feat: 新增[图标浮层]功能—客户端 https://jira.shanqu.cc/browse/GHZS-1100

This commit is contained in:
叶子维
2023-02-10 09:54:37 +08:00
parent 8e2fcd08b9
commit 5bf0bb5042
61 changed files with 383 additions and 73 deletions

View File

@ -262,7 +262,7 @@ public class BindingAdapters {
public static void setGameIcon(View view, GameEntity gameEntity) {
if (gameEntity != null && view instanceof GameIconView) {
((GameIconView) view).displayGameIcon(gameEntity.getIcon(), gameEntity.getIconSubscript());
((GameIconView) view).displayGameIcon(gameEntity.getIcon(), gameEntity.getIconSubscript(), gameEntity.getIconFloat());
}
}

View File

@ -19,7 +19,7 @@ import com.halo.assistant.HaloApp
@Database(
entities = [AnswerEntity::class, ArticleEntity::class, NewsEntity::class, HistoryGameEntity::class, MyVideoEntity::class, GamesCollectionEntity::class],
version = 12,
version = 13,
exportSchema = false
)
@TypeConverters(
@ -40,7 +40,8 @@ import com.halo.assistant.HaloApp
MeConverter::class,
SimpleGameListConverter::class,
TagInfoListConverter::class,
ActivityLabelListConverter::class
ActivityLabelListConverter::class,
IconFloatConverter::class
)
abstract class HistoryDatabase : RoomDatabase() {
@ -136,6 +137,12 @@ abstract class HistoryDatabase : RoomDatabase() {
}
}
val MIGRATION_12_13: Migration = object : Migration(12, 13) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("Alter TABLE HistoryGameEntity add iconFloat TEXT")
}
}
val instance by lazy {
Room.databaseBuilder(
HaloApp.getInstance().application,
@ -152,6 +159,7 @@ abstract class HistoryDatabase : RoomDatabase() {
.addMigrations(MIGRATION_9_10)
.addMigrations(MIGRATION_10_11)
.addMigrations(MIGRATION_11_12)
.addMigrations(MIGRATION_12_13)
.build()
}
}

View File

@ -56,6 +56,7 @@ object HistoryHelper {
historyGame.des = ""
historyGame.icon = updateEntity.rawIcon ?: updateEntity.icon
historyGame.iconSubscript = updateEntity.iconSubscript
historyGame.iconFloat = updateEntity.iconFloat
historyGame.name = updateEntity.name
historyGame.tagStyle = updateEntity.tagStyle
return historyGame
@ -70,6 +71,7 @@ object HistoryHelper {
historyGame.des = gameEntity.des
historyGame.icon = gameEntity.rawIcon ?: gameEntity.icon
historyGame.iconSubscript = gameEntity.iconSubscript
historyGame.iconFloat = gameEntity.iconFloat
historyGame.name = gameEntity.name
historyGame.tagStyle = gameEntity.tagStyle
historyGame.tag = gameEntity.getTag()

View File

@ -204,6 +204,7 @@ public class GameUtils {
gameUpdateEntity.setIcon(gameEntity.getIcon());
gameUpdateEntity.setRawIcon(gameEntity.getRawIcon());
gameUpdateEntity.setIconSubscript(gameEntity.getIconSubscript());
gameUpdateEntity.setIconFloat(gameEntity.getIconFloat());
gameUpdateEntity.setName(gameEntity.getName());
gameUpdateEntity.setPackageName(apkEntity.getPackageName());
gameUpdateEntity.setSize(apkEntity.getSize());

View File

@ -118,6 +118,7 @@ public class PackageUtils {
updateEntity.setIcon(gameEntity.getIcon());
updateEntity.setRawIcon(gameEntity.getRawIcon());
updateEntity.setIconSubscript(gameEntity.getIconSubscript());
updateEntity.setIconFloat(gameEntity.getIconFloat());
updateEntity.setPackageName(apkEntity.getPackageName());
updateEntity.setSize(apkEntity.getSize());
updateEntity.setVersion(apkEntity.getVersion());
@ -185,6 +186,7 @@ public class PackageUtils {
updateEntity.setIcon(gameEntity.getIcon());
updateEntity.setRawIcon(gameEntity.getRawIcon());
updateEntity.setIconSubscript(gameEntity.getIconSubscript());
updateEntity.setIconFloat(gameEntity.getIconFloat());
updateEntity.setPackageName(apkEntity.getPackageName());
updateEntity.setSize(apkEntity.getSize());
updateEntity.setVersion(apkEntity.getVersion());

View File

@ -326,6 +326,11 @@ public class DownloadManager implements DownloadStatusListener {
ExtensionsKt.addMetaExtra(downloadEntity, Constants.GAME_ICON_SUBSCRIPT, gameEntity.getIconSubscript());
ExtensionsKt.addMetaExtra(downloadEntity, Constants.IS_PLATFORM_RECOMMEND, apkEntity.getRecommend() != null ? "true" : "false");
ExtensionsKt.addMetaExtra(downloadEntity, Constants.GAME_NAME, gameEntity.getName());
if (gameEntity.getIconFloat() != null) {
ExtensionsKt.addMetaExtra(downloadEntity, Constants.GAME_ICON_FLOAT_TOP_TEXT, gameEntity.getIconFloat().getUpperLeftText());
ExtensionsKt.addMetaExtra(downloadEntity, Constants.GAME_ICON_FLOAT_TOP_COLOR, gameEntity.getIconFloat().getUpperLeftColor());
ExtensionsKt.addMetaExtra(downloadEntity, Constants.GAME_ICON_FLOAT_BOTTOM_TEXT, gameEntity.getIconFloat().getBottomText());
}
if (SimulatorGameManager.isSimulatorGame(gameEntity)) {
ExtensionsKt.addMetaExtra(downloadEntity, Constants.SIMULATOR_GAME, apkEntity.getFormat());
ExtensionsKt.addMetaExtra(downloadEntity, Constants.SIMULATOR, GsonUtils.toJson(gameEntity.getSimulator()));

View File

@ -200,11 +200,11 @@ public class LibaoDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
ExtensionsKt.setRootBackgroundColor(holder.binding.getRoot(), R.color.background_white);
if (mLibaoEntity.getGame() != null) {
holder.binding.libaodetailGameIcon.displayGameIcon(mLibaoEntity.getGame().getIcon(), mLibaoEntity.getGame().getIconSubscript());
holder.binding.libaodetailGameIcon.displayGameIcon(mLibaoEntity.getGame().getIcon(), mLibaoEntity.getGame().getIconSubscript(), mLibaoEntity.getGame().getIconFloat());
GameEntity gameEntity = mLibaoEntity.getGame().toGameEntity();
GameItemViewHolder.initGameSubtitle(gameEntity, holder.binding.gameSubtitleTv, null, null, false, null);
} else {
holder.binding.libaodetailGameIcon.displayGameIcon(mLibaoEntity.getIcon(), null);
holder.binding.libaodetailGameIcon.displayGameIcon(mLibaoEntity.getIcon(), null, mLibaoEntity.getGame().getIconFloat());
}
holder.binding.libaodetailName.setText(mLibaoEntity.getName());
if (TextUtils.isEmpty(mLibaoEntity.getPlatform())) {

View File

@ -291,9 +291,9 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
}
if (mConcernEntity.getGame() != null) {
viewHolder.binding.newsDigestThumb.displayGameIcon(mConcernEntity.getGame().getIcon(), mConcernEntity.getGame().getIconSubscript());
viewHolder.binding.newsDigestThumb.displayGameIcon(mConcernEntity.getGame().getIcon(), mConcernEntity.getGame().getIconSubscript(), mConcernEntity.getGame().getIconFloat());
} else {
viewHolder.binding.newsDigestThumb.displayGameIcon(mConcernEntity.getGameIcon(), null);
viewHolder.binding.newsDigestThumb.displayGameIcon(mConcernEntity.getGameIcon(), null, mConcernEntity.getGame().getIconFloat());
}
viewHolder.binding.newsDigestTitle.setText(mConcernEntity.getGameName());
NewsUtils.setNewsPublishOn(viewHolder.binding.newsDigestTime, mConcernEntity.getTime());

View File

@ -255,7 +255,7 @@ class AmwayAdapter(
binding.gameIconView.displayGameIcon(
amway.game.rawIcon
?: amway.game.icon, amway.game.iconSubscript
?: amway.game.icon, amway.game.iconSubscript, amway.game.iconFloat
)
amway.game.tag?.let {

View File

@ -17,6 +17,7 @@ import androidx.recyclerview.widget.RecyclerView.ViewHolder;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.PackageInstaller;
import com.gh.common.util.PackageUtils;
import com.gh.gamecenter.common.entity.IconFloat;
import com.gh.gamecenter.feature.utils.PlatformUtils;
import com.gh.gamecenter.feature.view.DownloadButton;
import com.gh.common.xapk.XapkInstaller;
@ -125,7 +126,12 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
if (!TextUtils.isEmpty(rawIcon)) {
icon = rawIcon;
}
viewHolder.binding.dmItemIvIcon.displayGameIcon(icon, ExtensionsKt.getMetaExtra(downloadEntity, Constants.GAME_ICON_SUBSCRIPT));
IconFloat iconFloat = new IconFloat(
ExtensionsKt.getMetaExtra(downloadEntity, Constants.GAME_ICON_FLOAT_TOP_TEXT),
ExtensionsKt.getMetaExtra(downloadEntity, Constants.GAME_ICON_FLOAT_TOP_COLOR),
ExtensionsKt.getMetaExtra(downloadEntity, Constants.GAME_ICON_FLOAT_BOTTOM_TEXT)
);
viewHolder.binding.dmItemIvIcon.displayGameIcon(icon, ExtensionsKt.getMetaExtra(downloadEntity, Constants.GAME_ICON_SUBSCRIPT), iconFloat);
} else {
ImageUtils.display(viewHolder.binding.dmItemIvIcon.getIconIv(), R.mipmap.logo);
viewHolder.binding.dmItemIvIcon.getIconDecoratorIv().setVisibility(View.GONE);

View File

@ -82,12 +82,13 @@ class NewInstalledGameFragmentAdapter(context: Context, private var mViewModel:
name = gameEntity.name
binding.gameIconView.displayGameIcon(
gameEntity.getRawIconInAdvanced(),
gameEntity.iconSubscript
gameEntity.iconSubscript,
gameEntity.iconFloat
)
binding.gameDes.text = gameEntity.brief
}
if (isSimulatorGame(gameEntity)) {
binding.gameIconView.displayGameIcon(gameEntity.icon, gameEntity.iconSubscript)
binding.gameIconView.displayGameIcon(gameEntity.icon, gameEntity.iconSubscript, gameEntity.iconFloat)
}
binding.gameName.text = name
generateExposureEvent(gameEntity)

View File

@ -168,7 +168,7 @@ class UpdatableGameAdapter(private var mViewModel: UpdatableGameViewModel) :
container.setBackgroundColor(R.color.background_white.toColor(context))
}
iconIv.displayGameIcon(update.rawIcon ?: update.icon, update.iconSubscript)
iconIv.displayGameIcon(update.rawIcon ?: update.icon, update.iconSubscript, update.iconFloat)
val nameText = if (!update.readablePlatform.isNullOrEmpty()) {
update.name + " - " + update.readablePlatform
} else {

View File

@ -586,6 +586,11 @@ class UpdatableGameViewModel(
downloadEntity.addMetaExtra(Constants.GAME_ICON_SUBSCRIPT, update.iconSubscript)
downloadEntity.addMetaExtra(Constants.DOWNLOAD_ID, downloadId)
downloadEntity.addMetaExtra(Constants.APK_MD5, update.md5)
if (update.iconFloat != null) {
downloadEntity.addMetaExtra(Constants.GAME_ICON_FLOAT_TOP_TEXT, update.iconFloat?.upperLeftText)
downloadEntity.addMetaExtra(Constants.GAME_ICON_FLOAT_TOP_COLOR, update.iconFloat?.upperLeftColor)
downloadEntity.addMetaExtra(Constants.GAME_ICON_FLOAT_BOTTOM_TEXT, update.iconFloat?.bottomText)
}
val platform = PlatformUtils.getInstance(getApplication()).getPlatformName(update.platform)
if ("官方版" != platform) {

View File

@ -1,6 +1,7 @@
package com.gh.gamecenter.entity
import android.os.Parcelable
import com.gh.gamecenter.common.entity.IconFloat
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.TagStyleEntity
import com.google.gson.annotations.SerializedName
@ -37,6 +38,8 @@ data class AmwayCommentEntity(
var subtitle: String? = "",
@SerializedName("subtitle_style")
var subtitleStyle: TagStyleEntity? = null,
@SerializedName("icon_float")
var iconFloat: IconFloat? = null,
// 曝光用的位置
var sequence: Int = 0,
@ -54,6 +57,7 @@ data class AmwayCommentEntity(
gameEntity.icon = icon
gameEntity.rawIcon = rawIcon
gameEntity.iconSubscript = iconSubscript
gameEntity.iconFloat = iconFloat
gameEntity.platform = ""
gameEntity.subtitle = subtitle ?: ""

View File

@ -1,6 +1,7 @@
package com.gh.gamecenter.entity
import com.gh.common.util.PackageUtils
import com.gh.gamecenter.common.entity.IconFloat
import com.gh.gamecenter.feature.entity.GameEntity
import com.google.gson.annotations.SerializedName
import com.halo.assistant.HaloApp
@ -12,6 +13,7 @@ data class GameInstall(
var name: String? = "",
var icon: String? = "",
var iconSubScript: String? = "",
var iconFloat: IconFloat? = null,
var isSignByGh: Boolean = false,
var installTime: Long = 0,
var version: String = "",
@ -29,6 +31,7 @@ data class GameInstall(
gameInstall.name = game.name
gameInstall.icon = game.rawIcon ?: game.icon
gameInstall.iconSubScript = game.iconSubscript
gameInstall.iconFloat = game.iconFloat
gameInstall.version = PackageUtils.getVersionNameByPackageName(installedPkgName) ?: "unknown"
gameInstall.packageName = installedPkgName
gameInstall.isSmoothGame = game.isVGame()

View File

@ -1,5 +1,6 @@
package com.gh.gamecenter.entity
import com.gh.gamecenter.common.entity.IconFloat
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.entity.*
import com.google.gson.annotations.SerializedName
@ -13,6 +14,8 @@ data class GameUpdateEntity(
var rawIcon: String? = null,
@SerializedName("icon_subscript")
var iconSubscript: String? = "",
@SerializedName("icon_float")
var iconFloat: IconFloat? = null,
@SerializedName("package")
var packageName: String = "",
var size: String? = null,
@ -60,6 +63,7 @@ data class GameUpdateEntity(
gameEntity.icon = icon
gameEntity.rawIcon = rawIcon
gameEntity.iconSubscript = iconSubscript
gameEntity.iconFloat = iconFloat
gameEntity.tagStyle = tagStyle
gameEntity.brief = brief
gameEntity.download = download

View File

@ -2,6 +2,7 @@ package com.gh.gamecenter.entity
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.gh.gamecenter.common.entity.IconFloat
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.TagStyleEntity
import com.google.gson.annotations.SerializedName
@ -12,6 +13,7 @@ data class HistoryGameEntity(
var id: String = "",
var icon: String? = null,
var iconSubscript: String? = null,
var iconFloat: IconFloat? = null,
var name: String? = null,
var brief: String? = null,
@ -36,6 +38,7 @@ data class HistoryGameEntity(
gameEntity.des = des
gameEntity.rawIcon = icon
gameEntity.iconSubscript = iconSubscript
gameEntity.iconFloat = iconFloat
gameEntity.subtitle = subtitle
gameEntity.subtitleStyle = subtitleStyle
gameEntity.name = name

View File

@ -5,6 +5,7 @@ import android.os.Parcelable
import com.gh.gamecenter.common.annotation.SyncPage
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.entity.CommunityEntity
import com.gh.gamecenter.common.entity.IconFloat
import com.gh.gamecenter.common.syncpage.SyncFieldConstants
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.core.utils.TimeUtils
@ -133,6 +134,8 @@ data class PersonalHistoryEntity(
var rawIcon: String? = null,
@SerializedName("icon_subscript")
var iconSubscript: String? = null,
@SerializedName("icon_float")
var iconFloat: IconFloat? = null,
@SerializedName("played_time")
val playedTime: Long = 0

View File

@ -342,8 +342,8 @@ class ForumDetailFragment : BaseLazyTabFragment(), IScrollable {
mBinding.forumThumbSmall.displayGameIcon(icon, null)
mBinding.forumThumbBig.displayGameIcon(icon, null)
} else {
mBinding.forumThumbSmall.displayGameIcon(game.getIcon(), game.iconSubscript)
mBinding.forumThumbBig.displayGameIcon(game.getIcon(), game.iconSubscript)
mBinding.forumThumbSmall.displayGameIcon(game.getIcon(), game.iconSubscript, game.iconFloat)
mBinding.forumThumbBig.displayGameIcon(game.getIcon(), game.iconSubscript, game.iconFloat)
}
mBinding.toolbar.setNavigationIcon(if (!mIsDarkModeOn) R.drawable.ic_bar_back else R.drawable.ic_bar_back_light)
mBinding.searchIv.setImageDrawable(

View File

@ -326,7 +326,11 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) :
if (entity.bbs.type == "official_bbs") {
forumIcon?.displayGameIcon(entity.bbs.icon, null)
} else {
forumIcon?.displayGameIcon(entity.bbs.game?.getIcon(), entity.bbs.game?.iconSubscript)
forumIcon?.displayGameIcon(
entity.bbs.game?.getIcon(),
entity.bbs.game?.iconSubscript,
entity.bbs.game?.iconFloat
)
}
forumNameTv.setOnClickListener {

View File

@ -48,7 +48,11 @@ class ForumRecordsAdapter(
if (forumEntity.type == "official_bbs") {
forumIv.displayGameIcon(forumEntity.icon, null)
} else {
forumIv.displayGameIcon(forumEntity.game.getIcon(), forumEntity.game.iconSubscript)
forumIv.displayGameIcon(
forumEntity.game.getIcon(),
forumEntity.game.iconSubscript,
forumEntity.game.iconFloat
)
}
root.setOnClickListener {

View File

@ -55,7 +55,11 @@ class HorizontalForumsAdapter(
if (forumEntity.type == "official_bbs") {
forumIv.displayGameIcon(forumEntity.icon, null)
} else {
forumIv.displayGameIcon(forumEntity.game.getIcon(), forumEntity.game.iconSubscript)
forumIv.displayGameIcon(
forumEntity.game.getIcon(),
forumEntity.game.iconSubscript,
forumEntity.game.iconFloat
)
}
followTv.run {

View File

@ -65,7 +65,11 @@ class ForumListAdapter(
if (forumEntity?.type == "official_bbs") {
forumIcon.displayGameIcon(forumEntity.icon, null)
} else {
forumIcon.displayGameIcon(forumEntity.game.getIcon(), forumEntity.game.iconSubscript)
forumIcon.displayGameIcon(
forumEntity.game.getIcon(),
forumEntity.game.iconSubscript,
forumEntity.game.iconFloat
)
}
topLine.visibility = if (position == 0) View.GONE else View.VISIBLE

View File

@ -1119,7 +1119,9 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
}
mBodyBinding.gamedetailTvName.isSelected = true
val ranking = mNewGameDetailEntity!!.ranking
if (ranking != null) {
val shouldShowRank =
(ranking != null && (mGameEntity?.iconFloat == null || mGameEntity?.iconFloat?.bottomText.isNullOrEmpty())) || (ranking != null && ranking.no.toInt() <= 10 && mGameEntity?.iconFloat != null && !mGameEntity?.iconFloat?.bottomText.isNullOrEmpty())
if (ranking != null && shouldShowRank) {
mBodyBinding.gameDetailRankLl.visibility = View.VISIBLE
mBodyBinding.gameDetailRankTv.text = "${ranking.columnName}${ranking.no}"
mBodyBinding.gameDetailRankTv.isSelected = true
@ -1134,7 +1136,9 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
}
}
BindingAdapters.setGame(mBodyBinding.gamedetailIvThumb, mGameEntity)
BindingAdapters.setGame(mBodyBinding.gamedetailIvThumb, mGameEntity?.apply {
if (shouldShowRank && iconFloat != null) iconFloat!!.bottomText = ""
})
BindingAdapters.setGame(mBodyBinding.gamedetailThumbSmall, mGameEntity)
mNewGameDetailEntity?.event?.let {

View File

@ -62,7 +62,11 @@ class MyRatingAdapter(
holder.binding.tvComment.setExpandMaxLines(maxDesLines)
holder.binding.tvComment.setIsExpanded(Int.MAX_VALUE == maxDesLines)
holder.binding.gameIcon.displayGameIcon(rating.game.getRawIconIfExisted(), rating.game.iconSubscript)
holder.binding.gameIcon.displayGameIcon(
rating.game.getRawIconIfExisted(),
rating.game.iconSubscript,
rating.game.iconFloat
)
val m = Pattern.compile(RatingEditActivity.LABEL_REGEX).matcher(rating.content)
if (m.find()) {

View File

@ -362,9 +362,9 @@ class ConcernAdapter extends BaseRecyclerAdapter<ViewHolder> {
viewHolder.setClickData(concernEntity);
if (concernEntity.getGame() != null) {
viewHolder.binding.newsDigestThumb.displayGameIcon(concernEntity.getGame().getIcon(), concernEntity.getGame().getIconSubscript());
viewHolder.binding.newsDigestThumb.displayGameIcon(concernEntity.getGame().getIcon(), concernEntity.getGame().getIconSubscript(), concernEntity.getGame().getIconFloat());
} else {
viewHolder.binding.newsDigestThumb.displayGameIcon(concernEntity.getGameIcon(), null);
viewHolder.binding.newsDigestThumb.displayGameIcon(concernEntity.getGameIcon(), null, concernEntity.getGame().getIconFloat());
}
viewHolder.binding.newsDigestTitle.setText(concernEntity.getGameName());

View File

@ -207,7 +207,7 @@ class Libao2FragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
holder.setClickData(libaoEntity);
ExtensionsKt.setRootBackgroundColor(holder.binding.getRoot(), R.color.background_white);
holder.binding.libaoName.setText(libaoEntity.getName());
holder.binding.libaoGameIcon.displayGameIcon(libaoEntity.getIcon(), libaoEntity.getIconSubscript());
holder.binding.libaoGameIcon.displayGameIcon(libaoEntity.getIcon(), libaoEntity.getIconSubscript(), libaoEntity.getGame().getIconFloat());
if (TextUtils.isEmpty(libaoEntity.getPlatform())) {
holder.binding.libaoGameName.setText(libaoEntity.getGame().getName());
} else {

View File

@ -205,7 +205,7 @@ class Libao3FragmentAdapter extends BaseRecyclerAdapter<RecyclerView.ViewHolder>
final LibaoEntity libaoEntity = mLibaoList.get(position);
ExtensionsKt.setRootBackgroundColor(holder.binding.getRoot(), R.color.background_white);
holder.binding.libaoName.setText(libaoEntity.getName());
holder.binding.libaoGameIcon.displayGameIcon(libaoEntity.getIcon(), libaoEntity.getIconSubscript());
holder.binding.libaoGameIcon.displayGameIcon(libaoEntity.getIcon(), libaoEntity.getIconSubscript(), libaoEntity.getGame().getIconFloat());
if (mFilter.equals("expires:false") && libaoEntity.getExpires() > 0) {
holder.binding.expiresTime.setVisibility(View.VISIBLE);
holder.binding.expiresTime.setText(String.format(Locale.CHINA, "%s过期", TimeUtils.getFormatTime(libaoEntity.getExpires(), "MM.dd")));

View File

@ -161,7 +161,7 @@ public class LibaoHistoryAdapter extends BaseRecyclerAdapter<ViewHolder> {
viewHolder.binding.libaoName.setText(libaoEntity.getName());
viewHolder.binding.libaoDes.setText(libaoEntity.getContent());
viewHolder.binding.libaoGameName.setText(libaoEntity.getGame().getName());
viewHolder.binding.libaoGameIcon.displayGameIcon(libaoEntity.getIcon(), libaoEntity.getIconSubscript());
viewHolder.binding.libaoGameIcon.displayGameIcon(libaoEntity.getIcon(), libaoEntity.getIconSubscript(), libaoEntity.getGame().getIconFloat());
//领取状态
if (TextUtils.isEmpty(libaoEntity.getStatus())) {

View File

@ -201,7 +201,11 @@ class LibaoNewAdapter(
.getPlatformName(libaoEntity.platform)
)
}
holder.binding.libaoGameIcon.displayGameIcon(libaoEntity.getIcon(), libaoEntity.getIconSubscript())
holder.binding.libaoGameIcon.displayGameIcon(
libaoEntity.getIcon(),
libaoEntity.getIconSubscript(),
libaoEntity.game?.iconFloat
)
val content: String
if (libaoEntity.content!!.contains("<br/>")) {

View File

@ -222,7 +222,11 @@ class LibaoSearchAdapter(
.getPlatformName(libaoEntity.platform)
)
}
holder.binding.libaoGameIcon.displayGameIcon(libaoEntity.getIcon(), libaoEntity.getIconSubscript())
holder.binding.libaoGameIcon.displayGameIcon(
libaoEntity.getIcon(),
libaoEntity.getIconSubscript(),
libaoEntity.game?.iconFloat
)
val content: String
if (libaoEntity.content!!.contains("<br/>")) {

View File

@ -23,7 +23,11 @@ class InstalledGameAdapter(mContext: Context, val games: ArrayList<GameInstall>)
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
val gameInstall = games[position]
holder.itemView.apply {
findViewById<GameIconView>(R.id.game_icon).displayGameIcon(gameInstall.icon, gameInstall.iconSubScript)
findViewById<GameIconView>(R.id.game_icon).displayGameIcon(
gameInstall.icon,
gameInstall.iconSubScript,
gameInstall.iconFloat
)
findViewById<TextView>(R.id.game_name).text = gameInstall.name
}
}

View File

@ -16,7 +16,11 @@ class PersonalItemViewHolder(val binding: CommunityAnswerItemBinding) :
if (entity.community.type == "official_bbs") {
forumIcon?.displayGameIcon(entity.community.icon, null)
} else {
forumIcon?.displayGameIcon(entity.community.game?.getIcon(), entity.community.game?.iconSubscript)
forumIcon?.displayGameIcon(
entity.community.game?.getIcon(),
entity.community.game?.iconSubscript,
entity.community.game?.iconFloat
)
}
forumNameContainer?.setOnClickListener {

View File

@ -80,7 +80,11 @@ class UserCommentHistoryAdapter(
holder.binding.tvComment.setExpandMaxLines(maxDesLines)
holder.binding.tvComment.setIsExpanded(Int.MAX_VALUE == maxDesLines)
holder.binding.gameIcon.displayGameIcon(rating.game.getRawIconIfExisted(), rating.game.iconSubscript)
holder.binding.gameIcon.displayGameIcon(
rating.game.getRawIconIfExisted(),
rating.game.iconSubscript,
rating.game.iconFloat
)
val m = Pattern.compile(RatingEditActivity.LABEL_REGEX).matcher(rating.content)
if (m.find()) {

View File

@ -136,7 +136,11 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
if (entity.bbs.type == "official_bbs") {
forumIcon?.displayGameIcon(entity.bbs.icon, null)
} else {
forumIcon?.displayGameIcon(entity.bbs.game?.getIcon(), entity.bbs.game?.iconSubscript)
forumIcon?.displayGameIcon(
entity.bbs.game?.getIcon(),
entity.bbs.game?.iconSubscript,
entity.bbs.game?.iconFloat
)
}
val contentType = when (entity.type) {

View File

@ -183,7 +183,7 @@ class ArticleDetailContentViewHolder(
val icon = if (!entity.icon.isNullOrEmpty()) entity.icon else entity.game?.getIcon()
val iconSubscript =
if (!entity.iconSubscript.isNullOrEmpty()) entity.iconSubscript else entity.game?.iconSubscript
forumIconView.displayGameIcon(icon, iconSubscript)
forumIconView.displayGameIcon(icon, iconSubscript, entity.game?.iconFloat)
forumContainer.setOnClickListener {
DirectUtils.directForumDetail(forumContainer.context, entity.id, "帖子详情")
LogUtils.uploadAccessToBbs(entity.id, "文章内所属论坛")

View File

@ -72,7 +72,7 @@ class ChooseForumContainerAdapter(
)
val icon = forumEntity.icon.ifEmpty { forumEntity.game.getIcon() }
holder.binding.forumIcon.displayGameIcon(icon, forumEntity.game.iconSubscript)
holder.binding.forumIcon.displayGameIcon(icon, forumEntity.game.iconSubscript, forumEntity.game.iconFloat)
holder.binding.followTv.visibility = View.GONE
holder.itemView.setOnClickListener {
val tabType = if (type == ChooseForumContainerFragment.ChooseForumType.SEARCH.value) "论坛tab" else ""

View File

@ -160,7 +160,7 @@ class QuestionDetailContentViewHolder(
val icon = if (!entity.icon.isNullOrEmpty()) entity.icon else entity.game?.getIcon()
val iconSubscript =
if (!entity.iconSubscript.isNullOrEmpty()) entity.iconSubscript else entity.game?.iconSubscript
forumIconView.displayGameIcon(icon, iconSubscript)
forumIconView.displayGameIcon(icon, iconSubscript, entity.game?.iconFloat)
forumContainer.setOnClickListener {
DirectUtils.directForumDetail(forumContainer.context, entity.id, "问题详情")
LogUtils.uploadAccessToBbs(entity.id, "文章内所属论坛")

View File

@ -0,0 +1,18 @@
package com.gh.gamecenter.room.converter
import androidx.room.TypeConverter
import com.gh.gamecenter.common.entity.IconFloat
import com.gh.gamecenter.common.utils.toJson
import com.gh.gamecenter.common.utils.toObject
class IconFloatConverter {
@TypeConverter
fun toIconFloatString(data: IconFloat?): String {
return data?.toJson() ?: ""
}
@TypeConverter
fun toIconFloat(token: String?): IconFloat {
return token?.toObject() ?: IconFloat()
}
}

View File

@ -214,7 +214,7 @@ class DetailPlayerView @JvmOverloads constructor(context: Context, attrs: Attrib
mBinding.gameIconView.displayGameIcon(
videoEntity.game?.rawIcon
?: videoEntity.gameIcon, videoEntity.game?.iconSubscript
?: videoEntity.gameIcon, videoEntity.game?.iconSubscript, videoEntity.game?.iconFloat
)
ImageUtils.display(mBinding.userIconIv, videoEntity.user.icon)
if (videoEntity.user.border.isNotEmpty()) {

View File

@ -74,7 +74,7 @@ class GameVideoActivity : ToolBarActivity() {
if (it.status == Status.SUCCESS) {
mBinding.gameIcon.displayGameIcon(
it.data?.game?.getIcon()
?: it.data?.gameIcon, it.data?.game?.iconSubscript
?: it.data?.gameIcon, it.data?.game?.iconSubscript, it.data?.game?.iconFloat
)
mBinding.gameName.text = it.data?.game?.name
mBinding.likeCount.text = NumberUtils.transSimpleCount(it.data?.likeCount ?: 0)

View File

@ -10,6 +10,7 @@ import com.gh.download.DownloadManager
import com.gh.gamecenter.R
import com.gh.gamecenter.common.baselist.DiffUtilAdapter
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.entity.IconFloat
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.GridSpacingItemColorDecoration
import com.gh.gamecenter.core.utils.ToastUtils
@ -115,9 +116,15 @@ class HomeRecentVGameAdapter(context: Context) : DiffUtilAdapter<VGameItemData>(
fun bindView(entity: VGameItemData) {
if (mBinding.gameIconIv.getTag(R.string.app_name) != entity.downloadEntity.packageName) {
val iconFloat = IconFloat(
entity.downloadEntity.getMetaExtra(Constants.GAME_ICON_FLOAT_TOP_TEXT),
entity.downloadEntity.getMetaExtra(Constants.GAME_ICON_FLOAT_TOP_COLOR),
entity.downloadEntity.getMetaExtra(Constants.GAME_ICON_FLOAT_BOTTOM_TEXT)
)
mBinding.gameIconIv.displayGameIcon(
entity.downloadEntity.getMetaExtra(Constants.RAW_GAME_ICON),
entity.downloadEntity.getMetaExtra(Constants.GAME_ICON_SUBSCRIPT)
entity.downloadEntity.getMetaExtra(Constants.GAME_ICON_SUBSCRIPT),
iconFloat
)
mBinding.gameIconIv.setTag(R.string.app_name, entity.downloadEntity.packageName)
}

View File

@ -774,6 +774,20 @@ object VHelper {
updateEntity.iconSubscript
)
originDownloadEntity.addMetaExtra(Constants.APK_MD5, updateEntity.md5)
if (updateEntity.iconFloat != null) {
originDownloadEntity.addMetaExtra(
Constants.GAME_ICON_FLOAT_TOP_TEXT,
updateEntity.iconFloat?.upperLeftText
)
originDownloadEntity.addMetaExtra(
Constants.GAME_ICON_FLOAT_TOP_COLOR,
updateEntity.iconFloat?.upperLeftColor
)
originDownloadEntity.addMetaExtra(
Constants.GAME_ICON_FLOAT_BOTTOM_TEXT,
updateEntity.iconFloat?.bottomText
)
}
PackageRepository.removeUpdate(updateEntity.id, true)
}