diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3dd7b1654fde9ace72e7a5df91ca439b9aedb95e..7d9c16ef77fe122304ca49420a9ede0ef936a0fd 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -2,7 +2,6 @@
-
@@ -12,7 +11,6 @@
-
+
\ No newline at end of file
diff --git a/app/src/main/java/com/example/gsyvideoplayer/ListVideoActivity.java b/app/src/main/java/com/example/gsyvideoplayer/ListVideoActivity.java
new file mode 100644
index 0000000000000000000000000000000000000000..a74b7c335575093ea0168529b94a263803449e12
--- /dev/null
+++ b/app/src/main/java/com/example/gsyvideoplayer/ListVideoActivity.java
@@ -0,0 +1,41 @@
+package com.example.gsyvideoplayer;
+
+import android.os.Build;
+import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
+import android.transition.Explode;
+import android.view.Window;
+import android.widget.ListView;
+import android.widget.RelativeLayout;
+
+import com.example.gsyvideoplayer.adapter.ListVideoAdapter;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+
+public class ListVideoActivity extends AppCompatActivity {
+
+ @BindView(R.id.video_list)
+ ListView videoList;
+ @BindView(R.id.activity_list_video)
+ RelativeLayout activityListVideo;
+
+ ListVideoAdapter listVideoAdapter;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ // 设置一个exit transition
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
+ getWindow().setEnterTransition(new Explode());
+ getWindow().setExitTransition(new Explode());
+ }
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_list_video);
+ ButterKnife.bind(this);
+
+ listVideoAdapter = new ListVideoAdapter(this);
+ videoList.setAdapter(listVideoAdapter);
+
+ }
+}
diff --git a/app/src/main/java/com/example/gsyvideoplayer/MainActivity.java b/app/src/main/java/com/example/gsyvideoplayer/MainActivity.java
index 2789c05a23631eacf1c127da2e3822d8dab1158b..4573693b7fddf24562c85c933b361029b2eb9a0a 100644
--- a/app/src/main/java/com/example/gsyvideoplayer/MainActivity.java
+++ b/app/src/main/java/com/example/gsyvideoplayer/MainActivity.java
@@ -1,7 +1,9 @@
package com.example.gsyvideoplayer;
+import android.app.Activity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
+import android.view.View;
import android.widget.Button;
import com.example.gsyvideoplayer.utils.JumpUtils;
@@ -22,8 +24,15 @@ public class MainActivity extends AppCompatActivity {
ButterKnife.bind(this);
}
- @OnClick(R.id.open_btn)
- public void onClick() {
- JumpUtils.goToVideoPlayer(this, openBtn);
+ @OnClick({R.id.open_btn, R.id.list_btn})
+ public void onClick(View view) {
+ switch (view.getId()) {
+ case R.id.open_btn:
+ JumpUtils.goToVideoPlayer(this, openBtn);
+ break;
+ case R.id.list_btn:
+ JumpUtils.goToVideoPlayer(this);
+ break;
+ }
}
}
diff --git a/app/src/main/java/com/example/gsyvideoplayer/adapter/ListVideoAdapter.java b/app/src/main/java/com/example/gsyvideoplayer/adapter/ListVideoAdapter.java
new file mode 100644
index 0000000000000000000000000000000000000000..4f4c59bde3858995f2f62f32fdee2d3554c82548
--- /dev/null
+++ b/app/src/main/java/com/example/gsyvideoplayer/adapter/ListVideoAdapter.java
@@ -0,0 +1,93 @@
+package com.example.gsyvideoplayer.adapter;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.example.gsyvideoplayer.R;
+import com.example.gsyvideoplayer.model.VideoModel;
+import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by shuyu on 2016/11/11.
+ */
+
+public class ListVideoAdapter extends BaseAdapter {
+
+ private List list = new ArrayList<>();
+ private LayoutInflater inflater = null;
+ private Context context;
+
+ public ListVideoAdapter(Context context) {
+ super();
+ this.context = context;
+ inflater = LayoutInflater.from(context);
+ for (int i = 0; i < 40; i++) {
+ list.add(new VideoModel());
+ }
+
+ }
+
+ @Override
+ public int getCount() {
+ return list.size();
+ }
+
+ @Override
+ public Object getItem(int position) {
+ return null;
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return 0;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ ViewHolder holder = null;
+ if (convertView == null) {
+ holder = new ViewHolder();
+ convertView = inflater.inflate(R.layout.list_video_item, null);
+ holder.standardGSYVideoPlayer = (StandardGSYVideoPlayer) convertView.findViewById(R.id.list_item_video);
+ convertView.setTag(holder);
+ } else {
+ holder = (ViewHolder) convertView.getTag();
+ }
+
+ String url = "http://baobab.wdjcdn.com/14564977406580.mp4";
+ holder.standardGSYVideoPlayer.setUp(url, true, "");
+
+ //增加封面
+ ImageView imageView = new ImageView(context);
+ imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
+ imageView.setImageResource(R.mipmap.xxx1);
+ holder.standardGSYVideoPlayer.setThumbImageView(imageView);
+
+ //增加title
+ holder.standardGSYVideoPlayer.getTitleTextView().setVisibility(View.GONE);
+
+ //设置返回键
+ holder.standardGSYVideoPlayer.getBackButton().setVisibility(View.GONE);
+
+ //设置全屏按键功能
+ holder.standardGSYVideoPlayer.getFullscreenButton().setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ }
+ });
+ return convertView;
+ }
+
+ class ViewHolder {
+ StandardGSYVideoPlayer standardGSYVideoPlayer;
+ }
+}
diff --git a/app/src/main/java/com/example/gsyvideoplayer/model/VideoModel.java b/app/src/main/java/com/example/gsyvideoplayer/model/VideoModel.java
new file mode 100644
index 0000000000000000000000000000000000000000..2adb6f3441dc7564bd6003138b2480e83cd5bc9e
--- /dev/null
+++ b/app/src/main/java/com/example/gsyvideoplayer/model/VideoModel.java
@@ -0,0 +1,8 @@
+package com.example.gsyvideoplayer.model;
+
+/**
+ * Created by shuyu on 2016/11/11.
+ */
+
+public class VideoModel {
+}
diff --git a/app/src/main/java/com/example/gsyvideoplayer/utils/JumpUtils.java b/app/src/main/java/com/example/gsyvideoplayer/utils/JumpUtils.java
index 8daf2fc879c28b2e922fb494874eca6305ebb829..a60563cf2b328a38e64834995b45e0d1e67a1c1a 100644
--- a/app/src/main/java/com/example/gsyvideoplayer/utils/JumpUtils.java
+++ b/app/src/main/java/com/example/gsyvideoplayer/utils/JumpUtils.java
@@ -7,6 +7,7 @@ import android.support.v4.app.ActivityOptionsCompat;
import android.support.v4.util.Pair;
import android.view.View;
+import com.example.gsyvideoplayer.ListVideoActivity;
import com.example.gsyvideoplayer.PlayActivity;
import com.example.gsyvideoplayer.R;
@@ -35,4 +36,15 @@ public class JumpUtils {
activity.overridePendingTransition(R.anim.abc_fade_in, R.anim.abc_fade_out);
}
}
+
+ /**
+ * 跳转到视频列表
+ *
+ * @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());
+ }
}
diff --git a/app/src/main/res/layout/activity_list_video.xml b/app/src/main/res/layout/activity_list_video.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a6c6478c9c32942aa78f5cb3373e7dad08f808d5
--- /dev/null
+++ b/app/src/main/res/layout/activity_list_video.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 2ea84d3ab7a8fecbe690adfc97a08cf3eb4a20ab..fcc4ce15b1f681a6e83e4f3bcdfba94f2fc023f8 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,9 +1,10 @@
-
-
+
+
+
diff --git a/app/src/main/res/layout/list_video_item.xml b/app/src/main/res/layout/list_video_item.xml
new file mode 100644
index 0000000000000000000000000000000000000000..185d29d4b9e6e695fe43bc40f99a21d3e19aaeef
--- /dev/null
+++ b/app/src/main/res/layout/list_video_item.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file