Merge branch 'FongMi:dev' into dev

pull/123/head
LyOuYang 3 years ago committed by GitHub
commit 3d4dd5e02e
  1. 4
      app/build.gradle
  2. 17
      app/src/leanback/java/com/fongmi/android/tv/Product.java
  3. 16
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/DetailActivity.java
  4. 4
      app/src/leanback/res/layout/activity_detail.xml
  5. 4
      app/src/leanback/res/layout/activity_live.xml
  6. 4
      app/src/leanback/res/layout/adapter_vod.xml
  7. 15
      app/src/leanback/res/values/styles.xml
  8. 7
      app/src/main/java/com/fongmi/android/tv/ui/activity/BaseActivity.java
  9. 11
      app/src/main/java/com/fongmi/android/tv/utils/Notify.java
  10. 25
      app/src/main/res/values/styles.xml
  11. 10
      app/src/mobile/java/com/fongmi/android/tv/Product.java
  12. 1
      app/src/mobile/java/com/fongmi/android/tv/ui/fragment/child/SiteFragment.java
  13. 4
      app/src/mobile/res/layout/activity_detail.xml
  14. 4
      app/src/mobile/res/layout/adapter_vod.xml
  15. 15
      app/src/mobile/res/values/styles.xml

@ -10,8 +10,8 @@ android {
applicationId "com.fongmi.android.tv"
minSdk 21
targetSdk 29
versionCode 65
versionName "1.6.5"
versionCode 66
versionName "1.6.6"
ndk { abiFilters "armeabi-v7a" }
}

@ -0,0 +1,17 @@
package com.fongmi.android.tv;
import android.content.res.Resources;
import me.jessyan.autosize.AutoSizeCompat;
public class Product {
public static Resources hackResources(Resources resources) {
try {
AutoSizeCompat.autoConvertDensityOfGlobal(resources);
return resources;
} catch (Exception ignored) {
return resources;
}
}
}

