Merge branch 'dev' into release

okjack
FongMi 2 years ago
commit 87783e877c
  1. 12
      app/build.gradle
  2. 22
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/LiveActivity.java
  3. 43
      app/src/leanback/res/layout/view_widget_live.xml
  4. 6
      app/src/main/java/com/fongmi/android/tv/bean/Channel.java
  5. 5
      app/src/main/java/com/fongmi/android/tv/utils/ImgUtil.java
  6. 19
      catvod/src/main/java/com/github/catvod/net/OkHttp.java
  7. 2
      catvod/src/main/java/com/github/catvod/net/OkProxySelector.java

@ -10,8 +10,8 @@ android {
applicationId "com.fongmi.android.tv"
minSdk 21
targetSdk 28
versionCode 210
versionName "20231214"
versionCode 211
versionName "2.1.1"
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
@ -104,9 +104,9 @@ dependencies {
implementation 'androidx.media:media:1.6.0'
implementation 'cat.ereza:customactivityoncrash:2.4.0'
implementation 'com.github.bassaer:materialdesigncolors:1.0.0'
implementation 'com.github.bumptech.glide:glide:4.15.1'
implementation 'com.github.bumptech.glide:annotations:4.15.1'
implementation 'com.github.bumptech.glide:okhttp3-integration:4.15.1'
implementation 'com.github.bumptech.glide:glide:4.16.0'
implementation 'com.github.bumptech.glide:annotations:4.16.0'
implementation 'com.github.bumptech.glide:okhttp3-integration:4.16.0'
implementation 'com.github.jahirfiquitiva:TextDrawable:1.0.3'
implementation 'com.github.TeamNewPipe:NewPipeExtractor:289db1178ab66694c23893e6a487d4708343c47b'
implementation('com.github.thegrizzlylabs:sardine-android:0.8') { exclude group: 'com.squareup.okhttp3', module: 'okhttp' }
@ -136,5 +136,5 @@ dependencies {
//mobileImplementation 'com.google.android.gms:play-services-cast-framework:21.3.0'
mobileImplementation('com.journeyapps:zxing-android-embedded:4.3.0') { transitive = false }
annotationProcessor 'androidx.room:room-compiler:2.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.15.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.16.0'
}

@ -433,13 +433,15 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
private void showControl(View view) {
mBinding.control.getRoot().setVisibility(View.VISIBLE);
mBinding.widget.top.setVisibility(View.VISIBLE);
view.requestFocus();
setR2Callback();
setR1Callback();
hideInfo();
}
private void hideControl() {
mBinding.control.getRoot().setVisibility(View.GONE);
mBinding.widget.top.setVisibility(View.GONE);
App.removeCallbacks(mR1);
}
@ -449,13 +451,13 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
}
private void showInfo() {
mBinding.widget.info.setVisibility(View.VISIBLE);
setR1Callback();
mBinding.widget.bottom.setVisibility(View.VISIBLE);
setR3Callback();
setInfo();
}
private void hideInfo() {
mBinding.widget.info.setVisibility(View.GONE);
mBinding.widget.bottom.setVisibility(View.GONE);
App.removeCallbacks(mR3);
}
@ -476,11 +478,11 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
}
private void setR1Callback() {
App.post(mR3, Constant.INTERVAL_HIDE);
App.post(mR1, Constant.INTERVAL_HIDE);
}
private void setR2Callback() {
App.post(mR1, Constant.INTERVAL_HIDE);
private void setR3Callback() {
App.post(mR3, Constant.INTERVAL_HIDE);
}
private void onToggle() {
@ -572,6 +574,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
mViewModel.getEpg(mChannel);
mChannel.loadLogo(mBinding.widget.logo);
mBinding.widget.name.setText(mChannel.getName());
mBinding.widget.title.setText(mChannel.getName());
mBinding.widget.line.setText(mChannel.getLineText());
mBinding.widget.number.setText(mChannel.getNumber());
mBinding.control.line.setText(mChannel.getLineText());
@ -666,6 +669,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
mPlayers.reset();
setSpeedVisible();
setTrackVisible(true);
mBinding.widget.size.setText(mPlayers.getSizeText());
break;
case Player.STATE_ENDED:
nextChannel();
@ -787,7 +791,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (isVisible(mBinding.control.getRoot())) setR2Callback();
if (isVisible(mBinding.control.getRoot())) setR1Callback();
if (mKeyDown.hasEvent(event)) mKeyDown.onKeyDown(event);
return super.dispatchKeyEvent(event);
}
@ -923,7 +927,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
public void onBackPressed() {
if (isVisible(mBinding.control.getRoot())) {
hideControl();
} else if (isVisible(mBinding.widget.info)) {
} else if (isVisible(mBinding.widget.bottom)) {
hideInfo();
} else if (isVisible(mBinding.recycler)) {
hideUI();

@ -4,6 +4,47 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:letterSpacing="0.02"
android:shadowColor="@color/grey_900"
android:shadowDx="2"
android:shadowDy="2"
android:shadowRadius="1"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="20sp"
tools:text="CCTV-1" />
<TextView
android:id="@+id/size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
android:layout_alignStart="@+id/title"
android:layout_marginBottom="16dp"
android:shadowColor="@color/grey_900"
android:shadowDx="2"
android:shadowDy="2"
android:shadowRadius="1"
android:textColor="@color/white"
android:textSize="16sp"
tools:text="1920 x 1080" />
</RelativeLayout>
<LinearLayout
android:id="@+id/progress"
android:layout_width="wrap_content"
@ -127,7 +168,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/info"
android:id="@+id/bottom"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_gravity="bottom"

@ -293,10 +293,16 @@ public class Channel {
}
public Channel copy(Channel item) {
setPlayerType(item.getPlayerType());
setReferer(item.getReferer());
setHeader(item.getHeader());
setNumber(item.getNumber());
setParse(item.getParse());
setLogo(item.getLogo());
setName(item.getName());
setUrls(item.getUrls());
setDrm(item.getDrm());
setEpg(item.getEpg());
setUa(item.getUa());
return this;
}

@ -9,6 +9,7 @@ import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.bumptech.glide.Glide;
@ -124,14 +125,14 @@ public class ImgUtil {
private static RequestListener<Bitmap> getListener(ImageView view, ImageView.ScaleType scaleType) {
return new RequestListener<>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource) {
public boolean onLoadFailed(@Nullable GlideException e, Object model, @NonNull Target<Bitmap> target, boolean isFirstResource) {
view.setScaleType(scaleType);
view.setImageResource(R.drawable.ic_img_error);
return true;
}
@Override
public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource) {
public boolean onResourceReady(@NonNull Bitmap resource, @NonNull Object model, Target<Bitmap> target, @NonNull DataSource dataSource, boolean isFirstResource) {
view.setScaleType(ImageView.ScaleType.CENTER_CROP);
return false;
}

@ -1,6 +1,7 @@
package com.github.catvod.net;
import android.net.Uri;
import android.text.TextUtils;
import androidx.collection.ArrayMap;
@ -9,6 +10,7 @@ import com.github.catvod.utils.Path;
import com.github.catvod.utils.Util;
import com.google.common.net.HttpHeaders;
import java.net.ProxySelector;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
@ -28,10 +30,15 @@ public class OkHttp {
private static final int TIMEOUT = 30 * 1000;
private static final int CACHE = 100 * 1024 * 1024;
private static final ProxySelector defaultSelector;
private DnsOverHttps dns;
private OkHttpClient client;
private ProxySelector selector;
private OkProxySelector selector;
static {
defaultSelector = ProxySelector.getDefault();
}
private static class Loader {
static volatile OkHttp INSTANCE = new OkHttp();
@ -52,14 +59,14 @@ public class OkHttp {
}
public void setProxy(String proxy) {
ProxySelector.setDefault(selector());
selector().setProxy(proxy);
ProxySelector.setDefault(TextUtils.isEmpty(proxy) ? defaultSelector : selector());
if (!TextUtils.isEmpty(proxy)) selector().setProxy(proxy);
client = null;
}
public static ProxySelector selector() {
public static OkProxySelector selector() {
if (get().selector != null) return get().selector;
return get().selector = new ProxySelector();
return get().selector = new OkProxySelector();
}
public static OkHttpClient client() {
@ -133,7 +140,7 @@ public class OkHttp {
private static OkHttpClient.Builder getBuilder() {
OkHttpClient.Builder builder = new OkHttpClient.Builder().addInterceptor(new OkhttpInterceptor()).connectTimeout(TIMEOUT, TimeUnit.MILLISECONDS).readTimeout(TIMEOUT, TimeUnit.MILLISECONDS).writeTimeout(TIMEOUT, TimeUnit.MILLISECONDS).dns(dns()).hostnameVerifier((hostname, session) -> true).sslSocketFactory(new SSLCompat(), SSLCompat.TM);
builder.proxySelector(selector());
builder.proxySelector(ProxySelector.getDefault());
return builder;
}
}

@ -14,7 +14,7 @@ import java.net.URI;
import java.util.Collections;
import java.util.List;
public class ProxySelector extends java.net.ProxySelector {
public class OkProxySelector extends java.net.ProxySelector {
private List<String> hosts;
private Proxy proxy;
Loading…
Cancel
Save