merge fx-team to mozilla-central a=merge
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Fri, 17 Oct 2014 16:29:30 +0200
changeset 210857 4f4241be59e4745edccfaec76d2c878c3bf6cdac
parent 210853 4e9c5f29fc5ecb566402e5a3effe33cd20e56b85 (current diff)
parent 210856 c0d668591c904c012ccee89a7b05d415577a3677 (diff)
child 210879 51892b39597a0e4df693061c2ad2f1e6b25a8f62
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersmerge
milestone36.0a1
merge fx-team to mozilla-central a=merge
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f6135d6d53f470e82ed0621887d3d77817e10704
GIT binary patch
literal 341
zc%17D@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|wj^(N7l!{JxM1({$v_d#0*}aI
z1_o|n5N2eUHAey{$X?><>&kwQi&wyaXWE-{+CZU4o-U3d7N?h9G3+~JAkg}-eoaT4
zbB-&cs_6E_tp`#yb}$BISa4@*JQS*C7U(~wAS{!9qjcuXnr|ok-7a}tin<gNbYQ0n
ztEc_P`}&i&Ft%;1V<<~2d+ppHYS25sj=8|AD$U_ziX_VenFc9~sttTg7{7^0Yb9LF
zs*v2=a3!s5bINu<9*&u}gc&znySRIUBWGnZmxQVc_t%8T7K`8N-m$Iwd#3T`7AW+p
zr%z>GIhl7kXWNpyr@v00pfcg;g<0$$TedOnv*l=*8LOIWoE*nw@KHgNEhk#s;F&ys
fv})$hiW~3Rc5JU=esduV=vxL)S3j3^P6<r_@R)o~
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/layout/new_tablet_tabs_item_cell.xml
@@ -0,0 +1,59 @@
+<?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.tabs.TabsLayoutItemView xmlns:android="http://schemas.android.com/apk/res/android"
+                                           style="@style/TabsItem"
+                                           android:focusable="true"
+                                           android:id="@+id/info"
+                                           android:layout_width="wrap_content"
+                                           android:layout_height="wrap_content"
+                                           android:paddingTop="6dip"
+                                           android:paddingBottom="6dip"
+                                           android:paddingLeft="1dip"
+                                           android:paddingRight="1dip"
+                                           android:gravity="center"
+                                           android:orientation="vertical">
+
+    <LinearLayout android:layout_width="@dimen/new_tablet_tab_thumbnail_width"
+                  android:layout_height="wrap_content"
+                  android:orientation="horizontal"
+                  android:padding="3dip">
+
+        <TextView android:id="@+id/title"
+                  android:layout_width="0dip"
+                  android:layout_height="wrap_content"
+                  android:layout_weight="1.0"
+                  android:paddingTop="4dip"
+                  style="@style/TabRowTextAppearance"
+                  android:textSize="12sp"
+                  android:textColor="#FFFFFFFF"
+                  android:singleLine="true"
+                  android:duplicateParentState="true"/>
+
+        <ImageButton android:id="@+id/close"
+                     style="@style/TabsItemClose"
+                     android:layout_width="wrap_content"
+                     android:layout_height="match_parent"
+                     android:background="@drawable/action_bar_button_inverse"
+                     android:scaleType="center"
+                     android:contentDescription="@string/close_tab"
+                     android:src="@drawable/new_tablet_tab_close"/>
+
+    </LinearLayout>
+
+    <RelativeLayout android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:padding="3dp"
+                    android:background="@drawable/tab_thumbnail"
+                    android:duplicateParentState="true">
+
+        <org.mozilla.gecko.widget.ThumbnailView android:id="@+id/thumbnail"
+                                                android:layout_width="@dimen/new_tablet_tab_thumbnail_width"
+                                                android:layout_height="@dimen/new_tablet_tab_thumbnail_height"
+                                                android:src="@drawable/tab_thumbnail_default"/>
+
+    </RelativeLayout>
+
+</org.mozilla.gecko.tabs.TabsLayoutItemView>
--- a/mobile/android/base/resources/values-land/dimens.xml
+++ b/mobile/android/base/resources/values-land/dimens.xml
@@ -3,9 +3,10 @@
    - 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>
 
     <!-- Remote Tabs static view top padding. Less in landscape on phones. -->
     <dimen name="home_remote_tabs_top_padding">16dp</dimen>
 
+    <dimen name="new_tablet_tab_panel_grid_padding">48dp</dimen>
 </resources>
--- a/mobile/android/base/resources/values/dimens.xml
+++ b/mobile/android/base/resources/values/dimens.xml
@@ -113,16 +113,21 @@
     <dimen name="text_selection_handle_width">47dp</dimen>
     <dimen name="text_selection_handle_height">58dp</dimen>
     <dimen name="text_selection_handle_shadow">11dp</dimen>
     <dimen name="validation_message_height">50dp</dimen>
     <dimen name="validation_message_margin_top">6dp</dimen>
     <dimen name="url_bar_offset_left">32dp</dimen>
     <dimen name="history_tab_indicator_height">50dp</dimen>
 
+
+    <dimen name="new_tablet_tab_thumbnail_height">180dp</dimen>
+    <dimen name="new_tablet_tab_thumbnail_width">180dp</dimen>
+    <dimen name="new_tablet_tab_panel_grid_padding">24dp</dimen>
+
     <!-- PageActionButtons dimensions -->
     <dimen name="page_action_button_width">32dp</dimen>
 
     <!-- Banner -->
     <dimen name="home_banner_height">72dp</dimen>
 
     <!-- Icon Grid -->
     <dimen name="icongrid_columnwidth">128dp</dimen>
