mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-10 05:47:04 +00:00
Bug 874014: Revert back to icon based TabsPanel headers. [r=margaret]
--HG-- extra : rebase_source : e6410e0fec37c7386a8770fa243afda3f092eeec
This commit is contained in:
parent
75e013633c
commit
11504e0b54
@ -105,14 +105,19 @@ public class TabsPanel extends LinearLayout
|
||||
}
|
||||
});
|
||||
|
||||
Button button;
|
||||
ImageButton button;
|
||||
Resources resources = getContext().getResources();
|
||||
|
||||
mTabWidget = (IconTabWidget) findViewById(R.id.tab_widget);
|
||||
|
||||
button = mTabWidget.addTab(R.drawable.tabs_normal, R.string.tabs_normal);
|
||||
button = mTabWidget.addTab(R.drawable.tabs_private, R.string.tabs_private);
|
||||
button = mTabWidget.addTab(R.drawable.tabs_synced, R.string.tabs_synced);
|
||||
button = mTabWidget.addTab(R.drawable.tabs_normal);
|
||||
button.setContentDescription(resources.getString(R.string.tabs_normal));
|
||||
|
||||
button = mTabWidget.addTab(R.drawable.tabs_private);
|
||||
button.setContentDescription(resources.getString(R.string.tabs_private));
|
||||
|
||||
button = mTabWidget.addTab(R.drawable.tabs_synced);
|
||||
button.setContentDescription(resources.getString(R.string.tabs_synced));
|
||||
|
||||
mTabWidget.setTabSelectionListener(this);
|
||||
}
|
||||
|
@ -3,14 +3,12 @@
|
||||
- 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/. -->
|
||||
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:gecko="http://schemas.android.com/apk/res-auto">
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<Gecko.IconTabWidget android:id="@+id/tab_widget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:tabStripEnabled="false"
|
||||
android:divider="@drawable/tab_indicator_divider"
|
||||
gecko:display="icon"/>
|
||||
android:divider="@drawable/tab_indicator_divider"/>
|
||||
|
||||
</merge>
|
||||
|
@ -3,12 +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/. -->
|
||||
|
||||
<Button xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/browser_toolbar_height"
|
||||
android:minWidth="@dimen/tabs_panel_indicator_width"
|
||||
android:padding="@dimen/browser_toolbar_button_padding"
|
||||
android:background="@drawable/tabs_panel_indicator"
|
||||
android:textAppearance="@style/TextAppearance.Micro"
|
||||
android:textColor="#99FFFFFF"
|
||||
android:textStyle="bold"/>
|
||||
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="@dimen/tabs_panel_indicator_width"
|
||||
android:layout_height="@dimen/browser_toolbar_height"
|
||||
android:minWidth="@dimen/tabs_panel_indicator_width"
|
||||
android:paddingTop="@dimen/browser_toolbar_button_padding"
|
||||
android:paddingBottom="@dimen/browser_toolbar_button_padding"
|
||||
android:background="@drawable/tabs_panel_indicator"/>
|
||||
|
@ -171,13 +171,6 @@
|
||||
<attr name="android:listSelector"/>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="IconTabWidget">
|
||||
<attr name="display">
|
||||
<flag name="text" value="0x00" />
|
||||
<flag name="icon" value="0x01" />
|
||||
</attr>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="GeckoView">
|
||||
<attr name="url" format="string"/>
|
||||
</declare-styleable>
|
||||
|
@ -7,16 +7,14 @@ package org.mozilla.gecko.widget;
|
||||
import org.mozilla.gecko.R;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TabWidget;
|
||||
|
||||
public class IconTabWidget extends TabWidget {
|
||||
private OnTabChangedListener mListener;
|
||||
private boolean mIsIcon;
|
||||
|
||||
public static interface OnTabChangedListener {
|
||||
public void onTabChanged(int tabIndex);
|
||||
@ -24,22 +22,11 @@ public class IconTabWidget extends TabWidget {
|
||||
|
||||
public IconTabWidget(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.IconTabWidget);
|
||||
int type = a.getInt(R.styleable.IconTabWidget_display, 0x00);
|
||||
a.recycle();
|
||||
|
||||
mIsIcon = (type == 0x01);
|
||||
}
|
||||
|
||||
public Button addTab(int imageResId, int stringResId) {
|
||||
Button button = (Button) LayoutInflater.from(getContext()).inflate(R.layout.tabs_panel_indicator, null);
|
||||
if (mIsIcon) {
|
||||
button.setCompoundDrawablesWithIntrinsicBounds(imageResId, 0, 0, 0);
|
||||
button.setContentDescription(getContext().getString(stringResId));
|
||||
} else {
|
||||
button.setText(getContext().getString(stringResId).toUpperCase());
|
||||
}
|
||||
public ImageButton addTab(int resId) {
|
||||
ImageButton button = (ImageButton) LayoutInflater.from(getContext()).inflate(R.layout.tabs_panel_indicator, null);
|
||||
button.setImageResource(resId);
|
||||
|
||||
addView(button);
|
||||
button.setOnClickListener(new TabClickListener(getTabCount() - 1));
|
||||
|
Loading…
Reference in New Issue
Block a user