diff options
-rw-r--r-- | AndroidManifest.xml | 1 | ||||
-rw-r--r-- | src/com/android/dialer/DialtactsActivity.java | 6 | ||||
-rw-r--r-- | src/com/android/dialer/NewSearchFragment.java | 4 | ||||
-rw-r--r-- | src/com/android/dialer/dialpad/SmartDialCursorLoader.java | 36 | ||||
-rw-r--r-- | src/com/android/dialer/list/SmartDialNumberListAdapter.java | 12 |
5 files changed, 27 insertions, 32 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 91e228e82..178b3e824 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -20,6 +20,7 @@ <uses-permission android:name="android.permission.CALL_PRIVILEGED" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_CONTACTS" /> + <uses-permission android:name="android.permission.BIND_DIRECTORY_SEARCH" /> <uses-permission android:name="android.permission.READ_CALL_LOG" /> <uses-permission android:name="android.permission.WRITE_CALL_LOG" /> <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" /> diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 8cac17eb3..89e5b5a6b 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -176,6 +176,12 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } @Override + public void onCallNumberDirectly(String phoneNumber) { + Intent intent = CallUtil.getCallIntent(phoneNumber, getCallOrigin()); + startActivity(intent); + } + + @Override public void onShortcutIntentCreated(Intent intent) { Log.w(TAG, "Unsupported intent has come (" + intent + "). Ignoring."); } diff --git a/src/com/android/dialer/NewSearchFragment.java b/src/com/android/dialer/NewSearchFragment.java index 0ddee4207..e8e40d6aa 100644 --- a/src/com/android/dialer/NewSearchFragment.java +++ b/src/com/android/dialer/NewSearchFragment.java @@ -29,6 +29,10 @@ public class NewSearchFragment extends PhoneNumberPickerFragment { private OnListFragmentScrolledListener mActivityScrollListener; + public NewSearchFragment() { + setDirectorySearchEnabled(true); + } + @Override public void onAttach(Activity activity) { super.onAttach(activity); diff --git a/src/com/android/dialer/dialpad/SmartDialCursorLoader.java b/src/com/android/dialer/dialpad/SmartDialCursorLoader.java index 715f1e7cc..ee4a7a147 100644 --- a/src/com/android/dialer/dialpad/SmartDialCursorLoader.java +++ b/src/com/android/dialer/dialpad/SmartDialCursorLoader.java @@ -24,6 +24,7 @@ import android.provider.ContactsContract.CommonDataKinds.Phone; import android.telephony.PhoneNumberUtils; import android.util.Log; +import com.android.contacts.common.list.PhoneNumberListAdapter.PhoneQuery; import com.android.dialer.database.DialerDatabaseHelper; import com.android.dialer.database.DialerDatabaseHelper.ContactNumber; @@ -44,29 +45,6 @@ public class SmartDialCursorLoader extends AsyncTaskLoader<Cursor> { private String mQuery; private SmartDialNameMatcher mNameMatcher; - /** Constructs the columns of the cursor to be used. */ - public static class SmartDialPhoneQuery { - public static final String[] PROJECTION_PRIMARY = new String[] { - Phone._ID, // 0 - Phone.TYPE, // 1 - Phone.LABEL, // 2 - Phone.NUMBER, // 3 - Phone.CONTACT_ID, // 4 - Phone.LOOKUP_KEY, // 5 - Phone.PHOTO_ID, // 6 - Phone.DISPLAY_NAME_PRIMARY, // 7 - }; - - public static final int SMARTDIAL_ID = 0; - public static final int SMARTDIAL_TYPE = 1; - public static final int SMARTDIAL_LABEL = 2; - public static final int SMARTDIAL_NUMBER = 3; - public static final int SMARTDIAL_CONTACT_ID = 4; - public static final int SMARTDIAL_LOOKUP_KEY = 5; - public static final int SMARTDIAL_PHOTO_ID = 6; - public static final int SMARTDIAL_DISPLAY_NAME = 7; - } - public SmartDialCursorLoader(Context context) { super(context); mContext = context; @@ -107,10 +85,16 @@ public class SmartDialCursorLoader extends AsyncTaskLoader<Cursor> { } /** Constructs a cursor for the returned array of results. */ - final MatrixCursor cursor = new MatrixCursor(SmartDialPhoneQuery.PROJECTION_PRIMARY); + final MatrixCursor cursor = new MatrixCursor(PhoneQuery.PROJECTION_PRIMARY); + Object[] row = new Object[PhoneQuery.PROJECTION_PRIMARY.length]; for (ContactNumber contact : allMatches) { - cursor.addRow(new Object[] {contact.dataId, null, null, contact.phoneNumber, contact.id, - contact.lookupKey, contact.photoId, contact.displayName}); + row[PhoneQuery.PHONE_ID] = contact.dataId; + row[PhoneQuery.PHONE_NUMBER] = contact.phoneNumber; + row[PhoneQuery.CONTACT_ID] = contact.id; + row[PhoneQuery.LOOKUP_KEY] = contact.lookupKey; + row[PhoneQuery.PHOTO_ID] = contact.photoId; + row[PhoneQuery.DISPLAY_NAME] = contact.displayName; + cursor.addRow(row); } return cursor; } diff --git a/src/com/android/dialer/list/SmartDialNumberListAdapter.java b/src/com/android/dialer/list/SmartDialNumberListAdapter.java index 0413c4ee5..c5ce59af2 100644 --- a/src/com/android/dialer/list/SmartDialNumberListAdapter.java +++ b/src/com/android/dialer/list/SmartDialNumberListAdapter.java @@ -26,8 +26,8 @@ import android.util.Log; import com.android.contacts.common.list.ContactListItemView; import com.android.contacts.common.list.PhoneNumberListAdapter; +import com.android.contacts.common.list.PhoneNumberListAdapter.PhoneQuery; import com.android.dialer.dialpad.SmartDialCursorLoader; -import com.android.dialer.dialpad.SmartDialCursorLoader.SmartDialPhoneQuery; import com.android.dialer.dialpad.SmartDialNameMatcher; import com.android.dialer.dialpad.SmartDialPrefix; import com.android.dialer.dialpad.SmartDialMatchPosition; @@ -56,7 +56,7 @@ public class SmartDialNumberListAdapter extends PhoneNumberListAdapter{ */ public void configureLoader(SmartDialCursorLoader loader) { if (DEBUG) { - Log.v(TAG, "Congifugure Loader with query" + getQueryString()); + Log.v(TAG, "Configure Loader with query" + getQueryString()); } if (getQueryString() == null) { @@ -78,19 +78,19 @@ public class SmartDialNumberListAdapter extends PhoneNumberListAdapter{ protected void setHighlight(ContactListItemView view, Cursor cursor) { view.clearHighlightSequences(); - if (mNameMatcher.matches(cursor.getString(SmartDialPhoneQuery.SMARTDIAL_DISPLAY_NAME))) { + if (mNameMatcher.matches(cursor.getString(PhoneQuery.DISPLAY_NAME))) { final ArrayList<SmartDialMatchPosition> nameMatches = mNameMatcher.getMatchPositions(); for (SmartDialMatchPosition match:nameMatches) { view.addNameHighlightSequence(match.start, match.end); if (DEBUG) { - Log.v(TAG, cursor.getString(SmartDialPhoneQuery.SMARTDIAL_DISPLAY_NAME) + " " + + Log.v(TAG, cursor.getString(PhoneQuery.DISPLAY_NAME) + " " + mNameMatcher.getQuery() + " " + String.valueOf(match.start)); } } } final SmartDialMatchPosition numberMatch = mNameMatcher.matchesNumber(cursor.getString( - SmartDialPhoneQuery.SMARTDIAL_NUMBER)); + PhoneQuery.PHONE_NUMBER)); if (numberMatch != null) { view.addNumberHighlightSequence(numberMatch.start, numberMatch.end); } @@ -104,7 +104,7 @@ public class SmartDialNumberListAdapter extends PhoneNumberListAdapter{ public Uri getDataUri(int position) { Cursor cursor = ((Cursor)getItem(position)); if (cursor != null) { - long id = cursor.getLong(SmartDialPhoneQuery.SMARTDIAL_ID); + long id = cursor.getLong(PhoneQuery.PHONE_ID); return ContentUris.withAppendedId(ContactsContract.Data.CONTENT_URI, id); } else { Log.w(TAG, "Cursor was null in getDataUri() call. Returning null instead."); |