--- a/mobile/android/base/tabs/TabsGridLayout.java
+++ b/mobile/android/base/tabs/TabsGridLayout.java
@@ -11,18 +11,21 @@ import org.mozilla.gecko.animation.ViewH
 import org.mozilla.gecko.GeckoAppShell;
 import org.mozilla.gecko.GeckoEvent;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.Tab;
 import org.mozilla.gecko.tabs.TabsPanel.TabsLayout;
 import org.mozilla.gecko.Tabs;
 
 import android.content.Context;
+import android.content.res.Resources;
 import android.content.res.TypedArray;
 import android.util.AttributeSet;
+import android.util.TypedValue;
+import android.view.Gravity;
 import android.view.View;
 import android.widget.GridView;
 import android.view.ViewGroup;
 import android.widget.Button;
 
 /**
  * A tabs layout implementation for the tablet redesign (bug 1014156).
  * Expected to replace TabsListLayout once complete.
@@ -53,25 +56,37 @@ class TabsGridLayout extends GridView
 
         setRecyclerListener(new RecyclerListener() {
             @Override
             public void onMovedToScrapHeap(View view) {
                 TabsLayoutItemView item = (TabsLayoutItemView) view;
                 item.setThumbnail(null);
             }
         });
+
+        setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
+        setStretchMode(GridView.STRETCH_SPACING);
+        setGravity(Gravity.CENTER);
+        setNumColumns(GridView.AUTO_FIT);
+
+        final Resources resources = getResources();
+        final int columnWidth = resources.getDimensionPixelSize(R.dimen.new_tablet_tab_thumbnail_width);
+        setColumnWidth(columnWidth);
+
+        final int padding = resources.getDimensionPixelSize(R.dimen.new_tablet_tab_panel_grid_padding);
+        setPadding(padding, 0, padding, 0);
     }
 
     private class TabsGridLayoutAdapter extends TabsLayoutAdapter {
 
         final private Button.OnClickListener mCloseClickListener;
         final private View.OnClickListener mSelectClickListener;
 
         public TabsGridLayoutAdapter (Context context) {
-            super(context);
+            super(context, R.layout.new_tablet_tabs_item_cell);
 
             mCloseClickListener = new Button.OnClickListener() {
                 @Override
                 public void onClick(View v) {
                     TabsLayoutItemView itemView = (TabsLayoutItemView) v.getTag();
                     Tab tab = Tabs.getInstance().getTab(itemView.getTabId());
                     Tabs.getInstance().closeTab(tab);
                 }
--- a/mobile/android/base/tabs/TabsLayoutAdapter.java
+++ b/mobile/android/base/tabs/TabsLayoutAdapter.java
@@ -16,22 +16,24 @@ import android.widget.BaseAdapter;
 
 import java.util.ArrayList;
 
 // Adapter to bind tabs into a list
 public class TabsLayoutAdapter extends BaseAdapter {
     public static final String LOGTAG = "Gecko" + TabsLayoutAdapter.class.getSimpleName();
 
     private final Context mContext;
+    private final int mTabLayoutId;
     private ArrayList<Tab> mTabs;
     private final LayoutInflater mInflater;
 
-    public TabsLayoutAdapter (Context context) {
+    public TabsLayoutAdapter (Context context, int tabLayoutId) {
         mContext = context;
         mInflater = LayoutInflater.from(mContext);
+        mTabLayoutId = tabLayoutId;
     }
 
     final void setTabs (ArrayList<Tab> tabs) {
         mTabs = tabs;
         notifyDataSetChanged(); // Be sure to call this whenever mTabs changes.
     }
 
     final boolean removeTab (Tab tab) {
@@ -78,15 +80,15 @@ public class TabsLayoutAdapter extends B
             view = (TabsLayoutItemView) convertView;
         }
         final Tab tab = mTabs.get(position);
         bindView(view, tab);
         return view;
     }
 
     TabsLayoutItemView newView(int position, ViewGroup parent) {
-        return (TabsLayoutItemView) mInflater.inflate(R.layout.tabs_layout_item_view, parent, false);
+        return (TabsLayoutItemView) mInflater.inflate(mTabLayoutId, parent, false);
     }
 
     void bindView(TabsLayoutItemView view, Tab tab) {
         view.assignValues(tab);
     }
 }
\ No newline at end of file
--- a/mobile/android/base/tabs/TabsListLayout.java
+++ b/mobile/android/base/tabs/TabsListLayout.java
@@ -84,17 +84,17 @@ class TabsListLayout extends TwoWayView
                 item.setCloseVisible(true);
             }
         });
     }
 
     private class TabsListLayoutAdapter extends TabsLayoutAdapter {
         private final Button.OnClickListener mCloseOnClickListener;
         public TabsListLayoutAdapter (Context context) {
-            super(context);
+            super(context, R.layout.tabs_layout_item_view);
 
             mCloseOnClickListener = new Button.OnClickListener() {
                 @Override
                 public void onClick(View v) {
                     // The view here is the close button, which has a reference
                     // to the parent TabsLayoutItemView in it's tag, hence the getTag() call
                     TabsLayoutItemView item = (TabsLayoutItemView) v.getTag();
                     final int pos = (isVertical() ? item.getWidth() : 0 - item.getHeight());