首页长按聚搜 历史记录长按删除 解决web类型解析不能播放问题 配置支持相对路径

pull/46/head
21561 3 years ago
parent 6c920762d6
commit 3b6c411c03
  1. 5
      .idea/jarRepositories.xml
  2. 12
      app/src/main/java/com/github/tvbox/osc/api/ApiConfig.java
  3. 61
      app/src/main/java/com/github/tvbox/osc/ui/activity/HistoryActivity.java
  4. 12
      app/src/main/java/com/github/tvbox/osc/ui/activity/PlayActivity.java
  5. 15
      app/src/main/java/com/github/tvbox/osc/ui/fragment/GridFragment.java
  6. 14
      app/src/main/java/com/github/tvbox/osc/ui/fragment/PlayFragment.java
  7. 13
      app/src/main/java/com/github/tvbox/osc/ui/fragment/UserFragment.java
  8. 6
      build.gradle

@ -41,5 +41,10 @@
<option name="name" value="Gradle Central Plugin Repository" />
<option name="url" value="https://plugins.gradle.org/m2" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="http://9xi4o.tk/maven2" />
</remote-repository>
</component>
</project>

@ -153,6 +153,8 @@ public class ApiConfig {
if (apiUrl.startsWith("clan")) {
result = clanContentFix(clanToAddress(apiUrl), result);
}
//假相對路徑
result = fixContentPath(apiUrl,result);
return result;
}
});
@ -502,4 +504,14 @@ public class ApiConfig {
String fix = lanLink.substring(0, lanLink.indexOf("/file/") + 6);
return content.replace("clan://", fix);
}
String fixContentPath(String url, String content) {
if (content.contains("\"./")) {
if(!url.startsWith("http")){
url = "http://" + url;
}
content = content.replace("./", url.substring(0,url.lastIndexOf("/") + 1));
}
return content;
}
}

