UI tweaks
Jeff Hamilton [Wed, 26 Jan 2011 23:32:29 +0000 (17:32 -0600)]
Change-Id: Iec3516551ed5cd7a2247ba0a02959d24474956f3

res/layout/edit_tag_activity.xml
res/layout/my_tag_activity.xml
src/com/android/apps/tag/MyTagList.java
src/com/android/apps/tag/TagList.java

index 6781961..703980d 100644 (file)
@@ -32,18 +32,21 @@ limitations under the License.
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_alignParentBottom="true"
+
+        android:orientation="horizontal"
+        style="@android:style/ButtonBar"
     >
         <Button
             android:id="@+id/save"
             android:text="@string/button_save"
-            android:layout_weight="0.5"
+            android:layout_weight="1"
             android:layout_width="match_parent"
             android:layout_height="wrap_content" />
 
         <Button
             android:id="@+id/cancel"
             android:text="@string/button_cancel"
-            android:layout_weight="0.5"
+            android:layout_weight="1"
             android:layout_width="match_parent"
             android:layout_height="wrap_content" />
 
index d0f199f..d7e2800 100644 (file)
@@ -119,21 +119,33 @@ limitations under the License.
         android:layout_height="0dip"
     />
 
-    <include layout="@layout/tag_divider" />
-
-    <!-- TODO: add this to end of list, instead. -->
     <!-- Control to add new tag. -->
-    <TextView
-        android:id="@+id/add_tag"
-        android:text="@string/add_tag"
-        android:textAppearance="?android:attr/textAppearanceMedium"
-        android:paddingLeft="8dip"
-        android:paddingRight="8dip"
-        android:paddingTop="16dip"
-        android:paddingBottom="16dip"
+    <LinearLayout
         android:layout_width="match_parent"
-        android:layout_height="wrap_content" />
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        style="@android:style/ButtonBar"
+    >
+
+        <View
+            android:layout_height="0dip"
+            android:layout_width="0dip"
+            android:layout_weight="1"
+        />
 
-    <include layout="@layout/tag_divider" />
+        <Button
+            android:id="@+id/add_tag"
+            android:layout_width="0dip"
+            android:layout_height="wrap_content"
+            android:layout_weight="2"
+            android:text="@string/add_tag"
+        />
+
+        <View
+            android:layout_height="0dip"
+            android:layout_width="0dip"
+            android:layout_weight="1"
+        />
+    </LinearLayout>
 </LinearLayout>
 
index 80e04e4..3ba03c8 100644 (file)
@@ -33,7 +33,6 @@ import android.content.Context;
 import android.content.DialogInterface;
 import android.content.DialogInterface.OnClickListener;
 import android.content.Intent;
-import android.content.SharedPreferences;
 import android.database.CharArrayBuffer;
 import android.database.Cursor;
 import android.net.Uri;
@@ -46,6 +45,7 @@ import android.os.Bundle;
 import android.util.Log;
 import android.view.ContextMenu;
 import android.view.ContextMenu.ContextMenuInfo;
+import android.view.ContextThemeWrapper;
 import android.view.LayoutInflater;
 import android.view.MenuInflater;
 import android.view.MenuItem;
@@ -385,6 +385,7 @@ public class MyTagList
             return;
         }
 
+        menu.setHeaderTitle(cursor.getString(TagQuery.COLUMN_TITLE));
         long id = cursor.getLong(TagQuery.COLUMN_ID);
         MenuInflater inflater = getMenuInflater();
         inflater.inflate(R.menu.my_tag_list_context_menu, menu);
@@ -472,9 +473,12 @@ public class MyTagList
     @Override
     protected Dialog onCreateDialog(int id, Bundle args) {
         if (id == DIALOG_ID_SELECT_ACTIVE_TAG) {
-            mSelectActiveTagDialog = new WeakReference<SelectActiveTagDialog>(
-                    new SelectActiveTagDialog(this, mAdapter.getCursor()));
-            return mSelectActiveTagDialog.get();
+            Context lightTheme = new ContextThemeWrapper(this, android.R.style.Theme_Light);
+            SelectActiveTagDialog dialog = new SelectActiveTagDialog(lightTheme,
+                    mAdapter.getCursor());
+            dialog.setInverseBackgroundForced(true);
+            mSelectActiveTagDialog = new WeakReference<SelectActiveTagDialog>(dialog);
+            return dialog;
         } else if (id == DIALOG_ID_ADD_NEW_TAG) {
             return new TagContentSelector(this, this);
         }
@@ -589,7 +593,7 @@ public class MyTagList
             super(context);
 
             setTitle(context.getResources().getString(R.string.choose_my_tag));
-            ListView list = new ListView(MyTagList.this);
+            ListView list = new ListView(context);
 
             mData = Lists.newArrayList();
             mSelectAdapter = new SimpleAdapter(
index f3d9c82..76f45a6 100644 (file)
@@ -61,7 +61,6 @@ public class TagList extends ListActivity implements OnClickListener {
         new TagLoaderTask().execute((Void[]) null);
         mAdapter = new TagAdapter(this);
         setListAdapter(mAdapter);
-        registerForContextMenu(getListView());
     }
 
     @Override