From 8c00ccbe03a96c68854129ad827e0d7d8fad063e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BA=8E=E4=BF=8A?= <215613905@qq.com>
Date: Thu, 28 Jul 2022 17:46:57 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=B0=8F=E7=AA=97=E9=85=8D?=
=?UTF-8?q?=E7=BD=AE=E5=BC=80=E5=85=B3=20=20=20=20=20=20=20=20=20=20=20=20?=
=?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?=
=?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?=
=?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=E8=A7=86=E9=A2=91=E6=93=8D?=
=?UTF-8?q?=E4=BD=9C=E6=A0=8F=E9=97=B2=E7=BD=AE5=E7=A7=92=E8=87=AA?=
=?UTF-8?q?=E5=8A=A8=E6=B6=88=E5=A4=B1=20=20=20=20=20=20=20=20=20=20=20=20?=
=?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?=
=?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?=
=?UTF-8?q?=E4=BC=98=E5=8C=96=E9=80=89=E9=9B=86=E6=97=B6=E8=B0=83=E7=94=A8?=
=?UTF-8?q?=E9=A1=BA=E5=BA=8F=E9=97=AE=E9=A2=98=20=E6=8F=90=E5=8D=87?=
=?UTF-8?q?=E8=A7=82=E6=84=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/misc.xml | 3 +
.../osc/player/controller/VodController.java | 37 +-
.../tvbox/osc/ui/activity/DetailActivity.java | 24 +-
.../osc/ui/fragment/ModelSettingFragment.java | 12 +
.../com/github/tvbox/osc/util/HawkConfig.java | 1 +
app/src/main/res/layout/fragment_model.xml | 968 +++++++++---------
6 files changed, 574 insertions(+), 471 deletions(-)
diff --git a/.idea/misc.xml b/.idea/misc.xml
index e0ba2cbf..01e53908 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -10,7 +10,10 @@
+
+
+
diff --git a/app/src/main/java/com/github/tvbox/osc/player/controller/VodController.java b/app/src/main/java/com/github/tvbox/osc/player/controller/VodController.java
index 1042372b..1c93c669 100644
--- a/app/src/main/java/com/github/tvbox/osc/player/controller/VodController.java
+++ b/app/src/main/java/com/github/tvbox/osc/player/controller/VodController.java
@@ -1,6 +1,7 @@
package com.github.tvbox.osc.player.controller;
import android.content.Context;
+import android.os.Handler;
import android.os.Message;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -37,7 +38,6 @@ import xyz.doikki.videoplayer.util.PlayerUtils;
import static xyz.doikki.videoplayer.util.PlayerUtils.stringForTime;
-//视频播放页面控件
public class VodController extends BaseController {
public VodController(@NonNull @NotNull Context context) {
super(context);
@@ -101,6 +101,10 @@ public class VodController extends BaseController {
TextView mPlayerTimeSkipBtn;
TextView mPlayerTimeStepBtn;
+ Handler myHandle;
+ Runnable myRunnable;
+ int myHandleSeconds = 5000;//闲置多少毫秒秒关闭底栏 默认5秒
+
@Override
protected void initView() {
super.initView();
@@ -125,6 +129,14 @@ public class VodController extends BaseController {
mPlayerTimeSkipBtn = findViewById(R.id.play_time_end);
mPlayerTimeStepBtn = findViewById(R.id.play_time_step);
+ myHandle=new Handler();
+ myRunnable = new Runnable() {
+ @Override
+ public void run() {
+ hideBottom();
+ }
+ };
+
mGridView.setLayoutManager(new V7LinearLayoutManager(getContext(), 0, false));
ParseAdapter parseAdapter = new ParseAdapter();
parseAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@@ -199,6 +211,8 @@ public class VodController extends BaseController {
mPlayerScaleBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
+ myHandle.removeCallbacks(myRunnable);
+ myHandle.postDelayed(myRunnable, myHandleSeconds);
try {
int scaleType = mPlayerConfig.getInt("sc");
scaleType++;
@@ -216,6 +230,8 @@ public class VodController extends BaseController {
mPlayerSpeedBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
+ myHandle.removeCallbacks(myRunnable);
+ myHandle.postDelayed(myRunnable, myHandleSeconds);
try {
float speed = (float) mPlayerConfig.getDouble("sp");
speed += 0.25f;
@@ -289,6 +305,8 @@ public class VodController extends BaseController {
findViewById(R.id.play_time_reset).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
+ myHandle.removeCallbacks(myRunnable);
+ myHandle.postDelayed(myRunnable, myHandleSeconds);
try {
mPlayerConfig.put("et", 0);
mPlayerConfig.put("st", 0);
@@ -302,6 +320,8 @@ public class VodController extends BaseController {
mPlayerTimeStartBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
+ myHandle.removeCallbacks(myRunnable);
+ myHandle.postDelayed(myRunnable, myHandleSeconds);
try {
int step = Hawk.get(HawkConfig.PLAY_TIME_STEP, 5);
int st = mPlayerConfig.getInt("st");
@@ -320,6 +340,8 @@ public class VodController extends BaseController {
mPlayerTimeSkipBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
+ myHandle.removeCallbacks(myRunnable);
+ myHandle.postDelayed(myRunnable, myHandleSeconds);
try {
int step = Hawk.get(HawkConfig.PLAY_TIME_STEP, 5);
int et = mPlayerConfig.getInt("et");
@@ -338,6 +360,8 @@ public class VodController extends BaseController {
mPlayerTimeStepBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
+ myHandle.removeCallbacks(myRunnable);
+ myHandle.postDelayed(myRunnable, myHandleSeconds);
int step = Hawk.get(HawkConfig.PLAY_TIME_STEP, 5);
step += 5;
if (step > 30) {
@@ -562,10 +586,12 @@ public class VodController extends BaseController {
togglePlay();
return true;
}
- } else if (keyCode == KeyEvent.KEYCODE_DPAD_UP) {
- } else if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
+// } else if (keyCode == KeyEvent.KEYCODE_DPAD_UP) { // 闲置开启计时关闭透明底栏
+ } else if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN || keyCode == KeyEvent.KEYCODE_DPAD_UP) {
+ myHandle.removeCallbacks(myRunnable);
if (!isBottomVisible()) {
showBottom();
+ myHandle.postDelayed(myRunnable, myHandleSeconds);
return true;
}
}
@@ -582,8 +608,11 @@ public class VodController extends BaseController {
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
+ myHandle.removeCallbacks(myRunnable);
if (!isBottomVisible()) {
showBottom();
+ // 闲置计时关闭
+ myHandle.postDelayed(myRunnable, myHandleSeconds);
} else {
hideBottom();
}
@@ -601,4 +630,4 @@ public class VodController extends BaseController {
}
return false;
}
-}
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/github/tvbox/osc/ui/activity/DetailActivity.java b/app/src/main/java/com/github/tvbox/osc/ui/activity/DetailActivity.java
index ce32e5a9..84e0d8c3 100644
--- a/app/src/main/java/com/github/tvbox/osc/ui/activity/DetailActivity.java
+++ b/app/src/main/java/com/github/tvbox/osc/ui/activity/DetailActivity.java
@@ -38,6 +38,7 @@ import com.github.tvbox.osc.ui.dialog.QuickSearchDialog;
import com.github.tvbox.osc.ui.fragment.PlayFragment;
import com.github.tvbox.osc.util.DefaultConfig;
import com.github.tvbox.osc.util.FastClickCheckUtil;
+import com.github.tvbox.osc.util.HawkConfig;
import com.github.tvbox.osc.util.MD5;
import com.github.tvbox.osc.viewmodel.SourceViewModel;
import com.google.gson.Gson;
@@ -46,6 +47,7 @@ import com.google.gson.JsonElement;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.AbsCallback;
import com.lzy.okgo.model.Response;
+import com.orhanobut.hawk.Hawk;
import com.owen.tvrecyclerview.widget.TvRecyclerView;
import com.owen.tvrecyclerview.widget.V7GridLayoutManager;
import com.owen.tvrecyclerview.widget.V7LinearLayoutManager;
@@ -116,12 +118,6 @@ public class DetailActivity extends BaseActivity {
}
private void initView() {
- new Handler().postDelayed(new Runnable() {
- @Override
- public void run() {
- tvPlay.requestFocus();
- }
- },500);
llLayout = findViewById(R.id.llLayout);
llPlayerPlace = findViewById(R.id.previewPlayerPlace);
llPlayerFragmentContainer = findViewById(R.id.previewPlayer);
@@ -159,6 +155,12 @@ public class DetailActivity extends BaseActivity {
getSupportFragmentManager().beginTransaction().show(playFragment).commitAllowingStateLoss();
tvPlay.setText("全屏");
}
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ tvPlay.requestFocus();
+ }
+ },500);
tvSort.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -258,7 +260,7 @@ public class DetailActivity extends BaseActivity {
@Override
public void onItemPreSelected(TvRecyclerView parent, View itemView, int position) {
-
+ refresh(itemView, position);
}
@Override
@@ -268,7 +270,7 @@ public class DetailActivity extends BaseActivity {
@Override
public void onItemClick(TvRecyclerView parent, View itemView, int position) {
- refresh(itemView, position);
+
}
});
seriesAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@@ -285,9 +287,9 @@ public class DetailActivity extends BaseActivity {
}
seriesAdapter.getData().get(vodInfo.playIndex).selected = true;
seriesAdapter.notifyItemChanged(vodInfo.playIndex);
- jumpToPlay();
- //选集全屏 此处取消注释
+ //选集全屏 想选集不全屏的注释下面一行
if (showPreview && !fullWindows) toggleFullPreview();
+ jumpToPlay();
}
}
});
@@ -680,7 +682,7 @@ public class DetailActivity extends BaseActivity {
}
// preview
- boolean showPreview = true; // true 开启 false 关闭
+ boolean showPreview = Hawk.get(HawkConfig.SHOW_PREVIEW, true);; // true 开启 false 关闭
boolean fullWindows = false;
ViewGroup.LayoutParams windowsPreview = null;
ViewGroup.LayoutParams windowsFull = null;
diff --git a/app/src/main/java/com/github/tvbox/osc/ui/fragment/ModelSettingFragment.java b/app/src/main/java/com/github/tvbox/osc/ui/fragment/ModelSettingFragment.java
index d2306fad..7e1c90c3 100644
--- a/app/src/main/java/com/github/tvbox/osc/ui/fragment/ModelSettingFragment.java
+++ b/app/src/main/java/com/github/tvbox/osc/ui/fragment/ModelSettingFragment.java
@@ -58,6 +58,7 @@ public class ModelSettingFragment extends BaseLazyFragment {
private TextView tvDns;
private TextView tvHomeRec;
private TextView tvSearchView;
+ private TextView tvShowPreviewText;
public static ModelSettingFragment newInstance() {
return new ModelSettingFragment().setArguments();
@@ -74,6 +75,8 @@ public class ModelSettingFragment extends BaseLazyFragment {
@Override
protected void init() {
+ tvShowPreviewText = findViewById(R.id.showPreviewText);
+ tvShowPreviewText.setText(Hawk.get(HawkConfig.SHOW_PREVIEW, true) ? "已开启" : "已关闭");
tvDebugOpen = findViewById(R.id.tvDebugOpen);
tvParseWebView = findViewById(R.id.tvParseWebView);
tvMediaCodec = findViewById(R.id.tvMediaCodec);
@@ -498,6 +501,15 @@ public class ModelSettingFragment extends BaseLazyFragment {
findViewById(R.id.llDebug).setVisibility(View.VISIBLE);
}
};
+
+ findViewById(R.id.showPreview).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ FastClickCheckUtil.check(v);
+ Hawk.put(HawkConfig.SHOW_PREVIEW, !Hawk.get(HawkConfig.SHOW_PREVIEW, true));
+ tvShowPreviewText.setText(Hawk.get(HawkConfig.SHOW_PREVIEW, true) ? "已开启" : "已关闭");
+ }
+ });
}
@Override
diff --git a/app/src/main/java/com/github/tvbox/osc/util/HawkConfig.java b/app/src/main/java/com/github/tvbox/osc/util/HawkConfig.java
index a13a8d58..16dfdc49 100644
--- a/app/src/main/java/com/github/tvbox/osc/util/HawkConfig.java
+++ b/app/src/main/java/com/github/tvbox/osc/util/HawkConfig.java
@@ -7,6 +7,7 @@ package com.github.tvbox.osc.util;
*/
public class HawkConfig {
public static final String API_URL = "api_url";
+ public static final String SHOW_PREVIEW = "show_preview";
public static final String API_HISTORY = "api_history";
public static final String HOME_API = "home_api";
public static final String DEFAULT_PARSE = "parse_default";
diff --git a/app/src/main/res/layout/fragment_model.xml b/app/src/main/res/layout/fragment_model.xml
index f9aff1ad..232bef32 100644
--- a/app/src/main/res/layout/fragment_model.xml
+++ b/app/src/main/res/layout/fragment_model.xml
@@ -1,241 +1,62 @@
-
-
+ android:layout_height="match_parent"
+ android:padding="@dimen/vs_20">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:scrollbars="none">
-
-
-
-
-
-
-
-
-
-
+ android:focusableInTouchMode="false"
+ android:orientation="vertical">
-
-
-
-
-
-
-
-
-
-
-
+ android:paddingRight="@dimen/vs_20"
+ android:visibility="gone">
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/vs_60"
+ android:layout_marginBottom="@dimen/vs_10"
+ android:focusable="false"
+ android:orientation="horizontal">
+ android:id="@+id/llHomeRec"
+ android:layout_width="@dimen/vs_0"
+ android:layout_height="match_parent"
+ android:layout_marginEnd="@dimen/vs_5"
+ android:layout_marginRight="@dimen/vs_5"
+ android:layout_weight="1"
+ android:background="@drawable/shape_setting_model_focus"
+ android:focusable="true"
+ android:gravity="center_vertical"
+ android:orientation="horizontal"
+ android:paddingLeft="@dimen/vs_20"
+ android:paddingRight="@dimen/vs_20">
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="首页推荐"
+ android:textColor="@android:color/white"
+ android:textSize="@dimen/ts_24" />
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1" />
+ android:id="@+id/tvHomeRec"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="@android:color/white"
+ android:textSize="@dimen/ts_24" />
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/vs_10"
+ android:layout_marginLeft="@dimen/vs_10"
+ android:text=">"
+ android:textColor="@android:color/white"
+ android:textSize="@dimen/ts_30" />
+ android:id="@+id/llSearchView"
+ android:layout_width="@dimen/vs_0"
+ android:layout_height="match_parent"
+ android:layout_marginStart="@dimen/vs_5"
+ android:layout_marginLeft="@dimen/vs_5"
+ android:layout_weight="1"
+ android:background="@drawable/shape_setting_model_focus"
+ android:focusable="true"
+ android:gravity="center_vertical"
+ android:orientation="horizontal"
+ android:paddingLeft="@dimen/vs_20"
+ android:paddingRight="@dimen/vs_20">
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="搜索展示"
+ android:textColor="@android:color/white"
+ android:textSize="@dimen/ts_24" />
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1" />
+ android:id="@+id/tvSearchView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="@android:color/white"
+ android:textSize="@dimen/ts_24" />
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/vs_10"
+ android:layout_marginLeft="@dimen/vs_10"
+ android:text=">"
+ android:textColor="@android:color/white"
+ android:textSize="@dimen/ts_30" />
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/vs_60"
+ android:layout_marginBottom="@dimen/vs_10"
+ android:focusable="false"
+ android:orientation="horizontal">
+ android:id="@+id/llPlay"
+ android:layout_width="@dimen/vs_0"
+ android:layout_height="match_parent"
+ android:layout_marginEnd="@dimen/vs_5"
+ android:layout_marginRight="@dimen/vs_5"
+ android:layout_weight="1"
+ android:background="@drawable/shape_setting_model_focus"
+ android:focusable="true"
+ android:gravity="center_vertical"
+ android:orientation="horizontal"
+ android:paddingLeft="@dimen/vs_20"
+ android:paddingRight="@dimen/vs_20">
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="播放器"
+ android:textColor="@android:color/white"
+ android:textSize="@dimen/ts_24" />
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1" />
+ android:id="@+id/tvPlay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="@android:color/white"
+ android:textSize="@dimen/ts_24" />
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/vs_10"
+ android:layout_marginLeft="@dimen/vs_10"
+ android:text=">"
+ android:textColor="@android:color/white"
+ android:textSize="@dimen/ts_30" />
-
+ android:id="@+id/llMediaCodec"
+ android:layout_width="@dimen/vs_0"
+ android:layout_height="match_parent"
+ android:layout_marginStart="@dimen/vs_5"
+ android:layout_marginLeft="@dimen/vs_5"
+ android:layout_weight="1"
+ android:background="@drawable/shape_setting_model_focus"
+ android:focusable="true"
+ android:gravity="center_vertical"
+ android:orientation="horizontal"
+ android:paddingLeft="@dimen/vs_20"
+ android:paddingRight="@dimen/vs_20">
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="IJK解码方式"
+ android:textColor="@android:color/white"
+ android:textSize="@dimen/ts_24" />
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1" />
+ android:id="@+id/tvMediaCodec"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="@android:color/white"
+ android:textSize="@dimen/ts_24" />
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/vs_10"
+ android:layout_marginLeft="@dimen/vs_10"
+ android:text=">"
+ android:textColor="@android:color/white"
+ android:textSize="@dimen/ts_30" />
+
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/vs_60"
+ android:layout_marginBottom="@dimen/vs_10"
+ android:focusable="false"
+ android:orientation="horizontal">
+ android:id="@+id/llRender"
+ android:layout_width="@dimen/vs_0"
+ android:layout_height="match_parent"
+ android:layout_marginEnd="@dimen/vs_5"
+ android:layout_marginRight="@dimen/vs_5"
+ android:layout_weight="1"
+ android:background="@drawable/shape_setting_model_focus"
+ android:focusable="true"
+ android:gravity="center_vertical"
+ android:orientation="horizontal"
+ android:paddingLeft="@dimen/vs_20"
+ android:paddingRight="@dimen/vs_20">
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="渲染方式"
+ android:textColor="@android:color/white"
+ android:textSize="@dimen/ts_24" />
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1" />
-
+ android:id="@+id/tvRenderType"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="@android:color/white"
+ android:textSize="@dimen/ts_24" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:id="@+id/llAbout"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/vs_60"
+ android:layout_marginBottom="@dimen/vs_10"
+ android:background="@drawable/shape_setting_model_focus"
+ android:focusable="true"
+ android:gravity="center_vertical"
+ android:orientation="horizontal"
+ android:paddingLeft="@dimen/vs_20"
+ android:paddingRight="@dimen/vs_20">
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="关于"
+ android:textColor="@android:color/white"
+ android:textSize="@dimen/ts_24" />
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1" />
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/vs_10"
+ android:layout_marginLeft="@dimen/vs_10"
+ android:text=">"
+ android:textColor="@android:color/white"
+ android:textSize="@dimen/ts_30" />