diff --git a/README.md b/README.md index 5f09573a..b2ae9e63 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ --

- +

@@ -23,7 +23,7 @@ ## 文档 -- [文档 - API](https://github.com/Jzvd/JiaoZiVideoPlayer/wiki/%E6%96%87%E6%A1%A3-%E2%80%94-API),下载安装[Demo jiaozivideoplayer-7.3.1.apk](https://github.com/Jzvd/JiaoZiVideoPlayer/releases/download/v7.3.1/jiaozivideoplayer-7.3.1.apk),仔细过一遍Demo +- [文档 - API](https://github.com/Jzvd/JiaoZiVideoPlayer/wiki/%E6%96%87%E6%A1%A3-%E2%80%94-API),下载安装[Demo jiaozivideoplayer-7.4.0.apk](https://github.com/Jzvd/JiaoZiVideoPlayer/releases/download/v7.4.0/jiaozivideoplayer-7.4.0.apk),仔细过一遍Demo - [文档 - 自定义Jzvd](https://github.com/Jzvd/JiaoZiVideoPlayer/wiki/%E6%96%87%E6%A1%A3-%E2%80%94-%E8%87%AA%E5%AE%9A%E4%B9%89Jzvd),继承JzvdStd实现自己的播放器 - [文档 - 自定义播放内核](https://github.com/Jzvd/JiaoZiVideoPlayer/wiki/%E6%96%87%E6%A1%A3-%E2%80%94-%E8%87%AA%E5%AE%9A%E4%B9%89%E6%92%AD%E6%94%BE%E5%86%85%E6%A0%B8),测试哪个播放内核适合自己的项目 @@ -37,7 +37,7 @@ 1.添加类库 ```gradle -implementation 'cn.jzvd:jiaozivideoplayer:7.3.1' +implementation 'cn.jzvd:jiaozivideoplayer:7.4.0' ``` 2.添加布局 diff --git a/build.gradle b/build.gradle index b9b12e06..2d91d4e1 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.6.2' + classpath 'com.android.tools.build:gradle:3.6.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/demo/build.gradle b/demo/build.gradle index dbc08a3a..b888b879 100644 --- a/demo/build.gradle +++ b/demo/build.gradle @@ -8,8 +8,8 @@ android { applicationId "cn.jzvd.demo" minSdkVersion 16 targetSdkVersion 29 - versionCode 101 - versionName "7.3.1" + versionCode 102 + versionName "7.4.0" ndk { // add support lib abiFilters 'armeabi-v7a' //, 'arm64-v8a'//, "mips" //,'armeabi''x86',, 'x86_64', diff --git a/demo/src/main/java/cn/jzvd/demo/CustomJzvd/MyJzvdStdNoTitleNoClarity.java b/demo/src/main/java/cn/jzvd/demo/CustomJzvd/MyJzvdStdNoTitleNoClarity.java new file mode 100644 index 00000000..563af7b1 --- /dev/null +++ b/demo/src/main/java/cn/jzvd/demo/CustomJzvd/MyJzvdStdNoTitleNoClarity.java @@ -0,0 +1,23 @@ +package cn.jzvd.demo.CustomJzvd; + +import android.content.Context; +import android.util.AttributeSet; + +import cn.jzvd.demo.R; + +public class MyJzvdStdNoTitleNoClarity extends MyJzvdStd { + + public MyJzvdStdNoTitleNoClarity(Context context) { + super(context); + } + + public MyJzvdStdNoTitleNoClarity(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @Override + public int getLayoutId() { + return R.layout.layout_jzstd_notitle; + } + +} diff --git a/demo/src/main/java/cn/jzvd/demo/api/SmallChangeUiActivity.java b/demo/src/main/java/cn/jzvd/demo/api/SmallChangeUiActivity.java index dab07edf..0b6fc4f3 100644 --- a/demo/src/main/java/cn/jzvd/demo/api/SmallChangeUiActivity.java +++ b/demo/src/main/java/cn/jzvd/demo/api/SmallChangeUiActivity.java @@ -37,6 +37,7 @@ public class SmallChangeUiActivity extends AppCompatActivity { JzvdStdVolume jzvdStdVolume; JzvdStd jzvdStd_1_1, jzvdStd_16_9; + JzvdStd jzNoTitle; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { @@ -48,6 +49,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { getSupportActionBar().setTitle("SmallChangeUI"); setContentView(R.layout.activity_ui_small_change); + jzNoTitle = findViewById(R.id.jz_notitle); + jzNoTitle.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4" + , "饺子叫啥也显示不出来啊"); + Glide.with(this).load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png").into(jzNoTitle.posterImageView); lockScreen = findViewById(R.id.lock_screen); lockScreen.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4" diff --git a/demo/src/main/res/layout/activity_ui_small_change.xml b/demo/src/main/res/layout/activity_ui_small_change.xml index caeda7f3..9b102218 100644 --- a/demo/src/main/res/layout/activity_ui_small_change.xml +++ b/demo/src/main/res/layout/activity_ui_small_change.xml @@ -13,6 +13,24 @@ android:layout_height="wrap_content" android:orientation="vertical"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gradle/build_upload.gradle b/gradle/build_upload.gradle index 1da1b39b..445d2a54 100644 --- a/gradle/build_upload.gradle +++ b/gradle/build_upload.gradle @@ -8,7 +8,7 @@ signing { group = "cn.jzvd" archivesBaseName = "jiaozivideoplayer" -version = "7.3.1" +version = "7.4.0" uploadArchives { repositories { diff --git a/library/build.gradle b/library/build.gradle index bfecb012..39047ab3 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -7,8 +7,8 @@ android { defaultConfig { minSdkVersion 16 targetSdkVersion 29 - versionCode 101 - versionName "7.3.1" + versionCode 102 + versionName "7.4.0" } compileOptions { diff --git a/library/src/main/java/cn/jzvd/Jzvd.java b/library/src/main/java/cn/jzvd/Jzvd.java index f121b551..b75a1e9a 100644 --- a/library/src/main/java/cn/jzvd/Jzvd.java +++ b/library/src/main/java/cn/jzvd/Jzvd.java @@ -19,6 +19,8 @@ import android.view.WindowManager; import android.widget.FrameLayout; import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; import android.widget.SeekBar; import android.widget.TextView; import android.widget.Toast; @@ -259,6 +261,31 @@ public void init(Context context) { textureViewContainer = findViewById(R.id.surface_container); topContainer = findViewById(R.id.layout_top); + if (startButton == null) { + startButton = new ImageView(context); + } + if (fullscreenButton == null) { + fullscreenButton = new ImageView(context); + } + if (progressBar == null) { + progressBar = new SeekBar(context); + } + if (currentTimeTextView == null) { + currentTimeTextView = new TextView(context); + } + if (totalTimeTextView == null) { + totalTimeTextView = new TextView(context); + } + if (bottomContainer == null) { + bottomContainer = new LinearLayout(context); + } + if (textureViewContainer == null) { + textureViewContainer = new FrameLayout(context); + } + if (topContainer == null) { + topContainer = new RelativeLayout(context); + } + startButton.setOnClickListener(this); fullscreenButton.setOnClickListener(this); progressBar.setOnSeekBarChangeListener(this); @@ -312,7 +339,7 @@ public void onClick(View v) { } } - private void clickFullscreen() { + protected void clickFullscreen() { Log.i(TAG, "onClick fullscreen [" + this.hashCode() + "] "); if (state == STATE_AUTO_COMPLETE) return; if (screen == SCREEN_FULLSCREEN) { @@ -324,7 +351,7 @@ private void clickFullscreen() { } } - private void clickStart() { + protected void clickStart() { Log.i(TAG, "onClick start [" + this.hashCode() + "] "); if (jzDataSource == null || jzDataSource.urlsMap.isEmpty() || jzDataSource.getCurrentUrl() == null) { Toast.makeText(getContext(), getResources().getString(R.string.no_url), Toast.LENGTH_SHORT).show(); @@ -371,7 +398,7 @@ public boolean onTouch(View v, MotionEvent event) { return false; } - private void touchActionUp() { + protected void touchActionUp() { Log.i(TAG, "onTouch surfaceContainer actionUp [" + this.hashCode() + "] "); mTouchingProgressBar = false; dismissProgressDialog(); @@ -389,7 +416,7 @@ private void touchActionUp() { startProgressTimer(); } - private void touchActionMove(float x, float y) { + protected void touchActionMove(float x, float y) { Log.i(TAG, "onTouch surfaceContainer actionMove [" + this.hashCode() + "] "); float deltaX = x - mDownX; float deltaY = y - mDownY; @@ -473,7 +500,7 @@ private void touchActionMove(float x, float y) { } } - private void touchActionDown(float x, float y) { + protected void touchActionDown(float x, float y) { Log.i(TAG, "onTouch surfaceContainer actionDown [" + this.hashCode() + "] "); mTouchingProgressBar = true; @@ -945,6 +972,7 @@ public void cloneAJzvd(ViewGroup vg) { public void gotoScreenFullscreen() { gotoFullscreenTime = System.currentTimeMillis(); ViewGroup vg = (ViewGroup) getParent(); + jzvdContext = vg.getContext(); blockLayoutParams = getLayoutParams(); blockIndex = vg.indexOfChild(this); blockWidth = getWidth(); diff --git a/library/src/main/java/cn/jzvd/JzvdStd.java b/library/src/main/java/cn/jzvd/JzvdStd.java index fa82e152..37b5323f 100644 --- a/library/src/main/java/cn/jzvd/JzvdStd.java +++ b/library/src/main/java/cn/jzvd/JzvdStd.java @@ -85,7 +85,7 @@ public void onReceive(Context context, Intent intent) { protected Dialog mBrightnessDialog; protected ProgressBar mDialogBrightnessProgressBar; protected TextView mDialogBrightnessTextView; - private boolean mIsWifi; + protected boolean mIsWifi; public BroadcastReceiver wifiReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -101,9 +101,9 @@ public void onReceive(Context context, Intent intent) { } }; //doublClick 这两个全局变量只在ontouch中使用,就近放置便于阅读 - private long lastClickTime = 0; - private long doubleTime = 200; - private ArrayDeque delayTask = new ArrayDeque<>(); + protected long lastClickTime = 0; + protected long doubleTime = 200; + protected ArrayDeque delayTask = new ArrayDeque<>(); public JzvdStd(Context context) { super(context); @@ -130,6 +130,46 @@ public void init(Context context) { mRetryBtn = findViewById(R.id.retry_btn); mRetryLayout = findViewById(R.id.retry_layout); + if (batteryTimeLayout == null) { + batteryTimeLayout = new LinearLayout(context); + } + if (bottomProgressBar == null) { + bottomProgressBar = new ProgressBar(context); + } + if (titleTextView == null) { + titleTextView = new TextView(context); + } + if (backButton == null) { + backButton = new ImageView(context); + } + if (posterImageView == null) { + posterImageView = new ImageView(context); + } + if (loadingProgressBar == null) { + loadingProgressBar = new ProgressBar(context); + } + if (tinyBackImageView == null) { + tinyBackImageView = new ImageView(context); + } + if (batteryLevel == null) { + batteryLevel = new ImageView(context); + } + if (videoCurrentTime == null) { + videoCurrentTime = new TextView(context); + } + if (replayTextView == null) { + replayTextView = new TextView(context); + } + if (clarity == null) { + clarity = new TextView(context); + } + if (mRetryBtn == null) { + mRetryBtn = new TextView(context); + } + if (mRetryLayout == null) { + mRetryLayout = new LinearLayout(context); + } + posterImageView.setOnClickListener(this); backButton.setOnClickListener(this); tinyBackImageView.setOnClickListener(this); @@ -303,7 +343,7 @@ public void onClick(View v) { } } - private void clickRetryBtn() { + protected void clickRetryBtn() { if (jzDataSource.urlsMap.isEmpty() || jzDataSource.getCurrentUrl() == null) { Toast.makeText(jzvdContext, getResources().getString(R.string.no_url), Toast.LENGTH_SHORT).show(); return; @@ -318,7 +358,7 @@ private void clickRetryBtn() { startVideo(); } - private void clickClarity() { + protected void clickClarity() { onCLickUiToggleToClear(); LayoutInflater inflater = (LayoutInflater) jzvdContext @@ -368,19 +408,19 @@ private void clickClarity() { // clarityPopWindow.update(clarity, -offsetX, -offsetY, Math.round(layout.getMeasuredWidth() * 2), layout.getMeasuredHeight()); } - private void clickBackTiny() { + protected void clickBackTiny() { clearFloatScreen(); } - private void clickBack() { + protected void clickBack() { backPress(); } - private void clickSurfaceContainer() { + protected void clickSurfaceContainer() { startDismissControlViewTimer(); } - private void clickPoster() { + protected void clickPoster() { if (jzDataSource == null || jzDataSource.urlsMap.isEmpty() || jzDataSource.getCurrentUrl() == null) { Toast.makeText(jzvdContext, getResources().getString(R.string.no_url), Toast.LENGTH_SHORT).show(); return;