JumpUtils.java 3.2 KB
Newer Older
S
shuyu 已提交
1 2 3 4 5 6 7 8 9
package com.example.gsyvideoplayer.utils;

import android.app.Activity;
import android.content.Intent;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v4.util.Pair;
import android.view.View;

S
shuyu 已提交
10
import com.example.gsyvideoplayer.DetailListPlayer;
S
shuyu 已提交
11
import com.example.gsyvideoplayer.DetailPlayer;
12
import com.example.gsyvideoplayer.ListVideo2Activity;
S
shuyu 已提交
13
import com.example.gsyvideoplayer.ListVideoActivity;
S
shuyu 已提交
14 15
import com.example.gsyvideoplayer.PlayActivity;
import com.example.gsyvideoplayer.R;
16
import com.example.gsyvideoplayer.RecyclerView2Activity;
S
shuyu 已提交
17 18 19 20 21 22 23 24

/**
 * Created by shuyu on 2016/11/11.
 */

public class JumpUtils {

    /**
S
shuyu 已提交
25 26
     * 跳转到视频播放
     *
S
shuyu 已提交
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
     * @param activity
     * @param view
     */
    public static void goToVideoPlayer(Activity activity, View view) {
        Intent intent = new Intent(activity, PlayActivity.class);
        intent.putExtra(PlayActivity.TRANSITION, true);
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
            Pair pair = new Pair<>(view, PlayActivity.IMG_TRANSITION);
            ActivityOptionsCompat activityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(
                    activity, pair);
            ActivityCompat.startActivity(activity, intent, activityOptions.toBundle());
        } else {
            activity.startActivity(intent);
            activity.overridePendingTransition(R.anim.abc_fade_in, R.anim.abc_fade_out);
        }
    }
S
shuyu 已提交
43 44 45 46 47 48 49 50 51 52 53

    /**
     * 跳转到视频列表
     *
     * @param activity
     */
    public static void goToVideoPlayer(Activity activity) {
        Intent intent = new Intent(activity, ListVideoActivity.class);
        ActivityOptionsCompat activityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(activity);
        ActivityCompat.startActivity(activity, intent, activityOptions.toBundle());
    }
54 55 56 57 58 59 60 61 62 63 64

    /**
     * 跳转到视频列表2
     *
     * @param activity
     */
    public static void goToVideoPlayer2(Activity activity) {
        Intent intent = new Intent(activity, ListVideo2Activity.class);
        ActivityOptionsCompat activityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(activity);
        ActivityCompat.startActivity(activity, intent, activityOptions.toBundle());
    }
S
shuyu 已提交
65

66 67 68 69 70 71 72 73 74 75 76
    /**
     * 跳转到视频列表2
     *
     * @param activity
     */
    public static void goToVideoRecyclerPlayer2(Activity activity) {
        Intent intent = new Intent(activity, RecyclerView2Activity.class);
        ActivityOptionsCompat activityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(activity);
        ActivityCompat.startActivity(activity, intent, activityOptions.toBundle());
    }

S
shuyu 已提交
77 78 79 80 81 82 83 84 85
    /**
     * 跳转到详情播放
     *
     * @param activity
     */
    public static void goToDetailPlayer(Activity activity) {
        Intent intent = new Intent(activity, DetailPlayer.class);
        activity.startActivity(intent);
    }
S
shuyu 已提交
86 87 88 89 90 91 92 93 94 95

    /**
     * 跳转到详情播放
     *
     * @param activity
     */
    public static void goToDetailListPlayer(Activity activity) {
        Intent intent = new Intent(activity, DetailListPlayer.class);
        activity.startActivity(intent);
    }
S
shuyu 已提交
96
}