Java Code Examples for android.app.ActivityOptions#makeCustomAnimation()

The following examples show how to use android.app.ActivityOptions#makeCustomAnimation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActivityTransitionTouchListener.java    From your-local-weather with GNU General Public License v3.0 5 votes vote down vote up
private void swipeToRight() {
    if (destinationActivityOnRightSide == null) {
        return;
    }
    Intent intentToMoveToActivity = new Intent(context, destinationActivityOnRightSide);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        ActivityOptions options = ActivityOptions.makeCustomAnimation(context, R.anim.anim_slide_in_left,
                R.anim.anim_slide_out_left);
        context.startActivity(intentToMoveToActivity, options.toBundle());
    } else {
        context.startActivity(intentToMoveToActivity);
    }
}
 
Example 2
Source File: ChannelLookupActivity.java    From UTubeTV with The Unlicense 5 votes vote down vote up
public static void show(Activity activity) {
  // add animation, see finish below for the back transition
  ActivityOptions opts = ActivityOptions.makeCustomAnimation(activity, R.anim.scale_in, R.anim.scale_out);

  Intent intent = new Intent();
  intent.setClass(activity, ChannelLookupActivity.class);
  activity.startActivity(intent, opts.toBundle());
}
 
Example 3
Source File: ChannelDetailsActivity.java    From UTubeTV with The Unlicense 5 votes vote down vote up
public static void show(Activity activity, YouTubeData data) {
  // add animation, see finish below for the back transition
  ActivityOptions opts = ActivityOptions.makeCustomAnimation(activity, android.R.anim.fade_in, android.R.anim.fade_out);

  Bundle paramsBundle = YouTubeData.toBundle(data);

  Intent intent = new Intent();
  intent.putExtra("params", paramsBundle);
  intent.setClass(activity, ChannelDetailsActivity.class);
  activity.startActivity(intent, opts.toBundle());
}
 
Example 4
Source File: DonateActivity.java    From UTubeTV with The Unlicense 5 votes vote down vote up
public static void show(Activity activity) {
  // add animation, see finish below for the back transition
  ActivityOptions opts = ActivityOptions.makeCustomAnimation(activity, R.anim.scale_in, R.anim.scale_out);

  Intent intent = new Intent();
  intent.setClass(activity, DonateActivity.class);
  activity.startActivity(intent, opts.toBundle());
}
 
Example 5
Source File: IntroActivity.java    From UTubeTV with The Unlicense 5 votes vote down vote up
public static void showIntro(Activity activity, boolean force) {
  boolean show = false;
  final String PREF_KEY = "intro_first_launched_pref";

  if (force)
    show = true;
  else {
    SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(activity);

    final boolean firstLaunch = mPrefs.getBoolean(PREF_KEY, true);

    if (firstLaunch) {
      final SharedPreferences.Editor edit = mPrefs.edit();
      edit.putBoolean(PREF_KEY, false);
      edit.commit();
      show = true;
    }
  }

  if (show) {
    // add animation, see finish below for the back transition
    ActivityOptions opts = ActivityOptions.makeCustomAnimation(activity, R.anim.slidedown, 0);

    Intent intent = new Intent();
    intent.setClass(activity, IntroActivity.class);
    activity.startActivity(intent, opts.toBundle());
  }
}
 
Example 6
Source File: SettingsActivity.java    From UTubeTV with The Unlicense 5 votes vote down vote up
public static void show(Activity activity) {
  // add animation, see finish below for the back transition
  ActivityOptions opts = ActivityOptions.makeCustomAnimation(activity, R.anim.scale_in, R.anim.scale_out);

  Intent intent = new Intent();
  intent.setClass(activity, SettingsActivity.class);
  activity.startActivity(intent, opts.toBundle());
}
 
Example 7
Source File: CreditsActivity.java    From UTubeTV with The Unlicense 5 votes vote down vote up
public static void show(Activity activity) {
  // add animation, see finish below for the back transition
  ActivityOptions opts = ActivityOptions.makeCustomAnimation(activity, R.anim.scale_in, R.anim.scale_out);

  Intent intent = new Intent();
  intent.setClass(activity, CreditsActivity.class);
  activity.startActivity(intent, opts.toBundle());
}
 
Example 8
Source File: InfoActivity.java    From UTubeTV with The Unlicense 5 votes vote down vote up
public static void show(Activity activity, String contentID) {
  // add animation, see finish below for the back transition
  ActivityOptions opts = ActivityOptions.makeCustomAnimation(activity, R.anim.scale_in, R.anim.scale_out);

  Intent intent = new Intent();
  intent.putExtra("infoID", contentID);
  intent.setClass(activity, InfoActivity.class);
  activity.startActivity(intent, opts.toBundle());
}
 
Example 9
Source File: DrawerActivity.java    From UTubeTV with The Unlicense 5 votes vote down vote up
public void onEventMainThread(BusEvents.ThemeChanged event) {
  // animate doesn't work, puts new activity in the background.  use recreate instead
  boolean animate = false;
  if (animate) {
    ActivityOptions opts = ActivityOptions.makeCustomAnimation(this, android.R.anim.fade_in, android.R.anim.fade_out);

    startActivity(getIntent(), opts.toBundle());

    finish();
  } else {
    // not sure how to to get recreate to animate, so we use the above code when animating which is like a recreate
    recreate();
  }
}
 
