本文整理汇总了Java中org.holoeverywhere.app.Activity类的典型用法代码示例。如果您正苦于以下问题:Java Activity类的具体用法?Java Activity怎么用?Java Activity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Activity类属于org.holoeverywhere.app包,在下文中一共展示了Activity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActivityResult
import org.holoeverywhere.app.Activity; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case CAPTURE_EDIT_REQUEST_CODE:
File file = new File(this.getActivity().getCacheDir(), CAM_FILENAME);
if (file.exists()) {
//noinspection ResultOfMethodCallIgnored
file.delete();
}
file = new File(Environment.getExternalStorageDirectory() + CameraUtil.ROOT_PATH, VID_FILENAME);
if (file.exists()) {
//noinspection ResultOfMethodCallIgnored
file.delete();
}
if (resultCode == Activity.RESULT_OK) {
this.getActivity().setResult(Activity.RESULT_OK);
this.getActivity().finish();
}
break;
}
}
示例2: onActivityResult
import org.holoeverywhere.app.Activity; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case ColorPickerDialog.REQUEST_COLOR:
if (resultCode == Activity.RESULT_OK && data != null) {
int red = data.getIntExtra(ColorPickerDialog.RED_KEY, 255);
int green = data.getIntExtra(ColorPickerDialog.GREEN_KEY, 255);
int blue = data.getIntExtra(ColorPickerDialog.BLUE_KEY, 255);
drawingColor = Color.rgb(red, green, blue);
}
break;
case TIMER_PICK_REQUEST_CODE:
if (resultCode == Activity.RESULT_OK && data != null) {
displayTime = data.getIntExtra(TimerPickerDialog.RESULT_TIME_VAL_KEY, 5);
displayText.setText(displayTime.toString());
}
break;
}
}
示例3: onSuccess
import org.holoeverywhere.app.Activity; //导入依赖的package包/类
/**
* A callback used when the user has successfully selected a user to send to
*/
protected void onSuccess() {
SharedPreferences.Editor editor = (Editor) this.getActivity().getSharedPreferences(RESEND_INFO_KEY, Context.MODE_PRIVATE).edit();
String text = getCaption();
if (text == null)
text = "";
String resendFile = new File(this.getActivity().getCacheDir(), RESEND_FILE_PATH + (isPhoto() ? ".jpg" : ".mp4")).getAbsolutePath();
if (FileIO.bufferedCopy(filePath, resendFile) < 0) {
StatMethods.hotBread(this.getActivity(), "Error saving file for resend", Toast.LENGTH_SHORT);
}
editor.putString(SnapEditorBaseFrag.CAPTION_KEY, text).putString(SnapEditorBaseFrag.FILE_PATH_KEY, resendFile)
.putBoolean(SnapEditorBaseFrag.MEDIA_TYPE_KEY, isPhoto()).putInt(SnapEditorBaseFrag.SNAP_TIME_KEY, snapTime).commit();
onFragmentPopped();
this.getActivity().setResult(Activity.RESULT_OK);
this.getActivity().finish();
}
示例4: getThemeResId
import org.holoeverywhere.app.Activity; //导入依赖的package包/类
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;
}
}
示例5: startActivity
import org.holoeverywhere.app.Activity; //导入依赖的package包/类
/**
* 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);
}
}
示例6: GridView
import org.holoeverywhere.app.Activity; //导入依赖的package包/类
@SuppressLint("NewApi")
public GridView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
if (context instanceof Activity) {
setActivity((Activity) context);
}
final boolean longClickable = isLongClickable();
mOnItemLongClickListenerWrapper = new OnItemLongClickListenerWrapper();
super.setOnItemLongClickListener(mOnItemLongClickListenerWrapper);
setLongClickable(longClickable);
if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) {
super.setChoiceMode(CHOICE_MODE_NONE);
super.setFastScrollAlwaysVisible(false);
}
super.setFastScrollEnabled(false);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AbsListView,
defStyle, R.style.Holo_ListView);
setFastScrollEnabled(a.getBoolean(R.styleable.AbsListView_android_fastScrollEnabled, false));
setFastScrollAlwaysVisible(a.getBoolean(
R.styleable.AbsListView_android_fastScrollAlwaysVisible, false));
setChoiceMode(a.getInt(R.styleable.AbsListView_android_choiceMode, CHOICE_MODE_NONE));
a.recycle();
}
示例7: ListView
import org.holoeverywhere.app.Activity; //导入依赖的package包/类
@SuppressLint("NewApi")
public ListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
if (context instanceof Activity) {
setActivity((Activity) context);
}
final boolean longClickable = isLongClickable();
mOnItemLongClickListenerWrapper = new OnItemLongClickListenerWrapper();
super.setOnItemLongClickListener(mOnItemLongClickListenerWrapper);
setLongClickable(longClickable);
if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) {
super.setFastScrollAlwaysVisible(false);
}
super.setFastScrollEnabled(false);
super.setChoiceMode(CHOICE_MODE_NONE);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AbsListView,
defStyle, R.style.Holo_ListView);
setFastScrollEnabled(a.getBoolean(R.styleable.AbsListView_android_fastScrollEnabled, false));
setFastScrollAlwaysVisible(a.getBoolean(
R.styleable.AbsListView_android_fastScrollAlwaysVisible, false));
setChoiceMode(a.getInt(R.styleable.AbsListView_android_choiceMode, CHOICE_MODE_NONE));
a.recycle();
}
示例8: onAttach
import org.holoeverywhere.app.Activity; //导入依赖的package包/类
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
this.activity = (MainActivity)activity;
String title = getString(R.string.share_title);
String url = Common.WEB_LINK + Locale.getDefault().getLanguage().toLowerCase();
items.clear();
items.add(new ListItem("Facebook", IntentProvider.getFacebookIntent(activity, title, url)));
items.add(new ListItem("Twitter", IntentProvider.getTwitterIntent(activity, title, url)));
items.add(new ListItem("Google+", IntentProvider.getGooglePlusIntent(activity, title, url)));
items.add(new ListItem("VK", IntentProvider.getVkIntent(activity, title, url)));
adapter = new ArrayAdapter<ListItem>(
activity,
R.layout.select_dialog_item_holo,
items
);
}
示例9: TabListener
import org.holoeverywhere.app.Activity; //导入依赖的package包/类
public TabListener(Activity activity, String tag, Class<T> clz, Bundle args) {
mActivity = activity;
mTag = tag;
mClass = clz;
mArgs = args;
// Check to see if we already have a fragment for this tab, probably
// from a previously saved state. If so, deactivate it, because our
// initial state is that a tab isn't shown.
mFragment = (Fragment) activity.getSupportFragmentManager().findFragmentByTag(mTag);
if (mFragment != null && !mFragment.isDetached()) {
FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction();
ft.detach(mFragment);
ft.commit();
}
}
示例10: setTheme
import org.holoeverywhere.app.Activity; //导入依赖的package包/类
public synchronized void setTheme(int resid, boolean modifyGlobal) {
if (resid > ThemeManager._START_RESOURCES_ID) {
if (mLastThemeResourceId != resid) {
mActionBarContext = null;
mMenuInflater = null;
super.setTheme(mLastThemeResourceId = resid);
}
} else {
if ((resid & ThemeManager.COLOR_SCHEME_MASK) == 0) {
int theme = ThemeManager.getTheme(getIntent(), false);
if (theme == 0) {
final android.app.Activity activity = getParent();
if (activity != null) {
theme = ThemeManager.getTheme(activity.getIntent(), false);
}
}
theme &= ThemeManager.COLOR_SCHEME_MASK;
if (theme != 0) {
resid |= theme;
}
}
setTheme(ThemeManager.getThemeResource(resid, modifyGlobal));
}
}
示例11: onAttach
import org.holoeverywhere.app.Activity; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void onAttach(Activity activity) {
super.onAttach(activity);
if (sUserModules == null) {
sUserModules = new ArrayList<Module>();
int id = activity.getResources().getIdentifier("roboguice_modules", "array",
activity.getPackageName());
if (id <= 0) {
return;
}
for (String moduleName : activity.getResources().getStringArray(id)) {
try {
addModule((Class<? extends Module>) Class.forName(moduleName), activity);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
示例12: addModule
import org.holoeverywhere.app.Activity; //导入依赖的package包/类
private static void addModule(Class<? extends Module> clazz, Activity activity) {
Module module;
try {
if (activity == null) {
throw new NullPointerException();
}
module = clazz.getConstructor(Context.class).newInstance(activity);
} catch (Exception e) {
try {
module = clazz.newInstance();
} catch (Exception e2) {
throw new RuntimeException(e2);
}
}
if (module != null) {
addModule(module);
}
}
示例13: createInjector
import org.holoeverywhere.app.Activity; //导入依赖的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));
}
示例14: getContext
import org.holoeverywhere.app.Activity; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <T extends Context & RoboContext> T getContext(Context context) {
if (context instanceof Activity) {
return getContext((Activity) context);
}
if (context instanceof RoboContext) {
return (T) context;
}
WeakReference<RoboguiceContextWrapper> reference = sWrappersMap.get(context);
RoboguiceContextWrapper wrapper = reference == null ? null : reference.get();
if (wrapper == null) {
wrapper = new RoboguiceContextWrapper(context);
sWrappersMap.put(context, new WeakReference<RoboguiceContextWrapper>(wrapper));
}
return (T) wrapper;
}
示例15: popFragment
import org.holoeverywhere.app.Activity; //导入依赖的package包/类
@Override
@SuppressLint("NewApi")
public final void popFragment() {
if (Build.VERSION.SDK_INT < 11) {
((Activity)this.getActivity()).getSupportActionBar().hide();
} else {
//noinspection ConstantConditions
((Activity)this.getActivity()).getActionBar().hide();
}
super.popFragment();
}