summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorm0viefreak <m0viefreak.cm@googlemail.com>2011-12-20 06:25:35 +0100
committerm0viefreak <m0viefreak.cm@googlemail.com>2011-12-21 00:32:18 +0100
commit66414dd515c6dfc08f3e9e6a722bfeaf99f3023f (patch)
treeafdd8a1efb6815abccc94bdef0a310d5d1ce9d2c
parent0104281a40eb08c9065425013513906cee5a07d2 (diff)
downloadpackages_apps_Contacts-66414dd515c6dfc08f3e9e6a722bfeaf99f3023f.tar.gz
packages_apps_Contacts-66414dd515c6dfc08f3e9e6a722bfeaf99f3023f.tar.bz2
packages_apps_Contacts-66414dd515c6dfc08f3e9e6a722bfeaf99f3023f.zip
Dialpad: T9 Dialer - Fixes
- Added highlight for matching part of number/name in all entries in the drop down list - Replaced the QuickContactBadge and TextView items with a ListView like in the drop down but with only 1 element. This way the first entry and the drop down entries all look the same. This also adds the (mobile/home/...) indicator in the first item. - Some changes to the layout xml: * Reverted the height of the digit editbox to a fixed value. This should fix the cut off text on smaller resolutions. * Reduced the size of the dropdown arrow to match the height of the ListView item row (40dip) - call searchContacts() in onKey(), too, to make it work with hard-keyboards and the android soft-keyboard Patch Set 2: - If/else was swapped accidently Patch Set 3: - Fine tuned layout parameters: * Fixed mdpi dial pad * Limited size of mdpi digit box just like hdpi * Made first result entry fixed height to fit the large list below (almost looks like one continous list now) Patch Set 4: - Same as Patch Set 3, but for landscape Patch Set 5: - Remove unneded setNumber() method in T9Adapter, and use mPrevInput field of T9Search instead - Set cursor to the end of the digits input after selecting a number from the t9 search results - Prevent android soft keyboard from popping up and messing up the layout when clicking the digits edittext to move the cursor Patch Set 6: - Fixed toggle arrow not missing on ldpi devices (replaced 9patch graphics with fixed ones) - Remove unneeded drawable/t9result_state.xml Change-Id: I5867f82be089f77012b114536ae913fabf6c8b09
-rw-r--r--res/drawable/expander_close.9.pngbin753 -> 0 bytes
-rw-r--r--res/drawable/expander_close.pngbin0 -> 470 bytes
-rw-r--r--res/drawable/expander_close_pressed.9.pngbin3578 -> 0 bytes
-rw-r--r--res/drawable/expander_close_pressed.pngbin0 -> 1919 bytes
-rw-r--r--res/drawable/expander_open.9.pngbin821 -> 0 bytes
-rw-r--r--res/drawable/expander_open.pngbin0 -> 477 bytes
-rw-r--r--res/drawable/expander_open_pressed.9.pngbin3534 -> 0 bytes
-rw-r--r--res/drawable/expander_open_pressed.pngbin0 -> 1914 bytes
-rw-r--r--res/drawable/t9result_state.xml4
-rw-r--r--res/layout-finger/dialpad.xml5
-rw-r--r--res/layout-finger/twelve_key_dialer.xml34
-rw-r--r--res/layout-land-finger/twelve_key_dialer.xml37
-rw-r--r--res/layout-long-finger/twelve_key_dialer.xml34
-rw-r--r--res/layout-long-land-finger/twelve_key_dialer.xml37
-rw-r--r--src/com/android/contacts/T9Search.java26
-rw-r--r--src/com/android/contacts/TwelveKeyDialer.java100
16 files changed, 122 insertions, 155 deletions
diff --git a/res/drawable/expander_close.9.png b/res/drawable/expander_close.9.png
deleted file mode 100644
index f56ef3118..000000000
--- a/res/drawable/expander_close.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/expander_close.png b/res/drawable/expander_close.png
new file mode 100644
index 000000000..ae910d9f4
--- /dev/null
+++ b/res/drawable/expander_close.png
Binary files differ
diff --git a/res/drawable/expander_close_pressed.9.png b/res/drawable/expander_close_pressed.9.png
deleted file mode 100644
index 8137bfb79..000000000
--- a/res/drawable/expander_close_pressed.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/expander_close_pressed.png b/res/drawable/expander_close_pressed.png
new file mode 100644
index 000000000..00203085a
--- /dev/null
+++ b/res/drawable/expander_close_pressed.png
Binary files differ
diff --git a/res/drawable/expander_open.9.png b/res/drawable/expander_open.9.png
deleted file mode 100644
index d2e8ae851..000000000
--- a/res/drawable/expander_open.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/expander_open.png b/res/drawable/expander_open.png
new file mode 100644
index 000000000..1ae243ef9
--- /dev/null
+++ b/res/drawable/expander_open.png
Binary files differ
diff --git a/res/drawable/expander_open_pressed.9.png b/res/drawable/expander_open_pressed.9.png
deleted file mode 100644
index 23f570173..000000000
--- a/res/drawable/expander_open_pressed.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/expander_open_pressed.png b/res/drawable/expander_open_pressed.png
new file mode 100644
index 000000000..ac0e722e8
--- /dev/null
+++ b/res/drawable/expander_open_pressed.png
Binary files differ
diff --git a/res/drawable/t9result_state.xml b/res/drawable/t9result_state.xml
deleted file mode 100644
index a31764e4c..000000000
--- a/res/drawable/t9result_state.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-<item android:state_pressed="true"
- android:drawable="@drawable/btn_dial_textfield_pressed" />
-</selector>
diff --git a/res/layout-finger/dialpad.xml b/res/layout-finger/dialpad.xml
index 3e25fed2f..5ee6727bc 100644
--- a/res/layout-finger/dialpad.xml
+++ b/res/layout-finger/dialpad.xml
@@ -17,8 +17,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialpad"
android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="5"
+ android:layout_height="match_parent"
android:gravity="center_vertical">
<TableRow
android:layout_weight="1"
@@ -156,4 +155,4 @@
android:soundEffectsEnabled="false"
android:contentDescription="@string/description_image_button_pound" />
</TableRow>
-</TableLayout> \ No newline at end of file
+</TableLayout>
diff --git a/res/layout-finger/twelve_key_dialer.xml b/res/layout-finger/twelve_key_dialer.xml
index 2db9c0735..fbe5bef1b 100644
--- a/res/layout-finger/twelve_key_dialer.xml
+++ b/res/layout-finger/twelve_key_dialer.xml
@@ -29,7 +29,7 @@
<!-- TODO: Use a textAppearance to control the display of the number -->
<EditText android:id="@+id/digits"
android:layout_width="match_parent"
- android:layout_height="0dp"
+ android:layout_height="66dp"
android:gravity="center"
android:maxLines="1"
android:scrollHorizontally="true"
@@ -40,38 +40,28 @@
android:focusableInTouchMode="true"
android:editable="true"
android:cursorVisible="false"
- android:layout_weight="1"
+ android:layout_weight="0"
android:contentDescription="@string/description_digits_edittext"
/>
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="0px"
+ android:layout_height="wrap_content"
android:id="@+id/t9topbar"
android:layout_gravity="center"
android:gravity="center"
- android:layout_weight="1">
- <QuickContactBadge
- android:id="@+id/t9badge"
- android:layout_width="40dp"
- android:layout_marginLeft="5dp"
- android:layout_marginRight="5dp"
- android:layout_height="40dp"
- android:visibility="invisible"
- android:layout_centerVertical="true"
- android:focusable="true" />
- <TextView
- android:id="@+id/t9result"
- android:layout_weight="1"
- android:gravity="center"
+ android:layout_weight="0">
+ <ListView
android:layout_width="0dp"
- android:background="@drawable/t9result_state"
- android:clickable="true"
- android:layout_height="match_parent" />
+ android:id="@+id/t9listtop"
+ android:layout_weight="1"
+ android:visibility="gone"
+ android:scrollingCache="true"
+ android:layout_height="42dp" />
<ToggleButton
android:id="@+id/t9toggle"
- android:layout_width="48dp"
- android:layout_height="48dp"
+ android:layout_width="40dp"
+ android:layout_height="42dp"
android:visibility="invisible"
android:scaleType="centerInside"
android:layout_marginRight="5dp"
diff --git a/res/layout-land-finger/twelve_key_dialer.xml b/res/layout-land-finger/twelve_key_dialer.xml
index a7a569f19..ff6782e93 100644
--- a/res/layout-land-finger/twelve_key_dialer.xml
+++ b/res/layout-land-finger/twelve_key_dialer.xml
@@ -29,33 +29,22 @@
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="0px"
+ android:layout_height="wrap_content"
android:id="@+id/t9topbar"
android:layout_gravity="center"
android:gravity="center"
- android:layout_weight="0.3">
- <QuickContactBadge
- android:id="@+id/t9badge"
- android:layout_width="40dp"
- android:layout_marginLeft="5dp"
- android:layout_marginRight="5dp"
- android:layout_height="40dp"
- android:visibility="invisible"
- android:layout_centerVertical="true"
- android:focusable="true" />
- <TextView
- android:id="@+id/t9result"
- android:layout_weight="1"
- android:gravity="center"
- android:visibility="invisible"
+ android:layout_weight="0">
+ <ListView
android:layout_width="0dp"
- android:clickable="true"
- android:background="@drawable/t9result_state"
- android:layout_height="match_parent" />
+ android:layout_weight="1"
+ android:id="@+id/t9listtop"
+ android:visibility="gone"
+ android:scrollingCache="true"
+ android:layout_height="42dp" />
<ToggleButton
android:id="@+id/t9toggle"
- android:layout_width="48dp"
- android:layout_height="48dp"
+ android:layout_width="40dp"
+ android:layout_height="42dp"
android:visibility="invisible"
android:scaleType="centerInside"
android:layout_marginRight="5dp"
@@ -77,8 +66,8 @@
<EditText
android:id="@+id/digits"
android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1"
+ android:layout_height="54dp"
+ android:layout_weight="0"
android:layout_marginBottom="1dp"
android:layout_marginTop="1dp"
android:gravity="center"
@@ -108,4 +97,4 @@
android:layout_height="wrap_content"
android:footerDividersEnabled="true" />
</LinearLayout>
-</LinearLayout> \ No newline at end of file
+</LinearLayout>
diff --git a/res/layout-long-finger/twelve_key_dialer.xml b/res/layout-long-finger/twelve_key_dialer.xml
index 9f07301a1..964ecf9bd 100644
--- a/res/layout-long-finger/twelve_key_dialer.xml
+++ b/res/layout-long-finger/twelve_key_dialer.xml
@@ -28,7 +28,7 @@
<!-- TODO: Use a textAppearance to control the display of the number -->
<EditText android:id="@+id/digits"
android:layout_width="match_parent"
- android:layout_height="0dp"
+ android:layout_height="68dp"
android:gravity="center"
android:maxLines="1"
android:scrollHorizontally="true"
@@ -39,37 +39,27 @@
android:focusableInTouchMode="true"
android:editable="true"
android:cursorVisible="false"
- android:layout_weight="1"
+ android:layout_weight="0"
/>
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="0px"
+ android:layout_height="wrap_content"
android:id="@+id/t9topbar"
android:layout_gravity="center"
android:gravity="center"
- android:layout_weight="1">
- <QuickContactBadge
- android:id="@+id/t9badge"
- android:layout_width="40dp"
- android:layout_marginLeft="5dp"
- android:layout_marginRight="5dp"
- android:layout_height="40dp"
- android:visibility="invisible"
- android:layout_centerVertical="true"
- android:focusable="true" />
- <TextView
- android:id="@+id/t9result"
- android:layout_weight="1"
- android:gravity="center"
+ android:layout_weight="0">
+ <ListView
android:layout_width="0dp"
- android:background="@drawable/t9result_state"
- android:clickable="true"
- android:layout_height="match_parent" />
+ android:id="@+id/t9listtop"
+ android:layout_weight="1"
+ android:visibility="gone"
+ android:scrollingCache="true"
+ android:layout_height="42dp" />
<ToggleButton
android:id="@+id/t9toggle"
- android:layout_width="48dp"
- android:layout_height="48dp"
+ android:layout_width="40dp"
+ android:layout_height="42dp"
android:visibility="invisible"
android:scaleType="centerInside"
android:layout_marginRight="5dp"
diff --git a/res/layout-long-land-finger/twelve_key_dialer.xml b/res/layout-long-land-finger/twelve_key_dialer.xml
index e5417e91b..2e61210a7 100644
--- a/res/layout-long-land-finger/twelve_key_dialer.xml
+++ b/res/layout-long-land-finger/twelve_key_dialer.xml
@@ -29,33 +29,22 @@
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="0px"
+ android:layout_height="wrap_content"
android:id="@+id/t9topbar"
android:layout_gravity="center"
android:gravity="center"
- android:layout_weight="0.3">
- <QuickContactBadge
- android:id="@+id/t9badge"
- android:layout_width="40dp"
- android:layout_marginLeft="5dp"
- android:layout_marginRight="5dp"
- android:layout_height="40dp"
- android:visibility="invisible"
- android:layout_centerVertical="true"
- android:focusable="true" />
- <TextView
- android:id="@+id/t9result"
- android:layout_weight="1"
- android:gravity="center"
- android:visibility="invisible"
+ android:layout_weight="0">
+ <ListView
android:layout_width="0dp"
- android:clickable="true"
- android:background="@drawable/t9result_state"
- android:layout_height="match_parent" />
+ android:layout_weight="1"
+ android:id="@+id/t9listtop"
+ android:visibility="gone"
+ android:scrollingCache="true"
+ android:layout_height="42dp" />
<ToggleButton
android:id="@+id/t9toggle"
- android:layout_width="48dp"
- android:layout_height="48dp"
+ android:layout_width="40dp"
+ android:layout_height="42dp"
android:visibility="invisible"
android:scaleType="centerInside"
android:layout_marginRight="5dp"
@@ -77,8 +66,8 @@
<EditText
android:id="@+id/digits"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_height="68dp"
+ android:layout_weight="0"
android:layout_marginBottom="1dp"
android:layout_marginTop="1dp"
android:gravity="center"
@@ -108,4 +97,4 @@
android:layout_height="wrap_content"
android:footerDividersEnabled="true" />
</LinearLayout>
-</LinearLayout> \ No newline at end of file
+</LinearLayout>
diff --git a/src/com/android/contacts/T9Search.java b/src/com/android/contacts/T9Search.java
index 5cba2888a..a4913a5ce 100644
--- a/src/com/android/contacts/T9Search.java
+++ b/src/com/android/contacts/T9Search.java
@@ -26,6 +26,7 @@ import java.util.Set;
import android.content.ContentUris;
import android.content.Context;
+import android.graphics.Color;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@@ -34,6 +35,8 @@ import android.preference.PreferenceManager;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.Contacts;
import android.telephony.PhoneNumberUtils;
+import android.text.Spannable;
+import android.text.style.ForegroundColorSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -280,7 +283,7 @@ class T9Search {
return sb.toString();
}
- protected static class T9Adapter extends ArrayAdapter<ContactItem> {
+ protected class T9Adapter extends ArrayAdapter<ContactItem> {
private ArrayList<ContactItem> mItems;
private LayoutInflater mMenuInflate;
@@ -309,8 +312,23 @@ class T9Search {
}
ContactItem o = mItems.get(position);
- holder.name.setText(o.name);
- holder.number.setText(o.number + " (" + o.groupType + ")");
+
+ holder.name.setText(o.name, TextView.BufferType.SPANNABLE);
+ holder.number.setText(o.number + " (" + o.groupType + ")", TextView.BufferType.SPANNABLE);
+ if (o.nameMatchId != -1) {
+ Spannable s = (Spannable) holder.name.getText();
+ int nameStart = o.normalName.indexOf(mPrevInput);
+ s.setSpan(new ForegroundColorSpan(Color.WHITE),
+ nameStart, nameStart + mPrevInput.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
+ holder.name.setText(s);
+ }
+ if (o.numberMatchId != -1) {
+ Spannable s = (Spannable) holder.number.getText();
+ int numberStart = o.numberMatchId;
+ s.setSpan(new ForegroundColorSpan(Color.WHITE),
+ numberStart, numberStart + mPrevInput.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
+ holder.number.setText(s);
+ }
if (o.photo != null)
holder.icon.setImageBitmap(o.photo);
else
@@ -320,7 +338,7 @@ class T9Search {
return convertView;
}
- static class ViewHolder {
+ class ViewHolder {
TextView name;
TextView number;
QuickContactBadge icon;
diff --git a/src/com/android/contacts/TwelveKeyDialer.java b/src/com/android/contacts/TwelveKeyDialer.java
index 9147f0ac4..8710df97a 100644
--- a/src/com/android/contacts/TwelveKeyDialer.java
+++ b/src/com/android/contacts/TwelveKeyDialer.java
@@ -23,6 +23,8 @@ import com.android.internal.telephony.ITelephony;
import com.android.phone.CallLogAsync;
import com.android.phone.HapticFeedback;
+import java.util.ArrayList;
+
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
@@ -166,9 +168,9 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
private static T9Search sT9Search; // Static to avoid reloading when class is destroyed and recreated
private ToggleButton mT9Toggle;
private ListView mT9List;
- private TextView mT9Result;
- private QuickContactBadge mT9ResultBadge;
+ private ListView mT9ListTop;
private T9Adapter mT9Adapter;
+ private T9Adapter mT9AdapterTop;
private ViewSwitcher mT9Flipper;
private LinearLayout mT9Top;
@@ -260,16 +262,16 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
mDigits = (EditText) findViewById(R.id.digits);
mDigits.setKeyListener(DialerKeyListener.getInstance());
mDigits.setOnClickListener(this);
+ mDigits.setOnTouchListener(this);
mDigits.setOnKeyListener(this);
- mT9Result = (TextView) findViewById(R.id.t9result);
- if (mT9Result != null) {
- mT9Result.setOnClickListener(this);
- }
- mT9ResultBadge = (QuickContactBadge) findViewById(R.id.t9badge);
mT9List = (ListView) findViewById(R.id.t9list);
- if (mT9List!= null) {
+ if (mT9List != null) {
mT9List.setOnItemClickListener(this);
}
+ mT9ListTop = (ListView) findViewById(R.id.t9listtop);
+ if (mT9ListTop != null) {
+ mT9ListTop.setOnItemClickListener(this);
+ }
mT9Toggle = (ToggleButton) findViewById(R.id.t9toggle);
if (mT9Toggle != null) {
mT9Toggle.setOnClickListener(this);
@@ -621,37 +623,9 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
if (sT9Search != null) {
T9SearchResult result = sT9Search.search(mDigits.getText().toString());
if (result != null) {
- T9Search.ContactItem contact = result.getTopContact();
- mT9Result.setText(contact.name + " : " + contact.normalNumber, TextView.BufferType.SPANNABLE);
- Spannable WordtoSpan = (Spannable) mT9Result.getText();
- String normalizedInput = T9Search.removeNonDigits(mDigits.getText().toString());
- int normalizedLength = normalizedInput.length();
- if (contact.nameMatchId != -1) {
- int nameStart = contact.normalName.indexOf(normalizedInput);
- WordtoSpan.setSpan(new ForegroundColorSpan(getResources().getColor(android.R.color.white)), nameStart,
- nameStart + normalizedLength, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
- }
- if (contact.numberMatchId != -1) {
- int numberStart = contact.name.length() + 3 + contact.numberMatchId;
- WordtoSpan.setSpan(new ForegroundColorSpan(getResources().getColor(android.R.color.white)),
- numberStart, numberStart + normalizedLength, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
- }
- mT9Result.setText(WordtoSpan);
- mT9ResultBadge.assignContactFromPhone(contact.number, true);
- mT9ResultBadge.setTag(contact.number);
- if (contact.photo != null)
- mT9ResultBadge.setImageBitmap(contact.photo);
- else
- mT9ResultBadge.setImageResource(R.drawable.ic_contact_list_picture);
- if (result.getNumResults()> 1) {
- mT9Toggle.setVisibility(View.VISIBLE);
- } else {
- mT9Toggle.setVisibility(View.GONE);
- }
if (mT9Adapter == null) {
- mT9Adapter = new T9Adapter(this, 0, result.getResults(),getLayoutInflater());
+ mT9Adapter = sT9Search.new T9Adapter(this, 0, result.getResults(),getLayoutInflater());
mT9Adapter.setNotifyOnChange(true);
- mT9List.setAdapter(mT9Adapter);
} else {
mT9Adapter.clear();
for (ContactItem item : result.getResults()) {
@@ -661,18 +635,32 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
if (mT9List.getAdapter() == null) {
mT9List.setAdapter(mT9Adapter);
}
- mT9ResultBadge.setVisibility(View.VISIBLE);
- mT9Result.setVisibility(View.VISIBLE);
+
+ if (mT9AdapterTop == null) {
+ mT9AdapterTop = sT9Search.new T9Adapter(this, 0, new ArrayList<ContactItem>(),getLayoutInflater());
+ 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);
+ }
} else {
- mT9ResultBadge.setVisibility(View.INVISIBLE);
- mT9Result.setVisibility(View.INVISIBLE);
+ mT9ListTop.setVisibility(View.INVISIBLE);
mT9Toggle.setVisibility(View.INVISIBLE);
toggleT9();
}
}
} else {
- mT9ResultBadge.setVisibility(View.INVISIBLE);
- mT9Result.setVisibility(View.INVISIBLE);
+ mT9ListTop.setVisibility(View.INVISIBLE);
mT9Toggle.setVisibility(View.INVISIBLE);
toggleT9();
}
@@ -927,6 +915,7 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
dialButtonPressed();
return true;
}
+ searchContacts();
break;
}
return false;
@@ -1034,13 +1023,6 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
animateT9();
return;
}
- case R.id.t9result: {
- mDigits.setText(mT9ResultBadge.getTag().toString());
- if (dialOnTap()) {
- dialButtonPressed();
- }
- return;
- }
}
//Wysie: Set the "voicemail"/add button to be enabled/disabled according to if any number is displayed
@@ -1049,6 +1031,16 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
@Override
public boolean onTouch(View view, MotionEvent event) {
+ if (view == mDigits) {
+ // hack to prevent soft keyboard from appearing,
+ // while still allowing touch interaction, like
+ // cursor positioning and selection
+ int inType = mDigits.getInputType(); // back up the input type
+ mDigits.setInputType(android.text.InputType.TYPE_NULL); // disable soft input
+ mDigits.onTouchEvent(event); // call native handler
+ mDigits.setInputType(inType); // restore input type
+ return true; // consume touch event
+ }
if (event.getAction() == MotionEvent.ACTION_DOWN) {
vibrate();
}
@@ -1368,8 +1360,12 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
* Handle clicks from the dialpad chooser.
*/
public void onItemClick(AdapterView parent, View v, int position, long id) {
- if (parent == mT9List) {
- mDigits.setText(mT9Adapter.getItem(position).number);
+ if (parent == mT9List || parent == mT9ListTop) {
+ if (parent == mT9List)
+ mDigits.setText(mT9Adapter.getItem(position).number);
+ else
+ mDigits.setText(mT9AdapterTop.getItem(position).number);
+ mDigits.setSelection(mDigits.length());
if (dialOnTap()) {
dialButtonPressed();
}