Bug 861314: Prompts crash on 2.2. [r=bnicholson] [CLOSED TREE]
authorSriram Ramasubramanian <sriram@mozilla.com>
Mon, 15 Apr 2013 15:06:42 -0700
changeset 129015 cad82c3b69bceb547a2627fdfb54d4ce14128a8b
parent 129014 9bef1ecd7ed3ce399a038dbf83b157223c8602cc
child 129016 098faa24c569d858bcbbc39e2d48f43668fde64d
push id24553
push userryanvm@gmail.com
push dateWed, 17 Apr 2013 16:44:13 +0000
treeherdermozilla-central@3607139bd503 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson
bugs861314
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 861314: Prompts crash on 2.2. [r=bnicholson] [CLOSED TREE]
mobile/android/base/Makefile.in
mobile/android/base/PromptService.java
mobile/android/base/resources/layout/autocomplete_list_item.xml
mobile/android/base/resources/layout/select_dialog_multichoice.xml
mobile/android/base/resources/layout/select_dialog_singlechoice.xml
mobile/android/base/resources/layout/simple_dropdown_item_1line.xml
mobile/android/base/resources/values-v11/styles.xml
mobile/android/base/resources/values/colors.xml
mobile/android/base/resources/values/styles.xml
mobile/android/base/resources/values/themes.xml
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -426,16 +426,18 @@ RES_LAYOUT = \
   res/layout/tabs_panel_header.xml \
   res/layout/tabs_panel_indicator.xml \
   res/layout/tabs_item_cell.xml \
   res/layout/tabs_item_row.xml \
   res/layout/text_selection_handles.xml \
   res/layout/list_item_header.xml \
   res/layout/select_dialog_list.xml \
   res/layout/select_dialog_multichoice.xml \
+  res/layout/select_dialog_singlechoice.xml \
+  res/layout/simple_dropdown_item_1line.xml \
   res/layout/abouthome_addon_row.xml \
   res/layout/abouthome_last_tabs_row.xml \
   res/layout/abouthome_section.xml \
   res/layout/abouthome_remote_tab_row.xml \
   res/layout/abouthome_topsite_item.xml \
   res/layout/validation_message.xml \
   res/layout/videoplayer.xml \
   $(NULL)
