summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Garnes <matt@cyngn.com>2015-02-23 11:28:05 -0800
committerMatt Garnes <matt@cyngn.com>2015-02-23 11:28:05 -0800
commitef8bf41f75de370a7d6d9b5435ed88782857d115 (patch)
tree666bc935df43db8cbd1e9b838cf381505cbdb7ae
parent5df4e52201fc95e8caaf76fc57f3672b35d974e5 (diff)
parent08981f519f42aad5eefb274df6f35d724a32019c (diff)
downloadpackages_apps_Contacts-ef8bf41f75de370a7d6d9b5435ed88782857d115.tar.gz
packages_apps_Contacts-ef8bf41f75de370a7d6d9b5435ed88782857d115.tar.bz2
packages_apps_Contacts-ef8bf41f75de370a7d6d9b5435ed88782857d115.zip
Merge CAF branch 'LA.BR.1.2.1_rb2.18' into caf/cm-12.0.
-rw-r--r--res/values/donottranslate_config.xml3
-rw-r--r--src/com/android/contacts/activities/MultiPickContactActivity.java4
-rw-r--r--src/com/android/contacts/group/GroupDetailFragment.java43
-rw-r--r--src/com/android/contacts/util/RCSUtil.java105
4 files changed, 91 insertions, 64 deletions
diff --git a/res/values/donottranslate_config.xml b/res/values/donottranslate_config.xml
index 5fc4f8970..a2fb1dad1 100644
--- a/res/values/donottranslate_config.xml
+++ b/res/values/donottranslate_config.xml
@@ -31,6 +31,9 @@
-->
<bool name="config_show_group_action_in_action_bar">false</bool>
+ <!-- configuration for show location -->
+ <bool name="config_show_location">true</bool>
+
<!-- Help URL pointing to main TOC for People. This is intentionally empty because
the overlay will fill this in during build time. -->
<string name="help_url_people_main"></string>
diff --git a/src/com/android/contacts/activities/MultiPickContactActivity.java b/src/com/android/contacts/activities/MultiPickContactActivity.java
index e066cda2e..e4f71b4ac 100644
--- a/src/com/android/contacts/activities/MultiPickContactActivity.java
+++ b/src/com/android/contacts/activities/MultiPickContactActivity.java
@@ -1386,7 +1386,9 @@ public class MultiPickContactActivity extends ListActivity implements
numberLabel = Phone.getDisplayLabel(context, callerNumberType,
callerNumberLabel);
} else {
- numberLabel = geocodedLocation;
+ if (context.getResources().getBoolean(R.bool.config_show_location)) {
+ numberLabel = geocodedLocation;
+ }
}
numberLabelText.setText(numberLabel);
numberLabelText.setVisibility(TextUtils.isEmpty(numberLabel)
diff --git a/src/com/android/contacts/group/GroupDetailFragment.java b/src/com/android/contacts/group/GroupDetailFragment.java
index 1d2d70d59..43dbed247 100644
--- a/src/com/android/contacts/group/GroupDetailFragment.java
+++ b/src/com/android/contacts/group/GroupDetailFragment.java
@@ -305,27 +305,40 @@ public class GroupDetailFragment extends Fragment implements OnScrollListener {
updateSize(data.getCount());
mAdapter.setContactCursor(data);
mMemberListView.setEmptyView(mEmptyView);
- // For starting RCS group-chat.
- StringBuilder sb = new StringBuilder();
- mGroupMembersPhonesList.clear();
- while(data.moveToNext()){
- Long id = data.getLong(0);
- String phoneNumber = RCSUtil.getPhoneforContactId(mContext, id);
- sb.append(phoneNumber).append(";");
- String[] groupMemberPhones = RCSUtil.getAllPhoneNumberFromContactId(mContext, id)
- .split(";");
- for (int i = 0 ; i < groupMemberPhones.length; i++) {
- mGroupMembersPhonesList.add(RCSUtil.getFormatNumber(groupMemberPhones[i]));
- }
- }
- Log.d(TAG,"mGroupMembersPhonesList:"+mGroupMembersPhonesList.toString());
- mGroupMembersPhones = sb.toString();
+ getGroupMemberPhoneNumber(data);
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {}
};
+ private void getGroupMemberPhoneNumber(final Cursor data) {
+ new Thread () {
+ @Override
+ public void run() {
+ // For starting RCS group-chat.
+ StringBuilder sb = new StringBuilder();
+ mGroupMembersPhonesList.clear();
+ while (data.moveToNext()) {
+ Long id = data.getLong(0);
+ String phoneNumber = RCSUtil.getPhoneforContactId(mContext,
+ id);
+ sb.append(phoneNumber).append(";");
+ String[] groupMemberPhones = RCSUtil
+ .getAllPhoneNumberFromContactId(mContext, id)
+ .split(";");
+ for (int i = 0; i < groupMemberPhones.length; i++) {
+ mGroupMembersPhonesList.add(RCSUtil
+ .getFormatNumber(groupMemberPhones[i]));
+ }
+ }
+ Log.d(TAG,"mGroupMembersPhonesList:"
+ + mGroupMembersPhonesList.toString());
+ mGroupMembersPhones = sb.toString();
+ }
+ }.start();
+ }
+
private void bindGroupMetaData(Cursor cursor) {
cursor.moveToPosition(-1);
if (cursor.moveToNext()) {
diff --git a/src/com/android/contacts/util/RCSUtil.java b/src/com/android/contacts/util/RCSUtil.java
index a630ac99a..b23e19516 100644
--- a/src/com/android/contacts/util/RCSUtil.java
+++ b/src/com/android/contacts/util/RCSUtil.java
@@ -2585,72 +2585,81 @@ public class RCSUtil {
public static String getPhoneforContactId(Context context, long contactId) {
- String phone = null;
+ String phone = "";
Cursor phonesCursor = null;
phonesCursor = RCSUtil.queryPhoneNumbers(context, contactId);
- if (phonesCursor == null) {
- return "";
- }
- if (phonesCursor.getCount() == 0) {
- // No valid number
- // signalError();
- return phone;
- } else if (phonesCursor.getCount() == 1) {
- // only one number, call it.
- phone = phonesCursor.getString(phonesCursor
- .getColumnIndex(Phone.NUMBER));
- } else {
- phonesCursor.moveToPosition(-1);
- boolean first = true;
- while (phonesCursor.moveToNext()) {
- if (first) {
- //
+ try {
+ if(null != phonesCursor) {
+ if (phonesCursor.getCount() == 0) {
+ // No valid number
+ // signalError();
+ if (!phonesCursor.isClosed()) {
+ phonesCursor.close();
+ }
+ return phone;
+ } else if (phonesCursor.getCount() == 1) {
+ // only one number, call it.
phone = phonesCursor.getString(phonesCursor
.getColumnIndex(Phone.NUMBER));
- first = false;
- }
- if (phonesCursor.getInt(phonesCursor.getColumnIndex
+ } else {
+ phonesCursor.moveToPosition(-1);
+ boolean first = true;
+ while (phonesCursor.moveToNext()) {
+ if (first) {
+ //
+ phone = phonesCursor.getString(phonesCursor
+ .getColumnIndex(Phone.NUMBER));
+ first = false;
+ }
+ if (phonesCursor.getInt(phonesCursor.getColumnIndex
- (Phone.IS_SUPER_PRIMARY)) != 0) {
- // Found super primary, call it.
- phone = phonesCursor.getString(phonesCursor
- .getColumnIndex(Phone.NUMBER));
- break;
+ (Phone.IS_SUPER_PRIMARY)) != 0) {
+ // Found super primary, call it.
+ phone = phonesCursor.getString(phonesCursor
+ .getColumnIndex(Phone.NUMBER));
+ break;
+ }
+ }
}
}
+ } finally {
+ if (null != phonesCursor) {
+ phonesCursor.close();
+ }
}
- phonesCursor.close();
return phone;
}
public static String getAllPhoneNumberFromContactId(Context context, long contactId) {
- String phone = null;
+ String phone = "";
Cursor phonesCursor = null;
StringBuilder sb = new StringBuilder();
phonesCursor = RCSUtil.queryPhoneNumbers(context, contactId);
- if (phonesCursor == null) {
- return "";
- }
- if (phonesCursor.getCount() == 0) {
- // No valid number
- // signalError();
- phonesCursor.close();
- return phone;
- } else if (phonesCursor.getCount() == 1) {
- // only one number, call it.
- phone = phonesCursor.getString(phonesCursor
- .getColumnIndex(Phone.NUMBER));
- } else {
- while (phonesCursor.moveToNext()) {
- //
- phone = phonesCursor.getString(phonesCursor
- .getColumnIndex(Phone.NUMBER));
- sb.append(phone).append(";");
+
+ try {
+ if (phonesCursor != null) {
+ if (phonesCursor.getCount() == 0) {
+ phone = "";
+ } else if (phonesCursor.getCount() == 1) {
+ // only one number, call it.
+ phone = phonesCursor.getString(phonesCursor
+ .getColumnIndex(Phone.NUMBER));
+ } else {
+ while (phonesCursor.moveToNext()) {
+ phone = phonesCursor.getString(phonesCursor
+ .getColumnIndex(Phone.NUMBER));
+ sb.append(phone).append(";");
+ }
+ phone = sb.toString();
+ }
}
- phone = sb.toString();
+ } finally {
+ if (null != phonesCursor) {
+ phonesCursor.close();
+ }
+
}
- phonesCursor.close();
return phone;
}