Search in sources :

Example 1 with AfApp

use of com.andframe.application.AfApp in project AndFrameWorks by scwang90.

the class AfPagerManager method startActivity.

@Override
public void startActivity(Class<? extends Activity> clazz, Object... args) {
    AfActivity activity = currentActivity();
    if (activity != null && activity.isRecycled()) {
        activity.startActivity(clazz, args);
    } else {
        AfApp app = AfApp.get();
        AfIntent intent = new AfIntent(app, clazz);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.putKeyVaules(args);
        app.startActivity(intent);
    }
}
Also used : AfActivity(com.andframe.activity.AfActivity) AfApp(com.andframe.application.AfApp) AfIntent(com.andframe.feature.AfIntent)

Example 2 with AfApp

use of com.andframe.application.AfApp in project AndFrameWorks by scwang90.

the class AfFragmentActivity method start.

// <editor-fold desc="跳转封装">
public static void start(Pager pager, Class<? extends Fragment> clazz, Object... params) {
    // List<Object> list = new ArrayList<>(Arrays.asList(params));
    // list.add(0, clazz.getName());
    // list.add(0, EXTRA_FRAGMENT);
    Context context = (pager instanceof Activity) ? (Activity) pager : (pager == null ? null : pager.getContext());
    if (context != null) {
        context.startActivity(newIntent(clazz, context, params));
    } else {
        AfApp app = AfApp.get();
        app.startActivity(newIntent(clazz, app, params).newTask());
    }
// pager.getContext().startActivity(new AfIntent(pager.getContext()));
// AfActivity activity = $.pager().currentActivity();
// if (activity != null) {
// (activity).startActivity(getActivityClazz(clazz), list.toArray());
// } else {
// AfApp app = AfApp.get();
// app.startActivity(new AfIntent(app, getActivityClazz(clazz),list.toArray()).newTask());
// }
}
Also used : Context(android.content.Context) Activity(android.app.Activity) AfApp(com.andframe.application.AfApp)

Aggregations

AfApp (com.andframe.application.AfApp)2 Activity (android.app.Activity)1 Context (android.content.Context)1 AfActivity (com.andframe.activity.AfActivity)1 AfIntent (com.andframe.feature.AfIntent)1