本文整理汇总了Java中org.holoeverywhere.ThemeManager类的典型用法代码示例。如果您正苦于以下问题:Java ThemeManager类的具体用法?Java ThemeManager怎么用?Java ThemeManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ThemeManager类属于org.holoeverywhere包,在下文中一共展示了ThemeManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateOptionsMenu
import org.holoeverywhere.ThemeManager; //导入依赖的package包/类
@Override
boolean onCreateOptionsMenu(Menu menu) {
final MenuItem item = menu.add(Menu.NONE, android.R.id.button1, Menu.NONE, "");
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
int theme = ThemeManager.getThemeType(getDialog().getContext());
if (theme != ThemeManager.LIGHT) {
theme = ThemeManager.DARK;
}
LayoutInflater inflater = LayoutInflater.from(getDialog().getContext(), theme | PreferenceInit.THEME_FLAG);
View actionView = inflater.inflate(R.layout.preference_widget_switch_screen_bar);
Switch switchView = (Switch) actionView.findViewById(R.id.switchWidget);
switchView.setChecked(mChecked);
switchView.setTextOn(mSwitchOn);
switchView.setTextOff(mSwitchOff);
switchView.setOnCheckedChangeListener(mListener);
MenuItemCompat.setActionView(item, actionView);
return true;
}
示例2: setTheme
import org.holoeverywhere.ThemeManager; //导入依赖的package包/类
public synchronized void setTheme(int resid, boolean modifyGlobal) {
if (resid > ThemeManager._START_RESOURCES_ID) {
if (mLastThemeResourceId != resid) {
mActionBarContext = null;
super.setTheme(mLastThemeResourceId = resid);
}
} else {
if ((resid & ThemeManager.COLOR_SCHEME_MASK) == 0) {
resid &= ~ThemeManager.COLOR_SCHEME_MASK;
final int parentColorScheme = ThemeManager.getParentColorScheme(getIntent());
if (parentColorScheme != ThemeManager.INVALID) {
resid |= parentColorScheme;
} else {
resid |= ThemeManager.getDefaultTheme() & ThemeManager.COLOR_SCHEME_MASK;
}
}
setTheme(ThemeManager.getThemeResource(resid, modifyGlobal));
}
}
示例3: setTheme
import org.holoeverywhere.ThemeManager; //导入依赖的package包/类
public synchronized void setTheme(int resid, boolean modifyGlobal) {
if (resid > ThemeManager._START_RESOURCES_ID) {
if (mLastThemeResourceId != resid) {
mActionBarContext = null;
mMenuInflater = null;
super.setTheme(mLastThemeResourceId = resid);
}
} else {
if ((resid & ThemeManager.COLOR_SCHEME_MASK) == 0) {
int theme = ThemeManager.getTheme(getIntent(), false);
if (theme == 0) {
final android.app.Activity activity = getParent();
if (activity != null) {
theme = ThemeManager.getTheme(activity.getIntent(), false);
}
}
theme &= ThemeManager.COLOR_SCHEME_MASK;
if (theme != 0) {
resid |= theme;
}
}
setTheme(ThemeManager.getThemeResource(resid, modifyGlobal));
}
}
示例4: resolveThemeForContext
import org.holoeverywhere.ThemeManager; //导入依赖的package包/类
@Override
public int resolveThemeForContext(Context context, int invalidTheme) {
TypedArray a;
int preferenceTheme = (a = context.obtainStyledAttributes(new int[]{
R.attr.preferenceTheme
})).getResourceId(0, 0);
a.recycle();
if (preferenceTheme != 0) {
return preferenceTheme;
}
return ThemeManager.getThemeResource(ThemeManager.getThemeType(context) | THEME_FLAG, false);
}
示例5: resolveThemeForContext
import org.holoeverywhere.ThemeManager; //导入依赖的package包/类
@Override
public int resolveThemeForContext(Context context, int invalidTheme) {
int theme = ThemeManager.getThemeType(context);
if (theme == ThemeManager.INVALID) {
theme = invalidTheme & ThemeManager.getThemeMask();
if (theme == 0) {
theme = ThemeManager.DARK;
}
}
theme |= mThemeFlag;
return ThemeManager.getThemeResource(theme, false);
}
示例6: getTheme
import org.holoeverywhere.ThemeManager; //导入依赖的package包/类
public int getTheme(int themeType) {
if (themeType == ThemeManager.DARK) {
return mDarkTheme;
} else if (themeType == ThemeManager.LIGHT) {
return mLightTheme;
} else if (themeType == ThemeManager.MIXED) {
return mMixedTheme;
} else {
return 0;
}
}
示例7: setupThemes
import org.holoeverywhere.ThemeManager; //导入依赖的package包/类
@Override
public void setupThemes() {
if (mFlagOwner) {
ThemeManager.map(mThemeFlag | ThemeManager.DARK, mDarkTheme);
ThemeManager.map(mThemeFlag | ThemeManager.LIGHT, mLightTheme);
ThemeManager.map(mThemeFlag | ThemeManager.MIXED, mMixedTheme);
}
}
示例8: startActivity
import org.holoeverywhere.ThemeManager; //导入依赖的package包/类
@Override
public void startActivity(Intent intent, Bundle options) {
if (HoloEverywhere.ALWAYS_USE_PARENT_THEME) {
ThemeManager.startActivity(this, intent, options);
} else {
superStartActivity(intent, -1, options);
}
}
示例9: instanceState
import org.holoeverywhere.ThemeManager; //导入依赖的package包/类
public Bundle instanceState(Bundle savedInstanceState) {
if (savedInstanceState != null) {
return savedInstanceState;
}
Bundle extras = getIntent().getExtras();
if (extras != null && extras.containsKey(ThemeManager.KEY_INSTANCE_STATE)) {
return extras.getBundle(ThemeManager.KEY_INSTANCE_STATE);
}
return null;
}
示例10: getTheme
import org.holoeverywhere.ThemeManager; //导入依赖的package包/类
@Override
public Theme getTheme() {
if (mLastThemeResourceId == 0) {
setTheme(ThemeManager.getDefaultTheme());
}
return super.getTheme();
}
示例11: startActivityForResult
import org.holoeverywhere.ThemeManager; //导入依赖的package包/类
@Override
public void startActivityForResult(Intent intent, int requestCode,
Bundle options) {
if (HoloEverywhere.ALWAYS_USE_PARENT_THEME) {
ThemeManager.startActivity(this, intent, requestCode, options);
} else {
superStartActivity(intent, requestCode, options);
}
}
示例12: startActivityForResult
import org.holoeverywhere.ThemeManager; //导入依赖的package包/类
@Override
public void startActivityForResult(Intent intent, int requestCode,
Bundle options) {
if (HoloEverywhere.ALWAYS_USE_PARENT_THEME) {
ThemeManager.startActivity(this, intent, requestCode, options);
} else {
superStartActivity(intent, requestCode, options);
}
}
示例13: IAddonThemes
import org.holoeverywhere.ThemeManager; //导入依赖的package包/类
public IAddonThemes(final boolean createFlag) {
this(createFlag ? ThemeManager.makeNewFlag() : -1, createFlag);
if (createFlag) {
ThemeManager.registerThemeSetter(this);
}
}
示例14: onInit
import org.holoeverywhere.ThemeManager; //导入依赖的package包/类
/**
* Do not override this method. Use {@link #onPreInit(Holo, Bundle)} and
* {@link #onPostInit(Holo, Bundle)}
*/
protected void onInit(Holo config, Bundle savedInstanceState) {
if (mInited) {
throw new IllegalStateException("This instance was already inited");
}
mInited = true;
if (config == null) {
config = createConfig(savedInstanceState);
}
if (config == null) {
config = Holo.defaultConfig();
}
onPreInit(config, savedInstanceState);
if (!config.ignoreApplicationInstanceCheck && !(getApplication() instanceof Application)) {
boolean throwError = true;
if (config.allowMockApplicationInstance) {
try {
throwError = !(getApplication() instanceof MockApplication);
if (!throwError) {
Log.w("HoloEverywhere", "Application instance is MockApplication. Wow. Let's begin tests...");
}
} catch (Exception e) {
}
}
if (throwError) {
String text = "Application instance isn't HoloEverywhere.\n";
if (getApplication().getClass() == android.app.Application.class) {
text += "Put attr 'android:name=\"org.holoeverywhere.app.Application\"'" +
" in <application> tag of AndroidManifest.xml";
} else {
text += "Please sure that you extend " + getApplication().getClass() +
" from a org.holoeverywhere.app.Application";
}
throw new IllegalStateException(text);
}
}
getLayoutInflater().setFragmentActivity(this);
if (this instanceof Activity) {
final Activity activity = (Activity) this;
ThemeManager.applyTheme(activity, mLastThemeResourceId == 0);
if (!config.ignoreThemeCheck && ThemeManager.getThemeType(this) == ThemeManager.INVALID) {
throw new HoloThemeException(activity);
}
TypedArray a = obtainStyledAttributes(new int[]{android.R.attr.windowActionBarOverlay, R.attr.windowActionBarOverlay});
if (a.getBoolean(0, false) || a.getBoolean(1, false)) {
supportRequestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
}
a.recycle();
a = obtainStyledAttributes(new int[]{android.R.attr.windowActionModeOverlay, R.attr.windowActionBarOverlay});
if (a.getBoolean(0, false) || a.getBoolean(1, false)) {
supportRequestWindowFeature(Window.FEATURE_ACTION_MODE_OVERLAY);
}
a.recycle();
}
onPostInit(config, savedInstanceState);
lockAttaching();
}
示例15: resolveThemeForContext
import org.holoeverywhere.ThemeManager; //导入依赖的package包/类
@Override
public int resolveThemeForContext(Context context, int invalidTheme) {
int theme, mod = 0;
TypedValue outValue = new TypedValue();
TypedArray a;
(a = context.obtainStyledAttributes(new int[] {
R.attr.preferenceTheme
})).getValue(0, outValue);
a.recycle();
switch (outValue.type) {
case TypedValue.TYPE_REFERENCE:
if (new ContextThemeWrapper(context, theme = outValue.resourceId)
.obtainStyledAttributes(new int[] {
R.attr.holoTheme
}).getInt(0, 0) == 4) {
return theme;
}
break;
case TypedValue.TYPE_INT_DEC:
case TypedValue.TYPE_INT_HEX:
mod = outValue.resourceId;
break;
}
theme = THEME_FLAG;
if (context instanceof Activity) {
if (mod == 0 || mod == ThemeManager.getDefaultTheme()) {
mod = ThemeManager.getThemeType(context);
if (mod == PreferenceInit.THEME_FLAG) {
theme = mod;
mod = 0;
} else if (mod == ThemeManager.INVALID) {
mod = ThemeManager.getDefaultTheme() & ThemeManager.COLOR_SCHEME_MASK;
if (mod == 0) {
mod = ThemeManager.DARK;
}
}
}
if (mod > 0) {
theme |= mod & ThemeManager.COLOR_SCHEME_MASK;
}
} else {
theme |= ThemeManager.getDefaultTheme() & ThemeManager.COLOR_SCHEME_MASK;
}
theme = ThemeManager.getThemeResource(theme, false);
if (theme == ThemeManager.getDefaultTheme() || theme == 0) {
theme = sThemes.getDarkTheme();
}
return theme;
}