Revert "Revert "增加片头片尾时间重置按钮""

This reverts commit ee688ab69c.

# Conflicts:
#	app/src/main/java/com/github/tvbox/osc/player/controller/VodController.java
pull/1/head
于俊 4 years ago
parent 9d5e8186e8
commit 42b3551bab
  1. 36
      .idea/inspectionProfiles/Project_Default.xml
  2. 7
      .idea/misc.xml
  3. 10
      .idea/runConfigurations.xml
  4. 53
      app/src/main/java/com/github/catvod/crawler/JarLoader.java
  5. 4
      app/src/main/java/com/github/tvbox/osc/base/BaseActivity.java
  6. 6
      app/src/main/java/com/github/tvbox/osc/player/controller/VodController.java
  7. 3
      app/src/main/java/com/github/tvbox/osc/ui/activity/DetailActivity.java
  8. 1
      app/src/main/java/com/github/tvbox/osc/ui/dialog/ApiDialog.java
  9. 14
      app/src/main/java/com/github/tvbox/osc/ui/fragment/ModelSettingFragment.java
  10. 4
      app/src/main/java/com/github/tvbox/osc/ui/fragment/PlayFragment.java
  11. 105
      app/src/main/res/layout/fragment_model.xml
  12. 14
      app/src/main/res/layout/player_vod_control_view.xml
  13. 1
      app/src/main/res/values/strings.xml

@ -0,0 +1,36 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
<option name="TOP_LEVEL_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="INNER_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="METHOD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
</value>
</option>
<option name="FIELD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="IGNORE_DEPRECATED" value="false" />
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
<option name="myAdditionalJavadocTags" value="date" />
</inspection_tool>
</profile>
</component>

@ -1,16 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ASMSmaliIdeaPluginConfiguration">
<asm skipDebug="true" skipFrames="true" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/android/repository/TVBoxOSC/app/src/main/res/layout/activity_live_play.xml" value="0.1" />
<entry key="..\:/android/repository/TVBoxOSC/app/src/main/res/layout/item_channel_group_layout.xml" value="0.22826086956521738" />
<entry key="..\:/android/repository/TVBoxOSC/app/src/main/res/layout/item_live_channel_layout.xml" value="0.22826086956521738" />
<entry key="..\:/tvbox/TVBoxOS/app/src/main/res/layout/fragment_model.xml" value="0.1296875" />
</map>
</option>
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
</project>

