OSDN Git Service

Fixed: Make items selectable via track ball
authorDaniel Lehmann <lehmannd@google.com>
Tue, 23 Feb 2010 00:17:29 +0000 (16:17 -0800)
committerDaniel Lehmann <lehmannd@google.com>
Tue, 23 Feb 2010 00:17:29 +0000 (16:17 -0800)
Fixed: Set correct item in display order dialog

Change-Id: I040b33f782224a226a59687e23b0a479f1887c74

res/layout-finger/preference_with_more_button.xml
src/com/android/contacts/ContactOptionsActivity.java
src/com/android/contacts/ui/ContactsPreferencesActivity.java

index 8599cee..93b8d5b 100644 (file)
@@ -23,8 +23,6 @@
     android:background="@android:drawable/list_selector_background"
     android:orientation="horizontal"
     android:gravity="center_vertical"
-    android:focusable="true"
-    android:clickable="true"
     >
 
     <RelativeLayout
index f93ddf8..38090aa 100644 (file)
@@ -63,6 +63,7 @@ public class ContactOptionsActivity extends Activity implements View.OnClickList
         setContentView(R.layout.contact_options);
 
         View ringtoneLayout = findViewById(R.id.ringtone);
+        ringtoneLayout.setFocusable(true);
         ringtoneLayout.setOnClickListener(this);
         TextView label = (TextView)findViewById(R.id.label);
         label.setText(getString(R.string.label_ringtone));
index aa6aa14..d9491be 100644 (file)
@@ -162,35 +162,23 @@ public final class ContactsPreferencesActivity extends ExpandableListActivity im
         mSortOrderView = inflater.inflate(R.layout.preference_with_more_button, mList, false);
 
         View preferenceLayout = mSortOrderView.findViewById(R.id.preference);
-        preferenceLayout.setOnClickListener(new View.OnClickListener() {
-
-            public void onClick(View v) {
-                showDialog(DIALOG_SORT_ORDER);
-            }
-        });
 
         TextView label = (TextView)preferenceLayout.findViewById(R.id.label);
         label.setText(getString(R.string.display_options_sort_list_by));
 
         mSortOrderTextView = (TextView)preferenceLayout.findViewById(R.id.data);
-        mList.addHeaderView(mSortOrderView, null, false);
+        mList.addHeaderView(mSortOrderView, null, true);
     }
 
     private void addDisplayOrderPreferenceView(LayoutInflater inflater) {
         mDisplayOrderView = inflater.inflate(R.layout.preference_with_more_button, mList, false);
         View preferenceLayout = mDisplayOrderView.findViewById(R.id.preference);
-        preferenceLayout.setOnClickListener(new View.OnClickListener() {
-
-            public void onClick(View v) {
-                showDialog(DIALOG_DISPLAY_ORDER);
-            }
-        });
 
         TextView label = (TextView)preferenceLayout.findViewById(R.id.label);
         label.setText(getString(R.string.display_options_view_names_as));
 
         mDisplayOrderTextView = (TextView)preferenceLayout.findViewById(R.id.data);
-        mList.addHeaderView(mDisplayOrderView, null, false);
+        mList.addHeaderView(mDisplayOrderView, null, true);
     }
 
     private void addDivider(LayoutInflater inflater) {
@@ -295,7 +283,8 @@ public final class ContactsPreferencesActivity extends ExpandableListActivity im
                 break;
             case DIALOG_DISPLAY_ORDER:
                 setCheckedItem(dialog,
-                        mSortOrder == ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY ? 0 : 1);
+                        mDisplayOrder == ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY
+                                ? 0 : 1);
                 break;
         }
     }
@@ -814,11 +803,20 @@ public final class ContactsPreferencesActivity extends ExpandableListActivity im
      * are usually the global modifier checkboxes.
      */
     public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-        switch (view.getId()) {
-            case R.id.header_phones: {
-                mDisplayPhones.toggle();
-                break;
-            }
+        Log.d(TAG, "OnItemClick, position=" + position + ", id=" + id);
+        if (view == mHeaderPhones) {
+            mDisplayPhones.toggle();
+            return;
+        }
+        if (view == mDisplayOrderView) {
+            Log.d(TAG, "Showing Display Order dialog");
+            showDialog(DIALOG_DISPLAY_ORDER);
+            return;
+        }
+        if (view == mSortOrderView) {
+            Log.d(TAG, "Showing Sort Order dialog");
+            showDialog(DIALOG_SORT_ORDER);
+            return;
         }
     }