Merge branch 'dev' into release

pull/295/head
okjack 2 years ago
commit bebfee7cc5
  1. 4
      app/build.gradle
  2. 4
      app/src/leanback/java/com/fongmi/android/tv/bean/Func.java
  3. 5
      app/src/leanback/java/com/fongmi/android/tv/ui/dialog/ConfigDialog.java
  4. 6
      app/src/leanback/res/layout/dialog_config.xml
  5. 10
      app/src/main/assets/css/style.css
  6. 41
      app/src/main/assets/index.html
  7. 8
      app/src/main/assets/js/script.js
  8. 14
      app/src/main/java/com/fongmi/android/tv/event/ServerEvent.java
  9. 7
      app/src/main/java/com/fongmi/android/tv/player/extractor/JianPian.java
  10. 3
      app/src/main/java/com/fongmi/android/tv/server/process/Action.java
  11. 29
      app/src/main/java/com/fongmi/android/tv/utils/ViewUtil.java

@ -10,8 +10,8 @@ android {
applicationId "com.fongmi.android.tv"
minSdk 21
targetSdk 28
versionCode 225
versionName "0217"
versionCode 227
versionName "2.2.7"
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]

@ -1,10 +1,10 @@
package com.fongmi.android.tv.bean;
import android.annotation.SuppressLint;
import android.view.View;
import com.fongmi.android.tv.R;
import com.fongmi.android.tv.utils.ResUtil;
import com.fongmi.android.tv.utils.ViewUtil;
public class Func {
@ -20,7 +20,7 @@ public class Func {
public Func(int resId) {
this.resId = resId;
this.id = View.generateViewId();
this.id = ViewUtil.generateViewId();
this.setDrawable();
}

@ -139,10 +139,12 @@ public class ConfigDialog implements DialogInterface.OnDismissListener {
}
private void onPositive(View view) {
String name = binding.name.getText().toString().trim();
String text = binding.text.getText().toString().trim();
if (edit) Config.find(url, type).url(text).update();
if (text.isEmpty()) Config.delete(url, type);
callback.setConfig(Config.find(text, type));
if (name.isEmpty()) callback.setConfig(Config.find(text, type));
else callback.setConfig(Config.find(text, name, type));
dialog.dismiss();
}
@ -153,6 +155,7 @@ public class ConfigDialog implements DialogInterface.OnDismissListener {
@Subscribe(threadMode = ThreadMode.MAIN)
public void onServerEvent(ServerEvent event) {
if (event.getType() != ServerEvent.Type.SETTING) return;
binding.name.setText(event.getName());
binding.text.setText(event.getText());
binding.text.setSelection(binding.text.getText().length());
}

@ -27,6 +27,12 @@
android:textSize="18sp"
tools:text="@string/push_info" />
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
<EditText
android:id="@+id/text"
android:layout_width="match_parent"

@ -1156,8 +1156,6 @@ input.weui-btn_mini {
.weui-cells:before {
top: 0;
border-top: 1px solid rgba(0, 0, 0, 0.1);
border-top: 1px solid var(--weui-FG-3);
-webkit-transform-origin: 0 0;
transform-origin: 0 0;
-webkit-transform: scaleY(0.5);
@ -1178,8 +1176,6 @@ input.weui-btn_mini {
.weui-cells:after {
bottom: 0;
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
border-bottom: 1px solid var(--weui-FG-3);
-webkit-transform-origin: 0 100%;
transform-origin: 0 100%;
-webkit-transform: scaleY(0.5);
@ -1243,8 +1239,6 @@ input.weui-btn_mini {
top: 0;
right: 0;
height: 1px;
border-top: 1px solid rgba(0, 0, 0, 0.1);
border-top: 1px solid var(--weui-FG-3);
color: rgba(0, 0, 0, 0.1);
color: var(--weui-FG-3);
-webkit-transform-origin: 0 0;
@ -3296,9 +3290,11 @@ page {
.weui-tabbar__item.weui-bar__item_on .weui-tabbar__label {
color: #07c160;
color: var(--weui-BRAND);
svg {
fill: #07c160;
}
svg {
fill: var(--weui-BRAND);
}
@ -3307,9 +3303,11 @@ page {
.weui-tabbar__icon {
display: inline-block;
margin-bottom: 6px;
svg {
fill: rgba(0, 0, 0, 0.9);
}
svg {
fill: var(--weui-FG-0);
}

@ -28,10 +28,12 @@
<div class="weui-cell weui-cell_active weui-cell_vcode weui-cell_wrap">
<div class="weui-cell__bd weui-flex">
<input id="keyword" class="weui-input weui-cell__control weui-cell__control_flex" type="text" value="" placeholder="請輸入關鍵字..." />
<button onclick="search(); return false;" class="weui-cell__control weui-btn weui-btn_default weui-vcode-btn">確定</button>
</div>
</div>
</div>
<div style="text-align: center;margin-top: 16px;">
<button onclick="search(); return false;" class="weui-cell__control weui-btn weui-btn_default weui-vcode-btn">確定</button>
</div>
</div>
</div>
</div>
@ -47,10 +49,12 @@
<div class="weui-cell weui-cell_active weui-cell_vcode weui-cell_wrap">
<div class="weui-cell__bd weui-flex">
<input id="push_url" class="weui-input weui-cell__control weui-cell__control_flex" type="text" value="" placeholder="請輸入播放網址..." />
<button onclick="push(); return false;" class="weui-cell__control weui-btn weui-btn_default weui-vcode-btn">確定</button>
</div>
</div>
</div>
<div style="text-align: center;margin-top: 16px;">
<button onclick="push(); return false;" class="weui-cell__control weui-btn weui-btn_default weui-vcode-btn">確定</button>
</div>
</div>
</div>
</div>
@ -60,16 +64,19 @@
<div class="weui-form__text-area">
<h2 class="weui-form__title">接口/Proxy/User-Agent</h2>
</div>
<div class="weui-form__control-area" style="margin-bottom: 0px !important;">
<div class="weui-form__control-area">
<div class="weui-cells__group weui-cells__group_form">
<div class="weui-cells">
<div class="weui-cell weui-cell_active weui-cell_vcode weui-cell_wrap">
<div class="weui-cell__bd weui-flex">
<input id="setting_text" class="weui-input weui-cell__control weui-cell__control_flex" type="text" value="" placeholder="請輸入..." />
<button onclick="setting(); return false;" class="weui-cell__control weui-btn weui-btn_default weui-vcode-btn">確定</button>
<input id="setting_name" class="weui-input weui-cell__control" type="text" value="" placeholder="請輸入名稱" />
<input id="setting_text" class="weui-input weui-cell__control weui-cell__control_flex" type="text" value="" placeholder="請輸入接口/Proxy/User-Agent..." />
</div>
</div>
</div>
<div style="text-align: center;margin-top: 16px;">
<button onclick="setting(); return false;" class="weui-cell__control weui-btn weui-btn_default weui-vcode-btn">確定</button>
</div>
</div>
</div>
</div>
@ -80,8 +87,8 @@
<h2 class="weui-form__title">本地</h2>
</div>
<input type="file" id="file_uploader" style="display:none;" onchange="uploadTip()" multiple />
<div class="weui-form__control-area" style="text-align: center;margin-bottom: 10px !important;">
<div class="button-sp-area" style="margin-top: 10px;">
<div class="weui-form__control-area" style="text-align: center;margin-bottom: 8px !important;">
<div class="button-sp-area">
<a href="javascript:void(0)" role="button" class="weui-btn weui-btn_mini weui-btn_default weui-wa-hotarea" href="javascript:void(0)" onclick="uploadFile()">上傳檔案</a>&nbsp;
<a href="javascript:void(0)" role="button" class="weui-btn weui-btn_mini weui-btn_default weui-wa-hotarea" href="javascript:void(0)" onclick="newFolder()">新增資料夾</a>&nbsp;
<a id="delCurFolder" href="javascript:void(0)" role="button" class="weui-btn weui-btn_mini weui-btn_warn weui-wa-hotarea" href="javascript:void(0)" onclick="delFolder()" style="display: none;">刪除資料夾</a>
@ -94,25 +101,37 @@
<div role="tablist" class="weui-tabbar">
<div id="tab1" role="tab" aria-labelledby="t1_title" aria-selected="true" aria-controls="panel1" class="weui-tabbar__item weui-bar__item_on">
<div class="weui-tabbar__icon">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000">
<path d="M0 0h24v24H0V0z" fill="none" />
<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" />
</svg>
</div>
<p id="t1_title" aria-hidden="true" class="weui-tabbar__label">搜尋</p>
</div>
<div id="tab2" role="tab" aria-labelledby="t2_title" aria-selected="false" aria-controls="panel2" class="weui-tabbar__item">
<div class="weui-tabbar__icon">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95C8.08 7.14 9.94 6 12 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11c1.56.1 2.78 1.41 2.78 2.96 0 1.65-1.35 3-3 3zM8 13h2.55v3h2.9v-3H16l-4-4z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000">
<path d="M0 0h24v24H0V0z" fill="none" />
<path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95C8.08 7.14 9.94 6 12 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11c1.56.1 2.78 1.41 2.78 2.96 0 1.65-1.35 3-3 3zM8 13h2.55v3h2.9v-3H16l-4-4z" />
</svg>
</div>
<p id="t2_title" aria-hidden="true" class="weui-tabbar__label">推送</p>
</div>
<div id="tab3" role="tab" aria-labelledby="t3_title" aria-selected="false" aria-controls="panel3" class="weui-tabbar__item">
<div class="weui-tabbar__icon">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M19.43 12.98c.04-.32.07-.64.07-.98 0-.34-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.09-.16-.26-.25-.44-.25-.06 0-.12.01-.17.03l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.06-.02-.12-.03-.18-.03-.17 0-.34.09-.43.25l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98 0 .33.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.09.16.26.25.44.25.06 0 .12-.01.17-.03l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.06.02.12.03.18.03.17 0 .34-.09.43-.25l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zm-1.98-1.71c.04.31.05.52.05.73 0 .21-.02.43-.05.73l-.14 1.13.89.7 1.08.84-.7 1.21-1.27-.51-1.04-.42-.9.68c-.43.32-.84.56-1.25.73l-1.06.43-.16 1.13-.2 1.35h-1.4l-.19-1.35-.16-1.13-1.06-.43c-.43-.18-.83-.41-1.23-.71l-.91-.7-1.06.43-1.27.51-.7-1.21 1.08-.84.89-.7-.14-1.13c-.03-.31-.05-.54-.05-.74s.02-.43.05-.73l.14-1.13-.89-.7-1.08-.84.7-1.21 1.27.51 1.04.42.9-.68c.43-.32.84-.56 1.25-.73l1.06-.43.16-1.13.2-1.35h1.39l.19 1.35.16 1.13 1.06.43c.43.18.83.41 1.23.71l.91.7 1.06-.43 1.27-.51.7 1.21-1.07.85-.89.7.14 1.13zM12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000">
<path d="M0 0h24v24H0V0z" fill="none" />
<path d="M19.43 12.98c.04-.32.07-.64.07-.98 0-.34-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.09-.16-.26-.25-.44-.25-.06 0-.12.01-.17.03l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.06-.02-.12-.03-.18-.03-.17 0-.34.09-.43.25l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98 0 .33.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.09.16.26.25.44.25.06 0 .12-.01.17-.03l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.06.02.12.03.18.03.17 0 .34-.09.43-.25l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zm-1.98-1.71c.04.31.05.52.05.73 0 .21-.02.43-.05.73l-.14 1.13.89.7 1.08.84-.7 1.21-1.27-.51-1.04-.42-.9.68c-.43.32-.84.56-1.25.73l-1.06.43-.16 1.13-.2 1.35h-1.4l-.19-1.35-.16-1.13-1.06-.43c-.43-.18-.83-.41-1.23-.71l-.91-.7-1.06.43-1.27.51-.7-1.21 1.08-.84.89-.7-.14-1.13c-.03-.31-.05-.54-.05-.74s.02-.43.05-.73l.14-1.13-.89-.7-1.08-.84.7-1.21 1.27.51 1.04.42.9-.68c.43-.32.84-.56 1.25-.73l1.06-.43.16-1.13.2-1.35h1.39l.19 1.35.16 1.13 1.06.43c.43.18.83.41 1.23.71l.91.7 1.06-.43 1.27-.51.7 1.21-1.07.85-.89.7.14 1.13zM12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z" />
</svg>
</div>
<p id="t3_title" aria-hidden="true" class="weui-tabbar__label">設定</p>
</div>
<div id="tab4" role="tab" aria-labelledby="t4_title" aria-selected="false" aria-controls="panel4" class="weui-tabbar__item">
<div class="weui-tabbar__icon">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M9.17 6l2 2H20v10H4V6h5.17M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000">
<path d="M0 0h24v24H0V0z" fill="none" />
<path d="M9.17 6l2 2H20v10H4V6h5.17M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z" />
</svg>
</div>
<p id="t4_title" aria-hidden="true" class="weui-tabbar__label">本地</p>
</div>

@ -13,7 +13,7 @@ function push() {
}
function setting() {
doAction('setting', { text: $('#setting_text').val() });
doAction('setting', { text: $('#setting_text').val(), name: $('#setting_name').val() });
}
function file(path) {
@ -29,7 +29,7 @@ function doAction(action, kv) {
}
function tpl_top(path) {
return `<a class="weui-cell weui-cell_access" href="javascript:void(0)" onclick="listFile('` + path + `')">
return `<a class="weui-cell weui-cell_access" href="javascript:void(0)" onclick="listFile('` + path + `')">
<div class="weui-cell__hd"><img src="` + ic_dir + `" alt="" style="width: 32px; margin-right: 16px; display: block;"></div>
<span class="weui-cell__bd">
<span class="weui-cell__name">..</span>
@ -40,7 +40,7 @@ function tpl_top(path) {
}
function tpl_dir(name, time, path) {
return `<a class="weui-cell weui-cell_access" href="#" onclick="listFile('` + path + `')">
return `<a class="weui-cell weui-cell_access" href="#" onclick="listFile('` + path + `')">
<div class="weui-cell__hd"><img src="` + ic_dir + `" alt="" style="width: 32px; margin-right: 16px; display: block;"></div>
<span class="weui-cell__bd">
<span class="weui-cell__name">` + name + `</span>
@ -52,7 +52,7 @@ function tpl_dir(name, time, path) {
}
function tpl_file(name, time, path, canDel) {
return `<a class="weui-cell weui-cell_access" href="javascript:void(0)" onclick="selectFile('` + path + `', ` + canDel + `)">
return `<a class="weui-cell weui-cell_access" href="javascript:void(0)" onclick="selectFile('` + path + `', ` + canDel + `)">
<div class="weui-cell__hd"><img src="` + ic_file + `" alt="" style="width: 32px; margin-right: 16px; display: block;"></div>
<span class="weui-cell__bd">
<span class="weui-cell__name">` + name + `</span>

@ -6,6 +6,7 @@ public class ServerEvent {
private final Type type;
private final String text;
private final String name;
public static void search(String text) {
EventBus.getDefault().post(new ServerEvent(Type.SEARCH, text));
@ -19,9 +20,18 @@ public class ServerEvent {
EventBus.getDefault().post(new ServerEvent(Type.SETTING, text));
}
public static void setting(String text, String name) {
EventBus.getDefault().post(new ServerEvent(Type.SETTING, text, name));
}
private ServerEvent(Type type, String text) {
this(type, text, "");
}
private ServerEvent(Type type, String text, String name) {
this.type = type;
this.text = text;
this.name = name;
}
public Type getType() {
@ -32,6 +42,10 @@ public class ServerEvent {
return text;
}
public String getName() {
return name;
}
public enum Type {
SEARCH, PUSH, SETTING
}

@ -3,7 +3,6 @@ package com.fongmi.android.tv.player.extractor;
import android.net.Uri;
import com.fongmi.android.tv.player.Source;
import com.github.catvod.utils.Path;
import com.p2p.P2PClass;
import java.net.URLDecoder;
@ -33,11 +32,12 @@ public class JianPian implements Source.Extractor {
private void start(String url) {
try {
if (path != null) p2p.P2Pdoxdel(path.getBytes("GBK"));
String lastPath = path;
path = URLDecoder.decode(url).split("\\|")[0];
path = path.replace("jianpian://pathtype=url&path=", "");
path = path.replace("tvbox-xg://", "").replace("tvbox-xg:", "");
path = path.replace("xg://", "ftp://").replace("xgplay://", "ftp://");
if (lastPath != null && !lastPath.equals(path)) p2p.P2Pdoxdel(lastPath.getBytes("GBK"));
p2p.P2Pdoxstart(path.getBytes("GBK"));
p2p.P2Pdoxadd(path.getBytes("GBK"));
} catch (Exception e) {
@ -58,11 +58,8 @@ public class JianPian implements Source.Extractor {
public void exit() {
try {
if (p2p != null && path != null) p2p.P2Pdoxpause(path.getBytes("GBK"));
if (p2p != null && path != null) p2p.P2Pdoxdel(path.getBytes("GBK"));
if (p2p != null) p2p.P2Pdoxendhttpd();
} catch (Exception e) {
e.printStackTrace();
}
Path.clear(Path.jpa());
}
}

@ -77,8 +77,9 @@ public class Action implements Process {
private void onSetting(Map<String, String> params) {
String text = params.get("text");
String name = params.get("name");
if (TextUtils.isEmpty(text)) return;
ServerEvent.setting(text);
ServerEvent.setting(text, name);
}
private void onFile(Map<String, String> params) {

@ -0,0 +1,29 @@
package com.fongmi.android.tv.utils;
import android.os.Build;
import android.view.View;
import java.util.concurrent.atomic.AtomicInteger;
public class ViewUtil {
private static final AtomicInteger viewIdGenerator = new AtomicInteger(1);
public static int generateViewId() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) return View.generateViewId();
else return generateUniqueViewId();
}
private static int generateUniqueViewId() {
while (true) {
final int result = viewIdGenerator.get();
// aapt-generated IDs have the high byte nonzero; clamp to the range under that.
int newValue = result + 1;
if (newValue > 0x00FFFFFF) newValue = 1; // Roll over to 1, not 0.
if (viewIdGenerator.compareAndSet(result, newValue)) {
return result;
}
}
}
}
Loading…
Cancel
Save