summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2013-08-14 01:07:30 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-08-14 01:07:31 +0000
commitc7d05be217de0c4fcb235591752990e1862ddc02 (patch)
tree67bc8f965f736ab8e6bc8cb29e48eaa5bc802b96
parent81d8b7d56109226a2231c480b63a9ca54d826668 (diff)
parentfce269a30e2ec112ea4c287d97e08ef7b3b31b89 (diff)
Merge "Clean up todos for dialer" into klp-dev
-rw-r--r--src/com/android/dialer/DialtactsActivity.java8
-rw-r--r--src/com/android/dialer/database/DialerDatabaseHelper.java6
-rw-r--r--src/com/android/dialer/dialpad/DialpadFragment.java16
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteFragment.java18
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java1
-rw-r--r--src/com/android/dialer/list/PhoneFavoritesTileAdapter.java11
6 files changed, 14 insertions, 46 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 93d31f3aa..bd2dbf3d7 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -68,8 +68,10 @@ import com.android.contacts.common.list.ContactListItemView;
import com.android.contacts.common.list.OnPhoneNumberPickerActionListener;
import com.android.contacts.common.list.PhoneNumberPickerFragment;
import com.android.dialer.calllog.CallLogActivity;
+import com.android.dialer.database.DialerDatabaseHelper;
import com.android.dialer.dialpad.DialpadFragment;
import com.android.dialer.dialpad.SmartDialNameMatcher;
+import com.android.dialer.dialpad.SmartDialPrefix;
import com.android.dialer.interactions.PhoneNumberInteraction;
import com.android.dialer.list.AllContactsActivity;
import com.android.dialer.list.PhoneFavoriteFragment;
@@ -165,6 +167,8 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
private String mSearchQuery;
+ private DialerDatabaseHelper mDialerDatabaseHelper;
+
/**
* Listener used when one of phone numbers in search UI is selected. This will initiate a
* phone call using the phone number.
@@ -280,6 +284,9 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
&& savedInstanceState == null) {
setupFilterText(intent);
}
+
+ mDialerDatabaseHelper = DialerDatabaseHelper.getInstance(this);
+ SmartDialPrefix.initializeNanpSettings(this);
}
@Override
@@ -289,6 +296,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
displayFragment(getIntent());
}
mFirstLaunch = false;
+ mDialerDatabaseHelper.startSmartDialUpdateThread();
}
@Override
diff --git a/src/com/android/dialer/database/DialerDatabaseHelper.java b/src/com/android/dialer/database/DialerDatabaseHelper.java
index a802825fc..3bea98070 100644
--- a/src/com/android/dialer/database/DialerDatabaseHelper.java
+++ b/src/com/android/dialer/database/DialerDatabaseHelper.java
@@ -293,7 +293,11 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper {
Log.v(TAG, "Getting Instance");
}
if (sSingleton == null) {
- sSingleton = new DialerDatabaseHelper(context, SMARTDIAL_DATABASE_NAME);
+ // Use application context instead of activity context because this is a singleton,
+ // and we don't want to leak the activity if the activity is not running but the
+ // dialer database helper is still doing work.
+ sSingleton = new DialerDatabaseHelper(context.getApplicationContext(),
+ SMARTDIAL_DATABASE_NAME);
}
return sSingleton;
}
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index fefbcc43c..82f537755 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -190,8 +190,6 @@ public class DialpadFragment extends Fragment
private ListView mDialpadChooser;
private DialpadChooserAdapter mDialpadChooserAdapter;
- private DialerDatabaseHelper mDialerDatabaseHelper;
-
/**
* Regular expression prohibiting manual phone call. Can be empty, which means "no rule".
*/
@@ -327,9 +325,6 @@ public class DialpadFragment extends Fragment
mContactsPrefs = new ContactsPreferences(getActivity());
mCurrentCountryIso = GeoUtil.getCurrentCountryIso(getActivity());
- mDialerDatabaseHelper = DialerDatabaseHelper.getInstance(getActivity());
- SmartDialPrefix.initializeNanpSettings(getActivity());
-
try {
mHaptic.init(getActivity(),
getResources().getBoolean(R.bool.config_enable_dialer_key_vibration));
@@ -674,10 +669,6 @@ public class DialpadFragment extends Fragment
// Prevent unnecessary confusion. Reset the press count anyway.
mDialpadPressCount = 0;
- // Initialize smart dialing state. This has to be done before anything is filled in before
- // the dialpad edittext to prevent entries from being loaded from a null cache.
- initializeSmartDialingState();
-
configureScreenFromIntent(getActivity());
stopWatch.lap("fdin");
@@ -1681,13 +1672,6 @@ public class DialpadFragment extends Fragment
return intent;
}
- private void initializeSmartDialingState() {
- // Handle smart dialing related state
- // TODO krelease: This should probably be moved to somewhere more appropriate, maybe
- // into DialtactsActivity
- mDialerDatabaseHelper.startSmartDialUpdateThread();
- }
-
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
diff --git a/src/com/android/dialer/list/PhoneFavoriteFragment.java b/src/com/android/dialer/list/PhoneFavoriteFragment.java
index b6a5fb43b..a1406d242 100644
--- a/src/com/android/dialer/list/PhoneFavoriteFragment.java
+++ b/src/com/android/dialer/list/PhoneFavoriteFragment.java
@@ -91,9 +91,6 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
if (DEBUG) Log.d(TAG, "ContactTileLoaderListener#onLoadFinished");
mContactTileAdapter.setContactCursor(data);
-
- // Show the filter header with "loading" state.
- mAccountFilterHeader.setVisibility(View.VISIBLE);
}
@Override
@@ -148,11 +145,6 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
private TextView mEmptyView;
private ListView mListView;
private View mShowAllContactsButton;
- /**
- * Layout containing {@link #mAccountFilterHeader}. Used to limit area being "pressed".
- */
- private FrameLayout mAccountFilterHeaderContainer;
- private View mAccountFilterHeader;
/**
* Layout used when contacts load is slower than expected and thus "loading" view should be
@@ -214,13 +206,6 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
mListView.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT);
mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
- // TODO krelease: Don't show this header anymore
- // Create the account filter header but keep it hidden until "all" contacts are loaded.
- mAccountFilterHeaderContainer = new FrameLayout(getActivity(), null);
- mAccountFilterHeader = inflater.inflate(R.layout.account_filter_header_for_phone_favorite,
- mListView, false);
- mAccountFilterHeaderContainer.addView(mAccountFilterHeader);
-
mLoadingView = inflater.inflate(R.layout.phone_loading_contacts, mListView, false);
mShowAllContactsButton = inflater.inflate(R.layout.show_all_contact_button, mListView,
false);
@@ -232,8 +217,7 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
});
mAdapter = new PhoneFavoriteMergedAdapter(getActivity(), mContactTileAdapter,
- mAccountFilterHeaderContainer, mCallLogAdapter, mLoadingView,
- mShowAllContactsButton);
+ mCallLogAdapter, mLoadingView, mShowAllContactsButton);
mListView.setAdapter(mAdapter);
diff --git a/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java b/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
index 0e5594ee5..ce2b6276e 100644
--- a/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
@@ -55,7 +55,6 @@ public class PhoneFavoriteMergedAdapter extends BaseAdapter {
public PhoneFavoriteMergedAdapter(Context context,
PhoneFavoritesTileAdapter contactTileAdapter,
- View accountFilterHeaderContainer,
CallLogAdapter callLogAdapter,
View loadingView,
View showAllContactsButton) {
diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
index 9234535af..3aa85e884 100644
--- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
@@ -536,17 +536,6 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter {
}
/**
- * Returns the "frequent header" position. Only available when STREQUENT or
- * STREQUENT_PHONE_ONLY is used for its display type.
- *
- * TODO krelease: We shouldn't need this method once we get rid of the frequent header
- * in the merged adapter
- */
- public int getFrequentHeaderPosition() {
- return getRowCount(mNumStarred);
- }
-
- /**
* Temporarily removes a contact from the list for UI refresh. Stores data for this contact
* in the back-up variable.
*