зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1076898
- Initial pass at Gridview visuals Initial pass at Gridview visuals (r=lucasr)
This commit is contained in:
Родитель
7ff01ce229
Коммит
e6f5550746
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 341 B |
|
@ -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>
|
|
@ -8,4 +8,5 @@
|
|||
<!-- 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>
|
||||
|
|
|
@ -118,6 +118,11 @@
|
|||
<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>
|
||||
|
||||
|
|
|
@ -16,8 +16,11 @@ 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;
|
||||
|
@ -58,6 +61,18 @@ class TabsGridLayout extends GridView
|
|||
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 {
|
||||
|
@ -66,7 +81,7 @@ class TabsGridLayout extends GridView
|
|||
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
|
||||
|
|
|
@ -21,12 +21,14 @@ 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) {
|
||||
|
@ -83,7 +85,7 @@ public class TabsLayoutAdapter extends BaseAdapter {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -89,7 +89,7 @@ class TabsListLayout extends TwoWayView
|
|||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче