Bug 1007442 - Part 1: Add scrolling to remote tabs tray where applicable. r=bnicholson
authorMichael Comella <michael.l.comella@gmail.com>
Wed, 11 Jun 2014 14:31:10 -0700
changeset 188322 8ef009362d13c3fe164c865d8b9d9766767673b1
parent 188321 281e6fc177c45776ee98869d9e810d45a9de26d8
child 188323 1e480afce4b3def0cabfdc9d22f81cc0386683d8
push id26951
push useremorley@mozilla.com
push dateThu, 12 Jun 2014 14:07:43 +0000
treeherdermozilla-central@4f98802de6ce [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson
bugs1007442
milestone33.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 1007442 - Part 1: Add scrolling to remote tabs tray where applicable. r=bnicholson
mobile/android/base/resources/layout/remote_tabs_setup_panel.xml
mobile/android/base/resources/layout/remote_tabs_verification_panel.xml
mobile/android/base/tabspanel/RemoteTabsSetupPanel.java
mobile/android/base/tabspanel/RemoteTabsVerificationPanel.java
--- a/mobile/android/base/resources/layout/remote_tabs_setup_panel.xml
+++ b/mobile/android/base/resources/layout/remote_tabs_setup_panel.xml
@@ -1,48 +1,54 @@
 <?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/. -->
 
 <org.mozilla.gecko.tabspanel.RemoteTabsSetupPanel
-       xmlns:android="http://schemas.android.com/apk/res/android"
-       style="@style/RemoteTabsPanelChild"
-       android:layout_width="match_parent"
-       android:layout_height="match_parent"
-       android:visibility="gone">
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:visibility="gone">
 
-    <LinearLayout style="@style/RemoteTabsSection"
+    <LinearLayout android:id="@+id/remote_tabs_setup_containing_layout"
+                  style="@style/RemoteTabsPanelChild"
                   android:layout_width="match_parent"
-                  android:layout_height="wrap_content">
+                  android:layout_height="match_parent">
 
-       <TextView style="@style/RemoteTabsItem.TextAppearance.Header"
-                 android:layout_width="match_parent"
-                 android:layout_height="wrap_content"
-                 android:text="@string/fxaccount_getting_started_welcome_to_sync"/>
+        <LinearLayout style="@style/RemoteTabsSection"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content">
+
+           <TextView style="@style/RemoteTabsItem.TextAppearance.Header"
+                     android:layout_width="match_parent"
+                     android:layout_height="wrap_content"
+                     android:text="@string/fxaccount_getting_started_welcome_to_sync"/>
 
-       <TextView style="@style/RemoteTabsItem.TextAppearance"
-                 android:layout_width="match_parent"
-                 android:layout_height="wrap_content"
-                 android:text="@string/fxaccount_getting_started_description"/>
+           <TextView style="@style/RemoteTabsItem.TextAppearance"
+                     android:layout_width="match_parent"
+                     android:layout_height="wrap_content"
+                     android:text="@string/fxaccount_getting_started_description"/>
 
-    </LinearLayout>
+        </LinearLayout>
 
-    <LinearLayout style="@style/RemoteTabsSection"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content">
+        <LinearLayout style="@style/RemoteTabsSection"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content">
 
-        <Button android:id="@+id/remote_tabs_setup_get_started"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                style="@style/RemoteTabsItem.Button"
-                android:text="@string/fxaccount_getting_started_get_started"
-                android:layout_marginBottom="15dp"/>
+            <Button android:id="@+id/remote_tabs_setup_get_started"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    style="@style/RemoteTabsItem.Button"
+                    android:text="@string/fxaccount_getting_started_get_started"
+                    android:layout_marginBottom="15dp"/>
 
-        <TextView android:id="@+id/remote_tabs_setup_old_sync_link"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  style="@style/RemoteTabsItem.TextAppearance.Linkified"
-                  android:text="@string/fxaccount_getting_started_old_firefox"/>
+            <TextView android:id="@+id/remote_tabs_setup_old_sync_link"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      style="@style/RemoteTabsItem.TextAppearance.Linkified"
+                      android:text="@string/fxaccount_getting_started_old_firefox"/>
+
+        </LinearLayout>
 
     </LinearLayout>
 
 </org.mozilla.gecko.tabspanel.RemoteTabsSetupPanel>
--- a/mobile/android/base/resources/layout/remote_tabs_verification_panel.xml
+++ b/mobile/android/base/resources/layout/remote_tabs_verification_panel.xml
@@ -1,48 +1,54 @@
 <?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/. -->
 
 <org.mozilla.gecko.tabspanel.RemoteTabsVerificationPanel
-      xmlns:android="http://schemas.android.com/apk/res/android"
-      style="@style/RemoteTabsPanelChild"
-      android:layout_width="match_parent"
-      android:layout_height="match_parent"
-      android:visibility="gone">
-
-    <LinearLayout style="@style/RemoteTabsSection"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content">
-
-        <TextView style="@style/RemoteTabsItem.TextAppearance.Header.FXAccounts"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:text="@string/fxaccount_full_label"
-                  android:layout_marginBottom="0dp"/>
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:visibility="gone">
 
-        <TextView style="@style/RemoteTabsItem.TextAppearance.Header"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:text="@string/fxaccount_confirm_account_header"
-                  android:layout_marginTop="0dp"/>
-
-        <TextView android:id="@+id/remote_tabs_confirm_verification"
-                  style="@style/RemoteTabsItem.TextAppearance"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:text="@string/fxaccount_confirm_account_verification_link"/>
-
-    </LinearLayout>
-
-    <LinearLayout style="@style/RemoteTabsSection"
+    <LinearLayout android:id="@+id/remote_tabs_verification_containing_layout"
+                  style="@style/RemoteTabsPanelChild"
                   android:layout_width="match_parent"
                   android:layout_height="match_parent">
 
-        <TextView android:id="@+id/remote_tabs_confirm_resend"
-                  style="@style/RemoteTabsItem.TextAppearance.Linkified.Resend"
-                  android:layout_width="match_parent"
-                  android:text="@string/fxaccount_confirm_account_resend_email"/>
+        <LinearLayout style="@style/RemoteTabsSection"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content">
+
+            <TextView style="@style/RemoteTabsItem.TextAppearance.Header.FXAccounts"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:text="@string/fxaccount_full_label"
+                      android:layout_marginBottom="0dp"/>
+
+            <TextView style="@style/RemoteTabsItem.TextAppearance.Header"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:text="@string/fxaccount_confirm_account_header"
+                      android:layout_marginTop="0dp"/>
+
+            <TextView android:id="@+id/remote_tabs_confirm_verification"
+                      style="@style/RemoteTabsItem.TextAppearance"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:text="@string/fxaccount_confirm_account_verification_link"/>
+
+        </LinearLayout>
+
+        <LinearLayout style="@style/RemoteTabsSection"
+                      android:layout_width="match_parent"
+                      android:layout_height="match_parent">
+
+            <TextView android:id="@+id/remote_tabs_confirm_resend"
+                      style="@style/RemoteTabsItem.TextAppearance.Linkified.Resend"
+                      android:layout_width="match_parent"
+                      android:text="@string/fxaccount_confirm_account_resend_email"/>
+
+        </LinearLayout>
 
     </LinearLayout>
 
 </org.mozilla.gecko.tabspanel.RemoteTabsVerificationPanel>
--- a/mobile/android/base/tabspanel/RemoteTabsSetupPanel.java
+++ b/mobile/android/base/tabspanel/RemoteTabsSetupPanel.java
@@ -12,47 +12,54 @@ import org.mozilla.gecko.fxa.FirefoxAcco
 import org.mozilla.gecko.fxa.activities.FxAccountCreateAccountActivity;
 import org.mozilla.gecko.tabspanel.TabsPanel.PanelView;
 
 import android.content.Context;
 import android.content.Intent;
 import android.util.AttributeSet;
 import android.view.View;
 import android.widget.LinearLayout;
+import android.widget.ScrollView;
 
 /**
  * A tabs panel which allows a user to get started setting up a Firefox
  * Accounts account. Currently used as one sub-panel in a sequence
  * contained by the {@link RemoteTabsPanel}.
  */
-class RemoteTabsSetupPanel extends LinearLayout implements PanelView {
+class RemoteTabsSetupPanel extends ScrollView implements PanelView {
+    private LinearLayout containingLayout;
+
     private TabsPanel tabsPanel;
 
     public RemoteTabsSetupPanel(Context context, AttributeSet attrs) {
         super(context, attrs);
     }
 
     @Override
     protected void onFinishInflate() {
         super.onFinishInflate();
 
-        final View setupGetStartedButton = findViewById(R.id.remote_tabs_setup_get_started);
+        containingLayout = (LinearLayout) findViewById(R.id.remote_tabs_setup_containing_layout);
+
+        final View setupGetStartedButton =
+                containingLayout.findViewById(R.id.remote_tabs_setup_get_started);
         setupGetStartedButton.setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(final View v) {
                 final Context context = getContext();
                 // This Activity will redirect to the correct Activity if the
                 // account is no longer in the setup state.
                 final Intent intent = new Intent(context, FxAccountCreateAccountActivity.class);
                 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                 context.startActivity(intent);
             }
         });
 
-        final View setupOlderVersionLink = findViewById(R.id.remote_tabs_setup_old_sync_link);
+        final View setupOlderVersionLink =
+                containingLayout.findViewById(R.id.remote_tabs_setup_old_sync_link);
         setupOlderVersionLink.setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(final View v) {
                 final String url = FirefoxAccounts.getOldSyncUpgradeURL(
                         getResources(), Locale.getDefault());
                 Tabs.getInstance().loadUrlInTab(url);
                 if (tabsPanel != null) {
                     tabsPanel.autoHidePanel();
@@ -73,11 +80,11 @@ class RemoteTabsSetupPanel extends Linea
 
     @Override
     public void hide() {
         setVisibility(View.GONE);
     }
 
     @Override
     public boolean shouldExpand() {
-        return getOrientation() == LinearLayout.VERTICAL;
+        return containingLayout.getOrientation() == LinearLayout.VERTICAL;
     }
 }
--- a/mobile/android/base/tabspanel/RemoteTabsVerificationPanel.java
+++ b/mobile/android/base/tabspanel/RemoteTabsVerificationPanel.java
@@ -9,37 +9,42 @@ import org.mozilla.gecko.fxa.FirefoxAcco
 import org.mozilla.gecko.fxa.login.State;
 import org.mozilla.gecko.tabspanel.TabsPanel.PanelView;
 
 import android.content.Context;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.view.View;
 import android.widget.LinearLayout;
+import android.widget.ScrollView;
 import android.widget.TextView;
 
 /**
  * A tabs panel which allows a user to get resend the verification email
  * to confirm a Firefox Account. Currently used as one sub-panel in a sequence
  * contained by the {@link RemoteTabsPanel}.
  */
-class RemoteTabsVerificationPanel extends LinearLayout implements PanelView {
+class RemoteTabsVerificationPanel extends ScrollView implements PanelView {
     private static final String LOG_TAG = RemoteTabsVerificationPanel.class.getSimpleName();
 
+    private LinearLayout containingLayout;
+
     private TabsPanel tabsPanel;
 
     public RemoteTabsVerificationPanel(Context context, AttributeSet attrs) {
         super(context, attrs);
     }
 
     @Override
     protected void onFinishInflate() {
         super.onFinishInflate();
 
-        final View resendLink = findViewById(R.id.remote_tabs_confirm_resend);
+        containingLayout = (LinearLayout) findViewById(R.id.remote_tabs_setup_containing_layout);
+
+        final View resendLink = containingLayout.findViewById(R.id.remote_tabs_confirm_resend);
         resendLink.setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View v) {
                 final State accountState = FirefoxAccounts.getFirefoxAccountState(getContext());
                 final State.Action neededAction = accountState.getNeededAction();
                 if (accountState.getNeededAction() != State.Action.NeedsVerification) {
                     autoHideTabsPanelOnUnexpectedState("Account expected to need verification " +
                             "on resend, but action was " + neededAction + " instead.");
@@ -51,17 +56,17 @@ class RemoteTabsVerificationPanel extend
                     return;
                 }
             }
         });
     }
 
     private void refresh() {
         final TextView verificationView =
-                (TextView) findViewById(R.id.remote_tabs_confirm_verification);
+                (TextView) containingLayout.findViewById(R.id.remote_tabs_confirm_verification);
         final String email = FirefoxAccounts.getFirefoxAccountEmail(getContext());
         if (email == null) {
             autoHideTabsPanelOnUnexpectedState("Account email DNE on View refresh.");
             return;
         }
 
         final String text = getResources().getString(
                 R.string.fxaccount_confirm_account_verification_link, email);
@@ -103,11 +108,11 @@ class RemoteTabsVerificationPanel extend
 
     @Override
     public void hide() {
         setVisibility(View.GONE);
     }
 
     @Override
     public boolean shouldExpand() {
-        return getOrientation() == LinearLayout.VERTICAL;
+        return containingLayout.getOrientation() == LinearLayout.VERTICAL;
     }
 }