评论升级

This commit is contained in:
coldmint 2022-07-13 07:53:18 +08:00
parent 3a691b33aa
commit 1afe92d237
53 changed files with 1047 additions and 544 deletions

Binary file not shown.

View File

@ -10,7 +10,6 @@ import android.text.style.ClickableSpan
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import android.view.View import android.view.View
import android.widget.Toast
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager

View File

@ -9,12 +9,10 @@ import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import android.view.View
import androidx.core.view.isVisible import androidx.core.view.isVisible
import com.coldmint.rust.pro.adapters.ApplicationListAdapter import com.coldmint.rust.pro.adapters.ApplicationListAdapter
import com.coldmint.rust.pro.base.BaseActivity import com.coldmint.rust.pro.base.BaseActivity
import com.coldmint.rust.pro.databinding.ActivityApplicationListBinding import com.coldmint.rust.pro.databinding.ActivityApplicationListBinding
import com.coldmint.rust.pro.tool.Decoration
import java.util.ArrayList import java.util.ArrayList
class ApplicationListActivity : BaseActivity<ActivityApplicationListBinding>() { class ApplicationListActivity : BaseActivity<ActivityApplicationListBinding>() {

View File

@ -123,8 +123,7 @@ class CreateModActivity : BaseActivity<ActivityCreateModBinding>() {
fileWriter.close() fileWriter.close()
finish() finish()
} catch (e: IOException) { } catch (e: IOException) {
Toast.makeText(this@CreateModActivity, e.toString(), Toast.LENGTH_SHORT) e.printStackTrace()
.show()
} }
} else { } else {
Toast.makeText(this@CreateModActivity, "你的手机拒绝创建目录", Toast.LENGTH_SHORT).show() Toast.makeText(this@CreateModActivity, "你的手机拒绝创建目录", Toast.LENGTH_SHORT).show()

View File

@ -5,12 +5,17 @@ import android.content.Intent
import cat.ereza.customactivityoncrash.CustomActivityOnCrash import cat.ereza.customactivityoncrash.CustomActivityOnCrash
import com.coldmint.rust.pro.tool.AppSettings import com.coldmint.rust.pro.tool.AppSettings
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.pm.PackageManager
import android.os.Bundle import android.os.Bundle
import android.util.Log import android.util.Log
import android.view.KeyEvent import android.view.KeyEvent
import android.view.MenuItem import android.view.MenuItem
import android.view.View import android.view.View
import androidx.core.view.isVisible
import com.coldmint.rust.core.dataBean.ApiResponse
import com.coldmint.rust.core.interfaces.ApiCallBack
import com.coldmint.rust.core.tool.FileOperator import com.coldmint.rust.core.tool.FileOperator
import com.coldmint.rust.core.web.ErrorReport
import com.coldmint.rust.core.web.ServerConfiguration import com.coldmint.rust.core.web.ServerConfiguration
import com.coldmint.rust.pro.databean.ErrorInfo import com.coldmint.rust.pro.databean.ErrorInfo
import com.coldmint.rust.pro.databinding.ActivityErrorBinding import com.coldmint.rust.pro.databinding.ActivityErrorBinding
@ -47,6 +52,25 @@ class ErrorActivity() : BaseActivity<ActivityErrorBinding>() {
} }
viewBinding.errorInfo.text = errorInfo.allErrorDetails viewBinding.errorInfo.text = errorInfo.allErrorDetails
Log.e("错误日志", errorInfo.allErrorDetails) Log.e("错误日志", errorInfo.allErrorDetails)
if (appSettings.getValue(AppSettings.Setting.ExperiencePlan, true)) {
val info = packageManager.getPackageInfo(packageName, 0)
ErrorReport.instance.send(
errorInfo.allErrorDetails,
info.versionName,
info.versionCode,
object : ApiCallBack<ApiResponse> {
override fun onResponse(t: ApiResponse) {
if (t.code == ServerConfiguration.Success_Code) {
viewBinding.shareLogButton.isVisible = false
}
}
override fun onFailure(e: Exception) {
e.printStackTrace()
}
})
}
saveLog() saveLog()
} }
} }

View File

