當前位置: 首頁>>代碼示例>>Java>>正文


Java ThemeManager.applyTheme方法代碼示例

本文整理匯總了Java中org.holoeverywhere.ThemeManager.applyTheme方法的典型用法代碼示例。如果您正苦於以下問題:Java ThemeManager.applyTheme方法的具體用法?Java ThemeManager.applyTheme怎麽用?Java ThemeManager.applyTheme使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.holoeverywhere.ThemeManager的用法示例。


在下文中一共展示了ThemeManager.applyTheme方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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();
}
 
開發者ID:restorer,項目名稱:gloomy-dungeons-2,代碼行數:61,代碼來源:_HoloActivity.java

示例2: 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)) {
        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,代碼行數:63,代碼來源:_HoloActivity.java

示例3: 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)) {
        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,代碼行數:63,代碼來源:_HoloActivity.java


注:本文中的org.holoeverywhere.ThemeManager.applyTheme方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。