From 2f7a9184c1503bd0b536ed2c7570e652a771c027 Mon Sep 17 00:00:00 2001 From: I Date: Tue, 19 Mar 2019 01:54:11 +0800 Subject: [PATCH 01/33] qa --- README-ZH.md | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README-ZH.md b/README-ZH.md index 348b9a20..8879b483 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -129,6 +129,7 @@ protected void onPause() { 1. [熊晓清](http://blog.csdn.net/yaya_xiong) QQ:137048616 2. [の伤也快乐](https://github.com/jmhjmh) QQ:466278628 +3. [吴亚男]() QQ:623562486 * [wiki整理](https://github.com/lipangit/JiaoZiVideoPlayer/wiki#wiki%E6%95%B4%E7%90%86) diff --git a/README.md b/README.md index 06c54efc..fb7c6e25 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,7 @@ protected void onPause() { 1. [熊晓清](http://blog.csdn.net/yaya_xiong) QQ:137048616 2. [の伤也快乐](https://github.com/jmhjmh) QQ:466278628 +3. [吴亚男]() QQ:623562486 ## Reward From a368fea6ffb388c28ef41130d8a7967c55ec6fc5 Mon Sep 17 00:00:00 2001 From: I Date: Mon, 25 Mar 2019 05:48:44 +0800 Subject: [PATCH 02/33] fix ui --- app/src/main/res/layout/activity_api_rotation_videosize.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/layout/activity_api_rotation_videosize.xml b/app/src/main/res/layout/activity_api_rotation_videosize.xml index 4e7b43ca..cc21d47d 100644 --- a/app/src/main/res/layout/activity_api_rotation_videosize.xml +++ b/app/src/main/res/layout/activity_api_rotation_videosize.xml @@ -10,7 +10,8 @@ + android:layout_height="wrap_content" + android:orientation="vertical"> Date: Mon, 25 Mar 2019 06:00:41 +0800 Subject: [PATCH 03/33] minify enable --- app/build.gradle | 2 +- jiaozivideoplayer/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 44bd5a17..2dd262bb 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -20,7 +20,7 @@ android { } buildTypes { release { - minifyEnabled false + minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.releaseConfig } diff --git a/jiaozivideoplayer/build.gradle b/jiaozivideoplayer/build.gradle index d6415e24..e56330b6 100644 --- a/jiaozivideoplayer/build.gradle +++ b/jiaozivideoplayer/build.gradle @@ -11,7 +11,7 @@ android { } buildTypes { release { - minifyEnabled false + minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } From 18c38552752e865320615e1566629936e61db88d Mon Sep 17 00:00:00 2001 From: I Date: Tue, 26 Mar 2019 07:15:29 +0800 Subject: [PATCH 04/33] attach importent --- .../src/main/java/cn/jzvd/JZDataSource.java | 4 +++ .../src/main/java/cn/jzvd/Jzvd.java | 25 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/JZDataSource.java b/jiaozivideoplayer/src/main/java/cn/jzvd/JZDataSource.java index 7d392901..da270815 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/JZDataSource.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/JZDataSource.java @@ -79,4 +79,8 @@ public boolean containsTheUrl(Object object) { } return false; } + + public JZDataSource cloneMe() { + return new JZDataSource(urlsMap, title); + } } diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java index 3751fe40..3155272b 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java @@ -24,6 +24,7 @@ import android.widget.Toast; import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import java.util.LinkedList; import java.util.Timer; import java.util.TimerTask; @@ -828,6 +829,27 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { } } + public Jzvd cloneMe() { + Jzvd jzvd = null; + try { + Constructor constructor = (Constructor) Jzvd.this.getClass().getConstructor(Context.class); + jzvd = constructor.newInstance(getContext()); + jzvd.jzDataSource = jzDataSource.cloneMe();//jzvd应该是idle状态 + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (InstantiationException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + } +// FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams( +// ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); +// vp.addView(jzvd, lp); + return jzvd; + } + /** * 这个仅仅是一个如何进入小窗的例子 */ @@ -837,6 +859,7 @@ public void gotoScreenTiny() { return; ViewGroup vg = (ViewGroup) getParent(); vg.removeView(this); + vg.addView(cloneMe()); CONTAINER_LIST.add(vg); vg = (ViewGroup) (JZUtils.scanForActivity(getContext())).getWindow().getDecorView();//和他也没有关系 FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(400, 400); @@ -848,6 +871,7 @@ public void gotoScreenTiny() { public void gotoScreenFullscreen() { ViewGroup vg = (ViewGroup) getParent(); vg.removeView(this); + vg.addView(cloneMe()); CONTAINER_LIST.add(vg); vg = (ViewGroup) (JZUtils.scanForActivity(getContext())).getWindow().getDecorView();//和他也没有关系 vg.addView(this, new FrameLayout.LayoutParams( @@ -864,6 +888,7 @@ public void gotoScreenFullscreen() { public void gotoScreenNormal() {//goback本质上是goto ViewGroup vg = (ViewGroup) (JZUtils.scanForActivity(getContext())).getWindow().getDecorView(); vg.removeView(this); + CONTAINER_LIST.getLast().removeAllViews(); CONTAINER_LIST.getLast().addView(this, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); CONTAINER_LIST.pop(); From 8df7eaa101c659e2facb626e8dfd55cea09da893 Mon Sep 17 00:00:00 2001 From: I Date: Tue, 26 Mar 2019 17:39:29 +0800 Subject: [PATCH 05/33] attach --- jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java index 3155272b..cf557027 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java @@ -835,6 +835,7 @@ public Jzvd cloneMe() { Constructor constructor = (Constructor) Jzvd.this.getClass().getConstructor(Context.class); jzvd = constructor.newInstance(getContext()); jzvd.jzDataSource = jzDataSource.cloneMe();//jzvd应该是idle状态 +// jzvd.setId(getId()); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InstantiationException e) { From c4d2686137066b66b46fa686473ff67bf7efcf48 Mon Sep 17 00:00:00 2001 From: I Date: Wed, 27 Mar 2019 05:35:35 +0800 Subject: [PATCH 06/33] goback fullscreen in listview --- jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java index cf557027..953b84ca 100644 --- a/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java +++ b/jiaozivideoplayer/src/main/java/cn/jzvd/Jzvd.java @@ -123,6 +123,10 @@ public void onAudioFocusChange(int focusChange) { protected int mGestureDownVolume; protected float mGestureDownBrightness; protected long mSeekTimePosition; + /** + * liestview中,退出全屏也会导致列表getview->setUp,这个变量要屏蔽这个过程 + **/ + protected long gobakFullscreenTime = 0; public Jzvd(Context context) { super(context); @@ -314,14 +318,11 @@ public void setUp(JZDataSource jzDataSource, int screen) { } public void setUp(JZDataSource jzDataSource, int screen, JZMediaInterface jzMediaInterface) { -// if (this.jzDataSource != null && jzDataSource.getCurrentUrl() != null && -// this.jzDataSource.containsTheUrl(jzDataSource.getCurrentUrl())) { -// return; -// } + if ((System.currentTimeMillis() - gobakFullscreenTime) < 200) return; + this.jzDataSource = jzDataSource; this.currentScreen = screen; onStateNormal(); - mediaInterface = jzMediaInterface;//这个位置可能需要调整 } @@ -835,7 +836,7 @@ public Jzvd cloneMe() { Constructor constructor = (Constructor) Jzvd.this.getClass().getConstructor(Context.class); jzvd = constructor.newInstance(getContext()); jzvd.jzDataSource = jzDataSource.cloneMe();//jzvd应该是idle状态 -// jzvd.setId(getId()); + jzvd.setId(getId()); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InstantiationException e) { @@ -887,6 +888,7 @@ public void gotoScreenFullscreen() { } public void gotoScreenNormal() {//goback本质上是goto + gobakFullscreenTime = System.currentTimeMillis(); ViewGroup vg = (ViewGroup) (JZUtils.scanForActivity(getContext())).getWindow().getDecorView(); vg.removeView(this); CONTAINER_LIST.getLast().removeAllViews(); From 9802f17c7ab3901628872ae7baf858956bffc3da Mon Sep 17 00:00:00 2001 From: I Date: Wed, 27 Mar 2019 09:41:26 +0800 Subject: [PATCH 07/33] goto and quit tiny in listview --- .../java/cn/jzvd/demo/ActivityTinyWindow.java | 4 +-- .../ActivityTinyWindowListViewNormal.java | 23 ++++++++++++- .../main/res/layout/activity_tiny_window.xml | 18 +++++----- app/src/main/res/layout/item_videoview.xml | 2 +- .../src/main/java/cn/jzvd/Jzvd.java | 33 ++----------------- 5 files changed, 37 insertions(+), 43 deletions(-) diff --git a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindow.java b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindow.java index aef810a1..1c398076 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindow.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindow.java @@ -1,5 +1,6 @@ package cn.jzvd.demo; +import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; @@ -70,8 +71,7 @@ public void clickTinyWindow(View view) { } public void clickAutoTinyListView(View view) { - Toast.makeText(this, "comming soon", Toast.LENGTH_SHORT).show(); -// startActivity(new Intent(this, ActivityTinyWindowListViewNormal.class)); + startActivity(new Intent(this, ActivityTinyWindowListViewNormal.class)); } public void clickAutoTinyListViewMultiHolder(View view) { diff --git a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewNormal.java b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewNormal.java index 5ec7c776..fee9759d 100644 --- a/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewNormal.java +++ b/app/src/main/java/cn/jzvd/demo/ActivityTinyWindowListViewNormal.java @@ -3,6 +3,7 @@ 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; @@ -41,7 +42,27 @@ public void onScrollStateChanged(AbsListView view, int scrollState) { @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { -// Jzvd.onScrollAutoTiny(view, firstVisibleItem, visibleItemCount, totalItemCount); + int lastVisibleItem = firstVisibleItem + visibleItemCount; + Jzvd jzvd = Jzvd.CURRENT_JZVD; + if (jzvd == null) return; + int currentPlayPosition = jzvd.positionInList; + if (currentPlayPosition >= 0) { + if ((currentPlayPosition < firstVisibleItem || currentPlayPosition > (lastVisibleItem - 1))) { + if (jzvd.currentState == Jzvd.CURRENT_STATE_PAUSE) { + Jzvd.resetAllVideos(); + } else { + Log.e("jzvd", "onScroll: out screen"); + if (jzvd.currentScreen != Jzvd.SCREEN_WINDOW_TINY) { + jzvd.gotoScreenTiny(); + } + } + } else { + if (jzvd.currentScreen == Jzvd.SCREEN_WINDOW_TINY) { + Log.e("jzvd", "onScroll: into screen"); + Jzvd.backPress(); + } + } + } } }); } diff --git a/app/src/main/res/layout/activity_tiny_window.xml b/app/src/main/res/layout/activity_tiny_window.xml index 620e33fb..144a8859 100644 --- a/app/src/main/res/layout/activity_tiny_window.xml +++ b/app/src/main/res/layout/activity_tiny_window.xml @@ -14,15 +14,6 @@ android:layout_height="wrap_content" android:orientation="vertical"> - - - -