@ -23,11 +23,9 @@ import okhttp3.Response;
public class JarLoader {
private ConcurrentHashMap<String, DexClassLoader> classLoaders = new ConcurrentHashMap<>();
private ConcurrentHashMap<String, Method> proxyMethods = new ConcurrentHashMap<>();
private ConcurrentHashMap<String, Spider> spiders = new ConcurrentHashMap<>();
/**
* always from main jar.
*/
private Method proxyFun = null;
private volatile String recentJarKey = "";
/**
* 不要在主线程调用我
@ -36,7 +34,8 @@ public class JarLoader {
*/
public boolean load(String cache) {
spiders.clear();
proxyFun = null;
recentJarKey = "main";
proxyMethods.clear();
classLoaders.clear();
return loadClassLoader(cache, "main");
}
@ -61,7 +60,7 @@ public class JarLoader {
try {
Class proxy = classLoader.loadClass("com.github.catvod.spider.Proxy");
Method mth = proxy.getMethod("proxy", Map.class);
proxyFun = mth;
proxyMethods.put(key, mth);
} catch (Throwable th) {
}
@ -83,22 +82,18 @@ public class JarLoader {
return success;
}
private DexClassLoader loadJarInternal(String jar) {
String[] urls = jar.split(";md5;");
String jarUrl = urls[0];
String urlMd5 = MD5.string2MD5(jarUrl);
if (classLoaders.contains(urlMd5))
return classLoaders.get(urlMd5);
String md5 = urls.length > 1 ? urls[1].trim() : "";
File cache = new File(App.getInstance().getFilesDir().getAbsolutePath() + "/" + urlMd5 + ".jar");
private DexClassLoader loadJarInternal(String jar, String md5, String key) {
if (classLoaders.contains(key))
return classLoaders.get(key);
File cache = new File(App.getInstance().getFilesDir().getAbsolutePath() + "/" + key + ".jar");
if (!md5.isEmpty()) {
if (cache.exists() && MD5.getFileMd5(cache).equalsIgnoreCase(md5)) {
loadClassLoader(cache.getAbsolutePath(), urlMd5);
return classLoaders.get(urlMd5);
loadClassLoader(cache.getAbsolutePath(), key);
return classLoaders.get(key);
}
}
try {
Response response = OkGo.<File>get(jarUrl).execute();
Response response = OkGo.<File>get(jar).execute();
InputStream is = response.body().byteStream();
OutputStream os = new FileOutputStream(cache);
try {
@ -115,8 +110,8 @@ public class JarLoader {
e.printStackTrace();
}
}
loadClassLoader(cache.getAbsolutePath(), urlMd5);
return classLoaders.get(urlMd5);
loadClassLoader(cache.getAbsolutePath(), key);
return classLoaders.get(key);
} catch (Throwable e) {
e.printStackTrace();
}
@ -125,19 +120,34 @@ public class JarLoader {
public Spider getSpider(String key, String cls, String ext, String jar) {
String clsKey = cls.replace("csp_", "");
String jarUrl = "";
String jarMd5 = "";
String jarKey = "";
if (jar.isEmpty()) {
jarKey = "main";
} else {
String[] urls = jar.split(";md5;");
jarUrl = urls[0];
jarKey = MD5.string2MD5(jarUrl);
jarMd5 = urls.length > 1 ? urls[1].trim() : "";
}
recentJarKey = jarKey;
if (spiders.containsKey(key))
return spiders.get(key);
DexClassLoader classLoader = null;
if (jar.isEmpty())
if (jarKey.equals("main"))
classLoader = classLoaders.get("main");
else {
classLoader = loadJarInternal(jar);
classLoader = loadJarInternal(jarUrl, jarMd5, jarKey);
}
if (classLoader == null)
return new SpiderNull();
try {
Spider sp = (Spider) classLoader.loadClass("com.github.catvod.spider." + clsKey).newInstance();
sp.init(App.getInstance(), ext);
if (!jar.isEmpty()) {
sp.homeContent(false); // 增加此行 应该可以解决部分写的有问题源的历史记录问题 但会增加这个源的首次加载时间 不需要可以已删掉
}
spiders.put(key, sp);
return sp;
} catch (Throwable th) {
@ -176,6 +186,7 @@ public class JarLoader {
public Object[] proxyInvoke(Map params) {
try {
Method proxyFun = proxyMethods.get(recentJarKey);
if (proxyFun != null) {
return (Object[]) proxyFun.invoke(null, params);
}

@ -205,6 +205,8 @@ public abstract class BaseActivity extends AppCompatActivity implements CustomAd
// 采样率
opts.inSampleSize = scale;
globalWp = new BitmapDrawable(BitmapFactory.decodeFile(wp.getAbsolutePath(), opts));
} else {
globalWp = null;
}
} catch (Throwable throwable) {
throwable.printStackTrace();
@ -215,4 +217,4 @@ public abstract class BaseActivity extends AppCompatActivity implements CustomAd
else
getWindow().setBackgroundDrawableResource(R.drawable.app_bg);
}
}
}

@ -37,6 +37,7 @@ 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);
@ -54,7 +55,6 @@ public class VodController extends BaseController {
}
case 1002: { // 显示底部菜单
mBottomRoot.setVisibility(VISIBLE);
mBottomRoot.requestFocus();
break;
}
case 1003: { // 隐藏底部菜单
@ -284,6 +284,7 @@ public class VodController extends BaseController {
}
}
});
// 增加播放页面片头片尾时间重置
findViewById(R.id.play_time_reset).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@ -304,6 +305,7 @@ public class VodController extends BaseController {
int step = Hawk.get(HawkConfig.PLAY_TIME_STEP, 5);
int st = mPlayerConfig.getInt("st");
st += step;
//片头最大跳过时间10分钟
if (st > 60 * 10)
st = 0;
mPlayerConfig.put("st", st);
@ -321,6 +323,7 @@ public class VodController extends BaseController {
int step = Hawk.get(HawkConfig.PLAY_TIME_STEP, 5);
int et = mPlayerConfig.getInt("et");
et += step;
//片尾最大跳过时间10分钟
if (et > 60 * 10)
et = 0;
mPlayerConfig.put("et", et);
@ -562,7 +565,6 @@ public class VodController extends BaseController {
} else if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
if (!isBottomVisible()) {
showBottom();
return true;
}
}
} else if (action == KeyEvent.ACTION_UP) {

@ -279,8 +279,7 @@ public class DetailActivity extends BaseActivity {
seriesAdapter.getData().get(vodInfo.playIndex).selected = true;
seriesAdapter.notifyItemChanged(vodInfo.playIndex);
jumpToPlay();
if (showPreview && !fullWindows)
toggleFullPreview();
// if (showPreview && !fullWindows) toggleFullPreview();
}
}
});

@ -55,6 +55,7 @@ public class ApiDialog extends BaseDialog {
ivQRCode = findViewById(R.id.ivQRCode);
tvAddress = findViewById(R.id.tvAddress);
inputApi = findViewById(R.id.input);
//内置网络接口在此处添加
inputApi.setText(Hawk.get(HawkConfig.API_URL, ""));
findViewById(R.id.inputSubmit).setOnClickListener(new View.OnClickListener() {
@Override

@ -44,7 +44,7 @@ import tv.danmaku.ijk.media.player.IjkMediaPlayer;
/**
* @author pj567
* @date :2020/12/23
* @description: 设置页面
* @description:
*/
public class ModelSettingFragment extends BaseLazyFragment {
private TextView tvDebugOpen;
@ -162,6 +162,16 @@ public class ModelSettingFragment extends BaseLazyFragment {
});
}
});
findViewById(R.id.llWpRecovery).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FastClickCheckUtil.check(v);
File wp = new File(requireActivity().getFilesDir().getAbsolutePath() + "/wp");
if (wp.exists())
wp.delete();
((BaseActivity) requireActivity()).changeWallpaper(true);
}
});
findViewById(R.id.llHomeApi).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -513,4 +523,4 @@ public class ModelSettingFragment extends BaseLazyFragment {
return "缩略图";
}
}
}
}

