use of org.holoeverywhere.app.Activity in project HoloEverywhere by Prototik.
the class PreferenceScreen method getThemeResId.
protected int getThemeResId(Context context) {
try {
if (context instanceof Activity) {
int t = ((Activity) context).getLastThemeResourceId();
if (t > 0) {
return t;
}
}
Method method = Context.class.getDeclaredMethod("getThemeResId");
method.setAccessible(true);
return (Integer) method.invoke(context);
} catch (Exception e) {
e.printStackTrace();
return R.style.Holo_Theme_NoActionBar;
}
}
use of org.holoeverywhere.app.Activity in project HoloEverywhere by Prototik.
the class _HoloActivity method 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();
}
use of org.holoeverywhere.app.Activity in project HoloEverywhere by Prototik.
the class ThemeManager method startActivity.
/**
* Only for system use
*/
@SuppressLint("NewApi")
public static void startActivity(Context context, Intent intent, int requestCode, Bundle options) {
final Activity activity = context instanceof Activity ? (Activity) context : null;
if (activity != null && HoloEverywhere.ALWAYS_USE_PARENT_THEME) {
ThemeManager.cloneTheme(activity.getIntent(), intent, true);
}
final int parentColorScheme = ThemeManager.getThemeType(activity);
if (parentColorScheme != INVALID) {
intent.putExtra(_PARENT_SCHEME_TAG, parentColorScheme);
}
if (context instanceof SuperStartActivity) {
((SuperStartActivity) context).superStartActivity(intent, requestCode, options);
} else if (VERSION.SDK_INT >= 16) {
context.startActivity(intent, options);
} else {
context.startActivity(intent);
}
}
use of org.holoeverywhere.app.Activity in project mobile-android by photo.
the class PhotoDetailsFragment method photoSelected.
void photoSelected(final Photo photo) {
ActionBar actionBar = ((Activity) getSupportActivity()).getSupportActionBar();
String title = photo.getTitle();
if (TextUtils.isEmpty(title)) {
title = photo.getFilenameOriginal();
}
actionBar.setTitle(getString(R.string.details_title_and_date_header, title, CommonUtils.formatDateTime(photo.getDateTaken())));
titleText.setText(title);
dateText.setText(CommonUtils.formatDateTime(photo.getDateTaken()));
privateBtn.setVisibility(photo.isPrivate() ? View.VISIBLE : View.GONE);
ensureThumbVisible(photo);
}
use of org.holoeverywhere.app.Activity in project mobile-android by photo.
the class SyncActionModeHandler method startActionMode.
public void startActionMode() {
Activity a = mActivity;
mActionMode = a.startActionMode(this);
View customView = LayoutInflater.from(a).inflate(mActionModeLayout, null);
mActionMode.setCustomView(customView);
mSelectionMenu = new SyncSelectionMenu(R.menu.sync_image_selection2, mHasPopupMenu, a, (Button) customView.findViewById(R.id.selection_menu), this);
updateSelectionMenu();
customizeActionModeCloseButton();
}
Aggregations