feat:【光环助手】工具新增跳转类型配置 https://jira.shanqu.cc/browse/GHZSCY-4618

This commit is contained in:
叶子维
2024-05-17 17:53:13 +08:00
parent 2a27e0f467
commit 7d4aa34d12
3 changed files with 49 additions and 16 deletions

View File

@ -5,6 +5,7 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import com.gh.common.constant.Config
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.R
import com.gh.gamecenter.WebActivity.Companion.getWebByCollectionTools
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
@ -103,19 +104,24 @@ class ToolBoxItemAdapter(
viewHolder.binding.root.setOnClickListener {
mViewModel.addToHistoryList(toolBoxEntity)
val url = toolBoxEntity.url
if (url != null && url.contains(Config.URL_ARTICLE)) {
val newsId = url.substring(url.lastIndexOf("/") + 1, url.length - 5) // 5: ".html"
val intent = NewsDetailActivity.getIntentById(mContext, newsId, "工具箱列表")
mContext.startActivity(intent)
} else {
mContext.startActivity(
getWebByCollectionTools(
mContext,
toolBoxEntity,
false
val linkEntity = toolBoxEntity.toLinkEntity()
if (linkEntity.type == "web") {
val url = linkEntity.link ?: ""
if (url.isNotEmpty() && url.contains(Config.URL_ARTICLE)) {
val newsId = url.substring(url.lastIndexOf("/") + 1, url.length - 5) // 5: ".html"
val intent = NewsDetailActivity.getIntentById(mContext, newsId, "工具箱列表")
mContext.startActivity(intent)
} else {
mContext.startActivity(
getWebByCollectionTools(
mContext,
toolBoxEntity,
false
)
)
)
}
} else {
DirectUtils.directToLinkPage(mContext, linkEntity, "工具箱", "")
}
}
}

View File

@ -3,16 +3,16 @@ package com.gh.gamecenter.toolbox
import android.app.Application
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.MutableLiveData
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.baselist.LoadStatus
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.entity.ToolBoxEntity
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.toJson
import com.gh.gamecenter.core.utils.GsonUtils
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.core.utils.TimeUtils
import com.gh.gamecenter.common.utils.toJson
import com.gh.gamecenter.core.utils.UrlFilterUtils
import com.gh.gamecenter.entity.ToolBoxBlockEntity
import com.gh.gamecenter.common.entity.ToolBoxEntity
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.retrofit.RetrofitManager
import com.google.gson.reflect.TypeToken
import io.reactivex.android.schedulers.AndroidSchedulers
@ -77,6 +77,12 @@ class ToolBoxViewModel(application: Application) : AndroidViewModel(application)
for (item in historyList) {
val offsetDay = TimeUtils.getBeforeDays(item.lastOpenTime / 1000)
if (offsetDay <= 30) {
if (item.url != null && (item.linkId.isEmpty() || item.linkType.isEmpty() || item.linkText.isEmpty())) {
// 给历史数据补充信息
item.linkType = "web"
item.linkId = item.url!!
item.linkText = item.url!!
}
add(item)
}
}