Example #1
0
 @Override
 protected void onStop() {
   super.onStop();
   switch (activeContentType) {
     case ABOUT:
       break;
     case MESSAGE_CENTER:
       ApptentiveMessageCenter.onStop(this);
       break;
     case INTERACTION:
       if (activityContent != null) {
         activityContent.onStop();
       }
       break;
     default:
       break;
   }
 }
Example #2
0
 @Override
 public void onBackPressed() {
   switch (activeContentType) {
     case ABOUT:
       AboutModule.getInstance().onBackPressed(this);
       break;
     case MESSAGE_CENTER:
       ApptentiveMessageCenter.onBackPressed(this);
       break;
     case INTERACTION:
       if (activityContent != null) {
         activityContent.onBackPressed(this);
       }
       break;
     default:
       break;
   }
   finish();
   overridePendingTransition(0, R.anim.slide_down_out);
   super.onBackPressed();
 }
Example #3
0
  @Override
  protected void onStart() {
    super.onStart();

    try {
      switch (activeContentType) {
        case ABOUT:
          AboutModule.getInstance().doShow(this);
          break;
        case MESSAGE_CENTER:
          getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED);
          ApptentiveMessageCenter.doShow(this);
          break;
        case INTERACTION:
          String interactionString =
              getIntent().getExtras().getCharSequence(Interaction.KEY_NAME).toString();
          Interaction interaction = Interaction.Factory.parseInteraction(interactionString);
          InteractionView view = null;
          switch (interaction.getType()) {
            case UpgradeMessage:
              view = new UpgradeMessageInteractionView((UpgradeMessageInteraction) interaction);
              break;
            case EnjoymentDialog:
              view = new EnjoymentDialogInteractionView((EnjoymentDialogInteraction) interaction);
              break;
            case RatingDialog:
              view = new RatingDialogInteractionView((RatingDialogInteraction) interaction);
              break;
            case AppStoreRating:
              view = new AppStoreRatingInteractionView((AppStoreRatingInteraction) interaction);
              break;
            case FeedbackDialog:
              view = new FeedbackDialogInteractionView((FeedbackDialogInteraction) interaction);
              break;
            case Survey:
              view = new SurveyInteractionView((SurveyInteraction) interaction);
              break;
            case MessageCenter:
              // For now, we use the old method.
              getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
              finish();
              Apptentive.showMessageCenter(this);
              return;
            default:
              break;
          }
          activityContent = view;
          if (view == null) {
            finish();
          } else {
            view.show(this);
          }
          break;
        default:
          Log.w("No Activity specified. Finishing...");
          finish();
          break;
      }
    } catch (Exception e) {
      Log.e("Error starting ViewActivity.", e);
      MetricModule.sendError(this, e, null, null);
    }
  }