summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanesh Mondegarian <daneshm90@gmail.com>2012-11-10 19:04:27 -0500
committerGerrit Code Review <gerrit@review.cyanogenmod.com>2012-11-12 11:30:31 -0800
commit4452f97951599857f485b07ad4beafcce5e4e81b (patch)
treed01a9fbc37911f848f8b8655e4efc5d845dbe817
parent5a6b835fb1b5b317b9fce99dfc07d1704cb7be37 (diff)
downloadpackages_apps_Contacts-jellybean-stable.tar.gz
packages_apps_Contacts-jellybean-stable.tar.bz2
packages_apps_Contacts-jellybean-stable.zip
Dialer : Fix T9 add to contactsjellybean-stable
Use activity context rather than application QuickContactBadge can only function with an activity context, in its current state, it crashes with : E/AndroidRuntime(12944): FATAL EXCEPTION: main E/AndroidRuntime(12944): android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? Patchset 2 : only use activity context for adapter Patchset 3: Get rid of mContext variable and rearrange parameters Change-Id: If6dec5a5e12e7006637331861e8d3d4275c31cd0
-rw-r--r--src/com/android/contacts/dialpad/DialpadFragment.java4
-rw-r--r--src/com/android/contacts/dialpad/T9SearchCache.java14
2 files changed, 9 insertions, 9 deletions
diff --git a/src/com/android/contacts/dialpad/DialpadFragment.java b/src/com/android/contacts/dialpad/DialpadFragment.java
index 5f7c4c724..eb86f71ec 100644
--- a/src/com/android/contacts/dialpad/DialpadFragment.java
+++ b/src/com/android/contacts/dialpad/DialpadFragment.java
@@ -829,7 +829,7 @@ public class DialpadFragment extends Fragment
if (length > 0) {
T9SearchResult result = mT9Search.search(mDigits.getText().toString());
if (mT9AdapterTop == null) {
- mT9AdapterTop = mT9Search.createT9Adapter(new ArrayList<ContactItem>());
+ mT9AdapterTop = mT9Search.createT9Adapter(getActivity(), new ArrayList<ContactItem>());
mT9AdapterTop.setNotifyOnChange(true);
} else {
mT9AdapterTop.clear();
@@ -837,7 +837,7 @@ public class DialpadFragment extends Fragment
if (result != null) {
if (mT9Adapter == null) {
- mT9Adapter = mT9Search.createT9Adapter(result.getResults());
+ mT9Adapter = mT9Search.createT9Adapter(getActivity(), result.getResults());
mT9Adapter.setNotifyOnChange(true);
} else {
mT9Adapter.clear();
diff --git a/src/com/android/contacts/dialpad/T9SearchCache.java b/src/com/android/contacts/dialpad/T9SearchCache.java
index db6b6b307..06888c383 100644
--- a/src/com/android/contacts/dialpad/T9SearchCache.java
+++ b/src/com/android/contacts/dialpad/T9SearchCache.java
@@ -508,8 +508,8 @@ public class T9SearchCache implements ComponentCallbacks2 {
return sb.toString();
}
- public T9Adapter createT9Adapter(ArrayList<ContactItem> items) {
- return new T9Adapter(items);
+ public T9Adapter createT9Adapter(Context context, ArrayList<ContactItem> items) {
+ return new T9Adapter(context, items);
}
protected class T9Adapter extends ArrayAdapter<ContactItem> {
@@ -519,10 +519,10 @@ public class T9SearchCache implements ComponentCallbacks2 {
private ContactPhotoManager mPhotoLoader;
private View mLoadingView;
- protected T9Adapter(ArrayList<ContactItem> items) {
- super(mContext, 0, items);
- mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- mPhotoLoader = ContactPhotoManager.getInstance(mContext);
+ protected T9Adapter(Context context, ArrayList<ContactItem> items) {
+ super(context, 0, items);
+ mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ mPhotoLoader = ContactPhotoManager.getInstance(context);
mItems = items;
}
@@ -550,7 +550,7 @@ public class T9SearchCache implements ComponentCallbacks2 {
ContactItem o = mItems.get(position);
if (o.nameEntries.isEmpty()) {
- holder.name.setText(mContext.getResources().getString(R.string.t9_add_to_contacts));
+ holder.name.setText(getContext().getResources().getString(R.string.t9_add_to_contacts));
holder.number.setVisibility(View.GONE);
holder.icon.setImageResource(R.drawable.ic_menu_add_field_holo_light);
holder.icon.assignContactFromPhone(o.number, true);