当前位置: 首页>>代码示例>>Java>>正文


Java ThemeManager.DARK属性代码示例

本文整理汇总了Java中org.holoeverywhere.ThemeManager.DARK属性的典型用法代码示例。如果您正苦于以下问题:Java ThemeManager.DARK属性的具体用法?Java ThemeManager.DARK怎么用?Java ThemeManager.DARK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.holoeverywhere.ThemeManager的用法示例。


在下文中一共展示了ThemeManager.DARK属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateOptionsMenu

@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;
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:20,代码来源:SwitchScreenPreference.java

示例2: resolveThemeForContext

@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);
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:12,代码来源:IAddonThemes.java

示例3: getTheme

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;
    }
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:11,代码来源:IAddonThemes.java

示例4: resolveThemeForContext

@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;
}
 
开发者ID:WassimBenltaief,项目名称:laposte-android,代码行数:49,代码来源:PreferenceInit.java


注:本文中的org.holoeverywhere.ThemeManager.DARK属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。