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


Java ThemeManager.INVALID属性代码示例

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


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

示例1: setTheme

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

/**
 * 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();
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:60,代码来源:_HoloActivity.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

示例5: onInit

/**
 * 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)) {
        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) {
        Activity activity = (Activity) this;
        if (config.requireRoboguice) {
            activity.addon(Activity.ADDON_ROBOGUICE);
        }
        if (config.requireSlider) {
            activity.addon(Activity.ADDON_SLIDER);
        }
        if (config.requireSherlock) {
            activity.addonSherlock();
        }
        final SparseIntArray windowFeatures = config.windowFeatures;
        if (windowFeatures != null) {
            for (int i = 0; i < windowFeatures.size(); i++) {
                if (windowFeatures.valueAt(i) > 0) {
                    requestWindowFeature((long) windowFeatures.keyAt(i));
                }
            }
        }
        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)) {
            requestWindowFeature((long) Window.FEATURE_ACTION_BAR_OVERLAY);
        }
        a.recycle();
    }
    onPostInit(config, savedInstanceState);
    lockAttaching();
}
 
开发者ID:WassimBenltaief,项目名称:laposte-android,代码行数:62,代码来源:_HoloActivity.java

示例6: onInit

/**
 * 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)) {
        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) {
        Activity activity = (Activity) this;
        if (config.requireRoboguice) {
            activity.addon(Activity.ADDON_ROBOGUICE);
        }
        if (config.requireSlider) {
            activity.addon(Activity.ADDON_SLIDER);
        }
        if (config.requireSherlock) {
            activity.addonSherlock();
        }
        final SparseIntArray windowFeatures = config.windowFeatures;
        if (windowFeatures != null) {
            for (int i = 0; i < windowFeatures.size(); i++) {
                if (windowFeatures.valueAt(i) > 0) {
                    requestWindowFeature((long) windowFeatures.keyAt(i));
                }
            }
        }
        boolean forceThemeApply = isForceThemeApply();
        if (config.forceThemeApply) {
            setForceThemeApply(forceThemeApply = true);
        }
        if (mLastThemeResourceId == 0) {
            forceThemeApply = true;
        }
        ThemeManager.applyTheme(activity, forceThemeApply);
        if (!config.ignoreThemeCheck && ThemeManager.getThemeType(this) == ThemeManager.INVALID) {
            throw new HoloThemeException(activity);
        }
    }
    onPostInit(config, savedInstanceState);
    lockAttaching();
}
 
开发者ID:antonyt,项目名称:TflTravelAlerts,代码行数:62,代码来源:_HoloActivity.java


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