Bug 793197 - Use a custom list item style in our custom listViews. r=sriram
authorWes Johnston <wjohnston@mozilla.com>
Tue, 02 Oct 2012 18:58:01 -0700
changeset 109090 0b9c37de03a2b7cd7a9635f0ec77672ab8839444
parent 109089 acf91f25f22849bc97ad5b8126315f17df146691
child 109091 7c779b27a9cebd5ff246c32d99f32f7b6be797b2
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewerssriram
bugs793197
milestone18.0a1
Bug 793197 - Use a custom list item style in our custom listViews. r=sriram
mobile/android/base/Makefile.in
mobile/android/base/PromptService.java
mobile/android/base/resources/color/select_item_multichoice.xml
mobile/android/base/resources/layout/select_dialog_multichoice.xml
mobile/android/base/resources/values-v11/styles.xml
mobile/android/base/resources/values/styles.xml
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -354,16 +354,17 @@ RES_LAYOUT = \
   res/layout/tabs_counter.xml \
   res/layout/tabs_panel.xml \
   res/layout/tabs_panel_toolbar.xml \
   res/layout/tabs_panel_toolbar_menu.xml \
   res/layout/tabs_row.xml \
   res/layout/tabs_tray.xml \
   res/layout/list_item_header.xml \
   res/layout/select_dialog_list.xml \
+  res/layout/select_dialog_multichoice.xml \
   res/layout/abouthome_addon_row.xml \
   res/layout/abouthome_last_tabs_row.xml \
   res/layout/abouthome_promo_box.xml \
   res/layout/abouthome_section.xml \
   res/layout/abouthome_remote_tab_row.xml \
   res/layout/abouthome_topsite_item.xml \
   res/layout/validation_message.xml \
   $(NULL)
@@ -884,16 +885,17 @@ RES_DRAWABLE_XLARGE_XHDPI_V11 = \
   res/drawable-xlarge-xhdpi-v11/awesomebar_tab_right.9.png \
   res/drawable-xlarge-xhdpi-v11/menu.png \
   res/drawable-xlarge-xhdpi-v11/tabs_carat_contracted.png \
   res/drawable-xlarge-xhdpi-v11/tabs_carat_expanded.png \
   $(NULL)
 
 RES_COLOR = \
   res/color/menu_item_title.xml \
+  res/color/select_item_multichoice.xml \
   $(NULL)
 
 RES_MENU = \
   res/menu/awesomebar_contextmenu.xml \
   res/menu/gecko_app_menu.xml \
   res/menu/titlebar_contextmenu.xml \
   $(NULL)
 
--- a/mobile/android/base/PromptService.java
+++ b/mobile/android/base/PromptService.java
@@ -287,17 +287,17 @@ public class PromptService implements On
             builder.setMessage(aText);
         }
 
         int length = mInputs == null ? 0 : mInputs.length;
         if (aMenuList != null && aMenuList.length > 0) {
             int resourceId = android.R.layout.select_dialog_item;
             if (mSelected != null && mSelected.length > 0) {
                 if (aMultipleSelection) {
-                    resourceId = android.R.layout.select_dialog_multichoice;
+                    resourceId = R.layout.select_dialog_multichoice;
                 } else {
                     resourceId = android.R.layout.select_dialog_singlechoice;
                 }
             }
             PromptListAdapter adapter = new PromptListAdapter(GeckoApp.mAppContext, resourceId, aMenuList);
             if (mSelected != null && mSelected.length > 0) {
                 if (aMultipleSelection) {
                     adapter.listView = (ListView) mInflater.inflate(R.layout.select_dialog_list, null);
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/color/select_item_multichoice.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:state_enabled="false" android:color="#999" />
+    <item android:color="#000"/>
+
+</selector>
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/layout/select_dialog_multichoice.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@android:id/text1"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    style="@style/GeckoList.ListItem"/>
--- a/mobile/android/base/resources/values-v11/styles.xml
+++ b/mobile/android/base/resources/values-v11/styles.xml
@@ -1,14 +1,14 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
-<resources>
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
     
     <!--
         Only overriden styles for Honeycomb/Ice cream sandwich are specified here.
         Please refer to values/styles.xml for default styles.
     -->
 
     <!-- Lists in AwesomeBar -->
     <style name="GeckoList" parent="android:style/Widget.Holo.ListView">
@@ -17,16 +17,27 @@
         <item name="android:layout_weight">1</item>
         <item name="android:background">#EEF1F5</item>
         <item name="android:divider">#D1D5DA</item>
         <item name="android:dividerHeight">1dp</item>
         <item name="android:cacheColorHint">#EEF1F5</item>
         <item name="android:listSelector">@drawable/action_bar_button</item>
     </style>
 
+    <style name="GeckoList.ListItem">
+        <item name="android:textColor">@color/select_item_multichoice</item>
+        <item name="android:minHeight">?android:attr/listPreferredItemHeight</item>
+        <item name="android:textAppearance">?android:attr/textAppearanceLarge</item>
+        <item name="android:gravity">center_vertical</item>
+        <item name="android:paddingLeft">12dip</item>
+        <item name="android:paddingRight">7dip</item>
+        <item name="android:checkMark">?android:attr/listChoiceIndicatorMultiple</item>
+        <item name="android:ellipsize">marquee</item>
+    </style>
+
     <!-- AwesomeBar -->
     <style name="AwesomeBar">
         <item name="android:layout_width">fill_parent</item>
         <item name="android:layout_height">@dimen/browser_toolbar_height</item>
         <item name="android:orientation">horizontal</item>
     </style>
 
     <!-- Lists in AwesomeBar -->
--- a/mobile/android/base/resources/values/styles.xml
+++ b/mobile/android/base/resources/values/styles.xml
@@ -6,16 +6,29 @@
 <resources>
 
     <!-- Layout -->
     <style name="Layout">
         <item name="android:layout_width">fill_parent</item>
         <item name="android:layout_height">fill_parent</item>
     </style>
 
+    <style name="GeckoList" parent="android:style/Widget.ListView">
+    </style>
+
+    <style name="GeckoList.ListItem">
+        <item name="android:minHeight">?android:attr/listPreferredItemHeight</item>
+        <item name="android:textAppearance">?android:attr/textAppearanceLargeInverse</item>
+        <item name="android:gravity">center_vertical</item>
+        <item name="android:paddingLeft">12dip</item>
+        <item name="android:paddingRight">7dip</item>
+        <item name="android:checkMark">?android:attr/listChoiceIndicatorMultiple</item>
+        <item name="android:ellipsize">marquee</item>
+    </style>
+
     <!-- Horizontal Layout -->
     <style name="Layout.Horizontal">
         <item name="android:orientation">horizontal</item>
     </style>
 
     <!-- Vertical Layout -->
     <style name="Layout.Vertical">
         <item name="android:orientation">vertical</item>