From 5cc46041176d9e7df60037bb0703adec3533d96e Mon Sep 17 00:00:00 2001 From: 21561 <215613905@qq.com> Date: Thu, 6 Mar 2025 21:48:10 +0800 Subject: [PATCH] =?UTF-8?q?fix=20epg=E5=BA=95=E9=83=A8=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=B8=8D=E5=AF=B9=E7=A7=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tvbox/osc/ui/activity/HomeActivity.java | 60 ++++++------------- .../osc/ui/activity/LivePlayActivity.java | 15 ++--- .../tvbox/osc/ui/fragment/PlayFragment.java | 5 -- .../main/res/layout/activity_live_play.xml | 6 +- gradle.properties | 2 +- 5 files changed, 31 insertions(+), 57 deletions(-) diff --git a/app/src/main/java/com/github/tvbox/osc/ui/activity/HomeActivity.java b/app/src/main/java/com/github/tvbox/osc/ui/activity/HomeActivity.java index a264f99e..8beebcaf 100644 --- a/app/src/main/java/com/github/tvbox/osc/ui/activity/HomeActivity.java +++ b/app/src/main/java/com/github/tvbox/osc/ui/activity/HomeActivity.java @@ -80,15 +80,15 @@ public class HomeActivity extends BaseActivity { private SortAdapter sortAdapter; private HomePageAdapter pageAdapter; private View currentView; - private List fragments = new ArrayList<>(); + private final List fragments = new ArrayList<>(); private boolean isDownOrUp = false; private boolean sortChange = false; private int currentSelected = 0; private int sortFocused = 0; public View sortFocusView = null; - private Handler mHandler = new Handler(); + private final Handler mHandler = new Handler(); private long mExitTime = 0; - private Runnable mRunnable = new Runnable() { + private final Runnable mRunnable = new Runnable() { @SuppressLint({"DefaultLocale", "SetTextI18n"}) @Override public void run() { @@ -153,8 +153,7 @@ public class HomeActivity extends BaseActivity { textView.invalidate(); } - public View v = view; - public int p = position; + public final int p = position; }, 10); } } @@ -265,13 +264,7 @@ public class HomeActivity extends BaseActivity { if (home != null && home.getName() != null && !home.getName().isEmpty()) tvName.setText(home.getName()); if (dataInitOk && jarInitOk) { - showLoading(); sourceViewModel.getSort(ApiConfig.get().getHomeSourceBean().getKey()); - if (hasPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)) { - LOG.e("有"); - } else { - LOG.e("无"); - } return; } showLoading(); @@ -307,7 +300,7 @@ public class HomeActivity extends BaseActivity { mHandler.post(new Runnable() { @Override public void run() { - Toast.makeText(HomeActivity.this, "jar加载失败", Toast.LENGTH_SHORT).show(); + Toast.makeText(HomeActivity.this, "jar加载失败;尝试加载上一次缓存", Toast.LENGTH_SHORT).show(); initData(); } }); @@ -521,7 +514,7 @@ public class HomeActivity extends BaseActivity { currentView.findViewById(R.id.tvFilter).setVisibility(visible ? View.GONE : View.VISIBLE); } - private Runnable mDataRunnable = new Runnable() { + private final Runnable mDataRunnable = new Runnable() { @Override public void run() { if (sortChange) { @@ -529,11 +522,7 @@ public class HomeActivity extends BaseActivity { if (sortFocused != currentSelected) { currentSelected = sortFocused; mViewPager.setCurrentItem(sortFocused, false); - if (sortFocused == 0) { - changeTop(false); - } else { - changeTop(true); - } + changeTop(sortFocused != 0); } } } @@ -588,38 +577,27 @@ public class HomeActivity extends BaseActivity { } }); if (hide && topHide == 0) { - animatorSet.playTogether(new Animator[]{ - ObjectAnimator.ofObject(viewObj, "marginTop", new IntEvaluator(), - new Object[]{ - Integer.valueOf(AutoSizeUtils.mm2px(this.mContext, 10.0f)), - Integer.valueOf(AutoSizeUtils.mm2px(this.mContext, 0.0f)) - }), + animatorSet.playTogether(ObjectAnimator.ofObject(viewObj, "marginTop", new IntEvaluator(), + AutoSizeUtils.mm2px(this.mContext, 10.0f), + AutoSizeUtils.mm2px(this.mContext, 0.0f)), ObjectAnimator.ofObject(viewObj, "height", new IntEvaluator(), - new Object[]{ - Integer.valueOf(AutoSizeUtils.mm2px(this.mContext, 50.0f)), - Integer.valueOf(AutoSizeUtils.mm2px(this.mContext, 1.0f)) - }), - ObjectAnimator.ofFloat(this.topLayout, "alpha", new float[]{1.0f, 0.0f})}); + AutoSizeUtils.mm2px(this.mContext, 50.0f), + AutoSizeUtils.mm2px(this.mContext, 1.0f)), + ObjectAnimator.ofFloat(this.topLayout, "alpha", 1.0f, 0.0f)); animatorSet.setDuration(200); animatorSet.start(); return; } if (!hide && topHide == 1) { - animatorSet.playTogether(new Animator[]{ - ObjectAnimator.ofObject(viewObj, "marginTop", new IntEvaluator(), - new Object[]{ - Integer.valueOf(AutoSizeUtils.mm2px(this.mContext, 0.0f)), - Integer.valueOf(AutoSizeUtils.mm2px(this.mContext, 10.0f)) - }), + animatorSet.playTogether(ObjectAnimator.ofObject(viewObj, "marginTop", new IntEvaluator(), + AutoSizeUtils.mm2px(this.mContext, 0.0f), + AutoSizeUtils.mm2px(this.mContext, 10.0f)), ObjectAnimator.ofObject(viewObj, "height", new IntEvaluator(), - new Object[]{ - Integer.valueOf(AutoSizeUtils.mm2px(this.mContext, 1.0f)), - Integer.valueOf(AutoSizeUtils.mm2px(this.mContext, 50.0f)) - }), - ObjectAnimator.ofFloat(this.topLayout, "alpha", new float[]{0.0f, 1.0f})}); + AutoSizeUtils.mm2px(this.mContext, 1.0f), + AutoSizeUtils.mm2px(this.mContext, 50.0f)), + ObjectAnimator.ofFloat(this.topLayout, "alpha", 0.0f, 1.0f)); animatorSet.setDuration(200); animatorSet.start(); - return; } } diff --git a/app/src/main/java/com/github/tvbox/osc/ui/activity/LivePlayActivity.java b/app/src/main/java/com/github/tvbox/osc/ui/activity/LivePlayActivity.java index 2a381642..df045c9e 100644 --- a/app/src/main/java/com/github/tvbox/osc/ui/activity/LivePlayActivity.java +++ b/app/src/main/java/com/github/tvbox/osc/ui/activity/LivePlayActivity.java @@ -408,7 +408,7 @@ public class LivePlayActivity extends BaseActivity { public void getEpg(Date date) { String channelName = channel_Name.getChannelName(); - SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd"); + @SuppressLint("SimpleDateFormat") SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd"); timeFormat.setTimeZone(TimeZone.getTimeZone("GMT+8:00")); String[] epgInfo = EpgUtil.getEpgInfo(channelName); String epgTagName = channelName; @@ -416,9 +416,7 @@ public class LivePlayActivity extends BaseActivity { if (epgInfo != null && !epgInfo[1].isEmpty()) { epgTagName = epgInfo[1]; } - String finalChannelName = channelName; epgListAdapter.CanBack(currentLiveChannelItem.getinclude_back()); - //epgListAdapter.updateData(date, new ArrayList<>()); String url; if(epgStringAddress.contains("{name}") && epgStringAddress.contains("{date}")){ @@ -475,21 +473,19 @@ public class LivePlayActivity extends BaseActivity { tv_next_program_name.setText(""); String savedEpgKey = channel_Name.getChannelName() + "_" + Objects.requireNonNull(liveEpgDateAdapter.getItem(liveEpgDateAdapter.getSelectedIndex())).getDatePresented(); if (hsEpg.containsKey(savedEpgKey)) { - String[] epgInfo = EpgUtil.getEpgInfo(channel_Name.getChannelName()); - updateChannelIcon(channel_Name.getChannelName(), epgInfo == null ? null : epgInfo[0]); ArrayList arrayList = (ArrayList) hsEpg.get(savedEpgKey); if (arrayList != null && arrayList.size() > 0) { Date date = new Date(); int size = arrayList.size() - 1; while (size >= 0) { if (date.after(((Epginfo) arrayList.get(size)).startdateTime) & date.before(((Epginfo) arrayList.get(size)).enddateTime)) { - tip_epg1.setText(((Epginfo) arrayList.get(size)).start + " - " + ((Epginfo) arrayList.get(size)).end); + tip_epg1.setText(((Epginfo) arrayList.get(size)).start + "-" + ((Epginfo) arrayList.get(size)).end); tv_current_program_name.setText(((Epginfo) arrayList.get(size)).title); if (size != arrayList.size() - 1) { - tip_epg2.setText(((Epginfo) arrayList.get(size + 1)).start + " - " + ((Epginfo) arrayList.get(size + 1)).end); + tip_epg2.setText(((Epginfo) arrayList.get(size + 1)).start + "-" + ((Epginfo) arrayList.get(size + 1)).end); tv_next_program_name.setText(((Epginfo) arrayList.get(size + 1)).title); } else { - tip_epg2.setText("00:00 - 23:59"); + tip_epg2.setText("00:00-23:59"); tv_next_program_name.setText("精彩节目-暂无节目预告信息"); } break; @@ -546,6 +542,7 @@ public class LivePlayActivity extends BaseActivity { } } + @SuppressLint("SetTextI18n") private void updateChannelIcon(String channelName, String logoUrl) { if (StringUtils.isEmpty(logoUrl)) { liveIconNullBg.setVisibility(View.VISIBLE); @@ -554,7 +551,7 @@ public class LivePlayActivity extends BaseActivity { liveIconNullText.setText("" + channel_Name.getChannelNum()); } else { imgLiveIcon.setVisibility(View.VISIBLE); - Picasso.get().load(logoUrl).placeholder(R.drawable.app_banner).into(imgLiveIcon); + Picasso.get().load(logoUrl).into(imgLiveIcon); liveIconNullBg.setVisibility(View.INVISIBLE); liveIconNullText.setVisibility(View.INVISIBLE); } diff --git a/app/src/main/java/com/github/tvbox/osc/ui/fragment/PlayFragment.java b/app/src/main/java/com/github/tvbox/osc/ui/fragment/PlayFragment.java index 2cd85a41..a837dc80 100644 --- a/app/src/main/java/com/github/tvbox/osc/ui/fragment/PlayFragment.java +++ b/app/src/main/java/com/github/tvbox/osc/ui/fragment/PlayFragment.java @@ -639,11 +639,6 @@ public class PlayFragment extends BaseLazyFragment { } } } -// if (trackInfo != null && trackInfo.getAudio().size()>0) { -// List audioTrackList = trackInfo.getAudio(); -//// int selectedIndex = trackInfo.getAudioSelected(false); -// ((IjkMediaPlayer)(mVideoView.getMediaPlayer())).setTrack(audioTrackList.get(0).index); -// } } private void initViewModel() { diff --git a/app/src/main/res/layout/activity_live_play.xml b/app/src/main/res/layout/activity_live_play.xml index 378aa36c..b1e032f6 100644 --- a/app/src/main/res/layout/activity_live_play.xml +++ b/app/src/main/res/layout/activity_live_play.xml @@ -469,7 +469,7 @@ android:ellipsize='marquee' android:singleLine="true" android:textColor="@android:color/white" - android:textSize="@dimen/vs_60" + android:textSize="@dimen/vs_50" android:textStyle="bold" tools:ignore="EllipsizeMaxLines" />