Exemplo n.º 1
0
 @Override
 public Object onRetainNonConfigurationInstance() {
   super.onRetainNonConfigurationInstance();
   m_quitApp = false;
   return true;
 }
  /**
   * create any associated state and call init methods on an activity
   *
   * <p>call any life cycle events for the activity
   *
   * @param activity
   */
  @DSVerified
  @DSBan(DSCat.DROIDSAFE_INTERNAL)
  public static void modelActivity(android.app.Activity activity) {
    if (mApplication != null) activity.setApplication(mApplication);

    Bundle b = new Bundle();
    activity.performCreate(b, context);

    activity.onAttachedToWindow();
    activity.onWindowFocusChanged(true);

    // Call all public methods with no params
    activity.onBackPressed();
    activity.onContentChanged();
    activity.onCreateDescription();
    activity.onLowMemory();
    activity.onRetainNonConfigurationInstance();
    // do not call this automatically because it leads to a crazy long path of crap
    // activity.onSearchRequested();
    activity.onUserInteraction();

    // TODO: DOES THIS MAKE SENSE?
    // We should not change method's visiblity
    /*
    activity.onCreateDialog(0);
    activity.onCreateDialog(0, new Bundle());
    activity.onPrepareDialog(0, new Dialog(context));
    */

    /*
    //TODO: WHAT ABOUT A REAL MENU?  We moved to Activity's droidsafeOnOtherHook
    activity.onCreateOptionsMenu(null);
    activity.onPrepareOptionsMenu(null);
    activity.onCreateContextMenu(null, null, null);
    activity.onOptionsItemSelected(null);
    activity.onContextItemSelected(null);
    activity.dispatchTouchEvent(new MotionEvent());

    //activity.droidsafeOnKeyEvents();
    */
    activity.onConfigurationChanged(new Configuration());
    activity.droidsafeOnSavedInstanceState(b);

    activity.droidsafeOnResume();
    activity.droidsafeOnPause();

    ////////////////
    // Callback hooks specific for SubActivity classes
    // All subclass of Activity should implment this in the model
    // so that their callback will be called
    // Map, listview, expandblelist, etc...
    activity.droidsafeSubActivityCallbackHook();

    activity.droidsafeOnStop();

    activity.droidsafeOnRestart();

    activity.droidsafeOnDestroy();

    activity.droidsafePerformRestoreInstanceState(b);

    activity.onDetachedFromWindow();
    // Calls for MapActivity from mapping library
  }