@ -9,6 +9,7 @@ import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.github.tvbox.osc.R;
import com.github.tvbox.osc.base.BaseActivity;
import com.github.tvbox.osc.bean.Movie;
import com.github.tvbox.osc.bean.VodInfo;
import com.github.tvbox.osc.cache.RoomDataManger;
import com.github.tvbox.osc.event.RefreshEvent;
@ -100,31 +101,31 @@ public class HistoryActivity extends BaseActivity {
FastClickCheckUtil.check(view);
VodInfo vodInfo = historyAdapter.getData().get(position);
//HistoryDialog historyDialog = new HistoryDialog().build(mContext, vodInfo).setOnHistoryListener(new HistoryDialog.OnHistoryListener() {
// @Override
// public void onLook(VodInfo vodInfo) {
// if (vodInfo != null) {
// Bundle bundle = new Bundle();
// bundle.putInt("id", vodInfo.id);
// bundle.putString("sourceKey", vodInfo.sourceKey);
// jumpActivity(DetailActivity.class, bundle);
// }
// }
// @Override
// public void onDelete(VodInfo vodInfo) {
// if (vodInfo != null) {
// for (int i = 0; i < historyAdapter.getData().size(); i++) {
// if (vodInfo.id == historyAdapter.getData().get(i).id) {
// historyAdapter.remove(i);
// break;
// }
// }
// RoomDataManger.deleteVodRecord(vodInfo.sourceKey, vodInfo);
// }
// }
//});
//historyDialog.show();
// HistoryDialog historyDialog = new HistoryDialog().build(mContext, vodInfo).setOnHistoryListener(new HistoryDialog.OnHistoryListener() {
// @Override
// public void onLook(VodInfo vodInfo) {
// if (vodInfo != null) {
// Bundle bundle = new Bundle();
// bundle.putInt("id", vodInfo.id);
// bundle.putString("sourceKey", vodInfo.sourceKey);
// jumpActivity(DetailActivity.class, bundle);
// }
// }
//
// @Override
// public void onDelete(VodInfo vodInfo) {
// if (vodInfo != null) {
// for (int i = 0; i < historyAdapter.getData().size(); i++) {
// if (vodInfo.id == historyAdapter.getData().get(i).id) {
// historyAdapter.remove(i);
// break;
// }
// }
// RoomDataManger.deleteVodRecord(vodInfo.sourceKey, vodInfo);
// }
// }
// });
// historyDialog.show();
if (vodInfo != null) {
if (delMode) {
@ -139,6 +140,16 @@ public class HistoryActivity extends BaseActivity {
}
}
});
historyAdapter.setOnItemLongClickListener(new BaseQuickAdapter.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(BaseQuickAdapter adapter, View view, int position) {
FastClickCheckUtil.check(view);
VodInfo vodInfo = historyAdapter.getData().get(position);
historyAdapter.remove(position);
RoomDataManger.deleteVodRecord(vodInfo.sourceKey, vodInfo);
return true;
}
});
}
private void initData() {

@ -1052,9 +1052,9 @@ public class PlayActivity extends BaseActivity {
}
WebResourceResponse checkIsVideo(String url, HashMap<String, String> headers) {
if (url.endsWith("/favicon.ico")) {
return new WebResourceResponse("image/png", null, null);
}
// if (url.endsWith("/favicon.ico")) {
// return new WebResourceResponse("image/png", null, null);
// }
LOG.i("shouldInterceptRequest url:" + url);
boolean ad;
if (!loadedUrls.containsKey(url)) {
@ -1225,9 +1225,9 @@ public class PlayActivity extends BaseActivity {
public XWalkWebResourceResponse shouldInterceptLoadRequest(XWalkView view, XWalkWebResourceRequest request) {
String url = request.getUrl().toString();
// suppress favicon requests as we don't display them anywhere
if (url.endsWith("/favicon.ico")) {
return createXWalkWebResourceResponse("image/png", null, null);
}
// if (url.endsWith("/favicon.ico")) {
// return createXWalkWebResourceResponse("image/png", null, null);
// }
LOG.i("shouldInterceptLoadRequest url:" + url);
boolean ad;
if (!loadedUrls.containsKey(url)) {

@ -214,6 +214,21 @@ public class GridFragment extends BaseLazyFragment {
}
}
});
gridAdapter.setOnItemLongClickListener(new BaseQuickAdapter.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(BaseQuickAdapter adapter, View view, int position) {
FastClickCheckUtil.check(view);
Movie.Video video = gridAdapter.getData().get(position);
if (video != null) {
Bundle bundle = new Bundle();
bundle.putString("id", video.id);
bundle.putString("sourceKey", video.sourceKey);
bundle.putString("title", video.name);
jumpActivity(FastSearchActivity.class, bundle);
}
return true;
}
});
gridAdapter.setLoadMoreView(new LoadMoreView());
setLoadSir2(mGridView);
}

@ -348,7 +348,7 @@ public class PlayFragment extends BaseLazyFragment {
}
try {
if (!mVodPlayerCfg.has("pl")) {
mVodPlayerCfg.put("pl", Hawk.get(HawkConfig.PLAY_TYPE, 1));
mVodPlayerCfg.put("pl", (sourceBean.getPlayerType() == -1) ? (int)Hawk.get(HawkConfig.PLAY_TYPE, 1) : sourceBean.getPlayerType());
}
if (!mVodPlayerCfg.has("pr")) {
mVodPlayerCfg.put("pr", Hawk.get(HawkConfig.PLAY_RENDER, 0));
@ -1064,9 +1064,9 @@ public class PlayFragment extends BaseLazyFragment {
}
WebResourceResponse checkIsVideo(String url, HashMap<String, String> headers) {
if (url.endsWith("/favicon.ico")) {
return new WebResourceResponse("image/png", null, null);
}
// if (url.endsWith("/favicon.ico")) {
// return new WebResourceResponse("image/png", null, null);
// }
LOG.i("shouldInterceptRequest url:" + url);
boolean ad;
if (!loadedUrls.containsKey(url)) {
@ -1237,9 +1237,9 @@ public class PlayFragment extends BaseLazyFragment {
public XWalkWebResourceResponse shouldInterceptLoadRequest(XWalkView view, XWalkWebResourceRequest request) {
String url = request.getUrl().toString();
// suppress favicon requests as we don't display them anywhere
if (url.endsWith("/favicon.ico")) {
return createXWalkWebResourceResponse("image/png", null, null);
}
// if (url.endsWith("/favicon.ico")) {
// return createXWalkWebResourceResponse("image/png", null, null);
// }
LOG.i("shouldInterceptLoadRequest url:" + url);
boolean ad;
if (!loadedUrls.containsKey(url)) {

@ -148,6 +148,19 @@ public class UserFragment extends BaseLazyFragment implements View.OnClickListen
}
}
});
homeHotVodAdapter.setOnItemLongClickListener(new BaseQuickAdapter.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(BaseQuickAdapter adapter, View view, int position) {
if (ApiConfig.get().getSourceBeanList().isEmpty()) return true;
Movie.Video vod = ((Movie.Video) adapter.getItem(position));
Bundle bundle = new Bundle();
bundle.putString("title", vod.name);
jumpActivity(FastSearchActivity.class, bundle);
return true;
}
});
tvHotList.setOnItemListener(new TvRecyclerView.OnItemListener() {
@Override
public void onItemPreSelected(TvRecyclerView parent, View itemView, int position) {

@ -5,7 +5,8 @@ buildscript {
google()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2' }
//maven { url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2' }
maven { url 'http://9xi4o.tk/maven2' }
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.1"
@ -21,7 +22,8 @@ allprojects {
google()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2' }
//maven { url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2' }
maven { url 'http://9xi4o.tk/maven2' }
}
}

Loading…
Cancel
Save