优化采集 配置加载时自动添加http协议 尝试优化解析失败重试逻辑 优化倒叙选集问题

pull/11/head
于俊 4 years ago
parent f4cf57d5be
commit 832b58d192
  1. 9
      .idea/misc.xml
  2. 12
      app/src/main/AndroidManifest.xml
  3. 2
      app/src/main/java/com/github/tvbox/osc/api/ApiConfig.java
  4. 42
      app/src/main/java/com/github/tvbox/osc/ui/activity/DetailActivity.java
  5. 2
      app/src/main/java/com/github/tvbox/osc/ui/activity/HomeActivity.java
  6. 8
      app/src/main/java/com/github/tvbox/osc/ui/activity/PlayActivity.java
  7. 8
      app/src/main/java/com/github/tvbox/osc/ui/fragment/PlayFragment.java
  8. 15
      app/src/main/java/com/github/tvbox/osc/viewmodel/SourceViewModel.java
  9. 52
      app/src/main/res/layout/fragment_model.xml

@ -7,12 +7,13 @@
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/Users/21561/Desktop/TVBOX/TVBoxOS/app/src/main/res/layout/activity_detail.xml" value="0.16893115942028986" />
<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/layout/activity_detail.xml" value="0.16893115942028986" />
<entry key="..\:/tvbox/TVBoxOS/app/src/main/layout/activity_live_play.xml" value="0.1" />
<entry key="..\:/tvbox/TVBoxOS/app/src/main/res/layout/item_channel_group_layout.xml" value="0.22826086956521738" />
<entry key="..\:/tvbox/TVBoxOS/app/src/main/res/layout/item_live_channel_layout.xml" value="0.22826086956521738" />
<entry key="..\:/tvbox/TVBoxOS/app/src/main/res/drawable/box_controller_top_bg.xml" value="0.2455" />
<entry key="..\:/tvbox/TVBoxOS/app/src/main/res/layout/activity_detail.xml" value="0.3619791666666667" />
<entry key="..\:/tvbox/TVBoxOS/app/src/main/res/layout/activity_setting.xml" value="0.3619791666666667" />
<entry key="..\:/tvbox/TVBoxOS/app/src/main/res/layout/fragment_model.xml" value="0.33" />
<entry key="..\:/tvbox/TVBoxOS/app/src/main/res/layout/player_vod_control_view.xml" value="0.3619791666666667" />
</map>

@ -41,25 +41,25 @@
android:screenOrientation="sensorLandscape" />
<activity
android:name=".ui.activity.DetailActivity"
android:screenOrientation="sensorLandscape" />
android:screenOrientation="landscape" />
<activity
android:name=".ui.activity.PlayActivity"
android:screenOrientation="sensorLandscape" />
<activity
android:name=".ui.activity.PushActivity"
android:screenOrientation="sensorLandscape" />
android:screenOrientation="landscape" />
<activity
android:name=".ui.activity.SearchActivity"
android:screenOrientation="sensorLandscape" />
android:screenOrientation="landscape" />
<activity
android:name=".ui.activity.SettingActivity"
android:screenOrientation="sensorLandscape" />
android:screenOrientation="landscape" />
<activity
android:name=".ui.activity.HistoryActivity"
android:screenOrientation="sensorLandscape" />
android:screenOrientation="landscape" />
<activity
android:name=".ui.activity.CollectActivity"
android:screenOrientation="sensorLandscape" />
android:screenOrientation="landscape" />
<receiver android:name=".receiver.SearchReceiver">
<intent-filter>

