mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 816114: Awesomebar tabs title color should change with the themes. [r=mfinkle]
--HG-- extra : rebase_source : d544d0e2ee3925b89596296fdb18877215c4b7b4
This commit is contained in:
parent
7d913f06d9
commit
8b4843d99f
@ -20,10 +20,13 @@ import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.TabHost;
|
||||
import android.widget.TabWidget;
|
||||
|
||||
public class AwesomeBarTabs extends TabHost {
|
||||
public class AwesomeBarTabs extends TabHost
|
||||
implements LightweightTheme.OnChangeListener {
|
||||
private static final String LOGTAG = "GeckoAwesomeBarTabs";
|
||||
|
||||
private Context mContext;
|
||||
private GeckoActivity mActivity;
|
||||
|
||||
private boolean mInflated;
|
||||
private LayoutInflater mInflater;
|
||||
private OnUrlOpenListener mUrlOpenListener;
|
||||
@ -105,6 +108,8 @@ public class AwesomeBarTabs extends TabHost {
|
||||
Log.d(LOGTAG, "Creating AwesomeBarTabs");
|
||||
|
||||
mContext = context;
|
||||
mActivity = (GeckoActivity) context;
|
||||
|
||||
mInflated = false;
|
||||
mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
}
|
||||
@ -174,20 +179,50 @@ public class AwesomeBarTabs extends TabHost {
|
||||
filter("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
mActivity.getLightweightTheme().addListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
mActivity.getLightweightTheme().removeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLightweightThemeChanged() {
|
||||
styleSelectedTab();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLightweightThemeReset() {
|
||||
styleSelectedTab();
|
||||
}
|
||||
|
||||
private void styleSelectedTab() {
|
||||
int selIndex = mViewPager.getCurrentItem();
|
||||
TabWidget tabWidget = getTabWidget();
|
||||
boolean isPrivate = false;
|
||||
|
||||
if (mTarget != null && mTarget.equals(AwesomeBar.Target.CURRENT_TAB.name())) {
|
||||
Tab tab = Tabs.getInstance().getSelectedTab();
|
||||
if (tab != null)
|
||||
isPrivate = tab.isPrivate();
|
||||
}
|
||||
|
||||
for (int i = 0; i < tabWidget.getTabCount(); i++) {
|
||||
GeckoTextView view = (GeckoTextView) tabWidget.getChildTabViewAt(i);
|
||||
if (mTarget != null && mTarget.equals(AwesomeBar.Target.CURRENT_TAB.name())) {
|
||||
Tab tab = Tabs.getInstance().getSelectedTab();
|
||||
if (tab != null && tab.isPrivate()) {
|
||||
if (isPrivate) {
|
||||
view.setPrivateMode((i == selIndex) ? false : true);
|
||||
} else {
|
||||
if (i == selIndex)
|
||||
view.setPrivateMode(false);
|
||||
view.resetTheme();
|
||||
else if (mActivity.getLightweightTheme().isEnabled())
|
||||
view.setTheme(mActivity.getLightweightTheme().isLightTheme());
|
||||
else
|
||||
view.setPrivateMode(true);
|
||||
}
|
||||
view.resetTheme();
|
||||
}
|
||||
|
||||
if (i == selIndex)
|
||||
|
@ -10,6 +10,12 @@
|
||||
<!-- private browsing mode -->
|
||||
<item gecko:state_private="true" android:color="#FFDDDDDD" />
|
||||
|
||||
<!-- dark theme -->
|
||||
<item gecko:state_dark="true" android:color="#FFDDDDDD"/>
|
||||
|
||||
<!-- light theme -->
|
||||
<item gecko:state_light="true" android:color="#FF222222"/>
|
||||
|
||||
<!-- normal mode -->
|
||||
<item android:color="#FF222222"/>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user