diff --git a/app/build.gradle b/app/build.gradle index 5b102e5dc7..4b76722ff7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ import groovy.xml.XmlUtil android { buildFeatures { - viewBinding = true - dataBinding = true + viewBinding true + dataBinding true } compileOptions { diff --git a/app/src/main/java/com/gh/common/databind/BindingAdapters.java b/app/src/main/java/com/gh/common/databind/BindingAdapters.java index 072ca0349b..19fc45a56e 100644 --- a/app/src/main/java/com/gh/common/databind/BindingAdapters.java +++ b/app/src/main/java/com/gh/common/databind/BindingAdapters.java @@ -16,7 +16,6 @@ import android.widget.TextView; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.core.content.ContextCompat; -import androidx.databinding.BindingAdapter; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import com.facebook.drawee.view.SimpleDraweeView; @@ -34,6 +33,7 @@ import com.gh.common.util.DataUtils; import com.gh.common.util.DialogUtils; import com.gh.common.util.DisplayUtils; import com.gh.common.util.DownloadDialogHelper; +import com.gh.common.util.ExtensionsKt; import com.gh.common.util.GameUtils; import com.gh.common.util.GameViewUtils; import com.gh.common.util.ImageUtils; @@ -84,22 +84,18 @@ import java.util.List; public class BindingAdapters { - @BindingAdapter("imageIcon") public static void loadIcon(SimpleDraweeView view, String imageUrl) { ImageUtils.displayIcon(view, imageUrl); } - @BindingAdapter("imageUrl") public static void loadImage(SimpleDraweeView view, String imageUrl) { ImageUtils.display(view, imageUrl); } - @BindingAdapter("setTextSize") public static void setTextSize(TextView view, int number) { view.setTextSize(number); } - @BindingAdapter("setTypeface") public static void setTypeface(TextView view, String type) { if (type == null) return; @@ -119,7 +115,6 @@ public class BindingAdapters { } } - @BindingAdapter({"addDetailKaiFuView", "addDetailKaiFuViewListener", "isReadyPatch"}) public static void addDetailKaiFuView(LinearLayout view, List list , OnViewClickListener listener, Boolean isReadyPatch) { if (list == null) return; @@ -127,13 +122,13 @@ public class BindingAdapters { for (int i = 0; i < list.size() + 1; i++) { // 1 is Title View inflate = LayoutInflater.from(view.getContext()).inflate(R.layout.kaifu_detail_item_row, null); KaifuDetailItemRowBinding binding = KaifuDetailItemRowBinding.bind(inflate); - binding.setIsCloseBottom(i == list.size()); - binding.setIsReadyPatch(isReadyPatch); - if (i == 0) { - binding.setIsTitle(true); - } else { - ServerCalendarEntity serverEntity = list.get(i - 1); - binding.setEntity(serverEntity); + binding.getRoot().setBackgroundColor(isReadyPatch ? ExtensionsKt.toColor(R.color.theme) : ExtensionsKt.toColor(R.color.white)); + binding.getRoot().setPadding(DisplayUtils.dip2px(1), DisplayUtils.dip2px(1), DisplayUtils.dip2px(1), i == list.size() ? DisplayUtils.dip2px(1) : 0); + ServerCalendarEntity serverEntity = list.get(i - 1); + binding.timeTv.setText(i == 0 ? "时间" : serverEntity.getFormatTime("HH:mm")); + binding.remarkTv.setText(i == 0 ? "备注" : serverEntity.getRemark()); + binding.nameTv.setText(i == 0 ? "名字" : (TextUtils.isEmpty(serverEntity.getNote()) ? "-" : serverEntity.getNote())); + if (i != 0) { binding.getRoot().setOnClickListener(v -> { listener.onClick(v, isReadyPatch != null && isReadyPatch ? serverEntity : null); }); @@ -155,12 +150,10 @@ public class BindingAdapters { } // 如果超过10000,则转换为1.0W - @BindingAdapter("transSimpleCount") public static void transSimpleCount(TextView view, int count) { view.setText(NumberUtils.transSimpleCount(count)); } - @BindingAdapter("textColorFromString") public static void textColorFromString(TextView tv, String hexString) { if (TextUtils.isEmpty(hexString)) return; @@ -171,7 +164,6 @@ public class BindingAdapters { } } - @BindingAdapter("visibleGone") public static void showHide(View view, Boolean show) { if (show != null && show) { view.setVisibility(View.VISIBLE); @@ -180,7 +172,6 @@ public class BindingAdapters { } } - @BindingAdapter("goneIf") public static void goneIf(View view, Boolean gone) { if (gone != null && gone) { view.setVisibility(View.GONE); @@ -192,7 +183,6 @@ public class BindingAdapters { /** * lazy 的 paddingTop */ - @BindingAdapter("lazyPaddingLeft") public static void lazyPaddingLeft(View view, int paddingLeftInDp) { view.setPadding(DisplayUtils.dip2px(paddingLeftInDp), view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom()); } @@ -200,7 +190,6 @@ public class BindingAdapters { /** * lazy 的 paddingTop */ - @BindingAdapter("lazyPaddingTop") public static void lazyPaddingTop(View view, int paddingTopInDp) { view.setPadding(view.getPaddingLeft(), DisplayUtils.dip2px(paddingTopInDp), view.getPaddingRight(), view.getPaddingBottom()); } @@ -208,12 +197,10 @@ public class BindingAdapters { /** * lazy 的 paddingBottom */ - @BindingAdapter("lazyPaddingBottom") public static void lazyPaddingBottom(View view, int paddingBottomInDp) { view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), DisplayUtils.dip2px(paddingBottomInDp)); } - @BindingAdapter("visibleInvisible") public static void visibleInvisible(View view, Boolean show) { if (show != null && show) { view.setVisibility(View.VISIBLE); @@ -222,7 +209,6 @@ public class BindingAdapters { } } - @BindingAdapter("messageUnread") public static void setMessageUnread(TextView view, int unreadCount) { if (unreadCount < 100) { view.setText(String.valueOf(unreadCount)); @@ -231,7 +217,6 @@ public class BindingAdapters { } } - @BindingAdapter("serverTypePadding") public static void setServerTypePadding(TextView view, String serverType) { int paddRight = 0; if (TextUtils.isEmpty(serverType)) { @@ -249,7 +234,6 @@ public class BindingAdapters { view.setPadding(0, 0, paddRight, 0); } - @BindingAdapter("serverType") public static void setServerType(TextView view, String serverType) { view.setText(serverType); if ("删档内测".equals(serverType) || "不删档内测".equals(serverType)) { @@ -259,26 +243,22 @@ public class BindingAdapters { } } - @BindingAdapter("game") public static void setGame(View view, GameEntity gameEntity) { if (gameEntity != null && view instanceof GameIconView) { ((GameIconView) view).displayGameIcon(gameEntity); } } - @BindingAdapter("gameIcon") public static void setGameIcon(View view, GameEntity gameEntity) { if (gameEntity != null && view instanceof GameIconView) { ((GameIconView) view).displayGameIcon(gameEntity.getIcon(), gameEntity.getIconSubscript()); } } - @BindingAdapter("articleType") public static void setArticleType(TextView view, String articleType) { NewsUtils.setNewsType(view, articleType, 0, 0); } - @BindingAdapter("detailDownloadText") public static void setDetailDownloadText(TextView view, GameEntity gameEntity) { if (gameEntity == null || gameEntity.getApk().isEmpty()) { view.setBackgroundResource(R.drawable.game_item_btn_pause_style); @@ -287,7 +267,6 @@ public class BindingAdapters { } } - @BindingAdapter("liBaoBtn") public static void setLiBaoBtn(TextView view, String status) { if (TextUtils.isEmpty(status)) return; switch (status) { @@ -352,7 +331,6 @@ public class BindingAdapters { } // 大图下的进度条 - @BindingAdapter({"downloadButton", "traceEvent", "clickCallBack", "entrance", "location"}) public static void setDownloadButton(DownloadProgressBar progressBar, GameEntity gameEntity, ExposureEvent traceEvent, @@ -692,13 +670,11 @@ public class BindingAdapters { } } - @BindingAdapter("gameLabelList") public static void setGameLabelList(LinearLayout layout, List tagStyle) { GameViewUtils.setLabelList(layout.getContext(), layout, tagStyle); } // 包含测试开服标签 - @BindingAdapter("setGameTags") public static void setGameTags(LinearLayout layout, GameEntity gameEntity) { try { if (layout.getVisibility() == View.GONE) return; @@ -739,7 +715,6 @@ public class BindingAdapters { } } - @BindingAdapter("setVideoDetailGameTags") public static void setVideoDetailGameTags(LinearLayout layout, GameEntity gameEntity) { try { ArrayList tagStyle = new ArrayList<>(); @@ -767,14 +742,12 @@ public class BindingAdapters { } } - @BindingAdapter("isRefreshing") public static void isRefreshing(SwipeRefreshLayout layout, LoadStatus status) { if (status != LoadStatus.INIT_LOADING && status != LoadStatus.LIST_LOADING) { layout.setRefreshing(false); } } - @BindingAdapter({"setGameName", "isShowPlatform", "isShowSuffix"}) public static void setGameName(TextView view, GameEntity game, boolean isShowPlatform, @Nullable Boolean isShowSuffix) { if (isShowSuffix == null) isShowSuffix = true; // 默认显示 if (isShowPlatform && game.getApk().size() > 0) { @@ -787,7 +760,6 @@ public class BindingAdapters { } - @BindingAdapter({"setCommunityImage", "setCommunityVideoImage"}) public static void setCommunityImage(SimpleDraweeView imageView, List images, List videos) { if (videos.size() > 0) { CommunityVideoEntity videoEntity = videos.get(0); @@ -801,7 +773,6 @@ public class BindingAdapters { } } - @BindingAdapter({"setCommunityVideoDuration"}) public static void setCommunityVideoDuration(TextView mVideoDuration, List videos) { if (videos != null && videos.size() > 0) { CommunityVideoEntity videoEntity = videos.get(0); @@ -813,7 +784,6 @@ public class BindingAdapters { } } - @BindingAdapter({"setGameTags", "setMaxGameTags"}) public static void setGameTags(TextView view, List tags, int maxTags) { if (tags == null) { view.setText(""); @@ -842,7 +812,6 @@ public class BindingAdapters { view.setText(span); } - @BindingAdapter({"setVideoData"}) public static void setVideoData(TextView view, int count) { if (count > 0) { view.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(view.getContext(), R.drawable.ic_video_data_up), null, null, null); diff --git a/app/src/main/java/com/gh/common/databind/DrawablesBindingAdapter.java b/app/src/main/java/com/gh/common/databind/DrawablesBindingAdapter.java index 4c65d4dc2b..3d8cad32d4 100644 --- a/app/src/main/java/com/gh/common/databind/DrawablesBindingAdapter.java +++ b/app/src/main/java/com/gh/common/databind/DrawablesBindingAdapter.java @@ -1,5 +1,8 @@ package com.gh.common.databind; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.PARAMETER; + import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.graphics.drawable.GradientDrawable; @@ -7,18 +10,14 @@ import android.graphics.drawable.InsetDrawable; import android.graphics.drawable.StateListDrawable; import android.view.View; +import androidx.annotation.ColorInt; +import androidx.annotation.IntDef; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.lang.reflect.Field; -import androidx.annotation.ColorInt; -import androidx.annotation.IntDef; -import androidx.databinding.BindingAdapter; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.PARAMETER; - public class DrawablesBindingAdapter { private static final String TAG = "Drawables"; @@ -27,7 +26,7 @@ public class DrawablesBindingAdapter { // normal, checked, checkable, enabled, focused, pressed, selected - @BindingAdapter(value = { + /*@BindingAdapter(value = { "drawable_shapeMode", "drawable_solidColor", "drawable_strokeColor", @@ -248,7 +247,7 @@ public class DrawablesBindingAdapter { "drawable_pressed", "drawable_selected", - }, requireAll = false) + }, requireAll = false)*/ public static void setViewBackground( View view, diff --git a/app/src/main/java/com/gh/common/dialog/PackageCheckDialogFragment.kt b/app/src/main/java/com/gh/common/dialog/PackageCheckDialogFragment.kt index 590a036af1..558547b06e 100644 --- a/app/src/main/java/com/gh/common/dialog/PackageCheckDialogFragment.kt +++ b/app/src/main/java/com/gh/common/dialog/PackageCheckDialogFragment.kt @@ -62,9 +62,11 @@ class PackageCheckDialogFragment : BaseDialogFragment() { detectionObjects?.forEach { detectionObject -> if (detectionObject.packages.contains(packageName)) { val packageLink = gameEntity?.packageDialog?.links?.find { it.buttonLink } - LogUtils.uploadPackageCheck("pkg_check_pop_download", if (DownloadStatus.add == downloadEntity.status) "下载开始" else "下载完成", - gameEntity, packageLink?.text ?: "", packageLink?.title - ?: "", downloadEntity.gameId, downloadEntity.getMetaExtra(Constants.GAME_NAME)) + LogUtils.uploadPackageCheck( + "pkg_check_pop_download", if (DownloadStatus.add == downloadEntity.status) "下载开始" else "下载完成", + gameEntity, packageLink?.text ?: "", packageLink?.title + ?: "", downloadEntity.gameId, downloadEntity.getMetaExtra(Constants.GAME_NAME) + ) } } } @@ -98,8 +100,10 @@ class PackageCheckDialogFragment : BaseDialogFragment() { val spanBuilder = SpanBuilder(it.linkHintText).build() it.links.forEachIndexed { index, link -> - val linkSpan = SpanBuilder(link.title ?: "").click(0, (link.title - ?: "").length, R.color.theme_font, true) { + val linkSpan = SpanBuilder(link.title ?: "").click( + 0, (link.title + ?: "").length, R.color.theme_font, true + ) { LogUtils.uploadPackageCheck("pkg_check_pop_click", "点击链接", gameEntity, link.text, link.title, "", "") DirectUtils.directToLinkPage(requireContext(), link, "包名检测弹窗", "") }.build() @@ -205,6 +209,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() { if (it >= mDuration) { mDisposable?.dispose() binding.downloadBtn.isEnabled = true + binding.downloadBtn.background = R.drawable.bg_notification_open_btn_style_2.toDrawable() } } val animator = ValueAnimator.ofInt(0, 100) @@ -273,7 +278,8 @@ class PackageCheckDialogFragment : BaseDialogFragment() { } } - inner class PackageCheckAdapter(val context: Context, val entities: ArrayList) : BaseRecyclerAdapter(context) { + inner class PackageCheckAdapter(val context: Context, val entities: ArrayList) : + BaseRecyclerAdapter(context) { private var index = -1 fun notifyPackages() { @@ -282,7 +288,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() { } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { - return PackageCheckViewHolder(PackageCheckItemBinding.bind(LayoutInflater.from(context).inflate(R.layout.package_check_item, parent, false))) + return PackageCheckViewHolder(parent.toBinding()) } override fun getItemCount(): Int = entities.size @@ -290,7 +296,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() { override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { if (holder is PackageCheckViewHolder) { val entity = entities[position] - holder.binding.entity = entity + holder.binding.gameNameTv.text = entity.text if (position <= index) { val isAllInstalled = checkDetectionsInstalled(mAllInstalledPackages, entity.packages) if (isAllInstalled) { @@ -339,7 +345,8 @@ class PackageCheckDialogFragment : BaseDialogFragment() { if (!activity.lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)) return - var dialogFragment = activity.supportFragmentManager.findFragmentByTag(PackageCheckDialogFragment::class.java.simpleName) as? PackageCheckDialogFragment + var dialogFragment = + activity.supportFragmentManager.findFragmentByTag(PackageCheckDialogFragment::class.java.simpleName) as? PackageCheckDialogFragment if (dialogFragment == null) { dialogFragment = PackageCheckDialogFragment() dialogFragment.gameEntity = gameEntity diff --git a/app/src/main/java/com/gh/common/util/DialogUtils.java b/app/src/main/java/com/gh/common/util/DialogUtils.java index 7f9d2f8020..892dfc7313 100644 --- a/app/src/main/java/com/gh/common/util/DialogUtils.java +++ b/app/src/main/java/com/gh/common/util/DialogUtils.java @@ -44,13 +44,9 @@ import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.core.content.ContextCompat; -import androidx.databinding.DataBindingUtil; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import kotlin.Unit; -import kotlin.jvm.functions.Function0; - import com.facebook.drawee.generic.GenericDraweeHierarchy; import com.facebook.drawee.view.SimpleDraweeView; import com.gh.common.AppExecutor; @@ -81,6 +77,7 @@ import com.gh.gamecenter.entity.ApkEntity; import com.gh.gamecenter.entity.Badge; import com.gh.gamecenter.entity.BadgeEntity; import com.gh.gamecenter.entity.GameEntity; +import com.gh.gamecenter.entity.PermissionsEntity; import com.gh.gamecenter.entity.PrivacyPolicyEntity; import com.gh.gamecenter.entity.SettingsEntity; import com.gh.gamecenter.entity.SimpleGameEntity; @@ -101,6 +98,9 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; +import kotlin.Unit; +import kotlin.jvm.functions.Function0; + public class DialogUtils { public static Dialog showWaitDialog(Context context, String msg) { @@ -998,7 +998,10 @@ public class DialogUtils { if (holder instanceof PrivacyPolicyItemViewHolder) { PrivacyPolicyItemViewHolder viewHolder = (PrivacyPolicyItemViewHolder) holder; PrivacyItemBinding binding = viewHolder.getBinding(); - binding.setData(entity.getPermissions().get(position)); + final PermissionsEntity permissionsEntity = entity.getPermissions().get(position); + ImageUtils.display(binding.icon, permissionsEntity.getIcon()); + binding.name.setText(permissionsEntity.getName()); + binding.intro.setText(permissionsEntity.getIntro()); GenericDraweeHierarchy hierarchy = binding.icon.getHierarchy(); if (hierarchy != null) { if (position == 0) { @@ -1397,11 +1400,12 @@ public class DialogUtils { } else { final Dialog dialog = new Dialog(context, R.style.GhAlertDialog); - DialogOverseaConfirmationBinding binding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.dialog_oversea_confirmation, null, false); + DialogOverseaConfirmationBinding binding = DialogOverseaConfirmationBinding.inflate(LayoutInflater.from(context), null, false); View contentView = binding.getRoot(); - binding.setGame(gameEntity); + binding.gameIcon.displayGameIcon(gameEntity); + binding.gameNameTv.setText(context.getString(R.string.dialog_oversea_hint, gameEntity.getName())); binding.urlTv.setText(gameEntity.getOverseasAddressDialog().getLink()); binding.closeIv.setOnClickListener(v -> dialog.dismiss()); binding.downloadBtn.setText("下载(" + gameEntity.getApk().get(0).getSize() + ")"); @@ -1457,10 +1461,11 @@ public class DialogUtils { continue; } View item = LayoutInflater.from(context).inflate(R.layout.imprint_content_item, null); - ImprintContentItemBinding bind = DataBindingUtil.bind(item); - bind.setApk(apk); + ImprintContentItemBinding bind = ImprintContentItemBinding.bind(item); String platform = TextUtils.isEmpty(apk.getRemark()) ? apk.getPlatformName() : apk.getPlatformName() + "\n" + apk.getRemark(); - bind.setPlatformName(platform); + bind.imprintPlatform.setText(platform); + bind.imprintVersion.setText(apk.getVersion()); + bind.imprintTime.setText(NewsUtils.getFormattedTime(apk.getTime() != null ? apk.getTime() : 0)); content.addView(item, LinearLayout.LayoutParams.MATCH_PARENT, DisplayUtils.dip2px(40)); } @@ -2213,7 +2218,7 @@ public class DialogUtils { dialog.show(); } - public static void showReserveSuccess2WechatBindDialog(Context context, ConfirmListener confirmListener,CancelListener cancelListener) { + public static void showReserveSuccess2WechatBindDialog(Context context, ConfirmListener confirmListener, CancelListener cancelListener) { context = checkDialogContext(context); final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent); diff --git a/app/src/main/java/com/gh/common/view/ReserveDialog.kt b/app/src/main/java/com/gh/common/view/ReserveDialog.kt index 94c6ddb87f..39fbc96ca8 100644 --- a/app/src/main/java/com/gh/common/view/ReserveDialog.kt +++ b/app/src/main/java/com/gh/common/view/ReserveDialog.kt @@ -4,11 +4,11 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.RecyclerView import com.gh.base.BaseRecyclerViewHolder import com.gh.base.fragment.BaseDialogFragment +import com.gh.common.util.ImageUtils import com.gh.common.util.fromHtml import com.gh.gamecenter.GameDetailActivity import com.gh.gamecenter.R @@ -23,8 +23,8 @@ class ReserveDialog : BaseDialogFragment() { private lateinit var mReserveList: List private var mDismissListener: (() -> Unit)? = null - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - val binding: DialogReserveBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_reserve, container, false) + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { + val binding: DialogReserveBinding = DialogReserveBinding.inflate(layoutInflater, null, false) mReserveList = arguments?.getParcelableArrayList(RESERVE_LIST) ?: arrayListOf() @@ -54,7 +54,8 @@ class ReserveDialog : BaseDialogFragment() { override fun onBindViewHolder(holder: ReserveDialogItemViewHolder, position: Int) { val entity = mReserveList[position] - holder.binding.game = entity + ImageUtils.display(holder.binding.icon, entity.icon) + holder.binding.gameNameTv.text = entity.name holder.itemView.setOnClickListener { GameDetailActivity.startGameDetailActivity(mContext, entity.id, "(预约弹窗)") dismissAllowingStateLoss() diff --git a/app/src/main/java/com/gh/download/dialog/DownloadDialog.kt b/app/src/main/java/com/gh/download/dialog/DownloadDialog.kt index 99caf1fd2d..1b259997ff 100644 --- a/app/src/main/java/com/gh/download/dialog/DownloadDialog.kt +++ b/app/src/main/java/com/gh/download/dialog/DownloadDialog.kt @@ -3,10 +3,11 @@ package com.gh.download.dialog import android.annotation.SuppressLint import android.content.Context import android.os.Bundle -import android.view.* +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup import android.view.animation.Animation import android.view.animation.AnimationUtils -import androidx.databinding.DataBindingUtil import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentActivity import androidx.lifecycle.Observer @@ -32,7 +33,6 @@ import com.lightgame.utils.AppManager import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.Subscribe import org.greenrobot.eventbus.ThreadMode -import java.util.* class DownloadDialog : BaseDraggableDialogFragment() { @@ -62,17 +62,20 @@ class DownloadDialog : BaseDraggableDialogFragment() { private val mDataWatcher = object : DataWatcher() { override fun onDataChanged(downloadEntity: DownloadEntity) { if (downloadEntity.gameId == mGameEntity?.id && - DownloadStatus.delete != DownloadManager.getInstance().getStatus(downloadEntity.url)) { + DownloadStatus.delete != DownloadManager.getInstance().getStatus(downloadEntity.url) + ) { mAdapter?.listData?.forEachIndexed { index, entity -> if (entity.normal?.packageName == downloadEntity.packageName - || entity.installed?.packageName == downloadEntity.packageName) { + || entity.installed?.packageName == downloadEntity.packageName + ) { mAdapter?.notifyItemChanged(index) } } mCollectionAdapter?.listData?.forEachIndexed { index, entity -> if (entity.normal?.packageName == downloadEntity.packageName - || entity.installed?.packageName == downloadEntity.packageName) { + || entity.installed?.packageName == downloadEntity.packageName + ) { mCollectionAdapter?.notifyItemChanged(index) } } @@ -146,8 +149,8 @@ class DownloadDialog : BaseDraggableDialogFragment() { } @SuppressLint("ClickableViewAccessibility") - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - mBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_download, container, false) + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { + mBinding = DialogDownloadBinding.bind(layoutInflater.inflate(R.layout.dialog_download, container, false)) mBinding.title.text = ("选择下载" + mGameEntity.pluginDesc + "版本") val downloadNotice = mGameEntity.downloadAd @@ -159,9 +162,10 @@ class DownloadDialog : BaseDraggableDialogFragment() { DialogUtils.showImprintDialog(requireContext(), mGameEntity, downloadNotice.title) } else { DirectUtils.directToLinkPage( - requireContext(), - downloadNotice, - mEntrance, "下载多平台弹窗") + requireContext(), + downloadNotice, + mEntrance, "下载多平台弹窗" + ) } // MtaHelper.onEvent(MTA_KEY, "点击", mViewModel.gameEntity.name + "_" + downloadNotice.title) } diff --git a/app/src/main/java/com/gh/download/dialog/DownloadDialogAdapter.kt b/app/src/main/java/com/gh/download/dialog/DownloadDialogAdapter.kt index 5631cdd6ec..ff05bd25a0 100644 --- a/app/src/main/java/com/gh/download/dialog/DownloadDialogAdapter.kt +++ b/app/src/main/java/com/gh/download/dialog/DownloadDialogAdapter.kt @@ -1,15 +1,13 @@ package com.gh.download.dialog import android.content.Context +import android.graphics.drawable.GradientDrawable import android.view.View import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import com.gh.base.OnViewClickListener import com.gh.common.exposure.ExposureEvent -import com.gh.common.util.DirectUtils -import com.gh.common.util.MtaHelper -import com.gh.common.util.dip2px -import com.gh.common.util.throwExceptionInDebug +import com.gh.common.util.* import com.gh.gamecenter.NewsDetailActivity import com.gh.gamecenter.QaActivity import com.gh.gamecenter.R @@ -18,13 +16,15 @@ import com.gh.gamecenter.entity.GameEntity import com.lightgame.adapter.BaseRecyclerAdapter import com.lightgame.utils.Utils -class DownloadDialogAdapter(context: Context, - val viewModel: DownloadViewModel, - val listData: List, - val isCollectionPage: Boolean, - private val mTraceEvent: ExposureEvent?, - private val mEntrance: String, - private val mLocation: String) : BaseRecyclerAdapter(context) { +class DownloadDialogAdapter( + context: Context, + val viewModel: DownloadViewModel, + val listData: List, + val isCollectionPage: Boolean, + private val mTraceEvent: ExposureEvent?, + private val mEntrance: String, + private val mLocation: String +) : BaseRecyclerAdapter(context) { private val mPath = if (isCollectionPage) { "下载弹窗-二级页" @@ -83,11 +83,13 @@ class DownloadDialogAdapter(context: Context, } else 0 holder.binding.root.layoutParams = this } - holder.binding.type = listData[position].section + val section = listData[position].section + holder.binding.title.text = if (section == DownloadDialogSectionType.OTHER) "其它版本" else "我的版本" + holder.binding.otherVersionHint.goneIf(section != DownloadDialogSectionType.OTHER) } is DownloadDialogLinkItemViewHolder -> { - holder.binding.links = listData[position].links - holder.binding.clickListener = OnViewClickListener { _, data -> + val links = listData[position].links + val clickListener = OnViewClickListener { _, data -> when (data.linkType) { "dialog" -> { DownloadLinkDialog.showDownloadDialog(mContext, data) @@ -109,6 +111,28 @@ class DownloadDialogAdapter(context: Context, // MtaHelper.onEvent(DownloadDialog.MTA_KEY, "点击", viewModel.gameEntity.name + "_" + data.title) } + holder.binding.run { + links?.let { + leftLink.setOnClickListener { view -> + clickListener.onClick(view, links[0]) + } + rightLink.setOnClickListener { view -> + clickListener.onClick(view, links[1]) + } + } + leftLink.visibleIf(!links.isNullOrEmpty()) + rightLink.visibleIf(links?.size ?:0 > 1) + leftLink.text = if (links.isNullOrEmpty()) "" else links[0].title + rightLink.text = if (links?.size ?: 0 > 1) links?.get(1)?.title else "" + leftLink.background = GradientDrawable().apply { + cornerRadius = 8F.dip2px().toFloat() + setStroke(0.5F.dip2px(), R.color.divider.toColor()) + } + rightLink.background = GradientDrawable().apply { + cornerRadius = 8F.dip2px().toFloat() + setStroke(0.5F.dip2px(), R.color.divider.toColor()) + } + } } is DownloadDialogInstructionItemViewHolder -> { holder.bindItem(listData, position, mEntrance) diff --git a/app/src/main/java/com/gh/download/dialog/DownloadDialogInstalledItemViewHolder.kt b/app/src/main/java/com/gh/download/dialog/DownloadDialogInstalledItemViewHolder.kt index b9a7cd0e0b..968a7251fc 100644 --- a/app/src/main/java/com/gh/download/dialog/DownloadDialogInstalledItemViewHolder.kt +++ b/app/src/main/java/com/gh/download/dialog/DownloadDialogInstalledItemViewHolder.kt @@ -4,10 +4,7 @@ import android.view.View import com.gh.base.BaseRecyclerViewHolder import com.gh.common.constant.Config import com.gh.common.exposure.ExposureEvent -import com.gh.common.util.PackageUtils -import com.gh.common.util.goneIf -import com.gh.common.util.throwExceptionInDebug -import com.gh.common.util.toColor +import com.gh.common.util.* import com.gh.download.DownloadManager import com.gh.gamecenter.R import com.gh.gamecenter.databinding.DownloadDialogInstalledItemBinding @@ -16,15 +13,28 @@ import com.lightgame.download.DownloadStatus class DownloadDialogInstalledItemViewHolder(val binding: DownloadDialogInstalledItemBinding) : BaseRecyclerViewHolder(binding.root) { - fun bindInstalledItem(apkEntity: ApkEntity, viewModel: DownloadViewModel, traceEvent: ExposureEvent?, entrance: String, path: String, location: String) { + fun bindInstalledItem( + apkEntity: ApkEntity, + viewModel: DownloadViewModel, + traceEvent: ExposureEvent?, + entrance: String, + path: String, + location: String + ) { val gameEntity = viewModel.gameEntity val apkCollection = apkEntity.apkCollection - binding.pluginDesc = gameEntity.pluginDesc - binding.apk = if (apkCollection != null) { + val pluginDesc = gameEntity.pluginDesc + val apk = if (apkCollection != null) { ApkEntity(platformIcon = apkCollection.newIcon, platformName = apkCollection.name, remark = apkCollection.remark) } else apkEntity + ImageUtils.display(binding.icon, apk.getPlatformIcon()) + binding.name.text = apk.getPlatformName() + binding.remark.text = apk.remark binding.root.setBackgroundResource(R.drawable.download_dialog_item_background) + binding.launch.text = "启动${pluginDesc}版" + binding.pluggable.text = "${pluginDesc}此版本" + binding.update.text = "更新${pluginDesc}版" if (apkEntity.apkLink != null) { throwExceptionInDebug("apkLink 不应该出现在这里") @@ -132,6 +142,5 @@ class DownloadDialogInstalledItemViewHolder(val binding: DownloadDialogInstalled } DownloadDialogItemViewHolder.setDownloadClickListener(itemView, apkEntity, viewModel, traceEvent, entrance, path, location) - binding.executePendingBindings() } } \ No newline at end of file diff --git a/app/src/main/java/com/gh/download/dialog/DownloadDialogItemViewHolder.kt b/app/src/main/java/com/gh/download/dialog/DownloadDialogItemViewHolder.kt index aec082686a..1e079eff9f 100644 --- a/app/src/main/java/com/gh/download/dialog/DownloadDialogItemViewHolder.kt +++ b/app/src/main/java/com/gh/download/dialog/DownloadDialogItemViewHolder.kt @@ -32,32 +32,45 @@ import com.lightgame.utils.Utils class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : BaseRecyclerViewHolder(binding.root) { - fun bindItem(listData: List, - position: Int, - viewModel: DownloadViewModel, - isCollectionPage: Boolean, - traceEvent: ExposureEvent?, - entrance: String, - path: String, - location: String) { + fun bindItem( + listData: List, + position: Int, + viewModel: DownloadViewModel, + isCollectionPage: Boolean, + traceEvent: ExposureEvent?, + entrance: String, + path: String, + location: String + ) { val apkEntity = listData[position].normal!! val gameEntity = viewModel.gameEntity val apkLink = apkEntity.apkLink val apkCollection = apkEntity.apkCollection - binding.apk = when { + val apk = when { apkLink != null -> ApkEntity( - platformIcon = apkLink.icon, - platformName = apkLink.name, - remark = apkLink.remark) + platformIcon = apkLink.icon, + platformName = apkLink.name, + remark = apkLink.remark + ) apkCollection != null -> ApkEntity( - platformIcon = apkCollection.newIcon, - platformName = apkCollection.name, - recommend = apkCollection.recommend, - remark = apkCollection.remark) + platformIcon = apkCollection.newIcon, + platformName = apkCollection.name, + recommend = apkCollection.recommend, + remark = apkCollection.remark + ) else -> apkEntity } + ImageUtils.display(binding.icon, apk.getPlatformIcon()) + binding.name.text = apk.getPlatformName() + binding.remark.text = apk.remark + binding.recommendDesTv.goneIf(apk.recommend == null) + binding.recommendDesTv.text = apk.recommend?.description + binding.recommendLabel.goneIf(apk.recommend == null) + binding.recommendLabelTv.text = apk.recommend?.subscript + + binding.containerView.setBackgroundResource(R.drawable.download_dialog_item_background) binding.status.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null) changeRecommendUI(apkEntity, listData, position) @@ -70,7 +83,12 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas binding.remark.goneIf(apkLink.remark.isEmpty()) binding.status.text = "点击查看" - binding.status.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(binding.status.context, R.drawable.download_dialog_collection_status_link), null) + binding.status.setCompoundDrawablesWithIntrinsicBounds( + null, + null, + ContextCompat.getDrawable(binding.status.context, R.drawable.download_dialog_collection_status_link), + null + ) binding.containerView.setBackgroundResource(R.drawable.download_dialog_installed_background) itemView.setTag(DownloadDialogAdapter.ITEM_TAG_KEY, DownloadDialogItemStatus.LINK) } else if (apkCollection != null || (!isCollectionPage && apkEntity.downloadInstruction.isNotEmpty())) { @@ -119,11 +137,17 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas binding.status.visibility = View.VISIBLE binding.status.text = "可更新" - binding.status.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(binding.status.context, R.drawable.download_dialog_collection_status_update), null) + binding.status.setCompoundDrawablesWithIntrinsicBounds( + null, + null, + ContextCompat.getDrawable(binding.status.context, R.drawable.download_dialog_collection_status_update), + null + ) binding.downloadStatusIcon.visibility = View.GONE itemView.setTag(DownloadDialogAdapter.ITEM_TAG_KEY, DownloadDialogItemStatus.UPDATE) } else if (PackageUtils.getGhId(apkEntity.packageName) == gameEntity.id || - PackagesManager.isInstalled(apkEntity.packageName) && Config.getSettings()?.gameDownloadBlackList?.contains(apkEntity.packageName) == true) { + PackagesManager.isInstalled(apkEntity.packageName) && Config.getSettings()?.gameDownloadBlackList?.contains(apkEntity.packageName) == true + ) { binding.downloadStatusIcon.visibility = View.GONE binding.status.visibility = View.VISIBLE binding.containerView.setBackgroundResource(R.drawable.download_dialog_installed_background) @@ -143,7 +167,12 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas // 点击启动 binding.status.text = "点击启动" itemView.setTag(DownloadDialogAdapter.ITEM_TAG_KEY, DownloadDialogItemStatus.LAUNCH) - binding.status.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(binding.status.context, R.drawable.download_dialog_collection_status_launch), null) + binding.status.setCompoundDrawablesWithIntrinsicBounds( + null, + null, + ContextCompat.getDrawable(binding.status.context, R.drawable.download_dialog_collection_status_launch), + null + ) } } else { binding.downloadStatusIcon.visibility = View.VISIBLE @@ -160,7 +189,6 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas } setDownloadClickListener(itemView, apkEntity, viewModel, traceEvent, entrance, path, location) - binding.executePendingBindings() } private fun changeRecommendUI(apkEntity: ApkEntity, listData: List, position: Int) { @@ -171,7 +199,8 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas (binding.root.layoutParams as RecyclerView.LayoutParams).apply { bottomMargin = if (apkEntity.recommend != null) { if ((position + 1 < listData.size && listData[position + 1].normal?.recommend == null) || - (position + 2 < listData.size && listData[position + 2].normal?.recommend == null)) { + (position + 2 < listData.size && listData[position + 2].normal?.recommend == null) + ) { 20f.dip2px() } else 16f.dip2px() } else 8f.dip2px() @@ -192,13 +221,15 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas } } - fun setDownloadClickListener(itemView: View, - apkEntity: ApkEntity, - viewModel: DownloadViewModel, - traceEvent: ExposureEvent?, - entrance: String, - path: String, - location: String) { + fun setDownloadClickListener( + itemView: View, + apkEntity: ApkEntity, + viewModel: DownloadViewModel, + traceEvent: ExposureEvent?, + entrance: String, + path: String, + location: String + ) { val gameEntity = viewModel.gameEntity itemView.setOnClickListener { @@ -215,10 +246,13 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas } DownloadDialogItemStatus.DOWNLOADING -> { // 打开下载管理界面 - it.context.startActivity(DownloadManagerActivity.getDownloadMangerIntent( + it.context.startActivity( + DownloadManagerActivity.getDownloadMangerIntent( it.context, apkEntity.url, - BaseActivity.mergeEntranceAndPath(entrance, path))) + BaseActivity.mergeEntranceAndPath(entrance, path) + ) + ) if (AppManager.getInstance().currentActivity() is DownloadManagerActivity) { viewModel.dismissLiveData.postValue(Any()) } @@ -237,7 +271,7 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas } DownloadDialogItemStatus.INSTALL -> { val downloadEntity = DownloadManager.getInstance().getDownloadEntityByUrl(apkEntity.url) - ?: return@setOnClickListener + ?: return@setOnClickListener if (FileUtils.isEmptyFile(downloadEntity.path)) { Utils.toast(it.context, R.string.install_failure_hint) @@ -300,13 +334,15 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas } } - private fun createDownloadTask(context: Context, - apkEntity: ApkEntity, - gameEntity: GameEntity, - downloadMethod: String, - traceEvent: ExposureEvent?, - entrance: String, - location: String) { + private fun createDownloadTask( + context: Context, + apkEntity: ApkEntity, + gameEntity: GameEntity, + downloadMethod: String, + traceEvent: ExposureEvent?, + entrance: String, + location: String + ) { // todo 有时间存储判断统一处理 val msg = FileUtils.isCanDownload(context, apkEntity.size) if (msg.isNullOrEmpty()) { @@ -318,13 +354,14 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas CertificationDialog.showCertificationDialog(context, gameEntity, DialogUtils.ConfirmListener { DialogUtils.checkDownload(context, apkEntity.size) { isSubscribe -> DownloadManager.createDownload( - context, - apkEntity, - gameEntity, - downloadMethod, - entrance, - location, - isSubscribe, traceEvent) + context, + apkEntity, + gameEntity, + downloadMethod, + entrance, + location, + isSubscribe, traceEvent + ) DeviceRemindDialog.showDeviceRemindDialog(context, gameEntity) } diff --git a/app/src/main/java/com/gh/download/dialog/DownloadLinkDialog.kt b/app/src/main/java/com/gh/download/dialog/DownloadLinkDialog.kt index 3bc5465a8e..67f26089a1 100644 --- a/app/src/main/java/com/gh/download/dialog/DownloadLinkDialog.kt +++ b/app/src/main/java/com/gh/download/dialog/DownloadLinkDialog.kt @@ -5,12 +5,10 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import androidx.databinding.DataBindingUtil import androidx.fragment.app.FragmentActivity import com.gh.base.fragment.BaseDialogFragment import com.gh.common.util.dip2px import com.gh.gamecenter.BuildConfig -import com.gh.gamecenter.R import com.gh.gamecenter.databinding.DialogDownloadLinkBinding import com.gh.gamecenter.entity.GameEntity import com.halo.assistant.HaloApp @@ -25,11 +23,14 @@ class DownloadLinkDialog : BaseDialogFragment() { super.onCreate(savedInstanceState) mLinkEntity = requireArguments().getParcelable(KEY_LINK_ENTITY) } - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - val binding: DialogDownloadLinkBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_download_link, container, false) + + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { + val binding: DialogDownloadLinkBinding = DialogDownloadLinkBinding.inflate(layoutInflater, container, false) binding.title.text = mLinkEntity?.title - binding.webView.loadDataWithBaseURL(null, - mLinkEntity?.content ?: "", "text/html", "utf-8", null) + binding.webView.loadDataWithBaseURL( + null, + mLinkEntity?.content ?: "", "text/html", "utf-8", null + ) binding.confirm.setOnClickListener { dismissAllowingStateLoss() diff --git a/app/src/main/java/com/gh/gamecenter/adapter/viewholder/GameHeadViewHolder.kt b/app/src/main/java/com/gh/gamecenter/adapter/viewholder/GameHeadViewHolder.kt index 96fa28c90c..23bc84d95e 100644 --- a/app/src/main/java/com/gh/gamecenter/adapter/viewholder/GameHeadViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/adapter/viewholder/GameHeadViewHolder.kt @@ -23,7 +23,7 @@ class GameHeadViewHolder(var binding: GameHeadItemBinding) : return } - binding.subject = subject + binding.headTitle.text=subject.getFilterName() binding.headPb.visibility = View.GONE val text = if ("change" == subject.home) { "换一批" diff --git a/app/src/main/java/com/gh/gamecenter/adapter/viewholder/GameImageViewHolder.kt b/app/src/main/java/com/gh/gamecenter/adapter/viewholder/GameImageViewHolder.kt index 5c401e67db..d66ebe17d0 100644 --- a/app/src/main/java/com/gh/gamecenter/adapter/viewholder/GameImageViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/adapter/viewholder/GameImageViewHolder.kt @@ -2,8 +2,10 @@ package com.gh.gamecenter.adapter.viewholder import com.facebook.drawee.generic.RoundingParams import com.gh.base.BaseRecyclerViewHolder +import com.gh.common.databind.BindingAdapters import com.gh.common.util.DisplayUtils import com.gh.common.util.ImageUtils +import com.gh.common.util.goneIf import com.gh.gamecenter.R import com.gh.gamecenter.databinding.GameImageItemBinding import com.gh.gamecenter.entity.GameEntity @@ -12,7 +14,13 @@ class GameImageViewHolder(var binding: GameImageItemBinding) : BaseRecyclerViewH // 注意:专题详情的大图不能用此方法 fun bindImage(entity: GameEntity, applyRoundCorner: Boolean = false) { - binding.game = entity + binding.run { + gameContainer.goneIf(!(entity.type == "game" && entity.getApk().isNotEmpty())) + gameIcon.displayGameIcon(entity) + gameName.text = entity.name + gameSize.text = if (entity.getApk().isNotEmpty()) entity.getApk()[0].size.toString() else "" + BindingAdapters.setDownloadButton(progressBar, entity, null, null, null, "") + } val context = binding.root.context val width = context.resources.displayMetrics.widthPixels - DisplayUtils.dip2px(context, 16F) diff --git a/app/src/main/java/com/gh/gamecenter/adapter/viewholder/ViewHolder.kt b/app/src/main/java/com/gh/gamecenter/adapter/viewholder/ViewHolder.kt index 776e5d232a..e54127a06b 100644 --- a/app/src/main/java/com/gh/gamecenter/adapter/viewholder/ViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/adapter/viewholder/ViewHolder.kt @@ -7,7 +7,6 @@ class SearchGameFooterViewHolder(val binding: SearchGameFooterBinding) : BaseRec class PersonalHomeRatingViewHolder(val binding: PersonalHomeRatingBinding) : BaseRecyclerViewHolder(binding.root) class GameColumnCollectionItemViewHolder(val binding: GameColumnCollectionItemBinding) : BaseRecyclerViewHolder(binding.root) class PrivacyPolicyItemViewHolder(val binding: PrivacyItemBinding) : BaseRecyclerViewHolder(binding.root) -class UserHomeAmwayItemViewHolder(val binding: UserHomeAmwayItemBinding) : BaseRecyclerViewHolder(binding.root) class CommonCollectionItemViewHolder(val binding: CommonCollectionItemBinding) : BaseRecyclerViewHolder(binding.root) class CommonCollectionDetailOneItemViewHolder(val binding: CommonCollectionDetailOneItemBinding) : BaseRecyclerViewHolder(binding.root) class CommonCollectionDetailTwoItemViewHolder(val binding: CommonCollectionDetailTwoItemBinding) : BaseRecyclerViewHolder(binding.root) diff --git a/app/src/main/java/com/gh/gamecenter/amway/AmwayAdapter.kt b/app/src/main/java/com/gh/gamecenter/amway/AmwayAdapter.kt index 2ce17a0710..48b898afbb 100644 --- a/app/src/main/java/com/gh/gamecenter/amway/AmwayAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/amway/AmwayAdapter.kt @@ -5,7 +5,6 @@ import android.view.View import android.view.ViewGroup import android.widget.TextView import androidx.core.content.ContextCompat -import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView import com.airbnb.lottie.LottieAnimationView import com.gh.common.constant.ItemViewType @@ -28,22 +27,29 @@ import com.gh.gamecenter.home.LegacyHomeFragmentAdapterAssistant import com.halo.assistant.fragment.game.GamePluginAdapter import com.lightgame.download.DownloadEntity import com.lightgame.view.CheckableImageView -import java.util.* import java.util.regex.Pattern -class AmwayAdapter(context: Context, - private var mViewModel: AmwayViewModel, - private var mBasicExposureSource: List, - private var mLayoutManager: RecyclerView.LayoutManager) - : ListAdapter(context), IExposable { +class AmwayAdapter( + context: Context, + private var mViewModel: AmwayViewModel, + private var mBasicExposureSource: List, + private var mLayoutManager: RecyclerView.LayoutManager +) : ListAdapter(context), IExposable { private val mLegacyHomeFragmentAdapterAssistant by lazy { - LegacyHomeFragmentAdapterAssistant(mContext, this, mLayoutInflater, mBasicExposureSource, true, LegacyHomeFragmentAdapterAssistant.OuterType.AMWAY) + LegacyHomeFragmentAdapterAssistant( + mContext, + this, + mLayoutInflater, + mBasicExposureSource, + true, + LegacyHomeFragmentAdapterAssistant.OuterType.AMWAY + ) } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { return when (viewType) { - ITEM_AMWAY_COMMENT -> AmwayCommentViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.amway_comment_item, parent, false)) + ITEM_AMWAY_COMMENT -> AmwayCommentViewHolder(parent.toBinding()) ItemViewType.ITEM_FOOTER -> FooterViewHolder(mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false)) @@ -135,7 +141,8 @@ class AmwayAdapter(context: Context, fun notifyChildItem(position: Int) { if (getItemViewType(position) == ItemViewType.VERTICAL_SLIDE_ITEM - || getItemViewType(position) == ItemViewType.GAME_PLUGIN) { + || getItemViewType(position) == ItemViewType.GAME_PLUGIN + ) { val view = mLayoutManager.findViewByPosition(position) val recyclerView = view?.findViewById(R.id.recycler_view) recyclerView?.adapter?.notifyDataSetChanged() @@ -152,7 +159,8 @@ class AmwayAdapter(context: Context, entryMap[download.platform] = download } if (getItemViewType(gameAndPosition.position) == ItemViewType.VERTICAL_SLIDE_ITEM || - getItemViewType(gameAndPosition.position) == ItemViewType.GAME_PLUGIN) { + getItemViewType(gameAndPosition.position) == ItemViewType.GAME_PLUGIN + ) { val view = mLayoutManager.findViewByPosition(gameAndPosition.position) val recyclerView = view?.findViewById(R.id.recycler_view) when (val adapter = recyclerView?.adapter) { @@ -169,7 +177,12 @@ class AmwayAdapter(context: Context, fun bindComment(viewModel: AmwayViewModel, itemData: AmwayListItemData, blockPosition: Int, basicExposureSource: List) { val context = binding.root.context val amway = itemData.amwayCommentItem!! - binding.amway = amway + binding.gameNameTv.text = amway.game.name + binding.ratingTv.text = amway.game.star.toString() + binding.userNameTv.text = amway.comment.user.name + binding.ratingBar.rating = amway.comment.star.toFloat() + binding.likeCountTv.text = if (amway.comment.vote > 0) NumberUtils.transSimpleCount(amway.comment.vote) else "0" + val user = itemData.amwayCommentItem?.comment?.user binding.userIcon.display(user?.border, user?.icon, user?.auth?.icon) val m = Pattern.compile(RatingEditActivity.LABEL_REGEX).matcher(amway.comment.content) @@ -187,8 +200,10 @@ class AmwayAdapter(context: Context, MtaHelper.onEvent("安利墙", "点击", "评论${blockPosition}_${amway.game.name}_游戏") } - binding.gameIconView.displayGameIcon(amway.game.rawIcon - ?: amway.game.icon, amway.game.iconSubscript) + binding.gameIconView.displayGameIcon( + amway.game.rawIcon + ?: amway.game.icon, amway.game.iconSubscript + ) amway.game.tag?.let { val tags = it.take(3) @@ -201,8 +216,10 @@ class AmwayAdapter(context: Context, } binding.commentContainer.setOnClickListener { - val intent = RatingReplyActivity.getIntent(context, amway.game.id, amway.comment, false, viewModel.entrance - ?: "", EntranceUtils.ENTRANCE_AMWAY) + val intent = RatingReplyActivity.getIntent( + context, amway.game.id, amway.comment, false, viewModel.entrance + ?: "", EntranceUtils.ENTRANCE_AMWAY + ) SyncDataBetweenPageHelper.startActivityForResult(binding.root.context, intent, RatingFragment.RATING_REPLAY_REQUEST, adapterPosition) MtaHelper.onEvent("安利墙", "点击", "评论${blockPosition}_${amway.game.name}_评论") } diff --git a/app/src/main/java/com/gh/gamecenter/amway/search/AmwaySearchAdapter.kt b/app/src/main/java/com/gh/gamecenter/amway/search/AmwaySearchAdapter.kt index e2eb9e2307..05bf305b68 100644 --- a/app/src/main/java/com/gh/gamecenter/amway/search/AmwaySearchAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/amway/search/AmwaySearchAdapter.kt @@ -2,9 +2,8 @@ package com.gh.gamecenter.amway.search import android.content.Context import android.view.ViewGroup -import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView -import com.gh.gamecenter.R +import com.gh.common.util.toBinding import com.gh.gamecenter.baselist.ListAdapter import com.gh.gamecenter.entity.GameEntity @@ -15,7 +14,7 @@ class AmwaySearchAdapter(context: Context, val mViewModel: AmwaySearchViewModel) } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { - return AmwaySearchViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.amway_search_item, parent, false), mViewModel) + return AmwaySearchViewHolder(parent.toBinding(), mViewModel) } override fun getItemCount(): Int { diff --git a/app/src/main/java/com/gh/gamecenter/amway/search/AmwaySearchDefaultFragment.kt b/app/src/main/java/com/gh/gamecenter/amway/search/AmwaySearchDefaultFragment.kt index f9ad52e4d7..419c97e48b 100644 --- a/app/src/main/java/com/gh/gamecenter/amway/search/AmwaySearchDefaultFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/amway/search/AmwaySearchDefaultFragment.kt @@ -6,9 +6,7 @@ import androidx.recyclerview.widget.LinearLayoutManager import com.gh.common.util.DialogHelper import com.gh.common.util.observeNonNull import com.gh.common.util.viewModelProviderFromParent -import com.gh.gamecenter.R import com.gh.gamecenter.databinding.FragmentAmwaySearchDefaultBinding -import com.gh.gamecenter.databinding.FragmentSearchDefaultBinding import com.gh.gamecenter.eventbus.EBSearch import com.gh.gamecenter.search.SearchDefaultFragment import com.lightgame.utils.Util_System_Keyboard @@ -29,7 +27,8 @@ class AmwaySearchDefaultFragment : SearchDefaultFragment() { mViewModel = viewModelProviderFromParent() mViewModel.playedGames.observeNonNull(this) { - mBinding.isExistHotSearch = it.isNotEmpty() + defaultViewModel?.isExistHotSearch = it.isNotEmpty() + updateView() mBinding.hotList.run { layoutManager = LinearLayoutManager(context) adapter = AmwaySearchAdapter(context, mViewModel).apply { setData(it) } @@ -45,8 +44,9 @@ class AmwaySearchDefaultFragment : SearchDefaultFragment() { } override fun initView() { - mBinding = FragmentSearchDefaultBinding.bind(mCachedView.findViewById(R.id.searchContent)) - mBinding.isExistHistory = mHistoryList?.isNotEmpty() + mBinding = mAmwayBinding.searchContent + defaultViewModel?.isExistHistory = mHistoryList?.isNotEmpty() == true + updateView() mBinding.hotTitle.text = "最近玩过" mBinding.historyFlexContainer.setLimitHeight(mFlexMaxHeight) createFlexContent(mBinding.historyFlex, mHistoryList, clickListener = { @@ -59,7 +59,8 @@ class AmwaySearchDefaultFragment : SearchDefaultFragment() { mBinding.historyClear.setOnClickListener { DialogHelper.showCenterWarningDialog(requireContext(), "清空记录", "确定清空历史搜索记录?", confirmClickCallback = { mSearchDao.deleteAll() - mBinding.isExistHistory = false + defaultViewModel?.isExistHistory = false + updateView() updateNoPlayedGameHint() }) } diff --git a/app/src/main/java/com/gh/gamecenter/amway/search/AmwaySearchViewHolder.kt b/app/src/main/java/com/gh/gamecenter/amway/search/AmwaySearchViewHolder.kt index d28c7e4852..7e345fd95d 100644 --- a/app/src/main/java/com/gh/gamecenter/amway/search/AmwaySearchViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/amway/search/AmwaySearchViewHolder.kt @@ -18,7 +18,8 @@ import java.lang.ref.WeakReference class AmwaySearchViewHolder(var binding: AmwaySearchItemBinding, val mViewModel: AmwaySearchViewModel) : RecyclerView.ViewHolder(binding.root) { fun bindView(gameEntity: GameEntity) { - binding.game = gameEntity + binding.iconIv.displayGameIcon(gameEntity) + binding.nameTv.text = gameEntity.name binding.addIv.goneIf(!gameEntity.showComment) binding.hintTv.goneIf(gameEntity.showComment) diff --git a/app/src/main/java/com/gh/gamecenter/catalog/CatalogAdapter.kt b/app/src/main/java/com/gh/gamecenter/catalog/CatalogAdapter.kt index 8bc5f75406..45b7dd3810 100644 --- a/app/src/main/java/com/gh/gamecenter/catalog/CatalogAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/catalog/CatalogAdapter.kt @@ -4,6 +4,7 @@ import android.content.Context import android.view.View import android.view.ViewGroup import com.gh.base.BaseRecyclerViewHolder +import com.gh.common.util.goneIf import com.gh.common.util.toBinding import com.gh.common.util.toColor import com.gh.gamecenter.R @@ -11,11 +12,12 @@ import com.gh.gamecenter.databinding.CatalogItemBinding import com.gh.gamecenter.entity.CatalogEntity import com.lightgame.adapter.BaseRecyclerAdapter -class CatalogAdapter(context: Context, - private val mFragment: CatalogFragment, - private val mViewModel: CatalogViewModel, - private val mList: List) - : BaseRecyclerAdapter(context) { +class CatalogAdapter( + context: Context, + private val mFragment: CatalogFragment, + private val mViewModel: CatalogViewModel, + private val mList: List +) : BaseRecyclerAdapter(context) { override fun getItemCount() = mList.size @@ -25,8 +27,8 @@ class CatalogAdapter(context: Context, override fun onBindViewHolder(holder: CatalogItemViewHolder, position: Int) { holder.binding.run { val catalogEntity = mList[position] - entity = catalogEntity - executePendingBindings() + catalogName.text = catalogEntity.name + recommendTag.goneIf(!catalogEntity.recommended) if (catalogEntity.name == mViewModel.selectedCatalogName) { selectedTag.visibility = View.VISIBLE catalogName.setTextColor(R.color.theme_font.toColor()) diff --git a/app/src/main/java/com/gh/gamecenter/catalog/NewCatalogListAdapter.kt b/app/src/main/java/com/gh/gamecenter/catalog/NewCatalogListAdapter.kt index 8c6565f4b7..69c2d417aa 100644 --- a/app/src/main/java/com/gh/gamecenter/catalog/NewCatalogListAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/catalog/NewCatalogListAdapter.kt @@ -82,9 +82,8 @@ class NewCatalogListAdapter(context: Context, val gameEntity = mEntityList[position] - holder.binding.game = gameEntity + holder.bindGameItem(gameEntity) holder.initServerType(gameEntity) - holder.binding.executePendingBindings() val sortType = mViewModel.sortType.value val sortSize = mViewModel.sortSize.text diff --git a/app/src/main/java/com/gh/gamecenter/catalog/SpecialCatalogAdapter.kt b/app/src/main/java/com/gh/gamecenter/catalog/SpecialCatalogAdapter.kt index 17da241248..2f13f937df 100644 --- a/app/src/main/java/com/gh/gamecenter/catalog/SpecialCatalogAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/catalog/SpecialCatalogAdapter.kt @@ -16,10 +16,7 @@ import com.gh.common.constant.ItemViewType import com.gh.common.exposure.ExposureEvent import com.gh.common.exposure.ExposureSource import com.gh.common.exposure.IExposable -import com.gh.common.util.DirectUtils -import com.gh.common.util.dip2px -import com.gh.common.util.doOnPageSelected -import com.gh.common.util.toBinding +import com.gh.common.util.* import com.gh.gamecenter.R import com.gh.gamecenter.adapter.viewholder.FooterViewHolder import com.gh.gamecenter.baselist.ListAdapter @@ -27,9 +24,10 @@ import com.gh.gamecenter.databinding.* import com.gh.gamecenter.entity.GameEntity import com.gh.gamecenter.subject.SubjectActivity.Companion.startSubjectActivity -class SpecialCatalogAdapter(context: Context, - private val mCatalogViewModel: SpecialCatalogViewModel) - : ListAdapter(context), IExposable { +class SpecialCatalogAdapter( + context: Context, + private val mCatalogViewModel: SpecialCatalogViewModel +) : ListAdapter(context), IExposable { private val mExposureEventSparseArray: SparseArray = SparseArray() var isAutoScroll = true @@ -133,14 +131,18 @@ class SpecialCatalogAdapter(context: Context, height = imageWidth / 2 } - entity = imageEntity.image + ImageUtils.display(image, imageEntity.image.url) + title.text = imageEntity.image.title var exposureEvent: ExposureEvent? = null if (imageEntity.link.type == "game") { exposureEvent = ExposureEvent.createEventWithSourceConcat( - GameEntity(id = imageEntity.link.link, name = imageEntity.link.text).apply { outerSequence = mEntityList[position].position }, - mCatalogViewModel.basicExposureSource, - listOf(ExposureSource("精选页图片", ""))) + GameEntity(id = imageEntity.link.link, name = imageEntity.link.text).apply { + outerSequence = mEntityList[position].position + }, + mCatalogViewModel.basicExposureSource, + listOf(ExposureSource("精选页图片", "")) + ) mExposureEventSparseArray.append(position, exposureEvent) } root.setOnClickListener { @@ -154,16 +156,19 @@ class SpecialCatalogAdapter(context: Context, val entity = mEntityList[position].header!! val specialLink = entity.link holder.binding.run { - link = specialLink + headTitle.text = specialLink.text headMore.setOnClickListener { if (entity.type == "专题合集") { - DirectUtils.directToColumnCollection(mContext, specialLink.link - ?: "", -1, "(游戏-专题:" + specialLink.text + "-全部)") + DirectUtils.directToColumnCollection( + mContext, specialLink.link ?: "", -1, "(游戏-专题:" + specialLink.text + "-全部)" + ) } else { startSubjectActivity(mContext, specialLink.link, specialLink.text, false, "(游戏-专题:" + specialLink.text + "-全部)") } - mCatalogViewModel.logSpecialCatalogContentClick(entity.type, specialLink.text - ?: "", mEntityList[position].position) + mCatalogViewModel.logSpecialCatalogContentClick( + entity.type, specialLink.text + ?: "", mEntityList[position].position + ) } } } @@ -177,9 +182,11 @@ class SpecialCatalogAdapter(context: Context, game.subjectName = subject.link.text game.outerSequence = mEntityList[position].position - val exposureEvent = ExposureEvent.createEventWithSourceConcat(game, - mCatalogViewModel.basicExposureSource, - listOf(ExposureSource("精选页专题", subject.link.text ?: ""))) + val exposureEvent = ExposureEvent.createEventWithSourceConcat( + game, + mCatalogViewModel.basicExposureSource, + listOf(ExposureSource("精选页专题", subject.link.text ?: "")) + ) exposureList.add(exposureEvent) game.exposureEvent = exposureEvent @@ -231,7 +238,8 @@ class SpecialCatalogAdapter(context: Context, val banners = itemData.banner!!.data val pagerAdapter = binding.viewPager.adapter if (banners.isNotEmpty() - && (pagerAdapter == null || pagerAdapter is BannerAdapter && pagerAdapter.getDataSize() != banners.size)) { + && (pagerAdapter == null || pagerAdapter is BannerAdapter && pagerAdapter.getDataSize() != banners.size) + ) { binding.root.layoutParams = binding.root.layoutParams.apply { val rootWidth = mContext.resources.displayMetrics.widthPixels - (80F + 16F + 16F).dip2px() height = rootWidth / 2 @@ -246,9 +254,10 @@ class SpecialCatalogAdapter(context: Context, val view = View.inflate(mContext, R.layout.banner_indicator_item, null) view.findViewById(R.id.selectedIv).visibility = if (i == 0) View.VISIBLE else View.GONE view.findViewById(R.id.unSelectIv).visibility = if (i == 0) View.GONE else View.VISIBLE - view.layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT).apply { - if (i != 0) leftMargin = 4F.dip2px() else 0F.dip2px() - } + view.layoutParams = + LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT).apply { + if (i != 0) leftMargin = 4F.dip2px() else 0F.dip2px() + } addView(view) i++ } @@ -267,9 +276,9 @@ class SpecialCatalogAdapter(context: Context, val childCount = binding.indicatorContainer.childCount while (j < childCount) { binding.indicatorContainer.getChildAt(j).findViewById(R.id.selectedIv).visibility = - if (j == it % childCount) View.VISIBLE else View.GONE + if (j == it % childCount) View.VISIBLE else View.GONE binding.indicatorContainer.getChildAt(j).findViewById(R.id.unSelectIv).visibility = - if (j == it % childCount) View.GONE else View.VISIBLE + if (j == it % childCount) View.GONE else View.VISIBLE j++ } } diff --git a/app/src/main/java/com/gh/gamecenter/catalog/SpecialCatalogSubjectAdapter.kt b/app/src/main/java/com/gh/gamecenter/catalog/SpecialCatalogSubjectAdapter.kt index 3c2cbc7c3e..6e2bcfdfc4 100644 --- a/app/src/main/java/com/gh/gamecenter/catalog/SpecialCatalogSubjectAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/catalog/SpecialCatalogSubjectAdapter.kt @@ -10,10 +10,11 @@ import com.gh.gamecenter.databinding.CatalogSubjectGameItemBinding import com.gh.gamecenter.entity.GameEntity import com.lightgame.adapter.BaseRecyclerAdapter -class SpecialCatalogSubjectAdapter(context: Context, - private val mCatalogViewModel: SpecialCatalogViewModel, - private var mList: List) - : BaseRecyclerAdapter(context) { +class SpecialCatalogSubjectAdapter( + context: Context, + private val mCatalogViewModel: SpecialCatalogViewModel, + private var mList: List +) : BaseRecyclerAdapter(context) { private val mEntrance = "精选分类" private var countAndKey: Pair? = null @@ -29,8 +30,7 @@ class SpecialCatalogSubjectAdapter(context: Context, override fun getItemCount() = mList.size - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) - = CatalogSubjectGameItemViewHolder(parent.toBinding()) + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = CatalogSubjectGameItemViewHolder(parent.toBinding()) override fun onBindViewHolder(holder: CatalogSubjectGameItemViewHolder, position: Int) { holder.binding.run { @@ -39,8 +39,8 @@ class SpecialCatalogSubjectAdapter(context: Context, } val entity = mList[position] - game = entity - executePendingBindings() + gameIcon.displayGameIcon(entity) + gameName.text = entity.name if (!gameName.isSelected) { gameName.postDelayed({ gameName.isSelected = true }, 500) @@ -49,11 +49,12 @@ class SpecialCatalogSubjectAdapter(context: Context, root.setOnClickListener { GameDetailActivity.startGameDetailActivity(mContext, entity.id, "(${mEntrance})", entity.exposureEvent) mCatalogViewModel.logSpecialCatalogSpecificContentClick( - "专题", - game?.subjectName ?: "", - game?.name ?: "", - mPosition, - position) + "专题", + entity.subjectName ?: "", + entity.name ?: "", + mPosition, + position + ) } } } diff --git a/app/src/main/java/com/gh/gamecenter/catalog/SubCatalogAdapter.kt b/app/src/main/java/com/gh/gamecenter/catalog/SubCatalogAdapter.kt index cd7a73eb1d..20d370e2ae 100644 --- a/app/src/main/java/com/gh/gamecenter/catalog/SubCatalogAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/catalog/SubCatalogAdapter.kt @@ -4,39 +4,45 @@ import android.content.Context import android.view.ViewGroup import com.gh.base.BaseRecyclerViewHolder import com.gh.common.util.DialogHelper +import com.gh.common.util.ImageUtils +import com.gh.common.util.goneIf import com.gh.common.util.toBinding import com.gh.gamecenter.databinding.SubCatalogItemBinding import com.gh.gamecenter.entity.CatalogEntity import com.lightgame.adapter.BaseRecyclerAdapter -class SubCatalogAdapter(context: Context, - private val mCatalogViewModel: CatalogViewModel, - private val mPrimaryCatalog: CatalogEntity, - private var mList: List) - : BaseRecyclerAdapter(context) { +class SubCatalogAdapter( + context: Context, + private val mCatalogViewModel: CatalogViewModel, + private val mPrimaryCatalog: CatalogEntity, + private var mList: List +) : BaseRecyclerAdapter(context) { private val mTypes = listOf("专题", "标签") override fun getItemCount() = mList.size override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = - SubCatalogItemViewHolder(parent.toBinding()) + SubCatalogItemViewHolder(parent.toBinding()) override fun onBindViewHolder(holder: SubCatalogItemViewHolder, position: Int) { holder.binding.run { val catalogEntity = mList[position] - entity = catalogEntity - executePendingBindings() + ImageUtils.display(catalogIcon, catalogEntity.icon) + catalogName.text = catalogEntity.name + recommendTag.goneIf(!catalogEntity.recommended) root.setOnClickListener { mCatalogViewModel.logSubCatalogContentClick(catalogEntity.name, position) if (mTypes.contains(catalogEntity.type)) { - root.context.startActivity(NewCatalogListActivity.getIntent( - mContext, - mCatalogViewModel.catalogId, - mCatalogViewModel.catalogTitle, - catalogEntity.name, - mPrimaryCatalog, - catalogEntity.name) + root.context.startActivity( + NewCatalogListActivity.getIntent( + mContext, + mCatalogViewModel.catalogId, + mCatalogViewModel.catalogTitle, + catalogEntity.name, + mPrimaryCatalog, + catalogEntity.name + ) ) } else { DialogHelper.showUpgradeDialog(mContext) diff --git a/app/src/main/java/com/gh/gamecenter/category/CategoryDirectoryAdapter.kt b/app/src/main/java/com/gh/gamecenter/category/CategoryDirectoryAdapter.kt index ed06146016..035c1bbd7e 100644 --- a/app/src/main/java/com/gh/gamecenter/category/CategoryDirectoryAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/category/CategoryDirectoryAdapter.kt @@ -6,6 +6,8 @@ import android.view.ViewGroup import android.widget.LinearLayout import androidx.recyclerview.widget.RecyclerView import com.gh.common.util.DisplayUtils +import com.gh.common.util.ImageUtils +import com.gh.common.util.IntentUtils import com.gh.common.util.toBinding import com.gh.common.view.SubCategoryView import com.gh.gamecenter.R @@ -34,8 +36,14 @@ class CategoryDirectoryAdapter(context: Context, var categoryTitle: String) override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { when (holder) { is CategoryViewHolder -> { - holder.binding.category = mEntityList[position] - holder.binding.title = categoryTitle + val category = mEntityList[position] + holder.binding.run { + containerPrimaryCategory.setOnClickListener { + IntentUtils.startCategoryListActivity(root.context, categoryTitle, category) + } + ImageUtils.display(iconIv, category.icon) + categoryName.text = category.name + } holder.bindCategory( category = mEntityList[position], expandableStatusMap = expandStatusMap, diff --git a/app/src/main/java/com/gh/gamecenter/category/NewCategoryListAdapter.kt b/app/src/main/java/com/gh/gamecenter/category/NewCategoryListAdapter.kt index ee98489dff..2bcb83c54a 100644 --- a/app/src/main/java/com/gh/gamecenter/category/NewCategoryListAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/category/NewCategoryListAdapter.kt @@ -81,9 +81,8 @@ class NewCategoryListAdapter(context: Context, if (holder is GameItemViewHolder) { val gameEntity = mEntityList[position] - holder.binding.game = gameEntity + holder.bindGameItem(gameEntity) holder.initServerType(gameEntity) - holder.binding.executePendingBindings() val padTop = if (position == 0) 16F.dip2px() else 8F.dip2px() holder.itemView.setPadding(16F.dip2px(), padTop, 16F.dip2px(), 8F.dip2px()) diff --git a/app/src/main/java/com/gh/gamecenter/category2/CategoryV2Adapter.kt b/app/src/main/java/com/gh/gamecenter/category2/CategoryV2Adapter.kt index a006d7f8e8..610cd46c6c 100644 --- a/app/src/main/java/com/gh/gamecenter/category2/CategoryV2Adapter.kt +++ b/app/src/main/java/com/gh/gamecenter/category2/CategoryV2Adapter.kt @@ -4,6 +4,7 @@ import android.content.Context import android.view.View import android.view.ViewGroup import com.gh.base.BaseRecyclerViewHolder +import com.gh.common.util.goneIf import com.gh.common.util.toBinding import com.gh.common.util.toColor import com.gh.gamecenter.R @@ -11,22 +12,23 @@ import com.gh.gamecenter.databinding.CategoryV2ItemBinding import com.gh.gamecenter.entity.SidebarsEntity import com.lightgame.adapter.BaseRecyclerAdapter -class CategoryV2Adapter(context: Context, - private val mFragment: CategoryV2Fragment, - private val mViewModel: CategoryV2ViewModel, - private val mList: List) - : BaseRecyclerAdapter(context) { +class CategoryV2Adapter( + context: Context, + private val mFragment: CategoryV2Fragment, + private val mViewModel: CategoryV2ViewModel, + private val mList: List +) : BaseRecyclerAdapter(context) { override fun getItemCount() = mList.size override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = - CategoryV2ItemViewHolder(parent.toBinding()) + CategoryV2ItemViewHolder(parent.toBinding()) override fun onBindViewHolder(holder: CategoryV2ItemViewHolder, position: Int) { holder.binding.run { val catalogEntity = mList[position] - entity = catalogEntity - executePendingBindings() + catalogName.text = catalogEntity.name + recommendTag.goneIf(!catalogEntity.recommended) if (catalogEntity.name == mViewModel.selectedCategoryName) { selectedTag.visibility = View.VISIBLE catalogName.setTextColor(R.color.theme_font.toColor()) diff --git a/app/src/main/java/com/gh/gamecenter/category2/CategoryV2ListAdapter.kt b/app/src/main/java/com/gh/gamecenter/category2/CategoryV2ListAdapter.kt index 22ced4182f..6099957aa0 100644 --- a/app/src/main/java/com/gh/gamecenter/category2/CategoryV2ListAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/category2/CategoryV2ListAdapter.kt @@ -7,6 +7,7 @@ import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import com.gh.base.BaseRecyclerViewHolder import com.gh.common.constant.ItemViewType +import com.gh.common.databind.BindingAdapters import com.gh.common.exposure.ExposureEvent import com.gh.common.exposure.ExposureSource import com.gh.common.exposure.ExposureType @@ -22,7 +23,6 @@ import com.gh.gamecenter.databinding.CategoryGameItemBinding import com.gh.gamecenter.entity.GameEntity import com.gh.gamecenter.eventbus.EBDownloadStatus import com.lightgame.download.DownloadEntity -import java.util.* class CategoryV2ListAdapter(context: Context, private val mViewModel: CategoryV2ListViewModel, @@ -83,9 +83,8 @@ class CategoryV2ListAdapter(context: Context, holder.itemView.setPadding(16F.dip2px(), 8F.dip2px(), 16F.dip2px(), 8F.dip2px()) val gameEntity = mEntityList[position] - holder.binding.game = gameEntity + holder.bindGameItem(gameEntity) holder.initServerType(gameEntity) - holder.binding.executePendingBindings() val categoryTitle = mCategoryViewModel.categoryTitle val selectedCategoryName = mCategoryViewModel.selectedCategoryName @@ -174,6 +173,22 @@ class CategoryV2ListAdapter(context: Context, inner class CategoryGameItemViewHolder(val binding: CategoryGameItemBinding): BaseRecyclerViewHolder(binding.root) { + fun bindGameItem(gameEntity: GameEntity) { + binding.run { + gameIconView.displayGameIcon(gameEntity) + BindingAdapters.setGameName(gameName, gameEntity, false, null) + BindingAdapters.setTextSize(gameRating, if (gameEntity.commentCount > 3) 12 else 10) + BindingAdapters.setGameTags(labelList, gameEntity) + gameRating.setCompoundDrawables(if (gameEntity.commentCount > 3) R.drawable.game_horizontal_rating.toDrawable() else null, null, null, null) + gameRating.text = if (gameEntity.commentCount > 3) { + if (gameEntity.star == 10.0F) "10" else gameEntity.star.toString() + } else "" + gameRating.setPadding(0,0,if (gameEntity.commentCount > 3) 8F.dip2px() else 0,0) + gameRating.setTextColor(if (gameEntity.commentCount > 3) R.color.theme_font.toColor() else R.color.theme.toColor()) + gameDes.text = gameEntity.decoratedDes + } + } + fun initServerType(gameEntity: GameEntity) { val serverLabel = gameEntity.serverLabel when { diff --git a/app/src/main/java/com/gh/gamecenter/category2/SubCategoryAdapter.kt b/app/src/main/java/com/gh/gamecenter/category2/SubCategoryAdapter.kt index 6a383fa1be..cff08601e1 100644 --- a/app/src/main/java/com/gh/gamecenter/category2/SubCategoryAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/category2/SubCategoryAdapter.kt @@ -5,28 +5,30 @@ import android.view.View import android.view.ViewGroup import com.gh.base.BaseRecyclerViewHolder import com.gh.common.util.ToastUtils +import com.gh.common.util.goneIf import com.gh.common.util.toColor import com.gh.gamecenter.R import com.gh.gamecenter.databinding.SubCategoryItemBinding import com.gh.gamecenter.entity.CategoryEntity import com.lightgame.adapter.BaseRecyclerAdapter -class SubCategoryAdapter(context: Context, - private val mViewModel: CategoryV2ViewModel, - private val mList: List, - private val mPrimaryIndex: Int) - : BaseRecyclerAdapter(context) { +class SubCategoryAdapter( + context: Context, + private val mViewModel: CategoryV2ViewModel, + private val mList: List, + private val mPrimaryIndex: Int +) : BaseRecyclerAdapter(context) { override fun getItemCount() = mList.size override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = - SubCategoryItemViewHolder(SubCategoryItemBinding.inflate(mLayoutInflater)) + SubCategoryItemViewHolder(SubCategoryItemBinding.inflate(mLayoutInflater)) override fun onBindViewHolder(holder: SubCategoryItemViewHolder, position: Int) { holder.binding.run { val categoryEntity = mList[position] - entity = categoryEntity - executePendingBindings() + name.text = categoryEntity.name + recommendIv.goneIf(categoryEntity.recommend == false) if (categoryEntity.selected) { selectedIv.visibility = View.VISIBLE @@ -77,5 +79,5 @@ class SubCategoryAdapter(context: Context, } } - class SubCategoryItemViewHolder(val binding: SubCategoryItemBinding): BaseRecyclerViewHolder(binding.root) + class SubCategoryItemViewHolder(val binding: SubCategoryItemBinding) : BaseRecyclerViewHolder(binding.root) } \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/collection/GamesCollectionAdapter.kt b/app/src/main/java/com/gh/gamecenter/collection/GamesCollectionAdapter.kt index 4c28164fb0..c2a72d85b8 100644 --- a/app/src/main/java/com/gh/gamecenter/collection/GamesCollectionAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/collection/GamesCollectionAdapter.kt @@ -12,7 +12,6 @@ import android.widget.LinearLayout import android.widget.PopupWindow import android.widget.TextView import androidx.appcompat.app.AppCompatActivity -import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView import com.gh.common.constant.ItemViewType import com.gh.common.syncpage.ISyncAdapterHandler @@ -89,14 +88,7 @@ class GamesCollectionAdapter( override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { return when (viewType) { - ItemViewType.ITEM_BODY -> GameCollectionItemViewHolder( - DataBindingUtil.inflate( - mLayoutInflater, - R.layout.game_collection_item, - parent, - false - ) - ) + ItemViewType.ITEM_BODY -> GameCollectionItemViewHolder(parent.toBinding()) else -> FooterViewHolder(mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false)) } @@ -107,8 +99,28 @@ class GamesCollectionAdapter( is GameCollectionItemViewHolder -> { val itemEntity = mEntityList[position] holder.binding.run { - entity = itemEntity - executePendingBindings() + ImageUtils.display(poster, itemEntity.cover) + nameTv.text = itemEntity.title + tagIv.goneIf(itemEntity.stamp.isEmpty()) + itemEntity.games?.let { + gameOne.goneIf(it.size == 0) + gameOne.displayGameIcon(it[0].toGameEntity()) + gameTwo.goneIf(it.size < 2) + gameTwo.displayGameIcon(it[1].toGameEntity()) + gameThree.goneIf(it.size < 3) + gameThree.displayGameIcon(it[2].toGameEntity()) + } + moreNumTv.goneIf((itemEntity.count?.game ?: 0) < 4) + moreNumTv.text = "+ " + ((itemEntity.count?.game ?: 0) - 3) + tagContainer.goneIf(itemEntity.count?.game != 0) + timeTv.text = TimeUtils.getFormatTime(itemEntity.time?.update ?: 0, "MM - dd") + ImageUtils.display(userIcon, itemEntity.user?.icon) + userName.text = itemEntity.user?.name + voteCount.text = if (itemEntity.count?.vote == 0) "赞同" else NumberUtils.transNewSimpleCount(itemEntity.count?.vote ?: 0, "#") + voteCount.setTextColor(if (itemEntity.me?.isVoted == true) R.color.theme_font.toColor() else R.color.white.toColor()) + voteIcon.isChecked = itemEntity.me?.isVoted == true + commentCount.text = + if (itemEntity.count?.comment == 0) "评论" else NumberUtils.transNewSimpleCount(itemEntity.count?.comment ?: 0, "#") moreIv.goneIf( mViewModel.type != TYPE_USER diff --git a/app/src/main/java/com/gh/gamecenter/collection/VideoAdapter.kt b/app/src/main/java/com/gh/gamecenter/collection/VideoAdapter.kt index 1e1a0d5e25..f690b593b3 100644 --- a/app/src/main/java/com/gh/gamecenter/collection/VideoAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/collection/VideoAdapter.kt @@ -80,7 +80,7 @@ class VideoAdapter( override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { if (holder is VideoItemViewHolder) { val entity = mEntityList[position] - holder.binding.video = entity + holder.bindVideoItem(entity) holder.binding.selectIv.goneIf(mCurrentOption == ManageOption.OPTION_MANAGER) holder.binding.selectIv.isChecked = selectItems.contains(entity.id) diff --git a/app/src/main/java/com/gh/gamecenter/download/NewInstalledGameFragmentAdapter.kt b/app/src/main/java/com/gh/gamecenter/download/NewInstalledGameFragmentAdapter.kt index b5bf79af5a..08012c0dd1 100644 --- a/app/src/main/java/com/gh/gamecenter/download/NewInstalledGameFragmentAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/download/NewInstalledGameFragmentAdapter.kt @@ -48,11 +48,9 @@ class NewInstalledGameFragmentAdapter(context: Context, private var mViewModel: private fun initGameNormal(holder: GameItemViewHolder, gameEntity: GameEntity) { gameEntity.collection = ArrayList() // 清空集合,防止下载按钮会因为存在集合而清空合集包的状态判断 + holder.bindGameItem(gameEntity, isShowPlatform = true) holder.initServerType(gameEntity) val binding = holder.binding - binding.game = gameEntity - binding.isShowPlatform = true - binding.executePendingBindings() val name: String? if (gameEntity.getApk().size > 0) { name = String.format( diff --git a/app/src/main/java/com/gh/gamecenter/energy/CommodityAdapter.kt b/app/src/main/java/com/gh/gamecenter/energy/CommodityAdapter.kt index 114b683515..3242cf4626 100644 --- a/app/src/main/java/com/gh/gamecenter/energy/CommodityAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/energy/CommodityAdapter.kt @@ -4,7 +4,6 @@ import android.content.Context import android.graphics.Paint import android.view.View import android.view.ViewGroup -import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.StaggeredGridLayoutManager import com.gh.base.BaseRecyclerViewHolder @@ -19,9 +18,11 @@ import com.gh.gamecenter.entity.CommodityCategoryEntity import com.gh.gamecenter.entity.CommodityEntity import io.reactivex.disposables.Disposable -class CommodityAdapter(context: Context, - val entrance: String, - val category: CommodityCategoryEntity): ListAdapter(context) { +class CommodityAdapter( + context: Context, + val entrance: String, + val category: CommodityCategoryEntity +) : ListAdapter(context) { private val mTimers = ArrayList() @@ -39,7 +40,7 @@ class CommodityAdapter(context: Context, override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { return when (viewType) { ItemViewType.ITEM_BODY -> { - CommodityItemViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.commodity_item, parent, false)) + CommodityItemViewHolder(parent.toBinding()) } else -> { FooterViewHolder(mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false)) @@ -66,8 +67,12 @@ class CommodityAdapter(context: Context, } val commodity = mEntityList[position] - entity = commodity - executePendingBindings() + ImageUtils.display(coverImageView, commodity.coverImage) + name.text=commodity.name + energy.text=commodity.energy.toString() + originEnergy.goneIf(!commodity.showOriginEnergy) + originEnergy.text="${commodity.originEnergy}光能" + exchangeCountTv.text="已兑${commodity.totalExchangeNum}件" if (commodity.tag != null && commodity.tag.id.isNotBlank()) { tagTv.visibility = View.VISIBLE @@ -82,11 +87,11 @@ class CommodityAdapter(context: Context, root.setOnClickListener { IntegralLogHelper.run { logCommodity( - "click_goods", - entrance, - commodity?.id ?: "", - category.id, - category.name + "click_goods", + entrance, + commodity?.id ?: "", + category.id, + category.name ) log("view_goods_detail", "商品详情页") @@ -161,9 +166,9 @@ class CommodityAdapter(context: Context, is FooterViewHolder -> { holder.itemView.layoutParams = (holder.itemView.layoutParams as StaggeredGridLayoutManager.LayoutParams) - .apply { - isFullSpan = true - } + .apply { + isFullSpan = true + } if (entrance == "光能中心") { holder.itemView.setPadding(0, 0, 0, 40F.dip2px()) holder.itemView.layoutParams = holder.itemView.layoutParams.apply { diff --git a/app/src/main/java/com/gh/gamecenter/energy/HorizontalTaskAdapter.kt b/app/src/main/java/com/gh/gamecenter/energy/HorizontalTaskAdapter.kt index d259723c33..b96f9a67d6 100644 --- a/app/src/main/java/com/gh/gamecenter/energy/HorizontalTaskAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/energy/HorizontalTaskAdapter.kt @@ -3,7 +3,6 @@ package com.gh.gamecenter.energy import android.content.Context import android.view.ViewGroup import androidx.appcompat.app.AppCompatActivity -import androidx.databinding.DataBindingUtil import com.gh.base.BaseRecyclerViewHolder import com.gh.common.util.* import com.gh.gamecenter.R @@ -13,16 +12,16 @@ import com.gh.gamecenter.gamedetail.dialog.InviteCodeDialog import com.gh.gamecenter.manager.UserManager import com.lightgame.adapter.BaseRecyclerAdapter -class HorizontalTaskAdapter(context: Context, - private val entrance: String, - var list: List) - : BaseRecyclerAdapter(context) { +class HorizontalTaskAdapter( + context: Context, + private val entrance: String, + var list: List +) : BaseRecyclerAdapter(context) { override fun getItemCount() = list.size - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) - = EnergyTaskViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.novice_task_item, parent, false)) + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = EnergyTaskViewHolder(parent.toBinding()) override fun onBindViewHolder(holder: EnergyTaskViewHolder, position: Int) { @@ -32,8 +31,8 @@ class HorizontalTaskAdapter(context: Context, } val task = list[position] - entity = task - executePendingBindings() + ImageUtils.display(taskIcon, task.icon) + taskName.text = task.name if (task.status == "finished") { taskBtn.text = "已完成" @@ -50,11 +49,12 @@ class HorizontalTaskAdapter(context: Context, root.setOnClickListener { task.run { IntegralLogHelper.logTask( - "click_mission", - entrance, - taskId, - name, - "新手任务") + "click_mission", + entrance, + taskId, + name, + "新手任务" + ) } CheckLoginUtils.checkLogin(mContext, entrance) { diff --git a/app/src/main/java/com/gh/gamecenter/energy/TaskAdapter.kt b/app/src/main/java/com/gh/gamecenter/energy/TaskAdapter.kt index 4a32034af8..12112cc19c 100644 --- a/app/src/main/java/com/gh/gamecenter/energy/TaskAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/energy/TaskAdapter.kt @@ -4,7 +4,6 @@ import android.content.Context import android.view.View import android.view.ViewGroup import androidx.appcompat.app.AppCompatActivity -import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.gh.base.BaseRecyclerViewHolder @@ -33,13 +32,13 @@ class TaskAdapter(context: Context) : ListAdapter(context) { override fun getItemViewType(position: Int): Int { val item = mEntityList[position] return when { - item.noviceTasks != null -> TYPE_NOVICE + item.noviceTasks != null -> TYPE_NOVICE - item.title != null -> TYPE_TITLE + item.title != null -> TYPE_TITLE - item.dailyTask != null -> TYPE_DAILY + item.dailyTask != null -> TYPE_DAILY - else -> TYPE_BOTTOM + else -> TYPE_BOTTOM } } @@ -106,13 +105,13 @@ class TaskAdapter(context: Context) : ListAdapter(context) { FooterViewHolder(view) } - TYPE_NOVICE -> NoviceTasksViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.novice_tasks_item, parent, false)) + TYPE_NOVICE -> NoviceTasksViewHolder(parent.toBinding()) - TYPE_TITLE -> TaskTitleViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.task_title_item, parent, false)) + TYPE_TITLE -> TaskTitleViewHolder(parent.toBinding()) - TYPE_BOTTOM -> TaskBottomViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.task_bottom_item, parent, false)) + TYPE_BOTTOM -> TaskBottomViewHolder(parent.toBinding()) - else -> DailyTaskViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.daily_task_item, parent, false)) + else -> DailyTaskViewHolder(parent.toBinding()) } } @@ -137,8 +136,10 @@ class TaskAdapter(context: Context) : ListAdapter(context) { is DailyTaskViewHolder -> { val task = mEntityList[position].dailyTask ?: return holder.binding.run { - entity = task - executePendingBindings() + ImageUtils.display(taskIcon, task.icon) + taskName.text = task.name + progress.goneIf(task.isFixed) + progress.text = "${task.progress}/${task.quota}" // if (task.isFixed) progress.text = "" @@ -157,11 +158,12 @@ class TaskAdapter(context: Context) : ListAdapter(context) { root.setOnClickListener { task.run { IntegralLogHelper.logTask( - "click_mission", - "光能中心", - taskId, - name, - if (isFixed) "常驻任务" else "日常任务") + "click_mission", + "光能中心", + taskId, + name, + if (isFixed) "常驻任务" else "日常任务" + ) } CheckLoginUtils.checkLogin(mContext, mEntrance) { @@ -192,21 +194,21 @@ class TaskAdapter(context: Context) : ListAdapter(context) { } is TaskBottomViewHolder -> { - holder.binding.run { - val isLastBottom = mEntityList[position].bottom!! - holder.itemView.layoutParams = (holder.itemView.layoutParams as ViewGroup.MarginLayoutParams).apply { - val marginBottom = if (isLastBottom) 40F.dip2px() else 0 - setMargins(16F.dip2px(), 0, 16F.dip2px(), marginBottom) - } + holder.binding.run { + val isLastBottom = mEntityList[position].bottom!! + holder.itemView.layoutParams = (holder.itemView.layoutParams as ViewGroup.MarginLayoutParams).apply { + val marginBottom = if (isLastBottom) 40F.dip2px() else 0 + setMargins(16F.dip2px(), 0, 16F.dip2px(), marginBottom) + } } } } } - inner class NoviceTasksViewHolder(val binding: NoviceTasksItemBinding): BaseRecyclerViewHolder(binding.root) - inner class TaskTitleViewHolder(val binding: TaskTitleItemBinding): BaseRecyclerViewHolder(binding.root) - inner class DailyTaskViewHolder(val binding: DailyTaskItemBinding): BaseRecyclerViewHolder(binding.root) - inner class TaskBottomViewHolder(val binding: TaskBottomItemBinding): BaseRecyclerViewHolder(binding.root) + inner class NoviceTasksViewHolder(val binding: NoviceTasksItemBinding) : BaseRecyclerViewHolder(binding.root) + inner class TaskTitleViewHolder(val binding: TaskTitleItemBinding) : BaseRecyclerViewHolder(binding.root) + inner class DailyTaskViewHolder(val binding: DailyTaskItemBinding) : BaseRecyclerViewHolder(binding.root) + inner class TaskBottomViewHolder(val binding: TaskBottomItemBinding) : BaseRecyclerViewHolder(binding.root) companion object { private const val TYPE_NOVICE = 900 diff --git a/app/src/main/java/com/gh/gamecenter/entity/ServerCalendarEntity.kt b/app/src/main/java/com/gh/gamecenter/entity/ServerCalendarEntity.kt index 2b011d72ae..2ac519b650 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/ServerCalendarEntity.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/ServerCalendarEntity.kt @@ -31,57 +31,56 @@ class ServerCalendarEntity() : Parcelable, BaseObservable() { var remark: String = "" - public fun setNote(note: String?) { + fun setNote(note: String?) { this.note = note notifyPropertyChanged(BR.note) } @Bindable - public fun getNote(): String? { + fun getNote(): String? { return this.note } - public fun setFirstName(firstName: CharSequence?) { + fun setFirstName(firstName: CharSequence?) { this.firstName = firstName notifyPropertyChanged(BR.firstName) } @Bindable - public fun getFirstName(): CharSequence? { + fun getFirstName(): CharSequence? { return this.firstName } - public fun setServerName(serverName: CharSequence?) { + fun setServerName(serverName: CharSequence?) { this.serverName = serverName notifyPropertyChanged(BR.serverName) } @Bindable - public fun getServerName(): CharSequence? { + fun getServerName(): CharSequence? { return this.serverName } - public fun setTime(time: Long) { + fun setTime(time: Long) { this.time = time notifyPropertyChanged(BR.time) } @Bindable - public fun getTime(): Long { + fun getTime(): Long { return this.time } - public fun setDataMark(dataMark: Int) { + fun setDataMark(dataMark: Int) { this.dataMark = dataMark notifyPropertyChanged(BR.dataMark) } @Bindable - public fun getDataMark(): Int { + fun getDataMark(): Int { return this.dataMark } - override fun describeContents(): Int { return 0 } diff --git a/app/src/main/java/com/gh/gamecenter/forum/detail/ForumDetailFragment.kt b/app/src/main/java/com/gh/gamecenter/forum/detail/ForumDetailFragment.kt index 78d597f6e1..4eaa776a8d 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/detail/ForumDetailFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/detail/ForumDetailFragment.kt @@ -18,7 +18,6 @@ import androidx.annotation.RequiresApi import androidx.core.content.ContextCompat import androidx.core.os.bundleOf import androidx.core.view.ViewCompat -import androidx.databinding.DataBindingUtil import androidx.fragment.app.Fragment import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager @@ -130,7 +129,7 @@ class ForumDetailFragment : BaseLazyTabFragment() { } override fun getInflatedLayout(): View { - mBinding = DataBindingUtil.inflate(layoutInflater, R.layout.fragment_forum_detail, null, false) + mBinding = FragmentForumDetailBinding.bind(layoutInflater.inflate(R.layout.fragment_forum_detail, null, false)) return mBinding.root } @@ -295,7 +294,16 @@ class ForumDetailFragment : BaseLazyTabFragment() { private fun initUI() { mForumDetail?.apply { - mBinding.entity = this + mBinding.forumTopMaskContainer.goneIf(background.isEmpty()) + mBinding.forumDefaultBackground.goneIf(background.isNotEmpty()) + mBinding.forumMaskDefaultView.goneIf(background.isNotEmpty()) + mBinding.moderatorContainer.visibleIf(moderator.isNotEmpty()) + mBinding.gameZoneTv.visibleIf(zone != null) + mBinding.forumNameTv.text = name + mBinding.followTv.text = if (me.isFollower) "已关注" else "关注" + mBinding.titleTv.text = name + mBinding.dividerLine.goneIf(topLink.isEmpty()) + mBinding.moderatorTv.setPadding(if (moderator.isNotEmpty()) 8f.dip2px() else 0, 0, 0, 0) if (type == "official_bbs") { mBinding.forumThumbSmall.displayGameIcon(icon, null) mBinding.forumThumbBig.displayGameIcon(icon, null) diff --git a/app/src/main/java/com/gh/gamecenter/forum/detail/ForumTopLinkAdapter.kt b/app/src/main/java/com/gh/gamecenter/forum/detail/ForumTopLinkAdapter.kt index 841bacda06..83beda78ff 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/detail/ForumTopLinkAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/detail/ForumTopLinkAdapter.kt @@ -3,18 +3,14 @@ package com.gh.gamecenter.forum.detail import android.content.Context import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView -import com.gh.common.util.DirectUtils -import com.gh.common.util.DisplayUtils -import com.gh.common.util.MtaHelper -import com.gh.common.util.NewLogUtils -import com.gh.gamecenter.R +import com.gh.common.util.* import com.gh.gamecenter.databinding.ForumTopLinkItemBinding import com.gh.gamecenter.entity.LinkEntity import com.lightgame.adapter.BaseRecyclerAdapter class ForumTopLinkAdapter(context: Context, val links: ArrayList, val bbsId: String, val bbsType: String) : BaseRecyclerAdapter(context) { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { - return ForumTopLinkViewHolder(ForumTopLinkItemBinding.bind(mLayoutInflater.inflate(R.layout.forum_top_link_item, parent, false))) + return ForumTopLinkViewHolder(parent.toBinding()) } override fun getItemCount(): Int = links.size diff --git a/app/src/main/java/com/gh/gamecenter/forum/home/ForumActivityAdapter.kt b/app/src/main/java/com/gh/gamecenter/forum/home/ForumActivityAdapter.kt index d3337cb492..ad59c0d8d2 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/home/ForumActivityAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/home/ForumActivityAdapter.kt @@ -2,7 +2,6 @@ package com.gh.gamecenter.forum.home import android.content.Context import android.view.ViewGroup -import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView import com.gh.base.BaseRecyclerViewHolder import com.gh.common.constant.ItemViewType @@ -14,9 +13,11 @@ import com.gh.gamecenter.baselist.ListAdapter import com.gh.gamecenter.databinding.ForumActivityItemBinding import com.gh.gamecenter.entity.ForumActivityEntity -class ForumActivityAdapter(context: Context, - val mViewModel: ForumActivityViewModel, - val mEntrance: String) : ListAdapter(context) { +class ForumActivityAdapter( + context: Context, + val mViewModel: ForumActivityViewModel, + val mEntrance: String +) : ListAdapter(context) { override fun getItemViewType(position: Int): Int { if (position == itemCount - 1) return ItemViewType.ITEM_FOOTER @@ -31,7 +32,7 @@ class ForumActivityAdapter(context: Context, } else -> { - ForumActivityViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.forum_activity_item, parent, false)) + ForumActivityViewHolder(parent.toBinding()) } } } @@ -45,9 +46,8 @@ class ForumActivityAdapter(context: Context, is ForumActivityViewHolder -> { holder.binding.run { val activityEntity = mEntityList[position] - entity = activityEntity - executePendingBindings() - + ImageUtils.display(introPic, activityEntity.image.cover) + title.text = activityEntity.title line.goneIf(position == 0) var status = "" @@ -150,5 +150,5 @@ class ForumActivityAdapter(context: Context, } } - inner class ForumActivityViewHolder(val binding: ForumActivityItemBinding): BaseRecyclerViewHolder(binding.root) + inner class ForumActivityViewHolder(val binding: ForumActivityItemBinding) : BaseRecyclerViewHolder(binding.root) } \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/forum/home/ForumArticleAskItemViewHolder.kt b/app/src/main/java/com/gh/gamecenter/forum/home/ForumArticleAskItemViewHolder.kt index 70cc3c52f6..4985d56a6b 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/home/ForumArticleAskItemViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/home/ForumArticleAskItemViewHolder.kt @@ -2,6 +2,8 @@ package com.gh.gamecenter.forum.home import android.app.Activity +import android.graphics.Color +import android.graphics.drawable.GradientDrawable import android.text.SpannableStringBuilder import android.view.View import android.view.ViewGroup @@ -41,8 +43,31 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B } private fun bindItem(entity: AnswerEntity, entrance: String, path: String) { - binding.entity = entity - binding.executePendingBindings() + binding.run { + questionTitle.goneIf(entity.type != "answer") + questionTitle.text = entity.questions.title + userName.text = entity.user.name + userBadgeName.text = entity.user.badge?.name + ImageUtils.display(userBadgeIcon, entity.user.badge?.icon) + ImageUtils.display(popularAnswerUserIcon, entity.popularAnswer?.user?.icon) + userBadgeIcon.goneIf(entity.user.badge == null) + concernBtn.goneIf(entity.me.isFollower || entity.user.id == UserManager.getInstance().userId) + followedUserTv.goneIf(!entity.me.isFollower) + time.text = (if (entity.me.isFollower) " · " else "") + NewsUtils.getFormattedTime(entity.time!!) + (if (entity.status == "pending" || entity.status == "fail") " · " else "") + statusTv.setText(if (entity.status == "pending") R.string.content_pending_status else R.string.fail_status) + statusTv.setTextColor(if (entity.status == "pending") R.color.theme_green.toColor() else R.color.theme_red.toColor()) + statusTv.goneIf(!(entity.status == "pending" || entity.status == "fail")) + title.goneIf(entity.type == "answer") + title.text = if (entity.type.contains("video")) entity.articleTitle else entity.questions.title + content.text = if (entity.type.contains("video")) entity.des else entity.brief + popularAnswerContainer.background = GradientDrawable().apply { + setColor(Color.parseColor("#F5F6F7")) + cornerRadius = 4F.dip2px().toFloat() + } + popularAnswerUserName.text = entity.popularAnswer?.user?.name + popularAnswerContent.text = entity.popularAnswer?.brief + forumNameTv.text = entity.bbs.name + } binding.userIcon.display(entity.user.border, entity.user.icon, entity.user.auth?.icon) binding.forumNameTv.text = entity.bbs.name @@ -160,7 +185,6 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B } } } - binding.executePendingBindings() } private fun bindVideoData(entity: ForumVideoEntity) { diff --git a/app/src/main/java/com/gh/gamecenter/forum/home/ForumFollowAdapter.kt b/app/src/main/java/com/gh/gamecenter/forum/home/ForumFollowAdapter.kt index b8f51a1756..4da83b7564 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/home/ForumFollowAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/home/ForumFollowAdapter.kt @@ -4,7 +4,6 @@ import android.content.Context import android.view.View import android.view.ViewGroup import androidx.core.content.ContextCompat -import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView import com.gh.common.util.* import com.gh.gamecenter.R @@ -39,7 +38,7 @@ class ForumFollowAdapter(context: Context) : BaseRecyclerAdapter 1) { val forumEntity = entityList[position - 2] - holder.binding.entity = forumEntity holder.binding.forumIcon.displayGameIcon(forumEntity.game.getIcon(), forumEntity.game.iconSubscript) holder.binding.forumName.text = forumEntity.name holder.binding.forumRecommendIv.visibleIf(forumEntity.isRecommend) diff --git a/app/src/main/java/com/gh/gamecenter/forum/home/ForumRecordsAdapter.kt b/app/src/main/java/com/gh/gamecenter/forum/home/ForumRecordsAdapter.kt index c00ed4b575..8b4c2de243 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/home/ForumRecordsAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/home/ForumRecordsAdapter.kt @@ -2,19 +2,21 @@ package com.gh.gamecenter.forum.home import android.content.Context import android.view.ViewGroup -import androidx.databinding.DataBindingUtil import com.gh.base.BaseRecyclerViewHolder -import com.gh.common.util.* -import com.gh.gamecenter.R +import com.gh.common.util.NewLogUtils +import com.gh.common.util.dip2px +import com.gh.common.util.goneIf +import com.gh.common.util.toBinding import com.gh.gamecenter.databinding.ForumRecordItemBinding import com.gh.gamecenter.entity.ForumEntity import com.gh.gamecenter.forum.detail.ForumDetailActivity import com.lightgame.adapter.BaseRecyclerAdapter -class ForumRecordsAdapter(context: Context, - private val entrance: String, - private var mList: List) - : BaseRecyclerAdapter(context) { +class ForumRecordsAdapter( + context: Context, + private val entrance: String, + private var mList: List +) : BaseRecyclerAdapter(context) { private var countAndKey: Pair? = null @@ -28,8 +30,7 @@ class ForumRecordsAdapter(context: Context, override fun getItemCount() = mList.size - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) - = ForumRecordViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.forum_record_item, parent, false)) + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ForumRecordViewHolder(parent.toBinding()) override fun onBindViewHolder(holder: ForumRecordViewHolder, position: Int) { @@ -39,9 +40,8 @@ class ForumRecordsAdapter(context: Context, } val forumEntity = mList[position] - entity = forumEntity - executePendingBindings() - + gameNameTv.text = forumEntity.name + unreadHint.goneIf(!forumEntity.unread) if (forumEntity.type == "official_bbs") { forumIv.displayGameIcon(forumEntity.icon, null) } else { diff --git a/app/src/main/java/com/gh/gamecenter/forum/home/HotForumsAdapter.kt b/app/src/main/java/com/gh/gamecenter/forum/home/HotForumsAdapter.kt index 23b61c43c2..f5348b65bc 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/home/HotForumsAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/home/HotForumsAdapter.kt @@ -2,7 +2,6 @@ package com.gh.gamecenter.forum.home import android.content.Context import android.view.ViewGroup -import androidx.databinding.DataBindingUtil import com.gh.base.BaseRecyclerViewHolder import com.gh.common.util.* import com.gh.gamecenter.R @@ -13,25 +12,24 @@ import com.gh.gamecenter.forum.detail.ForumDetailActivity import com.lightgame.adapter.BaseRecyclerAdapter import org.greenrobot.eventbus.EventBus -class HotForumsAdapter(context: Context, - private val entrance: String, - private val mViewModel: ForumViewModel?, - var list: List) - : BaseRecyclerAdapter(context) { +class HotForumsAdapter( + context: Context, + private val entrance: String, + private val mViewModel: ForumViewModel?, + var list: List +) : BaseRecyclerAdapter(context) { override fun getItemCount() = list.size - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) - = HotForumViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.hot_forum_item, parent, false)) + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = + HotForumViewHolder(parent.toBinding()) override fun onBindViewHolder(holder: HotForumViewHolder, position: Int) { holder.binding.run { val forumEntity = list[position] - entity = forumEntity - executePendingBindings() - + forumNameTv.text = forumEntity.name if (forumEntity.type == "official_bbs") { forumIv.displayGameIcon(forumEntity.icon, null) } else { diff --git a/app/src/main/java/com/gh/gamecenter/forum/home/OfficialForumAdapter.kt b/app/src/main/java/com/gh/gamecenter/forum/home/OfficialForumAdapter.kt index a717898b60..a1dc26e1ae 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/home/OfficialForumAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/home/OfficialForumAdapter.kt @@ -2,37 +2,31 @@ package com.gh.gamecenter.forum.home import android.content.Context import android.view.ViewGroup -import androidx.databinding.DataBindingUtil import com.gh.base.BaseRecyclerViewHolder -import com.gh.common.util.* -import com.gh.gamecenter.* -import com.gh.gamecenter.databinding.ForumWelfareItemBinding -import com.gh.gamecenter.databinding.HotForumItemBinding +import com.gh.common.util.NewLogUtils +import com.gh.common.util.toBinding import com.gh.gamecenter.databinding.OfficialForumItemBinding import com.gh.gamecenter.entity.ForumEntity import com.gh.gamecenter.forum.detail.ForumDetailActivity -import com.gh.gamecenter.manager.UserManager import com.lightgame.adapter.BaseRecyclerAdapter -class OfficialForumAdapter(context: Context, - private val entrance: String, - private var mList: List) - : BaseRecyclerAdapter(context) { +class OfficialForumAdapter( + context: Context, + private val entrance: String, + private var mList: List +) : BaseRecyclerAdapter(context) { override fun getItemCount() = mList.size - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) - = OfficialForumViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.official_forum_item, parent, false)) + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = OfficialForumViewHolder(parent.toBinding()) override fun onBindViewHolder(holder: OfficialForumViewHolder, position: Int) { holder.binding.run { val forumEntity = mList[position] - entity = forumEntity - executePendingBindings() - + forumName.text = forumEntity.name forumIv.displayGameIcon(forumEntity.icon, null) root.setOnClickListener { diff --git a/app/src/main/java/com/gh/gamecenter/forum/home/WelfaresAdapter.kt b/app/src/main/java/com/gh/gamecenter/forum/home/WelfaresAdapter.kt index 7e309808f2..0b721e90ca 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/home/WelfaresAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/home/WelfaresAdapter.kt @@ -2,23 +2,25 @@ package com.gh.gamecenter.forum.home import android.content.Context import android.view.ViewGroup -import androidx.databinding.DataBindingUtil import com.gh.base.BaseRecyclerViewHolder -import com.gh.common.util.* -import com.gh.gamecenter.* +import com.gh.common.util.CheckLoginUtils +import com.gh.common.util.DirectUtils +import com.gh.common.util.NewLogUtils +import com.gh.common.util.toBinding +import com.gh.gamecenter.InfoActivity import com.gh.gamecenter.databinding.ForumWelfareItemBinding import com.gh.gamecenter.toolbox.ToolBoxBlockActivity import com.lightgame.adapter.BaseRecyclerAdapter -class WelfaresAdapter(context: Context, - private var mList: List>) - : BaseRecyclerAdapter(context) { +class WelfaresAdapter( + context: Context, + private var mList: List> +) : BaseRecyclerAdapter(context) { override fun getItemCount() = mList.size - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) - = WelfareViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.forum_welfare_item, parent, false)) + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = WelfareViewHolder(parent.toBinding()) override fun onBindViewHolder(holder: WelfareViewHolder, position: Int) { diff --git a/app/src/main/java/com/gh/gamecenter/forum/list/ForumListAdapter.kt b/app/src/main/java/com/gh/gamecenter/forum/list/ForumListAdapter.kt index a55ddfe3dc..696eb18b44 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/list/ForumListAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/list/ForumListAdapter.kt @@ -3,7 +3,6 @@ package com.gh.gamecenter.forum.list import android.content.Context import android.view.View import android.view.ViewGroup -import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView import com.gh.base.BaseRecyclerViewHolder import com.gh.common.constant.ItemViewType @@ -17,9 +16,11 @@ import com.gh.gamecenter.eventbus.EBForumFollowChange import com.gh.gamecenter.forum.detail.ForumDetailActivity import org.greenrobot.eventbus.EventBus -class ForumListAdapter(context: Context, - val entrance: String, - val mViewModel: ForumListViewModel?): ListAdapter(context) { +class ForumListAdapter( + context: Context, + val entrance: String, + val mViewModel: ForumListViewModel? +) : ListAdapter(context) { override fun getItemCount(): Int { return if (mEntityList.isNullOrEmpty()) 0 else mEntityList.size + FOOTER_ITEM_COUNT @@ -36,7 +37,7 @@ class ForumListAdapter(context: Context, return when (viewType) { ItemViewType.ITEM_FOOTER -> FooterViewHolder(mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false)) - else -> ForumItemViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.forum_my_follow, parent, false)) + else -> ForumItemViewHolder(parent.toBinding()) } } @@ -45,9 +46,7 @@ class ForumListAdapter(context: Context, is ForumItemViewHolder -> { holder.binding.run { val forumEntity = mEntityList[position] - entity = forumEntity - executePendingBindings() - + forumNameTv.text = forumEntity.name if (forumEntity?.type == "official_bbs") { forumIcon.displayGameIcon(forumEntity.icon, null) } else { @@ -132,5 +131,5 @@ class ForumListAdapter(context: Context, } } - inner class ForumItemViewHolder(val binding: ForumMyFollowBinding): BaseRecyclerViewHolder(binding.root) + inner class ForumItemViewHolder(val binding: ForumMyFollowBinding) : BaseRecyclerViewHolder(binding.root) } \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/forum/moderator/ModeratorListAdapter.kt b/app/src/main/java/com/gh/gamecenter/forum/moderator/ModeratorListAdapter.kt index 5d6a248d15..b9d8762bb4 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/moderator/ModeratorListAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/moderator/ModeratorListAdapter.kt @@ -26,20 +26,25 @@ class ModeratorListAdapter(context: Context, val mViewModel: ModeratorListViewMo override fun getItemCount(): Int = datas.size override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { - return ModeratorItemViewHolder(ModeratorListItemBinding.bind(mLayoutInflater.inflate(R.layout.moderator_list_item, parent, false))) + return ModeratorItemViewHolder(parent.toBinding()) } override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { if (holder is ModeratorItemViewHolder) { val personalEntity = datas[position] var mHasNameLabel = false - if (personalEntity.nameLabel?.isNotEmpty() == true){ + if (personalEntity.nameLabel?.isNotEmpty() == true) { mHasNameLabel = true } holder.binding.run { - entity = personalEntity - hasNameLabel = mHasNameLabel - executePendingBindings() + ImageUtils.display(userIcon, personalEntity.icon) + userNameTv.text = personalEntity.name + labelTv.text = personalEntity.nameLabel + labelTv.visibility = if (mHasNameLabel) View.VISIBLE else View.GONE + followTv.background = + if (personalEntity.me.isFollower) R.drawable.bg_shape_f5_radius_999.toDrawable() else R.drawable.bg_forum_follow.toDrawable() + followTv.text = if (personalEntity.me.isFollower) "已关注" else "关注" + followTv.setTextColor(if (personalEntity.me.isFollower) R.color.text_subtitleDesc.toColor() else R.color.theme_font.toColor()) followTv.goneIf(personalEntity.id == UserManager.getInstance().userId) diff --git a/app/src/main/java/com/gh/gamecenter/forum/search/ForumContentSearchListAdapter.kt b/app/src/main/java/com/gh/gamecenter/forum/search/ForumContentSearchListAdapter.kt index 0c28930e73..c6f3eaad56 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/search/ForumContentSearchListAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/search/ForumContentSearchListAdapter.kt @@ -1,6 +1,8 @@ package com.gh.gamecenter.forum.search import android.content.Context +import android.graphics.Color +import android.graphics.drawable.GradientDrawable import android.text.SpannableStringBuilder import android.text.Spanned import android.view.View @@ -21,6 +23,7 @@ import com.gh.gamecenter.databinding.CommunityAnswerItemBinding import com.gh.gamecenter.databinding.ForumSearchContentListBinding import com.gh.gamecenter.entity.CommunityEntity import com.gh.gamecenter.forum.home.ForumArticleAskItemViewHolder +import com.gh.gamecenter.manager.UserManager import com.gh.gamecenter.qa.article.detail.ArticleDetailActivity import com.gh.gamecenter.qa.entity.AnswerEntity import com.gh.gamecenter.qa.entity.Questions @@ -144,8 +147,31 @@ class ForumContentSearchListAdapter(context: Context, val mListViewModel: ForumC normalContainer.visibility = View.GONE includedAnswerItem.root.visibility = View.VISIBLE - includedAnswerItem.entity = answer - includedAnswerItem.executePendingBindings() + includedAnswerItem.run { + questionTitle.goneIf(answer.type != "answer") + questionTitle.text = answer.questions.title + userName.text = answer.user.name + userBadgeName.text = answer.user.badge?.name + ImageUtils.display(userBadgeIcon, answer.user.badge?.icon) + ImageUtils.display(popularAnswerUserIcon, answer.popularAnswer?.user?.icon) + userBadgeIcon.goneIf(answer.user.badge == null) + concernBtn.goneIf(answer.me.isFollower || answer.user.id == UserManager.getInstance().userId) + followedUserTv.goneIf(!answer.me.isFollower) + time.text = (if (answer.me.isFollower) " · " else "") + NewsUtils.getFormattedTime(answer.time!!) + (if (answer.status == "pending" || answer.status == "fail") " · " else "") + statusTv.setText(if (answer.status == "pending") R.string.content_pending_status else R.string.fail_status) + statusTv.setTextColor(if (answer.status == "pending") R.color.theme_green.toColor() else R.color.theme_red.toColor()) + statusTv.goneIf(!(answer.status == "pending" || answer.status == "fail")) + title.goneIf(answer.type == "answer") + title.text = if (answer.type.contains("video")) answer.articleTitle else answer.questions.title + content.text = if (answer.type.contains("video")) answer.des else answer.brief + popularAnswerContainer.background = GradientDrawable().apply { + setColor(Color.parseColor("#F5F6F7")) + cornerRadius = 4F.dip2px().toFloat() + } + popularAnswerUserName.text = answer.popularAnswer?.user?.name + popularAnswerContent.text = answer.popularAnswer?.brief + forumNameTv.text = answer.bbs.name + } val answerViewHolder = ForumArticleAskItemViewHolder(includedAnswerItem) answerViewHolder.bindForumAnswerItem(answer, mEntrance, "") @@ -157,7 +183,17 @@ class ForumContentSearchListAdapter(context: Context, val mListViewModel: ForumC forumSearchHolder.binding.includedAnswerItem.root.visibility = View.GONE forumSearchHolder.binding.normalContainer.visibility = View.VISIBLE - forumSearchHolder.binding.entity = answer + forumSearchHolder.binding.run { + playIv.goneIf(answer.getPassVideos().isEmpty()) + durationTv.goneIf(answer.getPassVideos().isEmpty()) + durationTv.text = if (answer.getPassVideos().isNotEmpty()) answer.getPassVideos()[0].duration else "00:00" + durationTv.background = GradientDrawable().apply { + setColor(Color.parseColor("#99000000")) + cornerRadius = 2F.dip2px().toFloat() + } + countTv.text = "${answer.count.comment}评论 · ${answer.count.vote}点赞" + timeTv.text = TimeUtils.getFormatTime(answer.time ?: 0, "yyyy-MM-dd") + } if (answer.type == "question") { forumSearchHolder.binding.content.visibility = View.GONE val title = answer.questions.title ?: "" diff --git a/app/src/main/java/com/gh/gamecenter/forum/search/ForumOrUserSearchDefaultFragment.kt b/app/src/main/java/com/gh/gamecenter/forum/search/ForumOrUserSearchDefaultFragment.kt index 4aeebe10b0..5be7a9ce17 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/search/ForumOrUserSearchDefaultFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/search/ForumOrUserSearchDefaultFragment.kt @@ -33,7 +33,8 @@ class ForumOrUserSearchDefaultFragment : SearchDefaultFragment() { } private fun initHotSearch() { - mBinding.isExistHotSearch = mHotSearchList?.isNotEmpty() + defaultViewModel?.isExistHotSearch = mHotSearchList?.isNotEmpty() == true + updateView() mBinding.hotList.run { layoutManager = GridLayoutManager(context, 2) adapter = SearchDefaultHotAdapter(context, mHotSearchList, callBack = { @@ -68,7 +69,8 @@ class ForumOrUserSearchDefaultFragment : SearchDefaultFragment() { val params = mBinding.historyTitle.layoutParams as ConstraintLayout.LayoutParams params.topMargin = 0.5f.dip2px() mBinding.historyTitle.layoutParams = params - mBinding.isExistHistory = mHistoryList?.isNotEmpty() + defaultViewModel?.isExistHistory = mHistoryList?.isNotEmpty() == true + updateView() mBinding.historyFlexContainer.setLimitHeight(mFlexMaxHeight) createFlexContent(mBinding.historyFlex, mHistoryList, clickListener = { val key = mHistoryList!![it] @@ -83,7 +85,8 @@ class ForumOrUserSearchDefaultFragment : SearchDefaultFragment() { mBinding.historyClear.setOnClickListener { DialogHelper.showCenterWarningDialog(requireContext(), "清空记录", "确定清空历史搜索记录?", confirmClickCallback = { mSearchDao.deleteAll() - mBinding.isExistHistory = false + defaultViewModel?.isExistHistory = false + updateView() }) } } diff --git a/app/src/main/java/com/gh/gamecenter/forum/search/UserSearchListAdapter.kt b/app/src/main/java/com/gh/gamecenter/forum/search/UserSearchListAdapter.kt index 3a1994f1d4..14a30f0305 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/search/UserSearchListAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/search/UserSearchListAdapter.kt @@ -13,9 +13,9 @@ import com.gh.gamecenter.baselist.ListAdapter import com.gh.gamecenter.databinding.UserSearchListItemBinding import com.gh.gamecenter.entity.FollowersOrFansEntity import com.gh.gamecenter.manager.UserManager -import java.util.* -class UserSearchListAdapter(context: Context, val mEntrance: String, val mViewModel: UserSearchListViewModel) : ListAdapter(context) { +class UserSearchListAdapter(context: Context, val mEntrance: String, val mViewModel: UserSearchListViewModel) : + ListAdapter(context) { override fun setListData(updateData: MutableList) { var oldSize = 0 @@ -41,7 +41,7 @@ class UserSearchListAdapter(context: Context, val mEntrance: String, val mViewMo FooterViewHolder(mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false)) } else -> { - UserSearchListViewHolder(UserSearchListItemBinding.bind(mLayoutInflater.inflate(R.layout.user_search_list_item, parent, false))) + UserSearchListViewHolder(parent.toBinding()) } } } @@ -55,8 +55,19 @@ class UserSearchListAdapter(context: Context, val mEntrance: String, val mViewMo ItemViewType.ITEM_BODY -> { val binding = (holder as UserSearchListViewHolder).binding val entity = mEntityList[position] - binding.entity = entity - binding.executePendingBindings() + ImageUtils.display(binding.userAvatar, entity.icon) + ImageUtils.display(binding.userBadge, entity.auth.icon) + binding.userNameTv.text = entity.name + ImageUtils.display(binding.userBadgeIcon, entity.badge?.icon) + binding.userBadgeIcon.goneIf(entity.badge == null) + binding.userBadgeName.goneIf(entity.badge == null) + binding.userBadgeName.text = entity.badge?.name + binding.userSignatureTv.text = if (entity.introduce.isNullOrEmpty()) "这是一个很神秘的崽~" else entity.introduce + binding.userFansCountTv.text = "${entity.count.fans} 粉丝" + binding.attentionTv.background = + if (entity.me.isFollower) R.drawable.bg_shape_f5_radius_999.toDrawable() else R.drawable.bg_forum_follow.toDrawable() + binding.attentionTv.text = if (entity.me.isFollower) "已关注" else "关注" + binding.attentionTv.setTextColor(if (entity.me.isFollower) R.color.text_subtitleDesc.toColor() else R.color.theme_font.toColor()) if (entity.id == UserManager.getInstance().userId) { binding.attentionTv.text = "自己" binding.attentionTv.setTextColor(ContextCompat.getColor(mContext, R.color.text_subtitleDesc)) diff --git a/app/src/main/java/com/gh/gamecenter/forum/select/ForumAdapter.kt b/app/src/main/java/com/gh/gamecenter/forum/select/ForumAdapter.kt index 30138a0baa..9b300f35c9 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/select/ForumAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/select/ForumAdapter.kt @@ -16,7 +16,12 @@ import com.gh.gamecenter.qa.entity.CommunitySelectEntity import com.lightgame.adapter.BaseRecyclerAdapter import org.greenrobot.eventbus.EventBus -class ForumAdapter(val context: Context, val mViewModel: ForumSelectViewModel?, val isSelectForum: Boolean = false, val onSelectCallback: ((entity: CommunityEntity) -> Unit)? = null) : BaseRecyclerAdapter(context) { +class ForumAdapter( + val context: Context, + val mViewModel: ForumSelectViewModel?, + val isSelectForum: Boolean = false, + val onSelectCallback: ((entity: CommunityEntity) -> Unit)? = null +) : BaseRecyclerAdapter(context) { val datas: ArrayList = arrayListOf() @@ -29,7 +34,7 @@ class ForumAdapter(val context: Context, val mViewModel: ForumSelectViewModel?, } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { - return ForumItemViewHolder(ForumItemBinding.bind(mLayoutInflater.inflate(R.layout.forum_item, parent, false))) + return ForumItemViewHolder(parent.toBinding()) } override fun getItemCount(): Int = datas.size @@ -37,12 +42,24 @@ class ForumAdapter(val context: Context, val mViewModel: ForumSelectViewModel?, override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { if (holder is ForumItemViewHolder) { val forumEntity = datas[position] - holder.binding.entity = forumEntity + holder.binding.forumNameTv.text = forumEntity.name.fromHtml() + holder.binding.followTv.background = + if (forumEntity.isFollow) R.drawable.bg_shape_f5_radius_999.toDrawable() else R.drawable.bg_forum_follow.toDrawable() + holder.binding.followTv.text = if (forumEntity.isFollow) "已关注" else "关注" + holder.binding.followTv.setTextColor(if (forumEntity.isFollow) R.color.text_subtitleDesc.toColor() else R.color.theme_font.toColor()) + holder.binding.forumIcon.displayGameIcon(forumEntity.game.getIcon(), forumEntity.game.iconSubscript) holder.binding.followTv.goneIf(isSelectForum) holder.itemView.setOnClickListener { if (isSelectForum) { - onSelectCallback?.invoke(CommunityEntity(forumEntity.id, forumEntity.name, icon = forumEntity.game.getIcon(), iconSubscript = forumEntity.game.iconSubscript)) + onSelectCallback?.invoke( + CommunityEntity( + forumEntity.id, + forumEntity.name, + icon = forumEntity.game.getIcon(), + iconSubscript = forumEntity.game.iconSubscript + ) + ) } else { MtaHelper.onEvent("论坛首页", "选择论坛", forumEntity.name) mContext.startActivity(ForumDetailActivity.getIntent(mContext, forumEntity.id, "论坛-选择论坛")) @@ -52,17 +69,18 @@ class ForumAdapter(val context: Context, val mViewModel: ForumSelectViewModel?, mContext.ifLogin("论坛-选择论坛") { debounceActionWithInterval(it.id) { if (forumEntity.isFollow) { - DialogHelper.showDialog(mContext, "提示", "确定取消关注", "确定", "暂不", confirmClickCallback = { - mViewModel?.unFollowForum(forumEntity.id) { - MtaHelper.onEvent("论坛首页", "选择论坛", "关注") - forumEntity.isFollow = false - holder.binding.followTv.text = "关注" - ToastUtils.showToast("已取消关注") - holder.binding.followTv.background = ContextCompat.getDrawable(mContext, R.drawable.bg_forum_follow) - holder.binding.followTv.setTextColor(ContextCompat.getColor(mContext, R.color.theme_font)) - EventBus.getDefault().post(EBForumFollowChange(forumEntity, false)) - } - }, + DialogHelper.showDialog( + mContext, "提示", "确定取消关注", "确定", "暂不", confirmClickCallback = { + mViewModel?.unFollowForum(forumEntity.id) { + MtaHelper.onEvent("论坛首页", "选择论坛", "关注") + forumEntity.isFollow = false + holder.binding.followTv.text = "关注" + ToastUtils.showToast("已取消关注") + holder.binding.followTv.background = ContextCompat.getDrawable(mContext, R.drawable.bg_forum_follow) + holder.binding.followTv.setTextColor(ContextCompat.getColor(mContext, R.color.theme_font)) + EventBus.getDefault().post(EBForumFollowChange(forumEntity, false)) + } + }, extraConfig = DialogHelper.Config( centerTitle = true, centerContent = true diff --git a/app/src/main/java/com/gh/gamecenter/game/GameFragment.kt b/app/src/main/java/com/gh/gamecenter/game/GameFragment.kt index e59ba1f102..742b8c28bb 100644 --- a/app/src/main/java/com/gh/gamecenter/game/GameFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/game/GameFragment.kt @@ -14,10 +14,7 @@ import com.gh.base.fragment.LazyFragment import com.gh.common.constant.Constants import com.gh.common.exposure.ExposureListener import com.gh.common.exposure.ExposureSource -import com.gh.common.util.DialogUtils -import com.gh.common.util.EntranceUtils -import com.gh.common.util.dip2px -import com.gh.common.util.visibleIf +import com.gh.common.util.* import com.gh.common.view.FixLinearLayoutManager import com.gh.common.xapk.XapkInstaller import com.gh.common.xapk.XapkUnzipStatus @@ -67,9 +64,13 @@ class GameFragment : LazyFragment() { super.onFragmentFirstVisible() - mViewModel.loadStatus.observe(this, Observer { + mViewModel.loadStatus.observe(this) { if (it != null) { - mBinding.loadStatus = it + mBinding.gameRefresh.isRefreshing = !(it != LoadStatus.INIT_LOADING && it != LoadStatus.LIST_LOADING) + mBinding.gameRefresh.goneIf(it == LoadStatus.INIT_FAILED) + mBinding.gameList.goneIf(it == LoadStatus.INIT_LOADING) + mBinding.reuseNoConnection.root.goneIf(it != LoadStatus.INIT_FAILED) + mListAdapter.setLoadStatus(it) mBinding.reuseNoConnection.root.visibility = if (it == LoadStatus.INIT_FAILED) View.VISIBLE else View.GONE if (it != LoadStatus.INIT_LOADING) { @@ -82,7 +83,7 @@ class GameFragment : LazyFragment() { mViewModel.resetOffset() } } - }) + } mViewModel.itemDataList.observe(this, Observer { if (it != null) mListAdapter.setItemDataList(it as MutableList) }) diff --git a/app/src/main/java/com/gh/gamecenter/game/GameFragmentAdapter.kt b/app/src/main/java/com/gh/gamecenter/game/GameFragmentAdapter.kt index e365e75872..b79f642df5 100644 --- a/app/src/main/java/com/gh/gamecenter/game/GameFragmentAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/game/GameFragmentAdapter.kt @@ -11,7 +11,9 @@ import android.widget.TextView import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.gh.base.OnViewClickListener +import com.gh.common.constant.Config import com.gh.common.constant.ItemViewType +import com.gh.common.databind.BindingAdapters import com.gh.common.exposure.ExposureEvent import com.gh.common.exposure.ExposureSource import com.gh.common.exposure.ExposureType @@ -545,7 +547,7 @@ class GameFragmentAdapter( eTrace = null, event = ExposureType.EXPOSURE ) - holder.binding.traceEvent = mItemDataList[position].exposureEvent + BindingAdapters.setDownloadButton(holder.binding.progressBar, entity, mItemDataList[position].exposureEvent, null, null, "") } holder.binding.gameImageIcon.setOnClickListener { DataCollectionUtils.uploadClick(mContext, "$name-大图", "游戏-专题") @@ -587,9 +589,8 @@ class GameFragmentAdapter( val subjectDigestList = mItemDataList[position].subjectRecommend val binding = holder.binding - binding.list = subjectDigestList val blockData = mViewModel.blockData - binding.clickListener = OnViewClickListener { v, clickedPosition -> + val clickListener = OnViewClickListener { v, clickedPosition -> if (clickedPosition is Int) { MtaHelper.onEvent("推荐入口", blockData?.name, (clickedPosition + 1).toString()) if (clickedPosition < subjectDigestList?.size!!) { @@ -680,6 +681,34 @@ class GameFragmentAdapter( } } + binding.run { + viewpagerTvFailure.goneIf(subjectDigestList != null) + viewpagerTvFailure.setOnClickListener { + clickListener.onClick(it, null) + } + homeSubjectFailure.goneIf(subjectDigestList != null) + homeSubjectFailure.setOnClickListener { + clickListener.onClick(it, null) + } + entranceContainer1.setOnClickListener { clickListener.onClick(it, 0) } + entranceContainer2.setOnClickListener { clickListener.onClick(it, 1) } + entranceContainer3.setOnClickListener { clickListener.onClick(it, 2) } + entranceContainer4.setOnClickListener { clickListener.onClick(it, 3) } + entranceContainer5.setOnClickListener { clickListener.onClick(it, 4) } + subjectDigestList?.let { + ImageUtils.display(entranceIcon1, if (subjectDigestList.isNotEmpty()) subjectDigestList[0].icon else "") + ImageUtils.display(entranceIcon2, if (subjectDigestList.size > 1) subjectDigestList[1].icon else "") + ImageUtils.display(entranceIcon3, if (subjectDigestList.size > 2) subjectDigestList[2].icon else "") + ImageUtils.display(entranceIcon4, if (subjectDigestList.size > 3) subjectDigestList[3].icon else "") + ImageUtils.display(entranceIcon5, if (subjectDigestList.size > 4) subjectDigestList[4].icon else "") + entranceName1.text = if (subjectDigestList.isNotEmpty()) { if (Config.isShowPlugin()) subjectDigestList[0].name else subjectDigestList[0].nameNormal } else "推荐入口" + entranceName2.text = if (subjectDigestList.size > 1) { if (Config.isShowPlugin()) subjectDigestList[1].name else subjectDigestList[1].nameNormal } else "推荐入口" + entranceName3.text = if (subjectDigestList.size > 2) { if (Config.isShowPlugin()) subjectDigestList[2].name else subjectDigestList[2].nameNormal } else "推荐入口" + entranceName4.text = if (subjectDigestList.size > 3) { if (Config.isShowPlugin()) subjectDigestList[3].name else subjectDigestList[3].nameNormal } else "推荐入口" + entranceName5.text = if (subjectDigestList.size > 4) { if (Config.isShowPlugin()) subjectDigestList[4].name else subjectDigestList[4].nameNormal } else "推荐入口" + } + } + val itemData = mItemDataList[position] val slideList = itemData.slideList val pagerAdapter = binding.viewPager.adapter @@ -767,11 +796,8 @@ class GameFragmentAdapter( ) } - holder.binding.game = gameEntity - holder.binding.isShowSuffix = subjectData.isShowSuffix - holder.binding.briefStyle = subjectData.briefStyle + holder.bindGameItem(gameEntity, subjectData.isShowSuffix, subjectData.briefStyle) holder.initServerType(gameEntity) - holder.binding.executePendingBindings() runOnIoThread(true) { itemData.exposureEvent = ExposureEvent.createEventWithSourceConcat( diff --git a/app/src/main/java/com/gh/gamecenter/game/GameItemViewHolder.kt b/app/src/main/java/com/gh/gamecenter/game/GameItemViewHolder.kt index 709e7839c4..e1734cb0e7 100644 --- a/app/src/main/java/com/gh/gamecenter/game/GameItemViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/game/GameItemViewHolder.kt @@ -3,7 +3,12 @@ package com.gh.gamecenter.game import android.view.View import android.widget.TextView import com.gh.base.BaseRecyclerViewHolder +import com.gh.common.databind.BindingAdapters +import com.gh.common.util.dip2px +import com.gh.common.util.toColor +import com.gh.common.util.toDrawable import com.gh.common.view.DrawableView +import com.gh.gamecenter.R import com.gh.gamecenter.databinding.GameItemBinding import com.gh.gamecenter.entity.GameEntity @@ -13,6 +18,28 @@ class GameItemViewHolder(var binding: GameItemBinding) : BaseRecyclerViewHolder< initServerType(binding.gameName, binding.gameKaifuType, gameEntity) } + fun bindGameItem( + entity: GameEntity, + isShowSuffix: Boolean = true, + briefStyle: String = "", + isShowPlatform: Boolean = false + ) { + binding.run { + gameIconView.displayGameIcon(entity) + BindingAdapters.setGameName(gameName, entity, isShowPlatform, isShowSuffix) + BindingAdapters.setTextSize(gameRating, if (entity.commentCount > 3) 12 else 10) + BindingAdapters.setGameTags(labelList, entity) + gameRating.setCompoundDrawables(if (entity.commentCount > 3) R.drawable.game_horizontal_rating.toDrawable() else null, null, null, null) + gameRating.setPadding(0, 0, if (entity.commentCount > 3) 8F.dip2px() else 0, 0) + gameRating.text = if (entity.commentCount > 3) { + if (entity.star == 10.0F) "10" else entity.star.toString() + } else "" + gameRating.setTextColor(if (entity.commentCount > 3) R.color.theme_font.toColor() else R.color.theme.toColor()) + gameDes.text = entity.decoratedDes + recommendStar.rating = entity.recommendStar.toFloat() + } + } + companion object { fun initServerType(gameNameTv: TextView, serverTypeTv: TextView, gameEntity: GameEntity) { val serverLabel = gameEntity.serverLabel diff --git a/app/src/main/java/com/gh/gamecenter/game/commoncollection/CommonCollectionAdapter.kt b/app/src/main/java/com/gh/gamecenter/game/commoncollection/CommonCollectionAdapter.kt index ebc15b3de9..bec82a87e0 100644 --- a/app/src/main/java/com/gh/gamecenter/game/commoncollection/CommonCollectionAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/game/commoncollection/CommonCollectionAdapter.kt @@ -4,7 +4,9 @@ import android.content.Context import android.view.ViewGroup import androidx.constraintlayout.widget.ConstraintLayout import androidx.recyclerview.widget.RecyclerView +import com.gh.common.util.ImageUtils import com.gh.common.util.dip2px +import com.gh.common.util.goneIf import com.gh.common.util.toBinding import com.gh.gamecenter.adapter.viewholder.CommonCollectionItemViewHolder import com.gh.gamecenter.entity.CommonCollectionContentEntity @@ -50,9 +52,18 @@ class CommonCollectionAdapter( } holder.binding.apply { - style = collectionStyle - entity = contentEntity - executePendingBindings() + ImageUtils.display(commonCollectionImage, contentEntity.image) + maskView.goneIf(collectionStyle == "img-list" || (contentEntity.title.isEmpty() && contentEntity.addedContent1.isNullOrEmpty())) + titleTv.goneIf(!(collectionStyle == "1-1" || collectionStyle == "1-2")) + titleTv.text = contentEntity.title + desTv.goneIf(collectionStyle != "1-2") + desTv.text = contentEntity.addedContent1 + linkTitleTv.goneIf(collectionStyle != "img-list") + linkTitleTv.text = contentEntity.title + linkDes1.goneIf(collectionStyle != "img-list") + linkDes1.text = contentEntity.addedContent1 + linkDes2.goneIf(collectionStyle != "img-list") + linkDes2.text = contentEntity.addedContent2 if (collectionStyle == "1-1") { val maskParams = maskView.layoutParams as ConstraintLayout.LayoutParams diff --git a/app/src/main/java/com/gh/gamecenter/game/commoncollection/detail/CommonCollectionDetailAdapter.kt b/app/src/main/java/com/gh/gamecenter/game/commoncollection/detail/CommonCollectionDetailAdapter.kt index 53cfdb99ef..5950246efc 100644 --- a/app/src/main/java/com/gh/gamecenter/game/commoncollection/detail/CommonCollectionDetailAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/game/commoncollection/detail/CommonCollectionDetailAdapter.kt @@ -8,16 +8,13 @@ import androidx.recyclerview.widget.RecyclerView import com.gh.common.exposure.ExposureEvent import com.gh.common.exposure.ExposureSource import com.gh.common.exposure.IExposable -import com.gh.common.util.DirectUtils -import com.gh.common.util.NewLogUtils -import com.gh.common.util.toBinding +import com.gh.common.util.* import com.gh.gamecenter.adapter.viewholder.CommonCollectionDetailOneItemViewHolder import com.gh.gamecenter.adapter.viewholder.CommonCollectionDetailTwoItemViewHolder import com.gh.gamecenter.adapter.viewholder.CommonCollectionImageTextItemViewHolder import com.gh.gamecenter.baselist.ListAdapter import com.gh.gamecenter.entity.CommonCollectionContentEntity import com.gh.gamecenter.entity.GameEntity -import com.gh.gamecenter.entity.LinkEntity class CommonCollectionDetailAdapter( context: Context, @@ -88,16 +85,31 @@ class CommonCollectionDetailAdapter( when (holder) { is CommonCollectionDetailOneItemViewHolder -> { - holder.binding.entity = contentEntity - holder.binding.root.setOnClickListener(listener) + holder.binding.run { + ImageUtils.display(commonCollectionImage, contentEntity.image) + maskView.goneIf(contentEntity.title.isEmpty()) + titleTv.text = contentEntity.title + root.setOnClickListener(listener) + } } is CommonCollectionDetailTwoItemViewHolder -> { - holder.binding.entity = contentEntity - holder.binding.root.setOnClickListener(listener) + holder.binding.run { + ImageUtils.display(commonCollectionImage, contentEntity.image) + maskView.goneIf(contentEntity.title.isEmpty() && contentEntity.addedContent1.isNullOrEmpty()) + titleTv.text = contentEntity.title + desTv.text = contentEntity.addedContent1 + root.setOnClickListener(listener) + } } is CommonCollectionImageTextItemViewHolder -> { - holder.binding.entity = contentEntity - holder.binding.root.setOnClickListener(listener) + holder.binding.run { + ImageUtils.display(commonCollectionImage, contentEntity.image) + linkTitleTv.text = contentEntity.title + linkDes1.text = contentEntity.addedContent1 + linkDes2.text = contentEntity.addedContent2 + + root.setOnClickListener(listener) + } } } } diff --git a/app/src/main/java/com/gh/gamecenter/game/gallery/GameGallerySlideViewHolder.kt b/app/src/main/java/com/gh/gamecenter/game/gallery/GameGallerySlideViewHolder.kt index 27cc743af5..04644b464c 100644 --- a/app/src/main/java/com/gh/gamecenter/game/gallery/GameGallerySlideViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/game/gallery/GameGallerySlideViewHolder.kt @@ -100,7 +100,7 @@ class GameGallerySlideViewHolder(val binding: GameGallerySlideItemBinding) inner class GameGallerySlideItemViewHolder(val binding: ItemWithinGameGallerySlideBinding) : BaseRecyclerViewHolder(binding.root) { fun bindView(gameEntity: GameEntity) { - binding.game = gameEntity + binding.iconIv.displayGameIcon(gameEntity) binding.iconIv.setOnClickListener { GameDetailActivity.startGameDetailActivity(binding.root.context, gameEntity.id, mEntrance, gameEntity.exposureEvent) } diff --git a/app/src/main/java/com/gh/gamecenter/game/horizontal/GameHorizontalAdapter.kt b/app/src/main/java/com/gh/gamecenter/game/horizontal/GameHorizontalAdapter.kt index 3fc4b85279..2b299cf80e 100644 --- a/app/src/main/java/com/gh/gamecenter/game/horizontal/GameHorizontalAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/game/horizontal/GameHorizontalAdapter.kt @@ -7,14 +7,17 @@ import com.gh.common.exposure.ExposureEvent import com.gh.common.util.DataCollectionUtils import com.gh.common.util.MtaHelper import com.gh.common.util.StringUtils +import com.gh.common.util.toBinding import com.gh.gamecenter.GameDetailActivity import com.gh.gamecenter.R import com.gh.gamecenter.databinding.GameHorizontalItemBinding import com.gh.gamecenter.entity.SubjectEntity import com.lightgame.adapter.BaseRecyclerAdapter -class GameHorizontalAdapter(context: Context, - private var mSubjectEntity: SubjectEntity) : BaseRecyclerAdapter(context) { +class GameHorizontalAdapter( + context: Context, + private var mSubjectEntity: SubjectEntity +) : BaseRecyclerAdapter(context) { var gameName = "" var entrance = "" @@ -38,7 +41,7 @@ class GameHorizontalAdapter(context: Context, } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GameHorizontalItemViewHolder { - val binding: GameHorizontalItemBinding = GameHorizontalItemBinding.bind(mLayoutInflater.inflate(R.layout.game_horizontal_item, parent, false)) + val binding: GameHorizontalItemBinding = parent.toBinding() return GameHorizontalItemViewHolder(binding) } @@ -59,21 +62,28 @@ class GameHorizontalAdapter(context: Context, } val gameEntity = mSubjectEntity.data!![position + getIndex()] - holder.binding.game = gameEntity - holder.binding.simpleGameContainer.game = gameEntity - holder.binding.subject = mSubjectEntity - holder.setRemarkView(mSubjectEntity, gameEntity) + holder.binding.simpleGameContainer.run { + gameIcon.displayGameIcon(gameEntity) + GameHorizontalSimpleItemViewHolder.setHorizontalNameAndGravity(gameName, gameEntity.name) + } + holder.bindGameHorizontalItem(gameEntity, mSubjectEntity) holder.itemView.setOnClickListener { if (exposureEventList.isNullOrEmpty()) { DataCollectionUtils.uploadClick(mContext, "大家都在玩", "游戏详情", gameEntity.name) MtaHelper.onEvent("游戏详情_新", "大家都在玩", gameName + "+" + gameEntity.name) - GameDetailActivity.startGameDetailActivity(mContext, gameEntity, - StringUtils.buildString(entrance, "+(", "游戏详情", "[", gameName, "]:大家都在玩[", (position + 1).toString(), "])")) + GameDetailActivity.startGameDetailActivity( + mContext, gameEntity, + StringUtils.buildString(entrance, "+(", "游戏详情", "[", gameName, "]:大家都在玩[", (position + 1).toString(), "])") + ) } else { - GameDetailActivity.startGameDetailActivity(mContext, gameEntity, - StringUtils.buildString("(游戏-专题:", mSubjectEntity.name, "-列表[", (position + 1).toString(), "])"), traceEvent = exposureEventList!![position]) + GameDetailActivity.startGameDetailActivity( + mContext, + gameEntity, + StringUtils.buildString("(游戏-专题:", mSubjectEntity.name, "-列表[", (position + 1).toString(), "])"), + traceEvent = exposureEventList!![position] + ) } } } diff --git a/app/src/main/java/com/gh/gamecenter/game/horizontal/GameHorizontalItemViewHolder.kt b/app/src/main/java/com/gh/gamecenter/game/horizontal/GameHorizontalItemViewHolder.kt index 76c72b4245..fc048df43e 100644 --- a/app/src/main/java/com/gh/gamecenter/game/horizontal/GameHorizontalItemViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/game/horizontal/GameHorizontalItemViewHolder.kt @@ -1,13 +1,11 @@ package com.gh.gamecenter.game.horizontal -import android.text.TextUtils +import android.graphics.Color import android.view.View -import android.view.ViewTreeObserver -import android.widget.TextView -import androidx.databinding.BindingAdapter import com.gh.base.BaseRecyclerViewHolder import com.gh.common.util.goneIf import com.gh.common.util.setRoundedColorBackground +import com.gh.common.util.toDrawable import com.gh.gamecenter.R import com.gh.gamecenter.databinding.GameHorizontalItemBinding import com.gh.gamecenter.entity.GameEntity @@ -15,11 +13,27 @@ import com.gh.gamecenter.entity.SubjectEntity class GameHorizontalItemViewHolder(val binding: GameHorizontalItemBinding) : BaseRecyclerViewHolder(binding.root) { + fun bindGameHorizontalItem(gameEntity: GameEntity, subjectEntity: SubjectEntity) { + binding.gameRating.textSize = if (gameEntity.commentCount > 3) 12f else 10f + binding.gameRating.goneIf("star" != subjectEntity.typeStyle) + binding.gameRating.setCompoundDrawablesWithIntrinsicBounds( + if (gameEntity.commentCount > 3) R.drawable.game_horizontal_rating.toDrawable() else null, + null, + null, + null + ) + binding.gameRating.text = if (gameEntity.commentCount > 3) (if (gameEntity.star == 10.0f) "10" else gameEntity.star.toString()) else "" + binding.firstRemark.text = gameEntity.assignRemark.firstLine + binding.firstRemark.setTextColor(if (gameEntity.assignRemark.markedRed) Color.parseColor("#F10000") else Color.parseColor("#333333")) + binding.secondRemark.text = gameEntity.assignRemark.secondLine + setRemarkView(subjectEntity, gameEntity) + } + /** * 备注显示规则如下: * 一个专题中,只要有一个或以上的备注信息存在则显示或者隐藏占位,没有则隐藏 */ - fun setRemarkView(subjectEntity: SubjectEntity, gameEntity: GameEntity) { + private fun setRemarkView(subjectEntity: SubjectEntity, gameEntity: GameEntity) { if (subjectEntity.typeStyle == "remark") { var isHasFirstRemarkDate = false var isHasSecondRemarkDate = false @@ -40,9 +54,10 @@ class GameHorizontalItemViewHolder(val binding: GameHorizontalItemBinding) : Bas val currentTime = System.currentTimeMillis() if (startTime < currentTime - && (endTime > currentTime || startTime > endTime)) { + && (endTime > currentTime || startTime > endTime) + ) { binding.remarkDot.setRoundedColorBackground(R.color.theme, 5F) - } else if (startTime == 0L && endTime > currentTime) { + } else if (startTime == 0L && endTime > currentTime) { binding.remarkDot.setRoundedColorBackground(R.color.theme, 5F) } else if (startTime == 0L && endTime == 0L) { binding.remarkDot.setRoundedColorBackground(R.color.text_body, 5F) @@ -76,66 +91,4 @@ class GameHorizontalItemViewHolder(val binding: GameHorizontalItemBinding) : Bas binding.lineContainer.visibility = View.GONE } } - - companion object { - @JvmStatic - @BindingAdapter("setHorizontalNameAndGravity") - fun setHorizontalNameAndGravity(view: TextView, name: String?) { - view.text = name - view.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener { - override fun onGlobalLayout() { - view.viewTreeObserver.removeOnGlobalLayoutListener(this); - val newText = autoSplitText(view) - if (!TextUtils.isEmpty(newText)) { - view.text = newText; - } - } - }) - } - - // 手动把文本进行换行处理 - private fun autoSplitText(tv: TextView): String? { - try { - val rawText = tv.text.toString() - val tvPaint = tv.paint - val width = tv.width - if (width == 0) return null // 为零时,执行以下代码会进入死循环 - val tvWidth = (width - tv.paddingLeft - tv.paddingRight).toFloat() - val rawTextLines = rawText - .replace("\r".toRegex(), "") - .split("\n".toRegex()) - .dropLastWhile { it.isEmpty() } - .toTypedArray() - val sbNewText = StringBuilder() - for (rawTextLine in rawTextLines) { - if (tvPaint.measureText(rawTextLine) <= tvWidth) { - sbNewText.append(rawTextLine) - } else { - var lineWidth = 0f - var cnt = 0 - while (cnt != rawTextLine.length) { - val ch = rawTextLine[cnt] - lineWidth += tvPaint.measureText(ch.toString()) - if (lineWidth <= tvWidth) { - sbNewText.append(ch) - } else { - sbNewText.append("\n") - lineWidth = 0f - --cnt - } - ++cnt - } - } - sbNewText.append("\n") - } - if (!rawText.endsWith("\n")) { - sbNewText.deleteCharAt(sbNewText.length - 1) - } - return sbNewText.toString() - } catch (ignore: Exception) { - - } - return "" - } - } } \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/game/horizontal/GameHorizontalSimpleItemViewHolder.kt b/app/src/main/java/com/gh/gamecenter/game/horizontal/GameHorizontalSimpleItemViewHolder.kt index 18c07040a2..1462f37b57 100644 --- a/app/src/main/java/com/gh/gamecenter/game/horizontal/GameHorizontalSimpleItemViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/game/horizontal/GameHorizontalSimpleItemViewHolder.kt @@ -3,7 +3,6 @@ package com.gh.gamecenter.game.horizontal import android.text.TextUtils import android.view.ViewTreeObserver import android.widget.TextView -import androidx.databinding.BindingAdapter import com.gh.base.BaseRecyclerViewHolder import com.gh.gamecenter.databinding.GameHorizontalSimpleItemBinding import com.gh.gamecenter.entity.GameEntity @@ -11,7 +10,6 @@ import com.gh.gamecenter.entity.GameEntity class GameHorizontalSimpleItemViewHolder(val binding: GameHorizontalSimpleItemBinding) : BaseRecyclerViewHolder(binding.root) { companion object { @JvmStatic - @BindingAdapter("setHorizontalNameAndGravity") fun setHorizontalNameAndGravity(view: TextView, name: String?) { view.text = name view.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener { diff --git a/app/src/main/java/com/gh/gamecenter/game/horizontal/GameHorizontalSlideAdapter.kt b/app/src/main/java/com/gh/gamecenter/game/horizontal/GameHorizontalSlideAdapter.kt index 3481bdcfbf..500cf041f0 100644 --- a/app/src/main/java/com/gh/gamecenter/game/horizontal/GameHorizontalSlideAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/game/horizontal/GameHorizontalSlideAdapter.kt @@ -6,15 +6,17 @@ import com.gh.common.exposure.ExposureEvent import com.gh.common.util.StringUtils import com.gh.common.util.dip2px import com.gh.common.util.safelyGetInRelease +import com.gh.common.util.toBinding import com.gh.gamecenter.GameDetailActivity import com.gh.gamecenter.R import com.gh.gamecenter.databinding.GameHorizontalItemBinding import com.gh.gamecenter.entity.SubjectEntity import com.lightgame.adapter.BaseRecyclerAdapter -class GameHorizontalSlideAdapter(context: Context, - private var mSubjectEntity: SubjectEntity) - : BaseRecyclerAdapter(context) { +class GameHorizontalSlideAdapter( + context: Context, + private var mSubjectEntity: SubjectEntity +) : BaseRecyclerAdapter(context) { var gameName = "" var entrance = "" @@ -38,7 +40,7 @@ class GameHorizontalSlideAdapter(context: Context, } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GameHorizontalItemViewHolder { - val binding: GameHorizontalItemBinding = GameHorizontalItemBinding.bind(mLayoutInflater.inflate(R.layout.game_horizontal_item, parent, false)) + val binding: GameHorizontalItemBinding = parent.toBinding() return GameHorizontalItemViewHolder(binding) } @@ -50,26 +52,31 @@ class GameHorizontalSlideAdapter(context: Context, holder.binding.root.setPadding(0, 8F.dip2px(), 0, 8F.dip2px()) holder.binding.simpleGameContainer.root.setPadding(8F.dip2px(), 0, 8F.dip2px(), 0) holder.binding.root.layoutParams = - ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) + ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) val gameEntity = mSubjectEntity.data!![position + getIndex()] - holder.binding.game = gameEntity - holder.binding.simpleGameContainer.game = gameEntity - holder.binding.subject = mSubjectEntity + holder.binding.simpleGameContainer.run { + gameIcon.displayGameIcon(gameEntity) + GameHorizontalSimpleItemViewHolder.setHorizontalNameAndGravity(gameName, gameEntity.name) + } holder.binding.secondRemark.text = when { gameEntity.assignRemark.secondLine.isNotEmpty() -> gameEntity.assignRemark.secondLine "custom" == gameEntity.test?.gameTag && gameEntity.test?.text?.isNotEmpty() == true -> gameEntity.test?.text else -> gameEntity.test?.type ?: "" } - holder.setRemarkView(mSubjectEntity, gameEntity) + holder.bindGameHorizontalItem(gameEntity,mSubjectEntity) holder.itemView.setOnClickListener { val exposureEvent = exposureEventList?.safelyGetInRelease(position) if (exposureEvent != null) { - GameDetailActivity.startGameDetailActivity(mContext, gameEntity, - StringUtils.buildString("(游戏-专题:", mSubjectEntity.name, "-列表[", (position + 1).toString(), "])"), traceEvent = exposureEvent) + GameDetailActivity.startGameDetailActivity( + mContext, gameEntity, + StringUtils.buildString("(游戏-专题:", mSubjectEntity.name, "-列表[", (position + 1).toString(), "])"), traceEvent = exposureEvent + ) } else { - GameDetailActivity.startGameDetailActivity(mContext, gameEntity, - StringUtils.buildString("(游戏-专题:", mSubjectEntity.name, "-列表[", (position + 1).toString(), "])")) + GameDetailActivity.startGameDetailActivity( + mContext, gameEntity, + StringUtils.buildString("(游戏-专题:", mSubjectEntity.name, "-列表[", (position + 1).toString(), "])") + ) } } } diff --git a/app/src/main/java/com/gh/gamecenter/game/imageslide/ImageSlideAdapter.kt b/app/src/main/java/com/gh/gamecenter/game/imageslide/ImageSlideAdapter.kt index a904baba24..7c8ccf1ee8 100644 --- a/app/src/main/java/com/gh/gamecenter/game/imageslide/ImageSlideAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/game/imageslide/ImageSlideAdapter.kt @@ -4,23 +4,24 @@ import android.content.Context import android.graphics.Color import android.view.View import android.view.ViewGroup -import androidx.databinding.DataBindingUtil import com.gh.common.util.StringUtils import com.gh.common.util.dip2px +import com.gh.common.util.toBinding import com.gh.gamecenter.GameDetailActivity -import com.gh.gamecenter.R import com.gh.gamecenter.databinding.GameHorizontalSimpleItemBinding import com.gh.gamecenter.entity.GameEntity import com.gh.gamecenter.game.horizontal.GameHorizontalSimpleItemViewHolder import com.lightgame.adapter.BaseRecyclerAdapter -class ImageSlideAdapter(context: Context, - var subject: GameEntity, - val skipListener: View.OnClickListener, - val entrance: String) : BaseRecyclerAdapter(context) { +class ImageSlideAdapter( + context: Context, + var subject: GameEntity, + val skipListener: View.OnClickListener, + val entrance: String +) : BaseRecyclerAdapter(context) { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GameHorizontalSimpleItemViewHolder { - val binding: GameHorizontalSimpleItemBinding = DataBindingUtil.inflate(mLayoutInflater, R.layout.game_horizontal_simple_item, parent, false) + val binding: GameHorizontalSimpleItemBinding = parent.toBinding() val layoutParam = ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) binding.root.layoutParams = layoutParam binding.gameName.setTextColor(Color.WHITE) @@ -37,7 +38,11 @@ class ImageSlideAdapter(context: Context, holder.binding.root.setPadding(padL, 0, padR, 24F.dip2px()) val gameEntity = subject.games?.get(position) - holder.binding.game = gameEntity + gameEntity?.let { + holder.binding.gameIcon.displayGameIcon(it) + GameHorizontalSimpleItemViewHolder.setHorizontalNameAndGravity(holder.binding.gameName, it.name) + } + holder.itemView.isClickable = false holder.binding.gameName.setOnClickListener { skipGameDetail(gameEntity, position) } holder.binding.gameIcon.setOnClickListener { skipGameDetail(gameEntity, position) } @@ -45,8 +50,10 @@ class ImageSlideAdapter(context: Context, } private fun skipGameDetail(gameEntity: GameEntity?, position: Int) { - GameDetailActivity.startGameDetailActivity(mContext, gameEntity, - StringUtils.buildString("($entrance:", subject.name, "-列表[", (position + 1).toString(), "])"), traceEvent = gameEntity?.exposureEvent) + GameDetailActivity.startGameDetailActivity( + mContext, gameEntity, + StringUtils.buildString("($entrance:", subject.name, "-列表[", (position + 1).toString(), "])"), traceEvent = gameEntity?.exposureEvent + ) } fun checkResetData(subjectEntity: GameEntity) { diff --git a/app/src/main/java/com/gh/gamecenter/game/upload/UploadScheduleDialog.kt b/app/src/main/java/com/gh/gamecenter/game/upload/UploadScheduleDialog.kt index 53fc3ca7db..3b3bcf195b 100644 --- a/app/src/main/java/com/gh/gamecenter/game/upload/UploadScheduleDialog.kt +++ b/app/src/main/java/com/gh/gamecenter/game/upload/UploadScheduleDialog.kt @@ -5,7 +5,6 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.core.content.ContextCompat -import androidx.databinding.DataBindingUtil import com.gh.base.fragment.BaseDialogFragment import com.gh.common.util.MtaHelper import com.gh.gamecenter.R @@ -25,7 +24,7 @@ class UploadScheduleDialog : BaseDialogFragment() { var onClickListener: ((pos: Int) -> Unit)? = null override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - binding = DataBindingUtil.inflate(inflater, R.layout.dialog_upload_schedule, container, false) + binding = DialogUploadScheduleBinding.bind(layoutInflater.inflate(R.layout.dialog_upload_schedule, null, false)) return binding.root } @@ -63,18 +62,17 @@ class UploadScheduleDialog : BaseDialogFragment() { binding.executePendingBindings() }*/ - fun uploadFail(){ + fun uploadFail() { MtaHelper.onEvent("游戏上传", "游戏上传", "上传失败") - binding.isUploadSuccess = true + binding.tvGiveUpUpload.visibility = View.GONE + binding.tvExit.visibility = View.VISIBLE + binding.tvContactCustomerService.visibility = View.VISIBLE binding.ivUpload.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_upload_failure)) binding.tvUpload.text = "游戏上传失败" binding.circleProgressBar.isDisable(true) - - binding.executePendingBindings() } - override fun onBack(): Boolean { return true } diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/choose/AddSearchAndPlayedGameAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/choose/AddSearchAndPlayedGameAdapter.kt index 59df213f81..c639f8c830 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/choose/AddSearchAndPlayedGameAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/choose/AddSearchAndPlayedGameAdapter.kt @@ -37,7 +37,7 @@ class AddSearchAndPlayedGameAdapter(context: Context, val mChooseGamesViewModel: if (holder is GameItemViewHolder) { val entity = mEntityList[position] val isSelected = mChooseGamesViewModel.chooseGamesLiveData.value?.find { it.id == entity.id } != null - holder.binding.game = entity + holder.bindGameItem(entity) holder.binding.downloadBtn.text = if (isSelected) "删除" else "添加" holder.binding.downloadBtn.background = if (isSelected) R.drawable.bg_shape_f5_radius_999.toDrawable() else R.drawable.download_button_normal_style.toDrawable() diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailAdapter.kt index e9fead4292..786cdaf747 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailAdapter.kt @@ -11,6 +11,7 @@ import android.view.View import android.view.ViewGroup import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.RecyclerView +import com.gh.common.databind.BindingAdapters import com.gh.common.exposure.ExposureEvent import com.gh.common.exposure.ExposureSource import com.gh.common.exposure.ExposureType @@ -218,7 +219,7 @@ open class GameCollectionDetailAdapter( likeCountTv.text = mViewModel.getLikeText(comment.vote, "") root.setOnClickListener { binding.commentCountTv.performClick() } - if (comment.parentUser != null && !TextUtils.isEmpty(comment.parentUser!!.id) ) { + if (comment.parentUser != null && !TextUtils.isEmpty(comment.parentUser!!.id)) { val prefix = "回复" val colon = " :" val parentUserName = " ${comment.parentUser?.name} " @@ -289,21 +290,21 @@ open class GameCollectionDetailAdapter( } else { binding.commentPictureRv.visibility = View.GONE } - this.comment = comment + CommentItemViewHolder.bindView(binding, comment) contentTv.setExpandMaxLines(if (comment.isExpand) Int.MAX_VALUE else 4) contentTv.setIsExpanded(comment.isExpand) collapseTv.goneIf(!comment.isExpand) contentTv.setExpandCallback { comment.isExpand = true collapseTv.visibility = View.VISIBLE - this.comment = comment + CommentItemViewHolder.bindView(binding, comment) } collapseTv.setOnClickListener { comment.isExpand = false collapseTv.visibility = View.GONE contentTv.setExpandMaxLines(4) contentTv.setIsExpanded(false) - this.comment = comment + CommentItemViewHolder.bindView(binding, comment) } userIconIv.display( comment.user.border, @@ -490,16 +491,28 @@ open class GameCollectionDetailAdapter( } } - inner class GameCollectionGameEmptyViewHolder(view: View): RecyclerView.ViewHolder(view) + inner class GameCollectionGameEmptyViewHolder(view: View) : RecyclerView.ViewHolder(view) - inner class GameCollectionDividerViewHolder(view: View): RecyclerView.ViewHolder(view) + inner class GameCollectionDividerViewHolder(view: View) : RecyclerView.ViewHolder(view) - inner class GameCollectionGameItemViewHolder(val binding: GameCollectionGameItemBinding): RecyclerView.ViewHolder(binding.root) { + inner class GameCollectionGameItemViewHolder(val binding: GameCollectionGameItemBinding) : RecyclerView.ViewHolder(binding.root) { fun bindView(gameEntity: GameEntity, position: Int, isLast: Boolean) { binding.run { - game = gameEntity - gameItemIncluded.game = gameEntity + gameItemIncluded.run { + gameIconView.displayGameIcon(gameEntity) + BindingAdapters.setGameName(gameName, gameEntity, false, null) + BindingAdapters.setTextSize(gameRating, if (gameEntity.commentCount > 3) 12 else 10) + BindingAdapters.setGameTags(labelList, gameEntity) + gameRating.setCompoundDrawables(if (gameEntity.commentCount > 3) R.drawable.game_horizontal_rating.toDrawable() else null, null, null, null) + gameRating.setPadding(0, 0, if (gameEntity.commentCount > 3) 8F.dip2px() else 0, 0) + gameRating.text = if (gameEntity.commentCount > 3) { + if (gameEntity.star == 10.0F) "10" else gameEntity.star.toString() + } else "" + gameRating.setTextColor(if (gameEntity.commentCount > 3) R.color.theme_font.toColor() else R.color.theme.toColor()) + gameDes.text = gameEntity.decoratedDes + recommendStar.rating = gameEntity.recommendStar.toFloat() + } root.setPadding( 16F.dip2px(), if (position == 0) 16F.dip2px() else 8F.dip2px(), @@ -510,7 +523,6 @@ open class GameCollectionDetailAdapter( gameItemIncluded.root.background = null gameItemIncluded.recommendStarPref.text = "推荐指数" initServerType(gameEntity) - executePendingBindings() val exposureSources = ArrayList().apply { add(ExposureSource("游戏单", "${mViewModel.gameCollectionTitle}+${mViewModel.gameCollectionId}")) @@ -551,7 +563,8 @@ open class GameCollectionDetailAdapter( this@GameCollectionDetailAdapter, mEntrance, "游戏单详情-游戏列表:${gameEntity.name}", - exposureEvent) + exposureEvent + ) DownloadItemUtils.updateItem(mContext, gameEntity, GameViewHolder(binding.gameItemIncluded), true, isShowRecommendStar = true) } @@ -582,7 +595,10 @@ open class GameCollectionDetailAdapter( private fun getAuthTagBitmap(): Bitmap? { val view = LayoutGameCollectionAuthTagBinding.inflate(mLayoutInflater).root - view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)) + view.measure( + View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), + View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED) + ) view.layout(0, 0, view.measuredWidth, view.measuredHeight) val bitmap = Bitmap.createBitmap(view.measuredWidth, view.measuredHeight, Bitmap.Config.ARGB_8888) val canvas = Canvas(bitmap) diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailFragment.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailFragment.kt index 986cd26ee5..6bd993a4c7 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailFragment.kt @@ -398,9 +398,10 @@ class GameCollectionDetailFragment : private fun initImageTypeView() { mBinding?.imageItem?.run { mEntity?.run { - entity = this - executePendingBindings() - + nameTv.text = title + userNameTv.text = user?.name + ImageUtils.display(poster, cover) + tagIv.goneIf(stamp.isEmpty()) imageItemDesTv.text = intro when (stamp) { @@ -420,9 +421,9 @@ class GameCollectionDetailFragment : private fun initVideoTypeView() { mBinding?.videoItem?.run { mEntity?.run { - entity = this - executePendingBindings() - + tagIv.goneIf(stamp.isEmpty()) + userNameTv.text = user?.name + nameTv.text = title videoItemDesTv.text = intro when (stamp) { diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionPosterFragment.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionPosterFragment.kt index e01ae71af8..8f90900c44 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionPosterFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionPosterFragment.kt @@ -11,6 +11,7 @@ import com.gh.gamecenter.R import com.gh.gamecenter.databinding.FragmentGameCollectionPosterBinding import com.gh.gamecenter.databinding.LayoutGameCollectionTagBinding import com.gh.gamecenter.entity.GamesCollectionDetailEntity +import com.gh.gamecenter.manager.UserManager import com.gh.gamecenter.normal.NormalFragment class GameCollectionPosterFragment : NormalFragment() { @@ -49,9 +50,10 @@ class GameCollectionPosterFragment : NormalFragment() { mBinding.apply { mEntity.apply { - entity = this - executePendingBindings() - + nameTv.text = title + userName.text = user?.name + desTv.text=intro + followTv.goneIf(user?.id == UserManager.getInstance().userId) ImageUtils.getBitmap(cover, object : BiCallback { @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1) override fun onFirst(first: Bitmap) { diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/conversation/GameCollectionCommentConversationAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/conversation/GameCollectionCommentConversationAdapter.kt index 8faf77c051..86155840d4 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/conversation/GameCollectionCommentConversationAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/conversation/GameCollectionCommentConversationAdapter.kt @@ -5,10 +5,8 @@ import android.view.View import android.view.ViewGroup import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintSet -import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView -import com.gh.common.util.* -import com.gh.gamecenter.R +import com.gh.common.util.dip2px import com.gh.gamecenter.databinding.ItemArticleDetailCommentBinding import com.gh.gamecenter.entity.CommentEntity import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailAdapter @@ -28,7 +26,7 @@ class GameCollectionCommentConversationAdapter( return when (viewType) { ITEM_COMMENT_TOP -> { val binding: ItemArticleDetailCommentBinding = - DataBindingUtil.inflate(mLayoutInflater, R.layout.item_article_detail_comment, parent, false) + ItemArticleDetailCommentBinding.inflate(mLayoutInflater, parent, false) TopCommentItemViewHolder(binding).apply { topCommentVH = this } } @@ -78,7 +76,7 @@ class GameCollectionCommentConversationAdapter( binding.floorHintTv.layoutParams = this } - binding.comment = comment + CommentItemViewHolder.bindView(binding, comment) binding.moreIv.visibility = View.GONE binding.divider.visibility = View.VISIBLE binding.commentCountTv.visibility = View.GONE diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/mine/MyGameCollectionViewHolder.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/mine/MyGameCollectionViewHolder.kt index 3356d9ef05..35193fa70c 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/mine/MyGameCollectionViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/mine/MyGameCollectionViewHolder.kt @@ -3,6 +3,8 @@ package com.gh.gamecenter.gamecollection.mine import android.view.LayoutInflater import com.gh.base.BaseRecyclerViewHolder import com.gh.common.util.DialogHelper +import com.gh.common.util.ImageUtils +import com.gh.common.util.TimeUtils import com.gh.common.util.goneIf import com.gh.gamecenter.databinding.ItemGameCollectionFlexTagBinding import com.gh.gamecenter.databinding.ItemMyGameCollectionBinding @@ -20,7 +22,12 @@ class MyGameCollectionViewHolder( BaseRecyclerViewHolder(binding.root) { fun bindGameCollectionItem(entity: GamesCollectionEntity) { - binding.entity = entity + ImageUtils.display(binding.posterView, entity.cover) + binding.gameCollectionNameTv.text = entity.title + binding.createTimeTv.goneIf(!(entity.status == "pass" && entity.display != "self_only")) + binding.createTimeTv.text = TimeUtils.getFormatTime(entity.time?.create ?: 0, "MM-dd") + binding.statusView.goneIf(!(entity.status != "pass" || entity.display == "self_only")) + binding.publishBtn.goneIf(entity.display != "self_only") initTagsUI(entity.tags ?: arrayListOf()) val statusLabelRes = entity.getStatusLabelRes() if (statusLabelRes > 0) { diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionAmwayAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionAmwayAdapter.kt index 901c7b741b..eb14309988 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionAmwayAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionAmwayAdapter.kt @@ -26,8 +26,9 @@ class GameCollectionAmwayAdapter(context: Context) : override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { if (holder is GameCollectionAmwayContentItemViewHolder) { - holder.binding.entity = mAmwayList[getRealPosition(position)] - holder.binding.amwayTv.text = TextHelper.getCommentLabelSpannableStringBuilder(mAmwayList[getRealPosition(position)].comment.content, R.color.white_alpha_80) + val entity = mAmwayList[getRealPosition(position)] + holder.binding.gameIcon.displayGameIcon(entity.game.toGameEntity()) + holder.binding.amwayTv.text = TextHelper.getCommentLabelSpannableStringBuilder(entity.comment.content, R.color.white_alpha_80) } } diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescCommentsAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescCommentsAdapter.kt index 1ca1022b1d..2ddc297133 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescCommentsAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescCommentsAdapter.kt @@ -9,7 +9,6 @@ import android.widget.LinearLayout import android.widget.PopupWindow import android.widget.TextView import androidx.core.content.ContextCompat -import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView import com.gh.base.BaseActivity import com.gh.common.constant.Constants @@ -28,11 +27,12 @@ import com.gh.gamecenter.manager.UserManager import org.greenrobot.eventbus.EventBus import java.util.regex.Pattern -class DescCommentsAdapter(context: Context, - var mViewModel: DescViewModel, - private var mEntrance: String, - private var gameName: String?) - : ListAdapter(context) { +class DescCommentsAdapter( + context: Context, + var mViewModel: DescViewModel, + private var mEntrance: String, + private var gameName: String? +) : ListAdapter(context) { var comments = ArrayList() val path = "游戏详情:介绍" @@ -47,7 +47,7 @@ class DescCommentsAdapter(context: Context, override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { return if (viewType == ItemViewType.ITEM_BODY) { - GameDetailRatingCommentViewHolder(DataBindingUtil.inflate(LayoutInflater.from(mContext), R.layout.item_game_detail_rating_comment, parent, false)) + GameDetailRatingCommentViewHolder(parent.toBinding()) } else { MoreViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_game_detail_comment_more, parent, false)) } @@ -62,7 +62,10 @@ class DescCommentsAdapter(context: Context, val commentData = comments[position] var isChildLongClick = false holder.binding.run { - data = commentData + ImageUtils.display(userIcon, commentData.user.icon) + ImageUtils.display(userBadge, commentData.user.auth?.icon) + userName.text = commentData.user.name + ratingStart.rating = commentData.star.toFloat() val p = Pattern.compile(RatingEditActivity.LABEL_REGEX) val m = p.matcher(commentData.content) if (m.find()) { @@ -86,7 +89,8 @@ class DescCommentsAdapter(context: Context, time.setTextColor(ContextCompat.getColor(mContext, R.color.text_subtitleDesc)) time.text = if (commentData.ignore) { val s = "${NewsUtils.getFormattedTime(commentData.time)} 保护期评论不计入总分" - SpanBuilder(s).image(s.length - 12, s.length - 11, R.drawable.ic_ignore_rating_tips).color(mContext, s.length - 10, s.length, R.color.text_subtitle).build() + SpanBuilder(s).image(s.length - 12, s.length - 11, R.drawable.ic_ignore_rating_tips) + .color(mContext, s.length - 10, s.length, R.color.text_subtitle).build() } else { NewsUtils.getFormattedTime(commentData.time) } @@ -161,10 +165,15 @@ class DescCommentsAdapter(context: Context, "投诉" -> { MtaHelper.onEvent("游戏详情_新", "玩家评论_投诉", mViewModel.game?.name) mContext.ifLogin(BaseActivity.mergeEntranceAndPath(mEntrance, path)) { - DialogUtils.showReportReasonDialog(mContext, + DialogUtils.showReportReasonDialog( + mContext, Constants.REPORT_LIST.toList() as java.util.ArrayList ) { reason, desc -> - SimpleRequestHelper.reportGameComment(mViewModel.game?.id ?: "", commentData.id, if (reason != "其他原因") reason else desc) + SimpleRequestHelper.reportGameComment( + mViewModel.game?.id ?: "", + commentData.id, + if (reason != "其他原因") reason else desc + ) } } } @@ -174,9 +183,11 @@ class DescCommentsAdapter(context: Context, time.setOnClickListener { if (commentData.isEditContent == null && commentData.ignore) { MtaHelper.onEvent("游戏详情_新", "玩家评论-评论说明", mViewModel.game?.name) - DialogUtils.showStopServerExplanationDialog(mContext, if (mViewModel.game?.commentDescription?.isNotEmpty() == true) - mViewModel.game?.commentDescription else mContext.getString(R.string.rating_protection), mViewModel.game?.name - ?: "") + DialogUtils.showStopServerExplanationDialog( + mContext, if (mViewModel.game?.commentDescription?.isNotEmpty() == true) + mViewModel.game?.commentDescription else mContext.getString(R.string.rating_protection), mViewModel.game?.name + ?: "" + ) } else if (commentData.isEditContent == true) { MtaHelper.onEvent("游戏详情_新", "玩家评论-点击时间", mViewModel.game?.name) val intent = CommentLogsActivity.getIntent(mContext, mViewModel.game!!.id, commentData.id) @@ -199,9 +210,9 @@ class DescCommentsAdapter(context: Context, val inflater = LayoutInflater.from(v.context) val layout = inflater.inflate(R.layout.layout_popup_container, null) val popupWindow = PopupWindow( - layout, - LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.WRAP_CONTENT + layout, + LinearLayout.LayoutParams.WRAP_CONTENT, + LinearLayout.LayoutParams.WRAP_CONTENT ) popupWindow.apply { setBackgroundDrawable(ColorDrawable(0)) diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/desc/GameLatestServiceAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/desc/GameLatestServiceAdapter.kt index 5399dd98c2..0de452c641 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/desc/GameLatestServiceAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/desc/GameLatestServiceAdapter.kt @@ -6,11 +6,10 @@ import android.view.LayoutInflater import android.view.View.MeasureSpec import android.view.ViewGroup import android.view.ViewTreeObserver -import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView import com.gh.common.util.TimeUtils import com.gh.common.util.safelyGetInRelease -import com.gh.gamecenter.R +import com.gh.common.util.toBinding import com.gh.gamecenter.databinding.ItemGameDetailLatestServiceBinding import com.gh.gamecenter.databinding.ItemGameDetailMoreBinding import com.gh.gamecenter.entity.ServerCalendarEntity @@ -57,7 +56,7 @@ class GameLatestServiceAdapter(val context: Context, val datas: ArrayList, val gameName: String, val listListener: OnListClickListener?) : RecyclerView.Adapter() { var mIsExpand = false private val mShowItemCount: Int = 3//最多展示多少个礼包 override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { return if (viewType == LIBAO_ITEM) { - LibaoViewHolder(DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.item_game_libao, parent, false)) + LibaoViewHolder(parent.toBinding()) } else { MoreViewHolder(ItemGameDetailMoreBinding.inflate(LayoutInflater.from(context), parent, false)) } diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/desc/GameRaidersAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/desc/GameRaidersAdapter.kt index 58afff9cf6..16d56f4d3b 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/desc/GameRaidersAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/desc/GameRaidersAdapter.kt @@ -3,7 +3,6 @@ package com.gh.gamecenter.gamedetail.desc import android.content.Context import android.view.LayoutInflater import android.view.ViewGroup -import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView import com.gh.common.DefaultUrlHandler import com.gh.common.util.* @@ -21,7 +20,7 @@ class GameRaidersAdapter(val context: Context, val articles: ArrayList, val mEntrance: String) : RecyclerView.Adapter() { +class GameRelatedVersionAdapter( + val context: Context, + val gameName: String, + val datas: ArrayList, + val mEntrance: String +) : RecyclerView.Adapter() { var isExpand = false private val mShowItemCount: Int = 3 @@ -25,7 +26,7 @@ class GameRelatedVersionAdapter(val context: Context, val gameName: String, val override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { return if (viewType == RELATED_VERSION_ITEM) { - GameDetailRelatedViewHolder(DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.item_game_detail_related_version, parent, false)) + GameDetailRelatedViewHolder(parent.toBinding()) } else { MoreViewHolder(LayoutInflater.from(context).inflate(R.layout.item_game_detail_more, parent, false)) } @@ -49,13 +50,17 @@ class GameRelatedVersionAdapter(val context: Context, val gameName: String, val val relatedVersion = datas[position] when (holder) { is GameDetailRelatedViewHolder -> { - holder.binding.relatedVersion = relatedVersion + holder.binding.gameNameTv.text = relatedVersion.gameName GameViewUtils.setLabelList(context, holder.binding.gameLabelLl, "type", relatedVersion.gameTags) holder.binding.gameIconView.displayGameIcon(relatedVersion.game?.getIcon(), relatedVersion.game?.iconSubscript) holder.itemView.setOnClickListener { MtaHelper.onEvent("游戏详情_新", "相关游戏版本", "${gameName}+${relatedVersion.gameName}") - GameDetailActivity.startGameDetailActivity(context, relatedVersion.gameId, - StringUtils.buildString(mEntrance, "+(", "游戏详情", "[", relatedVersion.gameName, "]:相关游戏[", (position + 1).toString(), "])"), exposureEventList.safelyGetInRelease(position)) + GameDetailActivity.startGameDetailActivity( + context, + relatedVersion.gameId, + StringUtils.buildString(mEntrance, "+(", "游戏详情", "[", relatedVersion.gameName, "]:相关游戏[", (position + 1).toString(), "])"), + exposureEventList.safelyGetInRelease(position) + ) } } is MoreViewHolder -> { diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/dialog/GamePermissionAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/dialog/GamePermissionAdapter.kt index 64836ec34e..da4641f0d4 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/dialog/GamePermissionAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/dialog/GamePermissionAdapter.kt @@ -2,7 +2,6 @@ package com.gh.gamecenter.gamedetail.dialog import android.content.Context import android.graphics.Typeface -import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.LinearLayout @@ -11,6 +10,7 @@ import androidx.core.content.ContextCompat import androidx.recyclerview.widget.RecyclerView import com.gh.base.BaseRecyclerViewHolder import com.gh.common.util.dip2px +import com.gh.common.util.toBinding import com.gh.gamecenter.R import com.gh.gamecenter.databinding.GamePermissionItemBinding import com.gh.gamecenter.gamedetail.entity.Permission @@ -19,7 +19,7 @@ import com.lightgame.adapter.BaseRecyclerAdapter class GamePermissionAdapter(context: Context, val permissions: List) : BaseRecyclerAdapter(context) { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { - return GamePermissionViewHolder(GamePermissionItemBinding.bind(LayoutInflater.from(mContext).inflate(R.layout.game_permission_item, parent, false))) + return GamePermissionViewHolder(parent.toBinding()) } override fun getItemCount(): Int = permissions.size diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/fuli/kaifu/ServersCalendarActivity.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/fuli/kaifu/ServersCalendarActivity.kt index 942b7f32a0..69008dcd1f 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/fuli/kaifu/ServersCalendarActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/fuli/kaifu/ServersCalendarActivity.kt @@ -10,7 +10,6 @@ import android.os.Bundle import android.text.TextUtils import android.view.* import android.widget.TextView -import androidx.databinding.DataBindingUtil import androidx.lifecycle.ViewModelProviders import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.LinearLayoutManager @@ -81,7 +80,7 @@ class ServersCalendarActivity : ToolBarActivity() { val postButton = container.findViewById(R.id.menu_post_text) postButton.text = "反馈" - mBinding = DataBindingUtil.bind(mContentView)!! + mBinding = ActivityServersCalendarBinding.bind(mContentView) mBinding.includeNoConnection.root.setOnClickListener { mBinding.includeLoading.root.visibility = View.VISIBLE mBinding.includeNoConnection.root.visibility = View.GONE diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/fuli/kaifu/ServersCalendarAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/fuli/kaifu/ServersCalendarAdapter.kt index bc495f5104..485d670404 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/fuli/kaifu/ServersCalendarAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/fuli/kaifu/ServersCalendarAdapter.kt @@ -100,7 +100,7 @@ class ServersCalendarAdapter(context: Context, if (meEntity?.isPartTime == true) { (mContext as Activity).startActivityForResult( getIntent(mContext, - viewModel.serverCalendarLiveData.value!!.last(), + if (viewModel.serverCalendarLiveData.value.isNullOrEmpty()) ServerCalendarEntity() else viewModel.serverCalendarLiveData.value!!.last(), viewModel.serverCalendarLiveData.value as ArrayList, mGameEntity.id, viewModel.getSelectTime(entity.day, entity.month, entity.year)), diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/history/HistoryApkListAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/history/HistoryApkListAdapter.kt index 481146f486..aaede0dc20 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/history/HistoryApkListAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/history/HistoryApkListAdapter.kt @@ -30,9 +30,11 @@ import com.lightgame.download.DownloadEntity import com.lightgame.download.DownloadStatus import com.lightgame.utils.Utils -class HistoryApkListAdapter(context: Context, - private var mViewModel: HistoryApkListViewModel, - private var mEntrance: String) : ListAdapter(context), IExposable { +class HistoryApkListAdapter( + context: Context, + private var mViewModel: HistoryApkListViewModel, + private var mEntrance: String +) : ListAdapter(context), IExposable { private val mBasicExposureSource by lazy { ExposureSource("历史版本", "") } @@ -60,7 +62,7 @@ class HistoryApkListAdapter(context: Context, val exposureEvent = ExposureEvent.createEvent(gameEntity = gameEntity, source = listOf(mBasicExposureSource)) - holder.binding.apk = apkEntity + holder.binding.updateDescTv.text = apkEntity.updateDesc holder.binding.versionTv.text = "版本${apkEntity.version}" holder.binding.updateDescTv.setExpandMaxLines(maxDesLines) holder.binding.updateDescTv.setIsExpanded(maxDesLines == Int.MAX_VALUE) @@ -68,12 +70,12 @@ class HistoryApkListAdapter(context: Context, holder.binding.updateDescTv.setExpandCallback { mExpandSparseBooleanArray.put(holder.adapterPosition, true) updateDescMarginRight( - holder.binding.updateDescTv, - mExpandSparseBooleanArray.get(holder.adapterPosition), - holder.binding.downloadBtn.visibility == View.VISIBLE) + holder.binding.updateDescTv, + mExpandSparseBooleanArray.get(holder.adapterPosition), + holder.binding.downloadBtn.visibility == View.VISIBLE + ) MtaHelper.onEvent("历史版本", "展开", "${mViewModel.game?.name}+${apkEntity.version}") } - holder.binding.executePendingBindings() holder.binding.downloadBtn.run { setOnTouchListener { _, event -> if (event.action == MotionEvent.ACTION_UP) { @@ -89,14 +91,15 @@ class HistoryApkListAdapter(context: Context, } DownloadItemUtils.setOnClickListener( - holder.binding.root.context, - this, - gameEntity, - 0, - this@HistoryApkListAdapter, - "$mEntrance+(历史版本)", - "历史版本", - exposureEvent) + holder.binding.root.context, + this, + gameEntity, + 0, + this@HistoryApkListAdapter, + "$mEntrance+(历史版本)", + "历史版本", + exposureEvent + ) if (apkEntity.downloadStatus == "off" || apkEntity.url.isNullOrEmpty()) { visibility = View.INVISIBLE @@ -122,8 +125,11 @@ class HistoryApkListAdapter(context: Context, } } } else { - downloadText = if (PackagesManager.isInstalledWithSpecificVersion(apkEntity.packageName, apkEntity.version - ?: "")) { + downloadText = if (PackagesManager.isInstalledWithSpecificVersion( + apkEntity.packageName, apkEntity.version + ?: "" + ) + ) { resources.getString(R.string.launch) } else { resources.getString(R.string.download) @@ -142,9 +148,10 @@ class HistoryApkListAdapter(context: Context, } } updateDescMarginRight( - holder.binding.updateDescTv, - mExpandSparseBooleanArray.get(holder.adapterPosition), - holder.binding.downloadBtn.visibility == View.VISIBLE) + holder.binding.updateDescTv, + mExpandSparseBooleanArray.get(holder.adapterPosition), + holder.binding.downloadBtn.visibility == View.VISIBLE + ) } } } diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/myrating/MyRatingAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/myrating/MyRatingAdapter.kt index 3f4e9f011a..14411d6862 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/myrating/MyRatingAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/myrating/MyRatingAdapter.kt @@ -17,9 +17,11 @@ import com.gh.gamecenter.gamedetail.rating.edit.RatingEditActivity import com.gh.gamecenter.personalhome.rating.MyRating import java.util.regex.Pattern -class MyRatingAdapter(context: Context, - val mEntrance: String, - val mListViewModel: MyRatingViewModel) : ListAdapter(context) { +class MyRatingAdapter( + context: Context, + val mEntrance: String, + val mListViewModel: MyRatingViewModel +) : ListAdapter(context) { private var mExpandSparseBooleanArray = SparseBooleanArray() @@ -43,7 +45,13 @@ class MyRatingAdapter(context: Context, is MyRatingViewHolder -> { var isChildLongClick = false val rating = mEntityList[position] - holder.binding.rating = rating + holder.binding.gameName.text = rating.game.name + holder.binding.scoreTv.text = if (rating.game.star > 0) rating.game.star.toString() else "评分过少" + holder.binding.scoreTv.textSize = if (rating.game.star > 0) 18f else 8f + holder.binding.ratingBar.rating=rating.star.toFloat() + holder.binding.comment.text=if (rating.reply > 0) NumberUtils.transSimpleCount(rating.reply) else "" + holder.binding.vote.isChecked=rating.me.isVoted + holder.binding.vote.text=if (rating.vote > 0) NumberUtils.transSimpleCount(rating.vote) else "" val maxDesLines = if (mExpandSparseBooleanArray.get(holder.adapterPosition)) Int.MAX_VALUE else 3 holder.binding.tvComment.setExpandMaxLines(maxDesLines) holder.binding.tvComment.setIsExpanded(Int.MAX_VALUE == maxDesLines) diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingAdapter.kt index 78c308d0f1..1396565aeb 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingAdapter.kt @@ -6,6 +6,7 @@ import android.content.Intent import android.util.SparseBooleanArray import android.view.View import android.view.ViewGroup +import android.widget.ProgressBar import androidx.core.content.ContextCompat import androidx.recyclerview.widget.RecyclerView import com.gh.common.constant.ItemViewType @@ -17,13 +18,16 @@ import com.gh.gamecenter.databinding.RatingCommentItemBinding import com.gh.gamecenter.databinding.RatingItemBinding import com.gh.gamecenter.entity.Rating import com.gh.gamecenter.entity.RatingComment +import com.gh.gamecenter.entity.Star import com.gh.gamecenter.gamedetail.rating.edit.RatingEditActivity import com.lightgame.utils.Utils -class RatingAdapter(context: Context, - private val mListViewModel: RatingViewModel, - private var mDirectComment: Boolean, - private val mEntrance: String) : ListAdapter(context) { +class RatingAdapter( + context: Context, + private val mListViewModel: RatingViewModel, + private var mDirectComment: Boolean, + private val mEntrance: String +) : ListAdapter(context) { var ratingData: Rating? = null val path = if (mListViewModel.type == RatingViewModel.RatingType.RATING) "游戏详情:评分" else "折叠评论" @@ -124,16 +128,24 @@ class RatingAdapter(context: Context, private fun bindRatingItem(holder: RatingItemViewHolder) { holder.binding.run { - ratingData?.serviceComment?.isServiceComment = true - data = ratingData - /*ratingSelector.setOnRatingChangeListener { ratingBar, rating -> - MtaHelper.onEvent("游戏详情_新", "评论Tab_点击星星", mListViewModel.game.name + "- ${rating.toInt()}") - if (!ClickUtils.isFastDoubleClick(ratingBar.id, 1000)) { - skipRatingEdit(rating, "游戏详情-评论-点击星星") - // 与传进评论编辑的星星保持一致 - ratingSelector.postDelayed({ ratingSelector.rating = 0F }, 500) - } - }*/ + ratingData?.let { + it.serviceComment?.isServiceComment = true + notEnoughCommentTips.goneIf(it.commentCount > 3) + scoreProgressContainer.goneIf(it.commentCount <= 3) + scoreTv.textSize = if (it.commentCount > 3) 18f else 8f + scoreTv.text = if (it.commentCount > 3) (if (it.star.average == 10.0f) "10" else it.star.average.toString()) else "评分过少" + setRatingScore(ratingScoreFive, it.star) + setRatingScore(ratingScoreFour, it.star) + setRatingScore(ratingScoreThree, it.star) + setRatingScore(ratingScoreTwo, it.star) + setRatingScore(ratingScoreOne, it.star) + actionButtonContainer.goneIf(it.me.isCommented) + stopServerContainer.goneIf(!it.ignoreComment) + serviceCommentTitle.goneIf(it.serviceComment == null) + myCommentTitle.goneIf(it.myComment == null) + allComment.goneIf(!it.isExistComment) + } + ratingEditBtn.setOnClickListener { mContext.showRegulationTestDialogIfNeeded { MtaHelper.onEvent("游戏详情_新", "评论Tab_点击我来评论", mListViewModel.game.name) @@ -216,6 +228,27 @@ class RatingAdapter(context: Context, } } + private fun setRatingScore(progress: ProgressBar, star: Star) { + if (star.hits <= 3) { + progress.progress = 0 + return + } + var targetScore = 0 + when (progress.id) { + R.id.rating_score_five -> targetScore = star.five / 10 + R.id.rating_score_four -> targetScore = star.four / 8 + R.id.rating_score_three -> targetScore = star.three / 6 + R.id.rating_score_two -> targetScore = star.two / 4 + R.id.rating_score_one -> targetScore = star.one / 2 + } + + var f = (targetScore / star.hits.toFloat()) * 100 + if (0 < f && f < 1) { + f = 1F + } + progress.progress = f.toInt() + } + private fun initRatingComment(holder: RatingCommentItemViewHolder, commentData: RatingComment, dataPosition: Int) { var isChildLongClick = false val maxDesLines = if (mExpandSparseBooleanArray.get(holder.adapterPosition)) Int.MAX_VALUE else 4 @@ -328,7 +361,8 @@ class RatingAdapter(context: Context, if (mContext is Activity) { val installPackageName = mListViewModel.canUserCommentThisGame() if (mDirectComment || !installPackageName.isNullOrEmpty()) { - val intent = RatingEditActivity.getIntent(mContext, mListViewModel.game, starCount, installPackageName, fromAmway, isSkipSuccessPage) + val intent = + RatingEditActivity.getIntent(mContext, mListViewModel.game, starCount, installPackageName, fromAmway, isSkipSuccessPage) (mContext as Activity).startActivityForResult(intent, RatingFragment.RATING_EDIT_REQUEST) } else { Utils.toast(mContext, "安装游戏后才能评论哦") diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingCommentItemViewHolder.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingCommentItemViewHolder.kt index 4a37638083..95089359d2 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingCommentItemViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingCommentItemViewHolder.kt @@ -1,5 +1,6 @@ package com.gh.gamecenter.gamedetail.rating +import android.annotation.SuppressLint import android.content.Context import android.graphics.Color import android.graphics.drawable.BitmapDrawable @@ -41,6 +42,7 @@ import java.util.* import java.util.regex.Pattern class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseRecyclerViewHolder(binding.root) { + @SuppressLint("CheckResult") fun setContent(commentData: RatingComment, game: GameEntity?, dataPosition: Int, entrance: String, path: String) { binding.run { val context = itemView.context @@ -53,14 +55,28 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR content.setTextWithHighlightedTextWrappedInsideWrapper(text = commentData.content, copyClickedText = true) } - data = commentData + commentItem.setPadding(0, 0, 0, if (!commentData.active || commentData.replyData != null) 16f.dip2px() else 0) + userName.text = commentData.user.name + ratingStart.rating = commentData.star.toFloat() + device.text = commentData.getDevice() + device.visibility = if (commentData.active && commentData.getDevice().isNotEmpty()) View.VISIBLE else View.GONE + version.visibility = if (commentData.active && commentData.gameVersion.isNotEmpty()) View.VISIBLE else View.GONE + comment.text = if (commentData.reply > 0) NumberUtils.transSimpleCount(commentData.reply) else "" + vote.isChecked = commentData.me.isVoted + vote.text = if (commentData.vote > 0) NumberUtils.transSimpleCount(commentData.vote) else "" + groupCl.goneIf(!commentData.active) + audit.goneIf(commentData.active) + line.goneIf(!(commentData.replyData != null && commentData.active)) + replyContainer.goneIf(!(commentData.replyData != null && commentData.active)) + replyMore.goneIf(commentData.reply <= 1) userIcon.display(commentData.user.border, commentData.user.icon, commentData.user.auth?.icon) when { commentData.isEditContent == null -> { time.setTextColor(ContextCompat.getColor(context, R.color.text_subtitleDesc)) time.text = if (commentData.ignore) { val s = "${NewsUtils.getFormattedTime(commentData.time)} 保护期评论不计入总分" - SpanBuilder(s).image(s.length - 12, s.length - 11, R.drawable.ic_ignore_rating_tips).color(context, s.length - 10, s.length, R.color.text_subtitle).build() + SpanBuilder(s).image(s.length - 12, s.length - 11, R.drawable.ic_ignore_rating_tips) + .color(context, s.length - 10, s.length, R.color.text_subtitle).build() } else { NewsUtils.getFormattedTime(commentData.time) } @@ -99,23 +115,33 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR var name = "${commentData.replyData?.user?.name} :${commentData.replyData?.content}" var contentSpan = getSpan(context, name, commentData) contentBadge.visibleIf(commentData.replyData!!.isService) - contentBadge.background = DrawableView.getCornerGradientDrawable(ContextCompat.getColor(context, R.color.text_4BC7FF), ContextCompat.getColor(context, R.color.theme), 5f) + contentBadge.background = DrawableView.getCornerGradientDrawable( + ContextCompat.getColor(context, R.color.text_4BC7FF), + ContextCompat.getColor(context, R.color.theme), + 5f + ) replyContent.movementMethod = CustomLinkMovementMethod.getInstance() replyContent.highlightColor = Color.TRANSPARENT if (commentData.replyData!!.user.badge != null) { Single.just(commentData.replyData!!.user.badge?.icon) - .map { - //Target对象保存为弱引用,gc时对象被回收导致无法回调,因此改为同步方式获取bitmap - //https://github.com/square/picasso/issues/352 - Picasso.with(context).load(Uri.parse(it)).priority(Picasso.Priority.HIGH).get() - }.subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe({ - val bitmapDrawable = BitmapDrawable(context.resources, it) - bitmapDrawable.setBounds(0, 0, 16F.dip2px(), 16F.dip2px()) - contentSpan.setSpan(CenterImageSpan(bitmapDrawable), commentData.replyData?.user?.name!!.length + 2, commentData.replyData?.user?.name!!.length + 3, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) - contentSpan.setSpan(object : ClickableSpan() { + .map { + //Target对象保存为弱引用,gc时对象被回收导致无法回调,因此改为同步方式获取bitmap + //https://github.com/square/picasso/issues/352 + Picasso.with(context).load(Uri.parse(it)).priority(Picasso.Priority.HIGH).get() + }.subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe({ + val bitmapDrawable = BitmapDrawable(context.resources, it) + bitmapDrawable.setBounds(0, 0, 16F.dip2px(), 16F.dip2px()) + contentSpan.setSpan( + CenterImageSpan(bitmapDrawable), + commentData.replyData?.user?.name!!.length + 2, + commentData.replyData?.user?.name!!.length + 3, + Spanned.SPAN_EXCLUSIVE_EXCLUSIVE + ) + contentSpan.setSpan( + object : ClickableSpan() { override fun updateDrawState(ds: TextPaint) { super.updateDrawState(ds) ds.isUnderlineText = false @@ -129,18 +155,31 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR else -> "" } DialogUtils.showViewBadgeDialog(context, commentData.replyData!!.user.badge) { - MtaHelper.onEvent("进入徽章墙_用户记录", key, "${commentData.replyData?.user?.name}(${commentData.replyData?.user?.id})") + MtaHelper.onEvent( + "进入徽章墙_用户记录", + key, + "${commentData.replyData?.user?.name}(${commentData.replyData?.user?.id})" + ) MtaHelper.onEvent("徽章中心", "进入徽章中心", key) - DirectUtils.directToBadgeWall(context, commentData.replyData!!.user.id, commentData.replyData!!.user.name, commentData.replyData!!.user.icon) + DirectUtils.directToBadgeWall( + context, + commentData.replyData!!.user.id, + commentData.replyData!!.user.name, + commentData.replyData!!.user.icon + ) } } - }, commentData.replyData?.user?.name!!.length + 2, commentData.replyData?.user?.name!!.length + 3, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) - replyContent.movementMethod = CustomLinkMovementMethod.getInstance() - replyContent.text = contentSpan - }, { - it.printStackTrace() - }) + }, + commentData.replyData?.user?.name!!.length + 2, + commentData.replyData?.user?.name!!.length + 3, + Spanned.SPAN_EXCLUSIVE_EXCLUSIVE + ) + replyContent.movementMethod = CustomLinkMovementMethod.getInstance() + replyContent.text = contentSpan + }, { + it.printStackTrace() + }) } else { name = "${commentData.replyData?.user?.name}:${commentData.replyData?.content}" contentSpan = getSpan(context, name, commentData) @@ -158,15 +197,27 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR if (commentData.me.isCommented) { badge.visibility = View.VISIBLE badge.text = "我的评论" - badge.background = DrawableView.getCornerGradientDrawable(ContextCompat.getColor(context, R.color.text_4BC7FF), ContextCompat.getColor(context, R.color.theme), 5f) + badge.background = DrawableView.getCornerGradientDrawable( + ContextCompat.getColor(context, R.color.text_4BC7FF), + ContextCompat.getColor(context, R.color.theme), + 5f + ) } else if (commentData.order > 0 && commentData.isWonderful) { badge.visibility = View.VISIBLE badge.text = "精彩评论" - badge.background = DrawableView.getCornerGradientDrawable(ContextCompat.getColor(context, R.color.text_FFB749), ContextCompat.getColor(context, R.color.text_FF6D3C), 5f) + badge.background = DrawableView.getCornerGradientDrawable( + ContextCompat.getColor(context, R.color.text_FFB749), + ContextCompat.getColor(context, R.color.text_FF6D3C), + 5f + ) } else if (commentData.isServiceComment) { badge.visibility = View.VISIBLE badge.text = "客服" - badge.background = DrawableView.getCornerGradientDrawable(ContextCompat.getColor(context, R.color.text_4BC7FF), ContextCompat.getColor(context, R.color.theme), 5f) + badge.background = DrawableView.getCornerGradientDrawable( + ContextCompat.getColor(context, R.color.text_4BC7FF), + ContextCompat.getColor(context, R.color.theme), + 5f + ) } else { badge.visibility = View.GONE } @@ -252,7 +303,8 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR game?.gameType ?: "" ) context.ifLogin(BaseActivity.mergeEntranceAndPath(entrance, path)) { - DialogUtils.showReportReasonDialog(context, + DialogUtils.showReportReasonDialog( + context, Constants.REPORT_LIST.toList() as ArrayList ) { reason, desc -> SimpleRequestHelper.reportGameComment(game?.id ?: "", commentData.id, if (reason != "其他原因") reason else desc) @@ -267,8 +319,10 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR if (commentData.isEditContent == null && commentData.ignore) { if (path == "游戏详情:评分") MtaHelper.onEvent("游戏详情_新", "评论Tab-评论说明", game?.name) if (path == "折叠评论") MtaHelper.onEvent("折叠评论", "评论说明", game?.name) - DialogUtils.showStopServerExplanationDialog(context, if (game?.commentDescription?.isNotEmpty() == true) game.commentDescription else - context.getString(R.string.rating_protection), game?.name ?: "") + DialogUtils.showStopServerExplanationDialog( + context, if (game?.commentDescription?.isNotEmpty() == true) game.commentDescription else + context.getString(R.string.rating_protection), game?.name ?: "" + ) } else if (commentData.isEditContent == true) { if (path == "游戏详情:评分") MtaHelper.onEvent("游戏详情_新", "评论Tab-点击时间", game?.name) if (path == "折叠评论") MtaHelper.onEvent("折叠评论", "点击时间", game?.name) @@ -289,7 +343,13 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR } override fun onClick(widget: View) { - context.startActivity(WebActivity.getWebIntent(context, context.getString(R.string.comment_rules_title), context.getString(R.string.comment_rules_url))) + context.startActivity( + WebActivity.getWebIntent( + context, + context.getString(R.string.comment_rules_title), + context.getString(R.string.comment_rules_url) + ) + ) } }, 8, 18, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) @@ -328,10 +388,10 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR private fun getSpan(context: Context, name: String, commentData: RatingComment): SpannableStringBuilder { val spanned = SpanBuilder(name) - .color(context, 0, commentData.replyData?.user?.name!!.length, R.color.text_title) - .bold(0, commentData.replyData?.user?.name!!.length) - .size(0, commentData.replyData?.user?.name!!.length, 13) - .build() + .color(context, 0, commentData.replyData?.user?.name!!.length, R.color.text_title) + .bold(0, commentData.replyData?.user?.name!!.length) + .size(0, commentData.replyData?.user?.name!!.length, 13) + .build() val contentSpan = TextHelper.getHighlightedSpannableStringThatIsWrappedInsideWrapper(context, spanned) if (commentData.replyData!!.isService) { @@ -349,9 +409,9 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR val inflater = LayoutInflater.from(v.context) val layout = inflater.inflate(R.layout.layout_popup_container, null) val popupWindow = PopupWindow( - layout, - LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.WRAP_CONTENT + layout, + LinearLayout.LayoutParams.WRAP_CONTENT, + LinearLayout.LayoutParams.WRAP_CONTENT ) popupWindow.apply { setBackgroundDrawable(ColorDrawable(0)) diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingFragment.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingFragment.kt index 754d8b16b4..96140c4f4d 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingFragment.kt @@ -5,10 +5,8 @@ import android.content.Intent import android.os.Bundle import android.text.method.LinkMovementMethod import android.view.View -import android.widget.ProgressBar import android.widget.TextView import androidx.core.content.ContextCompat -import androidx.databinding.BindingAdapter import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProviders import androidx.recyclerview.widget.RecyclerView @@ -22,7 +20,6 @@ import com.gh.gamecenter.baselist.LoadStatus import com.gh.gamecenter.baselist.LoadType import com.gh.gamecenter.entity.GameEntity import com.gh.gamecenter.entity.RatingComment -import com.gh.gamecenter.entity.Star import com.gh.gamecenter.eventbus.EBReuse import com.gh.gamecenter.eventbus.EBTypeChange import com.gh.gamecenter.gamedetail.GameDetailFragment @@ -216,28 +213,6 @@ class RatingFragment : LazyListFragment(), IScro } companion object { - @BindingAdapter("setRatingScore") - @JvmStatic - fun setRatingScore(progress: ProgressBar, star: Star) { - if (star.hits <= 3) { - progress.progress = 0 - return - } - var targetScore = 0 - when (progress.id) { - R.id.rating_score_five -> targetScore = star.five / 10 - R.id.rating_score_four -> targetScore = star.four / 8 - R.id.rating_score_three -> targetScore = star.three / 6 - R.id.rating_score_two -> targetScore = star.two / 4 - R.id.rating_score_one -> targetScore = star.one / 2 - } - - var f = (targetScore / star.hits.toFloat()) * 100 - if (0 < f && f < 1) { - f = 1F - } - progress.progress = f.toInt() - } const val RATING_EDIT_REQUEST = 222 const val RATING_REPLAY_REQUEST = 223 diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingReplyAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingReplyAdapter.kt index 016fc2a400..c036d1a24e 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingReplyAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingReplyAdapter.kt @@ -144,7 +144,9 @@ class RatingReplyAdapter( listOf(ExposureSource("其他", ""), ExposureSource("评论详情", "")) } mExposureEvent = ExposureEvent.createEvent(game, exposureSource) - holder.binding.game = game + holder.binding.gameIcon.displayGameIcon(game) + holder.binding.gameName.text = game.name + holder.binding.gameInfo.text = if (!game.getApk().isNullOrEmpty()) "V${game.getApk()[0].version} | ${game.getApk()[0].size}" else "" holder.itemView.setOnClickListener { NewLogUtils.logCommentTabOrCommentDetailClick( @@ -227,11 +229,11 @@ class RatingReplyAdapter( var isChildLongClick = false val replyEntity = mEntityList[position].reply!! holder.binding.run { - data = replyEntity - content.setTextWithHighlightedTextWrappedInsideWrapper( - text = data?.content - ?: "", copyClickedText = true - ) + userNameBadge.goneIf(replyEntity.weight != 1) + time.text = NewsUtils.getFormattedTime(replyEntity.time) + vote.isChecked = replyEntity.me.isVoted + vote.text = if (replyEntity.vote > 0) NumberUtils.transSimpleCount(replyEntity.vote) else "" + content.setTextWithHighlightedTextWrappedInsideWrapper(text = replyEntity.content, copyClickedText = true) val parent = replyEntity.parent userIcon.display( replyEntity.user.border, diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/edit/RatingEditActivity.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/edit/RatingEditActivity.kt index 16d27b400c..4d09ab87bd 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/edit/RatingEditActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/edit/RatingEditActivity.kt @@ -96,7 +96,9 @@ class RatingEditActivity : ToolBarActivity(), KeyboardHeightObserver { } private fun initView() { - mBinding.game = mGame + mGame?.let { + mBinding.givThumb.displayGameIcon(it) + } mPlaceholder = "您觉得《${mGame?.name}》怎么样?真实、客观、丰富、大于100字的评论内容,更容易获得点赞并推荐到安利墙哦~" mBinding.commentRules.setOnClickListener { startActivity(WebActivity.getWebIntent(this, getString(R.string.comment_rules_title), getString(R.string.comment_rules_url))) @@ -294,41 +296,45 @@ class RatingEditActivity : ToolBarActivity(), KeyboardHeightObserver { errorEntity?.code == 403079 -> { MtaHelper.onEvent("游戏评论跳转", "出现弹窗", mGame?.name ?: "") MtaHelper.onEvent("游戏评论跳转", "联系客服弹窗", "出现弹窗") - DialogUtils.showTrackableDialog(this@RatingEditActivity, true, "提示", - "检测到您评论的内容中含有反映游戏问题相关内容,可选择点击下方联系客服按钮,将问题反馈给客服,以便更优解决!", - "联系客服", "继续提交", - { - DirectUtils.directToWebView(this, Constants.TENCENT_QIDIAN_ADDRESS, mEntrance) - MtaHelper.onEvent("游戏评论跳转", "联系客服弹窗", "点击联系客服") - }, - { - postGameComment(again = true) - MtaHelper.onEvent("游戏评论跳转", "联系客服弹窗", "点击继续提交") - }, TrackableEntity(event = "游戏评论跳转", key = "联系客服弹窗")) + DialogUtils.showTrackableDialog( + this@RatingEditActivity, true, "提示", + "检测到您评论的内容中含有反映游戏问题相关内容,可选择点击下方联系客服按钮,将问题反馈给客服,以便更优解决!", + "联系客服", "继续提交", + { + DirectUtils.directToWebView(this, Constants.TENCENT_QIDIAN_ADDRESS, mEntrance) + MtaHelper.onEvent("游戏评论跳转", "联系客服弹窗", "点击联系客服") + }, + { + postGameComment(again = true) + MtaHelper.onEvent("游戏评论跳转", "联系客服弹窗", "点击继续提交") + }, TrackableEntity(event = "游戏评论跳转", key = "联系客服弹窗") + ) } errorEntity?.code == 403080 -> { MtaHelper.onEvent("游戏评论跳转", "出现弹窗", mGame?.name ?: "") MtaHelper.onEvent("游戏评论跳转", "意见反馈弹窗", "出现弹窗") - DialogUtils.showTrackableDialog(this@RatingEditActivity, "提示", - "检测到您评论的内容中含有反映游戏问题相关内容,可选择点击下方问题反馈按钮,将问题反馈给后台客服,以便更优解决!", - "问题反馈", "继续提交", - { - MtaHelper.onEvent("游戏评论跳转", "意见反馈弹窗", "点击问题反馈") - mBinding.mWebView.callHandler("getComment", OnReturnValue { content -> - DirectUtils.directToSuggestion( - context = this@RatingEditActivity, - type = SuggestType.gameQuestion, - content = content.replace(LABEL_REPLACE_REGEX.toRegex(), ""), - fromRatingKey = true, - game = SimpleGameEntity(mGame?.id ?: "", mGame?.name ?: "") - ) - finish() - }) - }, - { - MtaHelper.onEvent("游戏评论跳转", "意见反馈弹窗", "点击继续提交") - postGameComment(again = true) - }, TrackableEntity(event = "游戏评论跳转", key = "意见反馈弹窗")) + DialogUtils.showTrackableDialog( + this@RatingEditActivity, "提示", + "检测到您评论的内容中含有反映游戏问题相关内容,可选择点击下方问题反馈按钮,将问题反馈给后台客服,以便更优解决!", + "问题反馈", "继续提交", + { + MtaHelper.onEvent("游戏评论跳转", "意见反馈弹窗", "点击问题反馈") + mBinding.mWebView.callHandler("getComment", OnReturnValue { content -> + DirectUtils.directToSuggestion( + context = this@RatingEditActivity, + type = SuggestType.gameQuestion, + content = content.replace(LABEL_REPLACE_REGEX.toRegex(), ""), + fromRatingKey = true, + game = SimpleGameEntity(mGame?.id ?: "", mGame?.name ?: "") + ) + finish() + }) + }, + { + MtaHelper.onEvent("游戏评论跳转", "意见反馈弹窗", "点击继续提交") + postGameComment(again = true) + }, TrackableEntity(event = "游戏评论跳转", key = "意见反馈弹窗") + ) } else -> ErrorHelper.handleError(this@RatingEditActivity, errorString) } @@ -416,10 +422,12 @@ class RatingEditActivity : ToolBarActivity(), KeyboardHeightObserver { if (!TextUtils.isEmpty(content)) { if (mComment != null) { - DialogHelper.showDialog(this, "提示", - "确定退出评论吗?已撰写的内容会丢失", - "继续撰写", "确定退出", - cancelClickCallback = { finish() }, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)) + DialogHelper.showDialog( + this, "提示", + "确定退出评论吗?已撰写的内容会丢失", + "继续撰写", "确定退出", + cancelClickCallback = { finish() }, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true) + ) } else { // save local draft val ratingDraft = RatingComment() @@ -477,7 +485,14 @@ class RatingEditActivity : ToolBarActivity(), KeyboardHeightObserver { const val RATING_CONTENT_LIMIT = 5000 const val IM_REQUEST_CODE = 345 - fun getIntent(context: Context, game: GameEntity, starCount: Float, installPackageName: String?, fromAmway: Boolean = false, isSkipSuccessPage: Boolean = true): Intent { + fun getIntent( + context: Context, + game: GameEntity, + starCount: Float, + installPackageName: String?, + fromAmway: Boolean = false, + isSkipSuccessPage: Boolean = true + ): Intent { val intent = Intent(context, RatingEditActivity::class.java) intent.putExtra(GameEntity.TAG, game) intent.putExtra(EntranceUtils.KEY_RATING_STAR_COUNT, starCount) diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/logs/CommentLogsAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/logs/CommentLogsAdapter.kt index c6de2ba9e0..e58752b80e 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/logs/CommentLogsAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/logs/CommentLogsAdapter.kt @@ -12,6 +12,8 @@ import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import com.gh.base.BaseRecyclerViewHolder import com.gh.common.constant.ItemViewType +import com.gh.common.util.ImageUtils +import com.gh.common.util.NewsUtils import com.gh.gamecenter.R import com.gh.gamecenter.adapter.viewholder.FooterViewHolder import com.gh.gamecenter.baselist.ListAdapter @@ -20,8 +22,10 @@ import com.gh.gamecenter.databinding.GameCommentLogItemBinding import com.gh.gamecenter.entity.RatingComment -class CommentLogsAdapter(context: Context, - val viewModel: NormalListViewModel) : ListAdapter(context) { +class CommentLogsAdapter( + context: Context, + val viewModel: NormalListViewModel +) : ListAdapter(context) { override fun getItemViewType(position: Int): Int { if (position == itemCount - 1) return ItemViewType.ITEM_FOOTER return ItemViewType.ITEM_BODY @@ -45,7 +49,12 @@ class CommentLogsAdapter(context: Context, when (holder) { is CommentLogItemViewHolder -> { val entity = mEntityList[position] - holder.binding.data = entity + ImageUtils.display(holder.binding.userIcon, entity.user.icon) + ImageUtils.display(holder.binding.userBadge, entity.user.auth?.icon) + holder.binding.userName.text = entity.user.name + holder.binding.ratingStart.rating = entity.star.toFloat() + holder.binding.time.text = NewsUtils.getFormattedTime(entity.time) + holder.binding.content.text = getContentSpan(entity.content) } is FooterViewHolder -> holder.initFooterViewHolder(viewModel, mIsLoading, isNetworkError, mIsOver) @@ -97,8 +106,9 @@ class CommentLogsAdapter(context: Context, } } } while ((text.contains("") && text.contains("") || - text.contains("") && text.contains("")) - && index < 50) + text.contains("") && text.contains("")) + && index < 50 + ) if (text.isNotEmpty()) list.add(SpanType(0, text)) @@ -109,26 +119,30 @@ class CommentLogsAdapter(context: Context, msp.append(value) if (spanType.type == 1) { msp.setSpan( - ForegroundColorSpan(mContext.resources.getColor(R.color.hint)), - (msp.length - value.length), - msp.length, - Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) + ForegroundColorSpan(mContext.resources.getColor(R.color.hint)), + (msp.length - value.length), + msp.length, + Spanned.SPAN_EXCLUSIVE_EXCLUSIVE + ) msp.setSpan( - StrikethroughSpan(), - (msp.length - value.length), - msp.length, - Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) + StrikethroughSpan(), + (msp.length - value.length), + msp.length, + Spanned.SPAN_EXCLUSIVE_EXCLUSIVE + ) } else if (spanType.type == 2) { msp.setSpan( - ForegroundColorSpan(Color.WHITE), - (msp.length - value.length), - msp.length, - Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) + ForegroundColorSpan(Color.WHITE), + (msp.length - value.length), + msp.length, + Spanned.SPAN_EXCLUSIVE_EXCLUSIVE + ) msp.setSpan( - BackgroundColorSpan(mContext.resources.getColor(R.color.theme_font)), - (msp.length - value.length), - msp.length, - Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) + BackgroundColorSpan(mContext.resources.getColor(R.color.theme_font)), + (msp.length - value.length), + msp.length, + Spanned.SPAN_EXCLUSIVE_EXCLUSIVE + ) } } } else { diff --git a/app/src/main/java/com/gh/gamecenter/help/HelpQaCategoryAdapter.kt b/app/src/main/java/com/gh/gamecenter/help/HelpQaCategoryAdapter.kt index 1e0613d5b6..6266e82756 100644 --- a/app/src/main/java/com/gh/gamecenter/help/HelpQaCategoryAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/help/HelpQaCategoryAdapter.kt @@ -6,6 +6,7 @@ import android.view.ViewGroup import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.RecyclerView import com.gh.common.util.DirectUtils +import com.gh.common.util.ImageUtils import com.gh.common.util.MtaHelper import com.gh.common.util.NewLogUtils import com.gh.common.view.GridSpacingItemColorDecoration @@ -13,7 +14,7 @@ import com.gh.gamecenter.R import com.gh.gamecenter.databinding.HelpQaCategoryItemBinding import com.gh.gamecenter.entity.HelpCategoryEntity -class HelpQaCategoryAdapter(val context: Context, val mQaCollectionId: String?) : RecyclerView.Adapter() { +class HelpQaCategoryAdapter(val context: Context, private val mQaCollectionId: String?) : RecyclerView.Adapter() { val mEntityList = arrayListOf() @@ -33,7 +34,10 @@ class HelpQaCategoryAdapter(val context: Context, val mQaCollectionId: String?) override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { if (holder is HelpQaCategoryViewHolder) { val helpCategoryEntity = mEntityList[position] - holder.binding.entity = helpCategoryEntity + ImageUtils.display(holder.binding.categoryIcon, helpCategoryEntity.icon) + holder.binding.categoryName.text = helpCategoryEntity.name + + holder.binding.qaRv.apply { layoutManager = GridLayoutManager(context, 2) addItemDecoration(GridSpacingItemColorDecoration(context, 28, 0, R.color.transparent)) diff --git a/app/src/main/java/com/gh/gamecenter/help/HelpQaCategoryFragment.kt b/app/src/main/java/com/gh/gamecenter/help/HelpQaCategoryFragment.kt index 65b0de6c0e..a59a418ebe 100644 --- a/app/src/main/java/com/gh/gamecenter/help/HelpQaCategoryFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/help/HelpQaCategoryFragment.kt @@ -3,7 +3,6 @@ package com.gh.gamecenter.help import android.os.Bundle import android.view.View import android.widget.TextView -import androidx.databinding.DataBindingUtil import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import com.gh.common.util.EntranceUtils @@ -28,7 +27,7 @@ class HelpQaCategoryFragment : NormalFragment() { override fun getLayoutId(): Int = R.layout.fragment_qa_category override fun getInflatedLayout(): View { - mBinding = DataBindingUtil.inflate(layoutInflater, R.layout.fragment_qa_category, null, false) + mBinding = FragmentQaCategoryBinding.inflate(layoutInflater, null, false) return mBinding.root } @@ -70,7 +69,8 @@ class HelpQaCategoryFragment : NormalFragment() { super.onViewCreated(view, savedInstanceState) mBinding.listRv.apply { layoutManager = LinearLayoutManager(context) - val itemDecoration = CustomDividerItemDecoration(requireContext(), + val itemDecoration = CustomDividerItemDecoration( + requireContext(), onlyDecorateTheFirstItem = false, notDecorateTheFirstItem = false, notDecorateTheLastItem = true, diff --git a/app/src/main/java/com/gh/gamecenter/help/QaFeedbackDialogFragment.kt b/app/src/main/java/com/gh/gamecenter/help/QaFeedbackDialogFragment.kt index ce5d1ae69a..486e1723b8 100644 --- a/app/src/main/java/com/gh/gamecenter/help/QaFeedbackDialogFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/help/QaFeedbackDialogFragment.kt @@ -41,14 +41,14 @@ class QaFeedbackDialogFragment : BaseDialogFragment() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) mViewModel = viewModelProvider(QaFeedbackViewModel.Factory(contentId)) - mViewModel.feedbackSuccess.observe(this, { + mViewModel.feedbackSuccess.observe(this) { if (it) { ToastUtils.showToast("感谢您的反馈") EventBus.getDefault().post(EBReuse("feedbackRefresh")) dismissAllowingStateLoss() } mLoadingDialog?.dismiss() - }) + } } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { diff --git a/app/src/main/java/com/gh/gamecenter/help/QaFeedbackReasonAdapter.kt b/app/src/main/java/com/gh/gamecenter/help/QaFeedbackReasonAdapter.kt index a7bddd27da..30e96cb7ae 100644 --- a/app/src/main/java/com/gh/gamecenter/help/QaFeedbackReasonAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/help/QaFeedbackReasonAdapter.kt @@ -21,22 +21,18 @@ class QaFeedbackReasonAdapter( override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { return QaFeedbackReasonViewHolder( - ItemQaFeedbackReasonBinding.inflate( - LayoutInflater.from( - mContext - ), parent, false - ) + ItemQaFeedbackReasonBinding.inflate(LayoutInflater.from(mContext), parent, false) ) } override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { val reason = reasonList[position] if (holder is QaFeedbackReasonViewHolder) { - holder.binding.reason = reason holder.binding.reasonTv.apply { - holder.binding.reasonTv.background = - if (mSelectPosition == position) R.drawable.qa_feedback_rg_button_checked.toDrawable() else R.drawable.qa_feedback_rg_button_normal.toDrawable() - holder.binding.reasonTv.setTextColor(if (mSelectPosition == position) R.color.theme_font.toColor() else R.color.text_title.toColor()) + text = reason + background = if (mSelectPosition == position) R.drawable.qa_feedback_rg_button_checked.toDrawable() else + R.drawable.qa_feedback_rg_button_normal.toDrawable() + setTextColor(if (mSelectPosition == position) R.color.theme_font.toColor() else R.color.text_title.toColor()) } holder.binding.reasonTv.setOnClickListener { mSelectPosition = position diff --git a/app/src/main/java/com/gh/gamecenter/history/HistoryGameListAdapter.kt b/app/src/main/java/com/gh/gamecenter/history/HistoryGameListAdapter.kt index 8fcd5e799d..1cb15d51e4 100644 --- a/app/src/main/java/com/gh/gamecenter/history/HistoryGameListAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/history/HistoryGameListAdapter.kt @@ -76,9 +76,8 @@ class HistoryGameListAdapter(context: Context, private val mViewModel: HistoryGa is GameItemViewHolder -> { val gameEntity = mEntityList[position] - holder.binding.game = gameEntity + holder.bindGameItem(gameEntity) holder.initServerType(gameEntity) - holder.binding.executePendingBindings() (holder.binding.selectIv.layoutParams as ConstraintLayout.LayoutParams).apply { width = 20f.dip2px() diff --git a/app/src/main/java/com/gh/gamecenter/home/HomeFragment.kt b/app/src/main/java/com/gh/gamecenter/home/HomeFragment.kt index 5513beb884..c2b62c22d8 100644 --- a/app/src/main/java/com/gh/gamecenter/home/HomeFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/home/HomeFragment.kt @@ -9,6 +9,7 @@ import com.gh.base.fragment.LazyFragment import com.gh.common.AppExecutor import com.gh.common.TimeElapsedHelper import com.gh.common.constant.Constants +import com.gh.common.databind.BindingAdapters import com.gh.common.exposure.ExposureListener import com.gh.common.util.* import com.gh.common.view.OffsetLinearLayoutManager @@ -66,7 +67,14 @@ class HomeFragment : LazyFragment() { mListAdapter.submitList(it) }) mViewModel.loadStatus.observeNonNull(this, callback = { - mBinding.loadStatus = it + val loadStatus = it + mBinding.run { + BindingAdapters.isRefreshing(gameRefresh, LoadStatus.LIST_LOADED) + gameRefresh.goneIf(loadStatus == LoadStatus.INIT_FAILED) + gameList.goneIf(loadStatus == LoadStatus.INIT_LOADING) + reuseNoConnection.root.goneIf(loadStatus != LoadStatus.INIT_FAILED) + reuseLoading.root.goneIf(loadStatus != LoadStatus.INIT_LOADING) + } mListAdapter.setLoadStatus(it) mBinding.reuseNoConnection.root.visibility = if (it == LoadStatus.INIT_FAILED) View.VISIBLE else View.GONE mBinding.reuseLoading.root.visibility = if (it == LoadStatus.INIT_LOADING) View.VISIBLE else View.GONE @@ -95,7 +103,14 @@ class HomeFragment : LazyFragment() { R.color.theme ) ) - mBinding.loadStatus = LoadStatus.LIST_LOADED + val loadStatus = LoadStatus.LIST_LOADED + mBinding.run { + BindingAdapters.isRefreshing(gameRefresh, LoadStatus.LIST_LOADED) + gameRefresh.goneIf(loadStatus == LoadStatus.INIT_FAILED) + gameList.goneIf(loadStatus == LoadStatus.INIT_LOADING) + reuseNoConnection.root.goneIf(loadStatus != LoadStatus.INIT_FAILED) + reuseLoading.root.goneIf(loadStatus != LoadStatus.INIT_LOADING) + } mAutomaticLayoutManager = OffsetLinearLayoutManager(requireContext()) mLayoutManager = mAutomaticLayoutManager mListAdapter = HomeFragmentAdapter(requireContext(), mViewModel, mLayoutManager) { diff --git a/app/src/main/java/com/gh/gamecenter/home/HomeGameItemViewHolder.kt b/app/src/main/java/com/gh/gamecenter/home/HomeGameItemViewHolder.kt index 377bc90e54..790332fd64 100644 --- a/app/src/main/java/com/gh/gamecenter/home/HomeGameItemViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/home/HomeGameItemViewHolder.kt @@ -4,16 +4,20 @@ import android.graphics.Color import android.graphics.drawable.ColorDrawable import android.view.View import com.gh.base.BaseRecyclerViewHolder -import com.gh.common.AppExecutor +import com.gh.common.util.ImageUtils import com.gh.common.util.RandomUtils +import com.gh.common.util.goneIf import com.gh.gamecenter.databinding.HomeGameItemBinding import com.gh.gamecenter.entity.GameEntity class HomeGameItemViewHolder(val binding: HomeGameItemBinding) : BaseRecyclerViewHolder(binding.root) { fun bindGame(game: GameEntity) { - binding.data = game - + binding.gameIcon.displayGameIcon(game) + binding.gameName.text = game.name + binding.gameRating.goneIf(!(game.showComment && game.commentCount >= 3 && game.star >= 7)) + binding.gameRating.text = game.star.toString() + ImageUtils.display(binding.gameImage, game.homeSetting.image) binding.gameTags.postDelayed({ binding.gameTags.visibility = if (game.tagStyle.isNotEmpty()) { binding.gameTags.setTags(game.tagStyle) diff --git a/app/src/main/java/com/gh/gamecenter/home/HomeRecommendItemViewHolder.kt b/app/src/main/java/com/gh/gamecenter/home/HomeRecommendItemViewHolder.kt index a9cf3359b4..e1ff173267 100644 --- a/app/src/main/java/com/gh/gamecenter/home/HomeRecommendItemViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/home/HomeRecommendItemViewHolder.kt @@ -9,8 +9,7 @@ import com.gh.gamecenter.entity.HomeRecommend class HomeRecommendItemViewHolder(val binding: HomeRecommendItemBinding) : BaseRecyclerViewHolder(binding.root) { fun bindRecommend(recommends: List) { - binding.list = recommends - binding.clickListener = OnViewClickListener { _, position -> + val clickListener = OnViewClickListener { _, position -> // 很奇怪这里居然抛出 IndexOutOfBoundsException 异常(有可能数据改变了,页面还没刷新导致) if (position >= recommends.size) return@OnViewClickListener @@ -28,5 +27,31 @@ class HomeRecommendItemViewHolder(val binding: HomeRecommendItemBinding) : BaseR PageSwitchDataHelper.pushCurrentPageData(hashMapOf(Pair(PageSwitchDataHelper.PAGE_BUSINESS_TYPE, "首页-推荐位"))) DirectUtils.directToLinkPage(binding.root.context, recommend.transformLinkEntity(), "首页推荐入口", "新首页-推荐入口") } + binding.run { + containerOne.goneIf(recommends.isEmpty()) + containerTwo.goneIf(recommends.size < 2) + containerThree.goneIf(recommends.size < 3) + containerFour.goneIf(recommends.size < 4) + containerFive.goneIf(recommends.size < 5) + spaceOne.goneIf(recommends.size < 2) + spaceTwo.goneIf(recommends.size < 3) + spaceThree.goneIf(recommends.size < 4) + spaceFour.goneIf(recommends.size < 5) + containerOne.setOnClickListener { clickListener.onClick(it, 0) } + containerTwo.setOnClickListener { clickListener.onClick(it, 1) } + containerThree.setOnClickListener { clickListener.onClick(it, 2) } + containerFour.setOnClickListener { clickListener.onClick(it, 3) } + containerFive.setOnClickListener { clickListener.onClick(it, 4) } + ImageUtils.display(iconIvOne, if (recommends.isNotEmpty()) recommends[0].icon else "") + ImageUtils.display(iconIvTwo, if (recommends.size > 1) recommends[1].icon else "") + ImageUtils.display(iconIvThree, if (recommends.size > 2) recommends[2].icon else "") + ImageUtils.display(iconIvFour, if (recommends.size > 3) recommends[3].icon else "") + ImageUtils.display(iconIvFive, if (recommends.size > 4) recommends[4].icon else "") + nameTvOne.text = if (recommends.isNotEmpty()) recommends[0].name else "推荐入口" + nameTvTwo.text = if (recommends.size > 1) recommends[1].name else "推荐入口" + nameTvThree.text = if (recommends.size > 2) recommends[2].name else "推荐入口" + nameTvFour.text = if (recommends.size > 3) recommends[3].name else "推荐入口" + nameTvFive.text = if (recommends.size > 4) recommends[4].name else "推荐入口" + } } } \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/home/LegacyHomeFragmentAdapterAssistant.kt b/app/src/main/java/com/gh/gamecenter/home/LegacyHomeFragmentAdapterAssistant.kt index 95293da491..d6994d50fb 100644 --- a/app/src/main/java/com/gh/gamecenter/home/LegacyHomeFragmentAdapterAssistant.kt +++ b/app/src/main/java/com/gh/gamecenter/home/LegacyHomeFragmentAdapterAssistant.kt @@ -11,6 +11,7 @@ import androidx.recyclerview.widget.DefaultItemAnimator import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.gh.common.constant.ItemViewType +import com.gh.common.databind.BindingAdapters import com.gh.common.exposure.ExposureEvent import com.gh.common.exposure.ExposureSource import com.gh.common.iinterface.IOffsetable @@ -447,10 +448,10 @@ class LegacyHomeFragmentAdapterAssistant( basicSource = mBasicExposureSources, source = listOf(ExposureSource("专题", entity.subjectData?.name + "-大图")) ) - holder.binding.traceEvent = item.exposureEvent + BindingAdapters.setDownloadButton(holder.binding.progressBar, entity, item.exposureEvent, null, "(游戏-专题:$name-大图)", "") + } else { + BindingAdapters.setDownloadButton(holder.binding.progressBar, entity, null, null, "(游戏-专题:$name-大图)", "") } - - holder.binding.entrance = "(游戏-专题:$name-大图)" holder.binding.gameImageIcon.setOnClickListener { DataCollectionUtils.uploadClick(mContext, "$name-大图", "游戏-专题") MtaHelper.onEvent("游戏专题", "大图", name + ":" + entity.name) @@ -484,12 +485,8 @@ class LegacyHomeFragmentAdapterAssistant( ) } - holder.binding.game = gameEntity + holder.bindGameItem(gameEntity, subjectData.isShowSuffix, subjectData.briefStyle) holder.initServerType(gameEntity) - holder.binding.isShowSuffix = subjectData.isShowSuffix - holder.binding.briefStyle = subjectData.briefStyle - - holder.binding.executePendingBindings() runOnIoThread(true) { item.exposureEvent = ExposureEvent.createEventWithSourceConcat( diff --git a/app/src/main/java/com/gh/gamecenter/home/amway/HomeAmwayItemViewHolder.kt b/app/src/main/java/com/gh/gamecenter/home/amway/HomeAmwayItemViewHolder.kt index 684019dbe6..0b6a53d994 100644 --- a/app/src/main/java/com/gh/gamecenter/home/amway/HomeAmwayItemViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/home/amway/HomeAmwayItemViewHolder.kt @@ -3,6 +3,8 @@ package com.gh.gamecenter.home.amway import android.content.Context import android.view.View import com.gh.base.BaseRecyclerViewHolder +import com.gh.common.databind.BindingAdapters +import com.gh.common.util.ImageUtils import com.gh.common.util.TextHelper import com.gh.common.view.AsyncCell import com.gh.gamecenter.R @@ -14,7 +16,15 @@ import java.util.regex.Pattern class HomeAmwayItemViewHolder(val cell: HomeAmwayAsyncCell) : BaseRecyclerViewHolder(cell) { fun bindAmway(binding: HomeAmwayItemBinding, amway: AmwayCommentEntity) { - binding.data = amway + binding.gameIcon.displayGameIcon(amway.game.toGameEntity()) + binding.gameName.text = amway.game.name + binding.amwayScoreNumber.text = amway.game.star.toString() + BindingAdapters.setGameTags(binding.gameTags, amway.game.tag, 2) + + ImageUtils.display(binding.userIcon,amway.comment.user.icon) + ImageUtils.display(binding.userBadge,amway.comment.user.auth?.icon) + binding.userName.text=amway.comment.user.name + binding.ratingStart.rating=amway.comment.star.toFloat() // 强制更改标签颜色 val tags = amway.game.tag diff --git a/app/src/main/java/com/gh/gamecenter/home/skip/PackageSkipAdapter.kt b/app/src/main/java/com/gh/gamecenter/home/skip/PackageSkipAdapter.kt index afdfad4bac..70549dc43c 100644 --- a/app/src/main/java/com/gh/gamecenter/home/skip/PackageSkipAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/home/skip/PackageSkipAdapter.kt @@ -40,12 +40,9 @@ class PackageSkipAdapter(val context: Context, val games: ArrayList, override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { if (holder is GameItemViewHolder) { val gameEntity = games[position] - holder.binding.game = gameEntity - holder.initServerType(gameEntity) val subjectData = gameEntity.subjectData - holder.binding.isShowSuffix = subjectData?.isShowSuffix - holder.binding.briefStyle = subjectData?.briefStyle - holder.binding.executePendingBindings() + holder.bindGameItem(gameEntity, subjectData?.isShowSuffix ?: true, subjectData?.briefStyle ?: "") + holder.initServerType(gameEntity) if (games.size == 1) { holder.itemView.background = ContextCompat.getDrawable(context, R.drawable.background_shape_white_radius_8) diff --git a/app/src/main/java/com/gh/gamecenter/home/slide/HomeSlideListItemViewHolder.kt b/app/src/main/java/com/gh/gamecenter/home/slide/HomeSlideListItemViewHolder.kt index 919df06db1..3e32db72b1 100644 --- a/app/src/main/java/com/gh/gamecenter/home/slide/HomeSlideListItemViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/home/slide/HomeSlideListItemViewHolder.kt @@ -5,10 +5,7 @@ import android.graphics.drawable.ColorDrawable import android.view.View import com.facebook.imagepipeline.image.ImageInfo import com.gh.base.BaseRecyclerViewHolder -import com.gh.common.util.ImageUtils -import com.gh.common.util.RandomUtils -import com.gh.common.util.dip2px -import com.gh.common.util.toColor +import com.gh.common.util.* import com.gh.gamecenter.R import com.gh.gamecenter.databinding.HomeSlideListItemBinding import com.gh.gamecenter.entity.HomeSlide @@ -19,7 +16,23 @@ class HomeSlideListItemViewHolder(val binding: HomeSlideListItemBinding) : BaseR private val mImageWith = HaloApp.getInstance().application.resources.displayMetrics.widthPixels - 40F.dip2px() fun bindSlideListItem(homeSlide: HomeSlide) { - binding.data = homeSlide + binding.playIv.goneIf(homeSlide.linkType != "video") + binding.title.goneIf(homeSlide.title.isEmpty()) + binding.title.text = homeSlide.title + binding.digest.goneIf(!(homeSlide.text.isNotEmpty() && homeSlide.linkGame == null)) + binding.digest.text = homeSlide.text + if (homeSlide.linkGame != null) { + binding.includeGame.root.visibility = View.VISIBLE + val linkGame = homeSlide.linkGame + binding.includeGame.run { + gameIcon.displayGameIcon(linkGame) + gameName.text = linkGame.name + gameRating.goneIf(!(linkGame.commentCount > 3 && linkGame.star >= 7)) + gameRating.text = linkGame.star.toString() + } + } else { + binding.includeGame.root.visibility = View.GONE + } binding.includeGame.gameRating.setTextColor(R.color.white.toColor()) binding.includeGame.gameName.setTextColor(R.color.white.toColor()) diff --git a/app/src/main/java/com/gh/gamecenter/message/MessageAdapter.java b/app/src/main/java/com/gh/gamecenter/message/MessageAdapter.java index d1e466118d..afd82aa638 100644 --- a/app/src/main/java/com/gh/gamecenter/message/MessageAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/message/MessageAdapter.java @@ -4,11 +4,11 @@ import android.content.Context; import android.view.View; import android.view.ViewGroup; -import androidx.databinding.DataBindingUtil; import androidx.recyclerview.widget.RecyclerView; import com.gh.base.OnListClickListener; import com.gh.common.constant.ItemViewType; +import com.gh.common.databind.BindingAdapters; import com.gh.common.util.DialogHelper; import com.gh.gamecenter.R; import com.gh.gamecenter.adapter.viewholder.FooterViewHolder; @@ -68,13 +68,13 @@ public class MessageAdapter extends ListAdapter { public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { switch (viewType) { case ItemViewType.ITEM_HEADER: - MessageItemTopBinding topBinding = DataBindingUtil.inflate(mLayoutInflater, R.layout.message_item_top, parent, false); + MessageItemTopBinding topBinding = MessageItemTopBinding.inflate(mLayoutInflater, parent, false); return new MessageTopViewHolder(topBinding, mClickListener); case ItemViewType.ITEM_FOOTER: View view = mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false); return new FooterViewHolder(view, mClickListener); case ItemViewType.ITEM_BODY: - MessageItemBinding binding = DataBindingUtil.inflate(mLayoutInflater, R.layout.message_item, parent, false); + MessageItemBinding binding = MessageItemBinding.inflate(mLayoutInflater, parent, false); return new MessageItemViewHolder(binding, mClickListener, "消息_一级列表"); default: return null; @@ -86,7 +86,14 @@ public class MessageAdapter extends ListAdapter { switch (getItemViewType(position)) { case ItemViewType.ITEM_HEADER: MessageTopViewHolder topViewHolder = (MessageTopViewHolder) holder; - topViewHolder.mBinding.setUnreadEntity(mUnreadEntity); + BindingAdapters.setMessageUnread(topViewHolder.mBinding.unreadVote, mUnreadEntity.getVoteCount()); + BindingAdapters.showHide(topViewHolder.mBinding.unreadVote, mUnreadEntity.getVoteCount() != 0); + + BindingAdapters.setMessageUnread(topViewHolder.mBinding.unreadInvite, mUnreadEntity.getInvited() + mUnreadEntity.getSystemInvited()); + BindingAdapters.showHide(topViewHolder.mBinding.unreadInvite, mUnreadEntity.getInvited() + mUnreadEntity.getSystemInvited() != 0); + + BindingAdapters.setMessageUnread(topViewHolder.mBinding.unreadService, mUnreadEntity.getService()); + BindingAdapters.showHide(topViewHolder.mBinding.unreadService, mUnreadEntity.getService() != 0); break; case ItemViewType.ITEM_BODY: MessageItemViewHolder viewHolder = (MessageItemViewHolder) holder; @@ -94,16 +101,17 @@ public class MessageAdapter extends ListAdapter { viewHolder.setMessageItem(entity, mContext, mEntrance); viewHolder.itemView.setOnLongClickListener(v -> { DialogHelper.showDialog( - mContext, - "删除消息", - "消息删除将不可恢复,确定删除吗?", - "确定", - "取消", - () -> mViewModel.deleteMessage(entity.getId()), - () -> {}, - true, - "消息中心", - "消息列表-删除"); + mContext, + "删除消息", + "消息删除将不可恢复,确定删除吗?", + "确定", + "取消", + () -> mViewModel.deleteMessage(entity.getId()), + () -> { + }, + true, + "消息中心", + "消息列表-删除"); return false; }); break; diff --git a/app/src/main/java/com/gh/gamecenter/message/MessageItemViewHolder.java b/app/src/main/java/com/gh/gamecenter/message/MessageItemViewHolder.java index 81ff46b77f..d6a7969a71 100644 --- a/app/src/main/java/com/gh/gamecenter/message/MessageItemViewHolder.java +++ b/app/src/main/java/com/gh/gamecenter/message/MessageItemViewHolder.java @@ -8,6 +8,7 @@ import android.widget.RelativeLayout; import com.gh.base.BaseActivity; import com.gh.base.BaseRecyclerViewHolder; import com.gh.base.OnListClickListener; +import com.gh.common.databind.BindingAdapters; import com.gh.common.util.ClickUtils; import com.gh.common.util.DirectUtils; import com.gh.common.util.DisplayUtils; @@ -72,7 +73,15 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder public void setMessageItem(MessageEntity messageEntity, Context context, String entrance) { setClickData(messageEntity); - mBinding.setMessageEntity(messageEntity); + ImageUtils.display(mBinding.messageUserIcon, messageEntity.getUserEntity().getIcon()); + if (messageEntity.getUserEntity().getAuth() != null) { + ImageUtils.display(mBinding.messageUserBadge, messageEntity.getUserEntity().getAuth().getIcon()); + } + BindingAdapters.showHide(mBinding.messageUserBadge, messageEntity.getUserEntity().getAuth() != null); + BindingAdapters.showHide(mBinding.messageUnread, !messageEntity.getRead()); + mBinding.messageUserName.setText(messageEntity.getUserEntity().getName()); + + mBinding.messageTime.setText(NewsUtils.getFormattedTime(messageEntity.getTime())); List images; String targetUrl = null; // 防止串行 diff --git a/app/src/main/java/com/gh/gamecenter/message/MessageNormalAdapter.java b/app/src/main/java/com/gh/gamecenter/message/MessageNormalAdapter.java index bd5bf75c8d..b36be8a4e8 100644 --- a/app/src/main/java/com/gh/gamecenter/message/MessageNormalAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/message/MessageNormalAdapter.java @@ -4,6 +4,8 @@ import android.content.Context; import android.view.View; import android.view.ViewGroup; +import androidx.recyclerview.widget.RecyclerView; + import com.gh.base.OnListClickListener; import com.gh.common.constant.ItemViewType; import com.gh.common.util.DialogHelper; @@ -13,9 +15,6 @@ import com.gh.gamecenter.baselist.ListAdapter; import com.gh.gamecenter.databinding.MessageItemBinding; import com.gh.gamecenter.entity.MessageEntity; -import androidx.databinding.DataBindingUtil; -import androidx.recyclerview.widget.RecyclerView; - /** * Created by khy on 23/03/18. */ @@ -48,7 +47,7 @@ public class MessageNormalAdapter extends ListAdapter { view = mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false); return new FooterViewHolder(view, mClickListener); case ItemViewType.ITEM_BODY: - MessageItemBinding binding = DataBindingUtil.inflate(mLayoutInflater, R.layout.message_item, parent, false); + MessageItemBinding binding = MessageItemBinding.inflate(mLayoutInflater, parent, false); return new MessageItemViewHolder(binding, mClickListener, mOuterInfo); default: return null; diff --git a/app/src/main/java/com/gh/gamecenter/mygame/MyFollowedGameAdapter.kt b/app/src/main/java/com/gh/gamecenter/mygame/MyFollowedGameAdapter.kt index f773a31dee..9b1dfb1b52 100644 --- a/app/src/main/java/com/gh/gamecenter/mygame/MyFollowedGameAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/mygame/MyFollowedGameAdapter.kt @@ -7,6 +7,7 @@ import android.view.ViewGroup import androidx.core.content.ContextCompat import androidx.recyclerview.widget.RecyclerView import com.gh.common.constant.ItemViewType +import com.gh.common.databind.BindingAdapters import com.gh.common.exposure.ExposureEvent import com.gh.common.exposure.ExposureSource import com.gh.common.exposure.IExposable @@ -57,7 +58,20 @@ class MyFollowedGameAdapter(context: Context, var mViewModel: MyFollowedGameView holder.run { binding.run { - gameItemIncluded.game = gameEntity + gameItemIncluded.run { + gameIconView.displayGameIcon(gameEntity) + BindingAdapters.setGameName(gameName, gameEntity, false, null) + BindingAdapters.setTextSize(gameRating, if (gameEntity.commentCount > 3) 12 else 10) + BindingAdapters.setGameTags(labelList, gameEntity) + gameRating.setCompoundDrawables(if (gameEntity.commentCount > 3) R.drawable.game_horizontal_rating.toDrawable() else null, null, null, null) + gameRating.setPadding(0, 0, if (gameEntity.commentCount > 3) 8F.dip2px() else 0, 0) + gameRating.text = if (gameEntity.commentCount > 3) { + if (gameEntity.star == 10.0F) "10" else gameEntity.star.toString() + } else "" + gameRating.setTextColor(if (gameEntity.commentCount > 3) R.color.theme_font.toColor() else R.color.theme.toColor()) + gameDes.text = gameEntity.decoratedDes + recommendStar.rating = gameEntity.recommendStar.toFloat() + } moreBtn.visibility = View.GONE initServerType(gameEntity) initShortcut(gameEntity, mEntrance, path, newPath) diff --git a/app/src/main/java/com/gh/gamecenter/mygame/MyReservationAdapter.kt b/app/src/main/java/com/gh/gamecenter/mygame/MyReservationAdapter.kt index bba265ab0e..e742999d0b 100644 --- a/app/src/main/java/com/gh/gamecenter/mygame/MyReservationAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/mygame/MyReservationAdapter.kt @@ -3,9 +3,9 @@ package com.gh.gamecenter.mygame import android.content.Context import android.util.SparseArray import android.view.ViewGroup -import android.widget.LinearLayout import androidx.recyclerview.widget.RecyclerView import com.gh.common.constant.ItemViewType +import com.gh.common.databind.BindingAdapters import com.gh.common.exposure.ExposureEvent import com.gh.common.exposure.ExposureSource import com.gh.common.exposure.IExposable @@ -19,7 +19,6 @@ import com.gh.gamecenter.databinding.ItemFollowedGameBinding import com.gh.gamecenter.entity.GameEntity import com.gh.gamecenter.eventbus.EBDownloadStatus import com.gh.gamecenter.game.GameAndPosition -import java.util.* class MyReservationAdapter(context: Context, var mViewModel: MyReservationViewModel) : ListAdapter(context), IExposable { @@ -56,7 +55,20 @@ class MyReservationAdapter(context: Context, var mViewModel: MyReservationViewMo val path = "预约Tab" val newPath = "预约Tab_新" - holder.binding.gameItemIncluded.game = gameEntity + holder.binding.gameItemIncluded.run { + gameIconView.displayGameIcon(gameEntity) + BindingAdapters.setGameName(gameName, gameEntity, false, null) + BindingAdapters.setTextSize(gameRating, if (gameEntity.commentCount > 3) 12 else 10) + BindingAdapters.setGameTags(labelList, gameEntity) + gameRating.setCompoundDrawables(if (gameEntity.commentCount > 3) R.drawable.game_horizontal_rating.toDrawable() else null, null, null, null) + gameRating.setPadding(0, 0, if (gameEntity.commentCount > 3) 8F.dip2px() else 0, 0) + gameRating.text = if (gameEntity.commentCount > 3) { + if (gameEntity.star == 10.0F) "10" else gameEntity.star.toString() + } else "" + gameRating.setTextColor(if (gameEntity.commentCount > 3) R.color.theme_font.toColor() else R.color.theme.toColor()) + gameDes.text = gameEntity.decoratedDes + recommendStar.rating = gameEntity.recommendStar.toFloat() + } holder.initServerType(gameEntity) holder.initShortcut(gameEntity, mEntrance, path, newPath) diff --git a/app/src/main/java/com/gh/gamecenter/mygame/PlayedGameAdapter.kt b/app/src/main/java/com/gh/gamecenter/mygame/PlayedGameAdapter.kt index ecd4d10276..332bc23e60 100644 --- a/app/src/main/java/com/gh/gamecenter/mygame/PlayedGameAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/mygame/PlayedGameAdapter.kt @@ -19,6 +19,7 @@ import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.content.ContextCompat import androidx.recyclerview.widget.RecyclerView import com.gh.common.constant.ItemViewType +import com.gh.common.databind.BindingAdapters import com.gh.common.exposure.ExposureEvent import com.gh.common.exposure.ExposureSource import com.gh.common.exposure.IExposable @@ -103,7 +104,20 @@ open class PlayedGameAdapter(context: Context, if (mIsMyPlayedGame) { holder.initDownloadButtonOffset() } - holder.binding.gameItemIncluded.game = gameEntity + holder.binding.gameItemIncluded.run { + gameIconView.displayGameIcon(gameEntity) + BindingAdapters.setGameName(gameName, gameEntity, false, null) + BindingAdapters.setTextSize(gameRating, if (gameEntity.commentCount > 3) 12 else 10) + BindingAdapters.setGameTags(labelList, gameEntity) + gameRating.setCompoundDrawables(if (gameEntity.commentCount > 3) R.drawable.game_horizontal_rating.toDrawable() else null, null, null, null) + gameRating.setPadding(0, 0, if (gameEntity.commentCount > 3) 8F.dip2px() else 0, 0) + gameRating.text = if (gameEntity.commentCount > 3) { + if (gameEntity.star == 10.0F) "10" else gameEntity.star.toString() + } else "" + gameRating.setTextColor(if (gameEntity.commentCount > 3) R.color.theme_font.toColor() else R.color.theme.toColor()) + gameDes.text = gameEntity.decoratedDes + recommendStar.rating = gameEntity.recommendStar.toFloat() + } holder.binding.gameItemIncluded.labelList.removeAllViews() val runTimeView = TextView(mContext) diff --git a/app/src/main/java/com/gh/gamecenter/personal/NewPersonalFragment.kt b/app/src/main/java/com/gh/gamecenter/personal/NewPersonalFragment.kt index 18e4ea9d54..e000371927 100644 --- a/app/src/main/java/com/gh/gamecenter/personal/NewPersonalFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/personal/NewPersonalFragment.kt @@ -8,7 +8,6 @@ import android.text.TextUtils import android.view.View import android.view.ViewGroup import androidx.core.content.ContextCompat -import androidx.databinding.DataBindingUtil import androidx.lifecycle.ViewModelProvider import androidx.recyclerview.widget.LinearLayoutManager import com.gh.base.fragment.BaseLazyFragment @@ -61,7 +60,6 @@ import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.Subscribe import org.greenrobot.eventbus.ThreadMode import org.json.JSONObject -import java.util.* import kotlin.math.abs class NewPersonalFragment : BaseLazyFragment() { @@ -82,12 +80,7 @@ class NewPersonalFragment : BaseLazyFragment() { private var mEnergy: Long = 0 override fun getInflatedLayout(): View { - mBinding = DataBindingUtil.inflate( - layoutInflater, - R.layout.fragment_new_personal_stub, - null, - false - ) + mBinding = FragmentNewPersonalStubBinding.inflate(layoutInflater, null, false) mBinding.stub.setOnInflateListener { _, inflateId -> mStubBinding = FragmentNewPersonalBinding.bind(inflateId) } @@ -508,7 +501,7 @@ class NewPersonalFragment : BaseLazyFragment() { } private fun inflateRealView() { - mBinding.stub.viewStub?.inflate() + mBinding.stub.inflate() mStubBinding.collapsingToolbar.setOnClickListener(this) mStubBinding.toolbar.setOnClickListener(this) diff --git a/app/src/main/java/com/gh/gamecenter/personal/PersonalFragment.kt b/app/src/main/java/com/gh/gamecenter/personal/PersonalFragment.kt index 7e1c5b1d50..319bdba268 100644 --- a/app/src/main/java/com/gh/gamecenter/personal/PersonalFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/personal/PersonalFragment.kt @@ -9,7 +9,6 @@ import android.text.TextUtils import android.view.View import android.view.ViewGroup import androidx.core.content.ContextCompat -import androidx.databinding.DataBindingUtil import androidx.lifecycle.ViewModelProvider import androidx.recyclerview.widget.LinearLayoutManager import com.gh.base.BaseActivity @@ -82,7 +81,7 @@ class PersonalFragment : BaseLazyFragment() { private var mIsLogging = false override fun getInflatedLayout(): View { - mBinding = DataBindingUtil.inflate(layoutInflater, R.layout.fragment_personal_stub, null, false) + mBinding = FragmentPersonalStubBinding.inflate(layoutInflater, null, false) mBinding.stub.setOnInflateListener { _, inflateId -> mStubBinding = FragmentPersonalBinding.bind(inflateId) } @@ -562,7 +561,7 @@ class PersonalFragment : BaseLazyFragment() { } private fun inflateRealView() { - mBinding.stub.viewStub?.inflate() + mBinding.stub.inflate() mStubBinding.collapsingToolbar.setOnClickListener(this) mStubBinding.toolbar.setOnClickListener(this) diff --git a/app/src/main/java/com/gh/gamecenter/personalhome/FollowersOrFansAdapter.kt b/app/src/main/java/com/gh/gamecenter/personalhome/FollowersOrFansAdapter.kt index f092e6b370..e757f948a5 100644 --- a/app/src/main/java/com/gh/gamecenter/personalhome/FollowersOrFansAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/personalhome/FollowersOrFansAdapter.kt @@ -14,7 +14,7 @@ import com.gh.gamecenter.entity.FollowersOrFansEntity import com.gh.gamecenter.manager.UserManager class FollowersOrFansAdapter(context: Context, val mViewModel: FollowersOrFansViewModel, val entrance: String) : - ListAdapter(context) { + ListAdapter(context) { var onBadgeClickListener: ((entity: FollowersOrFansEntity) -> Unit)? = null @@ -51,8 +51,13 @@ class FollowersOrFansAdapter(context: Context, val mViewModel: FollowersOrFansVi override fun onBindViewHolder(holder: androidx.recyclerview.widget.RecyclerView.ViewHolder, position: Int) { if (holder is FollowersOrFansViewHolder) { val entity = mEntityList[position] - holder.binding.entity = entity - + holder.binding.countRl.goneIf(!(entity.count.answer > 0 && entity.count.vote > 0)) + holder.binding.answerCount.goneIf(entity.count.answer <= 0) + holder.binding.answerCount.text = NumberUtils.transSimpleCount(entity.count.answer) + "回答" + holder.binding.voteCount.goneIf(entity.count.vote <= 0) + holder.binding.voteCount.text = NumberUtils.transSimpleCount(entity.count.vote) + "赞同" + holder.binding.userIntroduce.text = if (entity.introduce.isNullOrEmpty()) "这是一个很神秘的崽~" else entity.introduce + holder.binding.userName.text = entity.name holder.binding.divider.visibility = if (position == 0) View.GONE else View.VISIBLE holder.binding.userIcon.display(entity.border, entity.icon, entity.auth.icon) holder.binding.followerBtn.run { @@ -76,10 +81,12 @@ class FollowersOrFansAdapter(context: Context, val mViewModel: FollowersOrFansVi mContext.ifLogin("个人主页-粉丝-[关注]") { if (entity.id != UserManager.getInstance().userId) { if (entity?.me?.isFollower!!) { - DialogHelper.showDialog(mContext, "取消关注", "确定要取消关注 ${entity.name} 吗?", - "确定取消", "暂不取消", { - mViewModel.followingCommand(!entity.me.isFollower, entity.id, position) - }, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)) + DialogHelper.showDialog( + mContext, "取消关注", "确定要取消关注 ${entity.name} 吗?", + "确定取消", "暂不取消", { + mViewModel.followingCommand(!entity.me.isFollower, entity.id, position) + }, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true) + ) } else { mViewModel.followingCommand(!entity.me.isFollower, entity.id, position) } diff --git a/app/src/main/java/com/gh/gamecenter/personalhome/UserHomePlayedGameAdapter.kt b/app/src/main/java/com/gh/gamecenter/personalhome/UserHomePlayedGameAdapter.kt deleted file mode 100644 index aec4821586..0000000000 --- a/app/src/main/java/com/gh/gamecenter/personalhome/UserHomePlayedGameAdapter.kt +++ /dev/null @@ -1,38 +0,0 @@ -package com.gh.gamecenter.personalhome - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.databinding.DataBindingUtil -import androidx.recyclerview.widget.RecyclerView -import com.gh.common.util.DirectUtils -import com.gh.common.util.MtaHelper -import com.gh.gamecenter.R -import com.gh.gamecenter.databinding.ItemHomePlayedGameBinding -import com.gh.gamecenter.entity.GameEntity - -class UserHomePlayedGameAdapter(private var gameList: List) : RecyclerView.Adapter() { - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { - return HomePlayedGameViewHolder(DataBindingUtil.inflate(LayoutInflater.from(parent.context), R.layout.item_home_played_game, parent, false)) - } - - override fun getItemCount(): Int { - return gameList.size - } - - override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { - when (holder) { - is HomePlayedGameViewHolder -> { - val game = gameList[position] - holder.binding.game = game - holder.binding.root.setOnClickListener { - MtaHelper.onEvent("个人主页详情", "个人主页详情", "玩过的游戏") - DirectUtils.directToGameDetail(holder.binding.root.context, game.id, "个人主页") - } - } - } - } - - class HomePlayedGameViewHolder(var binding: ItemHomePlayedGameBinding) : RecyclerView.ViewHolder(binding.root) - -} \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/personalhome/background/BackgroundPreviewFragment.kt b/app/src/main/java/com/gh/gamecenter/personalhome/background/BackgroundPreviewFragment.kt index ce801d2214..d385043922 100644 --- a/app/src/main/java/com/gh/gamecenter/personalhome/background/BackgroundPreviewFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/personalhome/background/BackgroundPreviewFragment.kt @@ -11,7 +11,6 @@ import android.view.View import androidx.annotation.RequiresApi import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.content.ContextCompat -import androidx.databinding.DataBindingUtil import com.gh.base.fragment.WaitingDialogFragment import com.gh.common.util.* import com.gh.gamecenter.CropImageActivity @@ -48,12 +47,7 @@ class BackgroundPreviewFragment : NormalFragment() { override fun getLayoutId(): Int = 0 override fun getInflatedLayout(): View { - mBinding = DataBindingUtil.inflate( - layoutInflater, - R.layout.fragment_background_preview, - null, - false - ) + mBinding = FragmentBackgroundPreviewBinding.inflate(layoutInflater, null, false) return mBinding.root } diff --git a/app/src/main/java/com/gh/gamecenter/personalhome/border/ChooseAvatarBorderAdapter.kt b/app/src/main/java/com/gh/gamecenter/personalhome/border/ChooseAvatarBorderAdapter.kt index cf32493947..d55858a2d0 100644 --- a/app/src/main/java/com/gh/gamecenter/personalhome/border/ChooseAvatarBorderAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/personalhome/border/ChooseAvatarBorderAdapter.kt @@ -14,7 +14,6 @@ import com.gh.gamecenter.energy.EnergyHouseActivity import com.gh.gamecenter.entity.AvatarBorderEntity import com.gh.gamecenter.manager.UserManager import com.lightgame.adapter.BaseRecyclerAdapter -import java.util.* class ChooseAvatarBorderAdapter(context: Context, private val mFragment: ChooseAvatarBorderFragment, @@ -33,7 +32,7 @@ class ChooseAvatarBorderAdapter(context: Context, } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { - return PendantBackgroundViewHolder(AvatarItemBinding.bind(mLayoutInflater.inflate(R.layout.avatar_item, parent, false))) + return PendantBackgroundViewHolder(parent.toBinding()) } override fun getItemCount(): Int = entityList.size diff --git a/app/src/main/java/com/gh/gamecenter/personalhome/home/UserHistoryAdapter.kt b/app/src/main/java/com/gh/gamecenter/personalhome/home/UserHistoryAdapter.kt index 33eb971dfd..a46007fd88 100644 --- a/app/src/main/java/com/gh/gamecenter/personalhome/home/UserHistoryAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/personalhome/home/UserHistoryAdapter.kt @@ -27,11 +27,12 @@ import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack import com.shuyu.gsyvideoplayer.utils.OrientationUtils import java.util.regex.Pattern -class UserHistoryAdapter(context: Context, - private val mListViewModel: UserHistoryViewModel, - private val mEntrance: String, - private val itemClickCallback: (historyEntity: PersonalHistoryEntity, position: Int) -> Unit) - : ListAdapter(context) { +class UserHistoryAdapter( + context: Context, + private val mListViewModel: UserHistoryViewModel, + private val mEntrance: String, + private val itemClickCallback: (historyEntity: PersonalHistoryEntity, position: Int) -> Unit +) : ListAdapter(context) { private var mExpandSparseBooleanArray = SparseBooleanArray() @@ -96,18 +97,30 @@ class UserHistoryAdapter(context: Context, topMargin = if (position == 0) 0 else 11F.dip2px() } - entity = historyEntity topLine.goneIf(position == 0) forumNameLl.visibleIf(historyEntity.community.id.isNotEmpty()) userIcon.display(historyEntity.user?.border, historyEntity.user?.icon, historyEntity.user?.auth?.icon) - executePendingBindings() + userName.text = historyEntity.user?.name + ImageUtils.display(userBadgeIcon, historyEntity.user?.badge?.icon) + userBadgeIcon.goneIf(historyEntity.user?.badge == null) + userBadgeName.text = historyEntity.user?.badge?.name + time.text = NewsUtils.getFormattedTime(historyEntity.time) + " · " + statusTv.goneIf(!(historyEntity.status == "pending" || historyEntity.status == "fail")) + statusTv.text = if (historyEntity.status == "pending") R.string.content_pending_status.toResString() else + R.string.fail_status.toResString() + statusTv.setTextColor(if (historyEntity.status == "pending") R.color.theme_green.toColor() else R.color.theme_red.toColor()) + questionTitle.text = + if ((historyEntity.type.contains("question") || historyEntity.type.contains("article") || historyEntity.type.contains("video"))) historyEntity.title else historyEntity.question.title + content.goneIf(historyEntity.brief.isEmpty() && historyEntity.des.isEmpty()) + content.text = if (historyEntity.type.contains("video")) historyEntity.des else historyEntity.brief + forumNameTv.text = historyEntity.community.name if (historyEntity.type == "community_article" && historyEntity.getPassVideos().isNotEmpty() && historyEntity.images.isNotEmpty()) { val title = questionTitle.text val videoSpan = SpanBuilder(" ").image(1, " ".length, R.drawable.ic_article_video_label).build() questionTitle.text = SpannableStringBuilder() - .append(title) - .append(videoSpan) + .append(title) + .append(videoSpan) } val suffix = if (historyEntity.status == "pending" || historyEntity.status == "fail") " · " else "" @@ -156,23 +169,23 @@ class UserHistoryAdapter(context: Context, val orientationUtils = OrientationUtils(mContext as Activity, visibleView) orientationUtils.isEnable = false GSYVideoOptionBuilder() - .setIsTouchWiget(false) - .setUrl(entity.url) - .setRotateViewAuto(false) - .setCacheWithPlay(true) - .setRotateWithSystem(false) - .setReleaseWhenLossAudio(true) - .setLooping(false) - .setShowFullAnimation(false) - .setEnlargeImageRes(R.drawable.ic_game_detail_enter_full_screen) - .setShrinkImageRes(R.drawable.ic_game_detail_exit_full_screen) - .setVideoAllCallBack(object : GSYSampleCallBack() { - override fun onQuitFullscreen(url: String?, vararg objects: Any) { - orientationUtils.backToProtVideo() - visibleView.uploadVideoStreamingPlaying("退出全屏") - } - }) - .build(visibleView) + .setIsTouchWiget(false) + .setUrl(entity.url) + .setRotateViewAuto(false) + .setCacheWithPlay(true) + .setRotateWithSystem(false) + .setReleaseWhenLossAudio(true) + .setLooping(false) + .setShowFullAnimation(false) + .setEnlargeImageRes(R.drawable.ic_game_detail_enter_full_screen) + .setShrinkImageRes(R.drawable.ic_game_detail_exit_full_screen) + .setVideoAllCallBack(object : GSYSampleCallBack() { + override fun onQuitFullscreen(url: String?, vararg objects: Any) { + orientationUtils.backToProtVideo() + visibleView.uploadVideoStreamingPlaying("退出全屏") + } + }) + .build(visibleView) visibleView.run { updateVideoData(entity) updateThumb(entity.poster) @@ -202,7 +215,11 @@ class UserHistoryAdapter(context: Context, private fun bindRatingItem(holder: PersonalHomeRatingViewHolder, position: Int) { val historyEntity = mEntityList[holder.adapterPosition] - holder.binding.entity = historyEntity + holder.binding.comment.text = if (historyEntity.count.reply > 0) NumberUtils.transSimpleCount(historyEntity.count.reply) else "" + holder.binding.vote.isChecked = historyEntity.me.isVoted + holder.binding.vote.text = if (historyEntity.count.vote > 0) NumberUtils.transSimpleCount(historyEntity.count.vote) else "" + holder.binding.ratingStart.rating = historyEntity.comment.star.toFloat() + holder.binding.userIcon.display(historyEntity.user?.border, historyEntity.user?.icon, historyEntity.user?.auth?.icon) val maxDesLines = if (mExpandSparseBooleanArray.get(holder.adapterPosition)) Int.MAX_VALUE else 3 holder.binding.content.setExpandMaxLines(maxDesLines) @@ -220,9 +237,10 @@ class UserHistoryAdapter(context: Context, } holder.binding.userCommand.text = (mContext.getString( - R.string.personal_home_rating_command, - NewsUtils.getFormattedTime(historyEntity.time), - historyEntity.comment.game.name)).fromHtml() + R.string.personal_home_rating_command, + NewsUtils.getFormattedTime(historyEntity.time), + historyEntity.comment.game.name + )).fromHtml() holder.binding.userCommand.setOnClickListener { GameDetailActivity.startGameDetailActivity(mContext, historyEntity.comment.game.id, mEntrance) } diff --git a/app/src/main/java/com/gh/gamecenter/personalhome/home/UserVideoHistoryAdapter.kt b/app/src/main/java/com/gh/gamecenter/personalhome/home/UserVideoHistoryAdapter.kt index 0fe2df0fb1..7d4caa20ed 100644 --- a/app/src/main/java/com/gh/gamecenter/personalhome/home/UserVideoHistoryAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/personalhome/home/UserVideoHistoryAdapter.kt @@ -49,7 +49,7 @@ class UserVideoHistoryAdapter(context: Context, val mViewModel: UserVideoHistory override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { if (holder is VideoItemViewHolder) { val entity = mEntityList[position] - holder.binding.video = entity + holder.bindVideoItem(entity) val params = holder.binding.videoTitle.layoutParams as ConstraintLayout.LayoutParams params.height = ConstraintLayout.LayoutParams.WRAP_CONTENT diff --git a/app/src/main/java/com/gh/gamecenter/personalhome/home/game/UserCommentHistoryAdapter.kt b/app/src/main/java/com/gh/gamecenter/personalhome/home/game/UserCommentHistoryAdapter.kt index 64ebdc964f..37f9597335 100644 --- a/app/src/main/java/com/gh/gamecenter/personalhome/home/game/UserCommentHistoryAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/personalhome/home/game/UserCommentHistoryAdapter.kt @@ -1,10 +1,10 @@ package com.gh.gamecenter.personalhome.home.game import android.content.Context +import android.graphics.Color import android.util.SparseBooleanArray import android.view.View import android.view.ViewGroup -import androidx.databinding.DataBindingUtil import androidx.fragment.app.Fragment import androidx.recyclerview.widget.RecyclerView import com.gh.base.BaseRecyclerViewHolder @@ -43,7 +43,7 @@ class UserCommentHistoryAdapter( override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { return when (viewType) { ItemViewType.ITEM_BODY -> { - UserCommentHistoryItemViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.item_user_comment_history, parent, false)) + UserCommentHistoryItemViewHolder(parent.toBinding()) } else -> { FooterViewHolder(mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false)) @@ -61,7 +61,15 @@ class UserCommentHistoryAdapter( var isChildLongClick = false val rating = mEntityList[position] - holder.binding.entity = rating + holder.binding.gameName.text = rating.game.name + holder.binding.amwayScoreNumber.text = if (rating.game.star > 0) rating.game.star.toString() else "评分过少" + holder.binding.amwayScoreNumber.setTextColor(Color.parseColor(if (rating.game.star > 0) "#1383EB" else "#2496FF")) + holder.binding.ratingStart.rating = rating.star.toFloat() + holder.binding.runTimeTv.text = "游戏时长: ${NumberUtils.transSimpleUsageTime(rating.game.playedTime)}" + holder.binding.date.text = rating.getFormatTime("MM-dd") + holder.binding.comment.text = if (rating.reply > 0) NumberUtils.transSimpleCount(rating.reply) else "" + holder.binding.vote.isChecked = rating.me.isVoted + holder.binding.vote.text = if (rating.vote > 0) NumberUtils.transSimpleCount(rating.vote) else "" holder.binding.divider.visibility = if (position == 0) View.GONE else View.VISIBLE diff --git a/app/src/main/java/com/gh/gamecenter/personalhome/home/game/UserPlayedGameAdapter.kt b/app/src/main/java/com/gh/gamecenter/personalhome/home/game/UserPlayedGameAdapter.kt index 3ef0fdc0ba..3904708643 100644 --- a/app/src/main/java/com/gh/gamecenter/personalhome/home/game/UserPlayedGameAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/personalhome/home/game/UserPlayedGameAdapter.kt @@ -4,7 +4,6 @@ import android.content.Context import android.util.TypedValue import android.view.ViewGroup import android.widget.TextView -import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView import com.gh.common.constant.ItemViewType import com.gh.common.util.* @@ -13,12 +12,12 @@ import com.gh.gamecenter.R import com.gh.gamecenter.adapter.viewholder.FooterViewHolder import com.gh.gamecenter.adapter.viewholder.GameViewHolder import com.gh.gamecenter.baselist.ListAdapter +import com.gh.gamecenter.databinding.GameItemBinding import com.gh.gamecenter.entity.GameEntity import com.gh.gamecenter.eventbus.EBDownloadStatus import com.gh.gamecenter.game.GameItemViewHolder import com.gh.gamecenter.mygame.PlayedGameViewModel import com.lightgame.download.DownloadEntity -import java.util.HashMap class UserPlayedGameAdapter(context: Context, private val mViewModel: PlayedGameViewModel): ListAdapter(context) { @@ -63,7 +62,7 @@ class UserPlayedGameAdapter(context: Context, override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { return when (viewType) { - ItemViewType.GAME_NORMAL -> GameItemViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.game_item, parent, false)) + ItemViewType.GAME_NORMAL -> GameItemViewHolder(GameItemBinding.inflate(mLayoutInflater, parent, false)) else -> FooterViewHolder(mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false)) } @@ -76,9 +75,8 @@ class UserPlayedGameAdapter(context: Context, root.setPadding(16F.dip2px(), 8F.dip2px(), 16F.dip2px(), 8F.dip2px()) val gameEntity = mEntityList[position] - game = gameEntity + holder.bindGameItem(gameEntity) holder.initServerType(gameEntity) - executePendingBindings() gameDes.run { setTextSize(TypedValue.COMPLEX_UNIT_SP, 11F) diff --git a/app/src/main/java/com/gh/gamecenter/personalhome/rating/RatingAdapter.kt b/app/src/main/java/com/gh/gamecenter/personalhome/rating/RatingAdapter.kt index 882d64cdcb..6dd26c2b27 100644 --- a/app/src/main/java/com/gh/gamecenter/personalhome/rating/RatingAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/personalhome/rating/RatingAdapter.kt @@ -6,6 +6,7 @@ import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import com.gh.common.constant.ItemViewType import com.gh.common.util.NewsUtils +import com.gh.common.util.NumberUtils import com.gh.common.util.fromHtml import com.gh.common.util.setTextWithHighlightedTextWrappedInsideWrapper import com.gh.gamecenter.GameDetailActivity @@ -52,7 +53,12 @@ class RatingAdapter( when (holder) { is PersonalHomeRatingViewHolder -> { val entity = mEntityList[holder.adapterPosition] - holder.binding.entity = entity.transformHistoryEntity() + val historyEntity = entity.transformHistoryEntity() + holder.binding.comment.text = if (historyEntity.count.reply > 0) NumberUtils.transSimpleCount(historyEntity.count.reply) else "" + holder.binding.vote.isChecked = historyEntity.me.isVoted + holder.binding.vote.text = if (historyEntity.count.vote > 0) NumberUtils.transSimpleCount(historyEntity.count.vote) else "" + holder.binding.ratingStart.rating = historyEntity.comment.star.toFloat() + holder.binding.userCommand.text = (mContext.getString( R.string.personal_home_rating_command, NewsUtils.getFormattedTime(entity.time), diff --git a/app/src/main/java/com/gh/gamecenter/qa/answer/CommunityAnswerItemViewHolder.kt b/app/src/main/java/com/gh/gamecenter/qa/answer/CommunityAnswerItemViewHolder.kt index 58d76dfebe..b81515875c 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/answer/CommunityAnswerItemViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/answer/CommunityAnswerItemViewHolder.kt @@ -1,6 +1,8 @@ package com.gh.gamecenter.qa.answer +import android.graphics.Color import android.graphics.Paint +import android.graphics.drawable.GradientDrawable import android.text.SpannableStringBuilder import android.view.View import android.widget.LinearLayout @@ -10,6 +12,7 @@ import com.gh.common.util.* import com.gh.gamecenter.CollectionActivity import com.gh.gamecenter.R import com.gh.gamecenter.databinding.CommunityAnswerItemBinding +import com.gh.gamecenter.manager.UserManager import com.gh.gamecenter.qa.entity.AnswerEntity import com.gh.gamecenter.qa.entity.ArticleEntity @@ -62,8 +65,31 @@ class CommunityAnswerItemViewHolder(val binding: CommunityAnswerItemBinding) : B } private fun bindItem(entity: AnswerEntity, entrance: String, path: String) { - binding.entity = entity - binding.executePendingBindings() + binding.run { + questionTitle.goneIf(entity.type != "answer") + questionTitle.text = entity.questions.title + userName.text = entity.user.name + userBadgeName.text = entity.user.badge?.name + ImageUtils.display(userBadgeIcon, entity.user.badge?.icon) + ImageUtils.display(popularAnswerUserIcon, entity.popularAnswer?.user?.icon) + userBadgeIcon.goneIf(entity.user.badge == null) + concernBtn.goneIf(entity.me.isFollower || entity.user.id == UserManager.getInstance().userId) + followedUserTv.goneIf(!entity.me.isFollower) + time.text = (if (entity.me.isFollower) " · " else "") + NewsUtils.getFormattedTime(entity.time!!) + (if (entity.status == "pending" || entity.status == "fail") " · " else "") + statusTv.setText(if (entity.status == "pending") R.string.content_pending_status else R.string.fail_status) + statusTv.setTextColor(if (entity.status == "pending") R.color.theme_green.toColor() else R.color.theme_red.toColor()) + statusTv.goneIf(!(entity.status == "pending" || entity.status == "fail")) + title.goneIf(entity.type == "answer") + title.text = if (entity.type.contains("video")) entity.articleTitle else entity.questions.title + content.text = if (entity.type.contains("video")) entity.des else entity.brief + popularAnswerContainer.background = GradientDrawable().apply { + setColor(Color.parseColor("#F5F6F7")) + cornerRadius = 4F.dip2px().toFloat() + } + popularAnswerUserName.text = entity.popularAnswer?.user?.name + popularAnswerContent.text = entity.popularAnswer?.brief + forumNameTv.text = entity.bbs.name + } binding.userIcon.display(entity.user.border, entity.user.icon, entity.user.auth?.icon) binding.imageContainer.bindData(entity, entrance, path) @@ -137,6 +163,5 @@ class CommunityAnswerItemViewHolder(val binding: CommunityAnswerItemBinding) : B binding.content.paint.flags = Paint.ANTI_ALIAS_FLAG binding.content.setTextColor(ContextCompat.getColor(itemView.context, R.color.text_subtitle)) } - binding.executePendingBindings() } } \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/qa/answer/MyAnswerViewHolder.kt b/app/src/main/java/com/gh/gamecenter/qa/answer/MyAnswerViewHolder.kt index eb08ff1313..7acddcc767 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/answer/MyAnswerViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/answer/MyAnswerViewHolder.kt @@ -8,12 +8,16 @@ class MyAnswerViewHolder(val binding: CommunityMyAnswerItemBinding) : BaseAnswer fun bindItem(entity: AnswerEntity, entrance: String) { bindCommendAndVote(entity, entrance) - binding.data = entity - + binding.title.text = entity.questions.title + binding.content.text = entity.brief + binding.forumNameTv.text = if (!entity.communityName.isNullOrEmpty()) entity.communityName else entity.bbs.name } fun bindItem(entity: ArticleEntity, entrance: String) { bindCommendAndVote(entity, entrance) - binding.data = entity.transformAnswerEntity() + val data = entity.transformAnswerEntity() + binding.title.text = data.questions.title + binding.content.text = data.brief + binding.forumNameTv.text = if (!data.communityName.isNullOrEmpty()) data.communityName else data.bbs.name } } \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/qa/answer/detail/AnswerDetailFragment.kt b/app/src/main/java/com/gh/gamecenter/qa/answer/detail/AnswerDetailFragment.kt index 8698f682d6..fa67c9074a 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/answer/detail/AnswerDetailFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/answer/detail/AnswerDetailFragment.kt @@ -16,8 +16,6 @@ import android.widget.LinearLayout import android.widget.TextView import androidx.appcompat.app.AppCompatActivity import androidx.core.content.ContextCompat -import androidx.databinding.BindingAdapter -import androidx.databinding.DataBindingUtil import androidx.lifecycle.Observer import com.ethanhua.skeleton.Skeleton import com.ethanhua.skeleton.SkeletonScreen @@ -169,7 +167,7 @@ open class AnswerDetailFragment : NormalFragment() { } override fun getInflatedLayout(): View? { - mBinding = DataBindingUtil.inflate(layoutInflater, R.layout.fragment_answer_detail, null, false) + mBinding = FragmentAnswerDetailBinding.inflate(layoutInflater, null, false) mQuestionBinding = mBinding.pieceQuestionContent return mBinding.root } @@ -183,9 +181,8 @@ open class AnswerDetailFragment : NormalFragment() { ) { if (mViewModel.answerDetail != null && requestCode == ANSWER_PATCH_REQUEST) { if (mAnswerId == data.getStringExtra(EntranceUtils.KEY_ANSWER_ID)) { - mViewModel.answerDetail?.content = data.getStringExtra(EntranceUtils.KEY_ANSWER_CONTENT) - ?: "" - mBinding.detail = mViewModel.answerDetail + mViewModel.answerDetail?.content = data.getStringExtra(EntranceUtils.KEY_ANSWER_CONTENT) ?: "" + bindView(mViewModel.answerDetail) } } activity?.setResult(Activity.RESULT_OK, data) @@ -208,7 +205,7 @@ open class AnswerDetailFragment : NormalFragment() { val resultData = data.getParcelableExtra(QuestionsDetailEntity::class.java.simpleName) mViewModel.answerDetail?.question?.title = resultData?.title ?: "" mViewModel.answerDetail?.question?.description = resultData?.description ?: "" - mBinding.detail = mViewModel.answerDetail + bindView(mViewModel.answerDetail) mViewModel.answerDetail?.let { updateView(it) } @@ -219,6 +216,21 @@ open class AnswerDetailFragment : NormalFragment() { } } + private fun bindView(detail: AnswerDetailEntity?) { + mBinding.titleTv.text = detail?.question?.title + setContent(mBinding.richEditor, detail) + } + + private fun setContent(richEditor: RichEditor, content: AnswerDetailEntity?) { + if (TextUtils.isEmpty(content?.content)) { + richEditor.visibility = View.GONE + } else { + richEditor.setContentOwner(content?.me?.isContentOwner ?: false) + richEditor.setHtml(content?.content, true) + richEditor.visibility = View.VISIBLE + } + } + private fun initObserver() { mViewModel.answerLiveData.observe(this, Observer { apiResponse -> mBinding.scrollView.visibility = View.VISIBLE @@ -232,7 +244,7 @@ open class AnswerDetailFragment : NormalFragment() { mContainerViewModel.appendAnswer(nextAnswerId) } - mBinding.detail = answerDetail + bindView(answerDetail) // 延迟不在屏幕上的页面的加载,缓解滑动切换答案卡顿 AppExecutor.uiExecutor.executeWithDelay(Runnable { @@ -788,7 +800,7 @@ open class AnswerDetailFragment : NormalFragment() { } } - mBinding.bottomController.bottomCommentIv.setOnClickListener{ + mBinding.bottomController.bottomCommentIv.setOnClickListener { showCommentDialog(false) } mBinding.bottomController.replyTv.setOnClickListener { @@ -1245,13 +1257,3 @@ open class AnswerDetailFragment : NormalFragment() { } } -@BindingAdapter("setRichContent") -fun setContent(richEditor: RichEditor, content: AnswerDetailEntity?) { - if (TextUtils.isEmpty(content?.content)) { - richEditor.visibility = View.GONE - } else { - richEditor.setContentOwner(content?.me?.isContentOwner ?: false) - richEditor.setHtml(content?.content, true) - richEditor.visibility = View.VISIBLE - } -} diff --git a/app/src/main/java/com/gh/gamecenter/qa/answer/draft/AnswerDraftAdapter.java b/app/src/main/java/com/gh/gamecenter/qa/answer/draft/AnswerDraftAdapter.java index 5bda5b21b4..8b29a294e6 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/answer/draft/AnswerDraftAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/qa/answer/draft/AnswerDraftAdapter.java @@ -103,7 +103,10 @@ class AnswerDraftAdapter extends ListAdapter { AnswerEntity answerEntity = mEntityList.get(position); AnswerDraftItemBinding binding = draftViewHolder.getBinding(); SimpleDraweeView img = binding.answerDraftItemImg; - binding.setData(answerEntity); + binding.answerDraftItemTitle.setText(answerEntity.getQuestions().getTitle()); + binding.answerDraftItemContent.setText(answerEntity.getBrief()); + binding.answerDraftItemCommunityName.setText(answerEntity.getCommunityName()); + List images = answerEntity.getImages(); if (images.size() > 0) { for (int i = 0; i < images.size(); i++) { diff --git a/app/src/main/java/com/gh/gamecenter/qa/article/MyArticleAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/article/MyArticleAdapter.kt index bbdb554cb2..22090e399b 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/article/MyArticleAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/article/MyArticleAdapter.kt @@ -56,7 +56,6 @@ class MyArticleAdapter(context: Context, if (holder is MyAnswerViewHolder) { val entity = mEntityList[position] holder.bindItem(entity, mEntrance) - holder.binding.executePendingBindings() holder.binding.imageContainer.bindData(entity.transformAnswerEntity(), mEntrance, mPath) val spanBuilder = SpannableStringBuilder() if (entity.type == "question") { diff --git a/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailAdapter.kt index 6cce9bea9b..d9f8f9385e 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailAdapter.kt @@ -2,9 +2,7 @@ package com.gh.gamecenter.qa.article.detail import android.content.Context import android.view.ViewGroup -import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView -import com.gh.gamecenter.R import com.gh.gamecenter.baselist.LoadStatus import com.gh.gamecenter.databinding.ItemArticleDetailContentBinding import com.gh.gamecenter.qa.comment.base.BaseCommentAdapter diff --git a/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentAdapter.kt index 287e2831da..39044b4f74 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentAdapter.kt @@ -5,10 +5,8 @@ import android.view.View import android.view.ViewGroup import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintSet -import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView import com.gh.common.util.dip2px -import com.gh.gamecenter.R import com.gh.gamecenter.databinding.ItemArticleDetailCommentBinding import com.gh.gamecenter.entity.CommentEntity import com.gh.gamecenter.qa.comment.base.BaseCommentAdapter @@ -26,7 +24,7 @@ class ArticleDetailCommentAdapter(context: Context, override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { return when (viewType) { ITEM_COMMENT_TOP -> { - val binding: ItemArticleDetailCommentBinding = DataBindingUtil.inflate(mLayoutInflater, R.layout.item_article_detail_comment, parent, false) + val binding: ItemArticleDetailCommentBinding = ItemArticleDetailCommentBinding.inflate(mLayoutInflater, parent, false) ArticleDetailTopCommentViewHolder(binding).apply { topCommentVH = this } } @@ -64,7 +62,6 @@ class ArticleDetailCommentAdapter(context: Context, lp.leftMargin = 8F.dip2px() binding.contentTv.layoutParams = lp - binding.comment = comment binding.moreIv.visibility = View.GONE binding.divider.visibility = View.VISIBLE binding.commentCountTv.visibility = View.GONE diff --git a/app/src/main/java/com/gh/gamecenter/qa/article/draft/ArticleDraftAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/article/draft/ArticleDraftAdapter.kt index e0d259f974..d36202597c 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/article/draft/ArticleDraftAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/article/draft/ArticleDraftAdapter.kt @@ -49,7 +49,7 @@ class ArticleDraftAdapter(context: Context, override fun onBindViewHolder(holder: androidx.recyclerview.widget.RecyclerView.ViewHolder, position: Int) { if (holder is ArticleDraftViewHolder) { val entity = mEntityList[position] - holder.binding.data = entity + holder.binding.articleDraftTitle.text= entity.title.ifEmpty { "(缺少标题)" } if (entity.community.id.isNotEmpty() && entity.community.name.isNotEmpty()) { holder.binding.articleDraftCommunityName.apply { text = entity.community.name diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/CommentPictureAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/CommentPictureAdapter.kt index fad43778cf..0eca59e805 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/comment/CommentPictureAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/comment/CommentPictureAdapter.kt @@ -4,6 +4,7 @@ import android.content.Context import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import com.facebook.drawee.view.SimpleDraweeView +import com.gh.common.util.ImageUtils import com.gh.common.util.toBinding import com.gh.gamecenter.ImageViewerActivity import com.gh.gamecenter.databinding.ItemCommentPictureBinding @@ -30,7 +31,7 @@ class CommentPictureAdapter(val context: Context, var pictureList: ArrayList { - val binding: ItemArticleDetailCommentFooterBinding = DataBindingUtil.inflate( + val binding: ItemArticleDetailCommentFooterBinding = ItemArticleDetailCommentFooterBinding.inflate( mLayoutInflater, - R.layout.item_article_detail_comment_footer, parent, false ) @@ -89,9 +87,8 @@ abstract class BaseCommentAdapter( } ITEM_COMMENT_NORMAL -> { - val binding: ItemArticleDetailCommentBinding = DataBindingUtil.inflate( + val binding: ItemArticleDetailCommentBinding = ItemArticleDetailCommentBinding.inflate( mLayoutInflater, - R.layout.item_article_detail_comment, parent, false ) @@ -99,12 +96,7 @@ abstract class BaseCommentAdapter( } ITEM_FILTER -> { - val binding: PieceArticleDetailCommentFilterBinding = DataBindingUtil.inflate( - mLayoutInflater, - R.layout.piece_article_detail_comment_filter, - parent, - false - ) + val binding: PieceArticleDetailCommentFilterBinding = parent.toBinding() CommentFilterViewHolder(binding).apply { filterVH = this } } @@ -550,6 +542,19 @@ abstract class BaseCommentAdapter( } companion object { + + fun bindView(binding: ItemArticleDetailCommentBinding, comment: CommentEntity) { + binding.userNameTv.text = comment.user.name + binding.authorHintTv.goneIf(comment.me?.isContentOwner == false) + binding.badgeIv.goneIf(comment.user.badge == null) + ImageUtils.display(binding.badgeIv, comment.user.badge?.icon) + binding.badgeTv.text = comment.user.badge?.name + binding.topLabelIv.goneIf(!comment.isTop) + binding.timeTv.setPadding(if (comment.isTop) 4f.dip2px() else 0, 0, 0, 0) + binding.timeTv.text = CommentUtils.getCommentTime(comment.time) + binding.contentTv.goneIf(comment.content.isNullOrEmpty()) + } + fun bindComment( binding: ItemArticleDetailCommentBinding, viewModel: BaseCommentViewModel, @@ -586,21 +591,24 @@ abstract class BaseCommentAdapter( } else { binding.commentPictureRv.visibility = View.GONE } - binding.comment = comment +// binding.comment = comment + bindView(binding, comment) binding.contentTv.setExpandMaxLines(if (comment.isExpand) Int.MAX_VALUE else 4) binding.contentTv.setIsExpanded(comment.isExpand) binding.collapseTv.goneIf(!comment.isExpand) binding.contentTv.setExpandCallback { comment.isExpand = true binding.collapseTv.visibility = View.VISIBLE - binding.comment = comment +// binding.comment = comment + bindView(binding, comment) } binding.collapseTv.setOnClickListener { comment.isExpand = false binding.collapseTv.visibility = View.GONE binding.contentTv.setExpandMaxLines(4) binding.contentTv.setIsExpanded(false) - binding.comment = comment +// binding.comment = comment + bindView(binding, comment) } binding.userIconIv.display( comment.user.border, diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/conversation/CommentConversationAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/conversation/CommentConversationAdapter.kt index 024ce154b6..c9c82819b7 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/comment/conversation/CommentConversationAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/comment/conversation/CommentConversationAdapter.kt @@ -5,10 +5,8 @@ import android.view.View import android.view.ViewGroup import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintSet -import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView import com.gh.common.util.dip2px -import com.gh.gamecenter.R import com.gh.gamecenter.databinding.ItemArticleDetailCommentBinding import com.gh.gamecenter.entity.CommentEntity import com.gh.gamecenter.qa.comment.base.BaseCommentAdapter @@ -27,7 +25,7 @@ class CommentConversationAdapter( return when (viewType) { ITEM_COMMENT_TOP -> { val binding: ItemArticleDetailCommentBinding = - DataBindingUtil.inflate(mLayoutInflater, R.layout.item_article_detail_comment, parent, false) + ItemArticleDetailCommentBinding.inflate(mLayoutInflater, parent, false) TopCommentItemViewHolder(binding).apply { topCommentVH = this } } @@ -77,7 +75,6 @@ class CommentConversationAdapter( binding.floorHintTv.layoutParams = this } - binding.comment = comment binding.moreIv.visibility = View.GONE binding.divider.visibility = View.VISIBLE binding.commentCountTv.visibility = View.GONE diff --git a/app/src/main/java/com/gh/gamecenter/qa/dialog/ChooseForumContainerAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/dialog/ChooseForumContainerAdapter.kt index 4d084ebd1a..b6c0a51784 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/dialog/ChooseForumContainerAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/dialog/ChooseForumContainerAdapter.kt @@ -8,10 +8,7 @@ import androidx.core.content.ContextCompat import androidx.recyclerview.widget.RecyclerView import com.gh.base.BaseRecyclerViewHolder import com.gh.common.constant.ItemViewType -import com.gh.common.util.HtmlUtils -import com.gh.common.util.MtaHelper -import com.gh.common.util.NewLogUtils -import com.gh.common.util.goneIf +import com.gh.common.util.* import com.gh.gamecenter.R import com.gh.gamecenter.adapter.viewholder.FooterViewHolder import com.gh.gamecenter.baselist.ListAdapter @@ -29,7 +26,7 @@ class ChooseForumContainerAdapter(content: Context, val type: String, val onSele FooterViewHolder(mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false)) } else -> { - ForumItemViewHolder(ForumItemBinding.inflate(LayoutInflater.from(mContext), parent, false)) + ForumItemViewHolder(parent.toBinding()) } } } @@ -57,8 +54,13 @@ class ChooseForumContainerAdapter(content: Context, val type: String, val onSele override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { if (holder is ForumItemViewHolder) { val forumEntity = mEntityList[position] - holder.binding.entity = forumEntity - val icon = if (forumEntity.icon.isNotEmpty()) forumEntity.icon else forumEntity.game.getIcon() + holder.binding.forumNameTv.text = forumEntity.name.fromHtml() + holder.binding.followTv.background = + if (forumEntity.isFollow) R.drawable.bg_shape_f5_radius_999.toDrawable() else R.drawable.bg_forum_follow.toDrawable() + holder.binding.followTv.text = if (forumEntity.isFollow) "已关注" else "关注" + holder.binding.followTv.setTextColor(if (forumEntity.isFollow) R.color.text_subtitleDesc.toColor() else R.color.theme_font.toColor()) + + val icon = forumEntity.icon.ifEmpty { forumEntity.game.getIcon() } holder.binding.forumIcon.displayGameIcon(icon, forumEntity.game.iconSubscript) holder.binding.followTv.visibility = View.GONE holder.itemView.setOnClickListener { diff --git a/app/src/main/java/com/gh/gamecenter/qa/editor/ArticleAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/editor/ArticleAdapter.kt index 01bcaf2506..e7f814ae21 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/editor/ArticleAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/editor/ArticleAdapter.kt @@ -7,10 +7,7 @@ import android.view.View import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import com.gh.common.constant.ItemViewType -import com.gh.common.util.DialogUtils -import com.gh.common.util.DirectUtils -import com.gh.common.util.ImageUtils -import com.gh.common.util.MtaHelper +import com.gh.common.util.* import com.gh.gamecenter.R import com.gh.gamecenter.adapter.viewholder.FooterViewHolder import com.gh.gamecenter.baselist.ListAdapter @@ -44,7 +41,22 @@ class ArticleAdapter(context: Context, private val mEntrance: String?) : ListAda ItemViewType.ITEM_BODY -> { val articleHolder = holder as CollectionCommunityArticleViewHolder val entity = mEntityList[position] - articleHolder.binding.data = entity + articleHolder.binding.title.text = entity.title + ImageUtils.display(articleHolder.binding.userIcon, entity.user.icon) + articleHolder.binding.userBadge.goneIf(entity.user.auth == null) + ImageUtils.display(articleHolder.binding.userBadge, entity.user.auth?.icon) + articleHolder.binding.userName.text = entity.user.name + articleHolder.binding.content.text = entity.brief + articleHolder.binding.image.goneIf(entity.images.isNullOrEmpty() && entity.getPassVideos().isNullOrEmpty()) + articleHolder.binding.videoPlay.goneIf(entity.getPassVideos().isNullOrEmpty()) + articleHolder.binding.voteCount.text = + "${entity.count.comment} 评论 · ${entity.count.vote} 点赞 · ${NewsUtils.getFormattedTime(entity.time?.create?:0)}" + articleHolder.binding.communityName.text = entity.community.name + if (entity.images.isNotEmpty()) { + ImageUtils.display(articleHolder.binding.image, entity.images.safelyGetInRelease(0)) + } else if (entity.getPassVideos().isNotEmpty()) { + ImageUtils.display(articleHolder.binding.image, entity.getPassVideos().safelyGetInRelease(0)?.poster) + } if (entity.user.badge != null) { articleHolder.binding.sdvUserBadge.visibility = View.VISIBLE diff --git a/app/src/main/java/com/gh/gamecenter/qa/editor/GameAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/editor/GameAdapter.kt index 735ed0b950..8feb22debf 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/editor/GameAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/editor/GameAdapter.kt @@ -28,7 +28,7 @@ open class GameAdapter(context: Context) : ListAdapter(context) { override fun onBindViewHolder(holder: androidx.recyclerview.widget.RecyclerView.ViewHolder, position: Int) { if (holder is GameItemViewHolder) { val entity = mEntityList[position] - holder.binding.game = entity + holder.bindGameItem(entity) holder.binding.downloadBtn.visibility = View.GONE val layoutParams = holder.binding.gameName.layoutParams layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT diff --git a/app/src/main/java/com/gh/gamecenter/qa/editor/GameDefaultAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/editor/GameDefaultAdapter.kt index 0e3ca801cd..29e3173fd3 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/editor/GameDefaultAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/editor/GameDefaultAdapter.kt @@ -4,14 +4,17 @@ import android.app.Activity import android.content.Context import android.content.Intent import android.view.ViewGroup +import com.gh.common.util.ImageUtils import com.gh.gamecenter.R import com.gh.gamecenter.databinding.EditorInsertDefaultItemBinding import com.gh.gamecenter.entity.GameEntity import com.gh.gamecenter.qa.entity.EditorInsertDefaultEntity import com.lightgame.adapter.BaseRecyclerAdapter -class GameDefaultAdapter(context: Context, - private val mDefaultList: List) : BaseRecyclerAdapter(context) { +class GameDefaultAdapter( + context: Context, + private val mDefaultList: List +) : BaseRecyclerAdapter(context) { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GameDefaultItemViewHolder { val view = mLayoutInflater.inflate(R.layout.editor_insert_default_item, parent, false) @@ -24,7 +27,8 @@ class GameDefaultAdapter(context: Context, override fun onBindViewHolder(holder: GameDefaultItemViewHolder, position: Int) { val entity = mDefaultList[position] - holder.binding.entity = entity + ImageUtils.display(holder.binding.gameIcon, entity.gameIcon) + holder.binding.gameName.text = entity.gameName holder.binding.type.text = when (entity.type) { "upload" -> "上次投稿" "played" -> "最近玩过" diff --git a/app/src/main/java/com/gh/gamecenter/qa/follow/AskFollowViewModel.kt b/app/src/main/java/com/gh/gamecenter/qa/follow/AskFollowViewModel.kt index 069877de20..78478ed1f4 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/follow/AskFollowViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/follow/AskFollowViewModel.kt @@ -1,73 +1,73 @@ -package com.gh.gamecenter.qa.follow - -import android.annotation.SuppressLint -import android.app.Application -import androidx.lifecycle.MutableLiveData -import com.gh.gamecenter.baselist.ListViewModel -import com.gh.gamecenter.entity.PersonalEntity -import com.gh.gamecenter.entity.PersonalHistoryEntity -import com.gh.gamecenter.manager.UserManager -import com.gh.gamecenter.retrofit.Response -import com.gh.gamecenter.retrofit.RetrofitManager -import com.lightgame.utils.Utils -import io.reactivex.Observable -import io.reactivex.schedulers.Schedulers -import okhttp3.ResponseBody -import retrofit2.HttpException -import java.util.* - -class AskFollowViewModel(application: Application) - : ListViewModel(application) { - - var recommendUsers = MutableLiveData>() - var followStatus = MutableLiveData() - - var followSet = HashSet() - - override fun provideDataObservable(page: Int): Observable> { - return RetrofitManager.getInstance() - .api - .getAskFollow(UserManager.getInstance().community.id, UserManager.getInstance().userId, page, Utils.getTime(getApplication())) - } - - override fun mergeResultLiveData() { - mResultLiveData.addSource(mListLiveData) { mutableList -> - mResultLiveData.postValue(mutableList) - } - } - - fun getRecommendUser() { - RetrofitManager.getInstance() - .api - .getRecommendUsers(UserManager.getInstance().community.id, UserManager.getInstance().userId) - .subscribeOn(Schedulers.io()) - .subscribe(object : Response>() { - override fun onResponse(response: List?) { - recommendUsers.postValue(response) - } - }) - } - - @SuppressLint("CheckResult") - fun doFollow() { - val requestList = arrayListOf>() - for (userId in followSet) { - requestList.add(RetrofitManager.getInstance().api.postFollowing(userId)) - } - Observable.mergeDelayError(requestList) - .subscribeOn(Schedulers.io()) - .subscribe(object : Response() { - override fun onComplete() { - followStatus.postValue(true) - followSet.clear() - } - - override fun onFailure(e: HttpException?) { - e?.printStackTrace() - followStatus.postValue(false) - } - }) - } - - -} \ No newline at end of file +//package com.gh.gamecenter.qa.follow +// +//import android.annotation.SuppressLint +//import android.app.Application +//import androidx.lifecycle.MutableLiveData +//import com.gh.gamecenter.baselist.ListViewModel +//import com.gh.gamecenter.entity.PersonalEntity +//import com.gh.gamecenter.entity.PersonalHistoryEntity +//import com.gh.gamecenter.manager.UserManager +//import com.gh.gamecenter.retrofit.Response +//import com.gh.gamecenter.retrofit.RetrofitManager +//import com.lightgame.utils.Utils +//import io.reactivex.Observable +//import io.reactivex.schedulers.Schedulers +//import okhttp3.ResponseBody +//import retrofit2.HttpException +//import java.util.* +// +//class AskFollowViewModel(application: Application) +// : ListViewModel(application) { +// +// var recommendUsers = MutableLiveData>() +// var followStatus = MutableLiveData() +// +// var followSet = HashSet() +// +// override fun provideDataObservable(page: Int): Observable> { +// return RetrofitManager.getInstance() +// .api +// .getAskFollow(UserManager.getInstance().community.id, UserManager.getInstance().userId, page, Utils.getTime(getApplication())) +// } +// +// override fun mergeResultLiveData() { +// mResultLiveData.addSource(mListLiveData) { mutableList -> +// mResultLiveData.postValue(mutableList) +// } +// } +// +// fun getRecommendUser() { +// RetrofitManager.getInstance() +// .api +// .getRecommendUsers(UserManager.getInstance().community.id, UserManager.getInstance().userId) +// .subscribeOn(Schedulers.io()) +// .subscribe(object : Response>() { +// override fun onResponse(response: List?) { +// recommendUsers.postValue(response) +// } +// }) +// } +// +// @SuppressLint("CheckResult") +// fun doFollow() { +// val requestList = arrayListOf>() +// for (userId in followSet) { +// requestList.add(RetrofitManager.getInstance().api.postFollowing(userId)) +// } +// Observable.mergeDelayError(requestList) +// .subscribeOn(Schedulers.io()) +// .subscribe(object : Response() { +// override fun onComplete() { +// followStatus.postValue(true) +// followSet.clear() +// } +// +// override fun onFailure(e: HttpException?) { +// e?.printStackTrace() +// followStatus.postValue(false) +// } +// }) +// } +// +// +//} \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/qa/follow/CommunityFollowItemViewHolder.kt b/app/src/main/java/com/gh/gamecenter/qa/follow/CommunityFollowItemViewHolder.kt deleted file mode 100644 index d2064210e5..0000000000 --- a/app/src/main/java/com/gh/gamecenter/qa/follow/CommunityFollowItemViewHolder.kt +++ /dev/null @@ -1,41 +0,0 @@ -package com.gh.gamecenter.qa.follow - -import com.gh.common.util.toColor -import com.gh.gamecenter.R -import com.gh.gamecenter.databinding.CommunityFollowItemBinding -import com.gh.gamecenter.entity.PersonalHistoryEntity -import com.gh.gamecenter.qa.answer.BaseAnswerOrArticleItemViewHolder -import com.gh.gamecenter.qa.entity.QuestionsDetailEntity -import com.gh.gamecenter.qa.questions.CommunityQuestionViewHolder -import com.gh.gamecenter.qa.questions.invite.QuestionsInviteActivity - -class CommunityFollowItemViewHolder(val binding: CommunityFollowItemBinding) : BaseAnswerOrArticleItemViewHolder(binding.root) { - - fun bindFollowItem(entity: PersonalHistoryEntity, entrance: String) { - commentCountContainer.isClickable = true - if (entity.type.contains("question")) { - CommunityQuestionViewHolder.bindAnswerCount( - entity.transformQuestionEntity(), - commentCountContainer, - commentCount, - entrance) - - voteIcon.setImageResource(R.drawable.community_invite_follow) - voteCount.setTextColor(R.color.text_subtitleDesc.toColor()) - voteCount.text = "邀请回答" - - voteCountContainer.setOnClickListener { - val questionsDetailEntity = QuestionsDetailEntity( - id = entity.id, - title = entity.title, - images = entity.images, - description = entity.description) - it.context.startActivity(QuestionsInviteActivity.getIntent(it.context, - questionsDetailEntity, - entrance)) - } - } else { - bindCommendAndVote(entity.transformAnswerEntity(), entrance) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/qa/questions/draft/QuestionDraftAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/questions/draft/QuestionDraftAdapter.kt index d04ac1c076..a3ad452d20 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/questions/draft/QuestionDraftAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/questions/draft/QuestionDraftAdapter.kt @@ -54,8 +54,7 @@ class QuestionDraftAdapter(val context: Context, val mViewModel: QuestionDraftVi override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { if (holder is QuestionDraftViewHolder) { val entity = mEntityList[position] - holder.binding.data = entity - + holder.binding.articleDraftTitle.text= entity.title.ifEmpty { "(缺少标题)" } if (entity.bbs != null) { holder.binding.articleDraftCommunityName.apply { text = entity.bbs?.name diff --git a/app/src/main/java/com/gh/gamecenter/qa/questions/edit/QuestionEditActivity.kt b/app/src/main/java/com/gh/gamecenter/qa/questions/edit/QuestionEditActivity.kt index d29f4ffed8..1524562cd4 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/questions/edit/QuestionEditActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/questions/edit/QuestionEditActivity.kt @@ -10,11 +10,12 @@ import android.os.Message import android.text.Editable import android.text.TextUtils import android.text.TextWatcher -import android.view.* +import android.view.KeyEvent +import android.view.MenuItem +import android.view.View import android.widget.EditText import androidx.core.content.ContextCompat import androidx.core.widget.addTextChangedListener -import androidx.databinding.DataBindingUtil import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProviders import com.gh.base.BaseRichEditorActivity @@ -95,7 +96,7 @@ class QuestionEditActivity : BaseRichEditorActivity(), mViewModel.gameEntity = null } setForumName() - mBinding.vm = mViewModel + mBinding.questionseditTitle.setText(mViewModel.title) } else if (requestCode == VideoPublishFragment.REQUEST_GAME_CODE) { val game = data.getParcelableExtra(GameEntity::class.java.simpleName) if (game != null) { @@ -139,10 +140,10 @@ class QuestionEditActivity : BaseRichEditorActivity(), if (!cacheTitle.isNullOrEmpty()) mViewModel.title = cacheTitle if (!cacheContent.isNullOrEmpty()) mViewModel.content = cacheContent } - mBinding = DataBindingUtil.bind(mContentView)!! + mBinding = ActivityQuestionsEditBinding.bind(mContentView) checkPostButtonEnable() mBinding.questionseditTitle.setOnEditorActionListener { _, _, e -> e?.keyCode == KeyEvent.KEYCODE_ENTER; } - mBinding.vm = mViewModel + mBinding.questionseditTitle.setText(mViewModel.title) mBinding.editorInsertContainer.editorFont.visibility = View.GONE mBinding.editorInsertContainer.editorLink.visibility = View.GONE mOriginalCb.visibility = View.GONE diff --git a/app/src/main/java/com/gh/gamecenter/qa/questions/edit/manager/HistoryActivity.kt b/app/src/main/java/com/gh/gamecenter/qa/questions/edit/manager/HistoryActivity.kt index b05da5a4dd..d3039b2e06 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/questions/edit/manager/HistoryActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/questions/edit/manager/HistoryActivity.kt @@ -15,6 +15,7 @@ import com.halo.assistant.HaloApp import io.reactivex.Observable import org.json.JSONObject +@Deprecated("废弃") class HistoryActivity : ListActivity>() { private var mAdapter: HistoryAdapter? = null @@ -42,7 +43,7 @@ class HistoryActivity : ListActivity, private val mQuestionId: String) : ListAdapter(context) { @@ -25,7 +26,7 @@ class HistoryAdapter(context: Context, } } - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): androidx.recyclerview.widget.RecyclerView.ViewHolder { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { val view: View return if (viewType == ItemViewType.ITEM_FOOTER) { view = mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false) @@ -39,12 +40,13 @@ class HistoryAdapter(context: Context, override fun getItemCount(): Int = if (mEntityList.isEmpty()) 0 else mEntityList.size + TOP_ITEM_COUNT - override fun onBindViewHolder(holder: androidx.recyclerview.widget.RecyclerView.ViewHolder, position: Int) { + override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { if (holder is FooterViewHolder) { holder.initFooterViewHolder(mViewModel, mIsLoading, mIsNetworkError, mIsOver) } else if (holder is HistoryItemViewHolder) { val entity = mEntityList[position] - holder.binding.data = entity + holder.binding.questionHistoryItemTitle.text=entity.title + holder.binding.questionHistoryItemCommunityName.text=entity.community.name holder.binding.questionHistoryItemTime.text = NewsUtils.getFormattedTime(entity.time) holder.itemView.setOnClickListener { mContext.startActivity(HistoryDetailActivity.getIntent(mContext, mQuestionId, entity.id)) diff --git a/app/src/main/java/com/gh/gamecenter/qa/questions/edit/manager/HistoryDetailActivity.kt b/app/src/main/java/com/gh/gamecenter/qa/questions/edit/manager/HistoryDetailActivity.kt index e2b1d3dd9a..00e2e3f8cd 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/questions/edit/manager/HistoryDetailActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/questions/edit/manager/HistoryDetailActivity.kt @@ -21,6 +21,7 @@ import com.gh.gamecenter.databinding.QuestionsHistoryDetailBinding import com.gh.gamecenter.qa.entity.QuestionHistoryDetailEntity import com.google.android.flexbox.FlexboxLayout +@Deprecated("废弃") class HistoryDetailActivity : ToolBarActivity() { private lateinit var mViewModel: HistoryDetailViewModel @@ -69,7 +70,7 @@ class HistoryDetailActivity : ToolBarActivity() { private fun updateView(it: QuestionHistoryDetailEntity?) { it?.let { - mBinding.data = it +// mBinding.data = it mBinding.questionHistoryExecutive.text = when (it.modifier.level) { "author" -> "作者" "primary" -> "版主" diff --git a/app/src/main/java/com/gh/gamecenter/qa/questions/edit/tip/QuestionTitleTipAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/questions/edit/tip/QuestionTitleTipAdapter.kt index 826341b1a8..cc799840ec 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/questions/edit/tip/QuestionTitleTipAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/questions/edit/tip/QuestionTitleTipAdapter.kt @@ -10,9 +10,7 @@ import android.widget.AutoCompleteTextView import android.widget.BaseAdapter import android.widget.Filter import android.widget.Filterable -import androidx.databinding.DataBindingUtil import com.gh.common.util.DisplayUtils -import com.gh.gamecenter.R import com.gh.gamecenter.databinding.QuestionEditTitleSearchItemBinding import com.gh.gamecenter.qa.entity.QuestionsIndexEntity import com.gh.gamecenter.qa.questions.newdetail.NewQuestionDetailActivity @@ -34,7 +32,7 @@ class QuestionTitleTipAdapter(private val context: Context, title: AutoCompleteT val view: View val binding: QuestionEditTitleSearchItemBinding if (convertView == null) { - binding = DataBindingUtil.bind(LayoutInflater.from(context).inflate(R.layout.question_edit_title_search_item, convertView, false))!! + binding = QuestionEditTitleSearchItemBinding.inflate(LayoutInflater.from(context), convertView, false) view = binding.root view.tag = binding } else { @@ -42,7 +40,7 @@ class QuestionTitleTipAdapter(private val context: Context, title: AutoCompleteT binding = view.tag as QuestionEditTitleSearchItemBinding } val entity = questionList[pos] - binding.entity = entity + binding.questionsEditIndexAnswerCount.text = "${entity.answerCount} 回答" binding.questionsEditIndexTitle.text = Html.fromHtml(replayKeyword(entity.title)) view.setOnClickListener { context.startActivity(NewQuestionDetailActivity.getIntent(context, entity.id, "", "问题编辑-标题自动搜索")) @@ -96,15 +94,15 @@ class QuestionTitleTipAdapter(private val context: Context, title: AutoCompleteT val results = FilterResults() if (prefix.isNullOrBlank()) return results RetrofitManager - .getInstance().api - .getAskSearchByTitle(mCommunityId, prefix.toString(), 1) - .subscribe(object : Response>() { - override fun onResponse(response: List?) { - results.values = response - results.count = response!!.size - mSearchKey = prefix.toString() - } - }) + .getInstance().api + .getAskSearchByTitle(mCommunityId, prefix.toString(), 1) + .subscribe(object : Response>() { + override fun onResponse(response: List?) { + results.values = response + results.count = response!!.size + mSearchKey = prefix.toString() + } + }) return results } diff --git a/app/src/main/java/com/gh/gamecenter/qa/questions/invite/QuestionsInviteAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/questions/invite/QuestionsInviteAdapter.kt index 03e69fd645..72865e6955 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/questions/invite/QuestionsInviteAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/questions/invite/QuestionsInviteAdapter.kt @@ -16,10 +16,12 @@ import com.gh.gamecenter.entity.MeEntity import com.gh.gamecenter.qa.entity.InviteEntity import java.util.* -open class QuestionsInviteAdapter(context: Context, - private val mListClickListener: OnListClickListener, - private val mEntrance: String, - private val mPath: String) : ListAdapter(context) { +open class QuestionsInviteAdapter( + context: Context, + private val mListClickListener: OnListClickListener, + private val mEntrance: String, + private val mPath: String +) : ListAdapter(context) { override fun setListData(listData: List?) { if (listData != null && listData.isNotEmpty()) { @@ -74,7 +76,7 @@ open class QuestionsInviteAdapter(context: Context, } ItemViewType.ITEM_HEADER -> { val headerEntity = mEntityList[position] - (holder as HeaderHolder).binding.title = headerEntity.headerName + (holder as HeaderHolder).binding.questionInviteHeaderTv.text = headerEntity.headerName } } } diff --git a/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/NewQuestionDetailAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/NewQuestionDetailAdapter.kt index b623b40df4..128082c565 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/NewQuestionDetailAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/NewQuestionDetailAdapter.kt @@ -3,16 +3,13 @@ package com.gh.gamecenter.qa.questions.newdetail import android.content.Context import android.text.SpannableStringBuilder import android.view.ViewGroup -import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView -import com.gh.common.syncpage.ISyncAdapterHandler import com.gh.common.util.SpanBuilder import com.gh.common.view.CustomLinkMovementMethod import com.gh.gamecenter.R import com.gh.gamecenter.baselist.LoadStatus import com.gh.gamecenter.databinding.ItemArticleDetailContentBinding import com.gh.gamecenter.qa.answer.detail.SimpleAnswerDetailActivity -import com.gh.gamecenter.qa.article.detail.ArticleDetailContentViewHolder import com.gh.gamecenter.qa.comment.base.BaseCommentAdapter class NewQuestionDetailAdapter(context: Context, var mViewModel: NewQuestionDetailViewModel, type: AdapterType, val entrance: String) : diff --git a/app/src/main/java/com/gh/gamecenter/qa/video/detail/ForumVideoDetailFragment.kt b/app/src/main/java/com/gh/gamecenter/qa/video/detail/ForumVideoDetailFragment.kt index 230bda1616..215edbe6d9 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/video/detail/ForumVideoDetailFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/video/detail/ForumVideoDetailFragment.kt @@ -23,6 +23,7 @@ import com.ethanhua.skeleton.Skeleton import com.ethanhua.skeleton.ViewSkeletonScreen import com.gh.base.fragment.BaseFragment_TabLayout import com.gh.common.constant.Constants +import com.gh.common.databind.BindingAdapters import com.gh.common.util.* import com.gh.download.DownloadManager import com.gh.gamecenter.GameDetailActivity @@ -292,7 +293,7 @@ class ForumVideoDetailFragment : BaseFragment_TabLayout() { mBinding.gameIconView.displayGameIcon(gameEntity) mBinding.gameNameTv.text = gameEntity.name mBinding.gameScoreTv.text = gameEntity.star.toString() - mBinding.game = gameEntity + BindingAdapters.setVideoDetailGameTags(mBinding.gameTagsContainer, gameEntity) mBinding.gameInfoContainer.setOnClickListener { NewLogUtils.logVideoDetailGameClick( "click_game", diff --git a/app/src/main/java/com/gh/gamecenter/qa/video/detail/desc/VideoDescAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/video/detail/desc/VideoDescAdapter.kt index 9c15e1a682..16f6802700 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/video/detail/desc/VideoDescAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/video/detail/desc/VideoDescAdapter.kt @@ -1,23 +1,22 @@ package com.gh.gamecenter.qa.video.detail.desc import android.content.Context -import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView -import com.gh.base.BaseRecyclerViewHolder import com.gh.common.constant.ItemViewType +import com.gh.common.util.ImageUtils import com.gh.common.util.NewLogUtils +import com.gh.common.util.TimeUtils +import com.gh.common.util.toBinding import com.gh.gamecenter.R import com.gh.gamecenter.adapter.viewholder.FooterViewHolder import com.gh.gamecenter.baselist.ListAdapter -import com.gh.gamecenter.databinding.ItemForumVideoBinding -import com.gh.gamecenter.databinding.ItemVideoDescTopBinding import com.gh.gamecenter.entity.VideoDescItemEntity import com.gh.gamecenter.qa.video.detail.ForumVideoDetailActivity import com.gh.gamecenter.qa.video.detail.ForumVideoDetailViewModel class VideoDescAdapter(context: Context, val mVideoDetailViewModel: ForumVideoDetailViewModel, val mViewModel: VideoDescViewModel) : - ListAdapter(context) { + ListAdapter(context) { private var mContentIsExpand = false private var expandHeight = 0 private var shrinkHeight = 0 @@ -56,10 +55,10 @@ class VideoDescAdapter(context: Context, val mVideoDetailViewModel: ForumVideoDe FooterViewHolder(mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false)) } VIDEO_TOP_DETAIL -> { - VideoDescTopViewHolder(ItemVideoDescTopBinding.inflate(LayoutInflater.from(mContext), parent, false), mContentIsExpand, shrinkHeight, expandHeight, mVideoDetailViewModel, mViewModel) + VideoDescTopViewHolder(parent.toBinding(), mContentIsExpand, shrinkHeight, expandHeight, mVideoDetailViewModel, mViewModel) } VIDEO_RECOMMEND -> { - VideoItemViewHolder(ItemForumVideoBinding.inflate(LayoutInflater.from(mContext), parent, false)) + VideoItemViewHolder(parent.toBinding()) } else -> { throw NullPointerException() @@ -80,17 +79,22 @@ class VideoDescAdapter(context: Context, val mVideoDetailViewModel: ForumVideoDe is VideoItemViewHolder -> { val entity = mEntityList[position] val recommendVideo = entity.recommendVideo - holder.binding.video = recommendVideo + ImageUtils.display(holder.binding.videoPoster, recommendVideo?.poster) + holder.binding.durationTv.text = TimeUtils.formatVideoDuration(recommendVideo?.length ?: 0) + holder.binding.videoTitleTv.text = recommendVideo?.title + holder.binding.userName.text = recommendVideo?.user?.name + holder.binding.voteAndCommentTv.text = "点赞 ${recommendVideo?.count?.vote} · 评论 ${recommendVideo?.count?.comment}" holder.binding.root.setOnClickListener { recommendVideo?.let { - mContext.startActivity(ForumVideoDetailActivity.getIntent(mContext, it.id,it.bbs?.id ?: "")) + mContext.startActivity(ForumVideoDetailActivity.getIntent(mContext, it.id, it.bbs?.id ?: "")) } val bbsType = if (mViewModel.topVideoDetail?.bbs?.type == "game_bbs") "游戏论坛" else "综合论坛" - NewLogUtils.logVideoDetailClick("click_video_detail_for_you_video", - mViewModel.topVideoDetail?.user?.id ?: "", - "视频贴", mViewModel.topVideoDetail?.bbs?.id ?: "", - bbsType, mViewModel.topVideoDetail?.id ?: "" - , recommendVideo?.id ?: "", position - 1) + NewLogUtils.logVideoDetailClick( + "click_video_detail_for_you_video", + mViewModel.topVideoDetail?.user?.id ?: "", + "视频贴", mViewModel.topVideoDetail?.bbs?.id ?: "", + bbsType, mViewModel.topVideoDetail?.id ?: "", recommendVideo?.id ?: "", position - 1 + ) } } is FooterViewHolder -> { diff --git a/app/src/main/java/com/gh/gamecenter/qa/video/detail/desc/VideoDescTopViewHolder.kt b/app/src/main/java/com/gh/gamecenter/qa/video/detail/desc/VideoDescTopViewHolder.kt index e2515fc549..01b301bb33 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/video/detail/desc/VideoDescTopViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/video/detail/desc/VideoDescTopViewHolder.kt @@ -28,9 +28,31 @@ class VideoDescTopViewHolder( ) : BaseRecyclerViewHolder(binding.root) { private var mIsAnimationFinish = true fun bindData(entity: ForumVideoEntity) { - binding.entity = entity + binding.userNameTv.text = entity.user.name + ImageUtils.display(binding.badgeIv, entity.user.badge?.icon) + binding.badgeIv.goneIf(entity.user.badge == null) + binding.fansAndTimeTv.text = "${entity.user.count.fans}粉丝 · ${CommentUtils.getCommentTime(entity.time.upload)}" + binding.concernBtn.run { + goneIf(entity.user.id == UserManager.getInstance().userId) + text = if (entity.me.isFollower) "已关注" else "关注" + background = if (entity.me.isFollower) R.drawable.bg_shape_f5_radius_999.toDrawable() else R.drawable.button_round_edf5fc.toDrawable() + setTextColor(if (entity.me.isFollower) R.color.text_subtitleDesc.toColor() else R.color.theme_font.toColor()) + } + binding.titleTv.text = entity.title + binding.desTv.text = entity.des + binding.desTv.goneIf(entity.des.isEmpty()) + binding.activityNameTv.goneIf(entity.tagActivityName.isEmpty()) + binding.activityNameTv.text = entity.tagActivityName binding.userAvatar.display(entity.user.border, entity.user.icon, entity.user.auth?.icon) - binding.executePendingBindings() + binding.likeIv.setImageDrawable(if (entity.me.isVoted) R.drawable.ic_forum_video_detail_liked.toDrawable() else R.drawable.ic_forum_video_detail_like.toDrawable()) + binding.likeCountTv.text=entity.count.vote.toString() + binding.likeCountTv.setTextColor(if (entity.me.isVoted) R.color.theme_font.toColor() else R.color.text_subtitleDesc.toColor()) + binding.collectIv.setImageDrawable(if (entity.me.isVideoFavorite) R.drawable.ic_forum_video_detail_collected.toDrawable() else R.drawable.ic_forum_video_detail_collect.toDrawable()) + binding.collectCountTv.text=entity.count.favorite.toString() + binding.collectCountTv.setTextColor(if (entity.me.isVideoFavorite) R.color.theme_font.toColor() else R.color.text_subtitleDesc.toColor()) + binding.shareIv.setImageDrawable(R.drawable.ic_forum_video_detail_share.toDrawable()) + binding.shareTv.text=entity.share.toString() + if (entity.original == "yes") { binding.originalTv.visibility = View.VISIBLE binding.activityNameTv.layoutParams = diff --git a/app/src/main/java/com/gh/gamecenter/search/SearchDefaultFragment.kt b/app/src/main/java/com/gh/gamecenter/search/SearchDefaultFragment.kt index 1840e9bf8a..7a95a86c68 100644 --- a/app/src/main/java/com/gh/gamecenter/search/SearchDefaultFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/search/SearchDefaultFragment.kt @@ -3,6 +3,7 @@ package com.gh.gamecenter.search import android.os.Bundle import android.text.TextUtils import android.view.Gravity +import android.view.View import android.view.ViewGroup import android.widget.TextView import androidx.recyclerview.widget.GridLayoutManager @@ -36,6 +37,9 @@ open class SearchDefaultFragment : BaseFragment() { private var mViewModel: SearchDefaultViewModel? = null + val defaultViewModel: SearchDefaultViewModel? + get() = mViewModel + // FlexboxLayout:maxLine 不符合需求 protected val mFlexMaxHeight = DisplayUtils.dip2px(57F) @@ -59,18 +63,33 @@ open class SearchDefaultFragment : BaseFragment() { open fun initView() { mBinding = FragmentSearchDefaultBinding.bind(mCachedView) + mHotSearchList = Config.getSettings()?.search?.hotSearch?.apply { + for ((index, hotSearch) in this.withIndex()) { + hotSearch.exposureEvent = ExposureEvent.createEvent( + hotSearch.toGameEntity().apply { sequence = index }, + listOf(ExposureSource("首页搜索"), ExposureSource("热门搜索")) + ) + hotSearch.name = hotSearch.name.removeSuffix(".") + if (!hotSearch.name.endsWith(hotSearch.nameSuffix ?: "")) { + hotSearch.name = hotSearch.name + (hotSearch.nameSuffix ?: "") + } + ExposureManager.log(hotSearch.exposureEvent!!) + } + } + mViewModel?.isExistHotSearch = mHotSearchList?.isNotEmpty() == true + + mHotTagList = Config.getSettings()?.search?.hotTag + mViewModel?.isExistHotTag = mHotTagList?.isNotEmpty() == true + updateHistorySearchView(null) mViewModel?.historySearchLiveData?.observe(this) { updateHistorySearchView(it) } - mHotTagList = Config.getSettings()?.search?.hotTag - mBinding.isExistHotTag = mHotTagList?.isNotEmpty() mBinding.hotTagFlexContainer.setLimitHeight(mFlexMaxHeight) createFlexContent(mBinding.hotTagFlex, getTagListString(), clickListener = { val tag = mHotTagList!![it] DataLogUtils.uploadHotTagLog(context, tag.name) -// MtaHelper.onEvent("游戏搜索", "热门标签", tagName) PageSwitchDataHelper.pushCurrentPageData( hashMapOf( Pair(PageSwitchDataHelper.PAGE_BUSINESS_TYPE, "游戏搜索-热门标签"), @@ -81,19 +100,6 @@ open class SearchDefaultFragment : BaseFragment() { DirectUtils.directToLinkPage(requireContext(), tag, "(搜索-${tag.name})", "") // 不需要path }) - mHotSearchList = Config.getSettings()?.search?.hotSearch?.apply { - for ((index, hotSearch) in this.withIndex()) { - hotSearch.exposureEvent = ExposureEvent.createEvent( - hotSearch.toGameEntity().apply { sequence = index }, - listOf(ExposureSource("首页搜索"), ExposureSource("热门搜索"))) - hotSearch.name = hotSearch.name.removeSuffix(".") - if (!hotSearch.name.endsWith(hotSearch.nameSuffix ?: "")) { - hotSearch.name = hotSearch.name + (hotSearch.nameSuffix ?: "") - } - ExposureManager.log(hotSearch.exposureEvent!!) - } - } - mBinding.isExistHotSearch = mHotSearchList?.isNotEmpty() mBinding.hotList.run { layoutManager = GridLayoutManager(context, 2) adapter = SearchDefaultHotAdapter(context, mHotSearchList, callBack = { @@ -106,13 +112,37 @@ open class SearchDefaultFragment : BaseFragment() { mBinding.historyClear.setOnClickListener { DialogHelper.showCenterWarningDialog(requireContext(), "清空记录", "确定清空历史搜索记录?", confirmClickCallback = { mSearchHistoryDao?.deleteAll() - mBinding.isExistHistory = false + mViewModel?.isExistHistory = false + updateView() }) } } + fun updateView() { + mBinding.historyTitle.visibility = if (mViewModel?.isExistHistory == true) View.VISIBLE else View.GONE + mBinding.historyClear.visibility = if (mViewModel?.isExistHistory == true) View.VISIBLE else View.GONE + mBinding.historyFlex.visibility = if (mViewModel?.isExistHistory == true) View.VISIBLE else View.GONE + mBinding.hotTagTitle.setPadding( + mBinding.hotTagTitle.paddingLeft, + if (mViewModel?.isExistHistory == true) 32f.dip2px() else 16f.dip2px(), + mBinding.hotTagTitle.paddingRight, + mBinding.hotTagTitle.paddingBottom + ) + mBinding.hotTitle.setPadding( + mBinding.hotTitle.paddingLeft, + if (mViewModel?.isExistHistory == false && mViewModel?.isExistHotTag == false) 16f.dip2px() else 32f.dip2px(), + mBinding.hotTitle.paddingRight, + mBinding.hotTitle.paddingBottom + ) + mBinding.hotTagTitle.visibility = if (mViewModel?.isExistHotTag == true) View.VISIBLE else View.GONE + mBinding.hotTagFlex.visibility = if (mViewModel?.isExistHotTag == true) View.VISIBLE else View.GONE + mBinding.hotTitle.visibility = if (mViewModel?.isExistHotSearch == true) View.VISIBLE else View.GONE + mBinding.hotList.visibility = if (mViewModel?.isExistHotSearch == true) View.VISIBLE else View.GONE + } + private fun updateHistorySearchView(historyList: List?) { - mBinding.isExistHistory = historyList?.isNotEmpty() + mViewModel?.isExistHistory = historyList?.isNotEmpty() == true + updateView() if (historyList != null) { mBinding.historyFlexContainer.setLimitHeight(mFlexMaxHeight) createFlexContent(mBinding.historyFlex, historyList, clickListener = { @@ -134,9 +164,11 @@ open class SearchDefaultFragment : BaseFragment() { return list } - fun createFlexContent(flexView: FlexboxLayout, - contentList: List?, - clickListener: (Int) -> Unit) { + fun createFlexContent( + flexView: FlexboxLayout, + contentList: List?, + clickListener: (Int) -> Unit + ) { if (contentList == null || contentList.isEmpty()) return flexView.removeAllViews() diff --git a/app/src/main/java/com/gh/gamecenter/search/SearchDefaultHotAdapter.kt b/app/src/main/java/com/gh/gamecenter/search/SearchDefaultHotAdapter.kt index 9781e5cc41..122877d0d3 100644 --- a/app/src/main/java/com/gh/gamecenter/search/SearchDefaultHotAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/search/SearchDefaultHotAdapter.kt @@ -4,7 +4,10 @@ import android.content.Context import android.view.ViewGroup import androidx.constraintlayout.widget.ConstraintLayout import com.gh.base.BaseRecyclerViewHolder -import com.gh.common.util.* +import com.gh.common.util.dip2px +import com.gh.common.util.toColor +import com.gh.common.util.toDrawable +import com.gh.common.util.tryWithDefaultCatch import com.gh.gamecenter.R import com.gh.gamecenter.databinding.SearchDefaultHotItemBinding import com.gh.gamecenter.entity.SettingsEntity @@ -28,8 +31,7 @@ class SearchDefaultHotAdapter( override fun onBindViewHolder(holder: SearchDefaultHotViewHolder, position: Int) { val hotSearch = hotList!![position] holder.binding.run { - entity = hotSearch - + name.text = hotSearch.name icon.displayGameIcon(hotSearch.rawIcon ?: hotSearch.icon, hotSearch.iconSubscript) if (!name.isSelected) { diff --git a/app/src/main/java/com/gh/gamecenter/search/SearchDefaultViewModel.kt b/app/src/main/java/com/gh/gamecenter/search/SearchDefaultViewModel.kt index 80827fe1a6..8e1e2c3b91 100644 --- a/app/src/main/java/com/gh/gamecenter/search/SearchDefaultViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/search/SearchDefaultViewModel.kt @@ -9,6 +9,9 @@ import com.gh.gamecenter.db.SearchHistoryDao class SearchDefaultViewModel(application: Application) : AndroidViewModel(application) { val historySearchLiveData = MutableLiveData>() + var isExistHotSearch: Boolean = false + var isExistHotTag: Boolean = false + var isExistHistory: Boolean = false init { runOnIoThread(true) { diff --git a/app/src/main/java/com/gh/gamecenter/search/SearchGameIndexAdapter.kt b/app/src/main/java/com/gh/gamecenter/search/SearchGameIndexAdapter.kt index 9557d913f4..f4edbc911d 100644 --- a/app/src/main/java/com/gh/gamecenter/search/SearchGameIndexAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/search/SearchGameIndexAdapter.kt @@ -10,6 +10,7 @@ import androidx.collection.ArrayMap import androidx.recyclerview.widget.RecyclerView import com.gh.common.constant.Constants import com.gh.common.constant.ItemViewType +import com.gh.common.databind.BindingAdapters import com.gh.common.exposure.ExposureEvent import com.gh.common.exposure.ExposureSource import com.gh.common.exposure.ExposureType @@ -117,8 +118,20 @@ class SearchGameIndexAdapter( if (holder is SearchGameIndexItemViewHolder) { val binding = holder.binding - binding.game = gameEntity - binding.gameItemIncluded.game = gameEntity + binding.gameItemIncluded.run { + gameIconView.displayGameIcon(gameEntity) + BindingAdapters.setGameName(gameName, gameEntity, false, null) + BindingAdapters.setTextSize(gameRating, if (gameEntity.commentCount > 3) 12 else 10) + BindingAdapters.setGameTags(labelList, gameEntity) + gameRating.setCompoundDrawables(if (gameEntity.commentCount > 3) R.drawable.game_horizontal_rating.toDrawable() else null, null, null, null) + gameRating.setPadding(0, 0, if (gameEntity.commentCount > 3) 8F.dip2px() else 0, 0) + gameRating.text = if (gameEntity.commentCount > 3) { + if (gameEntity.star == 10.0F) "10" else gameEntity.star.toString() + } else "" + gameRating.setTextColor(if (gameEntity.commentCount > 3) R.color.theme_font.toColor() else R.color.theme.toColor()) + gameDes.text = gameEntity.decoratedDes + recommendStar.rating = gameEntity.recommendStar.toFloat() + } binding.topDivider.goneIf(position == 0) binding.gameItemIncluded.root.setPadding( 16F.dip2px(), @@ -127,7 +140,6 @@ class SearchGameIndexAdapter( 16F.dip2px() ) holder.initServerType(gameEntity) - binding.executePendingBindings() binding.run { val isShowTag = !gameEntity.shouldUseMirrorInfo() diff --git a/app/src/main/java/com/gh/gamecenter/search/SearchGameResultAdapter.kt b/app/src/main/java/com/gh/gamecenter/search/SearchGameResultAdapter.kt index 209a83e224..c2f84befab 100644 --- a/app/src/main/java/com/gh/gamecenter/search/SearchGameResultAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/search/SearchGameResultAdapter.kt @@ -9,6 +9,7 @@ import androidx.collection.ArrayMap import androidx.recyclerview.widget.RecyclerView import com.gh.common.constant.Constants import com.gh.common.constant.ItemViewType +import com.gh.common.databind.BindingAdapters import com.gh.common.exposure.ExposureEvent import com.gh.common.exposure.ExposureSource import com.gh.common.exposure.ExposureType @@ -182,11 +183,22 @@ class SearchGameResultAdapter( private fun bindGameItem(holder: SearchGameIndexItemViewHolder) { val binding = holder.binding val gameEntity = mEntityList[holder.adapterPosition].game!! - binding.game = gameEntity - binding.gameItemIncluded.game = gameEntity + binding.gameItemIncluded.run { + gameIconView.displayGameIcon(gameEntity) + BindingAdapters.setGameName(gameName, gameEntity, false, null) + BindingAdapters.setTextSize(gameRating, if (gameEntity.commentCount > 3) 12 else 10) + BindingAdapters.setGameTags(labelList, gameEntity) + gameRating.setCompoundDrawables(if (gameEntity.commentCount > 3) R.drawable.game_horizontal_rating.toDrawable() else null, null, null, null) + gameRating.setPadding(0, 0, if (gameEntity.commentCount > 3) 8F.dip2px() else 0, 0) + gameRating.text = if (gameEntity.commentCount > 3) { + if (gameEntity.star == 10.0F) "10" else gameEntity.star.toString() + } else "" + gameRating.setTextColor(if (gameEntity.commentCount > 3) R.color.theme_font.toColor() else R.color.theme.toColor()) + gameDes.text = gameEntity.decoratedDes + recommendStar.rating = gameEntity.recommendStar.toFloat() + } binding.gameItemIncluded.root.setPadding(16F.dip2px(), 16F.dip2px(), 16F.dip2px(), 16F.dip2px()) holder.initServerType(gameEntity) - binding.executePendingBindings() val exposureSources = ArrayList() exposureSources.add(ExposureSource("首页搜索", "")) diff --git a/app/src/main/java/com/gh/gamecenter/search/SearchSubjectAdapter.kt b/app/src/main/java/com/gh/gamecenter/search/SearchSubjectAdapter.kt index 04562a1063..ed163f67fb 100644 --- a/app/src/main/java/com/gh/gamecenter/search/SearchSubjectAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/search/SearchSubjectAdapter.kt @@ -2,10 +2,9 @@ package com.gh.gamecenter.search import android.content.Context import android.view.ViewGroup -import androidx.databinding.DataBindingUtil import com.gh.common.util.dip2px +import com.gh.common.util.toBinding import com.gh.gamecenter.GameDetailActivity -import com.gh.gamecenter.R import com.gh.gamecenter.entity.GameEntity import com.gh.gamecenter.game.horizontal.GameHorizontalSimpleItemViewHolder import com.lightgame.adapter.BaseRecyclerAdapter @@ -21,7 +20,7 @@ class SearchSubjectAdapter(context: Context, parent: ViewGroup, viewType: Int ): GameHorizontalSimpleItemViewHolder { - return GameHorizontalSimpleItemViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.game_horizontal_simple_item, parent, false)) + return GameHorizontalSimpleItemViewHolder(parent.toBinding()) } override fun onBindViewHolder(holder: GameHorizontalSimpleItemViewHolder, position: Int) { @@ -29,9 +28,8 @@ class SearchSubjectAdapter(context: Context, holder.binding.run { val padR = if (position == itemCount - 1) 16F.dip2px() else 0 root.setPadding(16F.dip2px(), 0, padR, 0) - - game = gameEntity - executePendingBindings() + gameIcon.displayGameIcon(gameEntity) + GameHorizontalSimpleItemViewHolder.setHorizontalNameAndGravity(gameName, gameEntity.name) root.setOnClickListener { clickCallback.invoke() GameDetailActivity.startGameDetailActivity(mContext, gameEntity.id, mEntrance, gameEntity.exposureEvent) diff --git a/app/src/main/java/com/gh/gamecenter/servers/GameServersTestAdapter.kt b/app/src/main/java/com/gh/gamecenter/servers/GameServersTestAdapter.kt index d162e94661..e7c1e7d9c9 100644 --- a/app/src/main/java/com/gh/gamecenter/servers/GameServersTestAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/servers/GameServersTestAdapter.kt @@ -83,7 +83,7 @@ class GameServersTestAdapter(context: Context, 16F.dip2px(), if (isTheLastOfTheLatestConsecutiveGame) 16F.dip2px() else 8F.dip2px()) - holder.binding.game = gameEntity + holder.bindGameItem(gameEntity) holder.binding.gameName.layoutParams = holder.binding.gameName.layoutParams.apply { width = ViewGroup.LayoutParams.WRAP_CONTENT } @@ -118,7 +118,6 @@ class GameServersTestAdapter(context: Context, StringUtils.buildString("开服表:", gameEntity.name), mExposureEventArray[viewHolder.adapterPosition]) DownloadItemUtils.updateItem(mContext, gameEntity, GameViewHolder(viewHolder.binding), true, gameEntity.briefStyle) - viewHolder.binding.executePendingBindings() viewHolder.itemView.setOnClickListener { GameDetailActivity.startGameDetailActivity(mContext, gameEntity, StringUtils.buildString(mEntrance, "+(开服表[", viewHolder.adapterPosition.toString(), "])"), diff --git a/app/src/main/java/com/gh/gamecenter/servers/add/AddKaiFuActivity.kt b/app/src/main/java/com/gh/gamecenter/servers/add/AddKaiFuActivity.kt index 179ddcb0f5..8d23b95b2b 100644 --- a/app/src/main/java/com/gh/gamecenter/servers/add/AddKaiFuActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/servers/add/AddKaiFuActivity.kt @@ -19,8 +19,8 @@ import androidx.lifecycle.ViewModelProviders import com.bigkoo.pickerview.builder.TimePickerBuilder import com.bigkoo.pickerview.listener.OnTimeSelectListener import com.contrarywind.view.WheelView -import com.gh.base.OnViewClickListener import com.gh.base.ToolBarActivity +import com.gh.common.databind.AddKaiFuBindingAdapter import com.gh.common.util.EntranceUtils import com.gh.common.util.HaloWheelViewAdapter import com.gh.gamecenter.R @@ -72,28 +72,31 @@ class AddKaiFuActivity : ToolBarActivity() { // initView mBinding = ActivityKaifuAddBinding.bind(mContentView) - mBinding?.list = mViewModel?.calendarList - mBinding?.clickListener = OnViewClickListener { view: View, position: Any -> - if (position is Int) { - if (position == 0) { - when (view.id) { - R.id.kaifu_add_first_name -> { // 自动填充->名字 - mViewModel?.copyLastFirstNameToNext() + mBinding?.kaifuAddContainer?.let { + AddKaiFuBindingAdapter.addKaiFuView( + it, mViewModel?.calendarList + ) { view: View, position: Any -> + if (position is Int) { + if (position == 0) { + when (view.id) { + R.id.kaifu_add_first_name -> { // 自动填充->名字 + mViewModel?.copyLastFirstNameToNext() + } + R.id.kaifu_add_server_name -> { + mViewModel?.copyLastFirstAndServerNameToNext() + } + R.id.kaifu_add_time -> { // 自动填充->时间 + mViewModel?.copyTimeToNext() + } } - R.id.kaifu_add_server_name -> { - mViewModel?.copyLastFirstAndServerNameToNext() - } - R.id.kaifu_add_time -> { // 自动填充->时间 - mViewModel?.copyTimeToNext() + } else if (view.id == R.id.kaifu_add_time) { + showDataPicker { data: Date?, _ -> + run { + data?.minutes = mPickerMinutes[data?.minutes ?: 0] + mViewModel?.calendarList!![position].setTime(if (data == null) 0 else data.time / 1000) + } } } - } else if (view.id == R.id.kaifu_add_time) { - showDataPicker(OnTimeSelectListener { data: Date?, _ -> - run { - data?.minutes = mPickerMinutes.get(data?.minutes ?: 0) - mViewModel?.calendarList!![position].setTime(if (data == null) 0 else data.time / 1000) - } - }) } } } diff --git a/app/src/main/java/com/gh/gamecenter/servers/patch/PatchKaifuActivity.kt b/app/src/main/java/com/gh/gamecenter/servers/patch/PatchKaifuActivity.kt index 55eba14d16..82440aaa41 100644 --- a/app/src/main/java/com/gh/gamecenter/servers/patch/PatchKaifuActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/servers/patch/PatchKaifuActivity.kt @@ -8,7 +8,6 @@ import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProviders import com.gh.base.ToolBarActivity import com.gh.common.util.DialogHelper -import com.gh.common.util.DialogUtils import com.gh.common.util.EntranceUtils import com.gh.gamecenter.R import com.gh.gamecenter.databinding.ActivityKaifuPatchBinding @@ -32,8 +31,9 @@ class PatchKaifuActivity : ToolBarActivity() { mViewModel = ViewModelProviders.of(this).get(PatchKaifuViewModel::class.java) mViewModel?.initData( - intent.getParcelableExtra(ServerCalendarEntity.TAG) ?: ServerCalendarEntity(), - intent.getStringExtra(EntranceUtils.KEY_GAMEID) ?: "") + intent.getParcelableExtra(ServerCalendarEntity.TAG) ?: ServerCalendarEntity(), + intent.getStringExtra(EntranceUtils.KEY_GAMEID) ?: "" + ) mViewModel?.postResult?.observe(this, Observer { if (it != null) { val intent = Intent() @@ -44,7 +44,16 @@ class PatchKaifuActivity : ToolBarActivity() { }) mBinding = ActivityKaifuPatchBinding.bind(mContentView) - mBinding?.entity = mViewModel?.serverEntity + val entity = mViewModel?.serverEntity + mBinding?.timeTv?.text =entity?.getFormatTime("yyyy-MM-dd HH:mm") + mBinding?.nameTv?.text =entity?.getNote() + mBinding?.remarkTv?.text =entity?.remark + mBinding?.patchName?.setText(entity?.getNote()) + mBinding?.patchRemark?.setText(entity?.remark) + mBinding?.noteDelTv?.text = entity?.getNote() + mBinding?.remarkDelTv?.text = entity?.remark + + mBinding?.patchBtn?.isChecked = true mBinding?.patchBtn?.setOnCheckedChangeListener { _, b: Boolean -> if (b) mBinding?.deleteBtn?.isChecked = false @@ -72,8 +81,9 @@ class PatchKaifuActivity : ToolBarActivity() { return@setOnClickListener } if (mBinding?.patchBtn?.isChecked!! - && mViewModel?.serverEntity?.getNote() == patchName - && mViewModel?.serverEntity?.remark == patchRemark) { + && mViewModel?.serverEntity?.getNote() == patchName + && mViewModel?.serverEntity?.remark == patchRemark + ) { toast("内容没有变化,不能提交") return@setOnClickListener } @@ -82,7 +92,9 @@ class PatchKaifuActivity : ToolBarActivity() { if (mBinding?.patchBtn?.isChecked!!) "确定修改开服信息吗?" else "确定删除开服信息吗?", "确定", "返回", - { mViewModel?.post(mBinding?.patchBtn?.isChecked!!, patchName, patchRemark) }, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)) + { mViewModel?.post(mBinding?.patchBtn?.isChecked!!, patchName, patchRemark) }, + extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true) + ) } } } diff --git a/app/src/main/java/com/gh/gamecenter/simulatorgame/SimulatorGameListAdapter.kt b/app/src/main/java/com/gh/gamecenter/simulatorgame/SimulatorGameListAdapter.kt index 168b44a7ac..72720fcf82 100644 --- a/app/src/main/java/com/gh/gamecenter/simulatorgame/SimulatorGameListAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/simulatorgame/SimulatorGameListAdapter.kt @@ -21,6 +21,7 @@ import androidx.recyclerview.widget.RecyclerView import com.g00fy2.versioncompare.Version import com.gh.base.BaseRecyclerViewHolder import com.gh.common.constant.ItemViewType +import com.gh.common.databind.BindingAdapters import com.gh.common.simulator.SimulatorDownloadManager import com.gh.common.simulator.SimulatorGameManager import com.gh.common.util.* @@ -158,7 +159,20 @@ class SimulatorGameListAdapter(context: Context, topToTop = -1 bottomMargin = DisplayUtils.dip2px(8F) } - gameItemIncluded.game = gameEntity + gameItemIncluded.run { + gameIconView.displayGameIcon(gameEntity) + BindingAdapters.setGameName(gameName, gameEntity, false, null) + BindingAdapters.setTextSize(gameRating, if (gameEntity.commentCount > 3) 12 else 10) + BindingAdapters.setGameTags(labelList, gameEntity) + gameRating.setCompoundDrawables(if (gameEntity.commentCount > 3) R.drawable.game_horizontal_rating.toDrawable() else null, null, null, null) + gameRating.setPadding(0, 0, if (gameEntity.commentCount > 3) 8F.dip2px() else 0, 0) + gameRating.text = if (gameEntity.commentCount > 3) { + if (gameEntity.star == 10.0F) "10" else gameEntity.star.toString() + } else "" + gameRating.setTextColor(if (gameEntity.commentCount > 3) R.color.theme_font.toColor() else R.color.theme.toColor()) + gameDes.text = gameEntity.decoratedDes + recommendStar.rating = gameEntity.recommendStar.toFloat() + } gameItemIncluded.recentPlayedTag.goneIf(!gameEntity.isRecentlyPlayed) gameItemIncluded.selectIv.goneIf(!mShowSelectFlag) gameItemIncluded.selectIv.isChecked = mSelectList[position - 1] diff --git a/app/src/main/java/com/gh/gamecenter/subject/SubjectAdapter.kt b/app/src/main/java/com/gh/gamecenter/subject/SubjectAdapter.kt index 42c12a4510..b984862c9b 100644 --- a/app/src/main/java/com/gh/gamecenter/subject/SubjectAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/subject/SubjectAdapter.kt @@ -94,11 +94,9 @@ class SubjectAdapter(context: Context, holder.itemView.setPadding(padLeft, padTop, 20F.dip2px(), 12F.dip2px()) val gameEntity = mEntityList[position] - holder.binding.game = gameEntity - holder.binding.briefStyle = subjectData.briefStyle - holder.binding.isShowSuffix = true // 专题详情均显示游戏后缀 https://git.ghzs.com/pm/halo-app-issues/-/issues/1098 (3) + // 专题详情均显示游戏后缀 https://git.ghzs.com/pm/halo-app-issues/-/issues/1098 (3) + holder.bindGameItem(gameEntity, true, subjectData.briefStyle) holder.initServerType(gameEntity) - holder.binding.executePendingBindings() if (subjectData.isOrder!!) { var index = 1 diff --git a/app/src/main/java/com/gh/gamecenter/suggest/SuggestGameCollectAdapter.kt b/app/src/main/java/com/gh/gamecenter/suggest/SuggestGameCollectAdapter.kt index aa10a45d05..197aebc78c 100644 --- a/app/src/main/java/com/gh/gamecenter/suggest/SuggestGameCollectAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/suggest/SuggestGameCollectAdapter.kt @@ -26,9 +26,8 @@ class SuggestGameCollectAdapter(context: Context, holder.itemView.setPadding(8F.dip2px(),4F.dip2px(),12F.dip2px(),4F.dip2px()) val gameEntity = mGameList[position] - holder.binding.game = gameEntity + holder.bindGameItem(gameEntity) holder.initServerType(gameEntity) - holder.binding.executePendingBindings() holder.binding.downloadBtn.text = "查看" holder.binding.root.setOnClickListener { GameDetailActivity.startGameDetailActivity(mContext, gameEntity, "(意见反馈-收录提示)") diff --git a/app/src/main/java/com/gh/gamecenter/tag/TagsListAdapter.kt b/app/src/main/java/com/gh/gamecenter/tag/TagsListAdapter.kt index 71d504e096..d6baeaf258 100644 --- a/app/src/main/java/com/gh/gamecenter/tag/TagsListAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/tag/TagsListAdapter.kt @@ -79,9 +79,8 @@ class TagsListAdapter(context: Context, if (holder is GameItemViewHolder) { val gameEntity = mEntityList[position] - holder.binding.game = gameEntity + holder.bindGameItem(gameEntity) holder.initServerType(gameEntity) - holder.binding.executePendingBindings() val padTop = if (position == 0) 16F.dip2px() else 8F.dip2px() holder.itemView.setPadding(16F.dip2px(), padTop, 16F.dip2px(), 8F.dip2px()) diff --git a/app/src/main/java/com/gh/gamecenter/video/VideoItemViewHolder.kt b/app/src/main/java/com/gh/gamecenter/video/VideoItemViewHolder.kt new file mode 100644 index 0000000000..913fa6b111 --- /dev/null +++ b/app/src/main/java/com/gh/gamecenter/video/VideoItemViewHolder.kt @@ -0,0 +1,23 @@ +package com.gh.gamecenter.video + +import com.gh.base.BaseRecyclerViewHolder +import com.gh.common.util.ImageUtils +import com.gh.common.util.TimeUtils +import com.gh.common.util.toSimpleCount +import com.gh.gamecenter.databinding.VideoNewItemBinding +import com.gh.gamecenter.entity.MyVideoEntity + +class VideoItemViewHolder(var binding: VideoNewItemBinding) : BaseRecyclerViewHolder(binding.root) { + + fun bindVideoItem(entity: MyVideoEntity) { + binding.run { + ImageUtils.display(videoCover, entity.poster) + videoLikeCount.text = entity.vote.toSimpleCount() + videoCommentCount.text = entity.commentCount.toSimpleCount() + videoDuration.text = TimeUtils.formatVideoDuration(entity.length) + videoTitle.text = entity.title + ImageUtils.display(userIcon, entity.user.icon) + userName.text = entity.user.name + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/video/ViewHolder.kt b/app/src/main/java/com/gh/gamecenter/video/ViewHolder.kt index 6f2a1fd70f..7b1c9fec81 100644 --- a/app/src/main/java/com/gh/gamecenter/video/ViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/video/ViewHolder.kt @@ -1,8 +1,6 @@ package com.gh.gamecenter.video import com.gh.base.BaseRecyclerViewHolder -import com.gh.gamecenter.databinding.VideoNewItemBinding import com.gh.gamecenter.databinding.VideoStatusItemBinding -class VideoItemViewHolder(var binding: VideoNewItemBinding) : BaseRecyclerViewHolder(binding.root) class VideoStatusItemViewHolder(var binding: VideoStatusItemBinding) : BaseRecyclerViewHolder(binding.root) \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/video/game/GameVideoActivity.kt b/app/src/main/java/com/gh/gamecenter/video/game/GameVideoActivity.kt index 4559015fec..f4ff9c80e1 100644 --- a/app/src/main/java/com/gh/gamecenter/video/game/GameVideoActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/video/game/GameVideoActivity.kt @@ -4,7 +4,6 @@ import android.content.Context import android.content.Intent import android.graphics.Color import android.os.Bundle -import androidx.databinding.DataBindingUtil import androidx.fragment.app.Fragment import androidx.lifecycle.ViewModelProviders import com.gh.base.BaseActivity @@ -32,7 +31,7 @@ class GameVideoActivity : ToolBarActivity() { setNavigationTitle("视频合集") setStatusBarColor(R.color.text_181927.toColor()) mTitleTv.setTextColor(Color.WHITE) - mBinding = DataBindingUtil.bind(mContentView)!! + mBinding = ActivityVideoGameBinding.bind(mContentView) // viewpager & tab content val gameId = intent.getStringExtra(EntranceUtils.KEY_GAMEID) ?: "" diff --git a/app/src/main/java/com/gh/gamecenter/video/game/GameVideoAdapter.kt b/app/src/main/java/com/gh/gamecenter/video/game/GameVideoAdapter.kt index 3fde4aaa5b..d56c525c98 100644 --- a/app/src/main/java/com/gh/gamecenter/video/game/GameVideoAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/video/game/GameVideoAdapter.kt @@ -6,23 +6,22 @@ import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import com.gh.common.constant.ItemViewType import com.gh.common.util.DirectUtils -import com.gh.common.util.ImageUtils -import com.gh.common.util.toSimpleCount import com.gh.gamecenter.R import com.gh.gamecenter.adapter.viewholder.FooterViewHolder import com.gh.gamecenter.baselist.ListAdapter import com.gh.gamecenter.baselist.NormalListViewModel -import com.gh.gamecenter.databinding.VideoItemBinding import com.gh.gamecenter.databinding.VideoNewItemBinding import com.gh.gamecenter.entity.MyVideoEntity import com.gh.gamecenter.video.VideoItemViewHolder import com.gh.gamecenter.video.detail.VideoDetailContainerViewModel -class GameVideoAdapter(context: Context, - private val mViewModel: NormalListViewModel, - private val mEntrance: String, - private val mSortValue: String?, - val gameId: String) : ListAdapter(context) { +class GameVideoAdapter( + context: Context, + private val mViewModel: NormalListViewModel, + private val mEntrance: String, + private val mSortValue: String?, + val gameId: String +) : ListAdapter(context) { override fun getItemViewType(position: Int): Int { if (position == itemCount - 1) return ItemViewType.ITEM_FOOTER @@ -51,7 +50,7 @@ class GameVideoAdapter(context: Context, override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { if (holder is VideoItemViewHolder) { val entity = mEntityList[position] - holder.binding.video = entity + holder.bindVideoItem(entity) holder.itemView.setOnClickListener { var fromLocation = "" var path = "" diff --git a/app/src/main/java/com/gh/gamecenter/video/label/VideoLabelAdapter.kt b/app/src/main/java/com/gh/gamecenter/video/label/VideoLabelAdapter.kt index 4eced3a2b5..254d24182f 100644 --- a/app/src/main/java/com/gh/gamecenter/video/label/VideoLabelAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/video/label/VideoLabelAdapter.kt @@ -2,12 +2,10 @@ package com.gh.gamecenter.video.label import android.content.Context import android.view.ViewGroup -import androidx.core.content.ContextCompat import androidx.recyclerview.widget.RecyclerView import com.gh.base.BaseRecyclerViewHolder -import com.gh.common.util.goneIf +import com.gh.common.util.toBinding import com.gh.common.util.visibleIf -import com.gh.gamecenter.R import com.gh.gamecenter.databinding.VideoLabelItemBinding import com.gh.gamecenter.entity.ActivityLabelEntity import com.lightgame.adapter.BaseRecyclerAdapter @@ -29,14 +27,15 @@ class VideoLabelAdapter( } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { - return VideoLabelViewHolder(VideoLabelItemBinding.bind(mLayoutInflater.inflate(R.layout.video_label_item, parent, false))) + return VideoLabelViewHolder(parent.toBinding()) } override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { if (holder is VideoLabelViewHolder) { val activityLabelEntity = entityList[position] - holder.binding.entity = activityLabelEntity + holder.binding.titleTv.text = activityLabelEntity.name + holder.binding.contentTv.text = activityLabelEntity.desc holder.binding.selectedIv.visibleIf(selectPosition == position) holder.itemView.setOnClickListener { val lastPos: Int diff --git a/app/src/main/java/com/gh/gamecenter/video/videomanager/VideoDraftAdapter.kt b/app/src/main/java/com/gh/gamecenter/video/videomanager/VideoDraftAdapter.kt index ea4b2a2304..416535cfc0 100644 --- a/app/src/main/java/com/gh/gamecenter/video/videomanager/VideoDraftAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/video/videomanager/VideoDraftAdapter.kt @@ -18,10 +18,12 @@ import com.gh.gamecenter.baselist.ListAdapter import com.gh.gamecenter.databinding.CommunityVideoDraftItemBinding import com.gh.gamecenter.entity.VideoDraftEntity -class VideoDraftAdapter(context: Context, - private val mViewModel: VideoDraftViewModel, - private val mEntrance: String, - private val selectCallback: (VideoDraftEntity) -> Unit) : ListAdapter(context) { +class VideoDraftAdapter( + context: Context, + private val mViewModel: VideoDraftViewModel, + private val mEntrance: String, + private val selectCallback: (VideoDraftEntity) -> Unit +) : ListAdapter(context) { private val mPath = "草稿箱" @@ -53,7 +55,7 @@ class VideoDraftAdapter(context: Context, override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { if (holder is VideoDraftViewHolder) { val draftEntity = mEntityList[position] - holder.binding.data = draftEntity + holder.binding.articleDraftTitle.text = draftEntity.title.ifEmpty { "(缺少标题)" } if (draftEntity.bbsId.isNotEmpty() && draftEntity.game != null) { holder.binding.articleDraftCommunityName.apply { text = draftEntity.game?.name @@ -74,20 +76,22 @@ class VideoDraftAdapter(context: Context, holder.itemView.setOnClickListener { PermissionHelper.checkStoragePermissionBeforeAction(mContext, - object : EmptyCallback { - override fun onCallback() { - selectCallback.invoke(draftEntity) - } - }) + object : EmptyCallback { + override fun onCallback() { + selectCallback.invoke(draftEntity) + } + }) } holder.binding.articleDraftDelete.setOnClickListener { - DialogHelper.showDialog(mContext, "删除草稿", - "确定要删除视频草稿吗?删除之后不可恢复", - "确定删除", "暂时不了", - { - mViewModel.deleteDraft(draftEntity.id) - LogUtils.logVideoStreamingUpload("点击删除按钮", mPath, "", "") - }, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)) + DialogHelper.showDialog( + mContext, "删除草稿", + "确定要删除视频草稿吗?删除之后不可恢复", + "确定删除", "暂时不了", + { + mViewModel.deleteDraft(draftEntity.id) + LogUtils.logVideoStreamingUpload("点击删除按钮", mPath, "", "") + }, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true) + ) } } else if (holder is FooterViewHolder) { holder.initFooterViewHolder(mViewModel, mIsLoading, mIsNetworkError, mIsOver) @@ -98,9 +102,9 @@ class VideoDraftAdapter(context: Context, val inflater = LayoutInflater.from(view.context) val layout = inflater.inflate(R.layout.layout_popup_container, null) val popupWindow = BugFixedPopupWindow( - layout, - LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.WRAP_CONTENT + layout, + LinearLayout.LayoutParams.WRAP_CONTENT, + LinearLayout.LayoutParams.WRAP_CONTENT ) val container = layout.findViewById(R.id.container) val item = inflater.inflate(R.layout.layout_popup_option_item, container, false) @@ -110,13 +114,15 @@ class VideoDraftAdapter(context: Context, hitText.text = "删除" item.setOnClickListener { - DialogHelper.showDialog(mContext, "删除草稿", - "确定要删除视频草稿吗?删除之后不可恢复", - "确定删除", "暂时不了", - { - mViewModel.deleteDraft(entity.id) - LogUtils.logVideoStreamingUpload("点击删除按钮", mPath, "", "") - }, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)) + DialogHelper.showDialog( + mContext, "删除草稿", + "确定要删除视频草稿吗?删除之后不可恢复", + "确定删除", "暂时不了", + { + mViewModel.deleteDraft(entity.id) + LogUtils.logVideoStreamingUpload("点击删除按钮", mPath, "", "") + }, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true) + ) popupWindow.dismiss() } diff --git a/app/src/main/java/com/halo/assistant/fragment/game/GamePluginAdapter.java b/app/src/main/java/com/halo/assistant/fragment/game/GamePluginAdapter.java index f73a5c864e..c891b9109c 100644 --- a/app/src/main/java/com/halo/assistant/fragment/game/GamePluginAdapter.java +++ b/app/src/main/java/com/halo/assistant/fragment/game/GamePluginAdapter.java @@ -9,10 +9,12 @@ import android.widget.LinearLayout; import androidx.recyclerview.widget.RecyclerView; import com.gh.common.constant.ItemViewType; +import com.gh.common.databind.BindingAdapters; import com.gh.common.util.DataCollectionUtils; import com.gh.common.util.DialogUtils; import com.gh.common.util.DisplayUtils; import com.gh.common.util.DownloadItemUtils; +import com.gh.common.util.ExtensionsKt; import com.gh.common.util.HomePluggableHelper; import com.gh.common.util.MtaHelper; import com.gh.common.util.PlatformUtils; @@ -103,8 +105,16 @@ public class GamePluginAdapter extends BaseRecyclerAdapter { final GameEntity gameEntity = mPluginList.get(position); holder.initServerType(gameEntity); GamePluggableItemBinding binding = holder.getBinding(); - binding.gameItemIncluded.setGame(gameEntity); - binding.gameItemIncluded.setIsShowPlatform(true); + binding.gameItemIncluded.gameIconView.displayGameIcon(gameEntity); + BindingAdapters.setGameName(binding.gameItemIncluded.gameName, gameEntity, true, null); + BindingAdapters.setTextSize(binding.gameItemIncluded.gameRating, gameEntity.getCommentCount() > 3 ? 12 : 10); + BindingAdapters.setGameTags(binding.gameItemIncluded.labelList, gameEntity); + binding.gameItemIncluded.gameRating.setCompoundDrawables(gameEntity.getCommentCount() > 3 ? ExtensionsKt.toDrawable(R.drawable.game_horizontal_rating) : null, null, null, null); + binding.gameItemIncluded.gameRating.setPadding(0, 0, gameEntity.getCommentCount() > 3 ? DisplayUtils.dip2px(8) : 0, 0); + binding.gameItemIncluded.gameRating.setText(gameEntity.getCommentCount() > 3 ? (gameEntity.getStar() == 10.0 ? "10" : String.valueOf(gameEntity.getStar())) : ""); + binding.gameItemIncluded.gameRating.setTextColor(gameEntity.getCommentCount() > 3 ? ExtensionsKt.toColor(R.color.theme_font) : ExtensionsKt.toColor(R.color.theme)); + binding.gameItemIncluded.gameDes.setText(gameEntity.getDecoratedDes()); + binding.gameItemIncluded.recommendStar.setRating(gameEntity.getRecommendStar()); holder.itemView.setOnClickListener(v -> { MtaHelper.onEvent("首页_新", "点击", "插件化" + (position + 1) + "_" + gameEntity.getName()); DataCollectionUtils.uploadClick(mContext, "插件化" + "-列表", "游戏-专题", gameEntity.getName()); diff --git a/app/src/main/res/drawable/bg_shape_black_alpha_30_radius_2.xml b/app/src/main/res/drawable/bg_shape_black_alpha_30_radius_2.xml new file mode 100644 index 0000000000..13c4bd3a32 --- /dev/null +++ b/app/src/main/res/drawable/bg_shape_black_alpha_30_radius_2.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_shape_black_alpha_40_radius_2.xml b/app/src/main/res/drawable/bg_shape_black_alpha_40_radius_2.xml new file mode 100644 index 0000000000..da35f81358 --- /dev/null +++ b/app/src/main/res/drawable/bg_shape_black_alpha_40_radius_2.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_shape_f9_radius_6.xml b/app/src/main/res/drawable/bg_shape_f9_radius_6.xml new file mode 100644 index 0000000000..77ddf8bf44 --- /dev/null +++ b/app/src/main/res/drawable/bg_shape_f9_radius_6.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_stroke_f5_radius_999.xml b/app/src/main/res/drawable/bg_stroke_f5_radius_999.xml new file mode 100644 index 0000000000..0bf2ada174 --- /dev/null +++ b/app/src/main/res/drawable/bg_stroke_f5_radius_999.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/download_recommend_des_bg.xml b/app/src/main/res/drawable/download_recommend_des_bg.xml new file mode 100644 index 0000000000..4266a072fe --- /dev/null +++ b/app/src/main/res/drawable/download_recommend_des_bg.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_ask_column_detail.xml b/app/src/main/res/layout/activity_ask_column_detail.xml deleted file mode 100644 index a270e5b9c8..0000000000 --- a/app/src/main/res/layout/activity_ask_column_detail.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/activity_background_clip.xml b/app/src/main/res/layout/activity_background_clip.xml index 53838c319b..2ce069b904 100644 --- a/app/src/main/res/layout/activity_background_clip.xml +++ b/app/src/main/res/layout/activity_background_clip.xml @@ -1,61 +1,59 @@ - + - + android:layout_height="match_parent"> - + + - - - - + android:layout_height="68dp" + android:background="@color/black_alpha_60" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" /> - + + + + + - - - - diff --git a/app/src/main/res/layout/activity_help_detail.xml b/app/src/main/res/layout/activity_help_detail.xml index 60f527c9b5..6a187473e8 100644 --- a/app/src/main/res/layout/activity_help_detail.xml +++ b/app/src/main/res/layout/activity_help_detail.xml @@ -1,51 +1,48 @@ - + - + + + android:layout_height="wrap_content"> - - - + android:layout_height="wrap_content" + android:orientation="vertical"> - + android:includeFontPadding="false" + android:lineSpacingExtra="4dp" + android:paddingLeft="20dp" + android:paddingTop="16dp" + android:paddingRight="20dp" + android:paddingBottom="16dp" + android:textColor="@color/text_title" + android:textSize="18sp" + android:textStyle="bold" /> - + - - - - - - + + + diff --git a/app/src/main/res/layout/activity_kaifu_add.xml b/app/src/main/res/layout/activity_kaifu_add.xml index a50f8cb9b4..20a6f708ef 100644 --- a/app/src/main/res/layout/activity_kaifu_add.xml +++ b/app/src/main/res/layout/activity_kaifu_add.xml @@ -1,77 +1,56 @@ + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - + - - - + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/kaifu_add_container" + android:layout_marginTop="20dp" + android:lineSpacingExtra="5dp" + android:text="@string/kaifu_add_hint" + android:textColor="@color/text_subtitle" + android:textSize="12sp" /> + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_kaifu_patch.xml b/app/src/main/res/layout/activity_kaifu_patch.xml index 18cb5a2e29..cf79a861e4 100644 --- a/app/src/main/res/layout/activity_kaifu_patch.xml +++ b/app/src/main/res/layout/activity_kaifu_patch.xml @@ -1,224 +1,211 @@ - + - + - - - - - + android:layout_height="0dp" + android:layout_marginTop="8dp" + android:layout_weight="1" + android:background="@android:color/white" + android:orientation="vertical" + android:padding="20dp"> - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:background="@color/title" + android:orientation="horizontal" + android:paddingLeft="1dp" + android:paddingTop="1dp" + android:paddingRight="1dp" + android:paddingBottom="1dp"> + android:maxLines="2" + android:textColor="@color/title" + android:textColorHint="@color/title" + android:textSize="11sp" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + diff --git a/app/src/main/res/layout/activity_poster_edit.xml b/app/src/main/res/layout/activity_poster_edit.xml index 0aad6d26a7..2bc88590c0 100644 --- a/app/src/main/res/layout/activity_poster_edit.xml +++ b/app/src/main/res/layout/activity_poster_edit.xml @@ -1,105 +1,102 @@ - + - + android:layout_height="wrap_content" + android:background="@color/text_28282E" + android:orientation="vertical" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent"> - + app:layout_constraintTop_toTopOf="parent" /> - - - - - - - - - - - + + + app:layout_constraintTop_toTopOf="@id/normal_toolbar" /> - - - - - - - - - + - \ No newline at end of file + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_questions_edit.xml b/app/src/main/res/layout/activity_questions_edit.xml index 3236579f15..e71f854aea 100644 --- a/app/src/main/res/layout/activity_questions_edit.xml +++ b/app/src/main/res/layout/activity_questions_edit.xml @@ -1,291 +1,280 @@ - - - - - - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@color/white" + android:focusable="true" + android:focusableInTouchMode="true" + android:orientation="vertical"> + + + + + + + + + + + + + - - - - - - - - - - - - - + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingLeft="16dp" + android:paddingRight="16dp"> + + + + + + + + + + android:background="@null" + android:completionThreshold="1" + android:dropDownVerticalOffset="1dp" + android:hint="写下你想问的问题" + android:lineSpacingExtra="8dp" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:popupBackground="@drawable/question_edit_popup_border" + android:textColor="@color/text_title" + android:textColorHint="@color/text_body" + android:textCursorDrawable="@drawable/cursor_color" + android:textSize="16sp" + android:textStyle="bold" /> - + + + + + + + + + + + + + + + + android:layout_height="44dp" + android:layout_above="@+id/editor_insert_container" + android:background="@color/white"> + + + + + + + - - - + android:text="0" + android:textColor="@color/text_body" + android:textSize="12sp" + app:layout_constraintBottom_toBottomOf="@+id/forum_container" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@+id/forum_container" + app:layout_constraintTop_toTopOf="@+id/forum_container" /> + - - - - - - + android:layout_alignParentBottom="true" /> + android:id="@+id/uploadVideoGuideContainer" + android:layout_width="264dp" + android:layout_height="60dp" + android:layout_marginLeft="8dp" + android:visibility="gone" + tools:visibility="visible"> - - - + android:src="@drawable/pic_upload_video_guide" /> + + + android:id="@+id/originalTipsContainer" + android:layout_width="268dp" + android:layout_height="64dp" + android:layout_alignParentRight="true" + android:layout_marginRight="8dp" + android:visibility="gone" + tools:visibility="visible"> - + android:src="@drawable/pic_original_pop" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_marginTop="12dp" + android:layout_marginRight="8dp" /> + - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_rating_edit.xml b/app/src/main/res/layout/activity_rating_edit.xml index d8ab46acc6..6e94bdfa8d 100644 --- a/app/src/main/res/layout/activity_rating_edit.xml +++ b/app/src/main/res/layout/activity_rating_edit.xml @@ -1,230 +1,220 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@android:color/white"> - + - - - - + android:layout_below="@+id/toolbar" + android:orientation="vertical"> - + + + + + + + + - + android:layout_height="8dp" + android:background="@color/background" /> - + + + android:text="快来发表您的精彩评分吧" + android:textColor="@color/text_title" + android:textSize="14sp" + android:textStyle="bold" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + android:text="点击阅读" + android:textColor="@color/hint" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:text="《光环助手评论规则》" + android:textColor="@color/theme_font" /> - - + android:layout_height="7dp" + android:background="@drawable/shadow" + android:visibility="gone" /> - - - - - - - - - - + + + + - - - diff --git a/app/src/main/res/layout/activity_servers_calendar.xml b/app/src/main/res/layout/activity_servers_calendar.xml index 09636f3b08..6a5c090e76 100644 --- a/app/src/main/res/layout/activity_servers_calendar.xml +++ b/app/src/main/res/layout/activity_servers_calendar.xml @@ -1,163 +1,160 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> - + + + android:layout_below="@id/normal_toolbar_container" + android:background="@color/white" + android:visibility="gone" + tools:visibility="visible"> - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:background="@color/background" + android:drawableLeft="@drawable/servers_calendar_hint" + android:drawablePadding="4dp" + android:paddingLeft="20dp" + android:paddingTop="12dp" + android:paddingRight="20dp" + android:paddingBottom="12dp" + android:text="开服信息仅供参考,具体请以游戏内开服为准" + android:textColor="@color/text_subtitleDesc" + android:textSize="12sp" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_video_game.xml b/app/src/main/res/layout/activity_video_game.xml index 3ad32f80a7..4f763c24f8 100644 --- a/app/src/main/res/layout/activity_video_game.xml +++ b/app/src/main/res/layout/activity_video_game.xml @@ -1,172 +1,170 @@ - + - + + + + + + + + + + - + android:gravity="center" + app:layout_behavior="com.gh.common.view.FixAppBarLayoutBehavior"> - - - - - - - - - - - + android:background="@drawable/game_video_head_background" + android:gravity="center_vertical" + android:orientation="horizontal" + android:paddingLeft="20dp" + android:paddingTop="8dp" + android:paddingRight="20dp" + android:paddingBottom="16dp" + app:layout_scrollFlags="scroll|enterAlwaysCollapsed"> - - - - - - - - - - - - - - - - - + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + - + - - + - + + + + + + + android:layout_height="40dp" + android:background="@android:color/white"> + + + + + + + + + + + + - - - diff --git a/app/src/main/res/layout/activity_video_uplaod.xml b/app/src/main/res/layout/activity_video_uplaod.xml index 0f587d5779..c87a4d21bb 100644 --- a/app/src/main/res/layout/activity_video_uplaod.xml +++ b/app/src/main/res/layout/activity_video_uplaod.xml @@ -1,567 +1,565 @@ - + - + + + android:layout_height="0dp" + android:layout_weight="1" + android:background="@android:color/white"> - - - + android:layout_height="wrap_content"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + android:id="@+id/activityFlexbox" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginRight="20dp" + android:paddingBottom="16dp" + android:visibility="gone" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="@+id/game_tag" + app:layout_constraintTop_toBottomOf="@+id/game_tag" + tools:visibility="visible"> + android:id="@+id/chooseActivityIv" + android:layout_width="wrap_content" + android:layout_height="28dp" + android:background="@drawable/bg_upload_video_choose_activity_enable" + android:paddingLeft="12dp" + android:paddingRight="12dp" + android:src="@drawable/ic_upload_video_activity_enable" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_weight="1" + android:drawableLeft="@drawable/ic_activity" + android:drawablePadding="4dp" + android:ellipsize="end" + android:gravity="center" + android:includeFontPadding="false" + android:maxLines="1" + android:textColor="@color/white" + android:textSize="12sp" + tools:text="光遇" /> - + android:src="@drawable/ic_activity_delete" /> + + - + - - - + - + + + + + + + + + + + + + + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - - - - - - - - + app:layout_constraintTop_toTopOf="@id/watermark_hint" /> - - - - - - - - - - - - - + app:layout_constraintTop_toTopOf="parent" /> - - - - - - - - - + android:layout_height="0dp" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="@id/watermark_sb" + app:layout_constraintLeft_toLeftOf="@id/watermark_sb" + app:layout_constraintRight_toRightOf="@id/watermark_sb" + app:layout_constraintTop_toTopOf="@id/watermark_sb" /> - - + - + + + android:id="@+id/update_protocol" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginLeft="4dp" + android:layout_marginBottom="2dp" + android:text="@string/upload_protocol" + android:textColor="@color/text_subtitleDesc" + android:textSize="13sp" + app:layout_constraintBottom_toBottomOf="@id/upload_confirm" + app:layout_constraintLeft_toRightOf="@id/upload_confirm" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="@id/upload_confirm" /> + + + + + + + + + + + + - - + + diff --git a/app/src/main/res/layout/amway_comment_item.xml b/app/src/main/res/layout/amway_comment_item.xml index 5646032e06..0b7de69f06 100644 --- a/app/src/main/res/layout/amway_comment_item.xml +++ b/app/src/main/res/layout/amway_comment_item.xml @@ -1,240 +1,222 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content"> - - - - - - - - + android:layout_height="wrap_content" + android:layout_marginLeft="20dp" + android:layout_marginRight="20dp" + app:cardCornerRadius="5dp" + app:cardElevation="0dp"> - + android:layout_height="wrap_content"> + android:layout_height="wrap_content" + android:background="@drawable/selector_f8f8f8" + android:paddingLeft="16dp" + android:paddingTop="16dp" + android:paddingRight="16dp" + android:paddingBottom="10dp" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent"> - + app:layout_constraintTop_toTopOf="parent" /> - - - - - - - - - - - - - + android:layout_marginLeft="12dp" + android:ellipsize="end" + android:maxLines="1" + android:textColor="@color/text_5D5D5D" + android:textSize="15sp" + android:textStyle="bold" + app:layout_constraintLeft_toRightOf="@id/gameIconView" + app:layout_constraintTop_toTopOf="@id/gameIconView" + tools:text="我的世界(像素村落)如果有很长的文字的话就截断处理" /> - + - + - - - - - - - - - - - - - - - - - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/app/src/main/res/layout/amway_search_item.xml b/app/src/main/res/layout/amway_search_item.xml index 1729177ac4..0671b0988e 100644 --- a/app/src/main/res/layout/amway_search_item.xml +++ b/app/src/main/res/layout/amway_search_item.xml @@ -1,61 +1,47 @@ - + - + - - + - + - + - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/answer_draft_item.xml b/app/src/main/res/layout/answer_draft_item.xml index 5de2986cb9..37397cfa3b 100644 --- a/app/src/main/res/layout/answer_draft_item.xml +++ b/app/src/main/res/layout/answer_draft_item.xml @@ -1,105 +1,88 @@ - + - + - + - - - - - + android:layout_marginTop="14dp" + app:layout_constraintTop_toBottomOf="@id/answer_draft_item_content" + app:viewAspectRatio="2.3" /> - + - + - - - - - - - - \ No newline at end of file + diff --git a/app/src/main/res/layout/article_detail_fourm_tag_item.xml b/app/src/main/res/layout/article_detail_fourm_tag_item.xml deleted file mode 100644 index c944cc99c0..0000000000 --- a/app/src/main/res/layout/article_detail_fourm_tag_item.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/ask_column_tag_item.xml b/app/src/main/res/layout/ask_column_tag_item.xml deleted file mode 100644 index d17f77596e..0000000000 --- a/app/src/main/res/layout/ask_column_tag_item.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/ask_recommends_concern_list_item.xml b/app/src/main/res/layout/ask_recommends_concern_list_item.xml index 7553ce014d..0519563084 100644 --- a/app/src/main/res/layout/ask_recommends_concern_list_item.xml +++ b/app/src/main/res/layout/ask_recommends_concern_list_item.xml @@ -1,73 +1,60 @@ - + - + - - + - + - + - + - + - - - - - - - - + diff --git a/app/src/main/res/layout/ask_recommends_item_concern.xml b/app/src/main/res/layout/ask_recommends_item_concern.xml index a1d1a17cdc..d2376ecde3 100644 --- a/app/src/main/res/layout/ask_recommends_item_concern.xml +++ b/app/src/main/res/layout/ask_recommends_item_concern.xml @@ -1,41 +1,39 @@ - + - + - + - + - + - - diff --git a/app/src/main/res/layout/ask_search_question_item.xml b/app/src/main/res/layout/ask_search_question_item.xml index 1c8df9297f..469f9f324e 100644 --- a/app/src/main/res/layout/ask_search_question_item.xml +++ b/app/src/main/res/layout/ask_search_question_item.xml @@ -1,50 +1,47 @@ - + - + + + android:layout_marginTop="1dp" + android:includeFontPadding="false" + android:lineSpacingExtra="6dp" + android:maxLines="2" + android:textColor="@color/black" + android:textSize="16sp" + android:textStyle="bold" + app:layout_constraintBottom_toTopOf="@id/questions_answer_count" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + - - - - - - \ No newline at end of file + diff --git a/app/src/main/res/layout/ask_subject_top_item.xml b/app/src/main/res/layout/ask_subject_top_item.xml deleted file mode 100644 index 69986f5341..0000000000 --- a/app/src/main/res/layout/ask_subject_top_item.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/avatar_background_item.xml b/app/src/main/res/layout/avatar_background_item.xml index 431e762c58..2d626e9477 100644 --- a/app/src/main/res/layout/avatar_background_item.xml +++ b/app/src/main/res/layout/avatar_background_item.xml @@ -1,58 +1,56 @@ - + - + - + - + - - - - - \ No newline at end of file + + diff --git a/app/src/main/res/layout/avatar_item.xml b/app/src/main/res/layout/avatar_item.xml index f78421def4..9bbf7903b6 100644 --- a/app/src/main/res/layout/avatar_item.xml +++ b/app/src/main/res/layout/avatar_item.xml @@ -1,90 +1,88 @@ - + - + - + + + android:maxLines="1" + android:textColor="@color/text_subtitle" + android:textSize="13sp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="@+id/imageSdv" + app:layout_constraintStart_toStartOf="@+id/imageSdv" + app:layout_constraintTop_toBottomOf="@+id/imageSdv" /> - - - - - - - - - - + android:layout_marginTop="4dp" + android:gravity="center" + android:maxLines="1" + android:textColor="@color/text_subtitleDesc" + android:textSize="13sp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="@+id/imageSdv" + app:layout_constraintStart_toStartOf="@+id/imageSdv" + app:layout_constraintTop_toBottomOf="@+id/nameTv" /> + - - - \ No newline at end of file + + + + + + diff --git a/app/src/main/res/layout/catalog_header_item.xml b/app/src/main/res/layout/catalog_header_item.xml index 3ffd7b7146..cd2b2201ff 100644 --- a/app/src/main/res/layout/catalog_header_item.xml +++ b/app/src/main/res/layout/catalog_header_item.xml @@ -1,53 +1,41 @@ - + - - - - - - - - + android:gravity="center_vertical" + android:orientation="horizontal" + android:paddingLeft="@dimen/home_item_padding" + android:paddingRight="@dimen/home_item_padding"> - + android:includeFontPadding="false" + android:textColor="@color/text_title" + android:textSize="14sp" + android:textStyle="bold" + tools:text="人气手游风向标" /> - + - - - - \ No newline at end of file + diff --git a/app/src/main/res/layout/catalog_image_item.xml b/app/src/main/res/layout/catalog_image_item.xml index 30475929ce..18b2c5a6ec 100644 --- a/app/src/main/res/layout/catalog_image_item.xml +++ b/app/src/main/res/layout/catalog_image_item.xml @@ -1,39 +1,31 @@ - - - - - + + + android:layout_height="140dp" + android:layout_marginLeft="16dp" + android:layout_marginTop="16dp" + android:layout_marginRight="16dp" + app:fadeDuration="500" + app:placeholderImage="@drawable/occupy" + app:placeholderImageScaleType="fitXY" + app:roundedCornerRadius="8dp" /> - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/catalog_item.xml b/app/src/main/res/layout/catalog_item.xml index 11bad46e5b..5e832bdcf6 100644 --- a/app/src/main/res/layout/catalog_item.xml +++ b/app/src/main/res/layout/catalog_item.xml @@ -1,46 +1,34 @@ - + - - - + - + - - - - - - - \ No newline at end of file + + diff --git a/app/src/main/res/layout/catalog_subject_collection_item.xml b/app/src/main/res/layout/catalog_subject_collection_item.xml index 2cfeff5c6e..1563b1c14d 100644 --- a/app/src/main/res/layout/catalog_subject_collection_item.xml +++ b/app/src/main/res/layout/catalog_subject_collection_item.xml @@ -1,10 +1,6 @@ - - - - - + \ No newline at end of file diff --git a/app/src/main/res/layout/catalog_subject_game_item.xml b/app/src/main/res/layout/catalog_subject_game_item.xml index 241a634979..4402d4f9c1 100644 --- a/app/src/main/res/layout/catalog_subject_game_item.xml +++ b/app/src/main/res/layout/catalog_subject_game_item.xml @@ -1,43 +1,30 @@ - + - + - - - - - - - - - - \ No newline at end of file + android:layout_marginLeft="8dp" + android:layout_marginTop="8dp" + android:layout_marginRight="8dp" + android:ellipsize="end" + android:gravity="center" + android:includeFontPadding="false" + android:lineSpacingExtra="4dp" + android:marqueeRepeatLimit="marquee_forever" + android:maxLines="2" + android:textColor="@color/text_title" + android:textSize="12sp" + tools:text="超杀默示录" /> + diff --git a/app/src/main/res/layout/category_game_item.xml b/app/src/main/res/layout/category_game_item.xml index 0725e96a33..41e6a4a305 100644 --- a/app/src/main/res/layout/category_game_item.xml +++ b/app/src/main/res/layout/category_game_item.xml @@ -1,313 +1,274 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@drawable/reuse_listview_item_style" + android:gravity="center_vertical" + android:orientation="horizontal" + android:padding="@dimen/home_item_padding"> - + - + - + - + - + - - - - - - + + app:layout_constraintBottom_toTopOf="@+id/label_list" + app:layout_constraintLeft_toRightOf="@+id/gameIconView" + app:layout_constraintRight_toLeftOf="@+id/download_btn" + app:layout_constraintTop_toBottomOf="@+id/game_name"> - - - - - - + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toLeftOf="@+id/game_des" + app:layout_constraintTop_toTopOf="parent" /> - - - - + android:layout_marginTop="5dp" + android:layout_toRightOf="@id/game_rating" + android:ellipsize="end" + android:includeFontPadding="false" + android:singleLine="true" + android:textColor="@color/text_subtitleDesc" + android:textSize="10sp" + app:layout_constraintLeft_toRightOf="@+id/game_rating" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:text="巫妖王再怒霜之哀殤又飢渴" /> + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + app:layout_goneMarginStart="4dp" + tools:text="最新活动火爆来袭" /> - - - - + + + + + diff --git a/app/src/main/res/layout/category_v2_item.xml b/app/src/main/res/layout/category_v2_item.xml index 76c256dda7..a623b56c00 100644 --- a/app/src/main/res/layout/category_v2_item.xml +++ b/app/src/main/res/layout/category_v2_item.xml @@ -1,46 +1,34 @@ - + - - - + - + - - - - - - - \ No newline at end of file + + diff --git a/app/src/main/res/layout/collection_comunity_article_item.xml b/app/src/main/res/layout/collection_comunity_article_item.xml index 27272238cf..7559b46555 100644 --- a/app/src/main/res/layout/collection_comunity_article_item.xml +++ b/app/src/main/res/layout/collection_comunity_article_item.xml @@ -1,193 +1,170 @@ - + xmlns:fresco="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@drawable/reuse_listview_item_style" + android:paddingLeft="16dp" + android:paddingTop="13dp" + android:paddingRight="16dp" + android:paddingBottom="16dp"> - - - - - - - - + android:ellipsize="end" + android:maxLines="2" + android:textColor="@color/text_title" + android:textSize="14sp" + app:layout_constraintTop_toTopOf="parent" /> - + - - - - - - - - - - - + - - - - - - - - + app:roundingBorderColor="@color/black_alpha_10" + app:roundingBorderWidth="0.5dp" + fresco:roundAsCircle="true" /> - + - + - - + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/commodity_item.xml b/app/src/main/res/layout/commodity_item.xml index 71996cb3cf..679007dcae 100644 --- a/app/src/main/res/layout/commodity_item.xml +++ b/app/src/main/res/layout/commodity_item.xml @@ -1,175 +1,163 @@ - - - - - + - + + + + + + + + android:ellipsize="end" + android:includeFontPadding="false" + android:lineSpacingExtra="6dp" + android:maxLines="2" + android:paddingLeft="8dp" + android:paddingRight="8dp" + android:textColor="@color/text_title" + android:textSize="13sp" + android:textStyle="bold" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toBottomOf="@+id/coverImage" + tools:text="犬夜叉经典阿离同款抱枕卡通动漫人物犬夜叉经典阿离同款抱枕卡通动漫人物" /> - + - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + android:textColor="#FFA142" + android:textSize="10sp" + tools:text="23:59:58 后开抢" /> + + + \ No newline at end of file diff --git a/app/src/main/res/layout/common_collection_detail_one_item.xml b/app/src/main/res/layout/common_collection_detail_one_item.xml index aeadd5aa60..4fbc2b97a3 100644 --- a/app/src/main/res/layout/common_collection_detail_one_item.xml +++ b/app/src/main/res/layout/common_collection_detail_one_item.xml @@ -1,71 +1,57 @@ - + - + - - - - - - + android:layout_height="40dp" + android:background="@drawable/common_collection_item_title_bg" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" /> - + - - - - - - - - \ No newline at end of file + android:ellipsize="end" + android:maxLines="1" + android:textColor="@color/white" + android:textSize="14sp" + tools:text="8月游戏热点回顾下载" /> + + \ No newline at end of file diff --git a/app/src/main/res/layout/common_collection_detail_two_item.xml b/app/src/main/res/layout/common_collection_detail_two_item.xml index bfb65931ea..92b27ffbce 100644 --- a/app/src/main/res/layout/common_collection_detail_two_item.xml +++ b/app/src/main/res/layout/common_collection_detail_two_item.xml @@ -1,83 +1,68 @@ - + - + - - - - - - + android:layout_height="64dp" + android:background="@drawable/common_collection_item_title_bg" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" /> - + - - - + android:ellipsize="end" + android:maxLines="1" + android:textColor="@color/white" + android:textSize="14sp" + tools:text="8月游戏热点回顾下载" /> - - - - - - \ No newline at end of file + + + \ No newline at end of file diff --git a/app/src/main/res/layout/common_collection_image_text_item.xml b/app/src/main/res/layout/common_collection_image_text_item.xml index 020c06e378..8bd9cf2d33 100644 --- a/app/src/main/res/layout/common_collection_image_text_item.xml +++ b/app/src/main/res/layout/common_collection_image_text_item.xml @@ -1,81 +1,67 @@ - + - + - - + - + - - - - - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/common_collection_item.xml b/app/src/main/res/layout/common_collection_item.xml index 9168bd2509..9c697f91ef 100644 --- a/app/src/main/res/layout/common_collection_item.xml +++ b/app/src/main/res/layout/common_collection_item.xml @@ -1,137 +1,109 @@ - + - - - - - - - - - - + + + + + + + + + + + + + + + android:layout_marginTop="8dp" + android:ellipsize="end" + android:maxLines="1" + android:textColor="@color/black" + android:textSize="14sp" + android:visibility="gone" /> - + - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/community_answer_item.xml b/app/src/main/res/layout/community_answer_item.xml index 0494f4584e..b041e9996b 100644 --- a/app/src/main/res/layout/community_answer_item.xml +++ b/app/src/main/res/layout/community_answer_item.xml @@ -1,436 +1,402 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@color/white" + android:orientation="horizontal"> - + - - - - - - - - - - + android:background="@color/white"> + android:paddingLeft="11dp" + android:paddingRight="20dp" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + android:layout_marginLeft="8dp" + android:layout_marginTop="16dp" + android:paddingLeft="12dp" + android:paddingTop="8dp" + android:paddingRight="12dp" + android:paddingBottom="12dp" + android:visibility="gone" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/image_container" + tools:visibility="visible"> + android:id="@+id/popularAnswerUserIcon" + style="@style/frescoCircleStyle" + android:layout_width="20dp" + android:layout_height="20dp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:roundingBorderColor="@color/black_alpha_10" + app:roundingBorderWidth="0.5dp" /> + android:layout_marginLeft="8dp" + android:includeFontPadding="false" + android:textColor="@color/theme_font" + android:textSize="12sp" + app:layout_constraintBottom_toBottomOf="@+id/popularAnswerUserIcon" + app:layout_constraintStart_toEndOf="@+id/popularAnswerUserIcon" + app:layout_constraintTop_toTopOf="@+id/popularAnswerUserIcon" + tools:text="原神大佬" /> + app:layout_constraintBottom_toBottomOf="@+id/popularAnswerUserName" + app:layout_constraintStart_toEndOf="@+id/popularAnswerUserName" + app:layout_constraintTop_toTopOf="@+id/popularAnswerUserName" /> + + + + + + + + + + android:layout_height="24dp" + android:layout_marginLeft="20dp" + android:background="@drawable/bg_shape_f5_radius_999" + android:gravity="center_vertical" + android:orientation="horizontal"> + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:textSize="11sp" + tools:text="地下城与勇士" /> - - - - - - - - - - - - - - - - - + - - - - - + + + + + diff --git a/app/src/main/res/layout/community_article_draft_item.xml b/app/src/main/res/layout/community_article_draft_item.xml index c794fd9516..4e495dc4db 100644 --- a/app/src/main/res/layout/community_article_draft_item.xml +++ b/app/src/main/res/layout/community_article_draft_item.xml @@ -1,76 +1,62 @@ - + - - - - - - - - + android:ellipsize="end" + android:lineSpacingExtra="6dp" + android:maxLines="2" + android:textColor="@color/text_title" + android:textSize="16sp" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + - + - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/community_follow_item.xml b/app/src/main/res/layout/community_follow_item.xml deleted file mode 100644 index f4004f63a9..0000000000 --- a/app/src/main/res/layout/community_follow_item.xml +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/community_my_answer_item.xml b/app/src/main/res/layout/community_my_answer_item.xml index 90c91bfd74..7c2a277b95 100644 --- a/app/src/main/res/layout/community_my_answer_item.xml +++ b/app/src/main/res/layout/community_my_answer_item.xml @@ -1,162 +1,148 @@ - + - - - - - - - - + android:ellipsize="end" + android:lineSpacingExtra="6dp" + android:maxLines="2" + android:textColor="@color/text_title" + android:textSize="16sp" + android:textStyle="bold" + android:visibility="visible" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + - + - + - + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toLeftOf="@id/vote_count_container" + app:layout_constraintTop_toTopOf="parent"> - - - - - - - + android:minEms="3" + android:paddingTop="20dp" + android:paddingBottom="20dp" + android:textColor="@color/text_subtitleDesc" + android:textSize="12sp" + tools:text="16" /> - + - + - + - - - + android:layout_centerInParent="true" + android:src="@drawable/community_vote_selector" /> - - + - + + + + - + + + + diff --git a/app/src/main/res/layout/community_question_draft_item.xml b/app/src/main/res/layout/community_question_draft_item.xml index b3fac2db35..082266f702 100644 --- a/app/src/main/res/layout/community_question_draft_item.xml +++ b/app/src/main/res/layout/community_question_draft_item.xml @@ -1,77 +1,63 @@ - + - - - - - - - - + android:ellipsize="end" + android:lineSpacingExtra="6dp" + android:maxLines="2" + android:textColor="@color/text_title" + android:textSize="16sp" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + - - - + - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/community_question_item.xml b/app/src/main/res/layout/community_question_item.xml index c306bad7ce..109d3906ec 100644 --- a/app/src/main/res/layout/community_question_item.xml +++ b/app/src/main/res/layout/community_question_item.xml @@ -1,80 +1,78 @@ - + - + android:layout_marginLeft="20dp" + android:layout_marginTop="16dp" + android:layout_marginRight="20dp" + android:ellipsize="end" + android:includeFontPadding="false" + android:lineSpacingExtra="6dp" + android:maxLines="2" + android:textColor="@color/text_title" + android:textSize="16sp" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:text="其实我想躲於你附近,其实我想赌赌我命运,然后你承认我我是谁的候任" /> + + + + - - + android:minEms="2" + android:paddingTop="20dp" + android:paddingBottom="20dp" + android:textColor="@color/text_subtitleDesc" + android:textSize="12sp" + tools:text="16" /> - + - - - - - - + \ No newline at end of file diff --git a/app/src/main/res/layout/community_search_columm_item.xml b/app/src/main/res/layout/community_search_columm_item.xml index a1187e935b..9aa7c2e7fd 100644 --- a/app/src/main/res/layout/community_search_columm_item.xml +++ b/app/src/main/res/layout/community_search_columm_item.xml @@ -1,101 +1,87 @@ - + - - - - - - - + android:drawableLeft="@drawable/search_column_icon" + android:drawablePadding="6dp" + android:gravity="center_vertical" + android:includeFontPadding="false" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:text="专题" + android:textColor="@color/text_title" + android:textSize="16sp" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + - - - + - + - + - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/community_search_history_item.xml b/app/src/main/res/layout/community_search_history_item.xml deleted file mode 100644 index 6574d14dc9..0000000000 --- a/app/src/main/res/layout/community_search_history_item.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/community_search_hot_item.xml b/app/src/main/res/layout/community_search_hot_item.xml deleted file mode 100644 index 34a7a2421b..0000000000 --- a/app/src/main/res/layout/community_search_hot_item.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/community_search_special_columm_item.xml b/app/src/main/res/layout/community_search_special_columm_item.xml index 0ee956f824..f11eeef598 100644 --- a/app/src/main/res/layout/community_search_special_columm_item.xml +++ b/app/src/main/res/layout/community_search_special_columm_item.xml @@ -1,97 +1,83 @@ - + - - - - - - - + android:drawableLeft="@drawable/search_special_column_icon" + android:drawablePadding="6dp" + android:gravity="center_vertical" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:text="专栏" + android:textColor="@color/text_3a3a3a" + android:textSize="14sp" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - - - + - + - + - + - - + diff --git a/app/src/main/res/layout/community_select_opened_head_item.xml b/app/src/main/res/layout/community_select_opened_head_item.xml index 7213fd6271..e0c1de271b 100644 --- a/app/src/main/res/layout/community_select_opened_head_item.xml +++ b/app/src/main/res/layout/community_select_opened_head_item.xml @@ -1,36 +1,26 @@ - + - - - - - - + android:layout_marginTop="8dp" + android:background="@color/white" + android:gravity="center_vertical" + android:includeFontPadding="false" + android:orientation="horizontal" + android:paddingLeft="20dp" + android:paddingTop="16dp" + android:paddingBottom="4dp" + android:text="@{categoryName}" + android:textColor="@color/text_subtitle" + android:textSize="14sp" + android:textStyle="bold" + tools:text="我的游戏" /> - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/community_select_opened_item.xml b/app/src/main/res/layout/community_select_opened_item.xml index edac6d5045..ea94a5eea8 100644 --- a/app/src/main/res/layout/community_select_opened_item.xml +++ b/app/src/main/res/layout/community_select_opened_item.xml @@ -1,136 +1,111 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@android:color/white" + android:orientation="horizontal" + android:paddingTop="12dp" + android:paddingBottom="12dp"> - + - + - - - - - - - - - - + android:layout_height="wrap_content" + android:layout_marginLeft="15dp" + android:layout_marginRight="10dp" + android:ellipsize="end" + android:lineSpacingExtra="6dp" + android:maxLines="2" + android:textColor="@color/text_title" + android:textSize="13sp" + android:textStyle="bold" + app:layout_constraintBottom_toTopOf="@+id/community_status_left" + app:layout_constraintLeft_toRightOf="@id/game_icon_left" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="@id/game_icon_left" + tools:text="UC浏览器(无广告" /> - + - + - + - + - + android:layout_height="wrap_content" + android:layout_marginLeft="15dp" + android:layout_marginRight="15dp" + android:ellipsize="end" + android:includeFontPadding="false" + android:lineSpacingExtra="6dp" + android:maxLines="2" + android:textColor="@color/text_title" + android:textSize="13sp" + android:textStyle="bold" + app:layout_constraintBottom_toTopOf="@+id/community_status_right" + app:layout_constraintLeft_toRightOf="@id/game_icon_right" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="@id/game_icon_right" + tools:text="UC浏览器(无广告" /> - + - - - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/community_video_draft_item.xml b/app/src/main/res/layout/community_video_draft_item.xml index 2b31249c56..957cab7415 100644 --- a/app/src/main/res/layout/community_video_draft_item.xml +++ b/app/src/main/res/layout/community_video_draft_item.xml @@ -1,76 +1,62 @@ - + - - - - - - - - + android:ellipsize="end" + android:lineSpacingExtra="6dp" + android:maxLines="2" + android:textColor="@color/text_title" + android:textSize="16sp" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + - + - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/daily_task_item.xml b/app/src/main/res/layout/daily_task_item.xml index d754524820..01feafcf4d 100644 --- a/app/src/main/res/layout/daily_task_item.xml +++ b/app/src/main/res/layout/daily_task_item.xml @@ -1,97 +1,84 @@ - + - - - - - + android:layout_height="56dp" + android:layout_marginLeft="8dp" + android:layout_marginTop="12dp" + android:layout_marginRight="8dp" + android:background="@drawable/background_shape_white_radius_5"> - + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + - + - + - - - - - - \ No newline at end of file + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_download.xml b/app/src/main/res/layout/dialog_download.xml index ef36c7f272..a50518009f 100644 --- a/app/src/main/res/layout/dialog_download.xml +++ b/app/src/main/res/layout/dialog_download.xml @@ -1,137 +1,134 @@ - + android:layout_width="match_parent" + android:layout_height="match_parent"> - + android:layout_height="400dp" + android:layout_gravity="bottom" + android:background="@drawable/download_dialog_background" + android:descendantFocusability="blocksDescendants"> - + + + android:layout_height="64dp" + android:clickable="false" + app:layout_constraintTop_toTopOf="parent" /> - + - + - + - - - - - - - - - - - - - - - - + + android:paddingRight="12dp" /> - - - + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/dialog_download_link.xml b/app/src/main/res/layout/dialog_download_link.xml index cefbac0503..df08d6816c 100644 --- a/app/src/main/res/layout/dialog_download_link.xml +++ b/app/src/main/res/layout/dialog_download_link.xml @@ -1,53 +1,50 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@drawable/download_link_dialog_background" + android:orientation="vertical" + android:padding="24dp" + app:maxHeight="400dp" + tools:ignore="WebViewLayout"> - + android:textColor="@color/text_title" + android:textSize="16sp" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + - + - - - - + diff --git a/app/src/main/res/layout/dialog_oversea_confirmation.xml b/app/src/main/res/layout/dialog_oversea_confirmation.xml index 40f974f91e..6eb37f40d2 100644 --- a/app/src/main/res/layout/dialog_oversea_confirmation.xml +++ b/app/src/main/res/layout/dialog_oversea_confirmation.xml @@ -1,93 +1,82 @@ - + - + - - + - - - - - - - - - - - - - - - - + android:layout_gravity="center" + android:layout_marginTop="14dp" + android:includeFontPadding="false" + android:textColor="@color/text_title" + android:textSize="13sp" + android:textStyle="bold" + tools:text="光环助手" /> - - \ No newline at end of file + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_reserve.xml b/app/src/main/res/layout/dialog_reserve.xml index 51b5957c79..fcaad15230 100644 --- a/app/src/main/res/layout/dialog_reserve.xml +++ b/app/src/main/res/layout/dialog_reserve.xml @@ -1,43 +1,40 @@ - + - + android:src="@drawable/dialog_reserve_head_background" /> - + - + - + - - - - \ No newline at end of file + diff --git a/app/src/main/res/layout/dialog_reserve_item.xml b/app/src/main/res/layout/dialog_reserve_item.xml index e82e1525cc..5613bb9025 100644 --- a/app/src/main/res/layout/dialog_reserve_item.xml +++ b/app/src/main/res/layout/dialog_reserve_item.xml @@ -1,43 +1,32 @@ - + xmlns:fresco="http://schemas.android.com/tools" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:orientation="vertical" + android:paddingLeft="8dp" + android:paddingRight="8dp"> - + - - - - - - - - - - \ No newline at end of file + android:singleLine="true" + android:textColor="@color/text_title" + android:textSize="12sp" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toBottomOf="@id/icon" /> + diff --git a/app/src/main/res/layout/dialog_servers_calendear_detail_item.xml b/app/src/main/res/layout/dialog_servers_calendear_detail_item.xml index 27809221aa..1eb21edd35 100644 --- a/app/src/main/res/layout/dialog_servers_calendear_detail_item.xml +++ b/app/src/main/res/layout/dialog_servers_calendear_detail_item.xml @@ -1,55 +1,52 @@ - + - + android:layout_weight="1" + android:paddingLeft="24dp" + android:text="时间" + android:textColor="@color/text_subtitleDesc" + android:textSize="12sp" /> - + - + - + - - - - + diff --git a/app/src/main/res/layout/dialog_upload_schedule.xml b/app/src/main/res/layout/dialog_upload_schedule.xml index 6200f2c085..19a64b8ae5 100644 --- a/app/src/main/res/layout/dialog_upload_schedule.xml +++ b/app/src/main/res/layout/dialog_upload_schedule.xml @@ -1,96 +1,88 @@ - + - - - - + + + + + + + android:layout_marginTop="32dp" + android:layout_marginBottom="24dp" + android:gravity="center" + android:orientation="horizontal"> - + android:textSize="14sp" /> - + - - - - - + + - - \ No newline at end of file + diff --git a/app/src/main/res/layout/download_dialog_installed_item.xml b/app/src/main/res/layout/download_dialog_installed_item.xml index cb302013a3..81a02c266e 100644 --- a/app/src/main/res/layout/download_dialog_installed_item.xml +++ b/app/src/main/res/layout/download_dialog_installed_item.xml @@ -1,219 +1,200 @@ - + - - - - - - - - + + + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent" + fresco:placeholderImage="@drawable/download_dialog_game_icon_placeholder" + fresco:placeholderImageScaleType="fitXY" + fresco:roundedCornerRadius="4dp" + fresco:roundingBorderColor="@color/black_alpha_10" + fresco:roundingBorderWidth="0.5dp" /> - + - + + + + + + + - - - - - - + android:layout_marginRight="12dp" + android:drawableLeft="@drawable/download_dialog_status_launch" + android:drawablePadding="4dp" + android:textColor="@color/theme" + android:textSize="12sp" + android:visibility="gone" /> - + - + - + - + - + - + - + - + + - - - - - diff --git a/app/src/main/res/layout/download_dialog_instruction_item.xml b/app/src/main/res/layout/download_dialog_instruction_item.xml index fdd16de6b0..76315e9b6f 100644 --- a/app/src/main/res/layout/download_dialog_instruction_item.xml +++ b/app/src/main/res/layout/download_dialog_instruction_item.xml @@ -1,25 +1,23 @@ - + - + android:scrollbars="none" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - - - - + diff --git a/app/src/main/res/layout/download_dialog_item.xml b/app/src/main/res/layout/download_dialog_item.xml index cb33f6c4bd..f15a25378c 100644 --- a/app/src/main/res/layout/download_dialog_item.xml +++ b/app/src/main/res/layout/download_dialog_item.xml @@ -1,203 +1,182 @@ - - + - - - - - - + android:background="@drawable/download_dialog_item_background" + android:orientation="vertical"> - + + + + + android:layout_marginLeft="8dp" + android:includeFontPadding="false" + android:singleLine="true" + android:textColor="@color/text_title" + android:textSize="12sp" + app:layout_constraintBottom_toTopOf="@id/remark" + app:layout_constraintLeft_toRightOf="@id/icon" + app:layout_constraintRight_toLeftOf="@id/download_status_icon" + app:layout_constraintTop_toTopOf="@id/icon" + app:layout_constraintVertical_chainStyle="packed" + tools:text="九游版" /> + - - - - - - - - - - - - - - - - - - - - - - + android:layout_height="wrap_content" + android:layout_marginLeft="8dp" + android:layout_marginTop="2dp" + android:drawablePadding="2dp" + android:includeFontPadding="false" + android:singleLine="true" + android:textColor="@color/theme_font" + android:textSize="10sp" + app:layout_constraintBottom_toBottomOf="@id/icon" + app:layout_constraintLeft_toRightOf="@id/icon" + app:layout_constraintTop_toBottomOf="@id/remark" + tools:text="点击启动" /> - + + + + + + android:textSize="14sp" /> + + + + + + + + + + + + + - - - - diff --git a/app/src/main/res/layout/download_dialog_link_item.xml b/app/src/main/res/layout/download_dialog_link_item.xml index c9b1aac529..0c07809f3d 100644 --- a/app/src/main/res/layout/download_dialog_link_item.xml +++ b/app/src/main/res/layout/download_dialog_link_item.xml @@ -1,71 +1,41 @@ - + - + - + - - - - - - - - - - - - - - - + diff --git a/app/src/main/res/layout/download_dialog_platform_request_item.xml b/app/src/main/res/layout/download_dialog_platform_request_item.xml index fc41363334..3ebdf93579 100644 --- a/app/src/main/res/layout/download_dialog_platform_request_item.xml +++ b/app/src/main/res/layout/download_dialog_platform_request_item.xml @@ -1,29 +1,27 @@ - + - + android:gravity="center" + android:paddingTop="12dp" + android:paddingBottom="12dp" + android:text="没有我的版本?求版本 >" + android:textColor="@color/theme_font" + android:textSize="12sp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + - - diff --git a/app/src/main/res/layout/download_dialog_section_item.xml b/app/src/main/res/layout/download_dialog_section_item.xml index 53e3bc4f81..5452952761 100644 --- a/app/src/main/res/layout/download_dialog_section_item.xml +++ b/app/src/main/res/layout/download_dialog_section_item.xml @@ -1,49 +1,35 @@ - + - + - + - - - - - - - - - - - + diff --git a/app/src/main/res/layout/editor_insert_container.xml b/app/src/main/res/layout/editor_insert_container.xml index f6bddb7b82..6f0da6899e 100644 --- a/app/src/main/res/layout/editor_insert_container.xml +++ b/app/src/main/res/layout/editor_insert_container.xml @@ -1,348 +1,346 @@ - + - + android:background="@color/white" + android:gravity="center_vertical" + android:orientation="horizontal"> - + - + - + - + - + - + + - - + - + + - + + + + + + + + + + + + + + + + + + + + + + + + android:id="@+id/editor_link_answer" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:orientation="vertical" + app:layout_constraintEnd_toStartOf="@+id/editor_link_article" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> - + android:src="@drawable/icon_editor_link_answer" /> - - - - - + + android:id="@+id/editor_link_article" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:orientation="vertical" + app:layout_constraintEnd_toStartOf="@+id/editor_link_video" + app:layout_constraintStart_toEndOf="@+id/editor_link_answer" + app:layout_constraintTop_toTopOf="parent"> - + android:src="@drawable/icon_editor_link_article" /> - - - - - - - + - + + + + + + + + + + + + + + + android:gravity="center_horizontal" + android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="@+id/editor_link_answer" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/editor_link_answer"> - + + + android:layout_marginTop="8dp" + android:gravity="center" + android:text="引用游戏单" + android:textColor="@color/text_subtitle" + android:textSize="11sp" /> + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - \ No newline at end of file + diff --git a/app/src/main/res/layout/editor_insert_default_item.xml b/app/src/main/res/layout/editor_insert_default_item.xml index c2763ffe23..f90b4bad7b 100644 --- a/app/src/main/res/layout/editor_insert_default_item.xml +++ b/app/src/main/res/layout/editor_insert_default_item.xml @@ -1,70 +1,58 @@ - + - + - - + - + + + android:layout_height="1dp" + android:layout_marginLeft="20dp" + android:layout_marginRight="20dp" + android:background="@color/divider" + app:layout_constraintBottom_toBottomOf="parent" /> - - - - - - - - - - - + diff --git a/app/src/main/res/layout/followers_or_fans_item.xml b/app/src/main/res/layout/followers_or_fans_item.xml index 8ad1d62980..6652abd54b 100644 --- a/app/src/main/res/layout/followers_or_fans_item.xml +++ b/app/src/main/res/layout/followers_or_fans_item.xml @@ -1,142 +1,122 @@ - + - - - - - - - - - - - - - - - - - + android:layout_marginLeft="8dp" + android:layout_marginTop="12dp" + android:layout_marginBottom="20dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toRightOf="@id/user_icon" + app:layout_constraintTop_toBottomOf="@id/user_introduce"> + tools:text="1回答" /> + android:layout_toRightOf="@id/answer_count" + android:textColor="@color/text_subtitle" + android:textSize="11sp" + tools:text="1赞同" /> + - + - + + + + + - + - + + + - - diff --git a/app/src/main/res/layout/forum_activity_item.xml b/app/src/main/res/layout/forum_activity_item.xml index 9a9ef223fb..427a183e05 100644 --- a/app/src/main/res/layout/forum_activity_item.xml +++ b/app/src/main/res/layout/forum_activity_item.xml @@ -1,85 +1,74 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:paddingBottom="16dp"> - + - - + - + android:layout_marginTop="12dp" + android:includeFontPadding="false" + android:lineSpacingExtra="4dp" + android:textColor="@color/text_title" + android:textSize="14sp" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toBottomOf="@+id/introPic" + tools:text="官方预告,5.20限时领福利礼好礼等你拿快来参加吧还有更多好礼等你拿" /> - + - + + - - - - - - - diff --git a/app/src/main/res/layout/forum_item.xml b/app/src/main/res/layout/forum_item.xml index 423d25a278..f3646cf94a 100644 --- a/app/src/main/res/layout/forum_item.xml +++ b/app/src/main/res/layout/forum_item.xml @@ -1,51 +1,36 @@ - + - - + - - - - + android:layout_marginLeft="12dp" + android:layout_marginRight="20dp" + android:layout_weight="1" + android:ellipsize="end" + android:maxLines="1" + android:textColor="@color/text_title" + android:textSize="14sp" /> - - - - - - - \ No newline at end of file + + diff --git a/app/src/main/res/layout/forum_my_follow.xml b/app/src/main/res/layout/forum_my_follow.xml index 40cb394792..92d4a3c0a5 100644 --- a/app/src/main/res/layout/forum_my_follow.xml +++ b/app/src/main/res/layout/forum_my_follow.xml @@ -1,71 +1,59 @@ - + - - - - + + android:layout_height="80dp" + android:gravity="center_vertical" + android:orientation="horizontal" + android:paddingLeft="16dp" + android:paddingRight="16dp"> - + - + - + - - - - - - + - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/forum_record_item.xml b/app/src/main/res/layout/forum_record_item.xml index b8103899ca..44ce22045c 100644 --- a/app/src/main/res/layout/forum_record_item.xml +++ b/app/src/main/res/layout/forum_record_item.xml @@ -1,51 +1,43 @@ - - - - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="52dp" + android:layout_height="wrap_content" + android:layout_marginRight="12dp" + android:gravity="center_horizontal" + android:orientation="vertical"> - + + + android:layout_marginTop="4dp" + android:ellipsize="end" + android:gravity="center" + android:includeFontPadding="false" + android:singleLine="true" + android:textColor="@color/text_title" + android:textSize="11sp" + app:layout_constraintLeft_toLeftOf="@+id/forumIv" + app:layout_constraintRight_toRightOf="@+id/forumIv" + app:layout_constraintTop_toBottomOf="@+id/forumIv" + tools:text="龙之谷" /> - - - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/forum_search_content_list.xml b/app/src/main/res/layout/forum_search_content_list.xml index d215f0099d..60caa9d8ee 100644 --- a/app/src/main/res/layout/forum_search_content_list.xml +++ b/app/src/main/res/layout/forum_search_content_list.xml @@ -1,143 +1,128 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content"> - + - - - - - - + android:layout_height="wrap_content" + android:background="@color/white" + android:orientation="vertical" + android:paddingLeft="20dp" + android:paddingTop="16dp" + android:paddingRight="20dp"> - + - + + + + + + + + + + + + + android:layout_marginTop="12dp" + android:layout_marginBottom="16dp"> - - - - - - - - - - - - - - - + android:textColor="@color/text_subtitleDesc" + android:textSize="11sp" /> - + + - - - - - - - \ No newline at end of file + + + \ No newline at end of file diff --git a/app/src/main/res/layout/forum_top_link_item.xml b/app/src/main/res/layout/forum_top_link_item.xml index 8bdad6c861..b4333ae434 100644 --- a/app/src/main/res/layout/forum_top_link_item.xml +++ b/app/src/main/res/layout/forum_top_link_item.xml @@ -1,37 +1,35 @@ - + - + - - - - - \ No newline at end of file + + diff --git a/app/src/main/res/layout/forum_welfare_item.xml b/app/src/main/res/layout/forum_welfare_item.xml index 220b0ec11f..292042f1e7 100644 --- a/app/src/main/res/layout/forum_welfare_item.xml +++ b/app/src/main/res/layout/forum_welfare_item.xml @@ -1,36 +1,33 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:paddingLeft="16dp" + android:paddingRight="16dp"> - + + - - - - - - \ No newline at end of file + android:layout_marginLeft="12dp" + android:ellipsize="end" + android:gravity="center" + android:includeFontPadding="false" + android:singleLine="true" + android:textColor="@color/text_title" + android:textSize="14sp" + app:layout_constraintBottom_toBottomOf="@+id/welfareIv" + app:layout_constraintLeft_toRightOf="@+id/welfareIv" + app:layout_constraintTop_toTopOf="@+id/welfareIv" + tools:text="龙之谷" /> + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_amway_search_default.xml b/app/src/main/res/layout/fragment_amway_search_default.xml index 5a21c27ce3..c68381a873 100644 --- a/app/src/main/res/layout/fragment_amway_search_default.xml +++ b/app/src/main/res/layout/fragment_amway_search_default.xml @@ -1,37 +1,33 @@ - + - + + + android:layout_height="match_parent" + android:layout_gravity="center" + android:background="@color/background" + android:gravity="center" + android:orientation="vertical" + android:visibility="gone" + tools:visibility="visible"> - - - + android:text="搜索游戏,发表评论" + android:textColor="@color/c7c7c7" + android:textSize="15sp" /> - + - - - - - \ No newline at end of file + diff --git a/app/src/main/res/layout/fragment_answer_detail.xml b/app/src/main/res/layout/fragment_answer_detail.xml index c7ea63046b..9326a1e7cc 100644 --- a/app/src/main/res/layout/fragment_answer_detail.xml +++ b/app/src/main/res/layout/fragment_answer_detail.xml @@ -1,307 +1,293 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent"> - - - - - - - - + android:layout_height="match_parent" + android:background="@android:color/white" + android:visibility="visible"> - + android:layout_height="wrap_content" + android:paddingBottom="90dp"> - + + + android:paddingBottom="10dp" + app:layout_constraintTop_toBottomOf="@id/top_padding_view"> - - - + android:layout_marginLeft="20dp" + android:layout_marginTop="12dp" + android:layout_marginRight="20dp" + android:gravity="center_vertical" + android:lineSpacingExtra="6dp" + android:textColor="@color/black" + android:textSize="16sp" + android:textStyle="bold" /> - + + + + + + + + android:gravity="center_vertical" + android:orientation="horizontal" + android:paddingLeft="9dp" + android:paddingTop="7dp" + android:paddingRight="9dp" + android:paddingBottom="7dp"> - + - + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + android:gravity="center_vertical" + android:paddingTop="2dp" + android:paddingRight="20dp" + android:paddingBottom="2dp"> - + android:layout_marginRight="7dp" + android:drawableRight="@drawable/answer_detail_more_answer_icon" + android:drawablePadding="8dp" + android:textColor="@color/text_subtitle" + android:textSize="13sp" + tools:text="查看全部66个回答" /> - - - - - - - - - - + + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - - + + - + - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_answer_edit.xml b/app/src/main/res/layout/fragment_answer_edit.xml index c7d5ebfe1d..aa54c702d1 100644 --- a/app/src/main/res/layout/fragment_answer_edit.xml +++ b/app/src/main/res/layout/fragment_answer_edit.xml @@ -1,221 +1,220 @@ - + - + + + + android:layout_height="wrap_content" + android:layout_centerVertical="true" + android:gravity="center_vertical" + android:includeFontPadding="false" + android:lineSpacingExtra="6dp" + android:paddingLeft="20dp" + android:paddingTop="20dp" + android:paddingRight="10dp" + android:paddingBottom="12dp" + android:textColor="@color/text_title" + android:textSize="16sp" + android:textStyle="bold" + tools:text="快递公司全面复工:三通一达等均已全网恢复正常运营" /> - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:background="@android:color/white" + android:gravity="center" + app:layout_behavior="com.gh.common.view.FixAppBarLayoutBehavior"> + app:layout_scrollFlags="scroll|enterAlwaysCollapsed"> - + android:layout_height="wrap_content" + android:layout_marginLeft="20dp" + android:layout_marginTop="12dp" + android:layout_marginRight="20dp" + android:layout_marginBottom="8dp" + android:includeFontPadding="false" + android:lineSpacingExtra="4dp" + android:textColor="@color/text_subtitle" + android:textSize="14sp" + tools:text="国家邮政局召开部分快递企业专题电话会议。国家邮政局局党组书记、局长马军胜主持召开专题电话会议,向中通、圆通、申通、韵达、百世" /> - + android:layout_height="100dp" + android:layout_marginLeft="20dp" + android:layout_marginTop="8dp" + android:layout_marginRight="20dp" + android:layout_marginBottom="16dp"> - + - + - + + + + + + + + + + + + + + + + + + + + - - + + - + android:orientation="vertical" + app:layout_behavior="@string/appbar_scrolling_view_behavior"> - + - - + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/fragment_background_preview.xml b/app/src/main/res/layout/fragment_background_preview.xml index 02d91e7f8b..f6cbbf0eac 100644 --- a/app/src/main/res/layout/fragment_background_preview.xml +++ b/app/src/main/res/layout/fragment_background_preview.xml @@ -1,229 +1,226 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@color/white"> - + + + android:orientation="vertical"> - + android:layout_height="wrap_content" /> - + android:layout_height="@dimen/appbar_height"> - - - - - - - - - - - - + android:background="@color/transparent" /> + + + + + + - + - - - - - - - - - - - - - + app:layout_constraintTop_toTopOf="parent" + tools:background="@color/text_subtitle" /> - - - - - - - - - - - - + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_catalog.xml b/app/src/main/res/layout/fragment_catalog.xml index 7c00db2791..2d56f2253f 100644 --- a/app/src/main/res/layout/fragment_catalog.xml +++ b/app/src/main/res/layout/fragment_catalog.xml @@ -1,47 +1,44 @@ - - + + + android:layout_height="1dp" + android:background="@color/divider" /> - + + + + + android:layout_height="match_parent" /> + - + - + - - - - - - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_forum_detail.xml b/app/src/main/res/layout/fragment_forum_detail.xml index 5a73847918..0d5f532dec 100644 --- a/app/src/main/res/layout/fragment_forum_detail.xml +++ b/app/src/main/res/layout/fragment_forum_detail.xml @@ -1,480 +1,458 @@ - + - - - - - - - - - - - + android:layout_height="match_parent" + android:fitsSystemWindows="true" + android:orientation="vertical" + android:visibility="gone" + tools:visibility="visible"> - + android:gravity="center" + app:layout_behavior="com.gh.common.view.FixAppBarLayoutBehavior"> - + app:contentScrim="@color/white" + app:layout_scrollFlags="scroll|exitUntilCollapsed" + app:scrimAnimationDuration="0" + app:scrimVisibleHeightTrigger="80dp" + app:titleEnabled="false"> - + android:gravity="center_horizontal" + android:orientation="vertical" + app:layout_collapseMode="pin"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + android:layout_height="match_parent" + android:background="@color/transparent" + android:gravity="center_vertical" + android:orientation="horizontal" + android:translationX="-5dp"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_marginLeft="8dp" + android:layout_weight="1" + android:ellipsize="end" + android:maxLines="1" + android:textColor="@color/white" + android:textSize="16sp" + android:textStyle="bold" /> + android:id="@+id/searchIv" + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_gravity="center" + android:layout_marginLeft="15dp" + android:layout_marginRight="18dp" + android:src="@drawable/ic_forum_detail_search" /> + - + - - - - - - - - + android:layout_height="wrap_content" + android:background="@android:color/white"> - - + - + - + - + - + - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/fragment_forum_home.xml b/app/src/main/res/layout/fragment_forum_home.xml index f63af72c2e..af97d55626 100644 --- a/app/src/main/res/layout/fragment_forum_home.xml +++ b/app/src/main/res/layout/fragment_forum_home.xml @@ -202,7 +202,7 @@ android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintTop_toBottomOf="@id/column_detail_appbar" /> + app:layout_constraintTop_toBottomOf="@id/appbar" /> diff --git a/app/src/main/res/layout/fragment_forum_video_detail.xml b/app/src/main/res/layout/fragment_forum_video_detail.xml index 22727399f3..43ae734843 100644 --- a/app/src/main/res/layout/fragment_forum_video_detail.xml +++ b/app/src/main/res/layout/fragment_forum_video_detail.xml @@ -1,267 +1,256 @@ - + - - - - - - + android:layout_height="match_parent" + android:fitsSystemWindows="true" + android:orientation="vertical"> - + android:gravity="center" + app:elevation="0dp" + app:layout_behavior="com.gh.common.view.FixAppBarLayoutBehavior"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + app:contentScrim="@color/white" + app:layout_scrollFlags="scroll|exitUntilCollapsed" + app:scrimAnimationDuration="0" + app:scrimVisibleHeightTrigger="105dp" + app:titleEnabled="false"> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + android:layout_height="wrap_content"> - + - + - + + - + + - + android:overScrollMode="never" + app:layout_behavior="@string/appbar_scrolling_view_behavior" /> - - - - - + android:layout_height="8dp" + android:background="@drawable/bg_forum_video_detail_shadow" + app:layout_behavior="@string/appbar_scrolling_view_behavior" /> - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_game.xml b/app/src/main/res/layout/fragment_game.xml index f368cee408..dd2cd5e494 100644 --- a/app/src/main/res/layout/fragment_game.xml +++ b/app/src/main/res/layout/fragment_game.xml @@ -1,62 +1,43 @@ + - - - - - - - - - - - - + android:layout_height="match_parent"> - - - - - - - - - - - - + android:background="@color/white" + android:clipToPadding="false" /> - - + + + + + + + + + + diff --git a/app/src/main/res/layout/fragment_game_collection_poster.xml b/app/src/main/res/layout/fragment_game_collection_poster.xml index e4e104667c..132d8ac95b 100644 --- a/app/src/main/res/layout/fragment_game_collection_poster.xml +++ b/app/src/main/res/layout/fragment_game_collection_poster.xml @@ -1,161 +1,146 @@ - + - - - - - - - + android:layout_height="match_parent" + android:scaleType="centerCrop" /> - + - + - + - + + + + + + + + + + app:layout_constraintBottom_toBottomOf="@+id/userIcon" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toLeftOf="@+id/followTv" + app:layout_constraintTop_toTopOf="@+id/userIcon" + tools:text="测试用户名测试用户名测试用户名" /> + android:textSize="12sp" + app:layout_constraintBottom_toBottomOf="@+id/userIcon" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="@+id/userIcon" /> - + + - - - - - - - - - - - - - - - \ No newline at end of file + android:layout_marginTop="15dp" + android:includeFontPadding="false" + android:lineSpacingExtra="7dp" + android:paddingBottom="8dp" + android:textColor="@color/white" + android:textSize="14sp" + app:layout_constraintTop_toBottomOf="@+id/divider" + tools:text="第一行一二三四五六七八九十一二三四五六七八第一行一二三四五六七八九十一二三四五六七八第一行一二三四五六七八九十一二三四五六七八" /> + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_help_contaier.xml b/app/src/main/res/layout/fragment_help_contaier.xml index 95cfb13c30..3c7c162873 100644 --- a/app/src/main/res/layout/fragment_help_contaier.xml +++ b/app/src/main/res/layout/fragment_help_contaier.xml @@ -1,110 +1,107 @@ - + - + android:layout_height="match_parent" + android:orientation="vertical"> - + android:layout_height="wrap_content" + android:background="@color/white" + android:focusableInTouchMode="true"> - + - - - - - - - - - - - - - - - + android:background="@null" + android:hint="请输入关键词搜索" + android:imeOptions="actionSearch" + android:paddingLeft="34dp" + android:paddingRight="40dp" + android:singleLine="true" + android:textColorHint="@color/text_body" + android:textCursorDrawable="@drawable/cursor_color" + android:textSize="14sp" + app:layout_constraintBottom_toBottomOf="@id/search_background" + app:layout_constraintLeft_toLeftOf="@id/search_background" + app:layout_constraintRight_toRightOf="@id/search_background" + app:layout_constraintTop_toTopOf="@id/search_background" /> - + - - - + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/fragment_main_home.xml b/app/src/main/res/layout/fragment_main_home.xml index 96a356920a..1df3488094 100644 --- a/app/src/main/res/layout/fragment_main_home.xml +++ b/app/src/main/res/layout/fragment_main_home.xml @@ -1,64 +1,44 @@ + - - - - - - - - - - - - + android:layout_height="match_parent"> - - - - - - - - - + android:background="@color/white" + android:clipToPadding="false" /> - + - - + + + + + + + diff --git a/app/src/main/res/layout/fragment_new_personal_stub.xml b/app/src/main/res/layout/fragment_new_personal_stub.xml index 085c41a222..391830aec6 100644 --- a/app/src/main/res/layout/fragment_new_personal_stub.xml +++ b/app/src/main/res/layout/fragment_new_personal_stub.xml @@ -1,18 +1,11 @@ - + - - - - - - - - - + android:layout_height="match_parent" + android:layout="@layout/fragment_new_personal" /> + diff --git a/app/src/main/res/layout/fragment_package_check.xml b/app/src/main/res/layout/fragment_package_check.xml index bfc7f1e466..d1560a90d2 100644 --- a/app/src/main/res/layout/fragment_package_check.xml +++ b/app/src/main/res/layout/fragment_package_check.xml @@ -1,147 +1,142 @@ - + - + android:layout_marginLeft="24dp" + android:layout_marginRight="24dp" + android:drawableLeft="@drawable/ic_dialog_tips" + android:drawablePadding="4dp" + android:text="温馨提示" + android:textColor="@color/text_title" + android:textSize="16sp" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + + + + - - - - + android:overScrollMode="never" /> + - - + - + - + - + - + - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_personal_stub.xml b/app/src/main/res/layout/fragment_personal_stub.xml index 07fe4e8511..d0aadc4824 100644 --- a/app/src/main/res/layout/fragment_personal_stub.xml +++ b/app/src/main/res/layout/fragment_personal_stub.xml @@ -1,18 +1,12 @@ - + - - - - - + android:layout_height="match_parent" + android:layout="@layout/fragment_personal" /> + - - - diff --git a/app/src/main/res/layout/fragment_photo_poster.xml b/app/src/main/res/layout/fragment_photo_poster.xml index a42361f221..7e4f011f5a 100644 --- a/app/src/main/res/layout/fragment_photo_poster.xml +++ b/app/src/main/res/layout/fragment_photo_poster.xml @@ -1,14 +1,12 @@ - + - + android:layout_height="match_parent" /> - + - - diff --git a/app/src/main/res/layout/fragment_qa_category.xml b/app/src/main/res/layout/fragment_qa_category.xml index d4ed98cd26..34ced57d36 100644 --- a/app/src/main/res/layout/fragment_qa_category.xml +++ b/app/src/main/res/layout/fragment_qa_category.xml @@ -1,31 +1,28 @@ - + - + android:layout_height="match_parent" /> - + - - - + - + - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_search_default.xml b/app/src/main/res/layout/fragment_search_default.xml index 7760d685db..b960666d6c 100644 --- a/app/src/main/res/layout/fragment_search_default.xml +++ b/app/src/main/res/layout/fragment_search_default.xml @@ -1,134 +1,108 @@ - + - - - - - - - - - - + android:layout_height="wrap_content" + android:includeFontPadding="false" + android:padding="16dp" + android:text="@string/search_history" + android:textColor="@color/text_0E0E0E" + android:textSize="14sp" + android:textStyle="bold" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + + + + - - - - - - - - - + app:dividerDrawable="@drawable/shape_history_flexbox_divider" + app:flexWrap="wrap" + app:showDivider="middle" /> + - + + + + - - - - - + app:dividerDrawable="@drawable/shape_history_flexbox_divider" + app:flexWrap="wrap" + app:showDivider="middle" /> + - - - + + + + diff --git a/app/src/main/res/layout/fragment_sub_catalog.xml b/app/src/main/res/layout/fragment_sub_catalog.xml index b42b6ac131..e526044dc7 100644 --- a/app/src/main/res/layout/fragment_sub_catalog.xml +++ b/app/src/main/res/layout/fragment_sub_catalog.xml @@ -1,29 +1,27 @@ - - + + + android:background="@color/white" /> - + - + - - - - - \ No newline at end of file + + diff --git a/app/src/main/res/layout/fragment_video_poster.xml b/app/src/main/res/layout/fragment_video_poster.xml index 703b16eac1..1cdfb38e63 100644 --- a/app/src/main/res/layout/fragment_video_poster.xml +++ b/app/src/main/res/layout/fragment_video_poster.xml @@ -1,33 +1,30 @@ - + - + + + android:layout_height="112dp" + android:background="@color/text_28282E" + android:paddingLeft="20dp" + android:paddingTop="24dp" + android:paddingRight="20dp" + android:paddingBottom="24dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" /> - + - - - - - diff --git a/app/src/main/res/layout/game_attach_item.xml b/app/src/main/res/layout/game_attach_item.xml index 9fd03e3869..c07d8650a0 100644 --- a/app/src/main/res/layout/game_attach_item.xml +++ b/app/src/main/res/layout/game_attach_item.xml @@ -1,91 +1,76 @@ - - - - - - - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + android:id="@+id/game_icon_container" + android:layout_width="52dp" + android:layout_height="58dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent"> - - - - - - - - - - - + app:layout_constraintTop_toTopOf="parent" /> - + + + + + + + + diff --git a/app/src/main/res/layout/game_collection_amway_content_item.xml b/app/src/main/res/layout/game_collection_amway_content_item.xml index f59a0152b8..b9c3c19d8a 100644 --- a/app/src/main/res/layout/game_collection_amway_content_item.xml +++ b/app/src/main/res/layout/game_collection_amway_content_item.xml @@ -1,46 +1,36 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center_vertical" + android:orientation="horizontal"> - + - - + + - + android:layout_height="wrap_content" + android:layout_marginStart="5dp" + android:ellipsize="end" + android:includeFontPadding="false" + android:lines="1" + android:textColor="@color/white_alpha_80" + android:textSize="@dimen/tag_text_size" + tools:text="我真的真的很喜欢这款游戏,没有重氪那么我真的真的很喜欢这款游戏,没有重氪那么我真的真的很喜欢这款游戏,没有重氪那么" /> - - - - - - - - - \ No newline at end of file + diff --git a/app/src/main/res/layout/game_collection_detail_image_item.xml b/app/src/main/res/layout/game_collection_detail_image_item.xml index d0849349c6..293dfe3ff8 100644 --- a/app/src/main/res/layout/game_collection_detail_image_item.xml +++ b/app/src/main/res/layout/game_collection_detail_image_item.xml @@ -1,172 +1,152 @@ - + - - + - + - - - - - - + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + - + - + - + - - - - - - - - - - + android:layout_height="wrap_content" + app:avatar_width="22dp" + app:badge_width="8dp" + app:border_ratio="1" + app:border_width="0dp" + tools:layout_height="22dp" + tools:layout_width="22dp" /> + tools:text="测试用户名" /> + - - - \ No newline at end of file + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/game_collection_detail_video_item.xml b/app/src/main/res/layout/game_collection_detail_video_item.xml index 2600b74c03..3b9856d4b4 100644 --- a/app/src/main/res/layout/game_collection_detail_video_item.xml +++ b/app/src/main/res/layout/game_collection_detail_video_item.xml @@ -1,159 +1,140 @@ - + - - + + + - - - - - - - - + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:background="@drawable/bg_game_collection_video_item"> - - - - - + android:layout_marginLeft="17dp" + android:layout_marginRight="29dp" + android:includeFontPadding="false" + android:maxLines="2" + android:lineSpacingExtra="2dp" + android:textColor="@color/text_title" + android:textStyle="bold" + android:textSize="20sp" + tools:text="MOBA 手游集合,绝不氪金 5V5 公平对战" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toLeftOf="@+id/tagIv" + app:layout_constraintTop_toTopOf="parent" /> - + - + - + - - - - - - + android:layout_height="wrap_content" + app:avatar_width="24dp" + app:badge_width="8dp" + app:border_width="0dp" + app:border_ratio="1" + tools:layout_height="24dp" + tools:layout_width="24dp" /> + tools:text="测试用户名" /> + - - - - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/game_collection_game_item.xml b/app/src/main/res/layout/game_collection_game_item.xml index f357dd54cf..09e359c723 100644 --- a/app/src/main/res/layout/game_collection_game_item.xml +++ b/app/src/main/res/layout/game_collection_game_item.xml @@ -1,48 +1,38 @@ - - - + - - + - - - - - - - \ No newline at end of file + android:layout_marginTop="12dp" + android:paddingTop="7dp" + android:paddingLeft="8dp" + android:paddingRight="8dp" + android:paddingBottom="7dp" + android:includeFontPadding="false" + android:ellipsize="end" + android:maxLines="3" + android:background="@drawable/bg_shape_f8_radius_8" + android:textColor="@color/text_subtitleDesc" + android:textSize="12sp" + tools:text="跑跑卡丁车的手游版作为一部致敬经典的作品,在人物和地图上都有基本还原端游,但是手感有些区别" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toBottomOf="@+id/game_item_included" + app:layout_constraintBottom_toBottomOf="parent" /> + \ No newline at end of file diff --git a/app/src/main/res/layout/game_collection_item.xml b/app/src/main/res/layout/game_collection_item.xml index 376ff84968..8a89437896 100644 --- a/app/src/main/res/layout/game_collection_item.xml +++ b/app/src/main/res/layout/game_collection_item.xml @@ -1,308 +1,273 @@ - + - - - - - - - - - - - - + + + + + android:layout_marginStart="16dp" + android:layout_marginTop="18dp" + android:layout_marginEnd="16dp" + android:includeFontPadding="false" + android:singleLine="true" + android:textColor="@color/white" + android:textSize="16sp" + android:textStyle="bold" + app:layout_constraintEnd_toStartOf="@+id/tagIv" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:text="刺激游戏大合集" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + tools:text="999" /> - - + app:layout_constraintLeft_toRightOf="@+id/comment_count_container" + app:layout_constraintRight_toLeftOf="@+id/vote_count" + app:layout_constraintTop_toTopOf="parent" /> + + + + + + - - - - - - - - - - - - + - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/game_comment_log_item.xml b/app/src/main/res/layout/game_comment_log_item.xml index a1905a580f..190f6ffd83 100644 --- a/app/src/main/res/layout/game_comment_log_item.xml +++ b/app/src/main/res/layout/game_comment_log_item.xml @@ -1,19 +1,5 @@ - - - - - - - - - - - - - - + @@ -81,7 +62,6 @@ android:minWidth="14dp" android:minHeight="14dp" android:numStars="5" - android:rating="@{data.star}" app:layout_constraintBottom_toBottomOf="@+id/user_icon_container" app:layout_constraintLeft_toRightOf="@+id/user_icon_container" app:layout_constraintTop_toBottomOf="@+id/user_name" @@ -94,7 +74,6 @@ android:layout_height="wrap_content" android:layout_marginLeft="8dp" android:gravity="center" - android:text="@{NewsUtils.getFormattedTime(data.time)}" android:textColor="@color/hint" android:textSize="12sp" app:layout_constraintBottom_toBottomOf="@+id/user_icon_container" @@ -116,4 +95,3 @@ tools:text="每个评论的正文,最多显示4行,超过则使用省略号…全部,点击[全部]即可展开余下全文" /> - diff --git a/app/src/main/res/layout/game_head_item.xml b/app/src/main/res/layout/game_head_item.xml index 405b41e834..09dd43e5bf 100644 --- a/app/src/main/res/layout/game_head_item.xml +++ b/app/src/main/res/layout/game_head_item.xml @@ -1,61 +1,49 @@ - + - - - - - - - - + android:gravity="center_vertical" + android:orientation="horizontal" + android:paddingLeft="@dimen/home_item_padding" + android:paddingRight="@dimen/home_item_padding"> - + android:includeFontPadding="false" + android:maxLines="1" + android:textColor="@color/text_title" + android:textSize="18sp" + android:textStyle="bold" + tools:text="人气手游风向标" /> - + - + - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/game_horizontal_item.xml b/app/src/main/res/layout/game_horizontal_item.xml index 13da25ed46..1a3e71993d 100644 --- a/app/src/main/res/layout/game_horizontal_item.xml +++ b/app/src/main/res/layout/game_horizontal_item.xml @@ -1,150 +1,122 @@ - - - - - - - - - - - - - - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:paddingTop="6dp" + android:paddingBottom="6dp" + tools:background="@color/white"> + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent"> - - - - - - - - - - - - - - - - - - - - + app:layout_constraintTop_toTopOf="parent" + tools:text="9.3" /> + + + + + + - + + + + + + + + + + + + diff --git a/app/src/main/res/layout/game_horizontal_simple_item.xml b/app/src/main/res/layout/game_horizontal_simple_item.xml index ad93adb830..c2b7f33bf0 100644 --- a/app/src/main/res/layout/game_horizontal_simple_item.xml +++ b/app/src/main/res/layout/game_horizontal_simple_item.xml @@ -1,41 +1,28 @@ - + - + - - - - + android:layout_marginTop="8dp" + android:ellipsize="end" + android:gravity="center" + android:includeFontPadding="false" + android:lineSpacingExtra="4dp" + android:maxLines="2" + android:textColor="@color/text_title" + android:textSize="12sp" + tools:text="超杀默示录" /> - - - - - - - + diff --git a/app/src/main/res/layout/game_image_item.xml b/app/src/main/res/layout/game_image_item.xml index 72eac0497d..a68f8479d3 100644 --- a/app/src/main/res/layout/game_image_item.xml +++ b/app/src/main/res/layout/game_image_item.xml @@ -1,114 +1,83 @@ - + - - - - - - - - - - - - - - + fresco:actualImageScaleType="centerCrop" + fresco:backgroundImage="@color/placeholder_bg" + fresco:fadeDuration="500" + fresco:layout_constraintLeft_toLeftOf="parent" + fresco:layout_constraintTop_toTopOf="parent" + fresco:placeholderImage="@drawable/preload" + fresco:pressedStateOverlayImage="@color/pressed_bg" + fresco:viewAspectRatio="2.14" /> - + - - - - - - - - - - - + + android:layout_marginTop="4dp" + android:textColor="@android:color/white" + android:textSize="12sp" /> - - + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/game_image_slide_item.xml b/app/src/main/res/layout/game_image_slide_item.xml index 3ef3a5024d..a738ebe6ee 100644 --- a/app/src/main/res/layout/game_image_slide_item.xml +++ b/app/src/main/res/layout/game_image_slide_item.xml @@ -1,78 +1,76 @@ - + - + + + + + + + android:layout_centerVertical="true" + app:layout_constraintBottom_toBottomOf="@id/guide_place" + app:layout_constraintLeft_toLeftOf="parent" /> - + - + - + - - - - - - - - diff --git a/app/src/main/res/layout/game_item.xml b/app/src/main/res/layout/game_item.xml index 42e66006a3..7e25e4d99d 100644 --- a/app/src/main/res/layout/game_item.xml +++ b/app/src/main/res/layout/game_item.xml @@ -1,343 +1,303 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@drawable/reuse_listview_item_style" + android:gravity="center_vertical" + android:orientation="horizontal" + android:padding="@dimen/home_item_padding"> - + - + - + - + - + - + - + - - + + + + + + + + + + + + android:id="@+id/recommendContainer" + android:layout_width="wrap_content" + android:layout_height="18dp" + android:layout_marginTop="3dp" + android:background="@drawable/bg_game_item_recommend" + android:paddingStart="4dp" + android:paddingEnd="8dp" + android:visibility="gone" + app:layout_constrainedWidth="true" + app:layout_constraintHorizontal_bias="0" + app:layout_constraintLeft_toLeftOf="@+id/gameDesSpace" + app:layout_constraintRight_toRightOf="@+id/gameDesSpace" + app:layout_constraintTop_toTopOf="@+id/gameDesSpace"> + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@id/recommendIv" + app:layout_constraintTop_toTopOf="parent" + app:layout_goneMarginStart="4dp" + tools:text="最新活动火爆来袭" /> + - + + + + + + + + + + + diff --git a/app/src/main/res/layout/game_permission_dialog.xml b/app/src/main/res/layout/game_permission_dialog.xml index f2f0b2890b..2d66d0fb08 100644 --- a/app/src/main/res/layout/game_permission_dialog.xml +++ b/app/src/main/res/layout/game_permission_dialog.xml @@ -1,178 +1,175 @@ - + - + android:layout_height="wrap_content" + app:cardBackgroundColor="@color/white" + app:cardCornerRadius="8dp" + app:cardElevation="0dp"> - + android:layout_height="wrap_content"> - + + + android:layout_height="wrap_content" + android:layout_marginLeft="92dp" + android:layout_marginTop="19dp" + android:layout_marginRight="16dp" + android:ellipsize="end" + android:includeFontPadding="false" + android:maxLines="1" + android:textColor="@color/text_title" + android:textSize="16sp" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:text="少年三国志2" /> - + + + + + + + + android:layout_centerVertical="true" + android:layout_marginLeft="12dp" + android:layout_toRightOf="@id/privacyIv" + android:text="隐私政策" + android:textColor="@color/text_title" /> - + - + - + - + - + - + - + + + - - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/game_permission_item.xml b/app/src/main/res/layout/game_permission_item.xml index 94f62d8b62..b7c8228242 100644 --- a/app/src/main/res/layout/game_permission_item.xml +++ b/app/src/main/res/layout/game_permission_item.xml @@ -1,8 +1,7 @@ - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/game_viewpager_item.xml b/app/src/main/res/layout/game_viewpager_item.xml index b0c6c20d81..cda74f4dd5 100644 --- a/app/src/main/res/layout/game_viewpager_item.xml +++ b/app/src/main/res/layout/game_viewpager_item.xml @@ -1,228 +1,201 @@ - + + - - - - - - - - - - - - - - + - + android:visibility="visible" + app:fractionValue="0.4375" + app:measureBy="width"> - - + android:layout_height="match_parent" + android:overScrollMode="never" /> - + + + + + + + + + + + + - - + android:orientation="vertical"> - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/gamedetail_item_custom_column_item.xml b/app/src/main/res/layout/gamedetail_item_custom_column_item.xml index aa3eef97f1..779a368114 100644 --- a/app/src/main/res/layout/gamedetail_item_custom_column_item.xml +++ b/app/src/main/res/layout/gamedetail_item_custom_column_item.xml @@ -1,24 +1,21 @@ - + - + android:includeFontPadding="false" + android:lineSpacingExtra="4dp" + android:maxLines="4" + android:textColor="@color/text_subtitle" + android:textSize="13sp" + tools:text="sample" /> - - - - + diff --git a/app/src/main/res/layout/help_category_item.xml b/app/src/main/res/layout/help_category_item.xml index b265a3c582..f8e71755f8 100644 --- a/app/src/main/res/layout/help_category_item.xml +++ b/app/src/main/res/layout/help_category_item.xml @@ -1,31 +1,28 @@ - + - + + + android:layout_marginLeft="4dp" + android:layout_marginTop="16dp" + android:layout_marginBottom="16dp" + android:includeFontPadding="false" + android:singleLine="true" + android:textColor="@color/text_title" + android:textSize="14sp" + android:textStyle="bold" /> - - - - - - + diff --git a/app/src/main/res/layout/help_item.xml b/app/src/main/res/layout/help_item.xml index ee04287a9c..ccd1943e4b 100644 --- a/app/src/main/res/layout/help_item.xml +++ b/app/src/main/res/layout/help_item.xml @@ -1,36 +1,34 @@ - + - + android:layout_height="8dp" + android:background="@color/background" + android:visibility="gone" /> - + - - - - - + + diff --git a/app/src/main/res/layout/help_qa_category_item.xml b/app/src/main/res/layout/help_qa_category_item.xml index 79c25d47a8..30d6617631 100644 --- a/app/src/main/res/layout/help_qa_category_item.xml +++ b/app/src/main/res/layout/help_qa_category_item.xml @@ -1,96 +1,86 @@ - + - + - - - - + android:background="@color/white"> - - - + android:layout_marginLeft="20dp" + android:gravity="center_horizontal" + android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> - + + + + + android:layout_marginTop="16dp" + android:text="更多 >" + android:textColor="@color/text_subtitleDesc" + android:textSize="12sp" /> + - - - - - - - - + - - - - \ No newline at end of file + + + \ No newline at end of file diff --git a/app/src/main/res/layout/home_amway_item.xml b/app/src/main/res/layout/home_amway_item.xml index b81321ff5f..be429de70a 100644 --- a/app/src/main/res/layout/home_amway_item.xml +++ b/app/src/main/res/layout/home_amway_item.xml @@ -1,232 +1,213 @@ - + - + - - + - + android:layout_marginLeft="12dp" + android:layout_marginTop="8dp" + android:layout_marginRight="12dp" + android:includeFontPadding="false" + android:singleLine="true" + android:textColor="@color/text_title" + android:textSize="16sp" + android:textStyle="bold" + app:layout_constraintLeft_toRightOf="@id/game_icon" + app:layout_constraintRight_toRightOf="@id/amway_background" + app:layout_constraintTop_toTopOf="@id/amway_background" + tools:text="泡面三国" /> - + - + + + + + + + - - + android:textSize="13sp" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:text="面提升中希合作交流水平 推动金砖峰会取得丰硕成果,写在习近平主席对希腊进行国事访问并赴巴西出席金砖国家领导人第十一次会晤之际 " /> - - - - - - - - - - - - - - - - - - - - + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toBottomOf="@id/content"> + android:id="@+id/user_icon" + style="@style/frescoCircleStyle" + android:layout_width="20dp" + android:layout_height="20dp" /> - - - + android:layout_alignParentRight="true" + android:layout_alignParentBottom="true" /> - + + + + app:layout_constraintBottom_toBottomOf="@id/user_name" + app:layout_constraintLeft_toRightOf="@id/user_name" + app:layout_constraintTop_toTopOf="@id/user_name" /> + + + + - + + + + diff --git a/app/src/main/res/layout/home_game_item.xml b/app/src/main/res/layout/home_game_item.xml index d0cc84e82a..a38d65ecdd 100644 --- a/app/src/main/res/layout/home_game_item.xml +++ b/app/src/main/res/layout/home_game_item.xml @@ -1,153 +1,139 @@ - + - - - - - - - + app:layout_constraintTop_toTopOf="parent"> - - - - - - - - - - - - + app:layout_constraintTop_toTopOf="parent" /> - - - - - - + + + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:layout_marginRight="32dp" + app:layout_constraintEnd_toStartOf="@+id/game_rating" + app:layout_constraintStart_toStartOf="@id/game_name" + app:layout_constraintTop_toBottomOf="@+id/game_name" /> + + + - + + + + + + + + + + + diff --git a/app/src/main/res/layout/home_recommend_item.xml b/app/src/main/res/layout/home_recommend_item.xml index bb17d0328e..5a3cd9b9ea 100644 --- a/app/src/main/res/layout/home_recommend_item.xml +++ b/app/src/main/res/layout/home_recommend_item.xml @@ -1,179 +1,156 @@ - + - - - - - - - - - - - - + android:gravity="center_horizontal" + android:orientation="vertical"> - + + + android:layout_marginTop="8dp" + android:textColor="@color/text_title" + android:textSize="12sp" + tools:text="分类" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/home_slide_list_item.xml b/app/src/main/res/layout/home_slide_list_item.xml index 9bd782d40f..8415396371 100644 --- a/app/src/main/res/layout/home_slide_list_item.xml +++ b/app/src/main/res/layout/home_slide_list_item.xml @@ -1,128 +1,108 @@ - + - - - - - - - - - - - + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:roundedCornerRadius="5dp" + app:viewAspectRatio="1.2" /> - + - + - + - + - + - + - + - - diff --git a/app/src/main/res/layout/hot_forum_item.xml b/app/src/main/res/layout/hot_forum_item.xml index 778d0780ba..0c2d2ce4fa 100644 --- a/app/src/main/res/layout/hot_forum_item.xml +++ b/app/src/main/res/layout/hot_forum_item.xml @@ -1,57 +1,49 @@ - - - - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:paddingLeft="16dp" + android:paddingTop="8dp" + android:paddingRight="16dp" + android:paddingBottom="8dp"> - + + + android:layout_marginLeft="12dp" + android:layout_marginRight="20dp" + android:ellipsize="end" + android:includeFontPadding="false" + android:maxLines="1" + android:textColor="@color/text_title" + android:textSize="14sp" + app:layout_constraintBottom_toBottomOf="@+id/forumIv" + app:layout_constraintLeft_toRightOf="@+id/forumIv" + app:layout_constraintRight_toLeftOf="@+id/followTv" + app:layout_constraintTop_toTopOf="@+id/forumIv" + tools:text="龙之谷龙之谷龙之谷龙之谷龙之谷龙之谷龙之谷龙之谷龙之谷龙之谷龙之谷龙之谷龙之谷" /> - - - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/imprint_content_item.xml b/app/src/main/res/layout/imprint_content_item.xml index 1510489e20..dd27a8e8b2 100644 --- a/app/src/main/res/layout/imprint_content_item.xml +++ b/app/src/main/res/layout/imprint_content_item.xml @@ -1,71 +1,45 @@ - + - + - + - - - - - - - - - - - - - - - - - - - - - + + diff --git a/app/src/main/res/layout/item_article_detail_comment.xml b/app/src/main/res/layout/item_article_detail_comment.xml index a3d892241c..15aa19c05c 100644 --- a/app/src/main/res/layout/item_article_detail_comment.xml +++ b/app/src/main/res/layout/item_article_detail_comment.xml @@ -1,343 +1,320 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@color/white"> - - - - - - - - + + android:layout_marginLeft="3dp" + android:layout_marginTop="8dp" + android:layout_marginRight="24dp" + app:layout_constraintEnd_toStartOf="@+id/moreIv" + app:layout_constraintStart_toEndOf="@id/userIconIv" + app:layout_constraintTop_toTopOf="@id/userIconIv"> - + tools:text="孙一峰" /> - + + + + - - - - - - - - - - - - - - + android:layout_marginRight="32dp" + android:gravity="center" + android:includeFontPadding="false" + android:textColor="@color/text_subtitleDesc" + android:textSize="10sp" + android:visibility="gone" + app:layout_constrainedWidth="true" + app:layout_constraintBottom_toBottomOf="@+id/userNameTv" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@+id/badgeIv" + app:layout_constraintTop_toTopOf="@+id/userNameTv" + tools:text="答题先锋" /> + android:id="@+id/topLabelIv" + android:layout_width="26dp" + android:layout_height="14dp" + android:layout_marginTop="3dp" + android:src="@drawable/ic_article_comment_top" + app:layout_constraintStart_toStartOf="@id/userNameTv" + app:layout_constraintTop_toBottomOf="@id/userNameTv" + tools:visibility="gone" /> - - - - - - - - - - - - - - - - + android:textSize="11sp" + app:layout_constraintStart_toEndOf="@+id/topLabelIv" + app:layout_constraintTop_toBottomOf="@id/userNameTv" + tools:text="一个小时前" /> - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_article_detail_comment_footer.xml b/app/src/main/res/layout/item_article_detail_comment_footer.xml index 641ebd6375..dab8870a89 100644 --- a/app/src/main/res/layout/item_article_detail_comment_footer.xml +++ b/app/src/main/res/layout/item_article_detail_comment_footer.xml @@ -1,33 +1,30 @@ - + - + android:layout_height="48dp" + android:gravity="center" + android:orientation="horizontal"> - + - + + - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/item_category.xml b/app/src/main/res/layout/item_category.xml index 6a687aae29..c12219c9b8 100644 --- a/app/src/main/res/layout/item_category.xml +++ b/app/src/main/res/layout/item_category.xml @@ -1,107 +1,90 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> - - - - - - - - - - + android:layout_height="8dp" + android:background="@color/background" /> - + + + android:layout_height="wrap_content" + android:layout_marginTop="37dp"> + + + + + + + + + + + + + + + + + android:layout_height="37dp" + android:layout_below="@id/container_category"> - - - - - - - - - - - - - - - - - - - - - - - + android:layout_alignParentBottom="true" + android:layout_centerHorizontal="true" + android:paddingLeft="20dp" + android:paddingTop="20dp" + android:paddingRight="20dp" + android:paddingBottom="10dp" + android:src="@drawable/ic_category_arrow_down" + android:visibility="gone" + tools:visibility="visible" /> - - \ No newline at end of file + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_comment_picture.xml b/app/src/main/res/layout/item_comment_picture.xml index 228f4ea689..e3990273f3 100644 --- a/app/src/main/res/layout/item_comment_picture.xml +++ b/app/src/main/res/layout/item_comment_picture.xml @@ -1,32 +1,22 @@ - + - + - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/item_filter_commodity_size.xml b/app/src/main/res/layout/item_filter_commodity_size.xml index a2cfd91aae..60fdf7bf4b 100644 --- a/app/src/main/res/layout/item_filter_commodity_size.xml +++ b/app/src/main/res/layout/item_filter_commodity_size.xml @@ -1,21 +1,19 @@ - - + - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_forum_follow.xml b/app/src/main/res/layout/item_forum_follow.xml index b2d3f5ce03..4c1df92c51 100644 --- a/app/src/main/res/layout/item_forum_follow.xml +++ b/app/src/main/res/layout/item_forum_follow.xml @@ -1,49 +1,41 @@ - + - - - + - + - - - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_forum_video.xml b/app/src/main/res/layout/item_forum_video.xml index f476746c62..c045ba238c 100644 --- a/app/src/main/res/layout/item_forum_video.xml +++ b/app/src/main/res/layout/item_forum_video.xml @@ -1,106 +1,89 @@ - + - + - + - - - - + android:layout_margin="4dp" + android:background="@drawable/bg_shape_black_alpha_30_radius_2" + android:gravity="center" + android:includeFontPadding="false" + android:paddingLeft="2dp" + android:paddingTop="1dp" + android:paddingRight="2dp" + android:paddingBottom="1dp" + android:textColor="@color/white" + android:textSize="10sp" + app:layout_constraintBottom_toBottomOf="@+id/video_poster" + app:layout_constraintEnd_toEndOf="@+id/video_poster" /> - + - + - - - - - - - + - - \ No newline at end of file + diff --git a/app/src/main/res/layout/item_game_detail_latest_service.xml b/app/src/main/res/layout/item_game_detail_latest_service.xml index 33ac890c10..f17698073f 100644 --- a/app/src/main/res/layout/item_game_detail_latest_service.xml +++ b/app/src/main/res/layout/item_game_detail_latest_service.xml @@ -1,39 +1,37 @@ - + - + - + - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/item_game_detail_rating_comment.xml b/app/src/main/res/layout/item_game_detail_rating_comment.xml index 365180ef3f..3111679a29 100644 --- a/app/src/main/res/layout/item_game_detail_rating_comment.xml +++ b/app/src/main/res/layout/item_game_detail_rating_comment.xml @@ -1,185 +1,163 @@ - + - - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_marginLeft="8dp" + android:layout_marginRight="12dp" + android:gravity="left" + android:orientation="horizontal" + app:layout_constraintBottom_toTopOf="@+id/rating_start" + app:layout_constraintLeft_toRightOf="@+id/user_icon_container" + app:layout_constraintRight_toLeftOf="@+id/more" + app:layout_constraintTop_toTopOf="@+id/user_icon_container"> + + + + - - - - - - + app:layout_constraintTop_toTopOf="@id/sdv_user_badge" + tools:text="答题先锋" /> - + + + + + + + + + + + + diff --git a/app/src/main/res/layout/item_game_detail_related_version.xml b/app/src/main/res/layout/item_game_detail_related_version.xml index 4bcd3c1019..1a67cabfba 100644 --- a/app/src/main/res/layout/item_game_detail_related_version.xml +++ b/app/src/main/res/layout/item_game_detail_related_version.xml @@ -1,50 +1,39 @@ - + - + - - + - + - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/item_game_libao.xml b/app/src/main/res/layout/item_game_libao.xml index 485e40fb97..c03bfe2640 100644 --- a/app/src/main/res/layout/item_game_libao.xml +++ b/app/src/main/res/layout/item_game_libao.xml @@ -1,116 +1,114 @@ - + - + android:drawableLeft="@drawable/ic_game_detail_libao" + android:drawablePadding="4dp" + android:textColor="@color/text_title" + android:textSize="13sp" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:text="新春大礼包" /> - + + - - - - - - - - - - - - - - - - + + + + + + + - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_game_raiders.xml b/app/src/main/res/layout/item_game_raiders.xml index 1a49618803..f0814195ed 100644 --- a/app/src/main/res/layout/item_game_raiders.xml +++ b/app/src/main/res/layout/item_game_raiders.xml @@ -1,64 +1,62 @@ - + - + - + - + - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_history_apk.xml b/app/src/main/res/layout/item_history_apk.xml index 8f94d8b1d4..1f85405cb3 100644 --- a/app/src/main/res/layout/item_history_apk.xml +++ b/app/src/main/res/layout/item_history_apk.xml @@ -1,79 +1,67 @@ - + - + - - + - + + + android:layout_marginTop="11dp" + android:includeFontPadding="false" + android:lineSpacingExtra="4dp" + android:maxLines="3" + android:textColor="@color/text_title" + android:textSize="13sp" + app:endText="... " + app:expandText="展开" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toBottomOf="@id/downloadBtn" + app:useGradientAlphaEndText="true" /> - - - - - - - - - - - \ No newline at end of file + diff --git a/app/src/main/res/layout/item_home_played_game.xml b/app/src/main/res/layout/item_home_played_game.xml deleted file mode 100644 index 4d29517d4c..0000000000 --- a/app/src/main/res/layout/item_home_played_game.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/item_my_game_collection.xml b/app/src/main/res/layout/item_my_game_collection.xml index 1bffc6f03d..7aa98f718a 100644 --- a/app/src/main/res/layout/item_my_game_collection.xml +++ b/app/src/main/res/layout/item_my_game_collection.xml @@ -1,171 +1,152 @@ - + - - - - - - - - - + + + + + android:layout_marginLeft="16dp" + android:layout_marginTop="18dp" + android:layout_marginRight="16dp" + android:ellipsize="end" + android:includeFontPadding="false" + android:maxLines="2" + android:textColor="@color/white" + android:textSize="@dimen/secondary_title_text_size" + app:layout_constraintEnd_toStartOf="@+id/actionContainer" + app:layout_constraintStart_toStartOf="@+id/posterView" + app:layout_constraintTop_toTopOf="@+id/posterView" + tools:text="刺激游戏大合集" /> - + - + - + - + - + - + + - + - + + - - + - + + + - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/item_my_game_rating.xml b/app/src/main/res/layout/item_my_game_rating.xml index 2f96abeb03..6ba7e21423 100644 --- a/app/src/main/res/layout/item_my_game_rating.xml +++ b/app/src/main/res/layout/item_my_game_rating.xml @@ -1,202 +1,185 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@color/white" + android:orientation="vertical" + android:paddingLeft="20dp" + android:paddingTop="16dp" + android:paddingRight="20dp"> - - - - - - - - + android:background="@color/white"> - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@+id/gameScoreRl" + app:layout_constraintStart_toEndOf="@+id/gameIconRl" + app:layout_constraintTop_toTopOf="parent"> - - - - + android:textSize="14sp" + android:textStyle="bold" + fresco:text="冒险岛3" /> + + + + + + + + android:layout_centerInParent="true" + android:textColor="@android:color/white" + android:textSize="10sp" + fresco:text="评分过少" /> + - - - - + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/item_qa_feedback_reason.xml b/app/src/main/res/layout/item_qa_feedback_reason.xml index ba29862492..66dc757911 100644 --- a/app/src/main/res/layout/item_qa_feedback_reason.xml +++ b/app/src/main/res/layout/item_qa_feedback_reason.xml @@ -1,26 +1,17 @@ - - - - + - - - - - \ No newline at end of file + + diff --git a/app/src/main/res/layout/item_user_comment_history.xml b/app/src/main/res/layout/item_user_comment_history.xml index b5042ed9ad..741d45fb0d 100644 --- a/app/src/main/res/layout/item_user_comment_history.xml +++ b/app/src/main/res/layout/item_user_comment_history.xml @@ -1,182 +1,160 @@ - + - - + - - - - - - + android:layout_marginTop="16dp" + android:background="@drawable/bg_user_comment_game_info" + android:orientation="vertical"> - + - + + + + + + + + + + + + + + android:layout_marginTop="18dp" + android:ellipsize="end" + android:includeFontPadding="false" + android:lineSpacingExtra="4dp" + android:maxLines="4" + android:textColor="@color/text_subtitle" + android:textSize="13sp" + app:endText="... " + app:expandText="全部" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toBottomOf="@+id/rating_start" + app:useGradientAlphaEndText="true" + tools:text="面提升中希合作交流水平 推动金砖峰会取得丰硕成果,写在习近平主席对希腊进行国事访问并赴巴西出席金砖国家领导人第十一次会晤之际 " /> - + - + - + + + - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/item_video_desc_top.xml b/app/src/main/res/layout/item_video_desc_top.xml index e7c73bb8f5..5b843a6444 100644 --- a/app/src/main/res/layout/item_video_desc_top.xml +++ b/app/src/main/res/layout/item_video_desc_top.xml @@ -1,282 +1,247 @@ - + - - - - - - - - - + app:avatar_width="32dp" + app:badge_width="10dp" + app:border_color="@color/transparent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:layout_height="48dp" + tools:layout_width="48dp" /> + - + + + + + + + + + + + + + + + + + + + + + + + android:textSize="12sp" /> + - + + + + android:textSize="12sp" /> + + + + + - - - - - - - - - - - - - - - + android:layout_marginTop="8dp" + android:includeFontPadding="false" + android:textColor="@color/text_subtitleDesc" + android:textSize="12sp" /> + - + - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + diff --git a/app/src/main/res/layout/item_within_game_gallery_slide.xml b/app/src/main/res/layout/item_within_game_gallery_slide.xml index fc728b69e3..0d8df86b2e 100644 --- a/app/src/main/res/layout/item_within_game_gallery_slide.xml +++ b/app/src/main/res/layout/item_within_game_gallery_slide.xml @@ -1,23 +1,13 @@ - + - + - - + - - - - - - diff --git a/app/src/main/res/layout/kaifu_detail_item_row.xml b/app/src/main/res/layout/kaifu_detail_item_row.xml index e52f20602c..f5ffcd3c39 100644 --- a/app/src/main/res/layout/kaifu_detail_item_row.xml +++ b/app/src/main/res/layout/kaifu_detail_item_row.xml @@ -1,73 +1,45 @@ - + - + - + - + - - - - - - - - - - - - - - - - - - - + diff --git a/app/src/main/res/layout/local_video_item.xml b/app/src/main/res/layout/local_video_item.xml index 6ec7896003..99cd335cf6 100644 --- a/app/src/main/res/layout/local_video_item.xml +++ b/app/src/main/res/layout/local_video_item.xml @@ -1,58 +1,56 @@ - + - + android:layout_height="0dp" + app:layout_constraintDimensionRatio="w,1:1" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:roundedCornerRadius="2dp" + app:roundingBorderColor="@color/black_alpha_10" + app:roundingBorderWidth="0.5dp" /> - + - + - + + - - - diff --git a/app/src/main/res/layout/message_item.xml b/app/src/main/res/layout/message_item.xml index 465239932e..0cd2ad6860 100644 --- a/app/src/main/res/layout/message_item.xml +++ b/app/src/main/res/layout/message_item.xml @@ -1,183 +1,168 @@ - + - + - - - + + + + + + + + + + + + + + + + + + - + android:id="@+id/message_data_icon_container" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> + android:id="@+id/message_ask_icon" + android:layout_width="51dp" + android:layout_height="34dp" + android:layout_centerVertical="true" + app:fadeDuration="500" + app:placeholderImage="@drawable/message_ask_placeholder" + app:placeholderImageScaleType="fitXY" /> - + android:id="@+id/message_article_icon" + android:layout_width="51dp" + android:layout_height="34dp" + android:layout_centerVertical="true" + android:visibility="gone" + app:fadeDuration="500" + app:placeholderImage="@drawable/message_article_placeholder" + app:placeholderImageScaleType="fitXY" /> - + + + + android:id="@+id/message_original_title" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerVertical="true" + android:layout_marginLeft="10dp" + android:layout_marginRight="10dp" + android:layout_toRightOf="@+id/message_data_icon_container" + android:ellipsize="end" + android:maxLines="2" + android:textColor="@color/title" + android:textSize="12sp" /> + - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/app/src/main/res/layout/message_item_top.xml b/app/src/main/res/layout/message_item_top.xml index c0e1ce3cd5..426aabf671 100644 --- a/app/src/main/res/layout/message_item_top.xml +++ b/app/src/main/res/layout/message_item_top.xml @@ -1,206 +1,192 @@ - + - + - - - - - - - + android:layout_marginTop="16dp" + android:src="@drawable/message_vote_icon" + app:layout_constraintBottom_toTopOf="@+id/message_vote_name" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_chainStyle="packed" /> - - - - - - - - - - - + android:layout_marginLeft="14dp" + android:layout_marginTop="10dp" + android:background="@drawable/message_unread_hint" + android:gravity="center" + android:maxLength="3" + android:minWidth="13dp" + android:minHeight="1dp" + android:paddingLeft="4dp" + android:paddingRight="4dp" + android:textColor="@android:color/white" + android:textSize="9dp" + android:visibility="gone" + app:layout_constraintStart_toStartOf="@+id/guideline_vote" + app:layout_constraintTop_toTopOf="parent" /> - + - - - - - - - - - + android:layout_marginTop="8dp" + android:layout_marginBottom="16dp" + android:includeFontPadding="false" + android:text="赞同" + android:textColor="@color/text_title" + android:textSize="14sp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toBottomOf="@id/message_vote_icon" /> - + - + - + - + - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/moderator_list_item.xml b/app/src/main/res/layout/moderator_list_item.xml index b0cc748f4e..e3f87ceb1d 100644 --- a/app/src/main/res/layout/moderator_list_item.xml +++ b/app/src/main/res/layout/moderator_list_item.xml @@ -1,91 +1,68 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@drawable/reuse_listview_item_style" + android:gravity="center_vertical" + android:paddingLeft="16dp" + android:paddingTop="12dp" + android:paddingRight="16dp" + android:paddingBottom="12dp"> - + - - - - - - - - - - - - - - - - - - + android:layout_marginStart="12dp" + android:layout_marginEnd="12dp" + android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@+id/followTv" + app:layout_constraintStart_toEndOf="@+id/userIcon" + app:layout_constraintTop_toTopOf="parent"> + + - - \ No newline at end of file + tools:text="@string/app_name" /> + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/novice_task_item.xml b/app/src/main/res/layout/novice_task_item.xml index c2143dd993..e31cb78919 100644 --- a/app/src/main/res/layout/novice_task_item.xml +++ b/app/src/main/res/layout/novice_task_item.xml @@ -1,73 +1,63 @@ - - - - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginRight="16dp" + android:gravity="center_horizontal" + android:orientation="vertical"> - + + + android:layout_marginTop="9dp" + android:ellipsize="end" + android:includeFontPadding="false" + android:maxEms="5" + android:maxLines="1" + android:textColor="@color/text_title" + android:textSize="14sp" + app:layout_constraintLeft_toLeftOf="@+id/taskIcon" + app:layout_constraintRight_toLeftOf="@+id/taskNotice" + app:layout_constraintTop_toBottomOf="@+id/taskIcon" + tools:text="绑定手机哈哈哈哈哈哈哈" /> - + - - - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/novice_tasks_item.xml b/app/src/main/res/layout/novice_tasks_item.xml index d329a2d096..fa6966cd47 100644 --- a/app/src/main/res/layout/novice_tasks_item.xml +++ b/app/src/main/res/layout/novice_tasks_item.xml @@ -1,27 +1,23 @@ - + - + android:layout_height="164dp" + android:layout_marginLeft="16dp" + android:layout_marginTop="11dp" + android:layout_marginRight="16dp" + android:background="@drawable/bg_novice_tasks" + android:nestedScrollingEnabled="false" + android:paddingTop="43dp" /> - - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/official_forum_item.xml b/app/src/main/res/layout/official_forum_item.xml index 30ce00b320..c3966385eb 100644 --- a/app/src/main/res/layout/official_forum_item.xml +++ b/app/src/main/res/layout/official_forum_item.xml @@ -1,43 +1,33 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:paddingLeft="16dp" + android:paddingRight="16dp"> - - - + - - - - - - - \ No newline at end of file + android:layout_marginLeft="12dp" + android:ellipsize="end" + android:gravity="center" + android:includeFontPadding="false" + android:singleLine="true" + android:textColor="@color/text_title" + android:textSize="14sp" + app:layout_constraintBottom_toBottomOf="@+id/forumIv" + app:layout_constraintLeft_toRightOf="@+id/forumIv" + app:layout_constraintTop_toTopOf="@+id/forumIv" + tools:text="龙之谷" /> + diff --git a/app/src/main/res/layout/package_check_item.xml b/app/src/main/res/layout/package_check_item.xml index 6eb5243120..4c130bfb13 100644 --- a/app/src/main/res/layout/package_check_item.xml +++ b/app/src/main/res/layout/package_check_item.xml @@ -1,46 +1,37 @@ - + - + - - - - - - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/personal_home_rating.xml b/app/src/main/res/layout/personal_home_rating.xml index d70c3fdef9..b262489e1b 100644 --- a/app/src/main/res/layout/personal_home_rating.xml +++ b/app/src/main/res/layout/personal_home_rating.xml @@ -1,131 +1,115 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@drawable/reuse_listview_item_style" + android:orientation="vertical" + android:paddingLeft="15dp" + android:paddingTop="11dp" + android:paddingRight="20dp"> - + - + - - - - + android:layout_marginLeft="5dp" + android:layout_marginTop="2dp" + android:ellipsize="end" + android:includeFontPadding="false" + android:lineSpacingExtra="4dp" + android:maxLines="3" + android:textColor="@color/text_subtitle" + android:textSize="13sp" + app:endText="... " + app:expandText="全部" + app:layout_constraintTop_toBottomOf="@id/user_icon" + app:useGradientAlphaEndText="true" /> - + - - - - - - - + - + - - + diff --git a/app/src/main/res/layout/photo_poster_item.xml b/app/src/main/res/layout/photo_poster_item.xml index acd249ffc6..9d5de72ce6 100644 --- a/app/src/main/res/layout/photo_poster_item.xml +++ b/app/src/main/res/layout/photo_poster_item.xml @@ -1,29 +1,27 @@ - + - + android:layout_height="wrap_content" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:viewAspectRatio="1" /> - + - + - - diff --git a/app/src/main/res/layout/piece_article_detail_comment_filter.xml b/app/src/main/res/layout/piece_article_detail_comment_filter.xml index b8f6abf064..bbc6aeaaa2 100644 --- a/app/src/main/res/layout/piece_article_detail_comment_filter.xml +++ b/app/src/main/res/layout/piece_article_detail_comment_filter.xml @@ -1,87 +1,84 @@ - + - + + + + + + + + + + + android:layout_height="0.5dp" + android:background="@color/divider" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - - - - - - - - - - - - - - + diff --git a/app/src/main/res/layout/piece_community_vote_and_comment.xml b/app/src/main/res/layout/piece_community_vote_and_comment.xml index d978cd2bf9..11c6436782 100644 --- a/app/src/main/res/layout/piece_community_vote_and_comment.xml +++ b/app/src/main/res/layout/piece_community_vote_and_comment.xml @@ -1,79 +1,76 @@ - + - + - - - - - - - + android:paddingTop="20dp" + android:paddingBottom="20dp" + android:textColor="@color/text_subtitleDesc" + android:textSize="12sp" + tools:text="16" /> - + - + - + - - - + android:layout_centerInParent="true" + android:src="@drawable/community_vote_selector" /> - - - \ No newline at end of file + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/privacy_item.xml b/app/src/main/res/layout/privacy_item.xml index 87f34ec05f..76b13e58c3 100644 --- a/app/src/main/res/layout/privacy_item.xml +++ b/app/src/main/res/layout/privacy_item.xml @@ -1,59 +1,46 @@ - + - + - - - - + android:layout_marginLeft="12dp" + android:layout_marginRight="12dp" + android:includeFontPadding="false" + android:textColor="@color/text_title" + android:textSize="16sp" + android:textStyle="bold" + app:layout_constraintLeft_toRightOf="@id/icon" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + - - - - - - + diff --git a/app/src/main/res/layout/question_edit_title_search_item.xml b/app/src/main/res/layout/question_edit_title_search_item.xml index a6ae73f996..bd3084fdfa 100644 --- a/app/src/main/res/layout/question_edit_title_search_item.xml +++ b/app/src/main/res/layout/question_edit_title_search_item.xml @@ -1,50 +1,39 @@ - - - - + - + - + - - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/question_history_item.xml b/app/src/main/res/layout/question_history_item.xml index e97a9763dd..41eb33b188 100644 --- a/app/src/main/res/layout/question_history_item.xml +++ b/app/src/main/res/layout/question_history_item.xml @@ -1,56 +1,44 @@ - + - + - - + - + - - - - - - - - + diff --git a/app/src/main/res/layout/questioninvite_header_item.xml b/app/src/main/res/layout/questioninvite_header_item.xml index af312b0f13..2868e6ed15 100644 --- a/app/src/main/res/layout/questioninvite_header_item.xml +++ b/app/src/main/res/layout/questioninvite_header_item.xml @@ -1,31 +1,20 @@ - + - - - - - - - - - - \ No newline at end of file + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:background="@color/background" + android:gravity="center_vertical" + android:paddingLeft="20dp" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:textColor="@color/title" + android:textSize="11sp" + tools:text="系统推荐" /> + diff --git a/app/src/main/res/layout/questions_history_detail.xml b/app/src/main/res/layout/questions_history_detail.xml index 6efb1ca6e1..92c6bca68b 100644 --- a/app/src/main/res/layout/questions_history_detail.xml +++ b/app/src/main/res/layout/questions_history_detail.xml @@ -1,208 +1,182 @@ - + - + - + - + - + - + - + - + - + + android:id="@+id/question_history_picll" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="20dp" + android:layout_marginTop="8dp" + android:layout_marginRight="20dp"> - + - + - + + + + + android:id="@+id/question_history_time" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + android:textColor="@color/title" + android:textSize="12sp" /> - + + - + - - - - - - + + android:id="@+id/question_history_next" + android:layout_width="0dp" + android:layout_height="50dp" + android:layout_weight="1" + android:background="@android:color/white" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toLeftOf="@+id/question_history_line_center" + app:layout_constraintTop_toTopOf="@+id/question_history_line_center"> + android:id="@+id/question_history_next_tv" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center" + android:textColor="@color/title" + android:textSize="14sp" /> - - + + android:id="@+id/question_history_line_center" + android:layout_width="1dp" + android:layout_height="50dp" + android:background="@color/cutting_line" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toBottomOf="@id/question_history_line_top" /> - + - + + - - - - - - - - - - - - - - - - + + + + diff --git a/app/src/main/res/layout/rating_comment_item.xml b/app/src/main/res/layout/rating_comment_item.xml index 057f627e3c..1ac001e2ef 100644 --- a/app/src/main/res/layout/rating_comment_item.xml +++ b/app/src/main/res/layout/rating_comment_item.xml @@ -1,346 +1,314 @@ - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_marginRight="8dp" + android:orientation="horizontal" + app:layout_constraintBottom_toTopOf="@+id/rating_start" + app:layout_constraintLeft_toRightOf="@+id/user_icon" + app:layout_constraintRight_toLeftOf="@+id/more" + app:layout_constraintTop_toTopOf="@+id/user_icon"> - - - - - - - + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toLeftOf="@+id/sdv_user_badge" + app:layout_constraintTop_toTopOf="parent" + tools:text="用户名" /> + + + android:visibility="gone" + app:layout_constrainedWidth="true" + app:layout_constraintBottom_toBottomOf="@id/sdv_user_badge" + app:layout_constraintLeft_toRightOf="@id/sdv_user_badge" + app:layout_constraintRight_toLeftOf="@+id/badge" + app:layout_constraintTop_toTopOf="@id/sdv_user_badge" + tools:text="答题先锋" /> + - - - - - - - - - - - - - - - - - - + app:layout_constraintTop_toTopOf="@id/tv_badge_name" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/rating_item.xml b/app/src/main/res/layout/rating_item.xml index df8384e61a..55660dc3bd 100644 --- a/app/src/main/res/layout/rating_item.xml +++ b/app/src/main/res/layout/rating_item.xml @@ -1,433 +1,425 @@ - + - + - - - + - - - + android:orientation="vertical"> + + + + + + + + + + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginLeft="40dp" + android:layout_weight="1" + android:orientation="vertical"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - + android:layout_marginTop="5dp" + android:gravity="center_vertical" + android:orientation="horizontal"> - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + android:orientation="horizontal"> - + - + + - + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + - - - - diff --git a/app/src/main/res/layout/rating_reply_head_item.xml b/app/src/main/res/layout/rating_reply_head_item.xml index 3e947d72b9..e73470d4d2 100644 --- a/app/src/main/res/layout/rating_reply_head_item.xml +++ b/app/src/main/res/layout/rating_reply_head_item.xml @@ -1,100 +1,87 @@ - + - + - - + + + + android:layout_marginRight="16dp" + android:layout_weight="1" + android:orientation="vertical"> - - - - - - - - - - - - - + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + - - + android:layout_alignBottom="@id/game_name" + android:layout_centerVertical="true" + android:layout_marginBottom="2dp" + android:maxLines="1" + android:paddingLeft="3dp" + android:paddingRight="3dp" + android:paddingBottom="0.5dp" + android:textColor="@android:color/white" + android:textSize="9sp" + android:visibility="gone" /> + + android:id="@+id/game_info" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="7dp" + android:textColor="@color/hint" + android:textSize="11sp" /> + - + + + + diff --git a/app/src/main/res/layout/rating_reply_item.xml b/app/src/main/res/layout/rating_reply_item.xml index 1f3f077e2e..2a789e7acd 100644 --- a/app/src/main/res/layout/rating_reply_item.xml +++ b/app/src/main/res/layout/rating_reply_item.xml @@ -1,181 +1,147 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> - - - - - - - - - - - - - - + android:background="@android:color/white" + android:paddingLeft="11dp" + android:paddingRight="20dp"> - + + + + + + + + + + + + + + android:layout_marginLeft="9dp" + android:lineSpacingExtra="4dp" + android:textColor="@color/text_3a3a3a" + android:textSize="13sp" + app:layout_constraintTop_toBottomOf="@+id/user_icon" + tools:text="每个评论的正文,最多显示4行,超过则使用省略号…全部,点击[全部]即可展开余下全文" /> - + - + - - + - - - - - - - - - - - - - - - - - - + + \ No newline at end of file diff --git a/app/src/main/res/layout/reuse_loading.xml b/app/src/main/res/layout/reuse_loading.xml index 572d37cf12..f75775d4c3 100644 --- a/app/src/main/res/layout/reuse_loading.xml +++ b/app/src/main/res/layout/reuse_loading.xml @@ -1,19 +1,16 @@ - + - + - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/reuse_no_connection.xml b/app/src/main/res/layout/reuse_no_connection.xml index 2b35613b7f..30bbe14add 100644 --- a/app/src/main/res/layout/reuse_no_connection.xml +++ b/app/src/main/res/layout/reuse_no_connection.xml @@ -1,37 +1,34 @@ - + - + + + android:text="@string/loading_network_error" + android:textColor="@color/c7c7c7" + android:textSize="15sp" /> - + - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/reuse_nodata_skip.xml b/app/src/main/res/layout/reuse_nodata_skip.xml index 50384cb928..c641fac583 100644 --- a/app/src/main/res/layout/reuse_nodata_skip.xml +++ b/app/src/main/res/layout/reuse_nodata_skip.xml @@ -1,32 +1,29 @@ - + - + android:text="@string/game_none" + android:textColor="@color/btn_pause" + android:textSize="15sp" /> - + - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/reuse_toolbar.xml b/app/src/main/res/layout/reuse_toolbar.xml index 762613a4aa..b93500986b 100644 --- a/app/src/main/res/layout/reuse_toolbar.xml +++ b/app/src/main/res/layout/reuse_toolbar.xml @@ -1,116 +1,113 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/normal_toolbar_container" + android:layout_width="match_parent" + android:layout_height="@dimen/appbar_height"> - + android:layout_height="match_parent" + app:contentInsetEnd="0dp" + app:contentInsetStartWithNavigation="0dp" + app:navigationIcon="@null"> - + android:orientation="horizontal"> + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/search_default_hot_item.xml b/app/src/main/res/layout/search_default_hot_item.xml index 165506131d..6b6c8f1b24 100644 --- a/app/src/main/res/layout/search_default_hot_item.xml +++ b/app/src/main/res/layout/search_default_hot_item.xml @@ -1,67 +1,54 @@ - + - + - + - - - - - + android:layout_marginLeft="8dp" + android:ellipsize="end" + android:maxLines="1" + android:textSize="12sp" + app:layout_constrainedWidth="true" + app:layout_constraintBottom_toBottomOf="@+id/icon" + app:layout_constraintEnd_toStartOf="@+id/labelIv" + app:layout_constraintHorizontal_bias="0" + app:layout_constraintHorizontal_chainStyle="packed" + app:layout_constraintStart_toEndOf="@+id/icon" + app:layout_constraintTop_toTopOf="@+id/icon" /> - + - - - - - - - - + diff --git a/app/src/main/res/layout/search_game_footer.xml b/app/src/main/res/layout/search_game_footer.xml index 0ec499bc9c..19384a63bd 100644 --- a/app/src/main/res/layout/search_game_footer.xml +++ b/app/src/main/res/layout/search_game_footer.xml @@ -1,53 +1,51 @@ - + - + + + android:layout_marginTop="15dp" + android:gravity="center" + android:paddingLeft="16dp" + android:paddingRight="16dp"> + android:text="求游戏" + android:textColor="@android:color/white" + android:textSize="14sp" /> - + + + - - - - - - diff --git a/app/src/main/res/layout/search_game_horizontal_item.xml b/app/src/main/res/layout/search_game_horizontal_item.xml deleted file mode 100644 index 3212c5aa8c..0000000000 --- a/app/src/main/res/layout/search_game_horizontal_item.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/search_game_index_item.xml b/app/src/main/res/layout/search_game_index_item.xml index 23bf30cfcc..5778505776 100644 --- a/app/src/main/res/layout/search_game_index_item.xml +++ b/app/src/main/res/layout/search_game_index_item.xml @@ -1,50 +1,39 @@ - + - - + - - + - + android:orientation="horizontal" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:paddingBottom="16dp" /> - - - - - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/search_subject_item.xml b/app/src/main/res/layout/search_subject_item.xml index 99761afc25..8effa1127d 100644 --- a/app/src/main/res/layout/search_subject_item.xml +++ b/app/src/main/res/layout/search_subject_item.xml @@ -1,67 +1,65 @@ - - + + + + + android:gravity="center_vertical" + android:orientation="horizontal" + android:paddingLeft="16dp" + android:paddingTop="16dp" + android:paddingRight="21dp"> - - - + android:includeFontPadding="false" + android:textColor="@color/text_title" + android:textSize="16sp" + android:textStyle="bold" + tools:text="人气手游风向标" /> - - - - - - - - + - \ No newline at end of file + + + + + diff --git a/app/src/main/res/layout/stairs_comment_item.xml b/app/src/main/res/layout/stairs_comment_item.xml index beeaef9d82..e3c013412c 100644 --- a/app/src/main/res/layout/stairs_comment_item.xml +++ b/app/src/main/res/layout/stairs_comment_item.xml @@ -1,208 +1,205 @@ - + - + android:layout_marginLeft="8.5dp"> + + + android:layout_alignTop="@id/comment_user_icon" + android:layout_marginLeft="2.5dp" + android:layout_toRightOf="@+id/comment_user_icon"> - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_marginRight="4dp" + android:layout_toLeftOf="@id/command_container"> - - - + android:textSize="13sp" + app:layout_constrainedWidth="true" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@+id/comment_author" + app:layout_constraintHorizontal_bias="0" + app:layout_constraintHorizontal_chainStyle="packed" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:text="孙一峰" /> + + + + + + - - + android:layout_alignParentRight="true" + android:layout_marginRight="4dp" + android:orientation="vertical"> - - - - + android:id="@+id/comment_like_container" + android:layout_width="40dp" + android:layout_height="40dp" + android:gravity="center" + android:orientation="vertical" + android:paddingLeft="10dp" + android:paddingTop="4dp" + android:paddingRight="10dp" + android:paddingBottom="4dp"> + + + android:includeFontPadding="false" + android:textColor="@color/text_subtitle" + android:textSize="12sp" + tools:text="20" /> + + + + + + - - \ No newline at end of file + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/sub_catalog_item.xml b/app/src/main/res/layout/sub_catalog_item.xml index c3a65d15a8..3318ddb489 100644 --- a/app/src/main/res/layout/sub_catalog_item.xml +++ b/app/src/main/res/layout/sub_catalog_item.xml @@ -1,63 +1,51 @@ - + - - - + - + - + - - - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/sub_category_item.xml b/app/src/main/res/layout/sub_category_item.xml index 15c532c507..26986d676d 100644 --- a/app/src/main/res/layout/sub_category_item.xml +++ b/app/src/main/res/layout/sub_category_item.xml @@ -1,46 +1,37 @@ - + - - - - + - + - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/task_bottom_item.xml b/app/src/main/res/layout/task_bottom_item.xml index aa9beac9b4..1a846cf3c5 100644 --- a/app/src/main/res/layout/task_bottom_item.xml +++ b/app/src/main/res/layout/task_bottom_item.xml @@ -1,10 +1,7 @@ - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/task_title_item.xml b/app/src/main/res/layout/task_title_item.xml index f4418f6168..4b46898e74 100644 --- a/app/src/main/res/layout/task_title_item.xml +++ b/app/src/main/res/layout/task_title_item.xml @@ -1,23 +1,21 @@ - - + + + android:layout_height="35dp" + android:layout_marginTop="12dp" + android:background="@drawable/bg_task_top" /> - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/user_history_item.xml b/app/src/main/res/layout/user_history_item.xml index 5b27167e5a..4f7df0d30a 100644 --- a/app/src/main/res/layout/user_history_item.xml +++ b/app/src/main/res/layout/user_history_item.xml @@ -1,325 +1,297 @@ - - - - - - - - - - - - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + android:layout_height="wrap_content" + android:background="@color/white" + android:paddingLeft="11dp" + android:paddingRight="20dp" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent"> - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + app:layout_constraintTop_toTopOf="@id/user_icon" /> + app:layout_constraintBottom_toBottomOf="@id/user_icon" + app:layout_constraintLeft_toRightOf="@id/user_icon" + app:layout_constraintTop_toBottomOf="@id/user_name"> - - - - - - - - - - - - - - - - + android:alpha="0.6" + android:includeFontPadding="false" + android:text="关注的人" + android:textColor="@color/theme_font" + android:textSize="11sp" + android:visibility="gone" /> + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/user_home_amway_item.xml b/app/src/main/res/layout/user_home_amway_item.xml deleted file mode 100644 index 997c1b2f3d..0000000000 --- a/app/src/main/res/layout/user_home_amway_item.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/user_search_list_item.xml b/app/src/main/res/layout/user_search_list_item.xml index 68814a3843..9a94cb3d68 100644 --- a/app/src/main/res/layout/user_search_list_item.xml +++ b/app/src/main/res/layout/user_search_list_item.xml @@ -1,147 +1,124 @@ - + - - + - - + - + android:layout_marginLeft="12dp" + android:ellipsize="end" + android:maxLength="12" + android:maxLines="1" + android:textColor="@color/text_title" + app:layout_constrainedWidth="true" + app:layout_constraintBottom_toTopOf="@+id/userSignatureTv" + app:layout_constraintEnd_toStartOf="@+id/user_badge_icon" + app:layout_constraintHorizontal_bias="0" + app:layout_constraintHorizontal_chainStyle="packed" + app:layout_constraintStart_toEndOf="@+id/userAvatar" + app:layout_constraintTop_toTopOf="@+id/userAvatar" + tools:text="我的名字很长我的名字很长我的名字很长" /> + - + - + - + - + - + - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/video_item.xml b/app/src/main/res/layout/video_item.xml index 84ba2b001c..4760d48f70 100644 --- a/app/src/main/res/layout/video_item.xml +++ b/app/src/main/res/layout/video_item.xml @@ -1,49 +1,47 @@ - + - + + + + android:layout_marginLeft="8dp" + android:layout_marginBottom="8dp" + android:src="@drawable/video_like" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" /> - + + - - - - - - diff --git a/app/src/main/res/layout/video_label_item.xml b/app/src/main/res/layout/video_label_item.xml index c529c35453..2eacc17561 100644 --- a/app/src/main/res/layout/video_label_item.xml +++ b/app/src/main/res/layout/video_label_item.xml @@ -1,64 +1,54 @@ - + - - - - - - + android:layout_marginRight="16dp" + android:drawableLeft="@drawable/ic_choose_activity" + android:drawablePadding="8dp" + android:ellipsize="end" + android:lineSpacingExtra="8dp" + android:maxLines="1" + android:textColor="@color/text_title" + android:textSize="16sp" + app:layout_constraintEnd_toStartOf="@+id/selectedIv" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:text="发现好游戏计划" /> - + - - - - - \ No newline at end of file + + diff --git a/app/src/main/res/layout/video_new_item.xml b/app/src/main/res/layout/video_new_item.xml index d9ff190140..8addef4ee3 100644 --- a/app/src/main/res/layout/video_new_item.xml +++ b/app/src/main/res/layout/video_new_item.xml @@ -1,176 +1,157 @@ - + - - - - - - - - - - + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + + + + - - - - - - - - - - - - - - - - - - - - + app:layout_constraintStart_toStartOf="parent"> + + + + + app:layout_constraintTop_toTopOf="@+id/video_comment_count" /> - + + + + + + + + + + + diff --git a/app/src/main/res/layout/video_poster_preview_item.xml b/app/src/main/res/layout/video_poster_preview_item.xml index e474ce0001..4b3a243c4a 100644 --- a/app/src/main/res/layout/video_poster_preview_item.xml +++ b/app/src/main/res/layout/video_poster_preview_item.xml @@ -1,42 +1,39 @@ - + - + android:layout_height="60dp" + app:cardCornerRadius="3dp" + app:cardElevation="0dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintTop_toTopOf="parent"> - - - - - - - - - + + + + + diff --git a/app/src/main/res/layout/video_status_item.xml b/app/src/main/res/layout/video_status_item.xml index a4b868c381..144f9335dd 100644 --- a/app/src/main/res/layout/video_status_item.xml +++ b/app/src/main/res/layout/video_status_item.xml @@ -1,32 +1,30 @@ - + - + + + + android:layout_marginTop="4dp" + android:layout_marginRight="4dp" + android:background="@drawable/video_insert_status_background" + android:includeFontPadding="false" + android:paddingLeft="6dp" + android:paddingTop="4dp" + android:paddingRight="6dp" + android:paddingBottom="4dp" + android:textSize="11sp" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + - - - - - diff --git a/app/src/main/res/layout/video_verify_item.xml b/app/src/main/res/layout/video_verify_item.xml index bff41fcf4a..4894d8127b 100644 --- a/app/src/main/res/layout/video_verify_item.xml +++ b/app/src/main/res/layout/video_verify_item.xml @@ -1,70 +1,68 @@ - + - + + + android:layout_marginLeft="8dp" + android:ellipsize="end" + android:lineSpacingExtra="4dp" + android:maxLines="2" + android:minLines="2" + android:textColor="@color/text_title" + android:textSize="13sp" + app:layout_constraintBottom_toTopOf="@id/video_status" + app:layout_constraintLeft_toRightOf="@id/video_cover" + app:layout_constraintRight_toLeftOf="@id/more" + app:layout_constraintTop_toTopOf="@id/video_cover" + app:layout_constraintVertical_chainStyle="packed" + tools:text="元气骑士真好玩!元气骑士真好玩!元气骑士真好玩!元气骑士真好玩!" /> - + - + - + - - - -