本文整理汇总了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));
}
示例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);
}
}
示例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;
}
}
示例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);
}
}
}
}
示例5: createChooser
import org.holoeverywhere.app.Application; //导入依赖的package包/类
/**
* Declare chooser activity in manifest:
* <p/>
* <pre>
* <activity android:name="org.holoeverywhere.content.ChooserActivity"
* android:theme="@style/Holo.Theme.Dialog.Alert.Light"
* android:excludeFromRecents="true" />
* </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;
}
示例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);
}
}
}
}
示例7: createChooser
import org.holoeverywhere.app.Application; //导入依赖的package包/类
/**
* Declare chooser activity in manifest:
*
* <pre>
* <activity android:name="org.holoeverywhere.content.ChooserActivity"
* android:theme="@style/Holo.Theme.Dialog.Alert.Light"
* android:excludeFromRecents="true" />
* </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;
}
示例8: createChooser
import org.holoeverywhere.app.Application; //导入依赖的package包/类
/**
* Declare chooser activity in manifest:
*
* <pre>
* <activity android:name="org.holoeverywhere.ChooserActivity"
* android:theme="@style/Holo.Theme.Dialog.Alert.Light"
* android:finishOnCloseSystemDialogs="true"
* android:excludeFromRecents="true"
* android:multiprocess="true" />
* </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;
}
示例9: registerApplication
import org.holoeverywhere.app.Application; //导入依赖的package包/类
public void registerApplication(Class<? extends IAddonApplication> addonClazz) {
register(Application.class, addonClazz);
}
示例10: getSupportApplication
import org.holoeverywhere.app.Application; //导入依赖的package包/类
public Application getSupportApplication() {
return mActivity.getSupportApplication();
}
示例11: getSupportApplication
import org.holoeverywhere.app.Application; //导入依赖的package包/类
public Application getSupportApplication() {
return Application.getLastInstance();
}
示例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();
}
示例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();
}
示例14: AddonSherlock
import org.holoeverywhere.app.Application; //导入依赖的package包/类
public AddonSherlock() {
register(Activity.class, AddonSherlockA.class);
register(Application.class, AddonSherlockApplication.class);
}
示例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();
}