修复BUG,优化UI
This commit is contained in:
parent
f78d05f340
commit
c219e92777
|
@ -20,6 +20,7 @@ import com.coldmint.rust.core.database.code.SectionInfo
|
|||
import com.coldmint.rust.pro.adapters.CodeTableAdapter
|
||||
import com.coldmint.rust.pro.base.BaseActivity
|
||||
import com.coldmint.rust.pro.databinding.ActivityCodeTableBinding
|
||||
import com.muqing.muqing.gj
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
||||
|
@ -48,7 +49,7 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
|||
if (v?.text.isNullOrEmpty()) {
|
||||
loadData()
|
||||
}else
|
||||
loadData(v?.text.toString())
|
||||
loadData(v?.text.toString())
|
||||
}
|
||||
false
|
||||
}
|
||||
|
@ -231,9 +232,9 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
|||
viewBinding.edittext.isVisible = b
|
||||
if (!b) {
|
||||
viewBinding.edittext.setText("")
|
||||
com.coldmint.rust.pro.muqing.gj.ycjp(viewBinding.edittext)
|
||||
gj.ycjp(viewBinding.edittext)
|
||||
} else {
|
||||
com.coldmint.rust.pro.muqing.gj.tcjp(viewBinding.edittext)
|
||||
gj.tcjp(viewBinding.edittext)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@ import com.coldmint.rust.pro.viewmodel.StartViewModel
|
|||
import com.google.android.material.color.DynamicColors
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import com.google.gson.Gson
|
||||
import com.gyf.immersionbar.ImmersionBar
|
||||
import org.json.JSONObject
|
||||
|
@ -56,14 +55,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
private lateinit var appBarConfiguration: AppBarConfiguration
|
||||
private var oldLanguage: String? = null
|
||||
private var first = true
|
||||
var oldDynamicColor = false
|
||||
var tabLayout: TabLayout? = null
|
||||
val headLayout by lazy {
|
||||
private var oldDynamicColor = false
|
||||
private val headLayout by lazy {
|
||||
HeadLayoutBinding.inflate(layoutInflater)
|
||||
}
|
||||
|
||||
val startViewModel by lazy {
|
||||
ViewModelProvider(this).get(StartViewModel::class.java)
|
||||
ViewModelProvider(this)[StartViewModel::class.java]
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -75,14 +72,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
/**
|
||||
* 将Toolbar设置为ActionBar
|
||||
*/
|
||||
fun useToolbarSetSupportActionBar() {
|
||||
tabLayout = viewBinding.tabLayout
|
||||
private fun useToolbarSetSupportActionBar() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化导航
|
||||
*/
|
||||
fun initNav() {
|
||||
private fun initNav() {
|
||||
appBarConfiguration = AppBarConfiguration(
|
||||
setOf(R.id.community_item, R.id.mod_item, R.id.database_item, R.id.template_item),
|
||||
viewBinding.drawerlayout
|
||||
|
@ -119,7 +115,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
/**
|
||||
* 检查App更新
|
||||
*/
|
||||
fun checkAppUpdate() {
|
||||
private fun checkAppUpdate() {
|
||||
AppUpdate().getUpdate(object : ApiCallBack<AppUpdateData> {
|
||||
override fun onResponse(t: AppUpdateData) {
|
||||
val data = t.data
|
||||
|
@ -183,12 +179,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
} else {
|
||||
materialAlertDialogBuilder.setNegativeButton(
|
||||
R.string.dialog_cancel
|
||||
) { i, i2 ->
|
||||
) { _, _ ->
|
||||
}
|
||||
}
|
||||
materialAlertDialogBuilder.setPositiveButton(
|
||||
R.string.downlod
|
||||
) { i, i2 ->
|
||||
) { _, _ ->
|
||||
AppOperator.useBrowserAccessWebPage(this, data.link)
|
||||
}
|
||||
materialAlertDialogBuilder.show()
|
||||
|
@ -200,7 +196,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
/**
|
||||
* 显示游戏配置对话框
|
||||
*/
|
||||
fun showGameConfiguredDialog() {
|
||||
private fun showGameConfiguredDialog() {
|
||||
if (!AppSettings.getValue(AppSettings.Setting.SetGameStorage, false)) {
|
||||
try {
|
||||
val packageInfo = packageManager.getPackageInfo(
|
||||
|
@ -212,16 +208,16 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
if (versionCode >= 159) {
|
||||
MaterialAlertDialogBuilder(this).setTitle(R.string.game_configured)
|
||||
.setMessage(R.string.unable_to_detect)
|
||||
.setPositiveButton(R.string.show_details) { i, i2 ->
|
||||
.setPositiveButton(R.string.show_details) { _, _ ->
|
||||
startActivity(
|
||||
Intent(
|
||||
this@MainActivity,
|
||||
GameCheckActivity::class.java
|
||||
)
|
||||
)
|
||||
}.setNeutralButton(R.string.no_longer_prompt) { i, i2 ->
|
||||
}.setNeutralButton(R.string.no_longer_prompt) { _, _ ->
|
||||
AppSettings.setValue(AppSettings.Setting.SetGameStorage, true)
|
||||
}.setNeutralButton(R.string.dialog_cancel) { i, i2 ->
|
||||
}.setNeutralButton(R.string.dialog_cancel) { _, _ ->
|
||||
}.setCancelable(false).show()
|
||||
} else {
|
||||
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 dataBase = menu.findItem(R.id.database_item)
|
||||
val template = menu.findItem(R.id.template_item)
|
||||
|
@ -292,7 +288,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
//数据库
|
||||
dataBase.setOnMenuItemClickListener {
|
||||
viewBinding.mainButton.postOnAnimationDelayed({
|
||||
viewBinding.tabLayout.isVisible = false
|
||||
// viewBinding.tabLayout.isVisible = false
|
||||
viewBinding.mainButton.hide()
|
||||
}, hideViewDelay)
|
||||
false
|
||||
|
@ -300,7 +296,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
|
||||
template.setOnMenuItemClickListener {
|
||||
viewBinding.mainButton.postOnAnimationDelayed({
|
||||
viewBinding.tabLayout.isVisible = true
|
||||
// viewBinding.tabLayout.isVisible = true
|
||||
viewBinding.mainButton.show()
|
||||
}, hideViewDelay)
|
||||
false
|
||||
|
@ -339,7 +335,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
GlobalMethod.requestStoragePermissions(this) {
|
||||
if (it) {
|
||||
viewBinding.mainButton.postOnAnimationDelayed({
|
||||
viewBinding.tabLayout.isVisible = true
|
||||
// viewBinding.tabLayout.isVisible = true
|
||||
if (isActive) {
|
||||
viewBinding.mainButton.show()
|
||||
}
|
||||
|
@ -348,15 +344,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
}
|
||||
false
|
||||
}
|
||||
|
||||
community.setOnMenuItemClickListener {
|
||||
viewBinding.mainButton.postOnAnimationDelayed({
|
||||
viewBinding.tabLayout.isVisible = true
|
||||
// viewBinding.tabLayout.isVisible = true
|
||||
viewBinding.mainButton.hide()
|
||||
}, hideViewDelay)
|
||||
false
|
||||
}
|
||||
|
||||
menu.findItem(R.id.startGame).setOnMenuItemClickListener {
|
||||
val packName = AppSettings.getValue(
|
||||
AppSettings.Setting.GamePackage,
|
||||
|
@ -480,7 +474,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
* @param formFile File 文件
|
||||
* @param templateDirectory File 模板文件夹
|
||||
*/
|
||||
fun importTemplate(formFile: File, templateDirectory: File) {
|
||||
private fun importTemplate(formFile: File, templateDirectory: File) {
|
||||
val handler = Handler(Looper.getMainLooper())
|
||||
Thread(Runnable {
|
||||
//如果建立缓存完成,并且模板文件存在
|
||||
|
@ -533,10 +527,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
getString(R.string.covers_the_import),
|
||||
newInfo.versionName, oldInfo.versionName
|
||||
)
|
||||
).setPositiveButton(R.string.dialog_ok) { i, i2 ->
|
||||
).setPositiveButton(R.string.dialog_ok) { _, _ ->
|
||||
FileOperator.delete_files(templateDirectory)
|
||||
importTemplate(formFile, templateDirectory)
|
||||
}.setNegativeButton(R.string.dialog_cancel) { i, i2 ->
|
||||
}.setNegativeButton(R.string.dialog_cancel) { _, _ ->
|
||||
}.show()
|
||||
}
|
||||
return@Runnable
|
||||
|
@ -661,7 +655,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
/**
|
||||
* 观察启动视图
|
||||
*/
|
||||
fun observeStartViewModel() {
|
||||
private fun observeStartViewModel() {
|
||||
startViewModel.userLiveData.observe(this) {
|
||||
headLayout.nameView.text = it.data.userName
|
||||
headLayout.emailView.text = it.data.email
|
||||
|
@ -746,7 +740,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
AppSettings.Setting.DynamicColor,
|
||||
DynamicColors.isDynamicColorAvailable()
|
||||
)
|
||||
useToolbarSetSupportActionBar()
|
||||
// useToolbarSetSupportActionBar()
|
||||
initNav()
|
||||
observeStartViewModel()
|
||||
//偏移fab
|
||||
|
|
|
@ -9,7 +9,7 @@ import android.os.Bundle
|
|||
import cat.ereza.customactivityoncrash.config.CaocConfig
|
||||
import com.coldmint.rust.core.debug.LogCat
|
||||
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.google.android.material.color.DynamicColors
|
||||
import com.google.android.material.color.DynamicColorsOptions
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.coldmint.rust.pro
|
|||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.Menu
|
||||
|
@ -29,7 +28,6 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
|||
* 搜索界面
|
||||
*/
|
||||
class SearchActivity : BaseActivity<ActivitySearchBinding>() {
|
||||
|
||||
lateinit var list: MutableList<String>
|
||||
|
||||
@SuppressLint("CommitPrefEdits", "NotifyDataSetChanged")
|
||||
|
@ -48,43 +46,54 @@ class SearchActivity : BaseActivity<ActivitySearchBinding>() {
|
|||
viewBinding.deleat.setOnClickListener {
|
||||
MaterialAlertDialogBuilder(this@SearchActivity)
|
||||
.setTitle("清空所有历史记录")
|
||||
.setPositiveButton("确定"){ _, _ ->
|
||||
list.clear()
|
||||
getSharedPreferences("lishi",
|
||||
Context.MODE_PRIVATE).edit().putStringSet(
|
||||
"data", list.toSet()).apply()
|
||||
adapter.notifyDataSetChanged()
|
||||
.setPositiveButton("确定") { _, _ ->
|
||||
while (list.isNotEmpty()) {
|
||||
val index = 0
|
||||
list.removeAt(index)
|
||||
adapter.notifyItemRemoved(index)
|
||||
}
|
||||
getSharedPreferences("lishi",
|
||||
Context.MODE_PRIVATE).edit().putStringSet(
|
||||
"data", list.toSet()).apply()
|
||||
/* CoroutineScope(Dispatchers.Main).launch {
|
||||
while (list.isNotEmpty()) {
|
||||
list.removeAt(0) // 删除第一个数据
|
||||
adapter.notifyItemRemoved(0) // 刷新 RecyclerView
|
||||
delay(300) // 每隔一秒执行一次删除操作
|
||||
}
|
||||
}*/
|
||||
}
|
||||
.setNegativeButton("取消"){ _, _ ->
|
||||
|
||||
}.show()
|
||||
.setNegativeButton("取消", null).show()
|
||||
}
|
||||
viewBinding.searchView.onActionViewExpanded()
|
||||
|
||||
}
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
|
||||
private fun additem(string: String) {
|
||||
list.remove(string)
|
||||
list.add(0,string)
|
||||
adapter.notifyDataSetChanged()
|
||||
val indexOf = list.indexOf(string)
|
||||
if (indexOf != -1) {
|
||||
list.remove(string)
|
||||
adapter.notifyItemRemoved(indexOf)
|
||||
}
|
||||
list.add(0, string)
|
||||
adapter.notifyItemInserted(0)
|
||||
// 限制历史记录数量为10
|
||||
if (list.size > 10) {
|
||||
list.removeAt(list.lastIndex)
|
||||
}
|
||||
|
||||
val editor = getSharedPreferences("lishi", Context.MODE_PRIVATE).edit()
|
||||
editor.putStringSet("data", list.toSet())
|
||||
editor.apply()
|
||||
}
|
||||
|
||||
fun search(string: String) {
|
||||
val intent = Intent(this@SearchActivity, SearchResultActivity::class.java)
|
||||
intent.putExtra("key",string)
|
||||
startActivity(intent)
|
||||
/* val intent = Intent(this@SearchActivity, SearchResultActivity::class.java)
|
||||
intent.putExtra("key",string)
|
||||
startActivity(intent)*/
|
||||
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 {
|
||||
return VH(ItemStringBinding.bind(
|
||||
|
@ -95,13 +104,13 @@ class SearchActivity : BaseActivity<ActivitySearchBinding>() {
|
|||
|
||||
override fun onBindViewHolder(holder: VH, position: Int) {
|
||||
holder.binding.button.text = list[position]
|
||||
holder.binding.button.setOnClickListener{
|
||||
holder.binding.button.setOnClickListener {
|
||||
val a: Button = it as Button
|
||||
search(a.text.toString())
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount() :Int {
|
||||
override fun getItemCount(): Int {
|
||||
viewBinding.textview1Text1.isVisible = list.isEmpty()
|
||||
return list.size
|
||||
}
|
||||
|
|
|
@ -1,53 +1,41 @@
|
|||
package com.coldmint.rust.pro.fragments
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
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 android.view.LayoutInflater
|
||||
import com.coldmint.rust.pro.R
|
||||
import com.coldmint.rust.pro.adapters.CommunityAdapter
|
||||
import com.coldmint.rust.pro.base.BaseFragment
|
||||
import com.coldmint.rust.pro.databinding.*
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import com.coldmint.rust.pro.databinding.FragmentCommunityBinding
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
|
||||
class CommunityFragment : BaseFragment<FragmentCommunityBinding>() {
|
||||
|
||||
|
||||
|
||||
fun loadTab() {
|
||||
private fun loadTab() {
|
||||
if (!isAdded) {
|
||||
return
|
||||
}
|
||||
val mainActivity = requireActivity() as MainActivity
|
||||
val tabLayout: TabLayout? = mainActivity.tabLayout
|
||||
if (tabLayout != null) {
|
||||
tabLayout.isVisible = true
|
||||
TabLayoutMediator(tabLayout, viewBinding.pager)
|
||||
{ tab, position ->
|
||||
when (position) {
|
||||
0 -> {
|
||||
tab.text = getText(R.string.recommended)
|
||||
}
|
||||
1 -> {
|
||||
tab.text = getText(R.string.follow)
|
||||
}
|
||||
2 -> {
|
||||
tab.text = getText(R.string.ranking)
|
||||
}
|
||||
3 -> {
|
||||
tab.text = getText(R.string.my)
|
||||
}
|
||||
TabLayoutMediator(viewBinding.tabLayout, viewBinding.pager)
|
||||
{ tab, position ->
|
||||
when (position) {
|
||||
0 -> {
|
||||
tab.text = getText(R.string.recommended)
|
||||
}
|
||||
}.attach()
|
||||
} else {
|
||||
|
||||
1 -> {
|
||||
tab.text = getText(R.string.follow)
|
||||
}
|
||||
|
||||
2 -> {
|
||||
tab.text = getText(R.string.ranking)
|
||||
}
|
||||
|
||||
3 -> {
|
||||
tab.text = getText(R.string.my)
|
||||
}
|
||||
}
|
||||
}.attach()
|
||||
/* else {
|
||||
viewBinding.pager.postDelayed({ loadTab() }, MainActivity.linkInterval)
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,6 +48,4 @@ class CommunityFragment : BaseFragment<FragmentCommunityBinding>() {
|
|||
viewBinding.pager.isSaveEnabled = false
|
||||
loadTab()
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -16,6 +16,7 @@ import com.coldmint.rust.pro.WebModInfoActivity
|
|||
import com.coldmint.rust.pro.adapters.WebModAdapter
|
||||
import com.coldmint.rust.pro.base.BaseFragment
|
||||
import com.coldmint.rust.pro.databinding.FragmentPersonalHomeBinding
|
||||
import com.coldmint.rust.pro.ui.ScrollLinearLayoutManager
|
||||
import com.coldmint.rust.pro.ui.StableLinearLayoutManager
|
||||
|
||||
/**
|
||||
|
@ -30,30 +31,30 @@ class PersonalHomeFragment(val userId: String) : BaseFragment<FragmentPersonalHo
|
|||
|
||||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
||||
viewBinding.latestWorkRecycleView.layoutManager =
|
||||
StableLinearLayoutManager(requireContext())
|
||||
ScrollLinearLayoutManager(requireContext())
|
||||
viewBinding.highestScoreRecycleView.layoutManager =
|
||||
StableLinearLayoutManager(requireContext())
|
||||
ScrollLinearLayoutManager(requireContext())
|
||||
viewBinding.highestScoreActionView.setOnClickListener {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(
|
||||
"title", viewBinding.highestScoreView.text.toString()
|
||||
"title", viewBinding.highestScoreView.text.toString()
|
||||
)
|
||||
bundle.putString("action", "user-download")
|
||||
bundle.putString("account", userId)
|
||||
val thisIntent =
|
||||
Intent(requireContext(), TagActivity::class.java)
|
||||
Intent(requireContext(), TagActivity::class.java)
|
||||
thisIntent.putExtra("data", bundle)
|
||||
startActivity(thisIntent)
|
||||
}
|
||||
viewBinding.latestWorkActionView.setOnClickListener {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(
|
||||
"title", viewBinding.latestWorkView.text.toString()
|
||||
"title", viewBinding.latestWorkView.text.toString()
|
||||
)
|
||||
bundle.putString("action", "user-time")
|
||||
bundle.putString("account", userId)
|
||||
val thisIntent =
|
||||
Intent(requireContext(), TagActivity::class.java)
|
||||
Intent(requireContext(), TagActivity::class.java)
|
||||
thisIntent.putExtra("data", bundle)
|
||||
startActivity(thisIntent)
|
||||
}
|
||||
|
|
|
@ -24,10 +24,7 @@ class TemplateFragment : BaseFragment<FragmentTemplateBinding>() {
|
|||
|
||||
fun loadTab() {
|
||||
val mainActivity = requireActivity() as MainActivity
|
||||
val tabLayout: TabLayout? = mainActivity.tabLayout
|
||||
if (tabLayout != null) {
|
||||
tabLayout.isVisible = true
|
||||
TabLayoutMediator(tabLayout, viewBinding.viewPager2)
|
||||
TabLayoutMediator(viewBinding.tabLayout, viewBinding.viewPager2)
|
||||
{ tab, position ->
|
||||
when (position) {
|
||||
0 -> {
|
||||
|
@ -38,9 +35,9 @@ class TemplateFragment : BaseFragment<FragmentTemplateBinding>() {
|
|||
}
|
||||
}
|
||||
}.attach()
|
||||
} else {
|
||||
/* } else {
|
||||
viewBinding.viewPager2.postDelayed({ loadTab() }, MainActivity.linkInterval)
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentTemplateBinding {
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
package com.coldmint.rust.pro.fragments
|
||||
|
||||
import android.app.Activity
|
||||
import android.os.Bundle
|
||||
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.R
|
||||
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.databinding.FragmentWarehouseBinding
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
|
@ -24,23 +19,20 @@ class WarehouseFragment : BaseFragment<FragmentWarehouseBinding>() {
|
|||
private fun loadTab() {
|
||||
if (isAdded) {
|
||||
val mainActivity = activity as MainActivity
|
||||
val tableLayout = mainActivity.tabLayout
|
||||
if (tableLayout == null) {
|
||||
/* if (tableLayout == null) {
|
||||
viewBinding.pager.postDelayed({ loadTab() }, MainActivity.linkInterval)
|
||||
} else {
|
||||
tableLayout.isVisible = true
|
||||
TabLayoutMediator(tableLayout, viewBinding.pager)
|
||||
{ tab, position ->
|
||||
when (position) {
|
||||
0 -> {
|
||||
tab.text = getText(R.string.mod_title)
|
||||
}
|
||||
1 -> {
|
||||
tab.text = getText(R.string.map)
|
||||
}
|
||||
} else {*/
|
||||
TabLayoutMediator(viewBinding.tabLayout, viewBinding.pager) { tab, position ->
|
||||
when (position) {
|
||||
0 -> {
|
||||
tab.text = getText(R.string.mod_title)
|
||||
}
|
||||
}.attach()
|
||||
}
|
||||
|
||||
1 -> {
|
||||
tab.text = getText(R.string.map)
|
||||
}
|
||||
}
|
||||
}.attach()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import com.coldmint.rust.pro.databinding.FragmentWebModDetailsBinding
|
|||
import com.coldmint.rust.pro.tool.AppSettings
|
||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||
import com.coldmint.rust.pro.tool.TextStyleMaker
|
||||
import com.coldmint.rust.pro.viewmodel.StartViewModel
|
||||
import com.coldmint.rust.pro.viewmodel.WebModDetailsViewModel
|
||||
import com.google.android.material.chip.Chip
|
||||
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, "")
|
||||
WebMod.instance.getInfo(token, modId, object : ApiCallBack<WebModInfoData> {
|
||||
override fun onResponse(t: WebModInfoData) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.coldmint.rust.pro.muqing;
|
||||
package com.muqing.muqing;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ClipData;
|
|
@ -1,4 +1,4 @@
|
|||
package com.coldmint.rust.pro.muqing;
|
||||
package com.muqing.muqing;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/drawerlayout"
|
||||
android:layout_width="match_parent"
|
||||
android:fitsSystemWindows="false"
|
||||
|
@ -73,7 +74,8 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
app:elevation="2dp"
|
||||
app:menu="@menu/menu_drawer_left" />
|
||||
app:menu="@menu/menu_drawer_left"
|
||||
tools:ignore="VisualLintBounds" />
|
||||
|
||||
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
|
@ -57,7 +57,5 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -4,7 +4,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/drawerlayout"
|
||||
android:layout_width="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
android:fitsSystemWindows="false"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
|
@ -22,24 +22,6 @@
|
|||
android:layout_width="match_parent"
|
||||
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>
|
||||
|
||||
|
||||
|
@ -70,7 +52,8 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
app:elevation="2dp"
|
||||
app:menu="@menu/menu_drawer_left" />
|
||||
app:menu="@menu/menu_drawer_left"
|
||||
tools:ignore="VisualLintBounds" />
|
||||
|
||||
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
|
@ -3,7 +3,11 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_width="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
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/no_followers"
|
||||
android:textSize="16dp"
|
||||
android:textSize="16sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
|
@ -43,12 +43,12 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/my_follow"
|
||||
android:textSize="16dp" />
|
||||
android:textSize="16sp" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/headRecyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -52,6 +52,8 @@
|
|||
android:id="@+id/highestScoreRecycleView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusableInTouchMode="false"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:layout_marginTop="8dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -110,6 +112,8 @@
|
|||
android:id="@+id/latestWorkRecycleView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusableInTouchMode="false"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:layout_marginTop="8dp" />
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
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
|
||||
android:id="@+id/viewPager2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,9 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="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
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
@ -125,7 +126,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible">
|
||||
android:visibility="gone">
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
|
|
|
@ -8,7 +8,10 @@
|
|||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:strokeWidth="1dp"
|
||||
android:textColor="@color/dark_background"
|
||||
app:strokeWidth="1dp"
|
||||
app:strokeColor="?attr/colorOnSurface"
|
||||
app:shapeAppearance="?attr/shapeAppearanceSmallComponent"
|
||||
android:textColor="?attr/colorOnSurface"
|
||||
app:rippleColor="?colorBackgroundFloating"
|
||||
android:text="@string/action" />
|
||||
</RelativeLayout>
|
|
@ -20,6 +20,8 @@
|
|||
style="@style/TextAppearance.Material3.BodyMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:text="@string/name" />
|
||||
|
||||
</LinearLayout>
|
|
@ -35,7 +35,6 @@ android {
|
|||
dependencies {
|
||||
|
||||
implementation 'com.google.android.material:material:1.6.1'
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.8.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.5.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
|
|
Loading…
Reference in New Issue
Block a user