Bug 1007442 - Part 1: Add scrolling to remote tabs tray where applicable. r=bnicholson, a=lmandel
authorMichael Comella <michael.l.comella@gmail.com>
Wed, 11 Jun 2014 14:31:10 -0700
changeset 208236 44ef5ff8a390466dfdf87cee2eb7ab7fc0e84f75
parent 208235 75f28c2476327c40ef3436cf72f5f09cf8672379
child 208237 3b319d395f50612b8f1dbac6b3f53af4056e2c3f
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson, lmandel
bugs1007442
milestone32.0a2
Bug 1007442 - Part 1: Add scrolling to remote tabs tray where applicable. r=bnicholson, a=lmandel
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;
     }
 }