@ -8,11 +8,9 @@ import com.coldmint.rust.pro.tool.AppSettings
import android.content.Intent import android.content.Intent
import android.content.pm.PackageManager import android.content.pm.PackageManager
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import android.widget.Toast
import android.os.* import android.os.*
import android.util.Log import android.util.Log
import android.view.* import android.view.*
import android.widget.SearchView
import androidx.core.view.GravityCompat import androidx.core.view.GravityCompat
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
@ -20,6 +18,7 @@ import androidx.navigation.findNavController
import androidx.navigation.ui.* import androidx.navigation.ui.*
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.coldmint.rust.pro.dialog.CommentDialog
import com.coldmint.dialog.CoreDialog import com.coldmint.dialog.CoreDialog
import com.coldmint.rust.core.CompressionManager import com.coldmint.rust.core.CompressionManager
import com.coldmint.rust.core.TemplatePackage import com.coldmint.rust.core.TemplatePackage
@ -48,7 +47,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
private var oldLanguage: String? = null private var oldLanguage: String? = null
private var first = true private var first = true
var tabLayout: TabLayout? = null var tabLayout: TabLayout? = null
lateinit var searchView: SearchView
val headLayout by lazy { val headLayout by lazy {
HeadLayoutBinding.inflate(layoutInflater) HeadLayoutBinding.inflate(layoutInflater)
} }
@ -86,9 +84,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
viewBinding.mainButton.hide() viewBinding.mainButton.hide()
R.id.community_item R.id.community_item
} else { } else {
viewBinding.toolbar.postDelayed({
searchView.isVisible = false
}, linkInterval)
R.id.mod_item R.id.mod_item
} }
navController.graph = this navController.graph = this
@ -256,11 +251,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
val codeTable = menu.findItem(R.id.code_table) val codeTable = menu.findItem(R.id.code_table)
val mod = menu.findItem(R.id.mod_item) val mod = menu.findItem(R.id.mod_item)
val community = menu.findItem(R.id.community_item) val community = menu.findItem(R.id.community_item)
val help = menu.findItem(R.id.help) // val help = menu.findItem(R.id.help)
//管理可见性 //管理可见性
dataBase.isVisible = isActive dataBase.isVisible = isActive
template.isVisible = isActive template.isVisible = isActive
help.isVisible = isActive // help.isVisible = isActive
codeTable.isVisible = isActive codeTable.isVisible = isActive
if (mod.isChecked) { if (mod.isChecked) {
viewBinding.mainButton.isVisible = isActive viewBinding.mainButton.isVisible = isActive
@ -272,7 +267,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
viewBinding.tabLayout.isVisible = false viewBinding.tabLayout.isVisible = false
viewBinding.mainButton.hide() viewBinding.mainButton.hide()
}, hideViewDelay) }, hideViewDelay)
searchView.isVisible = false
false false
} }
@ -281,7 +275,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
viewBinding.tabLayout.isVisible = false viewBinding.tabLayout.isVisible = false
viewBinding.mainButton.show() viewBinding.mainButton.show()
}, hideViewDelay) }, hideViewDelay)
searchView.isVisible = false
false false
} }
@ -307,7 +300,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
startActivity(intent) startActivity(intent)
} }
else -> { else -> {
Toast.makeText(this@MainActivity, "请设置事件", Toast.LENGTH_SHORT).show()
} }
} }
} }
@ -318,7 +310,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
if (it) { if (it) {
viewBinding.mainButton.postOnAnimationDelayed({ viewBinding.mainButton.postOnAnimationDelayed({
viewBinding.tabLayout.isVisible = true viewBinding.tabLayout.isVisible = true
searchView.isVisible = false
if (isActive) { if (isActive) {
viewBinding.mainButton.show() viewBinding.mainButton.show()
} }
@ -330,7 +321,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
community.setOnMenuItemClickListener { community.setOnMenuItemClickListener {
viewBinding.mainButton.postOnAnimationDelayed({ viewBinding.mainButton.postOnAnimationDelayed({
searchView.isVisible = true
viewBinding.tabLayout.isVisible = true viewBinding.tabLayout.isVisible = true
viewBinding.mainButton.hide() viewBinding.mainButton.hide()
}, hideViewDelay) }, hideViewDelay)
@ -364,18 +354,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
false false
} }
help.setOnMenuItemClickListener {
AppOperator.useBrowserAccessWebPage(
this,
"https://www.kancloud.cn/coldmint/rust_assistant"
)
false
}
menu.findItem(R.id.donation).setOnMenuItemClickListener {
AppOperator.useBrowserAccessWebPage(this@MainActivity, "https://afdian.net/@coldmint")
false
}
//激活暂时不可用 //激活暂时不可用
val longTime = appSettings.getValue( val longTime = appSettings.getValue(
AppSettings.Setting.ExpirationTime, AppSettings.Setting.ExpirationTime,
@ -752,6 +730,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
initNav() initNav()
observeStartViewModel() observeStartViewModel()
checkAppUpdate() checkAppUpdate()
CommentDialog(this).show()
} else { } else {
startViewModel.initAllData() startViewModel.initAllData()
} }

View File

@ -2,19 +2,19 @@ package com.coldmint.rust.pro
import android.app.Application import android.app.Application
import android.content.Context import android.content.Context
import android.os.Environment
import android.util.Log import android.util.Log
import cat.ereza.customactivityoncrash.config.CaocConfig import cat.ereza.customactivityoncrash.config.CaocConfig
import com.coldmint.rust.core.web.ServerConfiguration
import com.coldmint.rust.pro.tool.AppSettings import com.coldmint.rust.pro.tool.AppSettings
import com.coldmint.rust.pro.tool.GlobalMethod
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
import com.hjq.language.MultiLanguages import com.hjq.language.MultiLanguages
import java.util.*
class RustApplication : Application() { class RustApplication : Application() {
// companion object {
// val appId = "61853bf9e0f9bb492b4f7eba"
// val channel = "Umeng"
// }
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
@ -47,6 +47,8 @@ class RustApplication : Application() {
} }
override fun attachBaseContext(base: Context?) { override fun attachBaseContext(base: Context?) {
super.attachBaseContext(MultiLanguages.attach(base)) super.attachBaseContext(MultiLanguages.attach(base))
} }

View File

@ -6,9 +6,11 @@ import android.os.Bundle
import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.SearchView
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.coldmint.rust.core.dataBean.HotSearchData
import com.coldmint.rust.core.dataBean.SearchSuggestionsData import com.coldmint.rust.core.dataBean.SearchSuggestionsData
import com.coldmint.rust.core.interfaces.ApiCallBack import com.coldmint.rust.core.interfaces.ApiCallBack
import com.coldmint.rust.core.web.Search import com.coldmint.rust.core.web.Search
import com.coldmint.rust.pro.adapters.HotSearchAdapter
import com.coldmint.rust.pro.adapters.SearchSuggestionsAdapter import com.coldmint.rust.pro.adapters.SearchSuggestionsAdapter
import com.coldmint.rust.pro.base.BaseActivity import com.coldmint.rust.pro.base.BaseActivity
import com.coldmint.rust.pro.databinding.ActivitySearchBinding import com.coldmint.rust.pro.databinding.ActivitySearchBinding
@ -21,7 +23,34 @@ class SearchActivity : BaseActivity<ActivitySearchBinding>() {
title = getString(R.string.search) title = getString(R.string.search)
setReturnButton() setReturnButton()
viewBinding.recyclerView.layoutManager = LinearLayoutManager(this) viewBinding.recyclerView.layoutManager = LinearLayoutManager(this)
viewBinding.hotSearchView.layoutManager = LinearLayoutManager(this)
loadSearchView()
loadHotSearch()
}
private fun loadHotSearch() {
Search.instance.hotSearch(object : ApiCallBack<HotSearchData> {
override fun onResponse(t: HotSearchData) {
val adapter = HotSearchAdapter(this@SearchActivity, t.data)
adapter.setItemEvent { i, itemHotSearchBinding, viewHolder, data ->
itemHotSearchBinding.root.setOnClickListener {
val intent = Intent(this@SearchActivity, SearchResultActivity::class.java)
intent.putExtra("key", data.keyword)
startActivity(intent)
}
}
viewBinding.hotSearchView.adapter = adapter
}
override fun onFailure(e: Exception) {
}
})
}
private fun loadSearchView() {
viewBinding.searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener, viewBinding.searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener,
android.widget.SearchView.OnQueryTextListener { android.widget.SearchView.OnQueryTextListener {
override fun onQueryTextSubmit(query: String?): Boolean { override fun onQueryTextSubmit(query: String?): Boolean {

View File

@ -0,0 +1,28 @@
package com.coldmint.rust.pro.adapters
import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import com.coldmint.rust.core.dataBean.HotSearchData
import com.coldmint.rust.pro.base.BaseAdapter
import com.coldmint.rust.pro.databinding.ItemHotSearchBinding
class HotSearchAdapter(context: Context, dataList: MutableList<HotSearchData.Data>) :
BaseAdapter<ItemHotSearchBinding, HotSearchData.Data>(context, dataList) {
override fun getViewBindingObject(
layoutInflater: LayoutInflater,
parent: ViewGroup,
viewType: Int
): ItemHotSearchBinding {
return ItemHotSearchBinding.inflate(layoutInflater,parent,false)
}
override fun onBingView(
data: HotSearchData.Data,
viewBinding: ItemHotSearchBinding,
viewHolder: ViewHolder<ItemHotSearchBinding>,
position: Int
) {
viewBinding.titleView.text = data.keyword
}
}

View File

@ -0,0 +1,49 @@
package com.coldmint.rust.pro.dialog
import android.R
import android.content.Context
import android.text.Editable
import android.text.TextWatcher
import android.view.*
import com.coldmint.dialog.BaseBottomDialog
import com.coldmint.rust.pro.databinding.DialogCommentBinding
import com.coldmint.rust.pro.tool.LinkAutoCompleteHelper
import com.coldmint.rust.pro.tool.TextStyleMaker
import com.google.android.material.bottomsheet.BottomSheetBehavior
/**
* 评论对话框部分方法与输入对话框逻辑相同
* @property autoDismiss Boolean
* @property inputCanBeEmpty Boolean
* @property errorTipFunction Function2<String, TextInputLayout, Unit>?
*/
class CommentDialog(context: Context) : BaseBottomDialog<DialogCommentBinding>(context) {
override fun getViewBindingObject(layoutInflater: LayoutInflater): DialogCommentBinding {
return DialogCommentBinding.inflate(layoutInflater)
}
override fun onShowDialog(viewBinding: DialogCommentBinding) {
viewBinding.textInputEditText.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
}
override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
}
override fun afterTextChanged(p0: Editable?) {
if (p0 != null) {
TextStyleMaker.instance.setStyle(p0, { type, data ->
TextStyleMaker.instance.clickEvent(context, type, data)
},context)
}
}
})
}
}

View File

@ -84,7 +84,7 @@ class RecommendedFragment : BaseFragment<RecommendedFragmentBinding>() {
} }
override fun onFailure(e: Exception) { override fun onFailure(e: Exception) {
showToast { e.toString() } e.printStackTrace()
viewBinding.randomRecommendedProgressIndicator.isVisible = false viewBinding.randomRecommendedProgressIndicator.isVisible = false
} }

View File

@ -44,7 +44,7 @@ class AppSettings private constructor(val mContext: Context) {
private val editor: SharedPreferences.Editor = sharedPreferences.edit() private val editor: SharedPreferences.Editor = sharedPreferences.edit()
enum class Setting { enum class Setting {
DatabaseDirectory, DatabasePath, TemplateDirectory, AppLanguage, DeveloperMode, CustomSymbol, AutoCreateNomedia, OnlyLoadConantLanguageTemple, NightMode, GamePackage, KeepRwmodFile, EnableRecoveryStation, RecoveryStationFileSaveDays, RecoveryStationFolder, IndependentFolder, SetGameStorage, PackDirectory, IdentifiersPromptNumber, UserName, UseJetBrainsMonoFont, AppID, Account, PassWord, ExpirationTime, CheckBetaUpdate, UpdateData, ShareTip, AgreePolicy, EnglishEditingMode, NightModeFollowSystem, UseMobileNetwork, MapFolder, ModFolder, UseTheCommunityAsTheLaunchPage, AutoSave, ServerAddress, Token, LoginStatus, DynamicColor DatabaseDirectory, DatabasePath, TemplateDirectory, AppLanguage, DeveloperMode, CustomSymbol, AutoCreateNomedia, OnlyLoadConantLanguageTemple, NightMode, GamePackage, KeepRwmodFile, EnableRecoveryStation, RecoveryStationFileSaveDays, RecoveryStationFolder, IndependentFolder, SetGameStorage, PackDirectory, IdentifiersPromptNumber, UserName, UseJetBrainsMonoFont, AppID, Account, PassWord, ExpirationTime, CheckBetaUpdate, UpdateData, ShareTip, AgreePolicy, EnglishEditingMode, NightModeFollowSystem, UseMobileNetwork, MapFolder, ModFolder, UseTheCommunityAsTheLaunchPage, AutoSave, ServerAddress, Token, LoginStatus, DynamicColor, ExperiencePlan
} }
@ -289,6 +289,7 @@ class AppSettings private constructor(val mContext: Context) {
map[Setting.AutoSave] = mContext.getString(R.string.setting_auto_save) map[Setting.AutoSave] = mContext.getString(R.string.setting_auto_save)
map[Setting.ServerAddress] = mContext.getString(R.string.setting_server_address) map[Setting.ServerAddress] = mContext.getString(R.string.setting_server_address)
map[Setting.DynamicColor] = mContext.getString(R.string.setting_dynamic_color) map[Setting.DynamicColor] = mContext.getString(R.string.setting_dynamic_color)
map[Setting.ExperiencePlan] = mContext.getString(R.string.experience_the_plan)
//仅保存不可显示 //仅保存不可显示
map[Setting.SetGameStorage] = "SetGameStorage" map[Setting.SetGameStorage] = "SetGameStorage"
map[Setting.AppID] = "AppId" map[Setting.AppID] = "AppId"

View File

@ -1,102 +0,0 @@
package com.coldmint.rust.pro.tool
import android.R
import android.content.Context
import androidx.recyclerview.widget.RecyclerView.ItemDecoration
import android.graphics.drawable.Drawable
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.LinearLayoutManager
import android.content.res.TypedArray
import android.graphics.Canvas
import android.graphics.Rect
import android.view.View
/**
* 分割线类
*/
class Decoration(private val mContext: Context, orientation: Int) : ItemDecoration() {
private val mDivider: Drawable?
private var mOrientation = 0
//设置屏幕的方向
fun setOrientation(orientation: Int) {
require(!(orientation != HORIZONTAL_LIST && orientation != VERTICAL_LIST)) { "invalid orientation" }
mOrientation = orientation
}
override fun onDraw(c: Canvas, parent: RecyclerView, state: RecyclerView.State) {
if (mOrientation == HORIZONTAL_LIST) {
drawVerticalLine(c, parent, state)
} else {
drawHorizontalLine(c, parent, state)
}
}
//画横线, 这里的parent其实是显示在屏幕显示的这部分
fun drawHorizontalLine(c: Canvas?, parent: RecyclerView, state: RecyclerView.State?) {
val left = parent.paddingLeft
val right = parent.width - parent.paddingRight
val childCount = parent.childCount
for (i in 0 until childCount) {
val child = parent.getChildAt(i)
//获得child的布局信息
val params = child.layoutParams as RecyclerView.LayoutParams
val top = child.bottom + params.bottomMargin
val bottom = top + mDivider!!.intrinsicHeight
mDivider.setBounds(left, top, right, bottom)
mDivider.draw(c!!)
//Log.d("wnw", left + " " + top + " "+right+" "+bottom+" "+i);
}
}
//画竖线
fun drawVerticalLine(c: Canvas?, parent: RecyclerView, state: RecyclerView.State?) {
val top = parent.paddingTop
val bottom = parent.height - parent.paddingBottom
val childCount = parent.childCount
for (i in 0 until childCount) {
val child = parent.getChildAt(i)
//获得child的布局信息
val params = child.layoutParams as RecyclerView.LayoutParams
val left = child.right + params.rightMargin
val right = left + mDivider!!.intrinsicWidth
mDivider.setBounds(left, top, right, bottom)
mDivider.draw(c!!)
}
}
//由于Divider也有长宽高每一个Item需要向下或者向右偏移
override fun getItemOffsets(
outRect: Rect,
view: View,
parent: RecyclerView,
state: RecyclerView.State
) {
if (mOrientation == HORIZONTAL_LIST) {
//画横线,就是往下偏移一个分割线的高度
outRect[0, 0, 0] = mDivider!!.intrinsicHeight
} else {
//画竖线,就是往右偏移一个分割线的宽度
outRect[0, 0, mDivider!!.intrinsicWidth] = 0
}
}
companion object {
const val HORIZONTAL_LIST = LinearLayoutManager.HORIZONTAL
const val VERTICAL_LIST = LinearLayoutManager.VERTICAL
//我们通过获取系统属性中的listDivider来添加在系统中的AppTheme中设置
val ATRRS = intArrayOf(
R.attr.listDivider
)
}
init {
val ta = mContext.obtainStyledAttributes(ATRRS)
mDivider = ta.getDrawable(0)
ta.recycle()
setOrientation(orientation)
}
}

View File

@ -0,0 +1,19 @@
package com.coldmint.rust.pro.tool
import android.content.Context
import com.coldmint.rust.pro.base.BaseAppendAutoCompleteHelper
/**
* 链接自动完成帮助
* 处理 @ at字符
*/
class LinkAutoCompleteHelper(context: Context) : BaseAppendAutoCompleteHelper(context) {
override fun getDataList(): List<String> {
return listOf("@mod{}","@user{}","@tag{}","@link{}","@qqGroup{}","@activate{}")
}
override fun getSymbol(): Char {
return '@'
}
}

View File

@ -2,20 +2,29 @@ package com.coldmint.rust.pro.tool
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.graphics.drawable.Drawable
import android.os.Bundle import android.os.Bundle
import android.text.Spannable import android.text.Spannable
import android.text.SpannableString import android.text.SpannableString
import android.text.Spanned
import android.text.method.LinkMovementMethod import android.text.method.LinkMovementMethod
import android.text.style.ClickableSpan import android.text.style.ClickableSpan
import android.text.style.ImageSpan
import android.view.View import android.view.View
import android.widget.TextView import android.widget.TextView
import android.widget.Toast import android.widget.Toast
import com.bumptech.glide.Glide
import com.bumptech.glide.request.target.CustomTarget
import com.bumptech.glide.request.transition.Transition
import com.coldmint.rust.core.tool.AppOperator import com.coldmint.rust.core.tool.AppOperator
import com.coldmint.rust.core.tool.LineParser
import com.coldmint.rust.core.web.ServerConfiguration import com.coldmint.rust.core.web.ServerConfiguration
import com.coldmint.rust.pro.* import com.coldmint.rust.pro.*
import com.google.android.material.chip.ChipDrawable
/**
* 字体样式制作器
*/
class TextStyleMaker private constructor() { class TextStyleMaker private constructor() {
companion object { companion object {
val instance: TextStyleMaker by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) { val instance: TextStyleMaker by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
@ -23,32 +32,121 @@ class TextStyleMaker private constructor() {
} }
} }
// /**
// * 生成可点击的字体
// * @param text String
// * @param funOnClick Function1<String, Unit>
// * @return SpannableString
// */
// private fun generate(text: String, funOnClick: (String, String) -> Unit): SpannableString {
// val spannableString = SpannableString(text)
// val start = "@"
// val start2 = "{"
// val start3 = "}"
// var startIndex = text.indexOf(start)
// while (startIndex > -1) {
// val start2Index = text.indexOf(start2, startIndex)
// if (start2Index > -1) {
// val start3Index = text.indexOf(start3, start2Index + start2.length)
// if (start3Index > -1) {
// val num1 = startIndex
// val num2 = start2Index
// val num3 = start3Index
// spannableString.setSpan(
// object : ClickableSpan() {
// override fun onClick(p0: View) {
// funOnClick.invoke(
// text.subSequence(num1 + start.length, num2).toString(),
// text.subSequence(num2 + start2.length, num3).toString()
// )
// }
// },
// startIndex,
// start3Index + start3.length,
// Spannable.SPAN_INCLUSIVE_EXCLUSIVE
// )
// } else {
// break
// }
// } else {
// break
// }
// startIndex = text.indexOf(start, startIndex + start.length)
// }
// return spannableString
// }
/** /**
* 生成可点击的字体 * 对文本设置样式可用于编辑框
* @param text String * @param editable Editable
* @param funOnClick Function1<String, Unit> * @param funOnClick Function2<String, String, Unit>
* @return SpannableString
*/ */
private fun generate(text: String, funOnClick: (String, String) -> Unit): SpannableString { fun setStyle(
val spannableString = SpannableString(text) spannable: Spannable,
funOnClick: (String, String) -> Unit,
context: Context
) {
val start = "@" val start = "@"
val start2 = "{" val start2 = "{"
val start3 = "}" val start3 = "}"
var startIndex = text.indexOf(start) var startIndex = spannable.indexOf(start)
while (startIndex > -1) { while (startIndex > -1) {
val start2Index = text.indexOf(start2, startIndex) val start2Index = spannable.indexOf(start2, startIndex)
if (start2Index > -1) { if (start2Index > -1) {
val start3Index = text.indexOf(start3, start2Index + start2.length) val start3Index = spannable.indexOf(start3, start2Index + start2.length)
if (start3Index > -1) { if (start3Index > -1) {
val num1 = startIndex val num1 = startIndex
val num2 = start2Index val num2 = start2Index
val num3 = start3Index val num3 = start3Index
spannableString.setSpan( val type = spannable.subSequence(num1 + start.length, num2).toString()
val data: String = spannable.subSequence(num2 + start2.length, num3).toString()
val chipDrawable = ChipDrawable.createFromResource(context, R.xml.chip)
when (type) {
"mod" -> {
chipDrawable.chipIcon = context.getDrawable(R.drawable.mod)
}
"user" -> {
Glide.with(context)
.load(ServerConfiguration.website + "user/" + data + "/icon.png")
.into(
object : CustomTarget<Drawable>() {
override fun onResourceReady(
resource: Drawable,
transition: Transition<in Drawable>?
) {
chipDrawable.chipIcon = resource
}
override fun onLoadCleared(placeholder: Drawable?) {
}
}
)
}
else -> {
R.drawable.image
}
}
chipDrawable.closeIcon = null
chipDrawable.text = data
chipDrawable.setBounds(
0,
0,
chipDrawable.intrinsicWidth,
chipDrawable.intrinsicHeight
)
val span = ImageSpan(chipDrawable)
spannable.setSpan(
span, startIndex,
start3Index + start3.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
)
spannable.setSpan(
object : ClickableSpan() { object : ClickableSpan() {
override fun onClick(p0: View) { override fun onClick(p0: View) {
funOnClick.invoke( funOnClick.invoke(
text.subSequence(num1 + start.length, num2).toString(), type,
text.subSequence(num2 + start2.length, num3).toString() data
) )
} }
}, },
@ -62,20 +160,20 @@ class TextStyleMaker private constructor() {
} else { } else {
break break
} }
startIndex = text.indexOf(start, startIndex + start.length) startIndex = spannable.indexOf(start, startIndex + start.length)
} }
return spannableString
} }
/** /**
* 加载 * 加载文本框文本样式会重新生成对象
* @param textView TextView * @param textView TextView
* @param funOnClick Function1<String, Unit> * @param funOnClick Function1<String, Unit>
*/ */
fun load(textView: TextView, data: String? = null, funOnClick: (String, String) -> Unit) { fun load(textView: TextView, data: String? = null, funOnClick: (String, String) -> Unit) {
val text = data ?: textView.text.toString() val text = data ?: textView.text
val sp = generate(text, funOnClick) val spannableString = SpannableString(text)
textView.text = sp setStyle(spannableString, funOnClick, textView.context)
textView.text = spannableString
textView.movementMethod = LinkMovementMethod() textView.movementMethod = LinkMovementMethod()
} }
@ -153,10 +251,9 @@ class TextStyleMaker private constructor() {
context.startActivity(thisIntent) context.startActivity(thisIntent)
} }
"link" -> { "link" -> {
val thisIntent = Intent(context,BrowserActivity::class.java) val thisIntent = Intent(context, BrowserActivity::class.java)
thisIntent.putExtra("link",data) thisIntent.putExtra("link", data)
context.startActivity(thisIntent) context.startActivity(thisIntent)
// AppOperator.useBrowserAccessWebPage(context, data)
} }
"qqGroup" -> { "qqGroup" -> {
try { try {

View File

@ -176,6 +176,78 @@ class StartViewModel(application: Application) : BaseAndroidViewModel(applicatio
} }
/**
* 初始化设置
*/
private fun initSetting() {
appSettings.initSetting(AppSettings.Setting.AppLanguage, Locale.getDefault().language)
appSettings.initSetting(AppSettings.Setting.DeveloperMode, false)
appSettings.initSetting(
AppSettings.Setting.DatabaseDirectory,
context.filesDir.absolutePath + "/database/"
)
appSettings.initSetting(
AppSettings.Setting.TemplateDirectory,
context.filesDir.absolutePath + "/template/"
)
appSettings.initSetting(AppSettings.Setting.CustomSymbol, "[],:='*_$%@#{}()")
appSettings.initSetting(AppSettings.Setting.AutoCreateNomedia, true)
appSettings.initSetting(AppSettings.Setting.OnlyLoadConantLanguageTemple, true)
appSettings.initSetting(AppSettings.Setting.NightMode, isNightMode())
appSettings.initSetting(
AppSettings.Setting.GamePackage,
GlobalMethod.DEFAULT_GAME_PACKAGE
)
appSettings.initSetting(AppSettings.Setting.KeepRwmodFile, true)
appSettings.initSetting(AppSettings.Setting.RecoveryStationFileSaveDays, 7)
appSettings.initSetting(AppSettings.Setting.EnableRecoveryStation, true)
appSettings.initSetting(AppSettings.Setting.UseMobileNetwork, false)
appSettings.initSetting(AppSettings.Setting.ExperiencePlan, true)
appSettings.initSetting(
AppSettings.Setting.RecoveryStationFolder,
context.filesDir.absolutePath + "/backup/"
)
appSettings.initSetting(
AppSettings.Setting.PackDirectory,
AppSettings.dataRootDirectory + "/bin/"
)
appSettings.initSetting(AppSettings.Setting.IndependentFolder, true)
appSettings.initSetting(AppSettings.Setting.IdentifiersPromptNumber, 40)
appSettings.initSetting(AppSettings.Setting.UseJetBrainsMonoFont, true)
appSettings.initSetting(AppSettings.Setting.AppID, UUID.randomUUID().toString())
appSettings.initSetting(AppSettings.Setting.CheckBetaUpdate, false)
appSettings.initSetting(AppSettings.Setting.SetGameStorage, false)
appSettings.initSetting(AppSettings.Setting.ShareTip, true)
appSettings.initSetting(AppSettings.Setting.EnglishEditingMode, false)
appSettings.initSetting(AppSettings.Setting.NightModeFollowSystem, true)
appSettings.initSetting(AppSettings.Setting.UseTheCommunityAsTheLaunchPage, true)
appSettings.initSetting(
AppSettings.Setting.ServerAddress,
ServerConfiguration.defaultIp
)
ServerConfiguration.website =
appSettings.getValue(
AppSettings.Setting.ServerAddress,
ServerConfiguration.defaultIp
)
appSettings.initSetting(
AppSettings.Setting.MapFolder,
Environment.getExternalStorageDirectory().absolutePath + "/rustedWarfare/maps/"
)
appSettings.initSetting(
AppSettings.Setting.ModFolder,
Environment.getExternalStorageDirectory().absolutePath + "/rustedWarfare/units/"
)
appSettings.initSetting(AppSettings.Setting.AutoSave, true)
appSettings.initSetting(AppSettings.Setting.AgreePolicy, false)
appSettings.initSetting(AppSettings.Setting.LoginStatus, false)
//如果启用动态颜色
appSettings.initSetting(
AppSettings.Setting.DynamicColor,
DynamicColors.isDynamicColorAvailable()
)
}
/** /**
* 初始化资源 * 初始化资源
*/ */
@ -337,76 +409,6 @@ class StartViewModel(application: Application) : BaseAndroidViewModel(applicatio
} }
} }
/**
* 初始化设置
*/
private fun initSetting() {
appSettings.initSetting(AppSettings.Setting.AppLanguage, Locale.getDefault().language)
appSettings.initSetting(AppSettings.Setting.DeveloperMode, false)
appSettings.initSetting(
AppSettings.Setting.DatabaseDirectory,
context.filesDir.absolutePath + "/database/"
)
appSettings.initSetting(
AppSettings.Setting.TemplateDirectory,
context.filesDir.absolutePath + "/template/"
)
appSettings.initSetting(AppSettings.Setting.CustomSymbol, "[],:='*_$%@#{}()")
appSettings.initSetting(AppSettings.Setting.AutoCreateNomedia, true)
appSettings.initSetting(AppSettings.Setting.OnlyLoadConantLanguageTemple, true)
appSettings.initSetting(AppSettings.Setting.NightMode, isNightMode())
appSettings.initSetting(
AppSettings.Setting.GamePackage,
GlobalMethod.DEFAULT_GAME_PACKAGE
)
appSettings.initSetting(AppSettings.Setting.KeepRwmodFile, true)
appSettings.initSetting(AppSettings.Setting.RecoveryStationFileSaveDays, 7)
appSettings.initSetting(AppSettings.Setting.EnableRecoveryStation, true)
appSettings.initSetting(AppSettings.Setting.UseMobileNetwork, false)
appSettings.initSetting(
AppSettings.Setting.RecoveryStationFolder,
context.filesDir.absolutePath + "/backup/"
)
appSettings.initSetting(
AppSettings.Setting.PackDirectory,
AppSettings.dataRootDirectory + "/bin/"
)
appSettings.initSetting(AppSettings.Setting.IndependentFolder, true)
appSettings.initSetting(AppSettings.Setting.IdentifiersPromptNumber, 40)
appSettings.initSetting(AppSettings.Setting.UseJetBrainsMonoFont, true)
appSettings.initSetting(AppSettings.Setting.AppID, UUID.randomUUID().toString())
appSettings.initSetting(AppSettings.Setting.CheckBetaUpdate, false)
appSettings.initSetting(AppSettings.Setting.SetGameStorage, false)
appSettings.initSetting(AppSettings.Setting.ShareTip, true)
appSettings.initSetting(AppSettings.Setting.EnglishEditingMode, false)
appSettings.initSetting(AppSettings.Setting.NightModeFollowSystem, true)
appSettings.initSetting(AppSettings.Setting.UseTheCommunityAsTheLaunchPage, true)
appSettings.initSetting(
AppSettings.Setting.ServerAddress,
ServerConfiguration.defaultIp
)
ServerConfiguration.website =
appSettings.getValue(
AppSettings.Setting.ServerAddress,
ServerConfiguration.defaultIp
)
appSettings.initSetting(
AppSettings.Setting.MapFolder,
Environment.getExternalStorageDirectory().absolutePath + "/rustedWarfare/maps/"
)
appSettings.initSetting(
AppSettings.Setting.ModFolder,
Environment.getExternalStorageDirectory().absolutePath + "/rustedWarfare/units/"
)
appSettings.initSetting(AppSettings.Setting.AutoSave, true)
appSettings.initSetting(AppSettings.Setting.AgreePolicy, false)
appSettings.initSetting(AppSettings.Setting.LoginStatus, false)
//如果启用动态颜色
appSettings.initSetting(
AppSettings.Setting.DynamicColor,
DynamicColors.isDynamicColorAvailable()
)
}
/** /**
* 加载夜间设置 * 加载夜间设置

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M20,12l-1.41,-1.41L13,16.17V4h-2v12.17l-5.58,-5.59L4,12l8,8 8,-8z"/>
</vector>

View File

@ -29,6 +29,11 @@
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"> app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Elevated" style="@style/Widget.Material3.CardView.Elevated"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -36,10 +41,10 @@
android:layout_margin="8dp"> android:layout_margin="8dp">
<LinearLayout <LinearLayout
android:animateLayoutChanges="true"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="8dp" android:layout_margin="8dp"
android:animateLayoutChanges="true"
android:orientation="vertical"> android:orientation="vertical">
<SearchView <SearchView
@ -63,6 +68,38 @@
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Elevated"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:layout_marginTop="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:orientation="vertical">
<TextView
style="@style/TextAppearance.Material3.HeadlineMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hotSearch" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/hotSearchView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -15,7 +15,7 @@
<com.google.android.material.appbar.CollapsingToolbarLayout <com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:contentScrim="?attr/colorPrimary" app:contentScrim="?android:windowBackground"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap" app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
app:titleCollapseMode="scale" app:titleCollapseMode="scale"
app:titleEnabled="false"> app:titleEnabled="false">
@ -54,14 +54,13 @@
<TextView <TextView
android:id="@+id/nameView" android:id="@+id/nameView"
style="@style/TextAppearance.Material3.TitleMedium"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/headIconView" android:layout_below="@id/headIconView"
android:layout_alignLeft="@id/headIconView" android:layout_alignStart="@id/headIconView"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:text="@string/name" android:text="@string/name" />
android:textColor="@color/black"
android:textSize="16sp" />
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:id="@+id/cardView" android:id="@+id/cardView"
@ -97,38 +96,39 @@
android:layout_width="15dp" android:layout_width="15dp"
android:layout_height="15dp" android:layout_height="15dp"
android:layout_alignBottom="@id/cardView" android:layout_alignBottom="@id/cardView"
android:layout_marginLeft="8dp" android:layout_marginStart="8dp"
android:layout_toEndOf="@id/cardView" android:layout_toEndOf="@id/cardView"
android:src="@drawable/boy" /> android:src="@drawable/boy" />
<TextView <TextView
android:id="@+id/describeView" android:id="@+id/describeView"
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:layout_below="@id/nameView" android:layout_below="@id/nameView"
android:layout_alignLeft="@id/headIconView" android:layout_alignStart="@id/headIconView"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:text="@string/describe" /> android:text="@string/describe" />
<TextView <TextView
android:id="@+id/loginTimeView" android:id="@+id/loginTimeView"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/describeView" android:layout_below="@id/describeView"
android:layout_alignLeft="@id/headIconView" android:layout_alignStart="@id/headIconView"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:text="@string/user_info" android:text="@string/user_info" />
android:textSize="13sp" />
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignTop="@id/baseInfoView" android:layout_alignTop="@id/baseInfoView"
android:layout_alignBottom="@id/headIconView" android:layout_alignBottom="@id/headIconView"
android:layout_marginLeft="8dp" android:layout_marginStart="8dp"
android:layout_marginRight="16dp" android:layout_marginEnd="16dp"
android:layout_toRightOf="@id/headIconView" android:layout_toEndOf="@id/headIconView"
android:orientation="horizontal"> android:orientation="horizontal">
<LinearLayout <LinearLayout
@ -146,18 +146,18 @@
<TextView <TextView
android:id="@+id/fansNumView" android:id="@+id/fansNumView"
style="@style/TextAppearance.Material3.BodyLarge"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="0" android:text="0" />
android:textSize="16sp" />
<TextView <TextView
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/fans" android:text="@string/fans" />
android:textSize="13sp" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@ -170,18 +170,18 @@
<TextView <TextView
android:id="@+id/followNumView" android:id="@+id/followNumView"
style="@style/TextAppearance.Material3.BodyLarge"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="0" android:text="0" />
android:textSize="16sp" />
<TextView <TextView
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/follow" android:text="@string/follow" />
android:textSize="13sp" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@ -193,18 +193,18 @@
<TextView <TextView
android:id="@+id/praiseNumView" android:id="@+id/praiseNumView"
style="@style/TextAppearance.Material3.BodyLarge"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="0" android:text="0" />
android:textSize="16sp" />
<TextView <TextView
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/praise_number" android:text="@string/praise_number" />
android:textSize="13sp" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@ -217,8 +217,7 @@
android:layout_below="@id/numberLayout" android:layout_below="@id/numberLayout"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:text="@string/request_data" android:text="@string/request_data" />
android:theme="@style/Theme.rust.Concept" />
</RelativeLayout> </RelativeLayout>

View File

@ -24,9 +24,6 @@
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="12dp"
android:layout_marginTop="8dp"
android:layout_marginRight="12dp"
android:fillViewport="true" android:fillViewport="true"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"> app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
@ -55,7 +52,8 @@
android:id="@+id/progressBar" android:id="@+id/progressBar"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" /> android:layout_marginTop="8dp"
android:visibility="gone" />
</LinearLayout> </LinearLayout>
@ -65,36 +63,32 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="60dp" android:layout_marginBottom="60dp"
android:animateLayoutChanges="true" android:animateLayoutChanges="true"
android:visibility="gone"> android:visibility="visible">
<LinearLayout <LinearLayout
android:id="@+id/auditLayout" android:id="@+id/auditLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_marginHorizontal="16dp"
android:paddingBottom="8dp"> android:paddingBottom="8dp">
<TextView <TextView
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:text="@string/audit" android:text="@string/audit" />
android:textColor="@color/red"
android:textSize="16sp" />
</LinearLayout> </LinearLayout>
<androidx.cardview.widget.CardView <com.google.android.material.card.MaterialCardView
android:id="@+id/cardView" android:id="@+id/cardView"
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/auditLayout" android:layout_below="@id/auditLayout"
android:layout_marginLeft="4dp" android:layout_marginHorizontal="16dp"
android:layout_marginTop="8dp" android:visibility="visible">
android:layout_marginRight="4dp"
android:layout_marginBottom="8dp"
android:visibility="visible"
app:cardElevation="2dp"
card_view:cardCornerRadius="2dp">
<RelativeLayout <RelativeLayout
android:id="@+id/openUserSpace" android:id="@+id/openUserSpace"
@ -121,51 +115,54 @@
<TextView <TextView
android:id="@+id/userNameView" android:id="@+id/userNameView"
style="@style/TextAppearance.Material3.BodyLarge"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/name" android:text="@string/name" />
android:textSize="16sp" />
<TextView <TextView
android:id="@+id/userInfoView" android:id="@+id/userInfoView"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:text="@string/fans_information" android:text="@string/fans_information" />
android:textSize="13sp" />
</LinearLayout> </LinearLayout>
<ImageView <ImageView
android:id="@+id/spaceView" android:id="@+id/spaceView"
android:layout_width="15dp" android:layout_width="15dp"
android:layout_height="15dp" android:layout_height="15dp"
android:layout_alignParentRight="true" android:layout_alignParentEnd="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_margin="8dp" android:layout_margin="8dp"
android:src="@drawable/next" /> android:src="@drawable/next" />
</RelativeLayout> </RelativeLayout>
</androidx.cardview.widget.CardView> </com.google.android.material.card.MaterialCardView>
<androidx.cardview.widget.CardView <com.google.android.material.card.MaterialCardView
android:id="@+id/cardView2" android:id="@+id/cardView2"
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/cardView" android:layout_below="@id/cardView"
android:layout_marginLeft="4dp" android:layout_marginHorizontal="16dp"
android:layout_marginTop="8dp" android:layout_marginTop="16dp"
android:layout_marginRight="4dp" android:visibility="visible">
android:layout_marginBottom="8dp"
android:visibility="visible" <LinearLayout
app:cardElevation="2dp" android:layout_width="match_parent"
card_view:cardCornerRadius="2dp"> android:layout_height="match_parent"
android:layout_margin="8dp"
android:orientation="vertical">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content">
android:layout_margin="8dp">
<ImageView <ImageView
@ -178,26 +175,25 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignTop="@id/iconView" android:layout_centerVertical="true"
android:layout_alignBottom="@id/iconView" android:layout_marginStart="8dp"
android:layout_marginLeft="8dp" android:layout_toEndOf="@id/iconView"
android:layout_toRightOf="@id/iconView"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/titleView" android:id="@+id/titleView"
style="@style/TextAppearance.Material3.TitleMedium"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:ellipsize="end"
android:singleLine="true" android:singleLine="true"
android:text="标题" android:text="标题" />
android:textColor="@color/black"
android:textSize="16sp" />
<TextView <TextView
android:id="@+id/numView" android:id="@+id/numView"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
@ -205,6 +201,7 @@
<TextView <TextView
android:id="@+id/updateTimeView" android:id="@+id/updateTimeView"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
@ -213,72 +210,84 @@
</LinearLayout> </LinearLayout>
</RelativeLayout>
<com.kongzue.stacklabelview.StackLabel <com.kongzue.stacklabelview.StackLabel
android:id="@+id/belongStackLabelView" android:id="@+id/belongStackLabelView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/iconView"
android:layout_marginTop="8dp" /> android:layout_marginTop="8dp" />
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.youth.banner.Banner <com.youth.banner.Banner
android:id="@+id/banner" android:id="@+id/banner"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="180dp" android:layout_height="180dp"
android:layout_below="@id/belongStackLabelView"
android:layout_marginTop="8dp" /> android:layout_marginTop="8dp" />
</com.google.android.material.card.MaterialCardView>
<TextView <TextView
android:id="@+id/modInfoView" android:id="@+id/modInfoView"
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:layout_below="@id/banner"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:text="描述" /> android:text="描述" />
</RelativeLayout> </LinearLayout>
</androidx.cardview.widget.CardView> </com.google.android.material.card.MaterialCardView>
<androidx.cardview.widget.CardView <com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/cardView2" android:layout_below="@id/cardView2"
android:layout_marginLeft="4dp" android:layout_marginHorizontal="16dp"
android:layout_marginTop="8dp" android:layout_marginTop="16dp"
android:layout_marginRight="4dp" android:visibility="visible">
android:layout_marginBottom="8dp"
android:visibility="visible" <LinearLayout
app:cardElevation="2dp" android:layout_width="match_parent"
card_view:cardCornerRadius="2dp"> android:layout_height="wrap_content"
android:layout_margin="8dp"
android:orientation="vertical">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content">
android:layout_margin="8dp">
<TextView <TextView
android:id="@+id/discussion" android:id="@+id/discussion"
style="@style/TextAppearance.Material3.HeadlineSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_centerVertical="true"
android:text="@string/discussion" android:text="@string/discussion" />
android:textSize="16sp" />
<TextView <Button
android:id="@+id/sendDiscussion" android:id="@+id/sendDiscussion"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBottom="@id/discussion" android:layout_alignParentEnd="true"
android:layout_alignParentRight="true" android:layout_centerVertical="true"
android:text="@string/send_discussion" android:text="@string/send_discussion" />
android:textColor="?android:attr/colorPrimary" />
</RelativeLayout>
<com.google.android.material.progressindicator.LinearProgressIndicator <com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/commentLinearProgressIndicator" android:id="@+id/commentLinearProgressIndicator"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/discussion"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:indeterminate="true" /> android:indeterminate="true" />
@ -286,25 +295,26 @@
android:id="@+id/modCommentRecyclerView" android:id="@+id/modCommentRecyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/commentLinearProgressIndicator"
android:layout_marginTop="8dp" /> android:layout_marginTop="8dp" />
</RelativeLayout>
</androidx.cardview.widget.CardView> </LinearLayout>
</com.google.android.material.card.MaterialCardView>
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
<Button <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/button" android:id="@+id/button"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_gravity="bottom|right"
android:layout_gravity="bottom"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:text="@string/installation" android:text="@string/installation"
android:visibility="gone" /> android:visibility="visible"
app:icon="@drawable/cloud_download" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -0,0 +1,76 @@
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="24dp"
android:orientation="vertical">
<TextView
android:id="@+id/titleView"
style="@style/MaterialAlertDialog.Material3.Title.Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/send_discussion" />
<!-- <TextView-->
<!-- android:id="@+id/messageView"-->
<!-- style="@style/MaterialAlertDialog.Material3.Body.Text"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="16dp"-->
<!-- android:text="@string/title"-->
<!-- android:visibility="gone" />-->
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:hint="@string/content"
app:counterEnabled="true"
app:counterMaxLength="255">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/textInputEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:maxLength="255"
android:minLines="3" />
</com.google.android.material.textfield.TextInputLayout>
<RelativeLayout
android:id="@+id/buttonContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp">
<Button
android:id="@+id/negativeButton"
style="@style/Widget.Material3.Button.TextButton.Dialog.Flush"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toStartOf="@id/positiveButton"
android:text="@string/dialog_cancel" />
<Button
android:id="@+id/positiveButton"
style="@style/Widget.Material3.Button.TextButton.Dialog.Flush"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginStart="8dp"
android:text="@string/dialog_ok" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>

View File

@ -5,9 +5,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fillViewport="true" android:fillViewport="true"
android:paddingLeft="12dp"
android:paddingTop="8dp"
android:paddingRight="12dp"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"> app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<LinearLayout <LinearLayout
@ -15,84 +12,100 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<androidx.cardview.widget.CardView <com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:cardElevation="2dp" android:layout_marginHorizontal="16dp"
card_view:cardCornerRadius="2dp"> android:layout_marginTop="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_margin="8dp"
android:animateLayoutChanges="true" android:animateLayoutChanges="true"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/highestScoreView" android:id="@+id/highestScoreView"
style="@style/TextAppearance.Material3.HeadlineSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/highest_score" android:layout_centerVertical="true"
android:textSize="16sp" /> android:text="@string/highest_score" />
<TextView <Button
android:id="@+id/highestScoreActionView" android:id="@+id/highestScoreActionView"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBottom="@id/highestScoreView"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:text="@string/load_all" android:text="@string/load_all" />
android:textSize="13sp" /> </RelativeLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
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:layout_below="@id/highestScoreView"
android:layout_marginTop="8dp" /> android:layout_marginTop="8dp" />
</RelativeLayout> </LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginHorizontal="16dp"
app:cardElevation="2dp" android:layout_marginTop="16dp">
card_view:cardCornerRadius="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_margin="8dp"
android:animateLayoutChanges="true" android:animateLayoutChanges="true"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/latestWorkView" android:id="@+id/latestWorkView"
style="@style/TextAppearance.Material3.HeadlineSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/latest_work" android:layout_centerVertical="true"
android:textSize="16sp" /> android:text="@string/latest_work" />
<TextView <Button
android:id="@+id/latestWorkActionView" android:id="@+id/latestWorkActionView"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBottom="@id/latestWorkView"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:text="@string/load_all" android:text="@string/load_all" />
android:textSize="13sp" />
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:id="@+id/latestWorkRecycleView"
android:layout_height="wrap_content"
android:layout_below="@id/latestWorkView"
android:layout_marginTop="8dp" />
</RelativeLayout> </RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/latestWorkRecycleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout> </LinearLayout>

View File

@ -0,0 +1,14 @@
<?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="wrap_content">
<TextView
android:layout_margin="16dp"
android:id="@+id/titleView"
style="@style/TextAppearance.Material3.TitleMedium"
android:text="@string/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>

View File

@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:padding="8dp">
<TextView <TextView
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:id="@+id/titleView" android:id="@+id/titleView"
style="@style/TextAppearance.Material3.BodyMedium" style="@style/TextAppearance.Material3.TitleMedium"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"

View File

@ -7,7 +7,7 @@
android:animateLayoutChanges="true" android:animateLayoutChanges="true"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
android:paddingTop="8dp"> android:paddingHorizontal="8dp">
<ProgressBar <ProgressBar
@ -32,24 +32,28 @@
android:visibility="visible"> android:visibility="visible">
<LinearLayout <LinearLayout
android:padding="8dp"
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">
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.youth.banner.Banner <com.youth.banner.Banner
android:id="@+id/banner" android:id="@+id/banner"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="200dp" /> android:layout_height="200dp" />
</com.google.android.material.card.MaterialCardView>
<androidx.cardview.widget.CardView
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="16dp" android:layout_marginTop="16dp">
android:layout_marginTop="8dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="8dp"
app:cardElevation="2dp"
card_view:cardCornerRadius="2dp">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -62,17 +66,20 @@
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<TextView <TextView
style="@style/TextAppearance.Material3.HeadlineSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentLeft="true" android:layout_alignParentStart="true"
android:text="@string/random_recommended" android:layout_centerVertical="true"
android:textSize="16sp" /> android:text="@string/random_recommended" />
<TextView <Button
android:id="@+id/changeRandomRecommended" android:id="@+id/changeRandomRecommended"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:text="@string/change_random_recommended" /> android:text="@string/change_random_recommended" />
</RelativeLayout> </RelativeLayout>
@ -92,18 +99,15 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:visibility="gone" /> android:visibility="gone" />
</LinearLayout> </LinearLayout>
</androidx.cardview.widget.CardView> </com.google.android.material.card.MaterialCardView>
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:id="@+id/latestReleaseCard" android:id="@+id/latestReleaseCard"
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="16dp" android:layout_marginTop="16dp">
android:layout_marginRight="16dp"
android:layout_marginBottom="8dp"
app:cardElevation="2dp"
card_view:cardCornerRadius="2dp">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -112,10 +116,10 @@
android:padding="8dp"> android:padding="8dp">
<TextView <TextView
style="@style/TextAppearance.Material3.HeadlineSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/latest_release" android:text="@string/latest_release" />
android:textSize="16sp" />
<com.google.android.material.progressindicator.LinearProgressIndicator <com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/latestReleaseProgressIndicator" android:id="@+id/latestReleaseProgressIndicator"
@ -135,13 +139,10 @@
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:id="@+id/soleRecommendedCardView" android:id="@+id/soleRecommendedCardView"
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="16dp" android:layout_marginTop="16dp">
android:layout_marginRight="16dp"
android:layout_marginBottom="8dp"
app:cardElevation="2dp"
card_view:cardCornerRadius="2dp">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -150,10 +151,10 @@
android:padding="8dp"> android:padding="8dp">
<TextView <TextView
style="@style/TextAppearance.Material3.HeadlineSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/pay_attention_new" android:text="@string/pay_attention_new" />
android:textSize="16sp" />
<com.google.android.material.progressindicator.LinearProgressIndicator <com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/soleRecommendedProgressIndicator" android:id="@+id/soleRecommendedProgressIndicator"

View File

@ -6,6 +6,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="8dp"> android:padding="8dp">
<TextView <TextView
android:id="@+id/nameView" android:id="@+id/nameView"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -1,46 +1,54 @@
<?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="wrap_content"
android:gravity="center_vertical">
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<ImageView <ImageView
android:id="@+id/mod_icon" android:id="@+id/mod_icon"
android:layout_width="60dp" android:layout_width="56dp"
android:layout_height="60dp" android:layout_height="56dp"
android:layout_marginTop="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:src="@drawable/image" /> android:src="@drawable/image" />
</com.google.android.material.card.MaterialCardView>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginStart="8dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/mod_name_View" android:id="@+id/mod_name_View"
style="@style/TextAppearance.Material3.TitleMedium"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="模组名称" android:text="模组名称" />
android:textSize="16sp" />
<TextView <TextView
android:id="@+id/mod_introduction_view" android:id="@+id/mod_introduction_view"
style="@style/TextAppearance.Material3.TitleSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:text="介绍" android:text="介绍" />
android:textSize="14sp" />
<TextView <TextView
android:id="@+id/modInfo" android:id="@+id/modInfo"
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:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:text="@string/web_mod_info" android:text="@string/web_mod_info" />
android:textSize="14dp" />
</LinearLayout> </LinearLayout>

View File

@ -38,10 +38,6 @@
<group> <group>
<item
android:id="@+id/help"
android:icon="@drawable/help"
android:title="@string/help" />
<item <item
android:id="@+id/code_table" android:id="@+id/code_table"
@ -58,15 +54,12 @@
android:icon="@drawable/setup" android:icon="@drawable/setup"
android:title="@string/set_up" /> android:title="@string/set_up" />
<item
android:id="@+id/donation"
android:icon="@drawable/donation"
android:title="@string/donation" />
<!-- <item--> <!-- <item-->
<!-- android:id="@+id/feedback"--> <!-- android:id="@+id/donation"-->
<!-- android:icon="@drawable/feedback"--> <!-- android:icon="@drawable/donation"-->
<!-- android:title="@string/feedback" />--> <!-- android:title="@string/donation" />-->
<item <item
android:id="@+id/about" android:id="@+id/about"

View File

@ -636,7 +636,6 @@
<string name="activate">The activation</string> <string name="activate">The activation</string>
<string name="money">¥%1$.2f</string> <string name="money">¥%1$.2f</string>
<string name="discount_prompt">%1$s has saved %2$.2f</string> <string name="discount_prompt">%1$s has saved %2$.2f</string>
<string name="setting_night_mode_follow_system">NightModeFollowSystem</string>
<string name="night_mode_follow_system">Follow the system to turn on the dark mode</string> <string name="night_mode_follow_system">Follow the system to turn on the dark mode</string>
<string name="night_mode_follow_system_tip">Follow the system to turn on or off the dark mode</string> <string name="night_mode_follow_system_tip">Follow the system to turn on or off the dark mode</string>
<string name="downlod">download</string> <string name="downlod">download</string>
@ -825,7 +824,7 @@
<string name="select_the_image_in_the_album">Select the image in the album</string> <string name="select_the_image_in_the_album">Select the image in the album</string>
<string name="turret_design">Turret design</string> <string name="turret_design">Turret design</string>
<string name="experience_the_plan">User Experience Plan</string> <string name="experience_the_plan">User Experience Plan</string>
<string name="experience_the_plan_describe">Send software crash message anonymously (temporarily unavailable).</string> <string name="experience_the_plan_describe">Send software crash message anonymously .</string>
<string name="update_and_iteration">Version update and user experience planning</string> <string name="update_and_iteration">Version update and user experience planning</string>
<string name="setting_experience_the_plan" translatable="false">experiencePlan</string> <string name="setting_experience_the_plan" translatable="false">experiencePlan</string>
<string name="order_timeout" translatable="false">订单超时,无法支付。</string> <string name="order_timeout" translatable="false">订单超时,无法支付。</string>

View File

@ -636,7 +636,6 @@
<string name="activate">活性化</string> <string name="activate">活性化</string>
<string name="money">¥% 1ドル.2f</string> <string name="money">¥% 1ドル.2f</string>
<string name="discount_prompt">%1$s省%2$.2f元</string> <string name="discount_prompt">%1$s省%2$.2f元</string>
<string name="setting_night_mode_follow_system">ナイトモードフォローシステム</string>
<string name="night_mode_follow_system">システム追従ダークモード</string> <string name="night_mode_follow_system">システム追従ダークモード</string>
<string name="night_mode_follow_system_tip">ダークモードをオンまたはオフします</string> <string name="night_mode_follow_system_tip">ダークモードをオンまたはオフします</string>
<string name="downlod">ダウンロード</string> <string name="downlod">ダウンロード</string>
@ -825,7 +824,7 @@
<string name="select_the_image_in_the_album">アルバムで画像を選択する</string> <string name="select_the_image_in_the_album">アルバムで画像を選択する</string>
<string name="turret_design">砲塔の設計</string> <string name="turret_design">砲塔の設計</string>
<string name="experience_the_plan">ユーザー体験プログラム</string> <string name="experience_the_plan">ユーザー体験プログラム</string>
<string name="experience_the_plan_describe">匿名送信ソフト奔砕情報(利用不可)</string> <string name="experience_the_plan_describe">匿名送信ソフト奔砕情報。</string>
<string name="update_and_iteration">アップデートとユーザー体験プログラム</string> <string name="update_and_iteration">アップデートとユーザー体験プログラム</string>
<string name="setting_experience_the_plan" translatable="false">experiencePlan</string> <string name="setting_experience_the_plan" translatable="false">experiencePlan</string>
<string name="order_timeout" translatable="false">订单超时,无法支付。</string> <string name="order_timeout" translatable="false">订单超时,无法支付。</string>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.rust.Concept" parent="Base.rust.Concept">
<!-- Transparent system bars for edge-to-edge. -->
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">?attr/isLightTheme</item>
</style>
</resources>

View File

@ -1,14 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<!--概念主题 --> <style name="Theme.rust.Concept" parent="Base.rust.Concept">
<style name="Theme.rust.Concept" parent="Theme.Material3.DayNight.NoActionBar">
</style> </style>
<!--概念活动栏样式-->
<!-- <style name="ThemeOverlay.rust.Concept.ActionBar" parent="ThemeOverlay.Material3.ActionBar">-->
<!-- <item name="colorPrimary">@color/dark_background</item>-->
<!-- <item name="android:textColorPrimary">@color/white</item>-->
<!-- </style>-->
</resources> </resources>

View File

@ -636,7 +636,6 @@
<string name="activate">активирова</string> <string name="activate">активирова</string>
<string name="money">1$.2f</string> <string name="money">1$.2f</string>
<string name="discount_prompt">$1 % сэкономлено $2%2f</string> <string name="discount_prompt">$1 % сэкономлено $2%2f</string>
<string name="setting_night_mode_follow_system">Ночной РежимПодключениеСистема</string>
<string name="night_mode_follow_system">Следуйте за системой в темном режиме</string> <string name="night_mode_follow_system">Следуйте за системой в темном режиме</string>
<string name="night_mode_follow_system_tip">Следуйте за системой включения или выключения темного режима</string> <string name="night_mode_follow_system_tip">Следуйте за системой включения или выключения темного режима</string>
<string name="downlod">загрузк</string> <string name="downlod">загрузк</string>
@ -825,7 +824,7 @@
<string name="select_the_image_in_the_album">Выберите фотографии в фотоальбоме</string> <string name="select_the_image_in_the_album">Выберите фотографии в фотоальбоме</string>
<string name="turret_design">Проектирование башни</string> <string name="turret_design">Проектирование башни</string>
<string name="experience_the_plan">Программа пользовательского опыта</string> <string name="experience_the_plan">Программа пользовательского опыта</string>
<string name="experience_the_plan_describe">Анонимная отправка программного обеспечения для уничтожения информации (временно недоступной).</string> <string name="experience_the_plan_describe">Анонимная отправка программного обеспечения для уничтожения информации.</string>
<string name="update_and_iteration">Обновление версии с программой пользовательского опыта</string> <string name="update_and_iteration">Обновление версии с программой пользовательского опыта</string>
<string name="setting_experience_the_plan" translatable="false">experiencePlan</string> <string name="setting_experience_the_plan" translatable="false">experiencePlan</string>
<string name="order_timeout" translatable="false">订单超时,无法支付。</string> <string name="order_timeout" translatable="false">订单超时,无法支付。</string>

View File

@ -444,7 +444,7 @@
<string name="view_the_report_object">查看(%1$s)</string> <string name="view_the_report_object">查看(%1$s)</string>
<string name="bookmark_already_exists">此书签已存在,请更换路径。</string> <string name="bookmark_already_exists">此书签已存在,请更换路径。</string>
<string name="feedback">意见反馈</string> <string name="feedback">意见反馈</string>
<string name="setting_use_jetBrains_mono_font">UseJetBrainsMonoFont</string> <string name="setting_use_jetBrains_mono_font" translatable="false">UseJetBrainsMonoFont</string>
<string name="use_jetBrains_mono_font">使用JetBrains Mono字体</string> <string name="use_jetBrains_mono_font">使用JetBrains Mono字体</string>
<string name="use_jetBrains_mono_font_describe">助手内置的字体,强烈推荐使用。</string> <string name="use_jetBrains_mono_font_describe">助手内置的字体,强烈推荐使用。</string>
<string name="directory_does_not_exist">目录不存在。</string> <string name="directory_does_not_exist">目录不存在。</string>
@ -455,7 +455,7 @@
<string name="please_login_first">请先登录。</string> <string name="please_login_first">请先登录。</string>
<string name="network_error">网络错误。</string> <string name="network_error">网络错误。</string>
<string name="check_update_failure">检查更新失败。</string> <string name="check_update_failure">检查更新失败。</string>
<string name="setting_check_beta_update">CheckBetaUpdate</string> <string name="setting_check_beta_update" translatable="false">CheckBetaUpdate</string>
<string name="check_beta_update">检查Beta更新</string> <string name="check_beta_update">检查Beta更新</string>
<string name="check_beta_update_describe">仅在Release版本生效Beta版本采用强制更新。</string> <string name="check_beta_update_describe">仅在Release版本生效Beta版本采用强制更新。</string>
<string name="loading_values">加载数值...</string> <string name="loading_values">加载数值...</string>
@ -531,7 +531,7 @@
<string name="file_type_define">默认创建ini文件。</string> <string name="file_type_define">默认创建ini文件。</string>
<string name="file_type_tip2">您可能想输入\"%1$s\"?</string> <string name="file_type_tip2">您可能想输入\"%1$s\"?</string>
<string name="is_building">正在加载单位数据,请尝试加载完毕后使用此功能。</string> <string name="is_building">正在加载单位数据,请尝试加载完毕后使用此功能。</string>
<string name="setting_english_editing_mode">EnglishEditingMode</string> <string name="setting_english_editing_mode" translatable="false">EnglishEditingMode</string>
<string name="english_editing_mode_describe">使用英文编写您的模组,并带有中文提示,语法高亮。</string> <string name="english_editing_mode_describe">使用英文编写您的模组,并带有中文提示,语法高亮。</string>
<string name="english_editing_mode">原生开发模式</string> <string name="english_editing_mode">原生开发模式</string>
<string name="mt_installed">您是否使用英文作为您的开发语言?相比在\"MT管理器\"上工作,助手有英文代码提示功能,以及针对模组环境的智能提示。</string> <string name="mt_installed">您是否使用英文作为您的开发语言?相比在\"MT管理器\"上工作,助手有英文代码提示功能,以及针对模组环境的智能提示。</string>
@ -607,11 +607,6 @@
<string name="mod_package">模组包</string> <string name="mod_package">模组包</string>
<string name="restart_to_take_effect">检查到您更换了图像由于Glide缓存机制助手需要重启才能展示新图像。很抱歉给您带来的不便。</string> <string name="restart_to_take_effect">检查到您更换了图像由于Glide缓存机制助手需要重启才能展示新图像。很抱歉给您带来的不便。</string>
<string name="extension">扩展</string> <string name="extension">扩展</string>
<string name="use_adm">Adm多线程下载</string>
<string name="use_adm_tip">允许调用Adm下载器进行多线程下载。</string>
<string name="setting_use_adm">useAdm</string>
<string name="no_adm_installed">请先安装Adm。</string>
<string name="from_adm">Adm下载目录</string>
<string name="word_wrap">自动换行</string> <string name="word_wrap">自动换行</string>
<string name="database_error">json结果集长度为0</string> <string name="database_error">json结果集长度为0</string>
<string name="mod_icon_transition">ModIconTransition</string> <string name="mod_icon_transition">ModIconTransition</string>
@ -636,7 +631,7 @@
<string name="activate">激活</string> <string name="activate">激活</string>
<string name="money">¥%1$.2f</string> <string name="money">¥%1$.2f</string>
<string name="discount_prompt">%1$s 已省%2$.2f元</string> <string name="discount_prompt">%1$s 已省%2$.2f元</string>
<string name="setting_night_mode_follow_system">NightModeFollowSystem</string> <string name="setting_night_mode_follow_system" translatable="false">NightModeFollowSystem</string>
<string name="night_mode_follow_system">跟随系统开启深色模式</string> <string name="night_mode_follow_system">跟随系统开启深色模式</string>
<string name="night_mode_follow_system_tip">跟随系统开启或关闭深色模式</string> <string name="night_mode_follow_system_tip">跟随系统开启或关闭深色模式</string>
<string name="downlod">下载</string> <string name="downlod">下载</string>
@ -670,7 +665,7 @@
<string name="edit_map">编辑地图</string> <string name="edit_map">编辑地图</string>
<string name="edit_map_tip">我们推荐使用NotTiled作为地图编辑工具。</string> <string name="edit_map_tip">我们推荐使用NotTiled作为地图编辑工具。</string>
<string name="downlod_nottiled">下载NotTiled</string> <string name="downlod_nottiled">下载NotTiled</string>
<string name="setting_use_the_community_as_the_launch_page">UseTheCommunityAsTheLaunchPage</string> <string name="setting_use_the_community_as_the_launch_page" translatable="false">UseTheCommunityAsTheLaunchPage</string>
<string name="use_the_community_as_the_launch_page">使用社区作为启动页面</string> <string name="use_the_community_as_the_launch_page">使用社区作为启动页面</string>
<string name="use_the_community_as_the_launch_page_tip">默认启用</string> <string name="use_the_community_as_the_launch_page_tip">默认启用</string>
<string name="renewal">续费</string> <string name="renewal">续费</string>
@ -723,7 +718,7 @@
<string name="delete_source_file_check">删除源文件</string> <string name="delete_source_file_check">删除源文件</string>
<string name="init_all_units">初始化单位列表...</string> <string name="init_all_units">初始化单位列表...</string>
<string name="clear_cache">清理缓存</string> <string name="clear_cache">清理缓存</string>
<string name="setting_clear_cache">ClearCache</string> <string name="setting_clear_cache" translatable="false">ClearCache</string>
<string name="clear_cache_description">缓存在应用使用过程中产生,助手通过读取缓存加速。</string> <string name="clear_cache_description">缓存在应用使用过程中产生,助手通过读取缓存加速。</string>
<string name="cache">缓存与存储空间</string> <string name="cache">缓存与存储空间</string>
<string name="history_cache">文件打开记录</string> <string name="history_cache">文件打开记录</string>
@ -737,7 +732,7 @@
<string name="search_unit_name">欲搜索单位名</string> <string name="search_unit_name">欲搜索单位名</string>
<string name="auto_save_describe">当您切换到其他程序时,自动保存代码。</string> <string name="auto_save_describe">当您切换到其他程序时,自动保存代码。</string>
<string name="auto_save">自动保存</string> <string name="auto_save">自动保存</string>
<string name="setting_auto_save">AutoSave</string> <string name="setting_auto_save" translatable="false">AutoSave</string>
<string name="auto_save_toast">已自动保存。</string> <string name="auto_save_toast">已自动保存。</string>
<string name="is_code">是代码</string> <string name="is_code">是代码</string>
<string name="search_tip">撤销搜索</string> <string name="search_tip">撤销搜索</string>
@ -757,13 +752,13 @@
<string name="synchronous_ok">同步成功。</string> <string name="synchronous_ok">同步成功。</string>
<string name="synchronous_failure">同步失败。</string> <string name="synchronous_failure">同步失败。</string>
<string name="synchronous_ing">正在同步...</string> <string name="synchronous_ing">正在同步...</string>
<string name="setting_server_address">ServerAddress</string> <string name="setting_server_address" translatable="false">ServerAddress</string>
<string name="server_address_configuration">服务器地址配置</string> <string name="server_address_configuration">服务器地址配置</string>
<string name="associated_tip">来自%1$s的关联提示</string> <string name="associated_tip">来自%1$s的关联提示</string>
<string name="login_tip">登录后,您可以:\n-上传,下载模组。\n-在社区内与朋友们畅聊。\n-使用中文编辑您的模组!\n-关注您喜爱的创作者</string> <string name="login_tip">登录后,您可以:\n-上传,下载模组。\n-在社区内与朋友们畅聊。\n-使用中文编辑您的模组!\n-关注您喜爱的创作者</string>
<string name="error_description">那时您正在做什么?</string> <string name="error_description">那时您正在做什么?</string>
<string name="no_error">没有错误</string> <string name="no_error">没有错误</string>
<string name="setting_see_error_info">SeeErrorInfo</string> <string name="setting_see_error_info" translatable="false">SeeErrorInfo</string>
<string name="see_error_info">崩溃日志</string> <string name="see_error_info">崩溃日志</string>
<string name="see_error_info_tip">查看此设备上的崩溃记录。</string> <string name="see_error_info_tip">查看此设备上的崩溃记录。</string>
<string name="can_not_tip_value">抱歉,目前无法提示值。</string> <string name="can_not_tip_value">抱歉,目前无法提示值。</string>
@ -825,7 +820,7 @@
<string name="select_the_image_in_the_album">在相册选择图像</string> <string name="select_the_image_in_the_album">在相册选择图像</string>
<string name="turret_design">炮塔设计</string> <string name="turret_design">炮塔设计</string>
<string name="experience_the_plan">用户体验计划</string> <string name="experience_the_plan">用户体验计划</string>
<string name="experience_the_plan_describe">匿名发送软件奔溃信息(暂不可用)</string> <string name="experience_the_plan_describe">匿名发送软件奔溃信息。</string>
<string name="update_and_iteration">版本更新与用户体验计划</string> <string name="update_and_iteration">版本更新与用户体验计划</string>
<string name="setting_experience_the_plan" translatable="false">experiencePlan</string> <string name="setting_experience_the_plan" translatable="false">experiencePlan</string>
<string name="order_timeout" translatable="false">订单超时,无法支付。</string> <string name="order_timeout" translatable="false">订单超时,无法支付。</string>
@ -853,5 +848,6 @@
<string name="search_type_mod_versions">模组更新日志</string> <string name="search_type_mod_versions">模组更新日志</string>
<string name="search_type_purchase_plan">套餐</string> <string name="search_type_purchase_plan">套餐</string>
<string name="search_type_mod_all">全部</string> <string name="search_type_mod_all">全部</string>
<string name="hotSearch">热门搜索</string>
</resources> </resources>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<chip xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:text="@string/title"
app:chipIcon="@drawable/image"
style="@style/Widget.Material3.Chip.Input"/>

View File

@ -216,8 +216,7 @@
app:title="@string/check_beta_update" /> app:title="@string/check_beta_update" />
<SwitchPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="true"
android:enabled="false"
android:key="@string/setting_experience_the_plan" android:key="@string/setting_experience_the_plan"
app:summary="@string/experience_the_plan_describe" app:summary="@string/experience_the_plan_describe"
app:title="@string/experience_the_plan" /> app:title="@string/experience_the_plan" />

View File

@ -0,0 +1,20 @@
package com.coldmint.rust.core.dataBean
import com.google.gson.annotations.SerializedName
data class HotSearchData(
@SerializedName("code")
val code: Int,
@SerializedName("data")
val `data`: MutableList<Data>,
@SerializedName("message")
val message: String
) {
data class Data(
@SerializedName("keyword")
val keyword: String,
@SerializedName("number")
val number: String
)
}

View File

@ -143,7 +143,6 @@ object FileOperator {
intent.setDataAndType(uri, type) intent.setDataAndType(uri, type)
context.startActivity(intent) context.startActivity(intent)
} catch (e: Exception) { } catch (e: Exception) {
Toast.makeText(context, e.toString(), Toast.LENGTH_SHORT).show()
e.printStackTrace() e.printStackTrace()
} }
} }

View File

@ -0,0 +1,74 @@
package com.coldmint.rust.core.web
import android.os.Handler
import android.os.Looper
import android.util.Log
import com.coldmint.rust.core.dataBean.ApiResponse
import com.coldmint.rust.core.dataBean.CouponListDataBean
import com.coldmint.rust.core.interfaces.ApiCallBack
import com.google.gson.Gson
import okhttp3.*
import java.io.IOException
/**
* 错误报告
*/
class ErrorReport {
companion object {
val instance: ErrorReport by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
ErrorReport()
}
}
/**
* 发送错误报告
* @param message String 消息
* @param versionName 版本名
* @param versionNumber 版本号
* @param apiCallBack ApiCallBack<CouponListDataBean>
*/
fun send(
message: String,
versionName: String,
versionNumber: Int,
apiCallBack: ApiCallBack<ApiResponse>
) {
val okHttpClient = ServerConfiguration.initOkHttpClient()
val requestBodyBuilder: FormBody.Builder =
FormBody.Builder().add("message", message).add("versionName", versionName)
.add("versionNumber", versionNumber.toString())
val requestBody = requestBodyBuilder.build()
val request =
Request.Builder()
.url(ServerConfiguration.website + "php/error.php?action=send")
.post(requestBody).build()
val call = okHttpClient.newCall(request)
val handler = Handler(Looper.getMainLooper())
val gson = Gson()
call.enqueue(object : Callback {
override fun onFailure(call: Call, e: IOException) {
e.printStackTrace()
handler.post { apiCallBack.onFailure(e) }
}
override fun onResponse(call: Call, response: Response) {
try {
val data = response.body!!.string()
Log.d("错误反馈数据",data)
val finalApiResponse =
gson.fromJson(data, ApiResponse::class.java)
handler.post {
apiCallBack.onResponse(finalApiResponse)
}
} catch (e: Exception) {
e.printStackTrace()
handler.post {
apiCallBack.onFailure(e)
}
}
}
})
}
}

View File

@ -2,6 +2,7 @@ package com.coldmint.rust.core.web
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import com.coldmint.rust.core.dataBean.HotSearchData
import com.coldmint.rust.core.dataBean.SearchSuggestionsData import com.coldmint.rust.core.dataBean.SearchSuggestionsData
import com.coldmint.rust.core.dataBean.user.SearchResultDataBean import com.coldmint.rust.core.dataBean.user.SearchResultDataBean
import com.coldmint.rust.core.interfaces.ApiCallBack import com.coldmint.rust.core.interfaces.ApiCallBack
@ -100,5 +101,42 @@ class Search private constructor() {
}) })
} }
/**
* 获取热门搜索
* @param apiCallBack ApiCallBack<HotSearchData>
*/
fun hotSearch(apiCallBack: ApiCallBack<HotSearchData>) {
val okHttpClient = ServerConfiguration.initOkHttpClient()
val request =
Request.Builder()
.url(ServerConfiguration.website + "php/search.php?action=hotSearch")
.get().build()
val call = okHttpClient.newCall(request)
val handler = Handler(Looper.getMainLooper())
val gson = Gson()
call.enqueue(object : Callback {
override fun onFailure(call: Call, e: IOException) {
e.printStackTrace()
handler.post { apiCallBack.onFailure(e) }
}
override fun onResponse(call: Call, response: Response) {
try {
val data = response.body!!.string()
val finalHotSearchData =
gson.fromJson(data, HotSearchData::class.java)
handler.post {
apiCallBack.onResponse(finalHotSearchData)
}
} catch (e: Exception) {
e.printStackTrace()
handler.post {
apiCallBack.onFailure(e)
}
}
}
})
}
} }

View File

@ -0,0 +1,72 @@
package com.coldmint.dialog
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.DialogFragment
import androidx.viewbinding.ViewBinding
import com.google.android.material.bottomsheet.BottomSheetDialog
/**
* 基础底部对话框
* @param ViewBindingType : ViewBinding
* @property viewBinding ViewBindingType
*/
abstract class BaseBottomDialog<ViewBindingType : ViewBinding>(val context: Context) :
BottomDialog {
protected val bottomSheetDialog: BottomSheetDialog by lazy {
BottomSheetDialog(context)
}
protected val layoutInflater by lazy {
LayoutInflater.from(context)
}
protected val viewBinding by lazy {
getViewBindingObject(layoutInflater)
}
/**
* 获取布局绑定对象
* @param layoutInflater LayoutInflater
* @return ViewBindingType
*/
abstract fun getViewBindingObject(layoutInflater: LayoutInflater): ViewBindingType
/**
* 当显示对话框
*/
abstract fun onShowDialog(viewBinding:ViewBindingType)
@Deprecated("不建议这样设置请继承BaseBottomDialog类")
override fun setContentView(view: View): BottomDialog {
bottomSheetDialog.setContentView(view)
return this
}
override fun setCancelable(cancelable: Boolean): BottomDialog {
bottomSheetDialog.setCancelable(cancelable)
return this
}
override fun dismiss() {
bottomSheetDialog.dismiss()
}
override fun show(): BottomDialog {
setContentView(viewBinding.root)
onShowDialog(viewBinding)
bottomSheetDialog.show()
return this
}
}

View File

@ -0,0 +1,15 @@
package com.coldmint.dialog
import android.view.View
interface BottomDialog {
fun setContentView(view:View): BottomDialog
fun setCancelable(cancelable:Boolean):BottomDialog
fun dismiss()
fun show():BottomDialog
}