@ -350,10 +350,10 @@ public class PlayFragment extends BaseLazyFragment {
mVodPlayerCfg.put("sp", 1.0f);
}
if (!mVodPlayerCfg.has("st")) {
mVodPlayerCfg.put("st", 60);
mVodPlayerCfg.put("st", 0);
}
if (!mVodPlayerCfg.has("et")) {
mVodPlayerCfg.put("et", 60);
mVodPlayerCfg.put("et", 0);
}
} catch (Throwable th) {

@ -574,40 +574,87 @@
android:textSize="@dimen/ts_30" />
</LinearLayout>
<LinearLayout
android:id="@+id/llWp"
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">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="换张壁纸"
android:textColor="@android:color/white"
android:textSize="@dimen/ts_24" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
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:focusable="false"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/llWp"
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">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="换张壁纸"
android:textColor="@android:color/white"
android:textSize="@dimen/ts_24" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
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" />
</LinearLayout>
<LinearLayout
android:id="@+id/llWpRecovery"
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">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="重置壁纸"
android:textColor="@android:color/white"
android:textSize="@dimen/ts_24" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
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" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
@ -647,4 +694,4 @@
</LinearLayout>
</ScrollView>
</FrameLayout>
</FrameLayout>

@ -175,7 +175,19 @@
android:text="1S"
android:textColor="@android:color/white"
android:textSize="@dimen/ts_24" />
<!--添加片头片尾重置按钮-->
<TextView
android:id="@+id/play_time_reset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/vs_5"
android:layout_marginRight="@dimen/vs_5"
android:background="@drawable/button_dialog_main"
android:focusable="true"
android:padding="@dimen/vs_10"
android:text="↺"
android:textColor="@android:color/white"
android:textSize="@dimen/ts_24" />
</LinearLayout>

@ -1,3 +1,4 @@
<resources>
<!-- app名称 -->
<string name="app_name">TVBox</string>
</resources>
Loading…
Cancel
Save