mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 862996: Put text headings back in the tab menu. [r=mfinkle]
This commit is contained in:
parent
3dc969fb2c
commit
3c30ac1bb1
@ -103,19 +103,14 @@ public class TabsPanel extends LinearLayout
|
||||
}
|
||||
});
|
||||
|
||||
ImageButton button;
|
||||
Button button;
|
||||
Resources resources = getContext().getResources();
|
||||
|
||||
mTabWidget = (IconTabWidget) findViewById(R.id.tab_widget);
|
||||
|
||||
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));
|
||||
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);
|
||||
|
||||
mTabWidget.setTabSelectionListener(this);
|
||||
}
|
||||
|
@ -3,12 +3,14 @@
|
||||
- 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">
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:gecko="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<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"/>
|
||||
android:divider="@drawable/tab_indicator_divider"
|
||||
gecko:display="icon"/>
|
||||
|
||||
</merge>
|
||||
|
@ -3,11 +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/. -->
|
||||
|
||||
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="@style/AddressBar.ImageButton"
|
||||
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"/>
|
||||
<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"/>
|
||||
|
@ -157,5 +157,12 @@
|
||||
<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>
|
||||
|
||||
</resources>
|
||||
|
||||
|
@ -7,15 +7,16 @@ 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.ImageButton;
|
||||
import android.widget.Button;
|
||||
import android.widget.TabWidget;
|
||||
|
||||
public class IconTabWidget extends TabWidget {
|
||||
private Context mContext;
|
||||
private OnTabChangedListener mListener;
|
||||
private boolean mIsIcon;
|
||||
|
||||
public static interface OnTabChangedListener {
|
||||
public void onTabChanged(int tabIndex);
|
||||
@ -23,12 +24,22 @@ public class IconTabWidget extends TabWidget {
|
||||
|
||||
public IconTabWidget(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mContext = context;
|
||||
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.IconTabWidget);
|
||||
int type = a.getInt(R.styleable.IconTabWidget_display, 0x00);
|
||||
a.recycle();
|
||||
|
||||
mIsIcon = (type == 0x01);
|
||||
}
|
||||
|
||||
public ImageButton addTab(int resId) {
|
||||
ImageButton button = (ImageButton) LayoutInflater.from(mContext).inflate(R.layout.tabs_panel_indicator, null);
|
||||
button.setImageResource(resId);
|
||||
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());
|
||||
}
|
||||
|
||||
addView(button);
|
||||
button.setOnClickListener(new TabClickListener(getTabCount() - 1));
|
||||
|
Loading…
Reference in New Issue
Block a user