修复BUG,优化UI

This commit is contained in:
muqing 2024-02-11 18:03:57 +08:00
parent f78d05f340
commit c219e92777
23 changed files with 150 additions and 164 deletions

View File

@ -20,6 +20,7 @@ import com.coldmint.rust.core.database.code.SectionInfo
import com.coldmint.rust.pro.adapters.CodeTableAdapter import com.coldmint.rust.pro.adapters.CodeTableAdapter
import com.coldmint.rust.pro.base.BaseActivity import com.coldmint.rust.pro.base.BaseActivity
import com.coldmint.rust.pro.databinding.ActivityCodeTableBinding import com.coldmint.rust.pro.databinding.ActivityCodeTableBinding
import com.muqing.muqing.gj
import java.util.concurrent.Executors import java.util.concurrent.Executors
class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() { class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
@ -231,9 +232,9 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
viewBinding.edittext.isVisible = b viewBinding.edittext.isVisible = b
if (!b) { if (!b) {
viewBinding.edittext.setText("") viewBinding.edittext.setText("")
com.coldmint.rust.pro.muqing.gj.ycjp(viewBinding.edittext) gj.ycjp(viewBinding.edittext)
} else { } else {
com.coldmint.rust.pro.muqing.gj.tcjp(viewBinding.edittext) gj.tcjp(viewBinding.edittext)
} }
} }

View File