@ -98,6 +98,8 @@ public class ApiConfig {
String apiFix = apiUrl;
if (apiUrl.startsWith("clan://")) {
apiFix = clanToAddress(apiUrl);
}else if(!apiUrl.startsWith("http")){
apiFix = "http://" + apiFix;
}
OkGo.<String>get(apiFix)
.execute(new AbsCallback<String>() {

@ -5,7 +5,6 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Handler;
import android.text.Html;
import android.text.TextUtils;
import android.view.KeyEvent;
@ -66,7 +65,6 @@ import java.io.ObjectOutputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -111,6 +109,7 @@ public class DetailActivity extends BaseActivity {
boolean seriesSelect = false;
private View seriesFlagFocus = null;
private boolean isReverse;
private String preFlag="";
@Override
protected int getLayoutResID() {
@ -175,11 +174,10 @@ public class DetailActivity extends BaseActivity {
// vodInfo.seriesMap.get(vodInfo.playFlag).get(vodInfo.playIndex).selected = false;
// }
vodInfo.reverse();
// if (vodInfo.seriesMap.get(preFlag).size() > vodInfo.playIndex) {
// vodInfo.seriesMap.get(preFlag).get(vodInfo.playIndex).selected = false;
// if (vodInfo.seriesMap.get(vodInfo.playFlag).size() > vodInfo.playIndex) {
// vodInfo.seriesMap.get(vodInfo.playFlag).get(vodInfo.playIndex).selected = false;
// }
preFlag = "";
insertVod(sourceKey, vodInfo);
// insertVod(sourceKey, vodInfo);
seriesAdapter.notifyDataSetChanged();
}
}
@ -317,6 +315,11 @@ public class DetailActivity extends BaseActivity {
reload = true;
}
//解决倒叙不刷新
if (isReverse) {
reload = true;
}
seriesAdapter.getData().get(vodInfo.playIndex).selected = true;
seriesAdapter.notifyItemChanged(vodInfo.playIndex);
//选集全屏 想选集不全屏的注释下面一行
@ -330,7 +333,6 @@ public class DetailActivity extends BaseActivity {
private List<Runnable> pauseRunnable = null;
private String preFlag="";
private void jumpToPlay() {
if (vodInfo != null && vodInfo.seriesMap.get(vodInfo.playFlag).size() > 0) {
preFlag = vodInfo.playFlag;
@ -755,9 +757,6 @@ public class DetailActivity extends BaseActivity {
boolean fullWindows = false;
ViewGroup.LayoutParams windowsPreview = null;
ViewGroup.LayoutParams windowsFull = null;
// ViewGroup playerParent = null;
// View playerRoot = null;
// ViewGroup llLayoutParent = null;
void toggleFullPreview() {
if (windowsPreview == null) {
@ -767,25 +766,12 @@ public class DetailActivity extends BaseActivity {
windowsFull = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
}
fullWindows = !fullWindows;
// if (playerRoot == null)
// playerRoot = (View) llPlayerFragmentContainer.findViewById(R.id.mVideoView).getParent();
//
// if (playerParent == null) {
// playerParent = (ViewGroup) playerRoot.getParent();
// }
// if (llLayoutParent == null)
// llLayoutParent = (ViewGroup) llLayout.getParent();
// if (fullWindows) {
// playerParent.removeView(playerRoot);
// ((ViewGroup) getWindow().getDecorView()).addView(playerRoot);
// llLayoutParent.removeView(llLayout);
// } else {
// ((ViewGroup) getWindow().getDecorView()).removeView(playerRoot);
// playerParent.addView(playerRoot);
// llLayoutParent.addView(llLayout);
// }
llPlayerFragmentContainer.setLayoutParams(fullWindows ? windowsFull : windowsPreview);
llPlayerFragmentContainerBlock.setVisibility(fullWindows ? View.GONE : View.VISIBLE);
tvPlay.setFocusable(!fullWindows);
tvSort.setFocusable(!fullWindows);
tvCollect.setFocusable(!fullWindows);
tvQuickSearch.setFocusable(!fullWindows);
}
}

@ -216,7 +216,7 @@ public class HomeActivity extends BaseActivity {
if (home != null && home.getName() != null && !home.getName().isEmpty())
tvName.setText(home.getName());
if (dataInitOk && jarInitOk) {
showLoading();
// showLoading();
sourceViewModel.getSort(ApiConfig.get().getHomeSourceBean().getKey());
if (hasPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
LOG.e("有");

@ -310,7 +310,7 @@ public class PlayActivity extends BaseActivity {
playUrl(playUrl + url, headers);
}
} catch (Throwable th) {
errorWithRetry("获取播放信息错误", true);
// errorWithRetry("获取播放信息错误", true);
}
} else {
errorWithRetry("获取播放信息错误", true);
@ -449,9 +449,9 @@ public class PlayActivity extends BaseActivity {
private int autoRetryCount = 0;
boolean autoRetry() {
if (autoRetryCount < 3) {
autoRetryCount++;
if (autoRetryCount < 2) {
play(false);
autoRetryCount++;
return true;
} else {
autoRetryCount = 0;
@ -643,7 +643,7 @@ public class PlayActivity extends BaseActivity {
playUrl(rs.getString("url"), headers);
} catch (Throwable e) {
e.printStackTrace();
errorWithRetry("解析错误", false);
// errorWithRetry("解析错误", false);
}
}

@ -308,7 +308,7 @@ public class PlayFragment extends BaseLazyFragment {
playUrl(playUrl + url, headers);
}
} catch (Throwable th) {
errorWithRetry("获取播放信息错误", true);
// errorWithRetry("获取播放信息错误", true);
}
} else {
errorWithRetry("获取播放信息错误", true);
@ -461,9 +461,9 @@ public class PlayFragment extends BaseLazyFragment {
private int autoRetryCount = 0;
boolean autoRetry() {
if (autoRetryCount < 3) {
autoRetryCount++;
if (autoRetryCount < 2) {
play(false);
autoRetryCount++;
return true;
} else {
autoRetryCount = 0;
@ -656,7 +656,7 @@ public class PlayFragment extends BaseLazyFragment {
playUrl(rs.getString("url"), headers);
} catch (Throwable e) {
e.printStackTrace();
errorWithRetry("解析错误", false);
// errorWithRetry("解析错误", false);
}
}

@ -808,9 +808,9 @@ public class SourceViewModel extends ViewModel {
for (String s : str) {
String[] ss = s.split("\\$");
if (ss.length > 0) {
if (ss.length == 2) {
if (ss.length >= 2) {
infoBeanList.add(new Movie.Video.UrlBean.UrlInfo.InfoBean(ss[0], ss[1]));
} else if (ss.length == 1) {
} else {
infoBeanList.add(new Movie.Video.UrlBean.UrlInfo.InfoBean((infoBeanList.size() + 1) + "", ss[0]));
}
}
@ -850,8 +850,15 @@ public class SourceViewModel extends ViewModel {
for (String s : str) {
if (s.contains("$")) {
String[] ss = s.split("\\$");
if (ss.length >= 2) {
infoBeanList.add(new Movie.Video.UrlBean.UrlInfo.InfoBean(ss[0], ss[1]));
// if (ss.length >= 2) {
// infoBeanList.add(new Movie.Video.UrlBean.UrlInfo.InfoBean(ss[0], ss[1]));
// }
if (ss.length > 0) {
if (ss.length >= 2) {
infoBeanList.add(new Movie.Video.UrlBean.UrlInfo.InfoBean(ss[0], ss[1]));
} else {
infoBeanList.add(new Movie.Video.UrlBean.UrlInfo.InfoBean((infoBeanList.size() + 1) + "", ss[0]));
}
}
}
}

@ -551,11 +551,11 @@
android:orientation="horizontal">
<LinearLayout
android:id="@+id/llWp"
android:id="@+id/llScale"
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_marginStart="@dimen/vs_5"
android:layout_marginLeft="@dimen/vs_5"
android:layout_weight="1"
android:background="@drawable/shape_setting_model_focus"
android:focusable="true"
@ -567,7 +567,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="换张壁纸"
android:text="画面缩放"
android:textColor="@android:color/white"
android:textSize="@dimen/ts_24" />
@ -576,6 +576,13 @@
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/tvScaleType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:textSize="@dimen/ts_24" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -587,7 +594,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/llWpRecovery"
android:id="@+id/showPreview"
android:layout_width="@dimen/vs_0"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/vs_5"
@ -603,7 +610,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="重置壁纸"
android:text="窗口预览"
android:textColor="@android:color/white"
android:textSize="@dimen/ts_24" />
@ -612,6 +619,13 @@
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/showPreviewText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:textSize="@dimen/ts_24" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -633,11 +647,11 @@
android:orientation="horizontal">
<LinearLayout
android:id="@+id/llScale"
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_marginEnd="@dimen/vs_5"
android:layout_marginRight="@dimen/vs_5"
android:layout_weight="1"
android:background="@drawable/shape_setting_model_focus"
android:focusable="true"
@ -649,7 +663,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="画面缩放"
android:text="换张壁纸"
android:textColor="@android:color/white"
android:textSize="@dimen/ts_24" />
@ -658,13 +672,6 @@
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/tvScaleType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:textSize="@dimen/ts_24" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -676,7 +683,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/showPreview"
android:id="@+id/llWpRecovery"
android:layout_width="@dimen/vs_0"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/vs_5"
@ -692,7 +699,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="窗口预览"
android:text="重置壁纸"
android:textColor="@android:color/white"
android:textSize="@dimen/ts_24" />
@ -701,13 +708,6 @@
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/showPreviewText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:textSize="@dimen/ts_24" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"

Loading…
Cancel
Save