Skip to content

Instantly share code, notes, and snippets.

@JetXing
Last active September 10, 2015 05:53
Show Gist options
  • Save JetXing/9c0670dd1d2b46aeb4af to your computer and use it in GitHub Desktop.
Save JetXing/9c0670dd1d2b46aeb4af to your computer and use it in GitHub Desktop.
Activity convertion to View
/**
* <p>Helper class for managing multiple running embedded activities in the same
* process. This class is not normally used directly, but rather created for
* you as part of the {@link android.app.ActivityGroup} implementation.
*
* @see ActivityGroup
*
* @deprecated Use the new {@link Fragment} and {@link FragmentManager} APIs
* instead; these are also
* available on older platforms through the Android compatibility package.
*/
//@Deprecated
//public class LocalActivityManager
protected LocalActivityManager mLocalActivityManager;
public LocalActivityManager activityToView(ActivityGroup group) {
LocalActivityManager mLocalActivityManager = group.getLocalActivityManager();
}
@SuppressWarnings("deprecation")
protected View activityToView(String id, String reType, Class<?> cls){
Intent intent = new Intent(this, cls);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Window window = mLocalActivityManager.startActivity(id, intent);
View view = window != null ? window.getDecorView() : null;
if (view != null) {
view.setVisibility(View.VISIBLE);
}
return view;
}
@SuppressWarnings("deprecation")
protected View activityToView(String id, Class<?> cls) {
Intent intent = new Intent(this, cls);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Window window = mLocalActivityManager.startActivity(id, intent);
View view = window != null ? window.getDecorView() : null;
if (view != null) {
view.setVisibility(View.VISIBLE);
}
return view;
}
@SuppressWarnings("deprecation")
protected View activityToView(String id, Intent aIntent) {
Window window = mLocalActivityManager.startActivity(id, aIntent);
View view = window != null ? window.getDecorView() : null;
if (view != null) {
view.setVisibility(View.VISIBLE);
}
return view;
}
@SuppressWarnings("deprecation")
protected View activityToView(String id, String type, Intent aIntent) {
Window window = mLocalActivityManager.startActivity(id, aIntent);
View view = window != null ? window.getDecorView() : null;
if (view != null) {
view.setVisibility(View.VISIBLE);
}
return view;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment