android.app.Activity.overridePendingTransition()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(174)

本文整理了Java中android.app.Activity.overridePendingTransition()方法的一些代码示例,展示了Activity.overridePendingTransition()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.overridePendingTransition()方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:overridePendingTransition

Activity.overridePendingTransition介绍

暂无

代码示例

代码示例来源:origin: androidannotations/androidannotations

/**
   * Call this to specify an explicit transition animation to perform next.
   * 
   * The implementation of this method simply calls
   * {@link Activity#overridePendingTransition}, if the current context is an
   * {@link Activity}.
   * 
   * @param enterAnim
   *            A resource ID of the animation resource to use for the incoming
   *            activity. Use 0 for no animation.
   * @param exitAnim
   *            A resource ID of the animation resource to use for the outgoing
   *            activity. Use 0 for no animation.
   */
  public void withAnimation(int enterAnim, int exitAnim) {
    if (context instanceof Activity) {
      ((Activity) context).overridePendingTransition(enterAnim, exitAnim);
    }
  }
}

代码示例来源:origin: bingoogolapple/BGASwipeBackLayout-Android

/**
 * 执行滑动返回到到上一个 Activity 的动画。这里弄成静态方法,方便在 Fragment 中调用
 */
public static void executeSwipeBackAnim(Activity activity) {
  activity.overridePendingTransition(R.anim.bga_sbl_activity_swipeback_enter, R.anim.bga_sbl_activity_swipeback_exit);
}

代码示例来源:origin: TommyLemon/APIJSON

@Override
  public void run() {
    if (requestCode < 0) {
      context.startActivity(intent);
    } else {
      context.startActivityForResult(intent, requestCode);
    }
    if (showAnimation) {
      context.overridePendingTransition(R.anim.right_push_in, R.anim.hold);
    } else {
      context.overridePendingTransition(R.anim.null_anim, R.anim.null_anim);
    }
  }
});

代码示例来源:origin: jaydenxiao2016/AndroidFire

/**
 * 入口
 * @param activity
 */
public static void startAction(Activity activity){
  Intent intent = new Intent(activity, MainActivity.class);
  activity.startActivity(intent);
  activity.overridePendingTransition(R.anim.fade_in,
      com.jaydenxiao.common.R.anim.fade_out);
}

代码示例来源:origin: Rukey7/MvpApp

public static void launch(Context context) {
  Intent intent = new Intent(context, ChannelActivity.class);
  context.startActivity(intent);
  ((Activity)context).overridePendingTransition(R.anim.fade_entry, R.anim.hold);
}

代码示例来源:origin: Rukey7/MvpApp

public static void launch(Context context) {
  Intent intent = new Intent(context, SettingsActivity.class);
  context.startActivity(intent);
  ((Activity)context).overridePendingTransition(R.anim.slide_right_entry, R.anim.hold);
}

代码示例来源:origin: Rukey7/MvpApp

public static void launch(Context context, String newsId) {
  Intent intent = new Intent(context, NewsArticleActivity.class);
  intent.putExtra(NEWS_ID_KEY, newsId);
  context.startActivity(intent);
  ((Activity) context).overridePendingTransition(R.anim.slide_right_entry, R.anim.hold);
}

代码示例来源:origin: Rukey7/MvpApp

public static void launch(Context context, int index) {
  Intent intent = new Intent(context, DownloadActivity.class);
  intent.putExtra(INDEX_KEY, index);
  context.startActivity(intent);
  ((Activity)context).overridePendingTransition(R.anim.zoom_in_entry, R.anim.hold);
}

代码示例来源:origin: Rukey7/MvpApp

public static void launch(Context context, VideoInfo data) {
  Intent intent = new Intent(context, VideoPlayerActivity.class);
  intent.putExtra(VIDEO_DATA_KEY, data);
  context.startActivity(intent);
  ((Activity) context).overridePendingTransition(R.anim.slide_bottom_entry, R.anim.hold);
}

代码示例来源:origin: Rukey7/MvpApp

public static void launch(Context context, String photoId) {
  Intent intent = new Intent(context, PhotoSetActivity.class);
  intent.putExtra(PHOTO_SET_KEY, photoId);
  context.startActivity(intent);
  ((Activity)context).overridePendingTransition(R.anim.slide_right_entry, R.anim.hold);
}

代码示例来源:origin: Rukey7/MvpApp

public static void launch(Context context, String newsId) {
  Intent intent = new Intent(context, SpecialActivity.class);
  intent.putExtra(SPECIAL_KEY, newsId);
  context.startActivity(intent);
  ((Activity) context).overridePendingTransition(R.anim.slide_right_entry, R.anim.hold);
}

代码示例来源:origin: Rukey7/MvpApp

public static void launch(Context context, int index) {
  Intent intent = new Intent(context, LoveActivity.class);
  intent.putExtra(INDEX_KEY, index);
  context.startActivity(intent);
  ((Activity)context).overridePendingTransition(R.anim.zoom_out_entry, R.anim.hold);
}

代码示例来源:origin: Rukey7/MvpApp

public static void launch(Context context, String newsId) {
  Intent intent = new Intent(context, NewsDetailActivity.class);
  intent.putExtra(APP_KEY, newsId);
  context.startActivity(intent);
  ((Activity)context).overridePendingTransition(R.anim.slide_right_entry, R.anim.hold);
}

代码示例来源:origin: north2016/T-MVP

private void finish() {
  Activity act = (Activity) getContext();
  act.finish();
  act.overridePendingTransition(0, android.R.anim.fade_out);
}

代码示例来源:origin: jaydenxiao2016/AndroidFire

public static void startImagePagerActivity(Activity activity, List<String> imgUrls, int position){
  Intent intent = new Intent(activity, BigImagePagerActivity.class);
  intent.putStringArrayListExtra(INTENT_IMGURLS, new ArrayList<String>(imgUrls));
  intent.putExtra(INTENT_POSITION, position);
  activity.startActivity(intent);
  activity.overridePendingTransition(R.anim.fade_in,
      R.anim.fade_out);
}
/**

代码示例来源:origin: Rukey7/MvpApp

public static void launch(Context context, ArrayList<BeautyPhotoInfo> datas, int index) {
  Intent intent = new Intent(context, BigPhotoActivity.class);
  intent.putParcelableArrayListExtra(BIG_PHOTO_KEY, datas);
  intent.putExtra(PHOTO_INDEX_KEY, index);
  intent.putExtra(FROM_LOVE_ACTIVITY, false);
  context.startActivity(intent);
  ((Activity)context).overridePendingTransition(R.anim.expand_vertical_entry, R.anim.hold);
}

代码示例来源:origin: TommyLemon/APIJSON

/**判断是否已登录,如果未登录则弹出登录界面
 * @return
 */
private boolean isLoggedIn() {
  boolean isLoggedIn = APIJSONApplication.getInstance().isLoggedIn();
  if (isLoggedIn == false) {
    context.startActivity(LoginActivity.createIntent(context));
    context.overridePendingTransition(R.anim.bottom_push_in, R.anim.hold);
  }
  return isLoggedIn;
}

代码示例来源:origin: wangdan/AisenWeiBo

public static void launch(Activity from, String q) {
  FragmentArgs args = new FragmentArgs();
  args.add("q", q);
  SinaCommonActivity.launch(from, SearchFragment.class, args);
  from.overridePendingTransition(-1, -1);
}

代码示例来源:origin: robolectric/robolectric

@Test
public void getPendingTransitionEnterAnimationResourceId_should() throws Exception {
 Activity activity = Robolectric.setupActivity(Activity.class);
 activity.overridePendingTransition(15, 2);
 assertThat(shadowOf(activity).getPendingTransitionEnterAnimationResourceId()).isEqualTo(15);
}

代码示例来源:origin: robolectric/robolectric

@Test
public void getPendingTransitionExitAnimationResourceId_should() throws Exception {
 Activity activity = Robolectric.setupActivity(Activity.class);
 activity.overridePendingTransition(15, 2);
 assertThat(shadowOf(activity).getPendingTransitionExitAnimationResourceId()).isEqualTo(2);
}

相关文章

Activity类方法