• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Application类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.holoeverywhere.app.Application的典型用法代码示例。如果您正苦于以下问题:Java Application类的具体用法?Java Application怎么用?Java Application使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: createInjector

import org.holoeverywhere.app.Application; //导入依赖的package包/类
private static HoloInjector createInjector(final Context context) {
    OverriddenModuleBuilder builder = Modules.override(RoboGuice
            .newDefaultRoboModule((Application) context.getApplicationContext()));
    Module module;
    if (context instanceof Activity) {
        module = builder.with(new Iterable<Module>() {
            @Override
            public Iterator<Module> iterator() {
                List<Module> allModules = new ArrayList<Module>(1 + sUserModules
                        .size());
                allModules.add(new HoloModule((Activity) context));
                allModules.addAll(sUserModules);
                return allModules.iterator();
            }
        });
    } else {
        module = builder.with(sUserModules);
    }
    return new HoloInjector(context, Guice.createInjector(module));
}
 
开发者ID:Prototik,项目名称:HoloEverywhere-Addon-Roboguice,代码行数:21,代码来源:AddonRoboguice.java


示例2: _SharedPreferencesImpl_XML

import org.holoeverywhere.app.Application; //导入依赖的package包/类
public _SharedPreferencesImpl_XML(Context context, String name, int mode) {
    if (context instanceof Activity) {
        prefs = ((Activity) context).superGetSharedPreferences(name, mode);
    } else if (context instanceof Application) {
        prefs = ((Application) context).superGetSharedPreferences(name, mode);
    } else {
        prefs = context.getSharedPreferences(name, mode);
    }
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:10,代码来源:_SharedPreferencesImpl_XML.java


示例3: makeNameById

import org.holoeverywhere.app.Application; //导入依赖的package包/类
public static String makeNameById(int id) {
    if (id > 0) {
        if (HoloEverywhere.NAMED_PREFERENCES) {
            return Application.getLastInstance().getResources().getResourceEntryName(id);
        } else {
            return "preference_0x" + Integer.toHexString(id);
        }
    } else {
        return null;
    }
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:12,代码来源:PreferenceManager.java


示例4: restartWithTheme

import org.holoeverywhere.app.Application; //导入依赖的package包/类
/**
 * Like {@link #restartWithTheme(Activity, int)}, but if third arg is true -
 * restart activity regardless theme.
 *
 * @param activity Activity
 * @param theme    Theme flags for check
 * @param force    Force restart activity
 */
@SuppressLint("InlinedApi")
public static void restartWithTheme(Activity activity, int theme, boolean force) {
    if (theme < _START_RESOURCES_ID && theme > 0) {
        if (ThemeManager._THEME_MODIFIER > 0) {
            theme |= ThemeManager._THEME_MODIFIER;
        }
        theme &= ThemeManager._THEME_MASK;
    }
    if (force || ThemeManager.getTheme(activity) != theme) {
        Intent intent = new Intent(activity.getIntent());
        intent.setClass(activity, activity.getClass());
        intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
        if (theme > 0) {
            intent.putExtra(ThemeManager._THEME_TAG, theme);
        }
        intent.putExtra(KEY_INSTANCE_STATE, activity.saveInstanceState());
        intent.putExtra(KEY_CREATED_BY_THEME_MANAGER, true);
        if (activity.isRestricted()) {
            Application app = Application.getLastInstance();
            if (app != null && !app.isRestricted()) {
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                app.superStartActivity(intent, -1, null);
            }
        } else {
            if (!activity.isFinishing()) {
                activity.finish();
                activity.overridePendingTransition(0, 0);
            }
            if (activity != null) {
                activity.superStartActivity(intent, -1, null);
            }
        }
    }
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:44,代码来源:ThemeManager.java


示例5: createChooser

import org.holoeverywhere.app.Application; //导入依赖的package包/类
/**
 * Declare chooser activity in manifest:
 * <p/>
 * <pre>
 *  &lt;activity android:name="org.holoeverywhere.content.ChooserActivity"
 *      android:theme="@style/Holo.Theme.Dialog.Alert.Light"
 *      android:excludeFromRecents="true" /&gt;
 * </pre>
 */
@SuppressLint("NewApi")
public static Intent createChooser(Intent target, CharSequence title) {
    if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
        return Intent.createChooser(target, title);
    }
    Intent intent = new Intent();
    intent.setClass(Application.getLastInstance(), ChooserActivity.class);
    intent.putExtra(Intent.EXTRA_INTENT, target);
    if (title != null) {
        intent.putExtra(Intent.EXTRA_TITLE, title);
    }
    int permFlags = target.getFlags()
            & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
    if (permFlags != 0 && VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
        ClipData targetClipData = target.getClipData();
        if (targetClipData == null && target.getData() != null) {
            ClipData.Item item = new ClipData.Item(target.getData());
            String[] mimeTypes;
            if (target.getType() != null) {
                mimeTypes = new String[]{
                        target.getType()
                };
            } else {
                mimeTypes = new String[]{};
            }
            targetClipData = new ClipData(null, mimeTypes, item);
        }
        if (targetClipData != null) {
            intent.setClipData(targetClipData);
            intent.addFlags(permFlags);
        }
    }
    return intent;
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:44,代码来源:IntentCompat.java


示例6: restartWithTheme

import org.holoeverywhere.app.Application; //导入依赖的package包/类
/**
 * Like {@link #restartWithTheme(Activity, int)}, but if third arg is true -
 * restart activity regardless theme.
 * 
 * @param activity Activity
 * @param theme Theme flags for check
 * @param force Force restart activity
 */
@SuppressLint("InlinedApi")
public static void restartWithTheme(Activity activity, int theme, boolean force) {
    if (theme < _START_RESOURCES_ID && theme > 0) {
        if (ThemeManager._THEME_MODIFIER > 0) {
            theme |= ThemeManager._THEME_MODIFIER;
        }
        theme &= ThemeManager._THEME_MASK;
    }
    if (force || ThemeManager.getTheme(activity) != theme) {
        Intent intent = new Intent(activity.getIntent());
        intent.setClass(activity, activity.getClass());
        intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
        if (theme > 0) {
            intent.putExtra(ThemeManager._THEME_TAG, theme);
        }
        intent.putExtra(KEY_INSTANCE_STATE, activity.saveInstanceState());
        intent.putExtra(KEY_CREATED_BY_THEME_MANAGER, true);
        if (activity.isRestricted()) {
            Application app = Application.getLastInstance();
            if (app != null && !app.isRestricted()) {
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                app.superStartActivity(intent, -1, null);
            }
        } else {
            if (!activity.isFinishing()) {
                activity.finish();
                activity.overridePendingTransition(0, 0);
            }
            if (activity instanceof SuperStartActivity) {
                ((SuperStartActivity) activity).superStartActivity(intent,
                        -1, null);
            } else {
                activity.startActivity(intent);
            }
        }
    }
}
 
开发者ID:WassimBenltaief,项目名称:laposte-android,代码行数:47,代码来源:ThemeManager.java


示例7: createChooser

import org.holoeverywhere.app.Application; //导入依赖的package包/类
/**
 * Declare chooser activity in manifest:
 * 
 * <pre>
 *  &lt;activity android:name="org.holoeverywhere.content.ChooserActivity"
 *      android:theme="@style/Holo.Theme.Dialog.Alert.Light"
 *      android:excludeFromRecents="true" /&gt;
 * </pre>
 */
@SuppressLint("NewApi")
public static Intent createChooser(Intent target, CharSequence title) {
    if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
        return Intent.createChooser(target, title);
    }
    Intent intent = new Intent();
    intent.setClass(Application.getLastInstance(), ChooserActivity.class);
    intent.putExtra(Intent.EXTRA_INTENT, target);
    if (title != null) {
        intent.putExtra(Intent.EXTRA_TITLE, title);
    }
    int permFlags = target.getFlags()
            & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
    if (permFlags != 0 && VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
        ClipData targetClipData = target.getClipData();
        if (targetClipData == null && target.getData() != null) {
            ClipData.Item item = new ClipData.Item(target.getData());
            String[] mimeTypes;
            if (target.getType() != null) {
                mimeTypes = new String[] {
                        target.getType()
                };
            } else {
                mimeTypes = new String[] {};
            }
            targetClipData = new ClipData(null, mimeTypes, item);
        }
        if (targetClipData != null) {
            intent.setClipData(targetClipData);
            intent.addFlags(permFlags);
        }
    }
    return intent;
}
 
开发者ID:WassimBenltaief,项目名称:laposte-android,代码行数:44,代码来源:IntentCompat.java


示例8: createChooser

import org.holoeverywhere.app.Application; //导入依赖的package包/类
/**
 * Declare chooser activity in manifest:
 * 
 * <pre>
 *  &lt;activity android:name="org.holoeverywhere.ChooserActivity"
 *      android:theme="@style/Holo.Theme.Dialog.Alert.Light"
 *      android:finishOnCloseSystemDialogs="true"
 *      android:excludeFromRecents="true"
 *      android:multiprocess="true" /&gt;
 * </pre>
 */
public static Intent createChooser(Intent target, CharSequence title) {
    if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
        return Intent.createChooser(target, title);
    }
    Intent intent = new Intent();
    intent.setClass(Application.getLastInstance(), ChooserActivity.class);
    intent.putExtra(Intent.EXTRA_INTENT, target);
    if (title != null) {
        intent.putExtra(Intent.EXTRA_TITLE, title);
    }
    int permFlags = target.getFlags()
            & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
    if (permFlags != 0) {
        ClipData targetClipData = target.getClipData();
        if (targetClipData == null && target.getData() != null) {
            ClipData.Item item = new ClipData.Item(target.getData());
            String[] mimeTypes;
            if (target.getType() != null) {
                mimeTypes = new String[] {
                        target.getType()
                };
            } else {
                mimeTypes = new String[] {};
            }
            targetClipData = new ClipData(null, mimeTypes, item);
        }
        if (targetClipData != null) {
            intent.setClipData(targetClipData);
            intent.addFlags(permFlags);
        }
    }
    return intent;
}
 
开发者ID:antonyt,项目名称:TflTravelAlerts,代码行数:45,代码来源:IntentCompat.java


示例9: registerApplication

import org.holoeverywhere.app.Application; //导入依赖的package包/类
public void registerApplication(Class<? extends IAddonApplication> addonClazz) {
    register(Application.class, addonClazz);
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:4,代码来源:IAddon.java


示例10: getSupportApplication

import org.holoeverywhere.app.Application; //导入依赖的package包/类
public Application getSupportApplication() {
    return mActivity.getSupportApplication();
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:4,代码来源:_HoloFragment.java


示例11: getSupportApplication

import org.holoeverywhere.app.Application; //导入依赖的package包/类
public Application getSupportApplication() {
    return Application.getLastInstance();
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:4,代码来源:_HoloActivity.java


示例12: onInit

import org.holoeverywhere.app.Application; //导入依赖的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


示例13: onInit

import org.holoeverywhere.app.Application; //导入依赖的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


示例14: AddonSherlock

import org.holoeverywhere.app.Application; //导入依赖的package包/类
public AddonSherlock() {
    register(Activity.class, AddonSherlockA.class);
    register(Application.class, AddonSherlockApplication.class);
}
 
开发者ID:antonyt,项目名称:TflTravelAlerts,代码行数:5,代码来源:AddonSherlock.java


示例15: onInit

import org.holoeverywhere.app.Application; //导入依赖的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.app.Application类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StatefulRedisConnection类代码示例发布时间:2022-05-22
下一篇:
Java RoutePolicyFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap