Bug 836803 - Ensure that even a single-element prompt is wrapped in a ScrollView. r=mfinkle
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 31 Jan 2013 14:05:49 -0500
changeset 120491 f75f99c52648bf9fe9c28089011833430dea0d5b
parent 120490 1ce8f535ff87099eeff0492079fa5bb12686477b
child 120492 a033cebb0e4acb68fd86f18d5a7449920ede252c
push id24256
push userryanvm@gmail.com
push dateFri, 01 Feb 2013 20:50:01 +0000
treeherdermozilla-central@4e7c92906a79 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs836803
milestone21.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 836803 - Ensure that even a single-element prompt is wrapped in a ScrollView. r=mfinkle
mobile/android/base/PromptService.java
--- a/mobile/android/base/PromptService.java
+++ b/mobile/android/base/PromptService.java
@@ -335,40 +335,42 @@ public class PromptService implements On
                     builder.setSingleChoiceItems(adapter, selectedIndex, this);
                 }
             } else {
                 builder.setAdapter(adapter, this);
                 mSelected = null;
             }
         } else if (length == 1) {
             try {
-                builder.setView(applyInputStyle(mInputs[0].getView()));
+                ScrollView view = new ScrollView(GeckoApp.mAppContext);
+                view.addView(mInputs[0].getView());
+                builder.setView(applyInputStyle(view));
             } catch(UnsupportedOperationException ex) {
                 // We cannot display these input widgets with this sdk version,
                 // do not display any dialog and finish the prompt now.
                 finishDialog("{\"button\": -1}");
                 return;
             }
         } else if (length > 1) {
-            LinearLayout linearLayout = new LinearLayout(GeckoApp.mAppContext);
-            linearLayout.setOrientation(LinearLayout.VERTICAL);
             try {
+                LinearLayout linearLayout = new LinearLayout(GeckoApp.mAppContext);
+                linearLayout.setOrientation(LinearLayout.VERTICAL);
                 for (int i = 0; i < length; i++) {
                     View content = mInputs[i].getView();
                     linearLayout.addView(content);
                 }
+                ScrollView view = new ScrollView(GeckoApp.mAppContext);
+                view.addView(linearLayout);
+                builder.setView(applyInputStyle(view));
             } catch(UnsupportedOperationException ex) {
                 // We cannot display these input widgets with this sdk version,
                 // do not display any dialog and finish the prompt now.
                 finishDialog("{\"button\": -1}");
                 return;
             }
-            ScrollView view = new ScrollView(GeckoApp.mAppContext);
-            view.addView(linearLayout);
-            builder.setView(applyInputStyle(view));
         }
 
         length = mButtons == null ? 0 : mButtons.length;
         if (length > 0) {
             builder.setPositiveButton(mButtons[0], this);
             if (length > 1) {
                 builder.setNeutralButton(mButtons[1], this);
                 if (length > 2) {