--- a/mobile/android/base/PromptService.java
+++ b/mobile/android/base/PromptService.java
@@ -198,17 +198,17 @@ public class PromptService implements On
                 }
 
                 mView = (View)input;
             } else if (mType.equals("menulist")) {
                 Spinner spinner = new Spinner(GeckoApp.mAppContext);
                 try {
                     String[] listitems = getStringArray(mJSONInput, "values");
                     if (listitems.length > 0) {
-                        ArrayAdapter<String> adapter = new ArrayAdapter<String>(GeckoApp.mAppContext, android.R.layout.simple_dropdown_item_1line, listitems);
+                        ArrayAdapter<String> adapter = new ArrayAdapter<String>(GeckoApp.mAppContext, R.layout.simple_dropdown_item_1line, listitems);
                         spinner.setAdapter(adapter);
                         int selectedIndex = getSafeInt(mJSONInput, "selected");
                         spinner.setSelection(selectedIndex);
                     }
                 } catch(Exception ex) { }
                 mView = (View)spinner;
             } else if (mType.equals("label")) {
                 // not really an input, but a way to add labels and such to the dialog
@@ -315,17 +315,17 @@ public class PromptService implements On
 
         int length = mInputs == null ? 0 : mInputs.length;
         if (aMenuList != null && aMenuList.length > 0) {
             int resourceId = android.R.layout.simple_list_item_1;
             if (mSelected != null && mSelected.length > 0) {
                 if (aMultipleSelection) {
                     resourceId = R.layout.select_dialog_multichoice;
                 } else {
-                    resourceId = android.R.layout.select_dialog_singlechoice;
+                    resourceId = R.layout.select_dialog_singlechoice;
                 }
             }
             PromptListAdapter adapter = new PromptListAdapter(GeckoApp.mAppContext, resourceId, aMenuList);
             if (mSelected != null && mSelected.length > 0) {
                 if (aMultipleSelection) {
                     adapter.listView = (ListView) sInflater.inflate(R.layout.select_dialog_list, null);
                     adapter.listView.setOnItemClickListener(this);
                     builder.setInverseBackgroundForced(true);
--- a/mobile/android/base/resources/layout/autocomplete_list_item.xml
+++ b/mobile/android/base/resources/layout/autocomplete_list_item.xml
@@ -1,15 +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/. -->
 
 <TextView xmlns:android="http://schemas.android.com/apk/res/android"
           android:layout_width="fill_parent"
           android:layout_height="32dip"
-          android:textAppearance="?android:attr/textAppearanceMediumInverse"
-          android:textColor="@color/autocomplete_listitem_text"
+          android:textAppearance="@style/TextAppearance.Medium"
           android:layout_gravity="center_vertical"
           android:paddingLeft="10dp"
           android:paddingRight="10dp"
           android:paddingTop="3dp"
           android:paddingBottom="3dp"/>
--- a/mobile/android/base/resources/layout/select_dialog_multichoice.xml
+++ b/mobile/android/base/resources/layout/select_dialog_multichoice.xml
@@ -13,9 +13,10 @@
      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"
+    android:textAppearance="@style/TextAppearance.Widget.TextView"
     style="@style/Widget.ListItem"/>
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/layout/select_dialog_singlechoice.xml
@@ -0,0 +1,24 @@
+<?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"
+    android:textAppearance="@style/TextAppearance.Widget.TextView"
+    style="@style/Widget.ListItem"
+    android:checkMark="?android:attr/listChoiceIndicatorSingle"
+    android:ellipsize="marquee"/>
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/layout/simple_dropdown_item_1line.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@android:id/text1"
+    style="?android:attr/dropDownItemStyle"
+    android:textAppearance="@style/TextAppearance.Widget.TextView"
+    android:singleLine="true"
+    android:layout_width="match_parent"
+    android:layout_height="?android:attr/listPreferredItemHeight"
+    android:ellipsize="marquee"/>
--- a/mobile/android/base/resources/values-v11/styles.xml
+++ b/mobile/android/base/resources/values-v11/styles.xml
@@ -10,16 +10,18 @@
         Please refer to values/styles.xml for default styles.
     -->
 
     <!--
         Base application styles. This could be overridden in other res/values-XXX/themes.xml.
     -->
     <style name="Widget.BaseButton" parent="android:style/Widget.Holo.Light.Button"/>
 
+    <style name="Widget.BaseDropDownItem" parent="android:style/Widget.Holo.Light.DropDownItem"/>
+
     <style name="Widget.BaseEditText" parent="android:style/Widget.Holo.Light.EditText"/>
 
     <style name="Widget.BaseListView" parent="android:style/Widget.Holo.ListView"/>
 
     <style name="Widget.BaseTextView" parent="android:style/Widget.Holo.Light.TextView"/>
 
 
     <!--
--- a/mobile/android/base/resources/values/colors.xml
+++ b/mobile/android/base/resources/values/colors.xml
@@ -54,17 +54,16 @@
 
   <!-- Highlight colors -->
   <color name="text_color_highlight">#FF9500</color>
   <color name="text_color_highlight_inverse">#D06BFF</color>
 
   <!-- Link colors -->
   <color name="text_color_link">#22629E</color>
 
-  <color name="autocomplete_listitem_text">#000000</color>
   <color name="splash_background">#000000</color>
   <color name="splash_msgfont">#ffffff</color>
   <color name="splash_urlfont">#000000</color>
   <color name="splash_content">#ffffff</color>
   <color name="doorhanger_text">#FF222222</color>
   <color name="doorhanger_link">#ACC4D5</color>
   <color name="validation_message_text">#ffffff</color>
   <color name="identity_verified">#FF3298FF</color>
--- a/mobile/android/base/resources/values/styles.xml
+++ b/mobile/android/base/resources/values/styles.xml
@@ -7,38 +7,48 @@
 
     <!--
         Base application styles. This could be overridden in other res/values-XXX/themes.xml.
     -->
     <style name="Widget"/>
 
     <style name="Widget.BaseButton" parent="android:style/Widget.Button"/>
 
+    <style name="Widget.BaseDropDownItem" parent="android:style/Widget.DropDownItem"/>
+
     <style name="Widget.BaseEditText" parent="android:style/Widget.EditText"/>
 
     <style name="Widget.BaseListLiew" parent="android:style/Widget.ListView"/>
 
     <style name="Widget.BaseTextView" parent="android:style/Widget.TextView"/>
 
     <!--
         Application styles. All customizations that are not specific
         to a particular API level can go here.
     -->
     <style name="Widget.Button" parent="Widget.BaseButton">
         <item name="android:textAppearance">@style/TextAppearance.Widget.Button</item>
     </style>
 
+    <style name="Widget.DropDownItem" parent="Widget.BaseDropDownItem">
+        <item name="android:textAppearance">@style/TextAppearance.Widget.DropDownItem</item>
+    </style>
+
     <style name="Widget.EditText" parent="Widget.BaseEditText">
         <item name="android:textAppearance">@style/TextAppearance.Widget.EditText</item>
     </style>
 
     <style name="Widget.TextView" parent="Widget.BaseTextView">
         <item name="android:textAppearance">@style/TextAppearance.Widget.TextView</item>
     </style>
 
+    <style name="Widget.TextView.SpinnerItem">
+        <item name="android:textAppearance">@style/TextAppearance.Widget.TextView</item>
+    </style>
+
     <style name="Widget.ListView" parent="Widget.BaseListView">
         <item name="android:divider">#D1D5DA</item>
         <item name="android:dividerHeight">1dp</item>
         <item name="android:cacheColorHint">@android:color/transparent</item>
         <item name="android:listSelector">@drawable/action_bar_button</item>
     </style>
 
     <style name="Widget.ExpandableListView" parent="Widget.ListView">
@@ -127,16 +137,20 @@
     </style>
 
     <style name="TextAppearance.Widget" />
 
     <style name="TextAppearance.Widget.Button" parent="TextAppearance.Small">
         <item name="android:textColor">@color/primary_text</item>
     </style>
 
+    <style name="TextAppearance.Widget.DropDownItem">
+        <item name="android:textColor">@color/primary_text</item>
+    </style>
+
     <style name="TextAppearance.Widget.EditText">
         <item name="android:textColor">@color/primary_text</item>
     </style>
 
     <style name="TextAppearance.Widget.TextView">
         <item name="android:textColor">@color/primary_text</item>
     </style>
 
--- a/mobile/android/base/resources/values/themes.xml
+++ b/mobile/android/base/resources/values/themes.xml
@@ -74,17 +74,20 @@
     <style name="Gecko.Dialog" parent="GeckoDialogBase"/>
 
     <!--
         Activity based themes.
     -->
     <style name="Gecko.App">
         <item name="android:windowBackground">@color/background_normal</item>
         <item name="android:buttonStyle">@style/Widget.Button</item>
+        <item name="android:dropDownItemStyle">@style/Widget.DropDownItem</item>
         <item name="android:editTextStyle">@style/Widget.EditText</item>
+        <item name="android:spinnerDropDownItemStyle">@style/TextAppearance.Widget.TextView</item>
+        <item name="android:spinnerItemStyle">@style/Widget.TextView.SpinnerItem</item>
         <item name="android:textViewStyle">@style/Widget.TextView</item>
     </style>
 
     <style name="Gecko.AwesomeBar" parent="GeckoAwesomeBarBase">
         <item name="android:listViewStyle">@style/Widget.ListView</item>
         <item name="android:expandableListViewStyle">@style/Widget.ExpandableListView</item>
     </style>