@ -97,6 +97,7 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
private boolean mAutoMode;
private History mHistory;
private Players mPlayers;
private String mSiteKey;
private int mCurrent;
private Runnable mR1;
private Runnable mR2;
@ -197,6 +198,7 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
mPlayers = new Players().init();
mR1 = this::hideControl;
mR2 = this::setTraffic;
mSiteKey = getKey();
setRecyclerView();
setVideoView();
setViewModel();
@ -256,7 +258,7 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
mBinding.part.setAdapter(new ItemBridgeAdapter(mPartAdapter = new ArrayObjectAdapter(mPartPresenter = new PartPresenter(item -> initSearch(item, false)))));
mBinding.search.setHorizontalSpacing(ResUtil.dp2px(8));
mBinding.search.setRowHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
mBinding.search.setAdapter(new ItemBridgeAdapter(mSearchAdapter = new ArrayObjectAdapter(new SearchPresenter(this::getDetail))));
mBinding.search.setAdapter(new ItemBridgeAdapter(mSearchAdapter = new ArrayObjectAdapter(new SearchPresenter(this::setSearch))));
mBinding.control.parse.setHorizontalSpacing(ResUtil.dp2px(8));
mBinding.control.parse.setRowHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
mBinding.control.parse.setAdapter(new ItemBridgeAdapter(mParseAdapter = new ArrayObjectAdapter(new ParsePresenter(this::setParseActivated))));
@ -835,14 +837,14 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
}
private void checkFlag() {
int position = mBinding.flag.getSelectedPosition();
int position = isGone(mBinding.flag) ? -1 : mBinding.flag.getSelectedPosition();
if (position == mFlagAdapter.size() - 1) checkSearch();
else nextFlag(position);
}
private void checkSearch() {
if (isAutoMode() && mSearchAdapter.size() > 0) nextSite();
else initSearch(getName(), true);
if (mSearchAdapter.size() == 0) initSearch(getName(), true);
else if (isAutoMode()) nextSite();
}
private void initSearch(String keyword, boolean auto) {
@ -882,6 +884,11 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
if (isInitAuto()) nextSite();
}
private void setSearch(Vod item) {
setAutoMode(false);
getDetail(item);
}
private boolean mismatch(Vod item) {
String keyword = mBinding.part.getTag().toString();
if (isAutoMode()) return !item.getVodName().equals(keyword);
@ -903,6 +910,7 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
private void nextSite() {
if (mSearchAdapter.size() == 0) return;
Vod vod = (Vod) mSearchAdapter.get(0);
if (vod.getSiteKey().equals(mSiteKey)) return;
Notify.show(getString(R.string.play_switch_site, vod.getSiteName()));
mSearchAdapter.removeItems(0, 1);
setInitAuto(false);

@ -21,7 +21,7 @@
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/surface"
style="@style/ExoStyle"
style="@style/Player.Vod"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
@ -29,7 +29,7 @@
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/texture"
style="@style/ExoStyle"
style="@style/Player.Vod"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"

@ -16,7 +16,7 @@
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/surface"
style="@style/ExoStyle"
style="@style/Player.Live"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
@ -24,7 +24,7 @@
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/texture"
style="@style/ExoStyle"
style="@style/Player.Live"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"

@ -13,7 +13,7 @@
android:layout_height="match_parent"
android:background="@color/black_20"
android:scaleType="center"
app:shapeAppearanceOverlay="@style/VodStyle"
app:shapeAppearanceOverlay="@style/Vod"
tools:src="@drawable/ic_img_loading" />
<com.google.android.material.imageview.ShapeableImageView
@ -24,7 +24,7 @@
android:scaleType="center"
android:src="@drawable/ic_delete_vod"
android:visibility="gone"
app:shapeAppearanceOverlay="@style/VodStyle"
app:shapeAppearanceOverlay="@style/Vod"
tools:visibility="visible" />
<TextView

@ -13,19 +13,4 @@
<item name="android:windowTranslucentNavigation">true</item>
</style>
<style name="VodStyle">
<item name="cornerSize">8dp</item>
<item name="cornerFamily">rounded</item>
</style>
<style name="ExoStyle">
<item name="auto_show">false</item>
<item name="resize_mode">fit</item>
<item name="use_artwork">true</item>
<item name="use_controller">false</item>
<item name="animation_enabled">false</item>
<item name="default_artwork">@drawable/radio</item>
<item name="keep_content_on_player_reset">true</item>
</style>
</resources>

@ -2,6 +2,7 @@ package com.fongmi.android.tv.ui.activity;
import android.app.Activity;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
@ -9,6 +10,7 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewbinding.ViewBinding;
import com.fongmi.android.tv.Product;
import com.fongmi.android.tv.R;
import com.fongmi.android.tv.api.WallConfig;
import com.fongmi.android.tv.event.RefreshEvent;
@ -65,6 +67,11 @@ public abstract class BaseActivity extends AppCompatActivity {
setWall();
}
@Override
public Resources getResources() {
return Product.hackResources(super.getResources());
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);

@ -33,9 +33,8 @@ public class Notify {
}
public static void progress(Context context) {
ViewProgressBinding binding = ViewProgressBinding.inflate(LayoutInflater.from(context));
get().mDialog = new MaterialAlertDialogBuilder(context).setView(binding.getRoot()).create();
get().mDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
dismiss();
get().create(context);
get().mDialog.show();
}
@ -43,6 +42,12 @@ public class Notify {
if (get().mDialog != null && get().mDialog.isShowing()) get().mDialog.dismiss();
}
private void create(Context context) {
ViewProgressBinding binding = ViewProgressBinding.inflate(LayoutInflater.from(context));
mDialog = new MaterialAlertDialogBuilder(context).setView(binding.getRoot()).create();
mDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
}
private void makeText(String message) {
if (mToast != null) mToast.cancel();
if (TextUtils.isEmpty(message)) return;

@ -0,0 +1,25 @@
<resources>
<style name="Vod">
<item name="cornerSize">8dp</item>
<item name="cornerFamily">rounded</item>
</style>
<style name="Player">
<item name="auto_show">false</item>
<item name="resize_mode">fit</item>
<item name="use_artwork">true</item>
<item name="use_controller">false</item>
<item name="animation_enabled">false</item>
<item name="default_artwork">@drawable/radio</item>
</style>
<style name="Player.Vod">
<item name="keep_content_on_player_reset">false</item>
</style>
<style name="Player.Live">
<item name="keep_content_on_player_reset">true</item>
</style>
</resources>

@ -0,0 +1,10 @@
package com.fongmi.android.tv;
import android.content.res.Resources;
public class Product {
public static Resources hackResources(Resources resources) {
return resources;
}
}

@ -41,6 +41,7 @@ public class SiteFragment extends BaseFragment implements VodAdapter.OnClickList
@Override
protected void initView() {
mBinding.progressLayout.showProgress();
setRecyclerView();
}

@ -15,7 +15,7 @@
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/surface"
style="@style/ExoStyle"
style="@style/Player.Vod"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
@ -23,7 +23,7 @@
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/texture"
style="@style/ExoStyle"
style="@style/Player.Vod"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"

@ -13,7 +13,7 @@
android:layout_height="match_parent"
android:background="@color/black_20"
android:scaleType="center"
app:shapeAppearanceOverlay="@style/VodStyle"
app:shapeAppearanceOverlay="@style/Vod"
tools:src="@drawable/ic_img_loading" />
<com.google.android.material.imageview.ShapeableImageView
@ -24,7 +24,7 @@
android:scaleType="center"
android:src="@drawable/ic_delete_vod"
android:visibility="gone"
app:shapeAppearanceOverlay="@style/VodStyle"
app:shapeAppearanceOverlay="@style/Vod"
tools:visibility="visible" />
<TextView

@ -14,21 +14,6 @@
<item name="bottomSheetDialogTheme">@style/BottomSheetDialog</item>
</style>
<style name="VodStyle">
<item name="cornerSize">8dp</item>
<item name="cornerFamily">rounded</item>
</style>
<style name="ExoStyle">
<item name="auto_show">false</item>
<item name="resize_mode">fit</item>
<item name="use_artwork">true</item>
<item name="use_controller">false</item>
<item name="animation_enabled">false</item>
<item name="default_artwork">@drawable/radio</item>
<item name="keep_content_on_player_reset">true</item>
</style>
<style name="BottomSheetModal" parent="Widget.Design.BottomSheet.Modal">
<item name="android:background">@drawable/shape_bottom_sheet</item>
</style>

Loading…
Cancel
Save