Loading res/layout/row.xml +3 −1 Original line number Diff line number Diff line Loading @@ -18,11 +18,13 @@ <TextView android:id="@+id/rowName" android:layout_weight="0.5" android:gravity="center_vertical" android:layout_width="match_parent" android:layout_height="match_parent" /> <TextView android:id="@+id/rowNumber" android:layout_weight="0.5" android:gravity="center_vertical" android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout> Loading res/values/strings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ <string name="t9_state_summary">Enable T9 searching in dialer</string> <string name="t9_dial_click_title">Dial selected contact</string> <string name="t9_dial_click_summary">Dial the selected contact for T9</string> <string name="t9_add_to_contacts">Add to contacts</string> <string name="t9_map_row_2">2abcàáâäåɑæçǽćčá</string> <string name="t9_map_row_3">3deféèêë</string> <string name="t9_map_row_4">4ghiíìïîǵ</string> Loading src/com/android/contacts/dialpad/DialpadFragment.java +22 −18 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.app.Fragment; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.res.Resources; import android.database.Cursor; import android.graphics.Bitmap; Loading @@ -48,11 +47,9 @@ import android.telephony.PhoneNumberUtils; import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; import android.text.Editable; import android.text.Spannable; import android.text.TextUtils; import android.text.TextWatcher; import android.text.method.DialerKeyListener; import android.text.style.ForegroundColorSpan; import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; Loading @@ -73,7 +70,6 @@ import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.ListView; import android.widget.PopupMenu; import android.widget.QuickContactBadge; import android.widget.TextView; import android.widget.ToggleButton; import android.widget.ViewSwitcher; Loading Loading @@ -281,6 +277,7 @@ public class DialpadFragment extends Fragment mT9ListTop = (ListView) fragmentView.findViewById(R.id.t9listtop); if (mT9ListTop != null) { mT9ListTop.setOnItemClickListener(this); mT9ListTop.setTag(new ContactItem()); } mT9Toggle = (ToggleButton) fragmentView.findViewById(R.id.t9toggle); if (mT9Toggle != null) { Loading Loading @@ -750,6 +747,12 @@ public class DialpadFragment extends Fragment if (length > 0) { if (sT9Search != null) { T9SearchResult result = sT9Search.search(mDigits.getText().toString()); if (mT9AdapterTop == null) { mT9AdapterTop = sT9Search.new T9Adapter(getActivity(), 0, new ArrayList<ContactItem>(), getActivity().getLayoutInflater(), mPhotoLoader); mT9AdapterTop.setNotifyOnChange(true); } else { mT9AdapterTop.clear(); } if (result != null) { if (mT9Adapter == null) { mT9Adapter = sT9Search.new T9Adapter(getActivity(), 0, result.getResults(),getActivity().getLayoutInflater(), mPhotoLoader); Loading @@ -761,28 +764,24 @@ public class DialpadFragment extends Fragment if (mT9List.getAdapter() == null) { mT9List.setAdapter(mT9Adapter); } if (mT9AdapterTop == null) { mT9AdapterTop = sT9Search.new T9Adapter(getActivity(), 0, new ArrayList<ContactItem>(), getActivity().getLayoutInflater(), mPhotoLoader); mT9AdapterTop.setNotifyOnChange(true); } else { mT9AdapterTop.clear(); } mT9AdapterTop.add(result.getTopContact()); if (mT9ListTop.getAdapter() == null) { mT9ListTop.setAdapter(mT9AdapterTop); } mT9ListTop.setVisibility(View.VISIBLE); if (result.getNumResults()> 1) { mT9Toggle.setVisibility(View.VISIBLE); } else { mT9Toggle.setVisibility(View.GONE); } mT9Toggle.setTag(null); } else { mT9ListTop.setVisibility(View.INVISIBLE); mT9Toggle.setVisibility(View.INVISIBLE); ((ContactItem) mT9ListTop.getTag()).number = mDigits.getText().toString(); mT9AdapterTop.add((ContactItem) mT9ListTop.getTag()); mT9Toggle.setTag(new Boolean(true)); mT9Toggle.setVisibility(View.GONE); toggleT9(); } mT9ListTop.setVisibility(View.VISIBLE); if (mT9ListTop.getAdapter() == null) { mT9ListTop.setAdapter(mT9AdapterTop); } } } else { mT9ListTop.setVisibility(View.INVISIBLE); Loading Loading @@ -1373,7 +1372,12 @@ public class DialpadFragment extends Fragment if (parent == mT9List) { setFormattedDigits(mT9Adapter.getItem(position).number,null); } else { if (mT9Toggle.getTag() == null) { setFormattedDigits(mT9AdapterTop.getItem(position).number,null); } else { startActivity(getAddToContactIntent(mDigits.getText())); return; } } if (dialOnTap()) { dialButtonPressed(); Loading src/com/android/contacts/dialpad/T9Search.java +28 −21 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import java.util.Set; import android.content.Context; import android.database.Cursor; import android.graphics.Color; import android.net.Uri; import android.preference.PreferenceManager; import android.provider.ContactsContract.CommonDataKinds.Phone; Loading Loading @@ -294,8 +293,15 @@ class T9Search { holder = (ViewHolder) convertView.getTag(); } ContactItem o = mItems.get(position); if (o.name == null) { holder.name.setText(mContext.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); } else { holder.name.setText(o.name, TextView.BufferType.SPANNABLE); holder.number.setText(o.normalNumber + " (" + o.groupType + ")", TextView.BufferType.SPANNABLE); holder.number.setVisibility(View.VISIBLE); if (o.nameMatchId != -1) { Spannable s = (Spannable) holder.name.getText(); int nameStart = o.normalName.indexOf(mPrevInput); Loading @@ -315,6 +321,7 @@ class T9Search { else holder.icon.setImageResource(ContactPhotoManager.getDefaultAvatarResId(false, true)); holder.icon.assignContactFromPhone(o.number, true); } return convertView; } Loading Loading
res/layout/row.xml +3 −1 Original line number Diff line number Diff line Loading @@ -18,11 +18,13 @@ <TextView android:id="@+id/rowName" android:layout_weight="0.5" android:gravity="center_vertical" android:layout_width="match_parent" android:layout_height="match_parent" /> <TextView android:id="@+id/rowNumber" android:layout_weight="0.5" android:gravity="center_vertical" android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout> Loading
res/values/strings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ <string name="t9_state_summary">Enable T9 searching in dialer</string> <string name="t9_dial_click_title">Dial selected contact</string> <string name="t9_dial_click_summary">Dial the selected contact for T9</string> <string name="t9_add_to_contacts">Add to contacts</string> <string name="t9_map_row_2">2abcàáâäåɑæçǽćčá</string> <string name="t9_map_row_3">3deféèêë</string> <string name="t9_map_row_4">4ghiíìïîǵ</string> Loading
src/com/android/contacts/dialpad/DialpadFragment.java +22 −18 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.app.Fragment; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.res.Resources; import android.database.Cursor; import android.graphics.Bitmap; Loading @@ -48,11 +47,9 @@ import android.telephony.PhoneNumberUtils; import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; import android.text.Editable; import android.text.Spannable; import android.text.TextUtils; import android.text.TextWatcher; import android.text.method.DialerKeyListener; import android.text.style.ForegroundColorSpan; import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; Loading @@ -73,7 +70,6 @@ import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.ListView; import android.widget.PopupMenu; import android.widget.QuickContactBadge; import android.widget.TextView; import android.widget.ToggleButton; import android.widget.ViewSwitcher; Loading Loading @@ -281,6 +277,7 @@ public class DialpadFragment extends Fragment mT9ListTop = (ListView) fragmentView.findViewById(R.id.t9listtop); if (mT9ListTop != null) { mT9ListTop.setOnItemClickListener(this); mT9ListTop.setTag(new ContactItem()); } mT9Toggle = (ToggleButton) fragmentView.findViewById(R.id.t9toggle); if (mT9Toggle != null) { Loading Loading @@ -750,6 +747,12 @@ public class DialpadFragment extends Fragment if (length > 0) { if (sT9Search != null) { T9SearchResult result = sT9Search.search(mDigits.getText().toString()); if (mT9AdapterTop == null) { mT9AdapterTop = sT9Search.new T9Adapter(getActivity(), 0, new ArrayList<ContactItem>(), getActivity().getLayoutInflater(), mPhotoLoader); mT9AdapterTop.setNotifyOnChange(true); } else { mT9AdapterTop.clear(); } if (result != null) { if (mT9Adapter == null) { mT9Adapter = sT9Search.new T9Adapter(getActivity(), 0, result.getResults(),getActivity().getLayoutInflater(), mPhotoLoader); Loading @@ -761,28 +764,24 @@ public class DialpadFragment extends Fragment if (mT9List.getAdapter() == null) { mT9List.setAdapter(mT9Adapter); } if (mT9AdapterTop == null) { mT9AdapterTop = sT9Search.new T9Adapter(getActivity(), 0, new ArrayList<ContactItem>(), getActivity().getLayoutInflater(), mPhotoLoader); mT9AdapterTop.setNotifyOnChange(true); } else { mT9AdapterTop.clear(); } mT9AdapterTop.add(result.getTopContact()); if (mT9ListTop.getAdapter() == null) { mT9ListTop.setAdapter(mT9AdapterTop); } mT9ListTop.setVisibility(View.VISIBLE); if (result.getNumResults()> 1) { mT9Toggle.setVisibility(View.VISIBLE); } else { mT9Toggle.setVisibility(View.GONE); } mT9Toggle.setTag(null); } else { mT9ListTop.setVisibility(View.INVISIBLE); mT9Toggle.setVisibility(View.INVISIBLE); ((ContactItem) mT9ListTop.getTag()).number = mDigits.getText().toString(); mT9AdapterTop.add((ContactItem) mT9ListTop.getTag()); mT9Toggle.setTag(new Boolean(true)); mT9Toggle.setVisibility(View.GONE); toggleT9(); } mT9ListTop.setVisibility(View.VISIBLE); if (mT9ListTop.getAdapter() == null) { mT9ListTop.setAdapter(mT9AdapterTop); } } } else { mT9ListTop.setVisibility(View.INVISIBLE); Loading Loading @@ -1373,7 +1372,12 @@ public class DialpadFragment extends Fragment if (parent == mT9List) { setFormattedDigits(mT9Adapter.getItem(position).number,null); } else { if (mT9Toggle.getTag() == null) { setFormattedDigits(mT9AdapterTop.getItem(position).number,null); } else { startActivity(getAddToContactIntent(mDigits.getText())); return; } } if (dialOnTap()) { dialButtonPressed(); Loading
src/com/android/contacts/dialpad/T9Search.java +28 −21 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import java.util.Set; import android.content.Context; import android.database.Cursor; import android.graphics.Color; import android.net.Uri; import android.preference.PreferenceManager; import android.provider.ContactsContract.CommonDataKinds.Phone; Loading Loading @@ -294,8 +293,15 @@ class T9Search { holder = (ViewHolder) convertView.getTag(); } ContactItem o = mItems.get(position); if (o.name == null) { holder.name.setText(mContext.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); } else { holder.name.setText(o.name, TextView.BufferType.SPANNABLE); holder.number.setText(o.normalNumber + " (" + o.groupType + ")", TextView.BufferType.SPANNABLE); holder.number.setVisibility(View.VISIBLE); if (o.nameMatchId != -1) { Spannable s = (Spannable) holder.name.getText(); int nameStart = o.normalName.indexOf(mPrevInput); Loading @@ -315,6 +321,7 @@ class T9Search { else holder.icon.setImageResource(ContactPhotoManager.getDefaultAvatarResId(false, true)); holder.icon.assignContactFromPhone(o.number, true); } return convertView; } Loading