Example 10
Source File: PomodoroAlarmReceiver.java    From WearPomodoro with GNU General Public License v2.0 5 votes vote down vote up
@DebugLog
@Override
public void onReceive(Context context, Intent intent) {
    PomodoroMaster pomodoroMaster = ServiceProvider.getInstance().getPomodoroMaster(context);
    ActivityType justStoppedActivityType = pomodoroMaster.stop(); // order may be important, else we can get race conditions
    Intent transitionIntent = intentForAlarm(context, justStoppedActivityType, pomodoroMaster.getEatenPomodoros());
    ActivityOptions activityOptions = ActivityOptions.makeCustomAnimation(context, 0, 0);
    startWakefullActity(context, transitionIntent, activityOptions);
}
 
Example 11
Source File: ActionResponse.java    From PowerSwitch_Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Show failure animation in a fade in/out animation
 *
 * @param context any suitable context
 */
public static void showFailureAnimation(Context context) {
    Intent intent = new Intent(context, android.support.wearable.activity.ConfirmationActivity.class);
    intent.putExtra(android.support.wearable.activity.ConfirmationActivity.EXTRA_ANIMATION_TYPE,
            android.support.wearable.activity.ConfirmationActivity.FAILURE_ANIMATION);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    ActivityOptions activityOptions = ActivityOptions.makeCustomAnimation(context, android.R.anim.fade_in, android.R
            .anim.fade_out);
    context.startActivity(intent, activityOptions.toBundle());
}
 
Example 12
Source File: ActionResponse.java    From PowerSwitch_Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Show failure animation in a fade in/out animation
 *
 * @param context any suitable context
 * @param message text message
 */
public static void showFailureAnimation(Context context, String message) {
    Intent intent = new Intent(context, android.support.wearable.activity.ConfirmationActivity.class);
    intent.putExtra(android.support.wearable.activity.ConfirmationActivity.EXTRA_ANIMATION_TYPE,
            android.support.wearable.activity.ConfirmationActivity.FAILURE_ANIMATION);
    intent.putExtra(android.support.wearable.activity.ConfirmationActivity.EXTRA_MESSAGE, message);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    ActivityOptions activityOptions = ActivityOptions.makeCustomAnimation(context, android.R.anim.fade_in, android.R
            .anim.fade_out);
    context.startActivity(intent, activityOptions.toBundle());
}
 
Example 13
Source File: ActionResponse.java    From PowerSwitch_Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Show success animation in a fade in/out animation
 *
 * @param context any suitable context
 */
public static void showSuccessAnimation(Context context) {
    Intent intent = new Intent(context, ConfirmationActivity.class);
    intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE,
            ConfirmationActivity.SUCCESS_ANIMATION);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    ActivityOptions activityOptions = ActivityOptions.makeCustomAnimation(context, android.R.anim.fade_in, android.R
            .anim.fade_out);
    context.startActivity(intent, activityOptions.toBundle());
}
 
Example 14
Source File: ActionResponse.java    From PowerSwitch_Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Show success animation in a fade in/out animation
 *
 * @param context any suitable context
 * @param message
 */
public static void showSuccessAnimation(Context context, String message) {
    Intent intent = new Intent(context, android.support.wearable.activity.ConfirmationActivity.class);
    intent.putExtra(android.support.wearable.activity.ConfirmationActivity.EXTRA_ANIMATION_TYPE,
            android.support.wearable.activity.ConfirmationActivity.SUCCESS_ANIMATION);
    intent.putExtra(android.support.wearable.activity.ConfirmationActivity.EXTRA_MESSAGE, message);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    ActivityOptions activityOptions = ActivityOptions.makeCustomAnimation(context, android.R.anim.fade_in, android.R
            .anim.fade_out);
    context.startActivity(intent, activityOptions.toBundle());
}
 
Example 15
Source File: ActivityTransitionTouchListener.java    From your-local-weather with GNU General Public License v3.0 5 votes vote down vote up
private void swipeToLeft() {
    if (destinationActivityOnLeftSide == null) {
        return;
    }
    Intent intentToMoveToActivity = new Intent(context, destinationActivityOnLeftSide);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        ActivityOptions options = ActivityOptions.makeCustomAnimation(context, R.anim.anim_slide_in_right,
                R.anim.anim_slide_out_right);
        context.startActivity(intentToMoveToActivity, options.toBundle());
    } else {
        context.startActivity(intentToMoveToActivity);
    }
}
 
Example 16
Source File: ActivityOptionsCompatJB.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
public static ActivityOptionsCompatJB makeCustomAnimation(Context context,
        int enterResId, int exitResId) {
    return new ActivityOptionsCompatJB(
        ActivityOptions.makeCustomAnimation(context, enterResId, exitResId));
}
 
Example 17
Source File: ActivityOptionsCompatJB.java    From guideshow with MIT License 4 votes vote down vote up
public static ActivityOptionsCompatJB makeCustomAnimation(Context context,
        int enterResId, int exitResId) {
    return new ActivityOptionsCompatJB(
        ActivityOptions.makeCustomAnimation(context, enterResId, exitResId));
}
 
Example 18
Source File: ActivityOptionsCompatJB.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
public static ActivityOptionsCompatJB makeCustomAnimation(Context context,
        int enterResId, int exitResId) {
    return new ActivityOptionsCompatJB(
        ActivityOptions.makeCustomAnimation(context, enterResId, exitResId));
}
 
Example 19
Source File: ActivityOptionsCompatJB.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
public static ActivityOptionsCompatJB makeCustomAnimation(Context context,
        int enterResId, int exitResId) {
    return new ActivityOptionsCompatJB(
        ActivityOptions.makeCustomAnimation(context, enterResId, exitResId));
}