Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev
This commit is contained in:
@ -30,6 +30,7 @@ public class MarqueeView extends ViewFlipper {
|
||||
private int animDuration = 500;
|
||||
private int textSize = 14;
|
||||
private int textColor = 0xffffffff;
|
||||
private boolean useSingleLineText = false;
|
||||
|
||||
public MarqueeView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@ -118,6 +119,10 @@ public class MarqueeView extends ViewFlipper {
|
||||
tv.setText(text);
|
||||
tv.setTextColor(textColor);
|
||||
tv.setTextSize(textSize);
|
||||
if (useSingleLineText) {
|
||||
tv.setSingleLine(true);
|
||||
tv.setEllipsize(TextUtils.TruncateAt.END);
|
||||
}
|
||||
return tv;
|
||||
}
|
||||
|
||||
@ -127,6 +132,10 @@ public class MarqueeView extends ViewFlipper {
|
||||
start();
|
||||
}
|
||||
|
||||
public void enableSingleLineText() {
|
||||
useSingleLineText = true;
|
||||
}
|
||||
|
||||
public List<String> getNotices() {
|
||||
return notices;
|
||||
}
|
||||
|
||||
@ -197,6 +197,7 @@ class DescAdapter(context: Context,
|
||||
detailEntity.shouldBoundTogetherWithPreviousItem,
|
||||
detailEntity.shouldBoundTogetherWithNextItem)
|
||||
|
||||
viewHolder.binding.gamedetailItemNotice.enableSingleLineText()
|
||||
viewHolder.binding.gamedetailItemNotice.setOnClickListener {
|
||||
val index = viewHolder.binding.gamedetailItemNotice.displayedChild
|
||||
DirectUtils.directToArticle(mContext, noticeList[index].id, StringUtils.buildString(mEntrance, "游戏详情[", gameName, "]:公告"))
|
||||
@ -233,8 +234,7 @@ class DescAdapter(context: Context,
|
||||
detailEntity.shouldBoundTogetherWithPreviousItem,
|
||||
detailEntity.shouldBoundTogetherWithNextItem)
|
||||
|
||||
viewHolder.binding.contentTv.setTextWithHighlightedTextWrappedInsideWrapper(customColumn.des
|
||||
?: "", copyClickedText = true)
|
||||
viewHolder.binding.contentTv.setTextWithHighlightedTextWrappedInsideWrapper(customColumn.des ?: "")
|
||||
|
||||
viewHolder.binding.recyclerview.isNestedScrollingEnabled = false
|
||||
viewHolder.binding.recyclerview.layoutManager = if (customColumn.showInfoTagDes == true) {
|
||||
@ -266,6 +266,7 @@ class DescAdapter(context: Context,
|
||||
DirectUtils.directToLinkPage(mContext, customColumn.nameLink!!, StringUtils.buildString(mEntrance, "游戏详情[", gameName, "]:自定义栏目"), "")
|
||||
}
|
||||
|
||||
viewHolder.binding.linkHintIv.setOnClickListener { viewHolder.binding.linkHintTv.performClick() }
|
||||
viewHolder.binding.linkHintArrowIv.setOnClickListener { viewHolder.binding.linkHintTv.performClick() }
|
||||
viewHolder.binding.linkHintTv.setOnClickListener {
|
||||
MtaHelper.onEvent("游戏详情_新", "自定义栏目右上角跳转", "${gameName}-${customColumn.name}-${customColumn.link?.value}")
|
||||
@ -290,8 +291,7 @@ class DescAdapter(context: Context,
|
||||
viewHolder.binding.contentTv.setExpandMaxLines(maxDesLines)
|
||||
viewHolder.binding.contentTv.setIsExpanded(Int.MAX_VALUE == maxDesLines)
|
||||
viewHolder.binding.customColumn = customColumn
|
||||
viewHolder.binding.contentTv.setTextWithHighlightedTextWrappedInsideWrapper(customColumn.des
|
||||
?: "", copyClickedText = true)
|
||||
viewHolder.binding.contentTv.setTextWithHighlightedTextWrappedInsideWrapper(customColumn.des ?: "")
|
||||
viewHolder.binding.recyclerview.isNestedScrollingEnabled = false
|
||||
viewHolder.binding.recyclerview.layoutManager = if (customColumn.showInfoTagDes == true) {
|
||||
LinearLayoutManager(mContext)
|
||||
@ -313,6 +313,7 @@ class DescAdapter(context: Context,
|
||||
MtaHelper.onEvent("游戏详情_新", "自定义栏目正文_全部", "${gameName}-${customColumn.name}")
|
||||
}
|
||||
}
|
||||
|
||||
viewHolder.binding.linkImageIv.setOnClickListener {
|
||||
MtaHelper.onEvent("游戏详情_新", "自定义栏目正文_图片", "${gameName}-${customColumn.name}")
|
||||
viewHolder.binding.titleHintTv.performClick()
|
||||
@ -322,6 +323,7 @@ class DescAdapter(context: Context,
|
||||
DirectUtils.directToLinkPage(mContext, customColumn.nameLink!!, StringUtils.buildString(mEntrance, "游戏详情[", gameName, "]:自定义栏目"), "")
|
||||
}
|
||||
|
||||
viewHolder.binding.linkHintIv.setOnClickListener { viewHolder.binding.linkHintTv.performClick() }
|
||||
viewHolder.binding.linkHintArrowIv.setOnClickListener { viewHolder.binding.linkHintTv.performClick() }
|
||||
viewHolder.binding.linkHintTv.setOnClickListener {
|
||||
MtaHelper.onEvent("游戏详情_新", "自定义栏目右上角跳转", "${gameName}-${customColumn.name}-${customColumn.link?.value}")
|
||||
|
||||
@ -15,7 +15,6 @@ import com.gh.common.util.*
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.entity.ErrorEntity
|
||||
import com.gh.gamecenter.entity.GameEntity
|
||||
import com.gh.gamecenter.entity.LinkEntity
|
||||
import com.gh.gamecenter.entity.SubjectEntity
|
||||
import com.gh.gamecenter.gamedetail.entity.CustomColumn
|
||||
import com.gh.gamecenter.gamedetail.entity.DetailEntity
|
||||
@ -215,7 +214,8 @@ class DescViewModel(application: Application,
|
||||
rawItem.type = DetailEntity.Type.CUSTOM_COLUMN.value
|
||||
rawItem.customColumn = CustomColumn(
|
||||
name = "游戏简介",
|
||||
nameLink = LinkEntity(icon = UriUtil.getUriForResourceId(R.drawable.ic_game_desc).toString()),
|
||||
order = 1,
|
||||
nameIcon = UriUtil.getUriForResourceId(R.drawable.ic_game_desc).toString(),
|
||||
des = rawItem.des,
|
||||
showDesRowNum = 2)
|
||||
break
|
||||
|
||||
@ -78,7 +78,7 @@ data class CustomColumn(
|
||||
@SerializedName("name_link")
|
||||
var nameLink: LinkEntity? = null,
|
||||
var link: LinkEntity? = null,
|
||||
var order: Long? = 0,
|
||||
var order: Long? = 0, // 权重
|
||||
var title: Title? = null,
|
||||
var des: String? = "",
|
||||
@SerializedName("show_des_type")
|
||||
|
||||
@ -2,8 +2,11 @@ package com.gh.gamecenter.gamedetail.history
|
||||
|
||||
import android.graphics.drawable.InsetDrawable
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import butterknife.BindView
|
||||
import com.gh.common.util.*
|
||||
import com.gh.common.view.CustomDividerItemDecoration
|
||||
import com.gh.download.DownloadManager
|
||||
@ -24,6 +27,9 @@ class HistoryApkListFragment : ListFragment<GameEntity, HistoryApkListViewModel>
|
||||
private var mAdapter: HistoryApkListAdapter? = null
|
||||
private var mViewModel: HistoryApkListViewModel? = null
|
||||
|
||||
@BindView(R.id.reuse_tv_none_data)
|
||||
lateinit var noDataTv: TextView
|
||||
|
||||
private val dataWatcher = object : DataWatcher() {
|
||||
override fun onDataChanged(downloadEntity: DownloadEntity) {
|
||||
mAdapter?.notifyItemByDownload(downloadEntity)
|
||||
@ -38,7 +44,13 @@ class HistoryApkListFragment : ListFragment<GameEntity, HistoryApkListViewModel>
|
||||
}
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
noDataTv.text = "暂时还没有数据喔"
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
if (isEverPause && mAdapter != null) mAdapter?.notifyDataSetChanged()
|
||||
super.onResume()
|
||||
DownloadManager.getInstance(context).addObserver(dataWatcher)
|
||||
}
|
||||
|
||||
@ -3,20 +3,10 @@ package com.gh.gamecenter.receiver;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.gh.common.util.RunningUtils;
|
||||
import com.gh.gamecenter.DownloadManagerActivity;
|
||||
import com.gh.gamecenter.MainActivity;
|
||||
import com.gh.gamecenter.SplashScreenActivity;
|
||||
import com.gh.gamecenter.eventbus.EBSkip;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import com.gh.common.util.DirectUtils;
|
||||
|
||||
import static com.gh.common.util.EntranceUtils.ENTRANCE_DOWNLOAD;
|
||||
import static com.gh.common.util.EntranceUtils.KEY_ENTRANCE;
|
||||
import static com.gh.common.util.EntranceUtils.KEY_TO;
|
||||
|
||||
/**
|
||||
* Created by LGT on 2016/10/10.
|
||||
@ -26,36 +16,6 @@ public class DownloadReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
||||
if (RunningUtils.isRunning(context)) {
|
||||
// 助手正在运行
|
||||
if (RunningUtils.isEqualsTop(context, DownloadManagerActivity.class.getName())) {
|
||||
if (RunningUtils.isApplicationBroughtToBackground(context)) {
|
||||
// 这里是指从后台返回到前台 前两个的是关键
|
||||
|
||||
Intent download = new Intent(context, DownloadManagerActivity.class);
|
||||
Intent main = new Intent(context, MainActivity.class);
|
||||
main.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
main.setAction(Intent.ACTION_MAIN);
|
||||
main.addCategory(Intent.CATEGORY_DEFAULT);
|
||||
ContextCompat.startActivities(context, new Intent[]{main, download});
|
||||
}
|
||||
// 切换到游戏下载fragment
|
||||
EventBus.getDefault().post(new EBSkip(DownloadManagerActivity.TAG, DownloadManagerActivity.INDEX_DOWNLOAD));
|
||||
} else {
|
||||
Intent downloadIntent = DownloadManagerActivity.getDownloadMangerIntent(context, null, ENTRANCE_DOWNLOAD);
|
||||
downloadIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(downloadIntent);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
// 助手未在运行
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(KEY_TO, DownloadManagerActivity.TAG);
|
||||
intent.putExtra(KEY_ENTRANCE, ENTRANCE_DOWNLOAD);
|
||||
context.startActivity(SplashScreenActivity.getSplashScreenIntent(context, bundle));
|
||||
}
|
||||
DirectUtils.directToDownloadManager(context, ENTRANCE_DOWNLOAD);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -193,6 +193,7 @@ public class HaloApp extends TinkerAppLike {
|
||||
});
|
||||
}
|
||||
|
||||
// todo 动态注册和静态注册并行的话会触发多次回调
|
||||
// 3.5 开始将 targetSdk 升级至 26,原来写在 Manifest 的部分 receiver 由于系统限制需要换成在运行时注册
|
||||
private void initReceiver() {
|
||||
DownloadReceiver downloadReceiver = new DownloadReceiver();
|
||||
|
||||
Reference in New Issue
Block a user