fix epg底部信息样式不对称问题

pull/142/head
21561 1 year ago
parent e2d482a9ba
commit 5cc4604117
  1. 60
      app/src/main/java/com/github/tvbox/osc/ui/activity/HomeActivity.java
  2. 15
      app/src/main/java/com/github/tvbox/osc/ui/activity/LivePlayActivity.java
  3. 5
      app/src/main/java/com/github/tvbox/osc/ui/fragment/PlayFragment.java
  4. 6
      app/src/main/res/layout/activity_live_play.xml
  5. 2
      gradle.properties

@ -80,15 +80,15 @@ public class HomeActivity extends BaseActivity {
private SortAdapter sortAdapter;
private HomePageAdapter pageAdapter;
private View currentView;
private List<BaseLazyFragment> fragments = new ArrayList<>();
private final List<BaseLazyFragment> 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;
}
}

@ -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);
}

@ -639,11 +639,6 @@ public class PlayFragment extends BaseLazyFragment {
}
}
}
// if (trackInfo != null && trackInfo.getAudio().size()>0) {
// List<TrackInfoBean> audioTrackList = trackInfo.getAudio();
//// int selectedIndex = trackInfo.getAudioSelected(false);
// ((IjkMediaPlayer)(mVideoView.getMediaPlayer())).setTrack(audioTrackList.get(0).index);
// }
}
private void initViewModel() {

@ -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" />
<ImageView
@ -523,6 +523,8 @@
android:textColor="@color/color_FFFFFF"
android:ellipsize="marquee"
android:id="@+id/tv_current_program_time"
android:fontFamily="monospace"
android:textScaleX="0.95"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="暂无信息"
@ -572,6 +574,8 @@
android:textSize="@dimen/ts_26"
android:textColor="@color/color_FFFFFF"
android:id="@+id/tv_next_program_time"
android:fontFamily="monospace"
android:textScaleX="0.95"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="暂无信息"

@ -18,4 +18,4 @@ android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
IsDebug=true
#org.gradle.jvmargs=-Xmx2048m --add-opens java.base/java.io=ALL-UNNAMED
org.gradle.jvmargs=-Xmx2048m --add-opens java.base/java.io=ALL-UNNAMED

Loading…
Cancel
Save