From 2846ee1333698fca7b7e765f4c0cbc9efe556a97 Mon Sep 17 00:00:00 2001
From: Nathen <821537155@qq.com>
Date: Sun, 29 Oct 2017 22:33:27 +0800
Subject: [PATCH 01/46] release surface when complete
---
jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java
index d262a2244..d8c44c4d3 100644
--- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java
+++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java
@@ -712,6 +712,7 @@ public void onCompletion() {
clearFullscreenLayout();
JZUtils.setRequestedOrientation(getContext(), NORMAL_ORIENTATION);
+ if (JZMediaManager.surface != null) JZMediaManager.surface.release();
JZMediaManager.textureView = null;
JZMediaManager.savedSurfaceTexture = null;
isVideoRendingStart = false;
From 65633c8de5481b99972b6514a76b0f6dfa5fa32c Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Tue, 31 Oct 2017 15:00:30 +0800
Subject: [PATCH 02/46] fix code
---
app/src/main/java/cn/jzvd/demo/ApiActivity.java | 12 ++++++------
...deoPlayerStandardAutoCompleteAfterFullscreen.java | 1 -
...PlayerStandardShowShareButtonAfterFullscreen.java | 2 +-
.../java/cn/jzvd/demo/DirectFullscreenActivity.java | 4 ++--
app/src/main/java/cn/jzvd/demo/ListViewActivity.java | 10 +++++-----
.../jzvd/demo/ListViewFragmentViewPagerActivity.java | 2 +-
.../cn/jzvd/demo/ListViewMultiHolderActivity.java | 6 +++---
.../java/cn/jzvd/demo/ListViewNormalActivity.java | 2 +-
.../cn/jzvd/demo/ListViewNormalAutoTinyActivity.java | 2 +-
app/src/main/java/cn/jzvd/demo/MainActivity.java | 12 ++++++------
.../main/java/cn/jzvd/demo/OrientationActivity.java | 2 +-
.../cn/jzvd/demo/RecyclerViewNormalActivity.java | 2 +-
.../java/cn/jzvd/demo/RecyclerViewVideoAdapter.java | 2 +-
.../java/cn/jzvd/demo/UISmallChangeActivity.java | 8 ++++----
app/src/main/java/cn/jzvd/demo/VideoListAdapter.java | 2 +-
app/src/main/java/cn/jzvd/demo/WebViewActivity.java | 2 +-
16 files changed, 35 insertions(+), 36 deletions(-)
diff --git a/app/src/main/java/cn/jzvd/demo/ApiActivity.java b/app/src/main/java/cn/jzvd/demo/ApiActivity.java
index 6349d88aa..f4f01f7e2 100644
--- a/app/src/main/java/cn/jzvd/demo/ApiActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ApiActivity.java
@@ -45,22 +45,22 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
getSupportActionBar().setTitle("Api");
setContentView(R.layout.activity_api);
- mSmallChange = (Button) findViewById(R.id.small_change);
- mBigChange = (Button) findViewById(R.id.big_change);
- mOrientation = (Button) findViewById(R.id.orientation);
- mExtendsNormalActivity = (Button) findViewById(R.id.extends_normal_activity);
+ mSmallChange = findViewById(R.id.small_change);
+ mBigChange = findViewById(R.id.big_change);
+ mOrientation = findViewById(R.id.orientation);
+ mExtendsNormalActivity = findViewById(R.id.extends_normal_activity);
mSmallChange.setOnClickListener(this);
mBigChange.setOnClickListener(this);
mOrientation.setOnClickListener(this);
mExtendsNormalActivity.setOnClickListener(this);
- mJzVideoPlayerSimple = (JZVideoPlayerSimple) findViewById(R.id.simple_demo);
+ mJzVideoPlayerSimple = findViewById(R.id.simple_demo);
mJzVideoPlayerSimple.setUp("http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8"
, JZVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "饺子在家吗");
- mJzVideoPlayerStandard = (JZVideoPlayerStandard) findViewById(R.id.jz_video);
+ mJzVideoPlayerStandard = findViewById(R.id.jz_video);
LinkedHashMap map = new LinkedHashMap();
map.put("高清", VideoConstant.videoUrls[0][9]);
map.put("标清", VideoConstant.videoUrls[0][6]);
diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardAutoCompleteAfterFullscreen.java b/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardAutoCompleteAfterFullscreen.java
index 1c9d86d6c..45e16573d 100644
--- a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardAutoCompleteAfterFullscreen.java
+++ b/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardAutoCompleteAfterFullscreen.java
@@ -25,7 +25,6 @@ public JZVideoPlayerStandardAutoCompleteAfterFullscreen(Context context, Attribu
@Override
public void startVideo() {
-// super.startVideo();
if (currentScreen == SCREEN_WINDOW_FULLSCREEN) {
Log.d(TAG, "startVideo [" + this.hashCode() + "] ");
initTextureView();
diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowShareButtonAfterFullscreen.java b/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowShareButtonAfterFullscreen.java
index abe953a42..90753c433 100755
--- a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowShareButtonAfterFullscreen.java
+++ b/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardShowShareButtonAfterFullscreen.java
@@ -28,7 +28,7 @@ public JZVideoPlayerStandardShowShareButtonAfterFullscreen(Context context, Attr
@Override
public void init(Context context) {
super.init(context);
- shareButton = (ImageView) findViewById(R.id.share);
+ shareButton = findViewById(R.id.share);
shareButton.setOnClickListener(this);
}
diff --git a/app/src/main/java/cn/jzvd/demo/DirectFullscreenActivity.java b/app/src/main/java/cn/jzvd/demo/DirectFullscreenActivity.java
index b2c78e0e2..581978f03 100644
--- a/app/src/main/java/cn/jzvd/demo/DirectFullscreenActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/DirectFullscreenActivity.java
@@ -28,8 +28,8 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
getSupportActionBar().setTitle("PlayDirectlyWithoutLayout");
setContentView(R.layout.activity_directly_play);
- mStartFullscreen = (Button) findViewById(R.id.fullscreen);
- mStartTiny = (Button) findViewById(R.id.tiny_window);
+ mStartFullscreen = findViewById(R.id.fullscreen);
+ mStartTiny = findViewById(R.id.tiny_window);
mStartFullscreen.setOnClickListener(this);
mStartTiny.setOnClickListener(this);
diff --git a/app/src/main/java/cn/jzvd/demo/ListViewActivity.java b/app/src/main/java/cn/jzvd/demo/ListViewActivity.java
index 493672126..83f07219e 100644
--- a/app/src/main/java/cn/jzvd/demo/ListViewActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ListViewActivity.java
@@ -24,11 +24,11 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
getSupportActionBar().setTitle("ListView");
setContentView(R.layout.activity_listview);
- mNormal = (Button) findViewById(R.id.normal);
- mNormalAutoTiny = (Button) findViewById(R.id.normal_auto_tiny);
- mViewPager = (Button) findViewById(R.id.listview_fragment_viewpager);
- mMultiHolder = (Button) findViewById(R.id.multiholder);
- mRecyleView = (Button) findViewById(R.id.recyleview);
+ mNormal = findViewById(R.id.normal);
+ mNormalAutoTiny = findViewById(R.id.normal_auto_tiny);
+ mViewPager = findViewById(R.id.listview_fragment_viewpager);
+ mMultiHolder = findViewById(R.id.multiholder);
+ mRecyleView = findViewById(R.id.recyleview);
mNormal.setOnClickListener(this);
mNormalAutoTiny.setOnClickListener(this);
diff --git a/app/src/main/java/cn/jzvd/demo/ListViewFragmentViewPagerActivity.java b/app/src/main/java/cn/jzvd/demo/ListViewFragmentViewPagerActivity.java
index 2ca4be152..154d89fec 100755
--- a/app/src/main/java/cn/jzvd/demo/ListViewFragmentViewPagerActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ListViewFragmentViewPagerActivity.java
@@ -35,7 +35,7 @@ protected void onCreate(Bundle savedInstanceState) {
fragmentList.add(new DemoFragment().setIndex(2));
MyAdapter myAdapter = new MyAdapter(getSupportFragmentManager());
- ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
+ ViewPager viewPager = findViewById(R.id.viewPager);
viewPager.setAdapter(myAdapter);
viewPager.setOnPageChangeListener(this);
}
diff --git a/app/src/main/java/cn/jzvd/demo/ListViewMultiHolderActivity.java b/app/src/main/java/cn/jzvd/demo/ListViewMultiHolderActivity.java
index 539b25af5..47e44ec59 100755
--- a/app/src/main/java/cn/jzvd/demo/ListViewMultiHolderActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ListViewMultiHolderActivity.java
@@ -36,7 +36,7 @@ protected void onCreate(Bundle savedInstanceState) {
getSupportActionBar().setTitle("MultiHolderListView");
- listView = (ListView) findViewById(R.id.listview);
+ listView = findViewById(R.id.listview);
mAdapter = new VideoListAdapter(this);
listView.setAdapter(mAdapter);
@@ -113,7 +113,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
} else {
viewHolder = new VideoHolder();
convertView = mInflater.inflate(R.layout.item_videoview, null);
- viewHolder.jzVideoPlayer = (JZVideoPlayerStandard) convertView.findViewById(R.id.videoplayer);
+ viewHolder.jzVideoPlayer = convertView.findViewById(R.id.videoplayer);
convertView.setTag(viewHolder);
}
@@ -132,7 +132,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
textViewHolder = new TextViewHolder();
LayoutInflater mInflater = LayoutInflater.from(context);
convertView = mInflater.inflate(R.layout.item_textview, null);
- textViewHolder.textView = (TextView) convertView.findViewById(R.id.textview);
+ textViewHolder.textView = convertView.findViewById(R.id.textview);
convertView.setTag(textViewHolder);
}
}
diff --git a/app/src/main/java/cn/jzvd/demo/ListViewNormalActivity.java b/app/src/main/java/cn/jzvd/demo/ListViewNormalActivity.java
index 74f7abe31..5b0779dce 100644
--- a/app/src/main/java/cn/jzvd/demo/ListViewNormalActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ListViewNormalActivity.java
@@ -33,7 +33,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
getSupportActionBar().setTitle("NormalListView");
setContentView(R.layout.activity_listview_normal);
- listView = (ListView) findViewById(R.id.listview);
+ listView = findViewById(R.id.listview);
listView.setAdapter(new VideoListAdapter(this,
VideoConstant.videoUrls[0],
VideoConstant.videoTitles[0],
diff --git a/app/src/main/java/cn/jzvd/demo/ListViewNormalAutoTinyActivity.java b/app/src/main/java/cn/jzvd/demo/ListViewNormalAutoTinyActivity.java
index 25731788e..14a4c2ac6 100644
--- a/app/src/main/java/cn/jzvd/demo/ListViewNormalAutoTinyActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ListViewNormalAutoTinyActivity.java
@@ -30,7 +30,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
getSupportActionBar().setTitle("NormalListViewAutoTiny");
setContentView(R.layout.activity_listview_normal_auto_tiny);
- listView = (ListView) findViewById(R.id.listview);
+ listView = findViewById(R.id.listview);
listView.setAdapter(new VideoListAdapter(this,
VideoConstant.videoUrls[0],
VideoConstant.videoTitles[0],
diff --git a/app/src/main/java/cn/jzvd/demo/MainActivity.java b/app/src/main/java/cn/jzvd/demo/MainActivity.java
index 9fac8c0d9..528587343 100644
--- a/app/src/main/java/cn/jzvd/demo/MainActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/MainActivity.java
@@ -31,11 +31,11 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- mTinyWindow = (Button) findViewById(R.id.tiny_window);
- mDirectFullscreen = (Button) findViewById(R.id.direct_fullscreen);
- mListView = (Button) findViewById(R.id.listview);
- mApi = (Button) findViewById(R.id.api);
- mWebView = (Button) findViewById(R.id.webview);
+ mTinyWindow = findViewById(R.id.tiny_window);
+ mDirectFullscreen = findViewById(R.id.direct_fullscreen);
+ mListView = findViewById(R.id.listview);
+ mApi = findViewById(R.id.api);
+ mWebView = findViewById(R.id.webview);
mTinyWindow.setOnClickListener(this);
mListView.setOnClickListener(this);
@@ -43,7 +43,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
mApi.setOnClickListener(this);
mWebView.setOnClickListener(this);
- myJZVideoPlayerStandard = (MyJZVideoPlayerStandard) findViewById(R.id.jz_video);
+ myJZVideoPlayerStandard = findViewById(R.id.jz_video);
myJZVideoPlayerStandard.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4"
, JZVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "饺子快长大");
Picasso.with(this)
diff --git a/app/src/main/java/cn/jzvd/demo/OrientationActivity.java b/app/src/main/java/cn/jzvd/demo/OrientationActivity.java
index b8b787a9a..c2f9594cb 100644
--- a/app/src/main/java/cn/jzvd/demo/OrientationActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/OrientationActivity.java
@@ -26,7 +26,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
getSupportActionBar().setDisplayUseLogoEnabled(false);
getSupportActionBar().setTitle("Orientation");
setContentView(R.layout.activity_orientation);
- mJzVideoPlayerStandard = (JZVideoPlayerStandard) findViewById(R.id.jz_video);
+ mJzVideoPlayerStandard = findViewById(R.id.jz_video);
mJzVideoPlayerStandard.setUp(VideoConstant.videoUrlList[0]
, JZVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "饺子不信");
Picasso.with(this)
diff --git a/app/src/main/java/cn/jzvd/demo/RecyclerViewNormalActivity.java b/app/src/main/java/cn/jzvd/demo/RecyclerViewNormalActivity.java
index d31c5be54..23cb3cdf3 100644
--- a/app/src/main/java/cn/jzvd/demo/RecyclerViewNormalActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/RecyclerViewNormalActivity.java
@@ -33,7 +33,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
getSupportActionBar().setTitle("NormalRecyclerView");
setContentView(R.layout.activity_recyclerview_content);
- recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
+ recyclerView = findViewById(R.id.recyclerview);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
adapterVideoList = new RecyclerViewVideoAdapter(this);
diff --git a/app/src/main/java/cn/jzvd/demo/RecyclerViewVideoAdapter.java b/app/src/main/java/cn/jzvd/demo/RecyclerViewVideoAdapter.java
index 2dfab5796..00a96ce95 100644
--- a/app/src/main/java/cn/jzvd/demo/RecyclerViewVideoAdapter.java
+++ b/app/src/main/java/cn/jzvd/demo/RecyclerViewVideoAdapter.java
@@ -54,7 +54,7 @@ class MyViewHolder extends RecyclerView.ViewHolder {
public MyViewHolder(View itemView) {
super(itemView);
- jzVideoPlayer = (JZVideoPlayerStandard) itemView.findViewById(R.id.videoplayer);
+ jzVideoPlayer = itemView.findViewById(R.id.videoplayer);
}
}
diff --git a/app/src/main/java/cn/jzvd/demo/UISmallChangeActivity.java b/app/src/main/java/cn/jzvd/demo/UISmallChangeActivity.java
index 615c5825b..25badd7c3 100644
--- a/app/src/main/java/cn/jzvd/demo/UISmallChangeActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/UISmallChangeActivity.java
@@ -35,7 +35,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
getSupportActionBar().setTitle("SmallChangeUI");
setContentView(R.layout.activity_ui_small_change);
- jzVideoPlayerStandardWithShareButton = (JZVideoPlayerStandardShowShareButtonAfterFullscreen) findViewById(R.id.custom_videoplayer_standard_with_share_button);
+ jzVideoPlayerStandardWithShareButton = findViewById(R.id.custom_videoplayer_standard_with_share_button);
jzVideoPlayerStandardWithShareButton.setUp(VideoConstant.videoUrlList[3], JZVideoPlayer.SCREEN_LAYOUT_NORMAL
, "饺子想呼吸");
Picasso.with(this)
@@ -43,21 +43,21 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
.into(jzVideoPlayerStandardWithShareButton.thumbImageView);
- jzVideoPlayerStandardShowTitleAfterFullscreen = (JZVideoPlayerStandardShowTitleAfterFullscreen) findViewById(R.id.custom_videoplayer_standard_show_title_after_fullscreen);
+ jzVideoPlayerStandardShowTitleAfterFullscreen = findViewById(R.id.custom_videoplayer_standard_show_title_after_fullscreen);
jzVideoPlayerStandardShowTitleAfterFullscreen.setUp(VideoConstant.videoUrlList[4], JZVideoPlayer.SCREEN_LAYOUT_NORMAL
, "饺子想摇头");
Picasso.with(this)
.load(VideoConstant.videoThumbList[4])
.into(jzVideoPlayerStandardShowTitleAfterFullscreen.thumbImageView);
- jzVideoPlayerStandardShowTextureViewAfterAutoComplete = (JZVideoPlayerStandardShowTextureViewAfterAutoComplete) findViewById(R.id.custom_videoplayer_standard_show_textureview_aoto_complete);
+ jzVideoPlayerStandardShowTextureViewAfterAutoComplete = findViewById(R.id.custom_videoplayer_standard_show_textureview_aoto_complete);
jzVideoPlayerStandardShowTextureViewAfterAutoComplete.setUp(VideoConstant.videoUrlList[5], JZVideoPlayer.SCREEN_LAYOUT_NORMAL
, "饺子想旅行");
Picasso.with(this)
.load(VideoConstant.videoThumbList[5])
.into(jzVideoPlayerStandardShowTextureViewAfterAutoComplete.thumbImageView);
- jzVideoPlayerStandardAutoCompleteAfterFullscreen = (JZVideoPlayerStandardAutoCompleteAfterFullscreen) findViewById(R.id.custom_videoplayer_standard_aoto_complete);
+ jzVideoPlayerStandardAutoCompleteAfterFullscreen = findViewById(R.id.custom_videoplayer_standard_aoto_complete);
jzVideoPlayerStandardAutoCompleteAfterFullscreen.setUp(VideoConstant.videoUrls[0][1], JZVideoPlayer.SCREEN_LAYOUT_NORMAL
, "饺子没来");
Picasso.with(this)
diff --git a/app/src/main/java/cn/jzvd/demo/VideoListAdapter.java b/app/src/main/java/cn/jzvd/demo/VideoListAdapter.java
index 98d06a82b..2b89fdbcc 100755
--- a/app/src/main/java/cn/jzvd/demo/VideoListAdapter.java
+++ b/app/src/main/java/cn/jzvd/demo/VideoListAdapter.java
@@ -59,7 +59,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
- viewHolder.jzVideoPlayer = (JZVideoPlayerStandard) convertView.findViewById(R.id.videoplayer);
+ viewHolder.jzVideoPlayer = convertView.findViewById(R.id.videoplayer);
viewHolder.jzVideoPlayer.setUp(
videoUrls[position], JZVideoPlayer.SCREEN_LAYOUT_LIST,
videoTitles[position]);
diff --git a/app/src/main/java/cn/jzvd/demo/WebViewActivity.java b/app/src/main/java/cn/jzvd/demo/WebViewActivity.java
index 1ae95f118..37df6693d 100644
--- a/app/src/main/java/cn/jzvd/demo/WebViewActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/WebViewActivity.java
@@ -31,7 +31,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
getSupportActionBar().setDisplayUseLogoEnabled(false);
getSupportActionBar().setTitle("WebView");
setContentView(R.layout.activity_webview);
- mWebView = (WebView) findViewById(R.id.webview);
+ mWebView = findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.addJavascriptInterface(new JZCallBack(), "jzvd");
mWebView.loadUrl("file:///android_asset/jzvd.html");
From 903dd085943cd006c4e9a609e9b7de2fbb35a92e Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Tue, 31 Oct 2017 15:18:47 +0800
Subject: [PATCH 03/46] fix null point bug
---
app/src/main/AndroidManifest.xml | 4 ++
.../main/java/cn/jzvd/demo/MainActivity.java | 2 +-
.../java/cn/jzvd/demo/TinyWindowActivity.java | 39 ++++++++++++++++++
.../main/res/layout/activity_tiny_window.xml | 40 +++++++++++++++++++
.../java/cn/jzvd/JZVideoPlayerStandard.java | 2 +-
5 files changed, 85 insertions(+), 2 deletions(-)
create mode 100644 app/src/main/java/cn/jzvd/demo/TinyWindowActivity.java
create mode 100644 app/src/main/res/layout/activity_tiny_window.xml
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 2cc47f836..ec3bea71c 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -47,6 +47,10 @@
android:name=".ListViewMultiHolderActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:screenOrientation="portrait" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java
index fe2a86394..441b11268 100644
--- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java
+++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java
@@ -264,7 +264,7 @@ public void onClick(View v) {
super.onClick(v);
int i = v.getId();
if (i == R.id.thumb) {
- if (TextUtils.isEmpty(JZUtils.getCurrentUrlFromMap(urlMap, currentUrlMapIndex))) {
+ if (urlMap == null || TextUtils.isEmpty(JZUtils.getCurrentUrlFromMap(urlMap, currentUrlMapIndex))) {
Toast.makeText(getContext(), getResources().getString(R.string.no_url), Toast.LENGTH_SHORT).show();
return;
}
From 9eb799671638d995e2ffe4ee7fbd435a73c4ee53 Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Tue, 31 Oct 2017 15:45:28 +0800
Subject: [PATCH 04/46] auto tiny list view
---
.../java/cn/jzvd/demo/ListViewActivity.java | 7 +--
.../java/cn/jzvd/demo/TinyWindowActivity.java | 49 ++++++++++++++++++-
app/src/main/res/layout/activity_listview.xml | 8 ---
app/src/main/res/layout/activity_main.xml | 18 +++----
.../main/res/layout/activity_tiny_window.xml | 6 +--
5 files changed, 60 insertions(+), 28 deletions(-)
diff --git a/app/src/main/java/cn/jzvd/demo/ListViewActivity.java b/app/src/main/java/cn/jzvd/demo/ListViewActivity.java
index 83f07219e..7a764c26e 100644
--- a/app/src/main/java/cn/jzvd/demo/ListViewActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ListViewActivity.java
@@ -12,7 +12,7 @@
* Created by Nathen on 16/7/31.
*/
public class ListViewActivity extends AppCompatActivity implements View.OnClickListener {
- Button mNormal, mNormalAutoTiny, mViewPager, mMultiHolder, mRecyleView;
+ Button mNormal, mViewPager, mMultiHolder, mRecyleView;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
@@ -25,13 +25,11 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
setContentView(R.layout.activity_listview);
mNormal = findViewById(R.id.normal);
- mNormalAutoTiny = findViewById(R.id.normal_auto_tiny);
mViewPager = findViewById(R.id.listview_fragment_viewpager);
mMultiHolder = findViewById(R.id.multiholder);
mRecyleView = findViewById(R.id.recyleview);
mNormal.setOnClickListener(this);
- mNormalAutoTiny.setOnClickListener(this);
mViewPager.setOnClickListener(this);
mMultiHolder.setOnClickListener(this);
mRecyleView.setOnClickListener(this);
@@ -44,9 +42,6 @@ public void onClick(View v) {
case R.id.normal:
startActivity(new Intent(ListViewActivity.this, ListViewNormalActivity.class));
break;
- case R.id.normal_auto_tiny:
- startActivity(new Intent(ListViewActivity.this, ListViewNormalAutoTinyActivity.class));
- break;
case R.id.listview_fragment_viewpager:
startActivity(new Intent(ListViewActivity.this, ListViewFragmentViewPagerActivity.class));
break;
diff --git a/app/src/main/java/cn/jzvd/demo/TinyWindowActivity.java b/app/src/main/java/cn/jzvd/demo/TinyWindowActivity.java
index 2ccc58f96..509a322b3 100644
--- a/app/src/main/java/cn/jzvd/demo/TinyWindowActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/TinyWindowActivity.java
@@ -1,11 +1,16 @@
package cn.jzvd.demo;
+import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
+import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
+import com.squareup.picasso.Picasso;
+
+import cn.jzvd.JZVideoPlayer;
import cn.jzvd.JZVideoPlayerStandard;
/**
@@ -15,18 +20,31 @@
public class TinyWindowActivity extends AppCompatActivity implements View.OnClickListener {
JZVideoPlayerStandard mJzVideoPlayerStandard;
- Button mBtnTinyWindow;
+ Button mBtnTinyWindow, mBtnAutoTinyListView;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayShowHomeEnabled(true);
+ getSupportActionBar().setDisplayShowTitleEnabled(true);
+ getSupportActionBar().setDisplayUseLogoEnabled(false);
+ getSupportActionBar().setTitle("TinyWindow");
setContentView(R.layout.activity_tiny_window);
mJzVideoPlayerStandard = findViewById(R.id.jz_video);
+ mJzVideoPlayerStandard.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4"
+ , JZVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "饺子快长大");
+ Picasso.with(this)
+ .load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png")
+ .into(mJzVideoPlayerStandard.thumbImageView);
+
mBtnTinyWindow = findViewById(R.id.tiny_window);
+ mBtnAutoTinyListView = findViewById(R.id.auto_tiny_list_view);
mBtnTinyWindow.setOnClickListener(this);
- }
+ mBtnAutoTinyListView.setOnClickListener(this);
+ }
@Override
public void onClick(View view) {
@@ -34,6 +52,33 @@ public void onClick(View view) {
case R.id.tiny_window:
mJzVideoPlayerStandard.startWindowTiny();
break;
+ case R.id.auto_tiny_list_view:
+ startActivity(new Intent(this, ListViewNormalAutoTinyActivity.class));
+ break;
+ }
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ JZVideoPlayer.releaseAllVideos();
+ }
+
+ @Override
+ public void onBackPressed() {
+ if (JZVideoPlayer.backPress()) {
+ return;
+ }
+ super.onBackPressed();
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case android.R.id.home:
+ finish();
+ break;
}
+ return super.onOptionsItemSelected(item);
}
}
diff --git a/app/src/main/res/layout/activity_listview.xml b/app/src/main/res/layout/activity_listview.xml
index cff676d01..ad7f4e8be 100644
--- a/app/src/main/res/layout/activity_listview.xml
+++ b/app/src/main/res/layout/activity_listview.xml
@@ -12,14 +12,6 @@
android:layout_marginTop="8dp"
android:text="Normal ListView" />
-
-
-
-
+
+
diff --git a/app/src/main/res/layout/activity_tiny_window.xml b/app/src/main/res/layout/activity_tiny_window.xml
index ef40ca74b..2208d9f3f 100644
--- a/app/src/main/res/layout/activity_tiny_window.xml
+++ b/app/src/main/res/layout/activity_tiny_window.xml
@@ -25,15 +25,15 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp"
- android:text="Tiny Window" />
+ android:text="Start Tiny Window" />
+ android:text="AutoTinyListView" />
From aff5cf66fde5ccd9b015d94ceae0e1d48a1b8ebc Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Tue, 31 Oct 2017 17:36:03 +0800
Subject: [PATCH 05/46] go on demo
---
app/src/main/AndroidManifest.xml | 32 ++---
.../{ApiActivity.java => ActivityApi.java} | 12 +-
...ity.java => ActivityApiExtendsNormal.java} | 2 +-
...ivity.java => ActivityApiOrientation.java} | 2 +-
...ivity.java => ActivityApiUIBigChange.java} | 2 +-
...ity.java => ActivityApiUISmallChange.java} | 2 +-
...nActivity.java => ActivityDirectPlay.java} | 6 +-
...iewActivity.java => ActivityListView.java} | 10 +-
...=> ActivityListViewFragmentViewPager.java} | 12 +-
....java => ActivityListViewMultiHolder.java} | 4 +-
...ivity.java => ActivityListViewNormal.java} | 7 +-
...java => ActivityListViewRecyclerView.java} | 10 +-
.../{MainActivity.java => ActivityMain.java} | 22 ++--
...wActivity.java => ActivityTinyWindow.java} | 4 +-
... => ActivityTinyWindowListViewNormal.java} | 9 +-
...ViewActivity.java => ActivityWebView.java} | 26 ++--
...ter.java => AdapterRecyclerViewVideo.java} | 122 +++++++++---------
...ListAdapter.java => AdapterVideoList.java} | 4 +-
...oApplication.java => ApplicationDemo.java} | 2 +-
.../{DemoFragment.java => FragmentDemo.java} | 7 +-
app/src/main/res/layout/activity_main.xml | 14 +-
.../main/res/layout/activity_tiny_window.xml | 2 +-
22 files changed, 152 insertions(+), 161 deletions(-)
rename app/src/main/java/cn/jzvd/demo/{ApiActivity.java => ActivityApi.java} (92%)
rename app/src/main/java/cn/jzvd/demo/{ExtendsNormalActivity.java => ActivityApiExtendsNormal.java} (94%)
rename app/src/main/java/cn/jzvd/demo/{OrientationActivity.java => ActivityApiOrientation.java} (97%)
rename app/src/main/java/cn/jzvd/demo/{UIBigChangeActivity.java => ActivityApiUIBigChange.java} (95%)
rename app/src/main/java/cn/jzvd/demo/{UISmallChangeActivity.java => ActivityApiUISmallChange.java} (98%)
rename app/src/main/java/cn/jzvd/demo/{DirectFullscreenActivity.java => ActivityDirectPlay.java} (87%)
rename app/src/main/java/cn/jzvd/demo/{ListViewActivity.java => ActivityListView.java} (79%)
rename app/src/main/java/cn/jzvd/demo/{ListViewFragmentViewPagerActivity.java => ActivityListViewFragmentViewPager.java} (86%)
mode change 100755 => 100644
rename app/src/main/java/cn/jzvd/demo/{ListViewMultiHolderActivity.java => ActivityListViewMultiHolder.java} (97%)
mode change 100755 => 100644
rename app/src/main/java/cn/jzvd/demo/{ListViewNormalActivity.java => ActivityListViewNormal.java} (92%)
rename app/src/main/java/cn/jzvd/demo/{RecyclerViewNormalActivity.java => ActivityListViewRecyclerView.java} (90%)
rename app/src/main/java/cn/jzvd/demo/{MainActivity.java => ActivityMain.java} (91%)
rename app/src/main/java/cn/jzvd/demo/{TinyWindowActivity.java => ActivityTinyWindow.java} (94%)
rename app/src/main/java/cn/jzvd/demo/{ListViewNormalAutoTinyActivity.java => ActivityTinyWindowListViewNormal.java} (87%)
rename app/src/main/java/cn/jzvd/demo/{WebViewActivity.java => ActivityWebView.java} (78%)
rename app/src/main/java/cn/jzvd/demo/{RecyclerViewVideoAdapter.java => AdapterRecyclerViewVideo.java} (85%)
rename app/src/main/java/cn/jzvd/demo/{VideoListAdapter.java => AdapterVideoList.java} (94%)
mode change 100755 => 100644
rename app/src/main/java/cn/jzvd/demo/{DemoApplication.java => ApplicationDemo.java} (89%)
rename app/src/main/java/cn/jzvd/demo/{DemoFragment.java => FragmentDemo.java} (88%)
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index ec3bea71c..d245397b9 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -7,13 +7,13 @@
@@ -24,59 +24,59 @@
diff --git a/app/src/main/java/cn/jzvd/demo/ApiActivity.java b/app/src/main/java/cn/jzvd/demo/ActivityApi.java
similarity index 92%
rename from app/src/main/java/cn/jzvd/demo/ApiActivity.java
rename to app/src/main/java/cn/jzvd/demo/ActivityApi.java
index f4f01f7e2..2a8b9b70a 100644
--- a/app/src/main/java/cn/jzvd/demo/ApiActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityApi.java
@@ -28,7 +28,7 @@
/**
* Created by Nathen on 16/7/31.
*/
-public class ApiActivity extends AppCompatActivity implements View.OnClickListener {
+public class ActivityApi extends AppCompatActivity implements View.OnClickListener {
Button mSmallChange, mBigChange, mOrientation, mExtendsNormalActivity;
JZVideoPlayerSimple mJzVideoPlayerSimple;
JZVideoPlayerStandard mJzVideoPlayerStandard;
@@ -101,17 +101,17 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
public void onClick(View v) {
switch (v.getId()) {
case R.id.small_change:
- startActivity(new Intent(ApiActivity.this, UISmallChangeActivity.class));
+ startActivity(new Intent(ActivityApi.this, ActivityApiUISmallChange.class));
break;
case R.id.big_change:
- Toast.makeText(ApiActivity.this, "Comming Soon", Toast.LENGTH_SHORT).show();
-// startActivity(new Intent(ApiActivity.this, UIBigChangeActivity.class));
+ Toast.makeText(ActivityApi.this, "Comming Soon", Toast.LENGTH_SHORT).show();
+// startActivity(new Intent(ActivityApi.this, ActivityApiUIBigChange.class));
break;
case R.id.orientation:
- startActivity(new Intent(ApiActivity.this, OrientationActivity.class));
+ startActivity(new Intent(ActivityApi.this, ActivityApiOrientation.class));
break;
case R.id.extends_normal_activity:
- startActivity(new Intent(ApiActivity.this, ExtendsNormalActivity.class));
+ startActivity(new Intent(ActivityApi.this, ActivityApiExtendsNormal.class));
break;
}
}
diff --git a/app/src/main/java/cn/jzvd/demo/ExtendsNormalActivity.java b/app/src/main/java/cn/jzvd/demo/ActivityApiExtendsNormal.java
similarity index 94%
rename from app/src/main/java/cn/jzvd/demo/ExtendsNormalActivity.java
rename to app/src/main/java/cn/jzvd/demo/ActivityApiExtendsNormal.java
index c2abe0bfe..125c1c205 100644
--- a/app/src/main/java/cn/jzvd/demo/ExtendsNormalActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityApiExtendsNormal.java
@@ -12,7 +12,7 @@
* Created by Nathen on 2017/9/19.
*/
-public class ExtendsNormalActivity extends Activity {
+public class ActivityApiExtendsNormal extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
diff --git a/app/src/main/java/cn/jzvd/demo/OrientationActivity.java b/app/src/main/java/cn/jzvd/demo/ActivityApiOrientation.java
similarity index 97%
rename from app/src/main/java/cn/jzvd/demo/OrientationActivity.java
rename to app/src/main/java/cn/jzvd/demo/ActivityApiOrientation.java
index c2f9594cb..578067317 100644
--- a/app/src/main/java/cn/jzvd/demo/OrientationActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityApiOrientation.java
@@ -14,7 +14,7 @@
/**
* Created by Nathen on 2016/12/30.
*/
-public class OrientationActivity extends AppCompatActivity {
+public class ActivityApiOrientation extends AppCompatActivity {
JZVideoPlayerStandard mJzVideoPlayerStandard;
@Override
diff --git a/app/src/main/java/cn/jzvd/demo/UIBigChangeActivity.java b/app/src/main/java/cn/jzvd/demo/ActivityApiUIBigChange.java
similarity index 95%
rename from app/src/main/java/cn/jzvd/demo/UIBigChangeActivity.java
rename to app/src/main/java/cn/jzvd/demo/ActivityApiUIBigChange.java
index 0b21af709..62b5ebd8c 100644
--- a/app/src/main/java/cn/jzvd/demo/UIBigChangeActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityApiUIBigChange.java
@@ -10,7 +10,7 @@
/**
* Created by Nathen on 16/7/31.
*/
-public class UIBigChangeActivity extends AppCompatActivity {
+public class ActivityApiUIBigChange extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
diff --git a/app/src/main/java/cn/jzvd/demo/UISmallChangeActivity.java b/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java
similarity index 98%
rename from app/src/main/java/cn/jzvd/demo/UISmallChangeActivity.java
rename to app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java
index 25badd7c3..890658d01 100644
--- a/app/src/main/java/cn/jzvd/demo/UISmallChangeActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java
@@ -17,7 +17,7 @@
/**
* Created by Nathen on 16/7/31.
*/
-public class UISmallChangeActivity extends AppCompatActivity {
+public class ActivityApiUISmallChange extends AppCompatActivity {
JZVideoPlayerStandardShowShareButtonAfterFullscreen jzVideoPlayerStandardWithShareButton;
JZVideoPlayerStandardShowTitleAfterFullscreen jzVideoPlayerStandardShowTitleAfterFullscreen;
JZVideoPlayerStandardShowTextureViewAfterAutoComplete jzVideoPlayerStandardShowTextureViewAfterAutoComplete;
diff --git a/app/src/main/java/cn/jzvd/demo/DirectFullscreenActivity.java b/app/src/main/java/cn/jzvd/demo/ActivityDirectPlay.java
similarity index 87%
rename from app/src/main/java/cn/jzvd/demo/DirectFullscreenActivity.java
rename to app/src/main/java/cn/jzvd/demo/ActivityDirectPlay.java
index 581978f03..b167363d6 100644
--- a/app/src/main/java/cn/jzvd/demo/DirectFullscreenActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityDirectPlay.java
@@ -14,7 +14,7 @@
/**
* Created by Nathen on 16/7/31.
*/
-public class DirectFullscreenActivity extends AppCompatActivity implements View.OnClickListener {
+public class ActivityDirectPlay extends AppCompatActivity implements View.OnClickListener {
Button mStartFullscreen, mStartTiny;
@Override
@@ -25,7 +25,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(true);
getSupportActionBar().setDisplayUseLogoEnabled(false);
- getSupportActionBar().setTitle("PlayDirectlyWithoutLayout");
+ getSupportActionBar().setTitle("DirectPlays");
setContentView(R.layout.activity_directly_play);
mStartFullscreen = findViewById(R.id.fullscreen);
@@ -43,7 +43,7 @@ public void onClick(View v) {
JZVideoPlayerStandard.startFullscreen(this, JZVideoPlayerStandard.class, VideoConstant.videoUrlList[6], "饺子辛苦了");
break;
case R.id.tiny_window:
- Toast.makeText(DirectFullscreenActivity.this, "Comming Soon", Toast.LENGTH_SHORT).show();
+ Toast.makeText(ActivityDirectPlay.this, "Comming Soon", Toast.LENGTH_SHORT).show();
break;
}
}
diff --git a/app/src/main/java/cn/jzvd/demo/ListViewActivity.java b/app/src/main/java/cn/jzvd/demo/ActivityListView.java
similarity index 79%
rename from app/src/main/java/cn/jzvd/demo/ListViewActivity.java
rename to app/src/main/java/cn/jzvd/demo/ActivityListView.java
index 7a764c26e..a710ded8c 100644
--- a/app/src/main/java/cn/jzvd/demo/ListViewActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityListView.java
@@ -11,7 +11,7 @@
/**
* Created by Nathen on 16/7/31.
*/
-public class ListViewActivity extends AppCompatActivity implements View.OnClickListener {
+public class ActivityListView extends AppCompatActivity implements View.OnClickListener {
Button mNormal, mViewPager, mMultiHolder, mRecyleView;
@Override
@@ -40,16 +40,16 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
public void onClick(View v) {
switch (v.getId()) {
case R.id.normal:
- startActivity(new Intent(ListViewActivity.this, ListViewNormalActivity.class));
+ startActivity(new Intent(ActivityListView.this, ActivityListViewNormal.class));
break;
case R.id.listview_fragment_viewpager:
- startActivity(new Intent(ListViewActivity.this, ListViewFragmentViewPagerActivity.class));
+ startActivity(new Intent(ActivityListView.this, ActivityListViewFragmentViewPager.class));
break;
case R.id.multiholder:
- startActivity(new Intent(ListViewActivity.this, ListViewMultiHolderActivity.class));
+ startActivity(new Intent(ActivityListView.this, ActivityListViewMultiHolder.class));
break;
case R.id.recyleview:
- startActivity(new Intent(ListViewActivity.this, RecyclerViewNormalActivity.class));
+ startActivity(new Intent(ActivityListView.this, ActivityListViewRecyclerView.class));
break;
}
}
diff --git a/app/src/main/java/cn/jzvd/demo/ListViewFragmentViewPagerActivity.java b/app/src/main/java/cn/jzvd/demo/ActivityListViewFragmentViewPager.java
old mode 100755
new mode 100644
similarity index 86%
rename from app/src/main/java/cn/jzvd/demo/ListViewFragmentViewPagerActivity.java
rename to app/src/main/java/cn/jzvd/demo/ActivityListViewFragmentViewPager.java
index 154d89fec..ca8aca8db
--- a/app/src/main/java/cn/jzvd/demo/ListViewFragmentViewPagerActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityListViewFragmentViewPager.java
@@ -17,8 +17,8 @@
* Created by Nathen
* On 2016/02/07 01:01
*/
-public class ListViewFragmentViewPagerActivity extends AppCompatActivity implements ViewPager.OnPageChangeListener {
- List fragmentList = new ArrayList<>();
+public class ActivityListViewFragmentViewPager extends AppCompatActivity implements ViewPager.OnPageChangeListener {
+ List fragmentList = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -28,11 +28,11 @@ protected void onCreate(Bundle savedInstanceState) {
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(true);
getSupportActionBar().setDisplayUseLogoEnabled(false);
- getSupportActionBar().setTitle("ListViewFragmentViewPagerActivity");
+ getSupportActionBar().setTitle("ActivityListViewFragmentViewPager");
- fragmentList.add(new DemoFragment().setIndex(0));
- fragmentList.add(new DemoFragment().setIndex(1));
- fragmentList.add(new DemoFragment().setIndex(2));
+ fragmentList.add(new FragmentDemo().setIndex(0));
+ fragmentList.add(new FragmentDemo().setIndex(1));
+ fragmentList.add(new FragmentDemo().setIndex(2));
MyAdapter myAdapter = new MyAdapter(getSupportFragmentManager());
ViewPager viewPager = findViewById(R.id.viewPager);
diff --git a/app/src/main/java/cn/jzvd/demo/ListViewMultiHolderActivity.java b/app/src/main/java/cn/jzvd/demo/ActivityListViewMultiHolder.java
old mode 100755
new mode 100644
similarity index 97%
rename from app/src/main/java/cn/jzvd/demo/ListViewMultiHolderActivity.java
rename to app/src/main/java/cn/jzvd/demo/ActivityListViewMultiHolder.java
index 47e44ec59..81cf2d639
--- a/app/src/main/java/cn/jzvd/demo/ListViewMultiHolderActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityListViewMultiHolder.java
@@ -21,7 +21,7 @@
* Created by Nathen
* On 2016/05/23 21:34
*/
-public class ListViewMultiHolderActivity extends AppCompatActivity {
+public class ActivityListViewMultiHolder extends AppCompatActivity {
ListView listView;
VideoListAdapter mAdapter;
@@ -121,7 +121,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
VideoConstant.videoUrls[0][position], JZVideoPlayer.SCREEN_LAYOUT_LIST,
VideoConstant.videoTitles[0][position]);
viewHolder.jzVideoPlayer.positionInList = position;
- Picasso.with(ListViewMultiHolderActivity.this)
+ Picasso.with(ActivityListViewMultiHolder.this)
.load(VideoConstant.videoThumbs[0][position])
.into(viewHolder.jzVideoPlayer.thumbImageView);
} else {
diff --git a/app/src/main/java/cn/jzvd/demo/ListViewNormalActivity.java b/app/src/main/java/cn/jzvd/demo/ActivityListViewNormal.java
similarity index 92%
rename from app/src/main/java/cn/jzvd/demo/ListViewNormalActivity.java
rename to app/src/main/java/cn/jzvd/demo/ActivityListViewNormal.java
index 5b0779dce..55607084b 100644
--- a/app/src/main/java/cn/jzvd/demo/ListViewNormalActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityListViewNormal.java
@@ -5,19 +5,16 @@
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
-import android.util.Log;
import android.view.MenuItem;
import android.widget.AbsListView;
import android.widget.ListView;
-import cn.jzvd.JZMediaManager;
import cn.jzvd.JZVideoPlayer;
-import cn.jzvd.JZVideoPlayerManager;
/**
* Created by Nathen on 16/7/31.
*/
-public class ListViewNormalActivity extends AppCompatActivity {
+public class ActivityListViewNormal extends AppCompatActivity {
ListView listView;
SensorManager sensorManager;
@@ -34,7 +31,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
setContentView(R.layout.activity_listview_normal);
listView = findViewById(R.id.listview);
- listView.setAdapter(new VideoListAdapter(this,
+ listView.setAdapter(new AdapterVideoList(this,
VideoConstant.videoUrls[0],
VideoConstant.videoTitles[0],
VideoConstant.videoThumbs[0]));
diff --git a/app/src/main/java/cn/jzvd/demo/RecyclerViewNormalActivity.java b/app/src/main/java/cn/jzvd/demo/ActivityListViewRecyclerView.java
similarity index 90%
rename from app/src/main/java/cn/jzvd/demo/RecyclerViewNormalActivity.java
rename to app/src/main/java/cn/jzvd/demo/ActivityListViewRecyclerView.java
index 23cb3cdf3..18373fe95 100644
--- a/app/src/main/java/cn/jzvd/demo/RecyclerViewNormalActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityListViewRecyclerView.java
@@ -5,11 +5,9 @@
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
-import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.AbsListView;
import cn.jzvd.JZMediaManager;
import cn.jzvd.JZUtils;
@@ -19,9 +17,9 @@
/**
* Created by yujunkui on 16/8/29.
*/
-public class RecyclerViewNormalActivity extends AppCompatActivity {
+public class ActivityListViewRecyclerView extends AppCompatActivity {
RecyclerView recyclerView;
- RecyclerViewVideoAdapter adapterVideoList;
+ AdapterRecyclerViewVideo adapterVideoList;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
@@ -30,13 +28,13 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(true);
getSupportActionBar().setDisplayUseLogoEnabled(false);
- getSupportActionBar().setTitle("NormalRecyclerView");
+ getSupportActionBar().setTitle("RecyclerView");
setContentView(R.layout.activity_recyclerview_content);
recyclerView = findViewById(R.id.recyclerview);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
- adapterVideoList = new RecyclerViewVideoAdapter(this);
+ adapterVideoList = new AdapterRecyclerViewVideo(this);
recyclerView.setAdapter(adapterVideoList);
recyclerView.addOnChildAttachStateChangeListener(new RecyclerView.OnChildAttachStateChangeListener() {
@Override
diff --git a/app/src/main/java/cn/jzvd/demo/MainActivity.java b/app/src/main/java/cn/jzvd/demo/ActivityMain.java
similarity index 91%
rename from app/src/main/java/cn/jzvd/demo/MainActivity.java
rename to app/src/main/java/cn/jzvd/demo/ActivityMain.java
index d0c9f925a..941419791 100644
--- a/app/src/main/java/cn/jzvd/demo/MainActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityMain.java
@@ -19,7 +19,7 @@
/**
* Created by Nathen on 16/7/22.
*/
-public class MainActivity extends AppCompatActivity implements View.OnClickListener {
+public class ActivityMain extends AppCompatActivity implements View.OnClickListener {
MyJZVideoPlayerStandard myJZVideoPlayerStandard;
@@ -32,7 +32,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
setContentView(R.layout.activity_main);
mTinyWindow = findViewById(R.id.tiny_window);
- mDirectFullscreen = findViewById(R.id.direct_fullscreen);
+ mDirectFullscreen = findViewById(R.id.direct_play);
mListView = findViewById(R.id.listview);
mApi = findViewById(R.id.api);
mWebView = findViewById(R.id.webview);
@@ -70,20 +70,20 @@ public void onBackPressed() {
@Override
public void onClick(View v) {
switch (v.getId()) {
- case R.id.tiny_window:
- startActivity(new Intent(MainActivity.this, TinyWindowActivity.class));
- break;
- case R.id.direct_fullscreen:
- startActivity(new Intent(MainActivity.this, DirectFullscreenActivity.class));
+ case R.id.api:
+ startActivity(new Intent(ActivityMain.this, ActivityApi.class));
break;
case R.id.listview:
- startActivity(new Intent(MainActivity.this, ListViewActivity.class));
+ startActivity(new Intent(ActivityMain.this, ActivityListView.class));
break;
- case R.id.api:
- startActivity(new Intent(MainActivity.this, ApiActivity.class));
+ case R.id.tiny_window:
+ startActivity(new Intent(ActivityMain.this, ActivityTinyWindow.class));
+ break;
+ case R.id.direct_play:
+ startActivity(new Intent(ActivityMain.this, ActivityDirectPlay.class));
break;
case R.id.webview:
- startActivity(new Intent(MainActivity.this, WebViewActivity.class));
+ startActivity(new Intent(ActivityMain.this, ActivityWebView.class));
break;
}
}
diff --git a/app/src/main/java/cn/jzvd/demo/TinyWindowActivity.java b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindow.java
similarity index 94%
rename from app/src/main/java/cn/jzvd/demo/TinyWindowActivity.java
rename to app/src/main/java/cn/jzvd/demo/ActivityTinyWindow.java
index 509a322b3..f1cb88043 100644
--- a/app/src/main/java/cn/jzvd/demo/TinyWindowActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindow.java
@@ -17,7 +17,7 @@
* Created by Nathen on 2017/10/31.
*/
-public class TinyWindowActivity extends AppCompatActivity implements View.OnClickListener {
+public class ActivityTinyWindow extends AppCompatActivity implements View.OnClickListener {
JZVideoPlayerStandard mJzVideoPlayerStandard;
Button mBtnTinyWindow, mBtnAutoTinyListView;
@@ -53,7 +53,7 @@ public void onClick(View view) {
mJzVideoPlayerStandard.startWindowTiny();
break;
case R.id.auto_tiny_list_view:
- startActivity(new Intent(this, ListViewNormalAutoTinyActivity.class));
+ startActivity(new Intent(this, ActivityTinyWindowListViewNormal.class));
break;
}
}
diff --git a/app/src/main/java/cn/jzvd/demo/ListViewNormalAutoTinyActivity.java b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewNormal.java
similarity index 87%
rename from app/src/main/java/cn/jzvd/demo/ListViewNormalAutoTinyActivity.java
rename to app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewNormal.java
index 14a4c2ac6..003bb7468 100644
--- a/app/src/main/java/cn/jzvd/demo/ListViewNormalAutoTinyActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewNormal.java
@@ -3,20 +3,17 @@
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
-import android.util.Log;
import android.view.MenuItem;
import android.widget.AbsListView;
import android.widget.ListView;
-import cn.jzvd.JZMediaManager;
import cn.jzvd.JZVideoPlayer;
-import cn.jzvd.JZVideoPlayerManager;
/**
* Created by Nathen on 2017/10/22.
*/
-public class ListViewNormalAutoTinyActivity extends AppCompatActivity {
+public class ActivityTinyWindowListViewNormal extends AppCompatActivity {
ListView listView;
@@ -27,11 +24,11 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(true);
getSupportActionBar().setDisplayUseLogoEnabled(false);
- getSupportActionBar().setTitle("NormalListViewAutoTiny");
+ getSupportActionBar().setTitle("NormalListViewTinyWindow");
setContentView(R.layout.activity_listview_normal_auto_tiny);
listView = findViewById(R.id.listview);
- listView.setAdapter(new VideoListAdapter(this,
+ listView.setAdapter(new AdapterVideoList(this,
VideoConstant.videoUrls[0],
VideoConstant.videoTitles[0],
VideoConstant.videoThumbs[0]));
diff --git a/app/src/main/java/cn/jzvd/demo/WebViewActivity.java b/app/src/main/java/cn/jzvd/demo/ActivityWebView.java
similarity index 78%
rename from app/src/main/java/cn/jzvd/demo/WebViewActivity.java
rename to app/src/main/java/cn/jzvd/demo/ActivityWebView.java
index 37df6693d..3ff1a2fbc 100644
--- a/app/src/main/java/cn/jzvd/demo/WebViewActivity.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityWebView.java
@@ -19,7 +19,7 @@
* Created by Nathen on 16/10/13.
*/
-public class WebViewActivity extends AppCompatActivity {
+public class ActivityWebView extends AppCompatActivity {
WebView mWebView;
@Override
@@ -69,32 +69,32 @@ public void adViewJiaoZiVideoPlayer(final int width, final int height, final int
@Override
public void run() {
if (index == 0) {
- JZVideoPlayerStandard webVieo = new JZVideoPlayerStandard(WebViewActivity.this);
+ JZVideoPlayerStandard webVieo = new JZVideoPlayerStandard(ActivityWebView.this);
webVieo.setUp(VideoConstant.videoUrlList[1],
JZVideoPlayer.SCREEN_LAYOUT_LIST, "饺子骑大马");
- Picasso.with(WebViewActivity.this)
+ Picasso.with(ActivityWebView.this)
.load(VideoConstant.videoThumbList[1])
.into(webVieo.thumbImageView);
ViewGroup.LayoutParams ll = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
AbsoluteLayout.LayoutParams layoutParams = new AbsoluteLayout.LayoutParams(ll);
- layoutParams.y = JZUtils.dip2px(WebViewActivity.this, top);
- layoutParams.x = JZUtils.dip2px(WebViewActivity.this, left);
- layoutParams.height = JZUtils.dip2px(WebViewActivity.this, height);
- layoutParams.width = JZUtils.dip2px(WebViewActivity.this, width);
+ layoutParams.y = JZUtils.dip2px(ActivityWebView.this, top);
+ layoutParams.x = JZUtils.dip2px(ActivityWebView.this, left);
+ layoutParams.height = JZUtils.dip2px(ActivityWebView.this, height);
+ layoutParams.width = JZUtils.dip2px(ActivityWebView.this, width);
mWebView.addView(webVieo, layoutParams);
} else {
- JZVideoPlayerStandard webVieo = new JZVideoPlayerStandard(WebViewActivity.this);
+ JZVideoPlayerStandard webVieo = new JZVideoPlayerStandard(ActivityWebView.this);
webVieo.setUp(VideoConstant.videoUrlList[2],
JZVideoPlayer.SCREEN_LAYOUT_LIST, "饺子失态了");
- Picasso.with(WebViewActivity.this)
+ Picasso.with(ActivityWebView.this)
.load(VideoConstant.videoThumbList[2])
.into(webVieo.thumbImageView);
ViewGroup.LayoutParams ll = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
AbsoluteLayout.LayoutParams layoutParams = new AbsoluteLayout.LayoutParams(ll);
- layoutParams.y = JZUtils.dip2px(WebViewActivity.this, top);
- layoutParams.x = JZUtils.dip2px(WebViewActivity.this, left);
- layoutParams.height = JZUtils.dip2px(WebViewActivity.this, height);
- layoutParams.width = JZUtils.dip2px(WebViewActivity.this, width);
+ layoutParams.y = JZUtils.dip2px(ActivityWebView.this, top);
+ layoutParams.x = JZUtils.dip2px(ActivityWebView.this, left);
+ layoutParams.height = JZUtils.dip2px(ActivityWebView.this, height);
+ layoutParams.width = JZUtils.dip2px(ActivityWebView.this, width);
mWebView.addView(webVieo, layoutParams);
}
diff --git a/app/src/main/java/cn/jzvd/demo/RecyclerViewVideoAdapter.java b/app/src/main/java/cn/jzvd/demo/AdapterRecyclerViewVideo.java
similarity index 85%
rename from app/src/main/java/cn/jzvd/demo/RecyclerViewVideoAdapter.java
rename to app/src/main/java/cn/jzvd/demo/AdapterRecyclerViewVideo.java
index 00a96ce95..1dbd9d138 100644
--- a/app/src/main/java/cn/jzvd/demo/RecyclerViewVideoAdapter.java
+++ b/app/src/main/java/cn/jzvd/demo/AdapterRecyclerViewVideo.java
@@ -1,61 +1,61 @@
-package cn.jzvd.demo;
-
-import android.annotation.SuppressLint;
-import android.content.Context;
-import android.support.v7.widget.RecyclerView;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import com.squareup.picasso.Picasso;
-
-import cn.jzvd.JZVideoPlayer;
-import cn.jzvd.JZVideoPlayerStandard;
-
-public class RecyclerViewVideoAdapter extends RecyclerView.Adapter {
-
- public static final String TAG = "RecyclerViewVideoAdapter";
- int[] videoIndexs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- private Context context;
-
- public RecyclerViewVideoAdapter(Context context) {
- this.context = context;
- }
-
- @Override
- public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
- MyViewHolder holder = new MyViewHolder(LayoutInflater.from(
- context).inflate(R.layout.item_videoview, parent,
- false));
- return holder;
- }
-
- @SuppressLint("LongLogTag")
- @Override
- public void onBindViewHolder(MyViewHolder holder, int position) {
- Log.i(TAG, "onBindViewHolder [" + holder.jzVideoPlayer.hashCode() + "] position=" + position);
-
- holder.jzVideoPlayer.setUp(
- VideoConstant.videoUrls[0][position], JZVideoPlayer.SCREEN_LAYOUT_LIST,
- VideoConstant.videoTitles[0][position]);
- Picasso.with(holder.jzVideoPlayer.getContext())
- .load(VideoConstant.videoThumbs[0][position])
- .into(holder.jzVideoPlayer.thumbImageView);
- }
-
- @Override
- public int getItemCount() {
- return videoIndexs.length;
- }
-
- class MyViewHolder extends RecyclerView.ViewHolder {
- JZVideoPlayerStandard jzVideoPlayer;
-
- public MyViewHolder(View itemView) {
- super(itemView);
- jzVideoPlayer = itemView.findViewById(R.id.videoplayer);
- }
- }
-
-}
+package cn.jzvd.demo;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.support.v7.widget.RecyclerView;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.squareup.picasso.Picasso;
+
+import cn.jzvd.JZVideoPlayer;
+import cn.jzvd.JZVideoPlayerStandard;
+
+public class AdapterRecyclerViewVideo extends RecyclerView.Adapter {
+
+ public static final String TAG = "AdapterRecyclerViewVideo";
+ int[] videoIndexs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ private Context context;
+
+ public AdapterRecyclerViewVideo(Context context) {
+ this.context = context;
+ }
+
+ @Override
+ public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+ MyViewHolder holder = new MyViewHolder(LayoutInflater.from(
+ context).inflate(R.layout.item_videoview, parent,
+ false));
+ return holder;
+ }
+
+ @SuppressLint("LongLogTag")
+ @Override
+ public void onBindViewHolder(MyViewHolder holder, int position) {
+ Log.i(TAG, "onBindViewHolder [" + holder.jzVideoPlayer.hashCode() + "] position=" + position);
+
+ holder.jzVideoPlayer.setUp(
+ VideoConstant.videoUrls[0][position], JZVideoPlayer.SCREEN_LAYOUT_LIST,
+ VideoConstant.videoTitles[0][position]);
+ Picasso.with(holder.jzVideoPlayer.getContext())
+ .load(VideoConstant.videoThumbs[0][position])
+ .into(holder.jzVideoPlayer.thumbImageView);
+ }
+
+ @Override
+ public int getItemCount() {
+ return videoIndexs.length;
+ }
+
+ class MyViewHolder extends RecyclerView.ViewHolder {
+ JZVideoPlayerStandard jzVideoPlayer;
+
+ public MyViewHolder(View itemView) {
+ super(itemView);
+ jzVideoPlayer = itemView.findViewById(R.id.videoplayer);
+ }
+ }
+
+}
diff --git a/app/src/main/java/cn/jzvd/demo/VideoListAdapter.java b/app/src/main/java/cn/jzvd/demo/AdapterVideoList.java
old mode 100755
new mode 100644
similarity index 94%
rename from app/src/main/java/cn/jzvd/demo/VideoListAdapter.java
rename to app/src/main/java/cn/jzvd/demo/AdapterVideoList.java
index 2b89fdbcc..f8aa621c1
--- a/app/src/main/java/cn/jzvd/demo/VideoListAdapter.java
+++ b/app/src/main/java/cn/jzvd/demo/AdapterVideoList.java
@@ -15,7 +15,7 @@
* Created by Nathen
* On 2016/02/07 01:20
*/
-public class VideoListAdapter extends BaseAdapter {
+public class AdapterVideoList extends BaseAdapter {
public static final String TAG = "JiaoZiVideoPlayer";
@@ -25,7 +25,7 @@ public class VideoListAdapter extends BaseAdapter {
String[] videoTitles;
String[] videoThumbs;
- public VideoListAdapter(Context context, String[] videoUrls, String[] videoTitles, String[] videoThumbs) {
+ public AdapterVideoList(Context context, String[] videoUrls, String[] videoTitles, String[] videoThumbs) {
this.context = context;
this.videoUrls = videoUrls;
this.videoTitles = videoTitles;
diff --git a/app/src/main/java/cn/jzvd/demo/DemoApplication.java b/app/src/main/java/cn/jzvd/demo/ApplicationDemo.java
similarity index 89%
rename from app/src/main/java/cn/jzvd/demo/DemoApplication.java
rename to app/src/main/java/cn/jzvd/demo/ApplicationDemo.java
index 18f7bdb74..92d66c737 100644
--- a/app/src/main/java/cn/jzvd/demo/DemoApplication.java
+++ b/app/src/main/java/cn/jzvd/demo/ApplicationDemo.java
@@ -8,7 +8,7 @@
* Created by Nathen
* On 2015/12/01 11:29
*/
-public class DemoApplication extends Application {
+public class ApplicationDemo extends Application {
@Override
public void onCreate() {
diff --git a/app/src/main/java/cn/jzvd/demo/DemoFragment.java b/app/src/main/java/cn/jzvd/demo/FragmentDemo.java
similarity index 88%
rename from app/src/main/java/cn/jzvd/demo/DemoFragment.java
rename to app/src/main/java/cn/jzvd/demo/FragmentDemo.java
index 5e1fb8b6e..ed80b8e0c 100644
--- a/app/src/main/java/cn/jzvd/demo/DemoFragment.java
+++ b/app/src/main/java/cn/jzvd/demo/FragmentDemo.java
@@ -10,17 +10,16 @@
import android.widget.ListView;
import cn.jzvd.JZVideoPlayer;
-import cn.jzvd.demo.R;
/**
* Created by Nathen on 2017/6/9.
*/
-public class DemoFragment extends Fragment {
+public class FragmentDemo extends Fragment {
ListView listView;
int index;
- public DemoFragment setIndex(int index) {
+ public FragmentDemo setIndex(int index) {
this.index = index;
return this;
}
@@ -34,7 +33,7 @@ public void onCreate(Bundle savedInstanceState) {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInastanceState) {
listView = (ListView) inflater.inflate(R.layout.layout_list, container, false);
- listView.setAdapter(new VideoListAdapter(getActivity(),
+ listView.setAdapter(new AdapterVideoList(getActivity(),
VideoConstant.videoUrls[index],
VideoConstant.videoTitles[index],
VideoConstant.videoThumbs[index]));
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 20406085d..17c635215 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -20,12 +20,12 @@
android:layout_height="200dp" />
+ android:text="Api" />
+ android:text="Tiny Window" />
+ android:text="Direct Play" />
diff --git a/app/src/main/res/layout/activity_tiny_window.xml b/app/src/main/res/layout/activity_tiny_window.xml
index 2208d9f3f..9d722edf4 100644
--- a/app/src/main/res/layout/activity_tiny_window.xml
+++ b/app/src/main/res/layout/activity_tiny_window.xml
@@ -33,7 +33,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp"
- android:text="AutoTinyListView" />
+ android:text="Normal ListView TinyWindow" />
From 4ad36e1e1c315e19f77054cdcb3e1c40ed970013 Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Tue, 31 Oct 2017 18:18:19 +0800
Subject: [PATCH 06/46] fix bug when scroll in list
---
app/src/main/AndroidManifest.xml | 4 +
.../java/cn/jzvd/demo/ActivityTinyWindow.java | 11 +-
...ActivityTinyWindowListViewMultiHolder.java | 161 ++++++++++++++++++
.../main/java/cn/jzvd/demo/FragmentDemo.java | 2 +-
.../main/res/layout/activity_tiny_window.xml | 8 +
.../src/main/java/cn/jzvd/JZVideoPlayer.java | 3 +-
6 files changed, 184 insertions(+), 5 deletions(-)
create mode 100644 app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d245397b9..4726bbff1 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -51,6 +51,10 @@
android:name=".ActivityTinyWindow"
android:configChanges="orientation|screenSize|keyboardHidden"
android:screenOrientation="portrait" />
+
+
+
\ No newline at end of file
diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java
index d8c44c4d3..a4650b204 100644
--- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java
+++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java
@@ -924,7 +924,8 @@ public void startWindowFullscreen() {
public void startWindowTiny() {
Log.i(TAG, "startWindowTiny " + " [" + this.hashCode() + "] ");
onEvent(JZUserAction.ON_ENTER_TINYSCREEN);
- if (currentState == CURRENT_STATE_NORMAL || currentState == CURRENT_STATE_ERROR) return;
+ if (currentState == CURRENT_STATE_NORMAL || currentState == CURRENT_STATE_ERROR || currentState == CURRENT_STATE_AUTO_COMPLETE)
+ return;
ViewGroup vp = (JZUtils.scanForActivity(getContext()))//.getWindow().getDecorView();
.findViewById(Window.ID_ANDROID_CONTENT);
View old = vp.findViewById(R.id.jz_tiny_id);
From eaff0b3d14fadf4a952b9337e8f4c49314c45f6c Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Wed, 1 Nov 2017 14:21:49 +0800
Subject: [PATCH 07/46] remove simple in api activity
---
.../main/java/cn/jzvd/demo/ActivityApi.java | 6 --
app/src/main/res/layout/activity_api.xml | 12 ---
.../src/main/java/cn/jzvd/JZVideoPlayer.java | 5 +
.../java/cn/jzvd/JZVideoPlayerSimple.java | 73 ---------------
.../src/main/res/layout/jz_layout_base.xml | 91 -------------------
5 files changed, 5 insertions(+), 182 deletions(-)
delete mode 100644 jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerSimple.java
delete mode 100644 jiaozivideoplayer/src/main/res/layout/jz_layout_base.xml
diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApi.java b/app/src/main/java/cn/jzvd/demo/ActivityApi.java
index 2a8b9b70a..602906b4b 100644
--- a/app/src/main/java/cn/jzvd/demo/ActivityApi.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityApi.java
@@ -22,7 +22,6 @@
import java.util.LinkedHashMap;
import cn.jzvd.JZVideoPlayer;
-import cn.jzvd.JZVideoPlayerSimple;
import cn.jzvd.JZVideoPlayerStandard;
/**
@@ -30,7 +29,6 @@
*/
public class ActivityApi extends AppCompatActivity implements View.OnClickListener {
Button mSmallChange, mBigChange, mOrientation, mExtendsNormalActivity;
- JZVideoPlayerSimple mJzVideoPlayerSimple;
JZVideoPlayerStandard mJzVideoPlayerStandard;
JZVideoPlayer.JZAutoFullscreenListener mSensorEventListener;
SensorManager mSensorManager;
@@ -55,10 +53,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
mOrientation.setOnClickListener(this);
mExtendsNormalActivity.setOnClickListener(this);
- mJzVideoPlayerSimple = findViewById(R.id.simple_demo);
- mJzVideoPlayerSimple.setUp("http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8"
- , JZVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "饺子在家吗");
-
mJzVideoPlayerStandard = findViewById(R.id.jz_video);
LinkedHashMap map = new LinkedHashMap();
diff --git a/app/src/main/res/layout/activity_api.xml b/app/src/main/res/layout/activity_api.xml
index 5dd769e80..ed0edaf7d 100644
--- a/app/src/main/res/layout/activity_api.xml
+++ b/app/src/main/res/layout/activity_api.xml
@@ -14,18 +14,6 @@
android:layout_height="wrap_content"
android:orientation="vertical">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
From 6b52b0274faac96212c03924b7fccfc69327a24a Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Wed, 1 Nov 2017 14:38:41 +0800
Subject: [PATCH 08/46] faster build
---
app/build.gradle | 10 +++++-----
jiaozivideoplayer/build.gradle | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/app/build.gradle b/app/build.gradle
index eccba311a..7cdc920ad 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -32,15 +32,15 @@ android {
}
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
- compile 'com.android.support:appcompat-v7:27.0.0'
- compile project(':jiaozivideoplayer')
- compile 'com.squareup.picasso:picasso:2.5.2'
+ implementation 'com.android.support:appcompat-v7:27.0.0'
+ implementation project(':jiaozivideoplayer')
+ implementation 'com.squareup.picasso:picasso:2.5.2'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
- compile 'com.android.support:recyclerview-v7:27.0.0'
+ implementation 'com.android.support:recyclerview-v7:27.0.0'
}
diff --git a/jiaozivideoplayer/build.gradle b/jiaozivideoplayer/build.gradle
index 9dfbd08fb..06e4e3163 100644
--- a/jiaozivideoplayer/build.gradle
+++ b/jiaozivideoplayer/build.gradle
@@ -22,7 +22,7 @@ android {
}
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
provided 'com.android.support:appcompat-v7:27.0.0'
}
From 2c87a528ef764482ada6e179f4251a6975d1c1d0 Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Wed, 1 Nov 2017 15:19:01 +0800
Subject: [PATCH 09/46] fix multi holder press back button bug
---
.../main/java/cn/jzvd/demo/ActivityApi.java | 6 +--
.../jzvd/demo/ActivityApiExtendsNormal.java | 2 +-
.../cn/jzvd/demo/ActivityApiOrientation.java | 2 +-
.../jzvd/demo/ActivityApiUISmallChange.java | 12 +++---
.../demo/ActivityListViewMultiHolder.java | 2 +-
.../main/java/cn/jzvd/demo/ActivityMain.java | 2 +-
.../java/cn/jzvd/demo/ActivityTinyWindow.java | 2 +-
...ActivityTinyWindowListViewMultiHolder.java | 2 +-
.../java/cn/jzvd/demo/ActivityWebView.java | 4 +-
.../jzvd/demo/AdapterRecyclerViewVideo.java | 2 +-
.../java/cn/jzvd/demo/AdapterVideoList.java | 2 +-
.../JZVideoPlayerStandardFresco.java | 5 +--
.../src/main/java/cn/jzvd/JZVideoPlayer.java | 29 +++++++------
.../java/cn/jzvd/JZVideoPlayerStandard.java | 43 ++++++++++---------
14 files changed, 58 insertions(+), 57 deletions(-)
diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApi.java b/app/src/main/java/cn/jzvd/demo/ActivityApi.java
index 602906b4b..b1692c346 100644
--- a/app/src/main/java/cn/jzvd/demo/ActivityApi.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityApi.java
@@ -60,7 +60,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
map.put("标清", VideoConstant.videoUrls[0][6]);
map.put("普清", VideoConstant.videoUrlList[0]);
mJzVideoPlayerStandard.setUp(map, 2
- , JZVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "饺子不信");
+ , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, "饺子不信");
Picasso.with(this)
.load(VideoConstant.videoThumbList[0])
.into(mJzVideoPlayerStandard.thumbImageView);
@@ -73,10 +73,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
/** Play video in local path, eg:record by system camera **/
// cpAssertVideoToLocalPath();
// mJzVideoPlayerStandard.setUp(Environment.getExternalStorageDirectory().getAbsolutePath() + "/DCIM/Camera/local_video.mp4"
-// , JZVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "饺子不信");
+// , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, "饺子不信");
/** Play video in assert, but not work now **/
// mJzVideoPlayerStandard.setUp("file:///android_asset/local_video.mp4"
-// , JZVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "饺子不信");
+// , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, "饺子不信");
/** ImageLoader **/
// ImageLoader.getInstance().displayImage(VideoConstant.videoThumbs[0][1],
diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApiExtendsNormal.java b/app/src/main/java/cn/jzvd/demo/ActivityApiExtendsNormal.java
index 125c1c205..f5bdb1c3c 100644
--- a/app/src/main/java/cn/jzvd/demo/ActivityApiExtendsNormal.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityApiExtendsNormal.java
@@ -20,7 +20,7 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_extends_normal);
JZVideoPlayerStandard jzVideoPlayerStandard = findViewById(R.id.videoplayer);
jzVideoPlayerStandard.setUp(VideoConstant.videoUrlList[0]
- , JZVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "饺子不信");
+ , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, "饺子不信");
Picasso.with(this)
.load(VideoConstant.videoThumbList[0])
.into(jzVideoPlayerStandard.thumbImageView);
diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApiOrientation.java b/app/src/main/java/cn/jzvd/demo/ActivityApiOrientation.java
index 578067317..4ac7233d0 100644
--- a/app/src/main/java/cn/jzvd/demo/ActivityApiOrientation.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityApiOrientation.java
@@ -28,7 +28,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
setContentView(R.layout.activity_orientation);
mJzVideoPlayerStandard = findViewById(R.id.jz_video);
mJzVideoPlayerStandard.setUp(VideoConstant.videoUrlList[0]
- , JZVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "饺子不信");
+ , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, "饺子不信");
Picasso.with(this)
.load(VideoConstant.videoThumbList[0])
.into(mJzVideoPlayerStandard.thumbImageView);
diff --git a/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java b/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java
index 890658d01..6270e80c5 100644
--- a/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java
@@ -36,7 +36,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
setContentView(R.layout.activity_ui_small_change);
jzVideoPlayerStandardWithShareButton = findViewById(R.id.custom_videoplayer_standard_with_share_button);
- jzVideoPlayerStandardWithShareButton.setUp(VideoConstant.videoUrlList[3], JZVideoPlayer.SCREEN_LAYOUT_NORMAL
+ jzVideoPlayerStandardWithShareButton.setUp(VideoConstant.videoUrlList[3], JZVideoPlayer.SCREEN_WINDOW_NORMAL
, "饺子想呼吸");
Picasso.with(this)
.load(VideoConstant.videoThumbList[3])
@@ -44,28 +44,28 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
jzVideoPlayerStandardShowTitleAfterFullscreen = findViewById(R.id.custom_videoplayer_standard_show_title_after_fullscreen);
- jzVideoPlayerStandardShowTitleAfterFullscreen.setUp(VideoConstant.videoUrlList[4], JZVideoPlayer.SCREEN_LAYOUT_NORMAL
+ jzVideoPlayerStandardShowTitleAfterFullscreen.setUp(VideoConstant.videoUrlList[4], JZVideoPlayer.SCREEN_WINDOW_NORMAL
, "饺子想摇头");
Picasso.with(this)
.load(VideoConstant.videoThumbList[4])
.into(jzVideoPlayerStandardShowTitleAfterFullscreen.thumbImageView);
jzVideoPlayerStandardShowTextureViewAfterAutoComplete = findViewById(R.id.custom_videoplayer_standard_show_textureview_aoto_complete);
- jzVideoPlayerStandardShowTextureViewAfterAutoComplete.setUp(VideoConstant.videoUrlList[5], JZVideoPlayer.SCREEN_LAYOUT_NORMAL
+ jzVideoPlayerStandardShowTextureViewAfterAutoComplete.setUp(VideoConstant.videoUrlList[5], JZVideoPlayer.SCREEN_WINDOW_NORMAL
, "饺子想旅行");
Picasso.with(this)
.load(VideoConstant.videoThumbList[5])
.into(jzVideoPlayerStandardShowTextureViewAfterAutoComplete.thumbImageView);
jzVideoPlayerStandardAutoCompleteAfterFullscreen = findViewById(R.id.custom_videoplayer_standard_aoto_complete);
- jzVideoPlayerStandardAutoCompleteAfterFullscreen.setUp(VideoConstant.videoUrls[0][1], JZVideoPlayer.SCREEN_LAYOUT_NORMAL
+ jzVideoPlayerStandardAutoCompleteAfterFullscreen.setUp(VideoConstant.videoUrls[0][1], JZVideoPlayer.SCREEN_WINDOW_NORMAL
, "饺子没来");
Picasso.with(this)
.load(VideoConstant.videoThumbs[0][1])
.into(jzVideoPlayerStandardAutoCompleteAfterFullscreen.thumbImageView);
jzVideoPlayerStandard_1_1 = (JZVideoPlayerStandardAutoCompleteAfterFullscreen) findViewById(R.id.jz_videoplayer_1_1);
- jzVideoPlayerStandard_1_1.setUp(VideoConstant.videoUrls[0][1], JZVideoPlayer.SCREEN_LAYOUT_NORMAL
+ jzVideoPlayerStandard_1_1.setUp(VideoConstant.videoUrls[0][1], JZVideoPlayer.SCREEN_WINDOW_NORMAL
, "饺子有事吗");
Picasso.with(this)
.load(VideoConstant.videoThumbs[0][1])
@@ -74,7 +74,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
jzVideoPlayerStandard_1_1.heightRatio = 1;
jzVideoPlayerStandard_16_9 = (JZVideoPlayerStandardAutoCompleteAfterFullscreen) findViewById(R.id.jz_videoplayer_16_9);
- jzVideoPlayerStandard_16_9.setUp(VideoConstant.videoUrls[0][1], JZVideoPlayer.SCREEN_LAYOUT_NORMAL
+ jzVideoPlayerStandard_16_9.setUp(VideoConstant.videoUrls[0][1], JZVideoPlayer.SCREEN_WINDOW_NORMAL
, "饺子来不了");
Picasso.with(this)
.load(VideoConstant.videoThumbs[0][1])
diff --git a/app/src/main/java/cn/jzvd/demo/ActivityListViewMultiHolder.java b/app/src/main/java/cn/jzvd/demo/ActivityListViewMultiHolder.java
index 81cf2d639..fa2366ee2 100644
--- a/app/src/main/java/cn/jzvd/demo/ActivityListViewMultiHolder.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityListViewMultiHolder.java
@@ -118,7 +118,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
}
viewHolder.jzVideoPlayer.setUp(
- VideoConstant.videoUrls[0][position], JZVideoPlayer.SCREEN_LAYOUT_LIST,
+ VideoConstant.videoUrls[0][position], JZVideoPlayer.SCREEN_WINDOW_LIST,
VideoConstant.videoTitles[0][position]);
viewHolder.jzVideoPlayer.positionInList = position;
Picasso.with(ActivityListViewMultiHolder.this)
diff --git a/app/src/main/java/cn/jzvd/demo/ActivityMain.java b/app/src/main/java/cn/jzvd/demo/ActivityMain.java
index 941419791..4364cc8c6 100644
--- a/app/src/main/java/cn/jzvd/demo/ActivityMain.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityMain.java
@@ -45,7 +45,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
myJZVideoPlayerStandard = findViewById(R.id.jz_video);
myJZVideoPlayerStandard.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4"
- , JZVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "饺子快长大");
+ , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, "饺子快长大");
Picasso.with(this)
.load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png")
.into(myJZVideoPlayerStandard.thumbImageView);
diff --git a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindow.java b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindow.java
index 5152569b1..1e95a2c8f 100644
--- a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindow.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindow.java
@@ -34,7 +34,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
mJzVideoPlayerStandard = findViewById(R.id.jz_video);
mJzVideoPlayerStandard.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4"
- , JZVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "饺子快长大");
+ , JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, "饺子快长大");
Picasso.with(this)
.load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png")
.into(mJzVideoPlayerStandard.thumbImageView);
diff --git a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java
index 39a6b7074..849c3d752 100644
--- a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java
@@ -119,7 +119,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
}
viewHolder.jzVideoPlayer.setUp(
- VideoConstant.videoUrls[0][position], JZVideoPlayer.SCREEN_LAYOUT_LIST,
+ VideoConstant.videoUrls[0][position], JZVideoPlayer.SCREEN_WINDOW_LIST,
VideoConstant.videoTitles[0][position]);
viewHolder.jzVideoPlayer.positionInList = position;
Picasso.with(ActivityTinyWindowListViewMultiHolder.this)
diff --git a/app/src/main/java/cn/jzvd/demo/ActivityWebView.java b/app/src/main/java/cn/jzvd/demo/ActivityWebView.java
index 3ff1a2fbc..8382696b1 100644
--- a/app/src/main/java/cn/jzvd/demo/ActivityWebView.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityWebView.java
@@ -71,7 +71,7 @@ public void run() {
if (index == 0) {
JZVideoPlayerStandard webVieo = new JZVideoPlayerStandard(ActivityWebView.this);
webVieo.setUp(VideoConstant.videoUrlList[1],
- JZVideoPlayer.SCREEN_LAYOUT_LIST, "饺子骑大马");
+ JZVideoPlayer.SCREEN_WINDOW_LIST, "饺子骑大马");
Picasso.with(ActivityWebView.this)
.load(VideoConstant.videoThumbList[1])
.into(webVieo.thumbImageView);
@@ -85,7 +85,7 @@ public void run() {
} else {
JZVideoPlayerStandard webVieo = new JZVideoPlayerStandard(ActivityWebView.this);
webVieo.setUp(VideoConstant.videoUrlList[2],
- JZVideoPlayer.SCREEN_LAYOUT_LIST, "饺子失态了");
+ JZVideoPlayer.SCREEN_WINDOW_LIST, "饺子失态了");
Picasso.with(ActivityWebView.this)
.load(VideoConstant.videoThumbList[2])
.into(webVieo.thumbImageView);
diff --git a/app/src/main/java/cn/jzvd/demo/AdapterRecyclerViewVideo.java b/app/src/main/java/cn/jzvd/demo/AdapterRecyclerViewVideo.java
index 1dbd9d138..4fc3f1c51 100644
--- a/app/src/main/java/cn/jzvd/demo/AdapterRecyclerViewVideo.java
+++ b/app/src/main/java/cn/jzvd/demo/AdapterRecyclerViewVideo.java
@@ -37,7 +37,7 @@ public void onBindViewHolder(MyViewHolder holder, int position) {
Log.i(TAG, "onBindViewHolder [" + holder.jzVideoPlayer.hashCode() + "] position=" + position);
holder.jzVideoPlayer.setUp(
- VideoConstant.videoUrls[0][position], JZVideoPlayer.SCREEN_LAYOUT_LIST,
+ VideoConstant.videoUrls[0][position], JZVideoPlayer.SCREEN_WINDOW_LIST,
VideoConstant.videoTitles[0][position]);
Picasso.with(holder.jzVideoPlayer.getContext())
.load(VideoConstant.videoThumbs[0][position])
diff --git a/app/src/main/java/cn/jzvd/demo/AdapterVideoList.java b/app/src/main/java/cn/jzvd/demo/AdapterVideoList.java
index f8aa621c1..0513d403f 100644
--- a/app/src/main/java/cn/jzvd/demo/AdapterVideoList.java
+++ b/app/src/main/java/cn/jzvd/demo/AdapterVideoList.java
@@ -61,7 +61,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
}
viewHolder.jzVideoPlayer = convertView.findViewById(R.id.videoplayer);
viewHolder.jzVideoPlayer.setUp(
- videoUrls[position], JZVideoPlayer.SCREEN_LAYOUT_LIST,
+ videoUrls[position], JZVideoPlayer.SCREEN_WINDOW_LIST,
videoTitles[position]);
Picasso.with(convertView.getContext())
.load(videoThumbs[position])
diff --git a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardFresco.java b/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardFresco.java
index a48fe8bb1..a8caaa10a 100755
--- a/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardFresco.java
+++ b/app/src/main/java/cn/jzvd/demo/CustomView/JZVideoPlayerStandardFresco.java
@@ -3,9 +3,6 @@
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
-import android.widget.ImageView;
-import android.widget.ProgressBar;
-import android.widget.TextView;
import cn.jzvd.JZVideoPlayerStandard;
import cn.jzvd.demo.R;
@@ -53,7 +50,7 @@ public void setUp(String url, int screen, Object... objects) {
fullscreenButton.setImageResource(R.drawable.jz_shrink);
backButton.setVisibility(View.VISIBLE);
tinyBackImageView.setVisibility(View.INVISIBLE);
- } else if (currentScreen == SCREEN_LAYOUT_LIST) {
+ } else if (currentScreen == SCREEN_WINDOW_LIST) {
fullscreenButton.setImageResource(R.drawable.jz_enlarge);
backButton.setVisibility(View.GONE);
tinyBackImageView.setVisibility(View.INVISIBLE);
diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java
index 862b4e7ac..3fe0fb2f3 100644
--- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java
+++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java
@@ -3,6 +3,8 @@
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.ActivityInfo;
+import android.graphics.Point;
+import android.graphics.Rect;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
@@ -45,8 +47,8 @@ public abstract class JZVideoPlayer extends FrameLayout implements View.OnClickL
public static final int THRESHOLD = 80;
public static final int FULL_SCREEN_NORMAL_DELAY = 300;
- public static final int SCREEN_LAYOUT_NORMAL = 0;
- public static final int SCREEN_LAYOUT_LIST = 1;
+ public static final int SCREEN_WINDOW_NORMAL = 0;
+ public static final int SCREEN_WINDOW_LIST = 1;
public static final int SCREEN_WINDOW_FULLSCREEN = 2;
public static final int SCREEN_WINDOW_TINY = 3;
@@ -191,6 +193,7 @@ public static boolean backPress() {
Log.i(TAG, "backPress");
if ((System.currentTimeMillis() - CLICK_QUIT_FULLSCREEN_TIME) < FULL_SCREEN_NORMAL_DELAY)
return false;
+
if (JZVideoPlayerManager.getSecondFloor() != null) {
CLICK_QUIT_FULLSCREEN_TIME = System.currentTimeMillis();
if (JZVideoPlayerManager.getFirstFloor().getCurrentUrl().equals(JZMediaManager.CURRENT_PLAYING_URL)) {
@@ -198,31 +201,29 @@ public static boolean backPress() {
jzVideoPlayer.onEvent(jzVideoPlayer.currentScreen == JZVideoPlayerStandard.SCREEN_WINDOW_FULLSCREEN ?
JZUserAction.ON_QUIT_FULLSCREEN :
JZUserAction.ON_QUIT_TINYSCREEN);
- //TODO JZVideoPlayerManager.getFirstFloor()是否在屏幕中
-
JZVideoPlayerManager.getFirstFloor().playOnThisJzvd();
} else {
- //直接退出全屏和小窗
- JZVideoPlayerManager.getCurrentJzvd().currentState = CURRENT_STATE_NORMAL;
- JZVideoPlayerManager.getFirstFloor().clearFloatScreen();
- JZMediaManager.instance().releaseMediaPlayer();
- JZVideoPlayerManager.setFirstFloor(null);
+ quitFullscreenOrTinyWindow();
}
return true;
} else if (JZVideoPlayerManager.getFirstFloor() != null &&
(JZVideoPlayerManager.getFirstFloor().currentScreen == SCREEN_WINDOW_FULLSCREEN ||
JZVideoPlayerManager.getFirstFloor().currentScreen == SCREEN_WINDOW_TINY)) {//以前我总想把这两个判断写到一起,这分明是两个独立是逻辑
CLICK_QUIT_FULLSCREEN_TIME = System.currentTimeMillis();
- //直接退出全屏和小窗
- JZVideoPlayerManager.getCurrentJzvd().currentState = CURRENT_STATE_NORMAL;
- JZVideoPlayerManager.getFirstFloor().clearFloatScreen();
- JZMediaManager.instance().releaseMediaPlayer();
- JZVideoPlayerManager.setFirstFloor(null);
+ quitFullscreenOrTinyWindow();
return true;
}
return false;
}
+ public static void quitFullscreenOrTinyWindow(){
+ //直接退出全屏和小窗
+ JZVideoPlayerManager.getFirstFloor().clearFloatScreen();
+ JZMediaManager.instance().releaseMediaPlayer();
+ JZVideoPlayerManager.setFirstFloor(null);
+ JZVideoPlayerManager.setSecondFloor(null);
+ }
+
@SuppressLint("RestrictedApi")
public static void showSupportActionBar(Context context) {
if (ACTION_BAR_EXIST && JZUtils.getAppCompActivity(context) != null) {
diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java
index 441b11268..8c6dbb3c2 100644
--- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java
+++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java
@@ -11,7 +11,6 @@
import android.graphics.Color;
import android.text.TextUtils;
import android.util.AttributeSet;
-import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -138,8 +137,8 @@ public void setUp(LinkedHashMap urlMap, int defaultUrlMapIndex, int screen, Obje
clarity.setVisibility(View.VISIBLE);
}
changeStartButtonSize((int) getResources().getDimension(R.dimen.jz_start_button_w_h_fullscreen));
- } else if (currentScreen == SCREEN_LAYOUT_NORMAL
- || currentScreen == SCREEN_LAYOUT_LIST) {
+ } else if (currentScreen == SCREEN_WINDOW_NORMAL
+ || currentScreen == SCREEN_WINDOW_LIST) {
fullscreenButton.setImageResource(R.drawable.jz_enlarge);
backButton.setVisibility(View.GONE);
tinyBackImageView.setVisibility(View.INVISIBLE);
@@ -285,7 +284,11 @@ public void onClick(View v) {
} else if (i == R.id.back) {
backPress();
} else if (i == R.id.back_tiny) {
- backPress();
+ if(JZVideoPlayerManager.getFirstFloor().currentScreen==JZVideoPlayer.SCREEN_WINDOW_LIST){
+ quitFullscreenOrTinyWindow();
+ }else {
+ backPress();
+ }
} else if (i == R.id.clarity) {
LayoutInflater inflater = (LayoutInflater) getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@@ -465,8 +468,8 @@ public void resetProgressAndTime() {
public void changeUiToNormal() {
switch (currentScreen) {
- case SCREEN_LAYOUT_NORMAL:
- case SCREEN_LAYOUT_LIST:
+ case SCREEN_WINDOW_NORMAL:
+ case SCREEN_WINDOW_LIST:
setAllControlsVisiblity(View.VISIBLE, View.INVISIBLE, View.VISIBLE,
View.INVISIBLE, View.VISIBLE, View.INVISIBLE);
updateStartImage();
@@ -483,8 +486,8 @@ public void changeUiToNormal() {
public void changeUiToPreparing() {
switch (currentScreen) {
- case SCREEN_LAYOUT_NORMAL:
- case SCREEN_LAYOUT_LIST:
+ case SCREEN_WINDOW_NORMAL:
+ case SCREEN_WINDOW_LIST:
setAllControlsVisiblity(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE,
View.VISIBLE, View.VISIBLE, View.INVISIBLE);
break;
@@ -500,8 +503,8 @@ public void changeUiToPreparing() {
public void changeUiToPlayingShow() {
switch (currentScreen) {
- case SCREEN_LAYOUT_NORMAL:
- case SCREEN_LAYOUT_LIST:
+ case SCREEN_WINDOW_NORMAL:
+ case SCREEN_WINDOW_LIST:
setAllControlsVisiblity(View.VISIBLE, View.VISIBLE, View.VISIBLE,
View.INVISIBLE, View.INVISIBLE, View.INVISIBLE);
updateStartImage();
@@ -519,8 +522,8 @@ public void changeUiToPlayingShow() {
public void changeUiToPlayingClear() {
switch (currentScreen) {
- case SCREEN_LAYOUT_NORMAL:
- case SCREEN_LAYOUT_LIST:
+ case SCREEN_WINDOW_NORMAL:
+ case SCREEN_WINDOW_LIST:
setAllControlsVisiblity(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE,
View.INVISIBLE, View.INVISIBLE, View.VISIBLE);
break;
@@ -536,8 +539,8 @@ public void changeUiToPlayingClear() {
public void changeUiToPauseShow() {
switch (currentScreen) {
- case SCREEN_LAYOUT_NORMAL:
- case SCREEN_LAYOUT_LIST:
+ case SCREEN_WINDOW_NORMAL:
+ case SCREEN_WINDOW_LIST:
setAllControlsVisiblity(View.VISIBLE, View.VISIBLE, View.VISIBLE,
View.INVISIBLE, View.INVISIBLE, View.INVISIBLE);
updateStartImage();
@@ -555,8 +558,8 @@ public void changeUiToPauseShow() {
public void changeUiToPauseClear() {
switch (currentScreen) {
- case SCREEN_LAYOUT_NORMAL:
- case SCREEN_LAYOUT_LIST:
+ case SCREEN_WINDOW_NORMAL:
+ case SCREEN_WINDOW_LIST:
setAllControlsVisiblity(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE,
View.INVISIBLE, View.INVISIBLE, View.INVISIBLE);
break;
@@ -572,8 +575,8 @@ public void changeUiToPauseClear() {
public void changeUiToComplete() {
switch (currentScreen) {
- case SCREEN_LAYOUT_NORMAL:
- case SCREEN_LAYOUT_LIST:
+ case SCREEN_WINDOW_NORMAL:
+ case SCREEN_WINDOW_LIST:
setAllControlsVisiblity(View.VISIBLE, View.INVISIBLE, View.VISIBLE,
View.INVISIBLE, View.VISIBLE, View.INVISIBLE);
updateStartImage();
@@ -591,8 +594,8 @@ public void changeUiToComplete() {
public void changeUiToError() {
switch (currentScreen) {
- case SCREEN_LAYOUT_NORMAL:
- case SCREEN_LAYOUT_LIST:
+ case SCREEN_WINDOW_NORMAL:
+ case SCREEN_WINDOW_LIST:
setAllControlsVisiblity(View.INVISIBLE, View.INVISIBLE, View.VISIBLE,
View.INVISIBLE, View.INVISIBLE, View.INVISIBLE);
updateStartImage();
From b9691df3a0bab0d6da5e51e724e8e2855472d8ca Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Wed, 1 Nov 2017 15:49:40 +0800
Subject: [PATCH 10/46] fix log
---
jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java
index 3fe0fb2f3..682c2c93f 100644
--- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java
+++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java
@@ -216,7 +216,7 @@ public static boolean backPress() {
return false;
}
- public static void quitFullscreenOrTinyWindow(){
+ public static void quitFullscreenOrTinyWindow() {
//直接退出全屏和小窗
JZVideoPlayerManager.getFirstFloor().clearFloatScreen();
JZMediaManager.instance().releaseMediaPlayer();
@@ -795,7 +795,7 @@ public void onVideoSizeChanged() {
}
public void startProgressTimer() {
- Log.e(TAG, "startProgressTimer: ");
+ Log.i(TAG, "startProgressTimer: " + " [" + this.hashCode() + "] ");
cancelProgressTimer();
UPDATE_PROGRESS_TIMER = new Timer();
mProgressTimerTask = new ProgressTimerTask();
From 2898202e2f645dfcec09ccc933bc219c975633a6 Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Wed, 1 Nov 2017 16:04:51 +0800
Subject: [PATCH 11/46] add activity recycle view tiny window
---
app/src/main/AndroidManifest.xml | 4 +
.../demo/ActivityListViewRecyclerView.java | 13 +--
.../java/cn/jzvd/demo/ActivityTinyWindow.java | 7 +-
...ActivityTinyWindowListViewMultiHolder.java | 2 +-
.../demo/ActivityTinyWindowRecycleView.java | 88 +++++++++++++++++++
.../main/res/layout/activity_tiny_window.xml | 8 ++
6 files changed, 108 insertions(+), 14 deletions(-)
create mode 100644 app/src/main/java/cn/jzvd/demo/ActivityTinyWindowRecycleView.java
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4726bbff1..f7b3334dc 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -47,6 +47,10 @@
android:name=".ActivityListViewMultiHolder"
android:configChanges="orientation|screenSize|keyboardHidden"
android:screenOrientation="portrait" />
+
+
+
\ No newline at end of file
From b2c3d9ad203ae6c82571c522de31f24080e51e8c Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Wed, 1 Nov 2017 16:28:21 +0800
Subject: [PATCH 12/46] =?UTF-8?q?fix=20readme=E2=80=9D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README-ZH.md | 10 ++++++++--
README.md | 1 +
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/README-ZH.md b/README-ZH.md
index c061a5bc1..19274885e 100644
--- a/README-ZH.md
+++ b/README-ZH.md
@@ -7,12 +7,15 @@
-#### 立志成为Android平台使用最广泛的视频播放控件 Q群:490442439 验证信息:jzvd
+# [斗鱼直播](https://www.douyu.com/1667893)
-目前认为安卓中视频点播的终极状态是系统的MediaPlayer,其他的播放引擎并不是未来的趋势,虽然系统的MediaPlayer也有缺点我认为我们应该做出一些让步,如果系统的MediaPlayer没有重大缺陷将不会考虑替换它。
+每天下午两点开始直播写代码,回答大家的使用问题,请大家进入直播间后提问,直播期间不再手动打字回复
+
+Q群:490442439 验证信息:jzvd
[英文文档](https://github.com/lipangit/JiaoZiVideoPlayer) [工作计划](https://github.com/lipangit/JiaoZiVideoPlayer/projects/2) [微博](http://weibo.com/2342820395/profile?topnav=1&wvr=6&is_all=1) [视频教程](https://github.com/lipangit/JiaoZiVideoPlayer/wiki/%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B)
+
## 主要特点
1. 视频全屏播放和浮层小窗播放
@@ -26,6 +29,9 @@
9. [支持https和rtsp](https://developer.android.com/guide/topics/media/media-formats.html)
10. 小于 110kb
11. [Home键暂停,返回继续播放](https://github.com/lipangit/JiaoZiVideoPlayer/blob/develop/app/src/main/java/cn/jzvd/demo/ApiActivity.java#L117)
+12. 完美的列表滑動的判斷,可以滑動進入小窗口
+
+目前认为安卓中视频点播的终极状态是系统的MediaPlayer,其他的播放引擎并不是未来的趋势,虽然系统的MediaPlayer也有缺点我认为我们应该做出一些让步,如果系统的MediaPlayer没有重大缺陷将不会考虑替换它。
## 效果
diff --git a/README.md b/README.md
index 2d992a6fa..d45862c6d 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,7 @@ I think the final solution to video in android is `android.media.MediaPlayer`, o
9. [Support https and rtsp](https://developer.android.com/guide/topics/media/media-formats.html)
10. Less than 110kb
11. [Press home button will pause vidoe, come back goon play](https://github.com/lipangit/JiaoZiVideoPlayer/blob/develop/app/src/main/java/cn/jzvd/demo/ApiActivity.java#L117)
+12. Perfect scroll in ListView, and automatic start tiny window
## Effect
From a0d370795c63d540369c75af05996e767aa7921e Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Wed, 1 Nov 2017 16:38:28 +0800
Subject: [PATCH 13/46] readme
---
README.md | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index d45862c6d..8693c6500 100644
--- a/README.md
+++ b/README.md
@@ -7,11 +7,11 @@
-* This project needs translators, you can change everything editing readme, release note, formate variable and annotation.
+# [斗鱼直播](https://www.douyu.com/1667893)
-#### Ambition is becoming the most widely used video playback control. Q群:490442439 验证信息:jzvd
+每天下午两点开始直播写代码,回答大家的使用问题,请大家进入直播间后提问,直播期间不再手动打字回复
-I think the final solution to video in android is `android.media.MediaPlayer`, other players are not in the trend, even if the `android.media.MediaPlayer` has disavantages we should make concession, if `android.media.MediaPlayer` has defect we will consider to change other player.
+Q群:490442439 验证信息:jzvd
[中文文档](README-ZH.md) [WorkPlan](https://github.com/lipangit/JiaoZiVideoPlayer/projects/2) [Weibo](http://weibo.com/2342820395/profile?topnav=1&wvr=6&is_all=1) [VideoTutorial](https://github.com/lipangit/JiaoZiVideoPlayer/wiki/%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B)
@@ -30,6 +30,8 @@ I think the final solution to video in android is `android.media.MediaPlayer`, o
11. [Press home button will pause vidoe, come back goon play](https://github.com/lipangit/JiaoZiVideoPlayer/blob/develop/app/src/main/java/cn/jzvd/demo/ApiActivity.java#L117)
12. Perfect scroll in ListView, and automatic start tiny window
+I think the final solution to video in android is `android.media.MediaPlayer`, other players are not in the trend, even if the `android.media.MediaPlayer` has disavantages we should make concession, if `android.media.MediaPlayer` has defect we will consider to change other player.
+
## Effect
**[jiaozivideoplayer-6.1.1.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/6.1.1/jiaozivideoplayer-6.1.1.apk)**
From 2a27911afe95b0154052d91f4faca9eee928e0da Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Wed, 1 Nov 2017 16:49:22 +0800
Subject: [PATCH 14/46] radme
---
README-ZH.md | 2 +-
README.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/README-ZH.md b/README-ZH.md
index 19274885e..21e1b687a 100644
--- a/README-ZH.md
+++ b/README-ZH.md
@@ -9,7 +9,7 @@
# [斗鱼直播](https://www.douyu.com/1667893)
-每天下午两点开始直播写代码,回答大家的使用问题,请大家进入直播间后提问,直播期间不再手动打字回复
+每天下午两点开始直播写代码,回答大家的使用问题,请大家进入直播间办卡(办卡6元)之后提问,直播期间不再手动打字回复
Q群:490442439 验证信息:jzvd
diff --git a/README.md b/README.md
index 8693c6500..3714314fd 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
# [斗鱼直播](https://www.douyu.com/1667893)
-每天下午两点开始直播写代码,回答大家的使用问题,请大家进入直播间后提问,直播期间不再手动打字回复
+每天下午两点开始直播写代码,回答大家的使用问题,请大家进入直播间办卡(办卡6元)之后提问,直播期间不再手动打字回复
Q群:490442439 验证信息:jzvd
From 200f986b5172fc9520fe710981221ecf2fbccd90 Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Wed, 1 Nov 2017 17:00:16 +0800
Subject: [PATCH 15/46] readme
---
README-ZH.md | 2 +-
README.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/README-ZH.md b/README-ZH.md
index 21e1b687a..bd0c78e89 100644
--- a/README-ZH.md
+++ b/README-ZH.md
@@ -9,7 +9,7 @@
# [斗鱼直播](https://www.douyu.com/1667893)
-每天下午两点开始直播写代码,回答大家的使用问题,请大家进入直播间办卡(办卡6元)之后提问,直播期间不再手动打字回复
+每天下午两点开始直播写代码,回答大家的使用问题,请大家进入直播间建议办卡(办卡6元)之后提问,直播期间不再手动打字回复
Q群:490442439 验证信息:jzvd
diff --git a/README.md b/README.md
index 3714314fd..17b1d3b40 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
# [斗鱼直播](https://www.douyu.com/1667893)
-每天下午两点开始直播写代码,回答大家的使用问题,请大家进入直播间办卡(办卡6元)之后提问,直播期间不再手动打字回复
+每天下午两点开始直播写代码,回答大家的使用问题,请大家进入直播间建议办卡(办卡6元)之后提问,直播期间不再手动打字回复
Q群:490442439 验证信息:jzvd
From 3ca7ec07dfd21e5f8cdb7bac42bccff90bdcb3ee Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Wed, 1 Nov 2017 17:32:36 +0800
Subject: [PATCH 16/46] fix multi holder bug
---
.../jzvd/demo/ActivityTinyWindowListViewMultiHolder.java | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java
index 6e9db8133..b460e7339 100644
--- a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java
@@ -20,7 +20,6 @@
/**
* Created by Nathen on 2017/10/31.
*/
-
public class ActivityTinyWindowListViewMultiHolder extends AppCompatActivity {
ListView listView;
@@ -49,7 +48,7 @@ public void onScrollStateChanged(AbsListView view, int scrollState) {
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
- JZVideoPlayer.onScrollAutoTiny(view, firstVisibleItem, visibleItemCount, totalItemCount);
+ JZVideoPlayer.onScrollReleaseAllVideos(view, firstVisibleItem, visibleItemCount, totalItemCount);
}
});
}
@@ -109,7 +108,7 @@ public long getItemId(int position) {
public View getView(int position, View convertView, ViewGroup parent) {
if (getItemViewType(position) == 1) {
VideoHolder viewHolder;
- if (convertView != null && convertView.getTag() != null && convertView.getTag() instanceof ActivityListViewMultiHolder.VideoListAdapter.VideoHolder) {
+ if (convertView != null && convertView.getTag() != null && convertView.getTag() instanceof VideoListAdapter.VideoHolder) {
viewHolder = (VideoHolder) convertView.getTag();
} else {
viewHolder = new VideoHolder();
@@ -127,7 +126,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
.into(viewHolder.jzVideoPlayer.thumbImageView);
} else {
TextViewHolder textViewHolder;
- if (convertView != null && convertView.getTag() != null && convertView.getTag() instanceof ActivityListViewMultiHolder.VideoListAdapter.TextViewHolder) {
+ if (convertView != null && convertView.getTag() != null && convertView.getTag() instanceof VideoListAdapter.TextViewHolder) {
textViewHolder = (TextViewHolder) convertView.getTag();
} else {
textViewHolder = new TextViewHolder();
From 877b79b0e82d96a8a6625b8bba433af93bdad149 Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Wed, 1 Nov 2017 17:38:44 +0800
Subject: [PATCH 17/46] fix demo
---
.../cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java
index b460e7339..a0b024fc5 100644
--- a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewMultiHolder.java
@@ -48,7 +48,7 @@ public void onScrollStateChanged(AbsListView view, int scrollState) {
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
- JZVideoPlayer.onScrollReleaseAllVideos(view, firstVisibleItem, visibleItemCount, totalItemCount);
+ JZVideoPlayer.onScrollAutoTiny(view, firstVisibleItem, visibleItemCount, totalItemCount);
}
});
}
From 4fdc877d2eefa0858aece36a6431b6d2f4fb48fe Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Wed, 1 Nov 2017 17:40:06 +0800
Subject: [PATCH 18/46] readme
---
app/src/main/java/cn/jzvd/demo/ActivityDirectPlay.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/main/java/cn/jzvd/demo/ActivityDirectPlay.java b/app/src/main/java/cn/jzvd/demo/ActivityDirectPlay.java
index b167363d6..5abe7e804 100644
--- a/app/src/main/java/cn/jzvd/demo/ActivityDirectPlay.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityDirectPlay.java
@@ -25,7 +25,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(true);
getSupportActionBar().setDisplayUseLogoEnabled(false);
- getSupportActionBar().setTitle("DirectPlays");
+ getSupportActionBar().setTitle("DirectPlay");
setContentView(R.layout.activity_directly_play);
mStartFullscreen = findViewById(R.id.fullscreen);
From 2053ee475de1213510c7378e9418ee5cf79dc318 Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Wed, 1 Nov 2017 20:40:53 +0800
Subject: [PATCH 19/46] recycleview multiholder tiny window
---
app/src/main/AndroidManifest.xml | 4 +
.../java/cn/jzvd/demo/ActivityTinyWindow.java | 7 +-
.../demo/ActivityTinyWindowRecycleView.java | 18 +--
...ivityTinyWindowRecycleViewMultiHolder.java | 146 ++++++++++++++++++
.../main/res/layout/activity_tiny_window.xml | 8 +
.../src/main/java/cn/jzvd/JZVideoPlayer.java | 18 +++
6 files changed, 184 insertions(+), 17 deletions(-)
create mode 100644 app/src/main/java/cn/jzvd/demo/ActivityTinyWindowRecycleViewMultiHolder.java
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f7b3334dc..e481774ee 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -59,6 +59,10 @@
android:name=".ActivityTinyWindowListViewMultiHolder"
android:configChanges="orientation|screenSize|keyboardHidden"
android:screenOrientation="portrait" />
+
{
+
+ @Override
+ public int getItemViewType(int position) {
+ if (position != 4 && position != 7) {
+ return 0;//非视频
+ }
+ return 1;//视频
+ }
+
+ @Override
+ public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+ View view;
+ if (viewType == 1) {
+ view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_videoview, parent, false);
+ return new VideoHolder(view);
+ } else {
+ view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_textview, parent, false);
+ return new TextHolder(view);
+ }
+ }
+
+ @Override
+ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
+ if (position != 4 && position != 7) {
+ TextHolder textHolder = (TextHolder) holder;
+ } else {
+ VideoHolder videoHolder = (VideoHolder) holder;
+ videoHolder.jzVideoPlayer.setUp(
+ VideoConstant.videoUrls[0][position], JZVideoPlayer.SCREEN_WINDOW_LIST,
+ VideoConstant.videoTitles[0][position]);
+ videoHolder.jzVideoPlayer.positionInList = position;
+ Picasso.with(ActivityTinyWindowRecycleViewMultiHolder.this)
+ .load(VideoConstant.videoThumbs[0][position])
+ .into(videoHolder.jzVideoPlayer.thumbImageView);
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return 10;
+ }
+
+ class VideoHolder extends RecyclerView.ViewHolder {
+ JZVideoPlayerStandard jzVideoPlayer;
+
+ public VideoHolder(View itemView) {
+ super(itemView);
+ jzVideoPlayer = itemView.findViewById(R.id.videoplayer);
+ }
+ }
+
+ class TextHolder extends RecyclerView.ViewHolder {
+ TextView textView;
+
+ public TextHolder(View itemView) {
+ super(itemView);
+ textView = itemView.findViewById(R.id.textview);
+ }
+ }
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ JZVideoPlayer.releaseAllVideos();
+ }
+
+ @Override
+ public void onBackPressed() {
+ if (JZVideoPlayer.backPress()) {
+ return;
+ }
+ super.onBackPressed();
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case android.R.id.home:
+ finish();
+ break;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+}
diff --git a/app/src/main/res/layout/activity_tiny_window.xml b/app/src/main/res/layout/activity_tiny_window.xml
index ce70b9b12..a0d3e97c3 100644
--- a/app/src/main/res/layout/activity_tiny_window.xml
+++ b/app/src/main/res/layout/activity_tiny_window.xml
@@ -51,6 +51,14 @@
android:layout_marginTop="8dp"
android:text="RecycleView TinyWindow" />
+
+
\ No newline at end of file
diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java
index 682c2c93f..fbbb6d899 100644
--- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java
+++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java
@@ -1043,6 +1043,24 @@ public static void onScrollReleaseAllVideos(AbsListView view, int firstVisibleIt
}
}
+ public static void onChildViewAttachedToWindow(View view, int jzvdId) {
+ if (JZVideoPlayerManager.getCurrentJzvd() != null && JZVideoPlayerManager.getCurrentJzvd().currentScreen == JZVideoPlayer.SCREEN_WINDOW_TINY) {
+ JZVideoPlayer videoPlayer = view.findViewById(jzvdId);
+ if (videoPlayer != null && JZUtils.getCurrentUrlFromMap(videoPlayer.urlMap, videoPlayer.currentUrlMapIndex).equals(JZMediaManager.CURRENT_PLAYING_URL)) {
+ JZVideoPlayer.backPress();
+ }
+ }
+ }
+
+ public static void onChildViewDetachedFromWindow(View view) {
+ if (JZVideoPlayerManager.getCurrentJzvd() != null && JZVideoPlayerManager.getCurrentJzvd().currentScreen != JZVideoPlayer.SCREEN_WINDOW_TINY) {
+ JZVideoPlayer videoPlayer = JZVideoPlayerManager.getCurrentJzvd();
+ if (((ViewGroup) view).indexOfChild(videoPlayer) != -1) {
+ videoPlayer.startWindowTiny();
+ }
+ }
+ }
+
//TODO 是否有用
public void onSeekComplete() {
From 23f7c886ba3f0d9812e996600fdcf998bb7283ca Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Wed, 1 Nov 2017 20:53:11 +0800
Subject: [PATCH 20/46] rm isRenderingStar try to do this
---
.../jzvd/demo/ActivityTinyWindowRecycleViewMultiHolder.java | 4 ----
jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java | 4 ----
.../src/main/java/cn/jzvd/JZVideoPlayerStandard.java | 6 ------
3 files changed, 14 deletions(-)
diff --git a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowRecycleViewMultiHolder.java b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowRecycleViewMultiHolder.java
index 681607c53..12e7457a3 100644
--- a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowRecycleViewMultiHolder.java
+++ b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowRecycleViewMultiHolder.java
@@ -11,13 +11,9 @@
import android.view.ViewGroup;
import android.widget.TextView;
-import com.squareup.leakcanary.LeakTraceElement;
import com.squareup.picasso.Picasso;
-import cn.jzvd.JZMediaManager;
-import cn.jzvd.JZUtils;
import cn.jzvd.JZVideoPlayer;
-import cn.jzvd.JZVideoPlayerManager;
import cn.jzvd.JZVideoPlayerStandard;
/**
diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java
index fbbb6d899..b47a0b7af 100644
--- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java
+++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java
@@ -112,7 +112,6 @@ public void onAudioFocusChange(int focusChange) {
public ViewGroup topContainer, bottomContainer;
public int widthRatio = 0;
public int heightRatio = 0;
- protected boolean isVideoRendingStart = false;
protected int mScreenWidth;
protected int mScreenHeight;
protected AudioManager mAudioManager;
@@ -355,7 +354,6 @@ public void setUp(LinkedHashMap urlMap, int defaultUrlMapIndex, int screen, Obje
this.currentScreen = screen;
this.objects = objects;
this.headData = null;
- isVideoRendingStart = false;
onStateNormal();
}
@@ -607,7 +605,6 @@ public void onStatePreparingChangingUrl(int urlMapIndex, int seekToInAdvance) {
}
public void onStatePrepared() {//因为这个紧接着就会进入播放状态,所以不设置state
- isVideoRendingStart = true;
if (seekToInAdvance != 0) {
JZMediaManager.instance().mediaPlayer.seekTo(seekToInAdvance);
seekToInAdvance = 0;
@@ -721,7 +718,6 @@ public void onCompletion() {
if (JZMediaManager.surface != null) JZMediaManager.surface.release();
JZMediaManager.textureView = null;
JZMediaManager.savedSurfaceTexture = null;
- isVideoRendingStart = false;
}
public void release() {
diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java
index 8c6dbb3c2..44b0c257d 100644
--- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java
+++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayerStandard.java
@@ -158,7 +158,6 @@ public void setUp(LinkedHashMap urlMap, int defaultUrlMapIndex, int screen, Obje
if (tmp_test_back) {
tmp_test_back = false;
JZVideoPlayerManager.setFirstFloor(this);
- isVideoRendingStart = true;
backPress();
}
}
@@ -613,11 +612,6 @@ public void changeUiToError() {
public void setAllControlsVisiblity(int topCon, int bottomCon, int startBtn, int loadingPro,
int thumbImg, int bottomPro) {
- //TODO 这个地方由于前边的各种状态不是太明白,所以暂时只能这样写一下(目前没发现问题),作者可以优化一下
- if (!isVideoRendingStart && currentScreen != SCREEN_WINDOW_FULLSCREEN && currentScreen != SCREEN_WINDOW_TINY) {
- //只要没开始播放,一直显示缩略图
- thumbImg = VISIBLE;
- }
topContainer.setVisibility(topCon);
bottomContainer.setVisibility(bottomCon);
startButton.setVisibility(startBtn);
From 5574f87c1b3b6d350fc3172697130c6c69130f27 Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Wed, 1 Nov 2017 21:47:56 +0800
Subject: [PATCH 21/46] readme
---
README-ZH.md | 2 +-
README.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/README-ZH.md b/README-ZH.md
index bd0c78e89..3d056fb04 100644
--- a/README-ZH.md
+++ b/README-ZH.md
@@ -9,7 +9,7 @@
# [斗鱼直播](https://www.douyu.com/1667893)
-每天下午两点开始直播写代码,回答大家的使用问题,请大家进入直播间建议办卡(办卡6元)之后提问,直播期间不再手动打字回复
+每天下午两点开始直播写代码,回答大家的使用问题,请大家进入直播间后提问,直播期间不再手动打字回复,办卡(6元)优先,关注数到100的时候抽奖100元(两个50)
Q群:490442439 验证信息:jzvd
diff --git a/README.md b/README.md
index 17b1d3b40..91f9a66dd 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
# [斗鱼直播](https://www.douyu.com/1667893)
-每天下午两点开始直播写代码,回答大家的使用问题,请大家进入直播间建议办卡(办卡6元)之后提问,直播期间不再手动打字回复
+每天下午两点开始直播写代码,回答大家的使用问题,请大家进入直播间后提问,直播期间不再手动打字回复,办卡(6元)优先,关注数到100的时候抽奖100元(两个50)
Q群:490442439 验证信息:jzvd
From 1feef0c0a144debdc721446a8de2e0ef2c831574 Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Thu, 2 Nov 2017 14:25:14 +0800
Subject: [PATCH 22/46] fix code
---
.../src/main/java/cn/jzvd/JZResizeTextureView.java | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZResizeTextureView.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZResizeTextureView.java
index acebb4356..45a4268e6 100644
--- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZResizeTextureView.java
+++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZResizeTextureView.java
@@ -22,15 +22,11 @@ public class JZResizeTextureView extends TextureView {
public JZResizeTextureView(Context context) {
super(context);
- init();
+ mVideoSize = new Point(0, 0);
}
public JZResizeTextureView(Context context, AttributeSet attrs) {
super(context, attrs);
- init();
- }
-
- private void init() {
mVideoSize = new Point(0, 0);
}
From 8444a828fd62a221be0bb2e5d2c7de860970ac5a Mon Sep 17 00:00:00 2001
From: lipan <821537155@qq.com>
Date: Thu, 2 Nov 2017 20:45:42 +0800
Subject: [PATCH 23/46] videoRotation
---
app/src/main/assets/jzvd.html | 2 --
jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java | 4 ++++
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/app/src/main/assets/jzvd.html b/app/src/main/assets/jzvd.html
index 1784f8e7b..e19e9a7bf 100644
--- a/app/src/main/assets/jzvd.html
+++ b/app/src/main/assets/jzvd.html
@@ -18,8 +18,6 @@ This is webview
var cont1=document.getElementById("cont1");
jzvd.adViewJiaoZiVideoPlayer(210,120,cont1.offsetTop,cont1.offsetLeft,1)
-
-