Compare commits
11 Commits
v4.0.0
...
v4.0.0-bug
| Author | SHA1 | Date | |
|---|---|---|---|
| 0dcf86ce1c | |||
| 961d4ebb5c | |||
| 54b947504c | |||
| ee7f102d34 | |||
| 135b55f6f9 | |||
| 17782a500f | |||
| 64a64960ac | |||
| d4be850e68 | |||
| 414064699a | |||
| 99878606d5 | |||
| e1cfccfcc0 |
@ -23,7 +23,7 @@ object AppExecutor {
|
||||
@JvmStatic
|
||||
val lightWeightIoExecutor by lazy { Executors.newSingleThreadExecutor() }
|
||||
@JvmStatic
|
||||
val ioExecutor by lazy { Executors.newCachedThreadPool() }
|
||||
val ioExecutor = Executors.newCachedThreadPool() // 用 by lazy 可能影响初始化速度
|
||||
|
||||
class MainThreadExecutor : Executor {
|
||||
private val mainThreadHandler = Handler(Looper.getMainLooper())
|
||||
|
||||
@ -5,6 +5,8 @@ import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.gh.common.util.GsonUtils;
|
||||
import com.gh.common.util.PackageHelper;
|
||||
import com.gh.common.util.PackageUtils;
|
||||
@ -23,8 +25,6 @@ import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
@ -235,7 +235,7 @@ public class Config {
|
||||
}
|
||||
|
||||
public static boolean isGameDomeSwitchOpen() {
|
||||
return getSettings().getGameDomeSwitch().equals("on");
|
||||
return getSettings() != null && getSettings().getGameDomeSwitch().equals("on");
|
||||
}
|
||||
|
||||
public static void fixHideFunction() {
|
||||
|
||||
@ -11,8 +11,6 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.gh.gamecenter.BuildConfig;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.adapter.LibaoDetailAdapter;
|
||||
@ -37,6 +35,7 @@ import org.json.JSONObject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
@ -151,82 +150,6 @@ public class LibaoUtils {
|
||||
});
|
||||
}
|
||||
|
||||
public static void setLiBaoBtnStatus(final TextView libaoBtn, String status, Context context) {
|
||||
libaoBtn.setTextColor(Color.WHITE);
|
||||
if (TextUtils.isEmpty(status)) return;
|
||||
switch (status) {
|
||||
case "ling":
|
||||
libaoBtn.setText(R.string.libao_ling);
|
||||
libaoBtn.setBackgroundResource(R.drawable.button_normal_style);
|
||||
break;
|
||||
case "tao":
|
||||
libaoBtn.setText(R.string.libao_tao);
|
||||
libaoBtn.setBackgroundResource(R.drawable.button_normal_style);
|
||||
break;
|
||||
case "coming":
|
||||
libaoBtn.setText(R.string.libao_coming);
|
||||
libaoBtn.setBackgroundResource(R.drawable.button_normal_border);
|
||||
libaoBtn.setTextColor(context.getResources().getColor(R.color.theme_font));
|
||||
break;
|
||||
case "used_up":
|
||||
libaoBtn.setText(R.string.libao_used_up);
|
||||
libaoBtn.setBackgroundResource(R.drawable.button_normal_border);
|
||||
libaoBtn.setTextColor(context.getResources().getColor(R.color.theme_font));
|
||||
break;
|
||||
case "finish":
|
||||
libaoBtn.setText(R.string.libao_finish);
|
||||
libaoBtn.setBackgroundResource(R.drawable.button_border_gray);
|
||||
libaoBtn.setTextColor(context.getResources().getColor(R.color.button_gray));
|
||||
break;
|
||||
case "linged":
|
||||
libaoBtn.setText(R.string.libao_linged);
|
||||
libaoBtn.setBackgroundResource(R.drawable.button_normal_border);
|
||||
libaoBtn.setTextColor(context.getResources().getColor(R.color.theme_font));
|
||||
break;
|
||||
case "taoed":
|
||||
libaoBtn.setText(R.string.libao_taoed);
|
||||
libaoBtn.setBackgroundResource(R.drawable.button_normal_border);
|
||||
libaoBtn.setTextColor(context.getResources().getColor(R.color.theme_font));
|
||||
break;
|
||||
case "copy":
|
||||
libaoBtn.setText(R.string.libao_copy);
|
||||
libaoBtn.setBackgroundResource(R.drawable.button_normal_style);
|
||||
break;
|
||||
case "repeatLing":
|
||||
libaoBtn.setText(R.string.libao_repeat_ling);
|
||||
libaoBtn.setBackgroundResource(R.drawable.button_normal_border);
|
||||
libaoBtn.setTextColor(context.getResources().getColor(R.color.theme_font));
|
||||
break;
|
||||
case "repeatLinged":
|
||||
libaoBtn.setText(R.string.libao_repeat_ling);
|
||||
libaoBtn.setBackgroundResource(R.drawable.button_normal_style);
|
||||
break;
|
||||
case "repeatTao":
|
||||
libaoBtn.setText(R.string.libao_repeat_tao);
|
||||
libaoBtn.setBackgroundResource(R.drawable.button_normal_border);
|
||||
libaoBtn.setTextColor(context.getResources().getColor(R.color.theme_font));
|
||||
break;
|
||||
case "repeatTaoed":
|
||||
libaoBtn.setText(R.string.libao_repeat_tao);
|
||||
libaoBtn.setBackgroundResource(R.drawable.button_normal_style);
|
||||
break;
|
||||
case "unshelve":
|
||||
libaoBtn.setBackgroundResource(R.drawable.button_border_gray);
|
||||
libaoBtn.setText(R.string.libao_unshelve);
|
||||
libaoBtn.setTextColor(context.getResources().getColor(R.color.button_gray));
|
||||
break;
|
||||
case "check":
|
||||
libaoBtn.setText(R.string.libao_check);
|
||||
libaoBtn.setBackgroundResource(R.drawable.button_normal_style);
|
||||
break;
|
||||
default:
|
||||
libaoBtn.setBackgroundResource(R.drawable.button_border_gray);
|
||||
libaoBtn.setText("异常");
|
||||
libaoBtn.setTextColor(context.getResources().getColor(R.color.button_gray));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setLiBaoBtnStatusRound(final TextView libaoBtn, String status, Context context) {
|
||||
libaoBtn.setTextColor(Color.WHITE);
|
||||
if (TextUtils.isEmpty(status)) return;
|
||||
@ -306,7 +229,7 @@ public class LibaoUtils {
|
||||
public static void initLibaoBtn(final Context context, final TextView libaoBtn, final LibaoEntity libaoEntity,
|
||||
final boolean isInstallRequired, final LibaoDetailAdapter adapter, final String entrance) {
|
||||
String status = libaoEntity.getStatus();
|
||||
setLiBaoBtnStatus(libaoBtn, status, context);
|
||||
setLiBaoBtnStatusRound(libaoBtn, status, context);
|
||||
|
||||
libaoBtn.setOnClickListener(v -> {
|
||||
String btnStatus = libaoBtn.getText().toString();
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.gh.common.util
|
||||
|
||||
import java.sql.Timestamp
|
||||
import java.text.ParseException
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
@ -57,4 +56,21 @@ object TimeUtils {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断时间戳是多少天前
|
||||
*/
|
||||
fun getBeforeDays(timestamp: Long):Int{
|
||||
var days: Long = 0
|
||||
val format = SimpleDateFormat("yyyyMMdd HH:mm", Locale.getDefault())
|
||||
try {
|
||||
val today = format.parse(format.format(Date())).time
|
||||
val day = timestamp * 1000
|
||||
days = (today - day) / 86400000
|
||||
} catch (e: ParseException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
return days.toInt()
|
||||
}
|
||||
}
|
||||
@ -63,7 +63,7 @@ class DownloadDialog : BaseDialogFragment(), View.OnTouchListener {
|
||||
|
||||
private val mDataWatcher = object : DataWatcher() {
|
||||
override fun onDataChanged(downloadEntity: DownloadEntity) {
|
||||
if (downloadEntity.gameId == mGameEntity.id &&
|
||||
if (downloadEntity.gameId == mGameEntity?.id &&
|
||||
DownloadStatus.delete != DownloadManager.getInstance(requireContext()).getStatus(downloadEntity.url)) {
|
||||
mAdapter?.listData?.forEachIndexed { index, entity ->
|
||||
if (entity.normal?.packageName == downloadEntity.packageName
|
||||
@ -95,13 +95,17 @@ class DownloadDialog : BaseDialogFragment(), View.OnTouchListener {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
EventBus.getDefault().register(this)
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
mGameEntity = requireArguments().getParcelable(GameEntity::class.java.simpleName)!!
|
||||
mEntrance = requireArguments().getString(EntranceUtils.KEY_ENTRANCE) ?: ""
|
||||
mLocation = requireArguments().getString(EntranceUtils.KEY_LOCATION) ?: ""
|
||||
|
||||
val factory = DownloadViewModel.Factory(HaloApp.getInstance().application, mGameEntity)
|
||||
mViewModel = ViewModelProviders.of(this, factory).get(DownloadViewModel::class.java)
|
||||
mViewModel.listLiveData.observeNonNull(this, callback = { itemList ->
|
||||
mAdapter = DownloadDialogAdapter(requireContext(), mViewModel, itemList, false, mEntrance, mLocation)
|
||||
mBinding.contentList.layoutManager = createLayoutManager(itemList)
|
||||
mBinding.contentList.adapter = mAdapter
|
||||
|
||||
})
|
||||
|
||||
mViewModel.collectionLiveData.observe(this, Observer { collection ->
|
||||
@ -126,7 +130,7 @@ class DownloadDialog : BaseDialogFragment(), View.OnTouchListener {
|
||||
|
||||
if (mAdapter != null) collectionEnterAnimation()
|
||||
} else {
|
||||
mBinding.title.text = ("选择下载" + mGameEntity.pluginDesc + "版本")
|
||||
mBinding.title.text = ("选择下载" + mGameEntity?.pluginDesc + "版本")
|
||||
|
||||
mCollectionAdapter = null
|
||||
collectionExitAnimation()
|
||||
@ -256,7 +260,6 @@ class DownloadDialog : BaseDialogFragment(), View.OnTouchListener {
|
||||
return layoutManager
|
||||
}
|
||||
|
||||
|
||||
override fun onResume() {
|
||||
mAdapter?.notifyDataSetChanged()
|
||||
mCollectionAdapter?.notifyDataSetChanged()
|
||||
@ -266,7 +269,6 @@ class DownloadDialog : BaseDialogFragment(), View.OnTouchListener {
|
||||
mElapsedHelper.resumeCounting()
|
||||
}
|
||||
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
DownloadManager.getInstance(requireContext()).removeObserver(mDataWatcher)
|
||||
@ -276,10 +278,10 @@ class DownloadDialog : BaseDialogFragment(), View.OnTouchListener {
|
||||
|
||||
private fun postBrowseMta() {
|
||||
if (mCollectionAdapter == null) {
|
||||
MtaHelper.onEventWithTime(MTA_KEY, mElapsedHelper.elapsedTime, "浏览", mGameEntity.name)
|
||||
MtaHelper.onEventWithTime(MTA_KEY, mElapsedHelper.elapsedTime, "浏览", mGameEntity?.name)
|
||||
} else {
|
||||
val collectionData = mViewModel.collectionLiveData.value
|
||||
MtaHelper.onEventWithTime(MTA_KEY, mElapsedHelper.elapsedTime, "浏览", mGameEntity.name + "_" + collectionData?.name)
|
||||
MtaHelper.onEventWithTime(MTA_KEY, mElapsedHelper.elapsedTime, "浏览", mGameEntity?.name + "_" + collectionData?.name)
|
||||
throwExceptionInDebug("collectionData must be not null", collectionData == null)
|
||||
}
|
||||
}
|
||||
@ -399,9 +401,11 @@ class DownloadDialog : BaseDialogFragment(), View.OnTouchListener {
|
||||
if (hasDownloadDialogInCurrentActivity(fragmentActivity)) return
|
||||
|
||||
val downloadDialog = DownloadDialog().apply {
|
||||
mGameEntity = gameEntity
|
||||
mEntrance = entrance ?: ""
|
||||
mLocation = location ?: ""
|
||||
val bundle = Bundle()
|
||||
bundle.putString(EntranceUtils.KEY_ENTRANCE, entrance)
|
||||
bundle.putString(EntranceUtils.KEY_LOCATION, location)
|
||||
bundle.putParcelable(GameEntity::class.java.simpleName, gameEntity)
|
||||
arguments = bundle
|
||||
}
|
||||
downloadDialog.show(fragmentActivity.supportFragmentManager, DownloadDialog::class.java.name)
|
||||
}
|
||||
|
||||
@ -367,7 +367,7 @@ class GameDetailFragment : NormalFragment() {
|
||||
|
||||
mNewGameDetailEntity = data
|
||||
|
||||
// showAlertDialogIfNeeded(data.game)
|
||||
showAlertDialogIfNeeded(data)
|
||||
|
||||
initViewPage(data)
|
||||
initGameDetailTop()
|
||||
@ -516,14 +516,14 @@ class GameDetailFragment : NormalFragment() {
|
||||
BaseFragment_TabLayout.initTabStyle(mTabLayout, mViewPager.currentItem)
|
||||
}
|
||||
|
||||
private fun showAlertDialogIfNeeded(detailEntity: GameDetailEntity) {
|
||||
private fun showAlertDialogIfNeeded(detailEntity: NewGameDetailEntity) {
|
||||
if (detailEntity.detailDialog != null) {
|
||||
val dialog = detailEntity.detailDialog
|
||||
// 机型匹配或规则为空都弹
|
||||
if (dialog!!.rule.models.isEmpty() || dialog.rule.models.contains(Build.MODEL)) {
|
||||
val dayOfMonth = Calendar.getInstance().get(Calendar.DAY_OF_MONTH)
|
||||
if ("EVERY_TIME_OPEN" == dialog.alert || SPUtils.getLong(SP_OPENED_DIALOG_TIME_PREFIX + detailEntity.id!!, 0) != dayOfMonth.toLong()) {
|
||||
SPUtils.setLong(SP_OPENED_DIALOG_TIME_PREFIX + detailEntity.id!!, 0)
|
||||
if ("EVERY_TIME_OPEN" == dialog.alert || SPUtils.getLong(SP_OPENED_DIALOG_TIME_PREFIX + mGameEntity?.id, 0) != dayOfMonth.toLong()) {
|
||||
SPUtils.setLong(SP_OPENED_DIALOG_TIME_PREFIX + mGameEntity?.id, 0)
|
||||
doShowAlertDialog(dialog)
|
||||
}
|
||||
}
|
||||
@ -678,7 +678,7 @@ class GameDetailFragment : NormalFragment() {
|
||||
gameBigEvent.background = ContextCompat.getDrawable(requireContext(), R.drawable.bg_game_big_event)
|
||||
gameBigEvent.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(requireContext(), R.drawable.ic_game_detail_big_event_gray), null,
|
||||
ContextCompat.getDrawable(requireContext(), R.drawable.ic_game_detail_big_event_arrow_gray), null)
|
||||
var eventStr = "${TimeUtils.getFormatTime(it.time, "MM-dd")}:${it.content}"
|
||||
var eventStr = if (TimeUtils.getBeforeDays(it.time) <= 15) "${TimeUtils.getFormatTime(it.time, "MM-dd")}:${it.content}" else it.content
|
||||
if (eventStr.contains("\n")) eventStr = eventStr.substring(0, eventStr.indexOf("\n"))
|
||||
gameBigEvent.text = eventStr
|
||||
}
|
||||
|
||||
@ -293,6 +293,7 @@ class DescAdapter(context: Context,
|
||||
|
||||
viewHolder.binding.containerPaddingTop = itemData.paddingTop
|
||||
viewHolder.binding.containerPaddingBottom = itemData.paddingBottom
|
||||
viewHolder.binding.executePendingBindings()
|
||||
|
||||
if (viewHolder.binding.recyclerview.adapter == null) {
|
||||
val commentsAdapter = viewHolder.binding.recyclerview.adapter as DescCommentsAdapter?
|
||||
@ -347,6 +348,7 @@ class DescAdapter(context: Context,
|
||||
viewHolder.binding.link = recommendedImage
|
||||
viewHolder.binding.containerPaddingTop = itemData.paddingTop
|
||||
viewHolder.binding.containerPaddingBottom = itemData.paddingBottom
|
||||
viewHolder.binding.executePendingBindings()
|
||||
viewHolder.binding.root.setOnClickListener {
|
||||
MtaHelper.onEvent("游戏详情_新", "图片推荐", gameName + "+${recommendedImage?.title}")
|
||||
if (!TextUtils.isEmpty(recommendedImage?.communityId)) {
|
||||
@ -366,6 +368,7 @@ class DescAdapter(context: Context,
|
||||
|
||||
viewHolder.binding.containerPaddingTop = itemData.paddingTop
|
||||
viewHolder.binding.containerPaddingBottom = itemData.paddingBottom
|
||||
viewHolder.binding.executePendingBindings()
|
||||
viewHolder.binding.galleryRv.isNestedScrollingEnabled = false
|
||||
if (viewHolder.binding.galleryRv.adapter == null) {
|
||||
viewHolder.binding.galleryRv.apply {
|
||||
@ -404,6 +407,7 @@ class DescAdapter(context: Context,
|
||||
viewHolder.binding.galleryRv.isNestedScrollingEnabled = false
|
||||
viewHolder.binding.containerPaddingTop = itemData.paddingTop
|
||||
viewHolder.binding.containerPaddingBottom = itemData.paddingBottom
|
||||
viewHolder.binding.executePendingBindings()
|
||||
if (viewHolder.binding.galleryRv.adapter == null) {
|
||||
viewHolder.binding.galleryRv.apply {
|
||||
val params = layoutParams as ConstraintLayout.LayoutParams
|
||||
@ -430,6 +434,7 @@ class DescAdapter(context: Context,
|
||||
val maxDesLines = if (mExpandSparseBooleanArray.get(holder.adapterPosition)) Int.MAX_VALUE else 4
|
||||
holder.binding.contentTv.setExpandMaxLines(maxDesLines)
|
||||
holder.binding.contentTv.setIsExpanded(Int.MAX_VALUE == maxDesLines)
|
||||
holder.binding.executePendingBindings()
|
||||
holder.binding.contentTv.setExpandCallback {
|
||||
mExpandSparseBooleanArray.put(holder.adapterPosition, true)
|
||||
MtaHelper.onEvent("游戏详情_新", "展开更新内容", gameName)
|
||||
@ -454,6 +459,7 @@ class DescAdapter(context: Context,
|
||||
viewHolder.binding.serviceRv.isNestedScrollingEnabled = false
|
||||
viewHolder.binding.containerPaddingTop = itemData.paddingTop
|
||||
viewHolder.binding.containerPaddingBottom = itemData.paddingBottom
|
||||
viewHolder.binding.executePendingBindings()
|
||||
|
||||
if (!server!!.calendar.isNullOrEmpty()) {
|
||||
viewHolder.binding.serviceRv.visibility = View.VISIBLE
|
||||
@ -488,7 +494,6 @@ class DescAdapter(context: Context,
|
||||
DialogUtils.showKaifuRemindDialog(mContext, server.des, gameName)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//绑定攻略文章
|
||||
@ -498,6 +503,8 @@ class DescAdapter(context: Context,
|
||||
viewHolder.binding.galleryRv.isNestedScrollingEnabled = false
|
||||
viewHolder.binding.containerPaddingTop = itemData.paddingTop
|
||||
viewHolder.binding.containerPaddingBottom = itemData.paddingBottom
|
||||
viewHolder.binding.executePendingBindings()
|
||||
|
||||
if (viewHolder.binding.galleryRv.adapter == null) {
|
||||
viewHolder.binding.galleryRv.apply {
|
||||
val params = layoutParams as ConstraintLayout.LayoutParams
|
||||
@ -549,6 +556,8 @@ class DescAdapter(context: Context,
|
||||
|
||||
viewHolder.binding.containerPaddingTop = itemData.paddingTop
|
||||
viewHolder.binding.containerPaddingBottom = itemData.paddingBottom
|
||||
viewHolder.binding.executePendingBindings()
|
||||
|
||||
if (!info!!.topTags.isNullOrEmpty()) {
|
||||
viewHolder.binding.labelsLl.visibility = View.VISIBLE
|
||||
viewHolder.binding.labelsLl.removeAllViews()
|
||||
|
||||
@ -2,8 +2,6 @@ package com.gh.gamecenter.gamedetail.desc
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Application
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Build
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
@ -23,7 +21,6 @@ import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.utils.Util_System_Phone_State
|
||||
import com.squareup.picasso.Picasso
|
||||
import com.squareup.picasso.Target
|
||||
import com.walkud.rom.checker.RomIdentifier
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
@ -263,11 +260,9 @@ class DescViewModel(application: Application,
|
||||
if (item.type == DetailEntity.Type.CUSTOM_COLUMN.value) {
|
||||
item.customColumn?.infoTag?.let {
|
||||
for (tag in it) {
|
||||
Picasso.with(getApplication()).load(tag.icon).into(object : Target {
|
||||
override fun onPrepareLoad(placeHolderDrawable: Drawable?) {}
|
||||
override fun onBitmapFailed(errorDrawable: Drawable?) {}
|
||||
override fun onBitmapLoaded(bitmap: Bitmap?, from: Picasso.LoadedFrom?) {}
|
||||
})
|
||||
tryWithDefaultCatch {
|
||||
Picasso.with(getApplication()).load(tag.icon).fetch()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import butterknife.BindView
|
||||
import com.gh.base.BaseRecyclerViewHolder
|
||||
import com.gh.common.util.SpanBuilder
|
||||
import com.gh.common.util.tryWithDefaultCatch
|
||||
import com.gh.common.view.CenterImageSpan
|
||||
import com.gh.common.view.CustomLinkMovementMethod
|
||||
import com.gh.gamecenter.R
|
||||
@ -51,22 +52,24 @@ class GameDetailCustomColumnAdapter(context: Context)
|
||||
color ?: "#000000")
|
||||
.build()
|
||||
|
||||
Picasso.with(mContext).load(icon)
|
||||
.priority(Picasso.Priority.HIGH)
|
||||
.into(object : Target {
|
||||
override fun onPrepareLoad(placeHolderDrawable: Drawable?) {
|
||||
viewHolder.contentTv.movementMethod = CustomLinkMovementMethod.getInstance()
|
||||
viewHolder.contentTv.text = spannable
|
||||
}
|
||||
override fun onBitmapFailed(errorDrawable: Drawable?) {}
|
||||
override fun onBitmapLoaded(bitmap: Bitmap?, from: Picasso.LoadedFrom?) {
|
||||
val bitmapDrawable = BitmapDrawable(mContext.resources, bitmap)
|
||||
bitmapDrawable.setBounds(0, 0, DensityUtil.dip2px(12F), DensityUtil.dip2px(12F))
|
||||
spannable.setSpan(CenterImageSpan(bitmapDrawable), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
viewHolder.contentTv.movementMethod = CustomLinkMovementMethod.getInstance()
|
||||
viewHolder.contentTv.text = spannable
|
||||
}
|
||||
})
|
||||
tryWithDefaultCatch {
|
||||
Picasso.with(mContext).load(icon)
|
||||
.priority(Picasso.Priority.HIGH)
|
||||
.into(object : Target {
|
||||
override fun onPrepareLoad(placeHolderDrawable: Drawable?) {
|
||||
viewHolder.contentTv.movementMethod = CustomLinkMovementMethod.getInstance()
|
||||
viewHolder.contentTv.text = spannable
|
||||
}
|
||||
override fun onBitmapFailed(errorDrawable: Drawable?) {}
|
||||
override fun onBitmapLoaded(bitmap: Bitmap?, from: Picasso.LoadedFrom?) {
|
||||
val bitmapDrawable = BitmapDrawable(mContext.resources, bitmap)
|
||||
bitmapDrawable.setBounds(0, 0, DensityUtil.dip2px(12F), DensityUtil.dip2px(12F))
|
||||
spannable.setSpan(CenterImageSpan(bitmapDrawable), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
viewHolder.contentTv.movementMethod = CustomLinkMovementMethod.getInstance()
|
||||
viewHolder.contentTv.text = spannable
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +50,6 @@ class GameLibaoAdapter(val context: Context, val libaos: ArrayList<LibaoEntity>,
|
||||
val total = libaoEntity.total
|
||||
val available = libaoEntity.available
|
||||
if (total != 0) {
|
||||
holder.binding.libaoSchedulePb.progress = ((available / total.toFloat()) * 100).toInt()
|
||||
val availablePercent = (available) / total.toFloat() * 100
|
||||
val count = when {
|
||||
availablePercent >= 1F -> {
|
||||
@ -64,6 +63,7 @@ class GameLibaoAdapter(val context: Context, val libaos: ArrayList<LibaoEntity>,
|
||||
}
|
||||
}
|
||||
holder.binding.remainingTv.text = "剩余${count}%"
|
||||
holder.binding.libaoSchedulePb.progress = count
|
||||
}
|
||||
LibaoUtils.setLiBaoBtnStatusRound(holder.binding.receiveTv, libaoEntity.status, context)
|
||||
holder.itemView.setOnClickListener {
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
package com.gh.gamecenter.gamedetail.dialog
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.DialogInterface
|
||||
import android.os.Bundle
|
||||
import android.view.*
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.gh.base.fragment.BaseDialogFragment
|
||||
import com.gh.common.dialog.BaseTrackableDialogFragment
|
||||
import com.gh.common.util.DisplayUtils
|
||||
import com.gh.common.util.MtaHelper
|
||||
@ -18,7 +20,6 @@ import com.gh.gamecenter.entity.TagStyleEntity
|
||||
import com.gh.gamecenter.tag.TagsActivity
|
||||
import com.halo.assistant.HaloApp
|
||||
import kotlinx.android.synthetic.main.dialog_game_tags.view.*
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
class GameTagsDialog : BaseTrackableDialogFragment() {
|
||||
|
||||
@ -26,6 +27,12 @@ class GameTagsDialog : BaseTrackableDialogFragment() {
|
||||
lateinit var mTagStyles: ArrayList<TagStyleEntity>
|
||||
lateinit var mGameName: String
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
mGameName = requireArguments().getString("gameName") ?: ""
|
||||
mTagStyles = requireArguments().getParcelableArrayList("tagStyles") ?: ArrayList()
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val createDialog = super.onCreateDialog(savedInstanceState)
|
||||
createDialog.setCanceledOnTouchOutside(true)
|
||||
@ -76,8 +83,7 @@ class GameTagsDialog : BaseTrackableDialogFragment() {
|
||||
companion object {
|
||||
fun showGameTagsDialog(context: FragmentActivity, tagStyles: ArrayList<TagStyleEntity>, gameName: String) {
|
||||
val dialog = GameTagsDialog().apply {
|
||||
mTagStyles = tagStyles
|
||||
mGameName = gameName
|
||||
arguments = bundleOf("gameName" to gameName, "tagStyles" to tagStyles)
|
||||
}
|
||||
dialog.show(context.supportFragmentManager, DownloadDialog::class.java.name)
|
||||
}
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
package com.gh.gamecenter.gamedetail.entity
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.gh.gamecenter.entity.GameDetailEntity
|
||||
import com.gh.gamecenter.entity.LinkEntity
|
||||
import com.gh.gamecenter.entity.MeEntity
|
||||
import com.gh.gamecenter.entity.TagStyleEntity
|
||||
import com.gh.gamecenter.entity.*
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
@Keep
|
||||
@ -26,6 +23,8 @@ data class NewGameDetailEntity(
|
||||
@SerializedName("me")
|
||||
var me: MeEntity = MeEntity(),
|
||||
var event: BigEvent? = null,//游戏大事件
|
||||
@SerializedName("detail_dialog")
|
||||
var detailDialog: GameEntity.Dialog? = null,
|
||||
@SerializedName("tag_style")
|
||||
var tagStyle: ArrayList<TagStyleEntity> = ArrayList(),
|
||||
@SerializedName("detail_tab")
|
||||
|
||||
@ -52,7 +52,7 @@ public class GameLibaoGalleryAdapter extends BaseRecyclerAdapter<GameLibaoGaller
|
||||
}
|
||||
holder.libaoDes.setText(content);
|
||||
if (libaoEntity.getStatus() == null) return;
|
||||
LibaoUtils.setLiBaoBtnStatus(holder.libaoBtn, libaoEntity.getStatus(), mContext);
|
||||
LibaoUtils.setLiBaoBtnStatusRound(holder.libaoBtn, libaoEntity.getStatus(), mContext);
|
||||
|
||||
holder.libaoBtn.setOnTouchListener((v, event) -> {
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情_新", "游戏礼包_领取", mGameName + "->" + libaoEntity.getName());
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.gh.gamecenter.libao;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.text.Html;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
@ -30,6 +29,7 @@ import com.lightgame.utils.Utils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import retrofit2.HttpException;
|
||||
@ -287,7 +287,7 @@ class Libao3FragmentAdapter extends BaseRecyclerAdapter<RecyclerView.ViewHolder>
|
||||
});
|
||||
|
||||
holder.libaoBtnStatus.setText("复制");
|
||||
holder.libaoBtnStatus.setBackgroundResource(R.drawable.textview_blue_style);
|
||||
holder.libaoBtnStatus.setBackgroundResource(R.drawable.button_normal_round_style);
|
||||
} else if (viewHolder instanceof FooterViewHolder) {
|
||||
initFooterViewHolder((FooterViewHolder) viewHolder);
|
||||
}
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
package com.gh.gamecenter.libao;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -28,6 +25,9 @@ import com.lightgame.adapter.BaseRecyclerAdapter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.Function;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
@ -160,7 +160,7 @@ public class LibaoHistoryAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
ImageUtils.display(viewHolder.libaoGameIcon, libaoEntity.getIcon());
|
||||
|
||||
//领取状态
|
||||
LibaoUtils.setLiBaoBtnStatus(viewHolder.libaoBtnStatus
|
||||
LibaoUtils.setLiBaoBtnStatusRound(viewHolder.libaoBtnStatus
|
||||
, !TextUtils.isEmpty(libaoEntity.getStatus()) ? libaoEntity.getStatus() : "unshelve", mContext);
|
||||
|
||||
} else {
|
||||
|
||||
@ -261,7 +261,13 @@ public class WebFragment extends NormalFragment {
|
||||
|
||||
// 自适应屏幕
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING);
|
||||
try {
|
||||
// 部分设备不支持 TEXT_AUTOSIZING
|
||||
// 报 java.lang.IllegalArgumentException: WebViewClassic does not support TEXT_AUTOSIZING layout mode
|
||||
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING);
|
||||
} catch (Throwable throwable) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
// 用webview打开url
|
||||
|
||||
@ -70,7 +70,9 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:roundedCornerRadius="5dp"
|
||||
app:viewAspectRatio="2"
|
||||
tools:background="@color/placeholder_bg"
|
||||
app:fadeDuration="500"
|
||||
app:placeholderImage="@drawable/occupy"
|
||||
app:placeholderImageScaleType="fitXY"
|
||||
tools:layout_width="match_parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
||||
@ -14,12 +14,13 @@
|
||||
|
||||
<TextView
|
||||
android:id = "@+id/libao_copy_btn"
|
||||
android:layout_width = "45dp"
|
||||
android:layout_height = "25dp"
|
||||
android:layout_width = "44dp"
|
||||
android:layout_height = "24dp"
|
||||
android:layout_alignParentRight = "true"
|
||||
android:layout_centerVertical = "true"
|
||||
android:background = "@drawable/textview_blue_style"
|
||||
android:background = "@drawable/button_normal_round_style"
|
||||
android:gravity = "center"
|
||||
android:textSize="12sp"
|
||||
android:text = "@string/libao_copy"
|
||||
android:textColor = "@android:color/white" />
|
||||
|
||||
|
||||
@ -65,12 +65,13 @@
|
||||
|
||||
<TextView
|
||||
android:id = "@+id/libaodetail_copy_btn"
|
||||
android:layout_width = "60dp"
|
||||
android:layout_height = "30dp"
|
||||
android:layout_width = "56dp"
|
||||
android:layout_height = "28dp"
|
||||
android:layout_alignParentRight = "true"
|
||||
android:layout_centerVertical = "true"
|
||||
android:layout_marginLeft = "10dp"
|
||||
android:gravity = "center"
|
||||
android:textSize="12sp"
|
||||
android:textColor = "@android:color/white" />
|
||||
|
||||
</LinearLayout >
|
||||
|
||||
@ -52,8 +52,8 @@ COMMENT_HOST=https\://api.ghzs.com/v4d0d0/
|
||||
|
||||
# 请不要手动改动下面的值,除非你明确需要以某个apk作为基准包,需要打包请以scripts/tinker*.sh为准
|
||||
TINKER_ENABLE=
|
||||
TINKER_ID=6ce6489
|
||||
TINKER_BASE_APK_DIR=app-0515-18-55-40_6ce6489
|
||||
TINKER_ID=961d4eb
|
||||
TINKER_BASE_APK_DIR=app-0520-11-32-50_961d4eb
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user