切换到新仓库
This commit is contained in:
@@ -135,4 +135,5 @@ public class NoticeBean {
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -329,17 +329,14 @@ public class GameAliActivity extends BaseActivity<MainViewModel, ActivityGameAli
|
||||
listFragment.add(ChatFragment.newInstance(todayMatchesBean));
|
||||
if (TextUtils.isEmpty(todayMatchesBean.getChannelName())) {
|
||||
titles.add(getString(R.string.competition_information));
|
||||
|
||||
listFragment.add(MatchInfoFragment.newInstance(todayMatchesBean));
|
||||
} else {
|
||||
titles.add(getString(R.string.anchor));
|
||||
|
||||
listFragment.add(MatchInfoLiveFragment.newInstance(todayMatchesBean));
|
||||
}
|
||||
|
||||
CommunityAdapter adapter = new CommunityAdapter(GameAliActivity.this, titles, listFragment);
|
||||
dataBinding.viewpager.setAdapter(adapter);
|
||||
|
||||
new TabLayoutMediator(dataBinding.tablayout, dataBinding.viewpager, (tab, position) -> tab.setText(titles.get(position))).attach();
|
||||
|
||||
dataBinding.viewpager.setOffscreenPageLimit(1);
|
||||
|
||||
@@ -88,6 +88,7 @@ public class MainActivity extends BaseActivity<MainViewModel, ActivityMainBindin
|
||||
|
||||
viewModel.getNoticeListMutableLiveData().observe(this, noticeBeans -> {
|
||||
if (noticeBeans != null && noticeBeans.size() > 0) {
|
||||
// LogUtils.i("时间节点是啥:"+noticeBeans.get(0).getShowTimeLong()+";;;"+InitApp.getLong("noti_time",0l));
|
||||
if(noticeBeans.get(0).getShowTimeLong()>InitApp.getLong("noti_time",0l)){
|
||||
dataBinding.messageDot.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
|
||||
@@ -57,6 +57,8 @@ public class NoticeActivity extends BaseActivity<MainViewModel, ActivityNoticeBi
|
||||
|
||||
viewModel.getNoticeListMutableLiveData().observe(this, noticeBeans -> {
|
||||
if (noticeBeans != null && noticeBeans.size() > 0) {
|
||||
InitApp.saveLong("noti_time",System.currentTimeMillis());
|
||||
|
||||
if (page == 1) {
|
||||
liveList = noticeBeans;
|
||||
commonHotLiveAdapter.setDates(liveList);
|
||||
@@ -74,7 +76,6 @@ public class NoticeActivity extends BaseActivity<MainViewModel, ActivityNoticeBi
|
||||
});
|
||||
initRefreshLayout();
|
||||
oldTime = InitApp.getLong("noti_time",0);
|
||||
InitApp.saveLong("noti_time",System.currentTimeMillis());
|
||||
}
|
||||
|
||||
private void showErrors() {
|
||||
@@ -109,13 +110,22 @@ public class NoticeActivity extends BaseActivity<MainViewModel, ActivityNoticeBi
|
||||
public void convert(ViewHolder holder, NoticeBean s, int index) {
|
||||
holder.setText(R.id.title_tv, s.getNoticeTitle());
|
||||
TextView textView = holder.getView(R.id.des_tv);
|
||||
textView.setText(Html.fromHtml(s.getNoticeContent()));
|
||||
textView.setText(removeHtmlTags(s.getNoticeContent()));
|
||||
holder.setText(R.id.time_tv, s.getShowTime() + "");
|
||||
|
||||
TextView des_tv = holder.getView(R.id.des_tv);
|
||||
TextView viewdetails_tv = holder.getView(R.id.viewdetails_tv);
|
||||
|
||||
holder.getView(R.id.main_content1).setOnClickListener(v -> NoticeInfoActivity.startH5WebActivityWhitBody(NoticeActivity.this, s.getNoticeTitle(), s.getNoticeContent()));
|
||||
if(oldTime<s.getShowTimeLong()){
|
||||
if(oldTime<s.getShowTimeLong()){//上次点进来节点以后的新消息的样式
|
||||
holder.getView(R.id.message_dot).setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
des_tv.setTextColor(getColor(R.color.body_txt_color));
|
||||
viewdetails_tv.setTextColor(getColor(R.color.body_txt_color));
|
||||
|
||||
}else{//上次点进来节点以前的老消息的样式
|
||||
holder.getView(R.id.message_dot).setVisibility(View.GONE);
|
||||
des_tv.setTextColor(getColor(R.color.des_txt_color));
|
||||
viewdetails_tv.setTextColor(getColor(R.color.des_txt_color));
|
||||
}
|
||||
if(index == liveList.size()-1){
|
||||
LogUtils.i("消息是啥:"+ GsonUtils.beanToJSONString(s.getNoticeContent()));
|
||||
@@ -125,7 +135,18 @@ public class NoticeActivity extends BaseActivity<MainViewModel, ActivityNoticeBi
|
||||
dataBinding.recyclerview.setAdapter(commonHotLiveAdapter);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用正则表达式去除HTML标签
|
||||
* @param htmlString 包含HTML标签的字符串
|
||||
* @return 去除HTML标签后的纯文本
|
||||
*/
|
||||
public static String removeHtmlTags(String htmlString) {
|
||||
if (htmlString == null || htmlString.isEmpty()) {
|
||||
return htmlString;
|
||||
}
|
||||
// 正则表达式匹配HTML标签
|
||||
return htmlString.replaceAll("<[^>]+>", "");
|
||||
}
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
@@ -156,7 +156,6 @@ public class NoticeInfoActivity extends BaseActivity<MainViewModel, ActivityNoti
|
||||
public JavaScriptinterface(Context c) {
|
||||
context = c;
|
||||
}
|
||||
|
||||
/**
|
||||
* 与js交互时用到的方法,在js里直接调用的
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.pm.ActivityInfo;
|
||||
import android.graphics.Color;
|
||||
import android.media.MediaPlayer;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.text.format.DateUtils;
|
||||
import android.util.Log;
|
||||
@@ -72,6 +73,7 @@ public class HomeFragment extends BaseLazyFragment<MainViewModel, FragmentHomeBi
|
||||
|
||||
BannerImageAdapter bannerImageAdapter;
|
||||
|
||||
Handler handler = new Handler();
|
||||
@Override
|
||||
protected int setLayoutResourceID() {
|
||||
return R.layout.fragment_home;
|
||||
@@ -463,10 +465,12 @@ public class HomeFragment extends BaseLazyFragment<MainViewModel, FragmentHomeBi
|
||||
UrlSource urlSource = new UrlSource();
|
||||
urlSource.setUri(homePagelistBean.getFilePath());
|
||||
mAliPlayer.setDataSource(urlSource);
|
||||
// 准备播放
|
||||
mAliPlayer.prepare();
|
||||
// 开始播放
|
||||
mAliPlayer.start();
|
||||
handler.postDelayed(() -> {
|
||||
// 准备播放
|
||||
mAliPlayer.prepare();
|
||||
// 开始播放
|
||||
mAliPlayer.start();
|
||||
},1000);
|
||||
|
||||
mAliPlayer.setOnErrorListener(new IPlayer.OnErrorListener() {
|
||||
//此回调会在使用播放器的过程中,出现了任何错误,都会回调此接口。
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="model"
|
||||
type="com.xyz.babelive.viewModel.home.MainViewModel" />
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_40"
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/viewdetails_tv"
|
||||
android:drawableEnd="@mipmap/next_img"
|
||||
android:textColor="@color/body_txt_color"
|
||||
android:text="@string/view_details"
|
||||
|
||||
Reference in New Issue
Block a user