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 (isPrivate) { view.setPrivateMode((i == selIndex) ? false : true); } else { if (i == selIndex) view.resetTheme(); else if (mActivity.getLightweightTheme().isEnabled()) view.setTheme(mActivity.getLightweightTheme().isLightTheme()); else view.resetTheme(); } if (i == selIndex) continue; if (i == (selIndex - 1)) view.getBackground().setLevel(1); else if (i == (selIndex + 1)) view.getBackground().setLevel(2); else view.getBackground().setLevel(0); } if (selIndex == 0) findViewById(R.id.tab_widget_left).getBackground().setLevel(1); else findViewById(R.id.tab_widget_left).getBackground().setLevel(0); if (selIndex == (tabWidget.getTabCount() - 1)) findViewById(R.id.tab_widget_right).getBackground().setLevel(2); else findViewById(R.id.tab_widget_right).getBackground().setLevel(0); }
public void setTarget(String target) { mTarget = target; styleSelectedTab(); if (mTarget.equals(AwesomeBar.Target.CURRENT_TAB.name())) { Tab tab = Tabs.getInstance().getSelectedTab(); if (tab != null && tab.isPrivate()) mBackground.setPrivateMode(true); } }