@ -43,7 +43,6 @@ import com.coldmint.rust.pro.viewmodel.StartViewModel
import com.google.android.material.color.DynamicColors import com.google.android.material.color.DynamicColors
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import com.google.android.material.tabs.TabLayout
import com.google.gson.Gson import com.google.gson.Gson
import com.gyf.immersionbar.ImmersionBar import com.gyf.immersionbar.ImmersionBar
import org.json.JSONObject import org.json.JSONObject
@ -56,14 +55,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
private lateinit var appBarConfiguration: AppBarConfiguration private lateinit var appBarConfiguration: AppBarConfiguration
private var oldLanguage: String? = null private var oldLanguage: String? = null
private var first = true private var first = true
var oldDynamicColor = false private var oldDynamicColor = false
var tabLayout: TabLayout? = null private val headLayout by lazy {
val headLayout by lazy {
HeadLayoutBinding.inflate(layoutInflater) HeadLayoutBinding.inflate(layoutInflater)
} }
val startViewModel by lazy { val startViewModel by lazy {
ViewModelProvider(this).get(StartViewModel::class.java) ViewModelProvider(this)[StartViewModel::class.java]
} }
companion object { companion object {
@ -75,14 +72,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
/** /**
* 将Toolbar设置为ActionBar * 将Toolbar设置为ActionBar
*/ */
fun useToolbarSetSupportActionBar() { private fun useToolbarSetSupportActionBar() {
tabLayout = viewBinding.tabLayout
} }
/** /**
* 初始化导航 * 初始化导航
*/ */
fun initNav() { private fun initNav() {
appBarConfiguration = AppBarConfiguration( appBarConfiguration = AppBarConfiguration(
setOf(R.id.community_item, R.id.mod_item, R.id.database_item, R.id.template_item), setOf(R.id.community_item, R.id.mod_item, R.id.database_item, R.id.template_item),
viewBinding.drawerlayout viewBinding.drawerlayout
@ -119,7 +115,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
/** /**
* 检查App更新 * 检查App更新
*/ */
fun checkAppUpdate() { private fun checkAppUpdate() {
AppUpdate().getUpdate(object : ApiCallBack<AppUpdateData> { AppUpdate().getUpdate(object : ApiCallBack<AppUpdateData> {
override fun onResponse(t: AppUpdateData) { override fun onResponse(t: AppUpdateData) {
val data = t.data val data = t.data
@ -183,12 +179,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
} else { } else {
materialAlertDialogBuilder.setNegativeButton( materialAlertDialogBuilder.setNegativeButton(
R.string.dialog_cancel R.string.dialog_cancel
) { i, i2 -> ) { _, _ ->
} }
} }
materialAlertDialogBuilder.setPositiveButton( materialAlertDialogBuilder.setPositiveButton(
R.string.downlod R.string.downlod
) { i, i2 -> ) { _, _ ->
AppOperator.useBrowserAccessWebPage(this, data.link) AppOperator.useBrowserAccessWebPage(this, data.link)
} }
materialAlertDialogBuilder.show() materialAlertDialogBuilder.show()
@ -200,7 +196,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
/** /**
* 显示游戏配置对话框 * 显示游戏配置对话框
*/ */
fun showGameConfiguredDialog() { private fun showGameConfiguredDialog() {
if (!AppSettings.getValue(AppSettings.Setting.SetGameStorage, false)) { if (!AppSettings.getValue(AppSettings.Setting.SetGameStorage, false)) {
try { try {
val packageInfo = packageManager.getPackageInfo( val packageInfo = packageManager.getPackageInfo(
@ -212,16 +208,16 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
if (versionCode >= 159) { if (versionCode >= 159) {
MaterialAlertDialogBuilder(this).setTitle(R.string.game_configured) MaterialAlertDialogBuilder(this).setTitle(R.string.game_configured)
.setMessage(R.string.unable_to_detect) .setMessage(R.string.unable_to_detect)
.setPositiveButton(R.string.show_details) { i, i2 -> .setPositiveButton(R.string.show_details) { _, _ ->
startActivity( startActivity(
Intent( Intent(
this@MainActivity, this@MainActivity,
GameCheckActivity::class.java GameCheckActivity::class.java
) )
) )
}.setNeutralButton(R.string.no_longer_prompt) { i, i2 -> }.setNeutralButton(R.string.no_longer_prompt) { _, _ ->
AppSettings.setValue(AppSettings.Setting.SetGameStorage, true) AppSettings.setValue(AppSettings.Setting.SetGameStorage, true)
}.setNeutralButton(R.string.dialog_cancel) { i, i2 -> }.setNeutralButton(R.string.dialog_cancel) { _, _ ->
}.setCancelable(false).show() }.setCancelable(false).show()
} else { } else {
AppSettings.setValue(AppSettings.Setting.SetGameStorage, true) AppSettings.setValue(AppSettings.Setting.SetGameStorage, true)
@ -260,7 +256,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
/** /**
* 初始化导航菜单 * 初始化导航菜单
*/ */
fun initNavigationMenu(isActive: Boolean = GlobalMethod.isActive) { private fun initNavigationMenu(isActive: Boolean = GlobalMethod.isActive) {
val menu = viewBinding.navaiagtion.menu val menu = viewBinding.navaiagtion.menu
val dataBase = menu.findItem(R.id.database_item) val dataBase = menu.findItem(R.id.database_item)
val template = menu.findItem(R.id.template_item) val template = menu.findItem(R.id.template_item)
@ -292,7 +288,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
//数据库 //数据库
dataBase.setOnMenuItemClickListener { dataBase.setOnMenuItemClickListener {
viewBinding.mainButton.postOnAnimationDelayed({ viewBinding.mainButton.postOnAnimationDelayed({
viewBinding.tabLayout.isVisible = false // viewBinding.tabLayout.isVisible = false
viewBinding.mainButton.hide() viewBinding.mainButton.hide()
}, hideViewDelay) }, hideViewDelay)
false false
@ -300,7 +296,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
template.setOnMenuItemClickListener { template.setOnMenuItemClickListener {
viewBinding.mainButton.postOnAnimationDelayed({ viewBinding.mainButton.postOnAnimationDelayed({
viewBinding.tabLayout.isVisible = true // viewBinding.tabLayout.isVisible = true
viewBinding.mainButton.show() viewBinding.mainButton.show()
}, hideViewDelay) }, hideViewDelay)
false false
@ -339,7 +335,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
GlobalMethod.requestStoragePermissions(this) { GlobalMethod.requestStoragePermissions(this) {
if (it) { if (it) {
viewBinding.mainButton.postOnAnimationDelayed({ viewBinding.mainButton.postOnAnimationDelayed({
viewBinding.tabLayout.isVisible = true // viewBinding.tabLayout.isVisible = true
if (isActive) { if (isActive) {
viewBinding.mainButton.show() viewBinding.mainButton.show()
} }
@ -348,15 +344,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
} }
false false
} }
community.setOnMenuItemClickListener { community.setOnMenuItemClickListener {
viewBinding.mainButton.postOnAnimationDelayed({ viewBinding.mainButton.postOnAnimationDelayed({
viewBinding.tabLayout.isVisible = true // viewBinding.tabLayout.isVisible = true
viewBinding.mainButton.hide() viewBinding.mainButton.hide()
}, hideViewDelay) }, hideViewDelay)
false false
} }
menu.findItem(R.id.startGame).setOnMenuItemClickListener { menu.findItem(R.id.startGame).setOnMenuItemClickListener {
val packName = AppSettings.getValue( val packName = AppSettings.getValue(
AppSettings.Setting.GamePackage, AppSettings.Setting.GamePackage,
@ -480,7 +474,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
* @param formFile File 文件 * @param formFile File 文件
* @param templateDirectory File 模板文件夹 * @param templateDirectory File 模板文件夹
*/ */
fun importTemplate(formFile: File, templateDirectory: File) { private fun importTemplate(formFile: File, templateDirectory: File) {
val handler = Handler(Looper.getMainLooper()) val handler = Handler(Looper.getMainLooper())
Thread(Runnable { Thread(Runnable {
//如果建立缓存完成,并且模板文件存在 //如果建立缓存完成,并且模板文件存在
@ -533,10 +527,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
getString(R.string.covers_the_import), getString(R.string.covers_the_import),
newInfo.versionName, oldInfo.versionName newInfo.versionName, oldInfo.versionName
) )
).setPositiveButton(R.string.dialog_ok) { i, i2 -> ).setPositiveButton(R.string.dialog_ok) { _, _ ->
FileOperator.delete_files(templateDirectory) FileOperator.delete_files(templateDirectory)
importTemplate(formFile, templateDirectory) importTemplate(formFile, templateDirectory)
}.setNegativeButton(R.string.dialog_cancel) { i, i2 -> }.setNegativeButton(R.string.dialog_cancel) { _, _ ->
}.show() }.show()
} }
return@Runnable return@Runnable
@ -661,7 +655,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
/** /**
* 观察启动视图 * 观察启动视图
*/ */
fun observeStartViewModel() { private fun observeStartViewModel() {
startViewModel.userLiveData.observe(this) { startViewModel.userLiveData.observe(this) {
headLayout.nameView.text = it.data.userName headLayout.nameView.text = it.data.userName
headLayout.emailView.text = it.data.email headLayout.emailView.text = it.data.email
@ -746,7 +740,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
AppSettings.Setting.DynamicColor, AppSettings.Setting.DynamicColor,
DynamicColors.isDynamicColorAvailable() DynamicColors.isDynamicColorAvailable()
) )
useToolbarSetSupportActionBar() // useToolbarSetSupportActionBar()
initNav() initNav()
observeStartViewModel() observeStartViewModel()
//偏移fab //偏移fab

View File

@ -9,7 +9,7 @@ import android.os.Bundle
import cat.ereza.customactivityoncrash.config.CaocConfig import cat.ereza.customactivityoncrash.config.CaocConfig
import com.coldmint.rust.core.debug.LogCat import com.coldmint.rust.core.debug.LogCat
import com.coldmint.rust.core.debug.LogCatObserver import com.coldmint.rust.core.debug.LogCatObserver
import com.coldmint.rust.pro.muqing.wj import com.muqing.muqing.wj
import com.coldmint.rust.pro.tool.AppSettings import com.coldmint.rust.pro.tool.AppSettings
import com.google.android.material.color.DynamicColors import com.google.android.material.color.DynamicColors
import com.google.android.material.color.DynamicColorsOptions import com.google.android.material.color.DynamicColorsOptions

View File

@ -2,7 +2,6 @@ package com.coldmint.rust.pro
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.Menu import android.view.Menu
@ -29,7 +28,6 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
* 搜索界面 * 搜索界面
*/ */
class SearchActivity : BaseActivity<ActivitySearchBinding>() { class SearchActivity : BaseActivity<ActivitySearchBinding>() {
lateinit var list: MutableList<String> lateinit var list: MutableList<String>
@SuppressLint("CommitPrefEdits", "NotifyDataSetChanged") @SuppressLint("CommitPrefEdits", "NotifyDataSetChanged")
@ -48,43 +46,54 @@ class SearchActivity : BaseActivity<ActivitySearchBinding>() {
viewBinding.deleat.setOnClickListener { viewBinding.deleat.setOnClickListener {
MaterialAlertDialogBuilder(this@SearchActivity) MaterialAlertDialogBuilder(this@SearchActivity)
.setTitle("清空所有历史记录") .setTitle("清空所有历史记录")
.setPositiveButton("确定"){ _, _ -> .setPositiveButton("确定") { _, _ ->
list.clear() while (list.isNotEmpty()) {
val index = 0
list.removeAt(index)
adapter.notifyItemRemoved(index)
}
getSharedPreferences("lishi", getSharedPreferences("lishi",
Context.MODE_PRIVATE).edit().putStringSet( Context.MODE_PRIVATE).edit().putStringSet(
"data", list.toSet()).apply() "data", list.toSet()).apply()
adapter.notifyDataSetChanged() /* CoroutineScope(Dispatchers.Main).launch {
while (list.isNotEmpty()) {
list.removeAt(0) // 删除第一个数据
adapter.notifyItemRemoved(0) // 刷新 RecyclerView
delay(300) // 每隔一秒执行一次删除操作
} }
.setNegativeButton("取消"){ _, _ -> }*/
}
}.show() .setNegativeButton("取消", null).show()
} }
viewBinding.searchView.onActionViewExpanded() viewBinding.searchView.onActionViewExpanded()
} }
@SuppressLint("NotifyDataSetChanged")
private fun additem(string: String) { private fun additem(string: String) {
val indexOf = list.indexOf(string)
if (indexOf != -1) {
list.remove(string) list.remove(string)
list.add(0,string) adapter.notifyItemRemoved(indexOf)
adapter.notifyDataSetChanged() }
list.add(0, string)
adapter.notifyItemInserted(0)
// 限制历史记录数量为10 // 限制历史记录数量为10
if (list.size > 10) { if (list.size > 10) {
list.removeAt(list.lastIndex) list.removeAt(list.lastIndex)
} }
val editor = getSharedPreferences("lishi", Context.MODE_PRIVATE).edit() val editor = getSharedPreferences("lishi", Context.MODE_PRIVATE).edit()
editor.putStringSet("data", list.toSet()) editor.putStringSet("data", list.toSet())
editor.apply() editor.apply()
} }
fun search(string: String) { fun search(string: String) {
val intent = Intent(this@SearchActivity, SearchResultActivity::class.java) /* val intent = Intent(this@SearchActivity, SearchResultActivity::class.java)
intent.putExtra("key",string) intent.putExtra("key",string)
startActivity(intent) startActivity(intent)*/
additem(string) additem(string)
} }
val adapter: RecyclerView.Adapter<VH> = object :RecyclerView.Adapter<VH>() {
val adapter: RecyclerView.Adapter<VH> = object : RecyclerView.Adapter<VH>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
return VH(ItemStringBinding.bind( return VH(ItemStringBinding.bind(
@ -95,13 +104,13 @@ class SearchActivity : BaseActivity<ActivitySearchBinding>() {
override fun onBindViewHolder(holder: VH, position: Int) { override fun onBindViewHolder(holder: VH, position: Int) {
holder.binding.button.text = list[position] holder.binding.button.text = list[position]
holder.binding.button.setOnClickListener{ holder.binding.button.setOnClickListener {
val a: Button = it as Button val a: Button = it as Button
search(a.text.toString()) search(a.text.toString())
} }
} }
override fun getItemCount() :Int { override fun getItemCount(): Int {
viewBinding.textview1Text1.isVisible = list.isEmpty() viewBinding.textview1Text1.isVisible = list.isEmpty()
return list.size return list.size
} }

View File

@ -1,53 +1,41 @@
package com.coldmint.rust.pro.fragments package com.coldmint.rust.pro.fragments
import android.view.LayoutInflater
import android.os.Bundle import android.os.Bundle
import android.os.Parcelable import android.view.LayoutInflater
import android.view.View
import android.widget.Toast
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.coldmint.rust.pro.MainActivity
import com.coldmint.rust.pro.R import com.coldmint.rust.pro.R
import com.coldmint.rust.pro.adapters.CommunityAdapter import com.coldmint.rust.pro.adapters.CommunityAdapter
import com.coldmint.rust.pro.base.BaseFragment import com.coldmint.rust.pro.base.BaseFragment
import com.coldmint.rust.pro.databinding.* import com.coldmint.rust.pro.databinding.FragmentCommunityBinding
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator import com.google.android.material.tabs.TabLayoutMediator
class CommunityFragment : BaseFragment<FragmentCommunityBinding>() { class CommunityFragment : BaseFragment<FragmentCommunityBinding>() {
private fun loadTab() {
fun loadTab() {
if (!isAdded) { if (!isAdded) {
return return
} }
val mainActivity = requireActivity() as MainActivity TabLayoutMediator(viewBinding.tabLayout, viewBinding.pager)
val tabLayout: TabLayout? = mainActivity.tabLayout
if (tabLayout != null) {
tabLayout.isVisible = true
TabLayoutMediator(tabLayout, viewBinding.pager)
{ tab, position -> { tab, position ->
when (position) { when (position) {
0 -> { 0 -> {
tab.text = getText(R.string.recommended) tab.text = getText(R.string.recommended)
} }
1 -> { 1 -> {
tab.text = getText(R.string.follow) tab.text = getText(R.string.follow)
} }
2 -> { 2 -> {
tab.text = getText(R.string.ranking) tab.text = getText(R.string.ranking)
} }
3 -> { 3 -> {
tab.text = getText(R.string.my) tab.text = getText(R.string.my)
} }
} }
}.attach() }.attach()
} else { /* else {
viewBinding.pager.postDelayed({ loadTab() }, MainActivity.linkInterval) viewBinding.pager.postDelayed({ loadTab() }, MainActivity.linkInterval)
} }*/
} }
@ -60,6 +48,4 @@ class CommunityFragment : BaseFragment<FragmentCommunityBinding>() {
viewBinding.pager.isSaveEnabled = false viewBinding.pager.isSaveEnabled = false
loadTab() loadTab()
} }
} }

View File

@ -16,6 +16,7 @@ import com.coldmint.rust.pro.WebModInfoActivity
import com.coldmint.rust.pro.adapters.WebModAdapter import com.coldmint.rust.pro.adapters.WebModAdapter
import com.coldmint.rust.pro.base.BaseFragment import com.coldmint.rust.pro.base.BaseFragment
import com.coldmint.rust.pro.databinding.FragmentPersonalHomeBinding import com.coldmint.rust.pro.databinding.FragmentPersonalHomeBinding
import com.coldmint.rust.pro.ui.ScrollLinearLayoutManager
import com.coldmint.rust.pro.ui.StableLinearLayoutManager import com.coldmint.rust.pro.ui.StableLinearLayoutManager
/** /**
@ -30,9 +31,9 @@ class PersonalHomeFragment(val userId: String) : BaseFragment<FragmentPersonalHo
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) { override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
viewBinding.latestWorkRecycleView.layoutManager = viewBinding.latestWorkRecycleView.layoutManager =
StableLinearLayoutManager(requireContext()) ScrollLinearLayoutManager(requireContext())
viewBinding.highestScoreRecycleView.layoutManager = viewBinding.highestScoreRecycleView.layoutManager =
StableLinearLayoutManager(requireContext()) ScrollLinearLayoutManager(requireContext())
viewBinding.highestScoreActionView.setOnClickListener { viewBinding.highestScoreActionView.setOnClickListener {
val bundle = Bundle() val bundle = Bundle()
bundle.putString( bundle.putString(

View File

@ -24,10 +24,7 @@ class TemplateFragment : BaseFragment<FragmentTemplateBinding>() {
fun loadTab() { fun loadTab() {
val mainActivity = requireActivity() as MainActivity val mainActivity = requireActivity() as MainActivity
val tabLayout: TabLayout? = mainActivity.tabLayout TabLayoutMediator(viewBinding.tabLayout, viewBinding.viewPager2)
if (tabLayout != null) {
tabLayout.isVisible = true
TabLayoutMediator(tabLayout, viewBinding.viewPager2)
{ tab, position -> { tab, position ->
when (position) { when (position) {
0 -> { 0 -> {
@ -38,9 +35,9 @@ class TemplateFragment : BaseFragment<FragmentTemplateBinding>() {
} }
} }
}.attach() }.attach()
} else { /* } else {
viewBinding.viewPager2.postDelayed({ loadTab() }, MainActivity.linkInterval) viewBinding.viewPager2.postDelayed({ loadTab() }, MainActivity.linkInterval)
} }*/
} }
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentTemplateBinding { override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentTemplateBinding {

View File

@ -1,15 +1,10 @@
package com.coldmint.rust.pro.fragments package com.coldmint.rust.pro.fragments
import android.app.Activity
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View
import android.widget.Toast
import androidx.core.view.isVisible
import com.coldmint.rust.pro.MainActivity import com.coldmint.rust.pro.MainActivity
import com.coldmint.rust.pro.R import com.coldmint.rust.pro.R
import com.coldmint.rust.pro.adapters.WarehouseAdapter import com.coldmint.rust.pro.adapters.WarehouseAdapter
import com.coldmint.rust.pro.base.BaseAdapter
import com.coldmint.rust.pro.base.BaseFragment import com.coldmint.rust.pro.base.BaseFragment
import com.coldmint.rust.pro.databinding.FragmentWarehouseBinding import com.coldmint.rust.pro.databinding.FragmentWarehouseBinding
import com.google.android.material.tabs.TabLayoutMediator import com.google.android.material.tabs.TabLayoutMediator
@ -24,17 +19,15 @@ class WarehouseFragment : BaseFragment<FragmentWarehouseBinding>() {
private fun loadTab() { private fun loadTab() {
if (isAdded) { if (isAdded) {
val mainActivity = activity as MainActivity val mainActivity = activity as MainActivity
val tableLayout = mainActivity.tabLayout /* if (tableLayout == null) {
if (tableLayout == null) {
viewBinding.pager.postDelayed({ loadTab() }, MainActivity.linkInterval) viewBinding.pager.postDelayed({ loadTab() }, MainActivity.linkInterval)
} else { } else {*/
tableLayout.isVisible = true TabLayoutMediator(viewBinding.tabLayout, viewBinding.pager) { tab, position ->
TabLayoutMediator(tableLayout, viewBinding.pager)
{ tab, position ->
when (position) { when (position) {
0 -> { 0 -> {
tab.text = getText(R.string.mod_title) tab.text = getText(R.string.mod_title)
} }
1 -> { 1 -> {
tab.text = getText(R.string.map) tab.text = getText(R.string.map)
} }
@ -42,7 +35,6 @@ class WarehouseFragment : BaseFragment<FragmentWarehouseBinding>() {
}.attach() }.attach()
} }
} }
}
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentWarehouseBinding { override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentWarehouseBinding {
return FragmentWarehouseBinding.inflate(layoutInflater) return FragmentWarehouseBinding.inflate(layoutInflater)

View File

@ -22,7 +22,6 @@ import com.coldmint.rust.pro.databinding.FragmentWebModDetailsBinding
import com.coldmint.rust.pro.tool.AppSettings import com.coldmint.rust.pro.tool.AppSettings
import com.coldmint.rust.pro.tool.GlobalMethod import com.coldmint.rust.pro.tool.GlobalMethod
import com.coldmint.rust.pro.tool.TextStyleMaker import com.coldmint.rust.pro.tool.TextStyleMaker
import com.coldmint.rust.pro.viewmodel.StartViewModel
import com.coldmint.rust.pro.viewmodel.WebModDetailsViewModel import com.coldmint.rust.pro.viewmodel.WebModDetailsViewModel
import com.google.android.material.chip.Chip import com.google.android.material.chip.Chip
import com.youth.banner.adapter.BannerImageAdapter import com.youth.banner.adapter.BannerImageAdapter
@ -125,7 +124,7 @@ class WebModDetailsFragment(val modId: String, val modNameLiveData: MutableLiveD
/** /**
* 加载页面信息 * 加载页面信息
*/ */
fun loadInfo() { private fun loadInfo() {
val token = AppSettings.getValue(AppSettings.Setting.Token, "") val token = AppSettings.getValue(AppSettings.Setting.Token, "")
WebMod.instance.getInfo(token, modId, object : ApiCallBack<WebModInfoData> { WebMod.instance.getInfo(token, modId, object : ApiCallBack<WebModInfoData> {
override fun onResponse(t: WebModInfoData) { override fun onResponse(t: WebModInfoData) {

View File

@ -1,4 +1,4 @@
package com.coldmint.rust.pro.muqing; package com.muqing.muqing;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.ClipData; import android.content.ClipData;

View File

@ -1,4 +1,4 @@
package com.coldmint.rust.pro.muqing; package com.muqing.muqing;
import android.content.Context; import android.content.Context;
import android.os.Build; import android.os.Build;

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawerlayout" android:id="@+id/drawerlayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:fitsSystemWindows="false" android:fitsSystemWindows="false"
@ -73,7 +74,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="start" android:layout_gravity="start"
app:elevation="2dp" app:elevation="2dp"
app:menu="@menu/menu_drawer_left" /> app:menu="@menu/menu_drawer_left"
tools:ignore="VisualLintBounds" />
</androidx.drawerlayout.widget.DrawerLayout> </androidx.drawerlayout.widget.DrawerLayout>

View File

@ -57,7 +57,5 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="top" android:layout_gravity="top"
android:visibility="gone" /> android:visibility="gone" />
</LinearLayout> </LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawerlayout" android:id="@+id/drawerlayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:fitsSystemWindows="true" android:fitsSystemWindows="false"
android:layout_height="match_parent"> android:layout_height="match_parent">
<androidx.coordinatorlayout.widget.CoordinatorLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
@ -22,24 +22,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" /> android:layout_height="?attr/actionBarSize" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:visibility="gone">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="已安装" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="模板社区" />
</com.google.android.material.tabs.TabLayout>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
@ -70,7 +52,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="start" android:layout_gravity="start"
app:elevation="2dp" app:elevation="2dp"
app:menu="@menu/menu_drawer_left" /> app:menu="@menu/menu_drawer_left"
tools:ignore="VisualLintBounds" />
</androidx.drawerlayout.widget.DrawerLayout> </androidx.drawerlayout.widget.DrawerLayout>

View File

@ -3,7 +3,11 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"/>
<androidx.viewpager2.widget.ViewPager2 <androidx.viewpager2.widget.ViewPager2
android:id="@+id/pager" android:id="@+id/pager"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -20,7 +20,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/no_followers" android:text="@string/no_followers"
android:textSize="16dp" android:textSize="16sp"
android:visibility="gone" /> android:visibility="gone" />
<LinearLayout <LinearLayout
@ -43,12 +43,12 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/my_follow" android:text="@string/my_follow"
android:textSize="16dp" /> android:textSize="16sp" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/headRecyclerView" android:id="@+id/headRecyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="100dp" android:layout_height="wrap_content"
android:layout_marginTop="8dp" /> android:layout_marginTop="8dp" />
</LinearLayout> </LinearLayout>

View File

@ -52,6 +52,8 @@
android:id="@+id/highestScoreRecycleView" android:id="@+id/highestScoreRecycleView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:focusableInTouchMode="false"
android:nestedScrollingEnabled="false"
android:layout_marginTop="8dp" /> android:layout_marginTop="8dp" />
</LinearLayout> </LinearLayout>
@ -110,6 +112,8 @@
android:id="@+id/latestWorkRecycleView" android:id="@+id/latestWorkRecycleView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:focusableInTouchMode="false"
android:nestedScrollingEnabled="false"
android:layout_marginTop="8dp" /> android:layout_marginTop="8dp" />
</LinearLayout> </LinearLayout>

View File

@ -1,12 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent" />
<androidx.viewpager2.widget.ViewPager2 <androidx.viewpager2.widget.ViewPager2
android:id="@+id/viewPager2" android:id="@+id/viewPager2"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent" />
</LinearLayout> </LinearLayout>

View File

@ -1,9 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent" />
<androidx.viewpager2.widget.ViewPager2 <androidx.viewpager2.widget.ViewPager2
android:id="@+id/pager" android:id="@+id/pager"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
@ -125,7 +126,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:orientation="vertical" android:orientation="vertical"
android:visibility="visible"> android:visibility="gone">
<RelativeLayout <RelativeLayout

View File

@ -9,6 +9,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:strokeWidth="1dp" app:strokeWidth="1dp"
android:textColor="@color/dark_background" app:strokeColor="?attr/colorOnSurface"
app:shapeAppearance="?attr/shapeAppearanceSmallComponent"
android:textColor="?attr/colorOnSurface"
app:rippleColor="?colorBackgroundFloating"
android:text="@string/action" /> android:text="@string/action" />
</RelativeLayout> </RelativeLayout>

View File

@ -20,6 +20,8 @@
style="@style/TextAppearance.Material3.BodyMedium" style="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="3dp"
android:paddingEnd="3dp"
android:text="@string/name" /> android:text="@string/name" />
</LinearLayout> </LinearLayout>

View File

@ -35,7 +35,6 @@ android {
dependencies { dependencies {
implementation 'com.google.android.material:material:1.6.1' implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.core:core-ktx:1.8.0' implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.5.0' implementation 'androidx.appcompat:appcompat:1.5.0'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'