Пример #1
0
  /**
   * Hook method called when a new instance of PalantiriPresenter is created. One time
   * initialization code goes here, e.g., storing a WeakReference to the View layer and initializing
   * the Model layer.
   *
   * @param view A reference to the View layer.
   */
  @Override
  public void onCreate(MVP.RequiredViewOps view) {
    // Set the WeakReference.
    mView = new WeakReference<>(view);

    // Invoke the special onCreate() method in GenericPresenter,
    // passing in the PalantiriModel class to instantiate/manage
    // and "this" to provide this MVP.RequiredModelOps instance.
    super.onCreate(PalantiriModel.class, this);

    // Get the intent used to start the Activity.
    final Intent intent = view.getIntent();

    // Initialize the Options singleton using the extras contained
    // in the intent.
    if (Options.instance().parseArgs(view.getActivityContext(), makeArgv(intent)) == false)
      Utils.showToast(view.getActivityContext(), "Arguments were incorrect");

    // A runtime configuration change has not yet occurred.
    mConfigurationChangeOccurred = false;
  }