模组投币

This commit is contained in:
coldmint 2022-08-31 14:34:45 +08:00
parent f639e89a53
commit 5c3d4f09c9
60 changed files with 1460 additions and 660 deletions

Binary file not shown.

View File

@ -162,21 +162,23 @@ class ChangePasswordActivity : BaseActivity<ActivityChangePasswordBinding>() {
account,
false
) && checkCode(code, false) && checkPassword(
passWord
passWord, false
)
}
private fun checkCode(code: String, updateView: Boolean = true): Boolean {
return if (code.isBlank()) {
setErrorAndInput(
viewBinding.verificationCodeView,
String.format(
getString(R.string.please_input_value),
viewBinding.verificationCodeLayout.hint.toString()
),
viewBinding.verificationCodeLayout
)
if (updateView) {
setErrorAndInput(
viewBinding.verificationCodeView,
String.format(
getString(R.string.please_input_value),
viewBinding.verificationCodeLayout.hint.toString()
),
viewBinding.verificationCodeLayout
)
}
false
} else {
if (updateView) {

View File

@ -16,6 +16,7 @@ import android.text.style.ClickableSpan
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import androidx.core.view.isVisible
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.WhichButton
import com.afollestad.materialdialogs.actions.setActionButtonEnabled
@ -46,7 +47,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding>() {
.transparentNavigationBar().navigationBarDarkIcon(true)
}
Log.d("应用识别码", AppSettings.getValue(AppSettings.Setting.AppID, ""))
viewBinding.changeServerView.isVisible = BuildConfig.DEBUG
viewBinding.changePasswordView.setOnClickListener {
val intent = Intent(this, ChangePasswordActivity::class.java)
startActivity(intent)
@ -216,14 +217,14 @@ class LoginActivity : BaseActivity<ActivityLoginBinding>() {
)
}
"请更改登录设备" -> {
viewBinding.button.isActivated = false
viewBinding.button.isEnabled = false
verification(
account,
passWord,
appId,
object : ApiCallBack<ApiResponse> {
override fun onResponse(t: ApiResponse) {
viewBinding.button.isActivated = true
viewBinding.button.isEnabled = true
if (t.code == ServerConfiguration.Success_Code) {
MaterialDialog(this@LoginActivity).show {
title(R.string.verification).message(
@ -290,13 +291,8 @@ class LoginActivity : BaseActivity<ActivityLoginBinding>() {
}
override fun onFailure(e: Exception) {
viewBinding.button.isActivated = true
viewBinding.button.isEnabled = true
isLogin = false
viewBinding.button.setBackgroundColor(
GlobalMethod.getColorPrimary(
this@LoginActivity
)
)
viewBinding.button.setText(R.string.login)
showInternetError(viewBinding.button, e)
}
@ -316,7 +312,6 @@ class LoginActivity : BaseActivity<ActivityLoginBinding>() {
override fun onFailure(e: Exception) {
isLogin = false
viewBinding.button.setBackgroundColor(GlobalMethod.getColorPrimary(this@LoginActivity))
viewBinding.button.setText(R.string.login)
showInternetError(viewBinding.button, e)
}

View File

@ -34,6 +34,7 @@ import com.coldmint.rust.core.web.AppUpdate
import com.coldmint.rust.core.web.ServerConfiguration
import com.coldmint.rust.pro.databinding.ActivityMainBinding
import com.coldmint.rust.pro.databinding.HeadLayoutBinding
import com.coldmint.rust.pro.fragments.UserGroupFragment
import com.coldmint.rust.pro.viewmodel.StartViewModel
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.tabs.TabLayout
@ -266,6 +267,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
val codeTable = menu.findItem(R.id.code_table)
val mod = menu.findItem(R.id.mod_item)
val community = menu.findItem(R.id.community_item)
val group = menu.findItem(R.id.user_group)
group.setOnMenuItemClickListener {
viewBinding.drawerlayout.closeDrawer((GravityCompat.START))
val userGroupFragment = UserGroupFragment()
userGroupFragment.show(supportFragmentManager, "userGroup")
false
}
// val help = menu.findItem(R.id.help)
//管理可见性
dataBase.isVisible = isActive

View File

@ -51,9 +51,8 @@ class PackActivity : BaseActivity<ActivityPackBinding>() {
private var needReturn: Boolean = false
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
if (canUseView)
{
viewBinding.toolbar.title = getText(R.string.packmod)
if (canUseView) {
title = getText(R.string.packmod)
setReturnButton()
initData()
initAction()
@ -146,12 +145,6 @@ class PackActivity : BaseActivity<ActivityPackBinding>() {
if (type == getString(R.string.packmod)) {
sourceFileNum = 0
viewBinding.packCard.isVisible = true
viewBinding.packButton.setBackgroundColor(
GlobalMethod.getThemeColor(
this@PackActivity,
R.attr.colorPrimaryVariant
)
)
viewBinding.packButton.setText(R.string.packing)
viewBinding.packingTitle.setText(R.string.packmod)
if (saveConfigurationData()) {
@ -171,8 +164,8 @@ class PackActivity : BaseActivity<ActivityPackBinding>() {
* @param result 是否解压成功
*/
private fun resetButton(result: Boolean) {
viewBinding.packButton.setBackgroundColor(GlobalMethod.getColorPrimary(this@PackActivity))
if (result) {
viewBinding.packButton.setIconResource(R.drawable.ic_outline_share_24)
viewBinding.packButton.setText(R.string.share_mod)
if (needRecyclingFile && viewBinding.deleteSourceFile.isChecked) {
val tip = String.format(getString(R.string.recovery_prompt), modName)

View File

@ -29,7 +29,6 @@ class RustApplication : Application() {
DynamicColors.isDynamicColorAvailable()
)
}.build()
CompletionItemConverter.init(this)
DynamicColors.applyToActivitiesIfAvailable(this, options)
//程序崩溃
CaocConfig.Builder.create()

View File

@ -40,6 +40,7 @@ import com.coldmint.rust.core.web.ServerConfiguration
import com.coldmint.rust.core.web.User
import com.coldmint.rust.core.web.WebMod
import com.coldmint.rust.pro.adapters.CommentAdapter
import com.coldmint.rust.pro.adapters.ModPageDetailsAdapter
import com.coldmint.rust.pro.databinding.ActivityWebModInfoBinding
import com.coldmint.rust.pro.tool.AppSettings
import com.coldmint.rust.pro.base.BaseActivity
@ -47,7 +48,9 @@ import com.coldmint.rust.pro.databinding.LoadFileLayoutBinding
import com.coldmint.rust.pro.dialog.CommentDialog
import com.coldmint.rust.pro.tool.GlobalMethod
import com.coldmint.rust.pro.tool.TextStyleMaker
import com.google.android.material.appbar.AppBarLayout
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.tabs.TabLayoutMediator
import com.youth.banner.adapter.BannerImageAdapter
import com.youth.banner.holder.BannerImageHolder
import com.youth.banner.indicator.CircleIndicator
@ -73,10 +76,7 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
val token by lazy {
AppSettings.getValue(AppSettings.Setting.Token, "")
}
var developer: String? = null
//此模组是否对外开放
private var isOpen = false
lateinit var adapter :ModPageDetailsAdapter
private fun initView() {
setReturnButton()
@ -98,152 +98,179 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
viewBinding.button.isEnabled = false
viewBinding.button.text = getString(R.string.installated)
}
viewBinding.modCommentRecyclerView.layoutManager =
LinearLayoutManager(this@WebModInfoActivity)
viewBinding.modCommentRecyclerView.addItemDecoration(
DividerItemDecoration(this@WebModInfoActivity, DividerItemDecoration.VERTICAL)
)
tip = getString(R.string.file_download_progress)
}
}
private fun initData() {
if (token.isBlank()) {
viewBinding.progressBar.isVisible = false
viewBinding.tipView.isVisible = true
viewBinding.tipView.setText(R.string.please_login_first)
return
}
loadModCommentList(modId)
WebMod.instance.getInfo(token, modId, object : ApiCallBack<WebModInfoData> {
override fun onResponse(t: WebModInfoData) {
if (t.code == ServerConfiguration.Success_Code) {
developer = t.data.developer
isOpen = t.data.hidden == 0
viewBinding.loadLayout.isVisible = false
viewBinding.relativeLayout.isVisible = true
val icon = t.data.icon
if (icon != null && icon.isNotBlank()) {
Glide.with(this@WebModInfoActivity)
.load(ServerConfiguration.getRealLink(icon))
.apply(GlobalMethod.getRequestOptions())
.into(viewBinding.iconView)
adapter = ModPageDetailsAdapter(this, modId)
viewBinding.viewPager2.adapter = adapter
TabLayoutMediator(viewBinding.tabLayout, viewBinding.viewPager2) { tab, i ->
tab.text = when (i) {
0 -> {
getString(R.string.details)
}
title = t.data.name
val screenshotListData = t.data.screenshots
if (screenshotListData != null && screenshotListData.isNotBlank()) {
val list = ArrayList<String>()
val lineParser = LineParser()
lineParser.symbol = ","
lineParser.text = screenshotListData
lineParser.analyse { lineNum, lineData, isEnd ->
list.add(lineData)
true
}
val adapter = object : BannerImageAdapter<String>(list) {
override fun onBindView(
holder: BannerImageHolder?,
data: String?,
position: Int,
size: Int
) {
if (data != null && holder != null) {
Glide.with(this@WebModInfoActivity)
.load(ServerConfiguration.getRealLink(data))
.apply(GlobalMethod.getRequestOptions())
.into(holder.imageView)
}
}
}
viewBinding.banner.setAdapter(adapter)
viewBinding.banner.addBannerLifecycleObserver(this@WebModInfoActivity)
viewBinding.banner.indicator = CircleIndicator(this@WebModInfoActivity)
viewBinding.banner.setIndicatorSelectedColorRes(R.color.blue_500)
viewBinding.banner.isAutoLoop(false)
} else {
viewBinding.banner.isVisible = false
1 -> {
getString(R.string.insert_coins)
}
val tags = t.data.tags
val lineParser = LineParser(tags)
val tagList = ArrayList<String>()
lineParser.symbol = ","
lineParser.analyse { lineNum, lineData, isEnd ->
val tag = lineData.subSequence(1, lineData.length - 1).toString()
tagList.add(tag)
true
2 -> {
getString(R.string.discussion)
}
if (tagList.size > 0) {
viewBinding.belongStackLabelView.labels = tagList
viewBinding.belongStackLabelView.setOnLabelClickListener { index, v, s ->
val bundle = Bundle()
bundle.putString("tag", s)
bundle.putString(
"title",
String.format(getString(R.string.tag_title), s)
)
bundle.putString("action", "tag")
val thisIntent =
Intent(this@WebModInfoActivity, TagActivity::class.java)
thisIntent.putExtra("data", bundle)
startActivity(thisIntent)
}
} else {
viewBinding.belongStackLabelView.isVisible = false
else -> {
getString(R.string.title)
}
viewBinding.titleView.text = t.data.name
TextStyleMaker.instance.load(
viewBinding.modInfoView,
t.data.describe
) { type, data ->
TextStyleMaker.instance.clickEvent(this@WebModInfoActivity, type, data)
}
viewBinding.numView.text =
String.format(
getString(R.string.unit_and_downloadnum),
t.data.unitNumber,
t.data.downloadNumber,
t.data.versionName
)
viewBinding.updateTimeView.text =
String.format(getString(R.string.recent_update), t.data.updateTime)
viewBinding.button.isVisible = true
if (t.data.hidden == 0) {
viewBinding.auditLayout.isVisible = false
}
loadDeveloperInfo(t.data.developer)
viewBinding.button.setOnClickListener {
val type = viewBinding.button.text
val installation = getString(R.string.installation)
when (type) {
installation -> {
downloadAction(t)
}
}
}
} else {
viewBinding.tipView.isVisible = true
viewBinding.tipView.text = t.message
viewBinding.progressBar.isVisible = false
}
}
override fun onFailure(e: Exception) {
viewBinding.progressBar.isVisible = false
viewBinding.tipView.isVisible = true
viewBinding.tipView.setText(R.string.network_error)
}
})
}.attach()
// viewBinding.button.setOnClickListener {
// val type = viewBinding.button.text
// val installation = getString(R.string.installation)
// when (type) {
// installation -> {
// downloadAction(t)
// }
// }
//
// }
// viewBinding.modCommentRecyclerView.layoutManager =
// LinearLayoutManager(this@WebModInfoActivity)
// viewBinding.modCommentRecyclerView.addItemDecoration(
// DividerItemDecoration(this@WebModInfoActivity, DividerItemDecoration.VERTICAL)
// )
tip = getString(R.string.file_download_progress)
}
}
// private fun initData() {
//
// if (token.isBlank()) {
// viewBinding.progressBar.isVisible = false
// viewBinding.tipView.isVisible = true
// viewBinding.tipView.setText(R.string.please_login_first)
// return
// }
//
// loadModCommentList(modId)
//
//
// WebMod.instance.getInfo(token, modId, object : ApiCallBack<WebModInfoData> {
// override fun onResponse(t: WebModInfoData) {
// if (t.code == ServerConfiguration.Success_Code) {
// developer = t.data.developer
// isOpen = t.data.hidden == 0
// viewBinding.loadLayout.isVisible = false
// viewBinding.relativeLayout.isVisible = true
// val icon = t.data.icon
// if (icon != null && icon.isNotBlank()) {
// Glide.with(this@WebModInfoActivity)
// .load(ServerConfiguration.getRealLink(icon))
// .apply(GlobalMethod.getRequestOptions())
// .into(viewBinding.iconView)
// }
// title = t.data.name
// val screenshotListData = t.data.screenshots
// if (screenshotListData != null && screenshotListData.isNotBlank()) {
// val list = ArrayList<String>()
// val lineParser = LineParser()
// lineParser.symbol = ","
// lineParser.text = screenshotListData
// lineParser.analyse { lineNum, lineData, isEnd ->
// list.add(lineData)
// true
// }
// val adapter = object : BannerImageAdapter<String>(list) {
// override fun onBindView(
// holder: BannerImageHolder?,
// data: String?,
// position: Int,
// size: Int
// ) {
// if (data != null && holder != null) {
// Glide.with(this@WebModInfoActivity)
// .load(ServerConfiguration.getRealLink(data))
// .apply(GlobalMethod.getRequestOptions())
// .into(holder.imageView)
// }
// }
// }
// viewBinding.banner.setAdapter(adapter)
// viewBinding.banner.addBannerLifecycleObserver(this@WebModInfoActivity)
// viewBinding.banner.indicator = CircleIndicator(this@WebModInfoActivity)
// viewBinding.banner.setIndicatorSelectedColorRes(R.color.blue_500)
// viewBinding.banner.isAutoLoop(false)
// } else {
// viewBinding.banner.isVisible = false
// }
// val tags = t.data.tags
// val lineParser = LineParser(tags)
// val tagList = ArrayList<String>()
// lineParser.symbol = ","
// lineParser.analyse { lineNum, lineData, isEnd ->
// val tag = lineData.subSequence(1, lineData.length - 1).toString()
// tagList.add(tag)
// true
// }
// if (tagList.size > 0) {
// viewBinding.belongStackLabelView.labels = tagList
// viewBinding.belongStackLabelView.setOnLabelClickListener { index, v, s ->
// val bundle = Bundle()
// bundle.putString("tag", s)
// bundle.putString(
// "title",
// String.format(getString(R.string.tag_title), s)
// )
// bundle.putString("action", "tag")
// val thisIntent =
// Intent(this@WebModInfoActivity, TagActivity::class.java)
// thisIntent.putExtra("data", bundle)
// startActivity(thisIntent)
// }
// } else {
// viewBinding.belongStackLabelView.isVisible = false
// }
// viewBinding.titleView.text = t.data.name
// TextStyleMaker.instance.load(
// viewBinding.modInfoView,
// t.data.describe
// ) { type, data ->
// TextStyleMaker.instance.clickEvent(this@WebModInfoActivity, type, data)
// }
// viewBinding.numView.text =
// String.format(
// getString(R.string.unit_and_downloadnum),
// t.data.unitNumber,
// t.data.downloadNumber,
// t.data.versionName
// )
// viewBinding.updateTimeView.text =
// String.format(getString(R.string.recent_update), t.data.updateTime)
// viewBinding.button.isVisible = true
// if (t.data.hidden == 0) {
// viewBinding.auditLayout.isVisible = false
// }
// loadDeveloperInfo(t.data.developer)
//
// viewBinding.button.setOnClickListener {
// val type = viewBinding.button.text
// val installation = getString(R.string.installation)
// when (type) {
// installation -> {
// downloadAction(t)
// }
// }
//
// }
// } else {
// viewBinding.tipView.isVisible = true
// viewBinding.tipView.text = t.message
// viewBinding.progressBar.isVisible = false
// }
// }
//
// override fun onFailure(e: Exception) {
// viewBinding.progressBar.isVisible = false
// viewBinding.tipView.isVisible = true
// viewBinding.tipView.setText(R.string.network_error)
// }
//
// })
//
// }
/**
* 下载事件
* @param t WebModInfoData
@ -291,12 +318,12 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.report_item -> {
if (isOpen) {
if (adapter.isOpen()) {
val thisIntent = Intent(this, ReportActivity::class.java)
val bundle = Bundle()
bundle.putString("target", modId)
bundle.putString("type", "mod")
bundle.putString("name", viewBinding.titleView.text.toString())
bundle.putString("name", title.toString())
thisIntent.putExtra("data", bundle)
startActivity(thisIntent)
} else {
@ -315,10 +342,10 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
return super.onOptionsItemSelected(item)
}
override fun onResume() {
super.onResume()
loadModCommentList(modId)
}
// override fun onResume() {
// super.onResume()
// loadModCommentList(modId)
// }
/**
@ -378,79 +405,79 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
}
}
/**
* 加载评论列表
* @param modId String
*/
fun loadModCommentList(modId: String) {
viewBinding.commentLinearProgressIndicator.isVisible = true
WebMod.instance.getCommentsList(modId, object : ApiCallBack<WebModCommentData> {
override fun onResponse(t: WebModCommentData) {
viewBinding.commentLinearProgressIndicator.isVisible = false
val data = t.data
if (data == null) {
viewBinding.modCommentRecyclerView.isVisible = false
} else {
val adapter = CommentAdapter(this@WebModInfoActivity, data)
viewBinding.discussion.text =
String.format(getString(R.string.discussion_num), data.size)
adapter.setItemEvent { i, itemCommentBinding, viewHolder, data ->
itemCommentBinding.iconView.setOnClickListener {
gotoUserPage(data.account)
}
}
viewBinding.modCommentRecyclerView.isVisible = true
viewBinding.modCommentRecyclerView.adapter = adapter
}
}
override fun onFailure(e: Exception) {
viewBinding.commentLinearProgressIndicator.isVisible = false
viewBinding.modCommentRecyclerView.isVisible = false
}
})
}
fun loadDeveloperInfo(userId: String) {
User.getSpaceInfo(userId, object : ApiCallBack<SpaceInfoData> {
override fun onResponse(t: SpaceInfoData) {
if (t.code == ServerConfiguration.Success_Code) {
val icon = t.data.headIcon
if (icon != null) {
Glide.with(this@WebModInfoActivity)
.load(ServerConfiguration.getRealLink(icon))
.apply(GlobalMethod.getRequestOptions(true))
.into(viewBinding.headIconView)
}
viewBinding.userNameView.text = t.data.userName
val info = String.format(
getString(R.string.fans_information),
ServerConfiguration.numberToString(t.data.fans),
ServerConfiguration.numberToString(t.data.follower),
ServerConfiguration.numberToString(t.data.praise)
)
viewBinding.userInfoView.text = info
viewBinding.cardView.postDelayed({
viewBinding.cardView.isVisible = true
viewBinding.openUserSpace.setOnClickListener {
gotoUserPage(t.data.account)
}
}, 300)
}
// else {
// viewBinding.cardView.isVisible = false
// /**
// * 加载评论列表
// * @param modId String
// */
// fun loadModCommentList(modId: String) {
// viewBinding.commentLinearProgressIndicator.isVisible = true
// WebMod.instance.getCommentsList(modId, object : ApiCallBack<WebModCommentData> {
// override fun onResponse(t: WebModCommentData) {
// viewBinding.commentLinearProgressIndicator.isVisible = false
// val data = t.data
// if (data == null) {
// viewBinding.modCommentRecyclerView.isVisible = false
// } else {
// val adapter = CommentAdapter(this@WebModInfoActivity, data)
// viewBinding.discussion.text =
// String.format(getString(R.string.discussion_num), data.size)
// adapter.setItemEvent { i, itemCommentBinding, viewHolder, data ->
// itemCommentBinding.iconView.setOnClickListener {
// gotoUserPage(data.account)
// }
// }
// viewBinding.modCommentRecyclerView.isVisible = true
// viewBinding.modCommentRecyclerView.adapter = adapter
// }
}
override fun onFailure(e: Exception) {
// viewBinding.cardView.isVisible = false
}
})
}
// }
//
// override fun onFailure(e: Exception) {
// viewBinding.commentLinearProgressIndicator.isVisible = false
// viewBinding.modCommentRecyclerView.isVisible = false
// }
//
// })
// }
//
// fun loadDeveloperInfo(userId: String) {
// User.getSpaceInfo(userId, object : ApiCallBack<SpaceInfoData> {
// override fun onResponse(t: SpaceInfoData) {
// if (t.code == ServerConfiguration.Success_Code) {
// val icon = t.data.headIcon
// if (icon != null) {
// Glide.with(this@WebModInfoActivity)
// .load(ServerConfiguration.getRealLink(icon))
// .apply(GlobalMethod.getRequestOptions(true))
// .into(viewBinding.headIconView)
// }
// viewBinding.userNameView.text = t.data.userName
// val info = String.format(
// getString(R.string.fans_information),
// ServerConfiguration.numberToString(t.data.fans),
// ServerConfiguration.numberToString(t.data.follower),
// ServerConfiguration.numberToString(t.data.praise)
// )
// viewBinding.userInfoView.text = info
//
// viewBinding.cardView.postDelayed({
// viewBinding.cardView.isVisible = true
// viewBinding.openUserSpace.setOnClickListener {
// gotoUserPage(t.data.account)
// }
// }, 300)
// }
//// else {
//// viewBinding.cardView.isVisible = false
//// }
//
// }
//
// override fun onFailure(e: Exception) {
//// viewBinding.cardView.isVisible = false
// }
//
// })
// }
/**
@ -468,46 +495,46 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
)
}
private fun initAction() {
viewBinding.sendDiscussion.setOnClickListener {
val account = AppSettings.getValue(AppSettings.Setting.Account, "")
if (account.isBlank()) {
showError(getString(R.string.please_login_first))
return@setOnClickListener
}
CommentDialog(this).setCancelable(false)
.setSubmitFun { button, textInputLayout, s, alertDialog ->
button.isEnabled = false
WebMod.instance.sendComment(
AppSettings.getValue(AppSettings.Setting.Token, ""),
modId,
s,
object : ApiCallBack<ApiResponse> {
override fun onResponse(t: ApiResponse) {
if (t.code == ServerConfiguration.Success_Code) {
alertDialog.dismiss()
loadModCommentList(modId)
Snackbar.make(
viewBinding.button,
R.string.release_ok,
Snackbar.LENGTH_SHORT
).show()
} else {
textInputLayout.error = t.message
}
}
override fun onFailure(e: Exception) {
textInputLayout.error = e.toString()
}
})
}.show()
}
}
// private fun initAction() {
// viewBinding.sendDiscussion.setOnClickListener {
// val account = AppSettings.getValue(AppSettings.Setting.Account, "")
// if (account.isBlank()) {
// showError(getString(R.string.please_login_first))
// return@setOnClickListener
// }
//
//
// CommentDialog(this).setCancelable(false)
// .setSubmitFun { button, textInputLayout, s, alertDialog ->
// button.isEnabled = false
// WebMod.instance.sendComment(
// AppSettings.getValue(AppSettings.Setting.Token, ""),
// modId,
// s,
// object : ApiCallBack<ApiResponse> {
// override fun onResponse(t: ApiResponse) {
// if (t.code == ServerConfiguration.Success_Code) {
// alertDialog.dismiss()
// loadModCommentList(modId)
// Snackbar.make(
// viewBinding.button,
// R.string.release_ok,
// Snackbar.LENGTH_SHORT
// ).show()
// } else {
// textInputLayout.error = t.message
// }
// }
//
// override fun onFailure(e: Exception) {
// textInputLayout.error = e.toString()
// }
//
// })
// }.show()
// }
//
// }
override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivityWebModInfoBinding {
return ActivityWebModInfoBinding.inflate(layoutInflater)
@ -516,8 +543,8 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
if (canUseView) {
initView()
initData()
initAction()
// initData()
// initAction()
}
}
}

View File

@ -42,7 +42,11 @@ class CommentAdapter(context: Context, dataList: MutableList<WebModCommentData.D
.into(viewBinding.iconView)
}
viewBinding.nameView.text = data.userName
viewBinding.timeView.text = data.time
viewBinding.timeView.text = if (data.location == null) {
data.time
} else {
data.time + " " + data.location
}
TextStyleMaker.instance.load(viewBinding.contentView, data.content) { type, data ->
TextStyleMaker.instance.clickEvent(context, type, data)
}

View File

@ -29,7 +29,7 @@ import org.w3c.dom.Text
* @author Cold Mint
* @date 2021/12/28 18:29
*/
class DynamicAdapter( context: Context, dataList: MutableList<DynamicItemDataBean.Data>) :
class DynamicAdapter(context: Context, dataList: MutableList<DynamicItemDataBean.Data>) :
BaseAdapter<ItemDynamicBinding, DynamicItemDataBean.Data>(context, dataList) {
@ -53,7 +53,11 @@ class DynamicAdapter( context: Context, dataList: MutableList<DynamicItemDataBea
.apply(GlobalMethod.getRequestOptions(true))
.into(viewBinding.headIconView)
}
viewBinding.timeView.text = data.time
viewBinding.timeView.text = if (data.location == null) {
data.time
} else {
data.time + " " + data.location
}
viewBinding.nameView.text = data.userName
TextStyleMaker.instance.load(viewBinding.textview, data.content) { type, data ->
TextStyleMaker.instance.clickEvent(context, type, data)
@ -69,8 +73,7 @@ class DynamicAdapter( context: Context, dataList: MutableList<DynamicItemDataBea
GlobalMethod.copyText(context, data.content, view)
}
context.getString(R.string.delete_title) -> {
val account = AppSettings.
getValue(AppSettings.Setting.Account, "")
val account = AppSettings.getValue(AppSettings.Setting.Account, "")
val appId =
AppSettings
.getValue(AppSettings.Setting.AppID, "")

View File

@ -0,0 +1,59 @@
package com.coldmint.rust.pro.adapters
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.coldmint.rust.core.tool.DebugHelper
import com.coldmint.rust.pro.fragments.InsertCoinsFragment
import com.coldmint.rust.pro.fragments.ModCommentsFragment
import com.coldmint.rust.pro.fragments.NullFragment
import com.coldmint.rust.pro.fragments.WebModDetailsFragment
/**
* 模组详情页面适配器
* @constructor
*/
class ModPageDetailsAdapter(fragmentActivity: FragmentActivity, val modId: String) :
FragmentStateAdapter(fragmentActivity) {
private lateinit var webModDetailsFragment: WebModDetailsFragment
private lateinit var modCommentsFragment: ModCommentsFragment
override fun getItemCount(): Int {
return 3
}
/**
* 获取此模组是否对外开放
* @return Boolean
*/
fun isOpen(): Boolean {
return if (this::webModDetailsFragment.isInitialized) {
webModDetailsFragment.isOpen()
} else {
DebugHelper.printLog("获取模组公开状态", "详情碎片未初始化返回false", isError = true)
false
}
}
override fun createFragment(position: Int): Fragment {
return when (position) {
0 -> {
if (!this::webModDetailsFragment.isInitialized) {
webModDetailsFragment = WebModDetailsFragment(modId)
}
webModDetailsFragment
}
1 -> {
InsertCoinsFragment(modId)
}
2 -> {
if (!this::modCommentsFragment.isInitialized) {
modCommentsFragment = ModCommentsFragment(modId)
}
modCommentsFragment
}
else -> {
NullFragment()
}
}
}
}

View File

@ -0,0 +1,35 @@
package com.coldmint.rust.pro.adapters
import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import com.bumptech.glide.Glide
import com.coldmint.rust.pro.base.BaseAdapter
import com.coldmint.rust.pro.databean.UserGroupData
import com.coldmint.rust.pro.databinding.ItemTemplateBinding
import com.coldmint.rust.pro.databinding.ItemUserBinding
import com.coldmint.rust.pro.databinding.ItemUserGroupBinding
/**
* 用户群适配器
*/
class UserGroupAdapter(context: Context, dataList: MutableList<UserGroupData>) :
BaseAdapter<ItemUserGroupBinding, UserGroupData>(context, dataList) {
override fun getViewBindingObject(
layoutInflater: LayoutInflater,
parent: ViewGroup,
viewType: Int
): ItemUserGroupBinding {
return ItemUserGroupBinding.inflate(layoutInflater, parent, false)
}
override fun onBingView(
data: UserGroupData,
viewBinding: ItemUserGroupBinding,
viewHolder: ViewHolder<ItemUserGroupBinding>,
position: Int
) {
viewBinding.imageView.setImageResource(data.iconRes)
viewBinding.titleView.setText(data.titleRes)
}
}

View File

@ -0,0 +1,3 @@
package com.coldmint.rust.pro.databean
data class UserGroupData(val iconRes: Int, val titleRes: Int)

View File

@ -15,7 +15,7 @@ import com.coldmint.rust.pro.databinding.*
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
class CommunityFragment : BaseFragment<CommunityFragmentBinding>() {
class CommunityFragment : BaseFragment<FragmentCommunityBinding>() {
// 当请求时,此适配器返回一个
// representing an object in the collection.
private val communityAdapter: CommunityAdapter by lazy {
@ -51,8 +51,8 @@ class CommunityFragment : BaseFragment<CommunityFragmentBinding>() {
}
override fun getViewBindingObject(layoutInflater: LayoutInflater): CommunityFragmentBinding {
return CommunityFragmentBinding.inflate(layoutInflater)
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentCommunityBinding {
return FragmentCommunityBinding.inflate(layoutInflater)
}
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {

View File

@ -24,14 +24,14 @@ import com.coldmint.rust.pro.R
import com.coldmint.rust.pro.tool.AppSettings
import com.coldmint.rust.pro.adapters.DataSetAdapter
import com.coldmint.rust.pro.base.BaseFragment
import com.coldmint.rust.pro.databinding.DatabaseFragmentBinding
import com.coldmint.rust.pro.databinding.FragmentDatabaseBinding
import com.coldmint.rust.pro.databinding.DialogDatasetBinding
import com.google.gson.Gson
import java.io.File
import java.util.concurrent.Executors
import kotlin.collections.ArrayList
class DatabaseFragment : BaseFragment<DatabaseFragmentBinding>() {
class DatabaseFragment : BaseFragment<FragmentDatabaseBinding>() {
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
@ -165,7 +165,7 @@ class DatabaseFragment : BaseFragment<DatabaseFragmentBinding>() {
}
override fun getViewBindingObject(layoutInflater: LayoutInflater): DatabaseFragmentBinding {
return DatabaseFragmentBinding.inflate(layoutInflater)
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentDatabaseBinding {
return FragmentDatabaseBinding.inflate(layoutInflater)
}
}

View File

@ -0,0 +1,24 @@
package com.coldmint.rust.pro.fragments
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.coldmint.rust.pro.base.BaseFragment
import com.coldmint.rust.pro.databinding.FragmentInsertCoinsBinding
/**
* 投币碎片
*/
class InsertCoinsFragment(val modId: String) : BaseFragment<FragmentInsertCoinsBinding>() {
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
}
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentInsertCoinsBinding {
return FragmentInsertCoinsBinding.inflate(layoutInflater)
}
}

View File

@ -11,7 +11,7 @@ import com.coldmint.rust.pro.tool.AppSettings
import com.coldmint.rust.core.LocalTemplatePackage
import com.coldmint.rust.pro.adapters.TemplateListAdapter
import com.coldmint.rust.pro.base.BaseFragment
import com.coldmint.rust.pro.databinding.TemplateFragemntBinding
import com.coldmint.rust.pro.databinding.FragmentLocalTemplateBinding
import java.io.File
import java.util.*
import kotlin.collections.ArrayList
@ -20,7 +20,7 @@ import kotlin.collections.ArrayList
* 本地模板碎片
* @property first Boolean
*/
class LocalTemplateFragment : BaseFragment<TemplateFragemntBinding>() {
class LocalTemplateFragment : BaseFragment<FragmentLocalTemplateBinding>() {
private var first = true
override fun onResume() {
@ -65,8 +65,8 @@ class LocalTemplateFragment : BaseFragment<TemplateFragemntBinding>() {
}
}
override fun getViewBindingObject(layoutInflater: LayoutInflater): TemplateFragemntBinding {
return TemplateFragemntBinding.inflate(layoutInflater)
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentLocalTemplateBinding {
return FragmentLocalTemplateBinding.inflate(layoutInflater)
}
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {

View File

@ -0,0 +1,135 @@
package com.coldmint.rust.pro.fragments
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.core.view.isVisible
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import com.coldmint.rust.core.ModClass
import com.coldmint.rust.core.dataBean.ApiResponse
import com.coldmint.rust.core.dataBean.mod.WebModCommentData
import com.coldmint.rust.core.interfaces.ApiCallBack
import com.coldmint.rust.core.tool.DebugHelper
import com.coldmint.rust.core.web.ServerConfiguration
import com.coldmint.rust.core.web.WebMod
import com.coldmint.rust.pro.R
import com.coldmint.rust.pro.adapters.CommentAdapter
import com.coldmint.rust.pro.base.BaseFragment
import com.coldmint.rust.pro.databinding.FragmentModCommentsBinding
import com.coldmint.rust.pro.dialog.CommentDialog
import com.coldmint.rust.pro.tool.AppSettings
import com.google.android.material.snackbar.Snackbar
/**
* 模组评论适配器
*/
class ModCommentsFragment(val modId: String) : BaseFragment<FragmentModCommentsBinding>() {
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
viewBinding.recyclerView.layoutManager = LinearLayoutManager(requireContext())
viewBinding.recyclerView.addItemDecoration(
DividerItemDecoration(
requireContext(),
DividerItemDecoration.VERTICAL
)
)
viewBinding.swipeRefreshLayout.setOnRefreshListener {
loadCommentList(modId, false)
viewBinding.swipeRefreshLayout.isRefreshing = false
}
viewBinding.sendDiscussion.setOnClickListener {
val account = AppSettings.getValue(AppSettings.Setting.Account, "")
if (account.isBlank()) {
Toast.makeText(requireContext(), R.string.please_login_first, Toast.LENGTH_SHORT)
.show()
return@setOnClickListener
}
CommentDialog(requireContext()).setCancelable(false)
.setSubmitFun { button, textInputLayout, s, alertDialog ->
button.isEnabled = false
WebMod.instance.sendComment(
AppSettings.getValue(AppSettings.Setting.Token, ""),
modId,
s,
object : ApiCallBack<ApiResponse> {
override fun onResponse(t: ApiResponse) {
if (t.code == ServerConfiguration.Success_Code) {
alertDialog.dismiss()
loadCommentList(modId)
Snackbar.make(
viewBinding.sendDiscussion,
R.string.release_ok,
Snackbar.LENGTH_SHORT
).show()
} else {
textInputLayout.error = t.message
}
}
override fun onFailure(e: Exception) {
textInputLayout.error = e.toString()
}
})
}.show()
}
}
override fun onResume() {
super.onResume()
loadCommentList(modId)
}
/**
* 加载评论列表
* @param modId String
*/
fun loadCommentList(modId: String, useLinearProgressIndicator: Boolean = true) {
val key = "加载评论列表"
if (useLinearProgressIndicator) {
viewBinding.linearProgressIndicator.isVisible = true
}
WebMod.instance.getCommentsList(modId, object : ApiCallBack<WebModCommentData> {
override fun onResponse(t: WebModCommentData) {
val list = t.data
if (list.isNullOrEmpty()) {
DebugHelper.printLog(key, "为空", isError = true)
if (useLinearProgressIndicator) {
viewBinding.linearProgressIndicator.isVisible = false
}
viewBinding.recyclerView.isVisible = false
viewBinding.noContentLayout.isVisible = true
} else {
DebugHelper.printLog(key, "${list.size}条数据")
if (useLinearProgressIndicator) {
viewBinding.linearProgressIndicator.isVisible = false
}
viewBinding.recyclerView.isVisible = true
viewBinding.noContentLayout.isVisible = false
viewBinding.recyclerView.adapter = CommentAdapter(requireContext(), list)
}
}
override fun onFailure(e: Exception) {
DebugHelper.printLog(key, "加载失败", isError = true)
if (useLinearProgressIndicator) {
viewBinding.linearProgressIndicator.isVisible = false
}
viewBinding.recyclerView.isVisible = false
viewBinding.noContentLayout.isVisible = true
}
})
}
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentModCommentsBinding {
return FragmentModCommentsBinding.inflate(layoutInflater)
}
}

View File

@ -2,23 +2,21 @@ package com.coldmint.rust.pro.fragments
import android.annotation.SuppressLint
import android.content.res.ColorStateList
import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.os.*
import android.view.LayoutInflater
import androidx.core.view.isVisible
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import com.coldmint.rust.core.ModClass
import com.coldmint.rust.core.dataBean.ModConfigurationData
import com.coldmint.rust.core.tool.DebugHelper
import com.coldmint.rust.core.tool.FileOperator
import com.coldmint.rust.pro.R
import com.coldmint.rust.pro.adapters.ModActionAdapter
import com.coldmint.rust.pro.adapters.ModAdapter
import com.coldmint.rust.pro.base.BaseFragment
import com.coldmint.rust.pro.databinding.ModDialogBinding
import com.coldmint.rust.pro.databinding.ModFragmentBinding
import com.coldmint.rust.pro.databinding.FragmentModBinding
import com.coldmint.rust.pro.databinding.ModListItemBinding
import com.coldmint.rust.pro.tool.AppSettings
import com.coldmint.rust.pro.tool.GlobalMethod
@ -27,11 +25,12 @@ import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.snackbar.Snackbar
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import me.zhanghai.android.fastscroll.FastScrollerBuilder
import java.io.File
class ModFragment : BaseFragment<ModFragmentBinding>() {
class ModFragment : BaseFragment<FragmentModBinding>() {
val viewModel: ModViewModel by lazy {
ModViewModel()
}
@ -193,27 +192,31 @@ class ModFragment : BaseFragment<ModFragmentBinding>() {
viewBinding.progressBar.isVisible = false
viewBinding.modErrorIcon.isVisible = false
viewBinding.modError.isVisible = false
modAdapter = ModAdapter(requireContext(), dataList)
FastScrollerBuilder(viewBinding.modList).useMd2Style()
.setPopupTextProvider(modAdapter).build()
modAdapter.setItemEvent { i, modListItemBinding, viewHolder, modClass ->
if (isAdded) {
modAdapter = ModAdapter(requireContext(), dataList)
FastScrollerBuilder(viewBinding.modList).useMd2Style()
.setPopupTextProvider(modAdapter).build()
modAdapter.setItemEvent { i, modListItemBinding, viewHolder, modClass ->
modListItemBinding.root.setOnClickListener {
onClickItemWork(modListItemBinding, modClass)
}
modListItemBinding.root.setOnClickListener {
onClickItemWork(modListItemBinding, modClass)
}
modListItemBinding.root.setOnLongClickListener {
modAdapter.showDeleteItemDialog(
modClass.modName,
viewHolder.adapterPosition,
onClickPositiveButton = { d, b ->
delFile(handler, modClass, viewHolder.adapterPosition)
false
})
false
modListItemBinding.root.setOnLongClickListener {
modAdapter.showDeleteItemDialog(
modClass.modName,
viewHolder.adapterPosition,
onClickPositiveButton = { d, b ->
delFile(handler, modClass, viewHolder.adapterPosition)
false
})
false
}
}
viewBinding.modList.adapter = modAdapter
} else {
DebugHelper.printLog("加载模组列表", "没有附加到活动", isError = true)
}
viewBinding.modList.adapter = modAdapter
}
}
}
@ -328,8 +331,8 @@ class ModFragment : BaseFragment<ModFragmentBinding>() {
// viewBinding.progressBar.isVisible = false
// }
override fun getViewBindingObject(layoutInflater: LayoutInflater): ModFragmentBinding {
return ModFragmentBinding.inflate(layoutInflater)
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentModBinding {
return FragmentModBinding.inflate(layoutInflater)
}
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {

View File

@ -20,7 +20,7 @@ import com.coldmint.rust.pro.R
import com.coldmint.rust.pro.WebModInfoActivity
import com.coldmint.rust.pro.adapters.WebModAdapter
import com.coldmint.rust.pro.base.BaseFragment
import com.coldmint.rust.pro.databinding.RecommendedFragmentBinding
import com.coldmint.rust.pro.databinding.FragmentRecommendedBinding
import com.coldmint.rust.pro.tool.AppSettings
import com.coldmint.rust.pro.tool.GlobalMethod
import com.coldmint.rust.pro.tool.TextStyleMaker
@ -29,8 +29,9 @@ import com.youth.banner.adapter.BannerImageAdapter
import com.youth.banner.holder.BannerImageHolder
import com.youth.banner.indicator.CircleIndicator
import com.youth.banner.transformer.AlphaPageTransformer
import com.youth.banner.transformer.DepthPageTransformer
class RecommendedFragment : BaseFragment<RecommendedFragmentBinding>() {
class RecommendedFragment : BaseFragment<FragmentRecommendedBinding>() {
/**
* 加载最近更新
@ -177,8 +178,8 @@ class RecommendedFragment : BaseFragment<RecommendedFragmentBinding>() {
}
}
})
viewBinding.banner.setBannerGalleryEffect(16, 16, 8)
viewBinding.banner.addPageTransformer(AlphaPageTransformer())
// viewBinding.banner.setBannerGalleryEffect(16, 16, 8)
// viewBinding.banner.addPageTransformer(DepthPageTransformer())
if (activity != null) {
viewBinding.banner.addBannerLifecycleObserver(activity)
viewBinding.banner.indicator = CircleIndicator(activity)
@ -221,8 +222,8 @@ class RecommendedFragment : BaseFragment<RecommendedFragmentBinding>() {
loadBannerData()
}
override fun getViewBindingObject(layoutInflater: LayoutInflater): RecommendedFragmentBinding {
return RecommendedFragmentBinding.inflate(layoutInflater)
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentRecommendedBinding {
return FragmentRecommendedBinding.inflate(layoutInflater)
}
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {

View File

@ -0,0 +1,56 @@
package com.coldmint.rust.pro.fragments
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import com.coldmint.rust.core.tool.AppOperator
import com.coldmint.rust.pro.R
import com.coldmint.rust.pro.adapters.UserGroupAdapter
import com.coldmint.rust.pro.databean.UserGroupData
import com.coldmint.rust.pro.databinding.FragmentUserGroupBinding
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
/**
* 用户群碎片
* @property viewBinding FragmentUserGroupBinding
*/
class UserGroupFragment : BottomSheetDialogFragment() {
private lateinit var viewBinding: FragmentUserGroupBinding
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
viewBinding = FragmentUserGroupBinding.inflate(inflater, container, false)
return viewBinding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
viewBinding.recyclerView.layoutManager = LinearLayoutManager(requireContext())
val dataList = ArrayList<UserGroupData>()
dataList.add(UserGroupData(R.drawable.ic_qq, R.string.qq_group))
dataList.add(UserGroupData(R.drawable.ic_discord, R.string.discord_group))
val adapter = UserGroupAdapter(requireContext(), dataList)
viewBinding.recyclerView.adapter = adapter
adapter.setItemEvent { i, itemUserGroupBinding, viewHolder, userGroupData ->
itemUserGroupBinding.root.setOnClickListener {
if (userGroupData.titleRes == R.string.qq_group) {
AppOperator.useBrowserAccessWebPage(
requireContext(),
"https://qun.qq.com/qqweb/qunpro/share?_wv=3&_wwv=128&appChannel=share&inviteCode=1W7Dpb0&businessType=9&from=246610&biz=ka"
)
} else if (userGroupData.titleRes == R.string.discord_group) {
AppOperator.useBrowserAccessWebPage(
requireContext(),
"https://discord.gg/DTQDmVdVK3"
)
}
}
}
}
}

View File

@ -124,7 +124,12 @@ class UserInfoFragment : BaseFragment<FragmentUserInfoBinding>() {
.apply(GlobalMethod.getRequestOptions(true))
.into(viewBinding.headIconView)
}
viewBinding.emailView.text = t.data.email
viewBinding.coinView.text = String.format(
getString(
R.string.coin_number,
t.data.coinNumber
)
)
loadRecyclerView(t.data.permission)
} else {
// Toast.makeText(requireContext(), t.toString(), Toast.LENGTH_SHORT).show()

View File

@ -11,7 +11,6 @@ import com.coldmint.rust.pro.R
import com.coldmint.rust.pro.adapters.WarehouseAdapter
import com.coldmint.rust.pro.base.BaseAdapter
import com.coldmint.rust.pro.base.BaseFragment
import com.coldmint.rust.pro.databinding.CommunityFragmentBinding
import com.coldmint.rust.pro.databinding.FragmentWarehouseBinding
import com.google.android.material.tabs.TabLayoutMediator

View File

@ -0,0 +1,232 @@
package com.coldmint.rust.pro.fragments
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import androidx.core.view.isVisible
import com.bumptech.glide.Glide
import com.coldmint.rust.core.dataBean.mod.WebModInfoData
import com.coldmint.rust.core.dataBean.user.SpaceInfoData
import com.coldmint.rust.core.interfaces.ApiCallBack
import com.coldmint.rust.core.tool.LineParser
import com.coldmint.rust.core.web.ServerConfiguration
import com.coldmint.rust.core.web.User
import com.coldmint.rust.core.web.WebMod
import com.coldmint.rust.pro.R
import com.coldmint.rust.pro.TagActivity
import com.coldmint.rust.pro.UserHomePageActivity
import com.coldmint.rust.pro.base.BaseFragment
import com.coldmint.rust.pro.databinding.FragmentWebModDetailsBinding
import com.coldmint.rust.pro.tool.AppSettings
import com.coldmint.rust.pro.tool.GlobalMethod
import com.coldmint.rust.pro.tool.TextStyleMaker
import com.google.android.material.chip.Chip
import com.youth.banner.adapter.BannerImageAdapter
import com.youth.banner.holder.BannerImageHolder
import com.youth.banner.indicator.CircleIndicator
/**
* 模组详情碎片
*/
class WebModDetailsFragment(val modId: String) : BaseFragment<FragmentWebModDetailsBinding>() {
var developer: String? = null
//此模组是否对外开放
private var isOpen = false
/**
* 获取此模组是否对外开放
* @return Boolean
*/
fun isOpen(): Boolean {
return isOpen
}
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
loadInfo()
}
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentWebModDetailsBinding {
return FragmentWebModDetailsBinding.inflate(layoutInflater)
}
fun loadDeveloperInfo(userId: String) {
User.getSpaceInfo(userId, object : ApiCallBack<SpaceInfoData> {
override fun onResponse(t: SpaceInfoData) {
if (t.code == ServerConfiguration.Success_Code) {
val icon = t.data.headIcon
if (icon != null) {
Glide.with(requireContext())
.load(ServerConfiguration.getRealLink(icon))
.apply(GlobalMethod.getRequestOptions(true))
.into(viewBinding.headIconView)
}
viewBinding.userNameView.text = t.data.userName
val info = String.format(
getString(R.string.fans_information),
ServerConfiguration.numberToString(t.data.fans),
ServerConfiguration.numberToString(t.data.follower),
ServerConfiguration.numberToString(t.data.praise)
)
viewBinding.userInfoView.text = info
viewBinding.cardView.postDelayed({
viewBinding.cardView.isVisible = true
viewBinding.openUserSpace.setOnClickListener {
gotoUserPage(t.data.account)
}
}, 300)
} else {
viewBinding.cardView.isVisible = false
}
}
override fun onFailure(e: Exception) {
viewBinding.cardView.isVisible = false
}
})
}
/**
* 打开用户主页
* @param userId String
*/
fun gotoUserPage(userId: String) {
val intent = Intent(
requireContext(),
UserHomePageActivity::class.java
)
intent.putExtra("userId", userId)
startActivity(
intent
)
}
/**
* 加载页面信息
*/
fun loadInfo() {
val token = AppSettings.getValue(AppSettings.Setting.Token, "")
WebMod.instance.getInfo(token, modId, object : ApiCallBack<WebModInfoData> {
override fun onResponse(t: WebModInfoData) {
if (t.code == ServerConfiguration.Success_Code) {
developer = t.data.developer
isOpen = t.data.hidden == 0
viewBinding.loadLayout.isVisible = false
viewBinding.contentLayout.isVisible = true
val icon = t.data.icon
if (icon != null && icon.isNotBlank()) {
Glide.with(requireContext())
.load(ServerConfiguration.getRealLink(icon))
.apply(GlobalMethod.getRequestOptions())
.into(viewBinding.iconView)
}
val screenshotListData = t.data.screenshots
if (screenshotListData != null && screenshotListData.isNotBlank()) {
val list = ArrayList<String>()
val lineParser = LineParser()
lineParser.symbol = ","
lineParser.text = screenshotListData
lineParser.analyse { lineNum, lineData, isEnd ->
list.add(lineData)
true
}
val adapter = object : BannerImageAdapter<String>(list) {
override fun onBindView(
holder: BannerImageHolder?,
data: String?,
position: Int,
size: Int
) {
if (data != null && holder != null) {
Glide.with(requireContext())
.load(ServerConfiguration.getRealLink(data))
.apply(GlobalMethod.getRequestOptions())
.into(holder.imageView)
}
}
}
viewBinding.banner.setAdapter(adapter)
viewBinding.banner.addBannerLifecycleObserver(requireActivity())
viewBinding.banner.indicator = CircleIndicator(requireActivity())
viewBinding.banner.setIndicatorSelectedColorRes(R.color.blue_500)
viewBinding.banner.isAutoLoop(false)
} else {
viewBinding.banner.isVisible = false
}
val tags = t.data.tags
val lineParser = LineParser(tags)
val tagList = ArrayList<String>()
lineParser.symbol = ","
lineParser.analyse { lineNum, lineData, isEnd ->
val tag = lineData.subSequence(1, lineData.length - 1).toString()
tagList.add(tag)
true
}
if (tagList.size > 0) {
tagList.forEach {
val chip = Chip(requireContext())
chip.text = it
val s = it
chip.setOnClickListener {
val bundle = Bundle()
bundle.putString("tag", s)
bundle.putString(
"title",
String.format(getString(R.string.tag_title), s)
)
bundle.putString("action", "tag")
val thisIntent =
Intent(requireContext(), TagActivity::class.java)
thisIntent.putExtra("data", bundle)
startActivity(thisIntent)
}
viewBinding.chipGroup.addView(chip)
}
} else {
viewBinding.chipGroup.isVisible = false
}
viewBinding.titleView.text = t.data.name
TextStyleMaker.instance.load(
viewBinding.modInfoView,
t.data.describe
) { type, data ->
TextStyleMaker.instance.clickEvent(requireContext(), type, data)
}
viewBinding.numView.text =
String.format(
getString(R.string.unit_and_downloadnum),
t.data.unitNumber,
t.data.downloadNumber,
t.data.versionName
)
viewBinding.updateTimeView.text =
String.format(getString(R.string.recent_update), t.data.updateTime)
if (t.data.hidden == 0) {
viewBinding.hideTextView.isVisible = false
}
loadDeveloperInfo(t.data.developer)
} else {
viewBinding.contentLayout.isVisible = false
viewBinding.loadLayout.isVisible = true
viewBinding.tipView.isVisible = true
viewBinding.tipView.text = t.message
viewBinding.progressBar.isVisible = false
}
}
override fun onFailure(e: Exception) {
viewBinding.contentLayout.isVisible = false
viewBinding.loadLayout.isVisible = true
viewBinding.progressBar.isVisible = false
viewBinding.tipView.isVisible = true
viewBinding.tipView.setText(R.string.network_error)
}
})
}
}

View File

@ -35,6 +35,7 @@ import com.coldmint.rust.pro.*
import com.coldmint.rust.pro.base.BaseAndroidViewModel
import com.coldmint.rust.pro.tool.AppSettings
import com.coldmint.rust.pro.tool.BookmarkManager
import com.coldmint.rust.pro.tool.CompletionItemConverter
import com.coldmint.rust.pro.tool.GlobalMethod
import com.google.android.material.color.DynamicColors
import com.google.android.material.dialog.MaterialAlertDialogBuilder
@ -118,6 +119,8 @@ class StartViewModel(application: Application) : BaseAndroidViewModel(applicatio
initBookmark()
//验证用户信息
verifyingUserInfo()
CompletionItemConverter.init(getApplication())
}

View File

@ -0,0 +1,17 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:width="200dp"
android:height="200dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="?attr/colorPrimary"
android:pathData="M0,512a512,512 0,1 0,1024 0A512,512 0,1 0,0 512z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M190.9,234.3h642.2v477.3H190.9z" />
<path
android:fillColor="?attr/colorPrimary"
android:pathData="M698.2,932.3L157.3,862.8c-58.4,-7.5 -55.4,-191.2 -50.3,-249.9l26,-297.2c5.1,-58.7 74.4,-120.2 132.7,-128.4l466.4,-65.1c58.3,-8.1 177.2,212.6 176.1,271.5l-8.7,445.1M512,300.4c-114.3,0 -194.6,49.1 -194.6,49.1 43.9,-39.3 120.7,-61.9 120.7,-61.9l-7.3,-7.3c-72.1,1.3 -137.4,51.2 -137.4,51.2 -73.4,153.2 -68.7,285.4 -68.7,285.4 59.7,77.2 148.5,71.7 148.5,71.7l30.3,-38.4c-53.3,-11.5 -87,-58.9 -87,-58.9S396.8,646 512,646c115.2,0 195.4,-54.6 195.4,-54.6s-33.7,47.4 -87,58.9l30.3,38.4s88.7,5.5 148.5,-71.7c0,0 4.7,-132.3 -68.7,-285.4 0,0 -65.3,-49.9 -137.4,-51.2l-7.3,7.3s76.8,22.6 120.7,61.9c0,0 -80.2,-49.1 -194.6,-49.1M423.7,462.1c27.7,0 50.3,24.3 49.9,54.2 0,29.4 -22.2,54.2 -49.9,54.2 -27.3,0 -49.5,-24.7 -49.5,-54.2 0,-29.9 21.8,-54.2 49.5,-54.2m177.9,0c27.7,0 49.9,24.3 49.9,54.2 0,29.4 -22.2,54.2 -49.9,54.2 -27.3,0 -49.5,-24.7 -49.5,-54.2 0,-29.9 21.8,-54.2 49.5,-54.2z"
tools:ignore="VectorPath" />
</vector>

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="M4,19h16v2L4,21zM20,3L4,3v10c0,2.21 1.79,4 4,4h6c2.21,0 4,-1.79 4,-4v-3h2c1.11,0 2,-0.9 2,-2L22,5c0,-1.11 -0.89,-2 -2,-2zM16,13c0,1.1 -0.9,2 -2,2L8,15c-1.1,0 -2,-0.9 -2,-2L6,5h10v8zM20,8h-2L18,5h2v3z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92s2.92,-1.31 2.92,-2.92c0,-1.61 -1.31,-2.92 -2.92,-2.92zM18,4c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM6,13c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1 1,0.45 1,1 -0.45,1 -1,1zM18,20.02c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1 1,0.45 1,1 -0.45,1 -1,1z" />
</vector>

View File

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="200dp"
android:height="200dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="?attr/colorPrimary"
android:pathData="M0,512a512,512 0,1 0,1024 0A512,512 0,1 0,0 512z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M244.9,561.3c18.6,-44.2 44.5,-76.8 63.7,-83.8 -0.3,-25.6 4.5,-41.6 12.5,-54.4 0,-1 -1.9,-11.5 5.1,-24.6 4.8,-115.2 79.7,-206.4 201,-206.4s196.2,91.2 201,206.4c7,13.1 5.1,23.7 5.1,24.6 8,12.8 12.8,28.8 12.5,54.4 19.2,7 45.1,39.7 63.7,84.2 24,56.3 27.8,110.4 8.6,120 -13.1,6.4 -33.9,-9.6 -53.4,-37.8 -7.7,31.4 -26.9,60.2 -54.1,82.9 28.8,10.6 47.4,27.8 47.4,47.4 0,32 -50.6,57.9 -112.6,57.9 -56.3,0 -102.1,-21.1 -111.4,-48h-13.4c-9.3,26.9 -55,48 -111.4,48 -62.1,0 -112.6,-25.9 -112.6,-57.9 0,-19.5 18.6,-36.8 47.4,-47.4 -27.2,-22.7 -46.4,-51.5 -54.1,-82.9 -19.5,28.2 -40.3,44.2 -53.4,37.8 -19.2,-9.6 -15.4,-63.7 8.6,-120.3z" />
</vector>

View File

@ -83,30 +83,30 @@
android:layout_below="@id/checkbox"
android:layout_marginTop="8dp">
<TextView
<Button
android:id="@+id/changePasswordView"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/retrieve_password"
android:textColor="?colorPrimary" />
android:text="@string/retrieve_password" />
<TextView
android:visibility="gone"
<Button
android:id="@+id/changeServerView"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_toEndOf="@id/changePasswordView"
android:text="@string/changing_the_server"
android:textColor="?colorPrimary" />
android:visibility="gone" />
<TextView
<Button
android:id="@+id/registerView"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:text="@string/register"
android:textColor="?colorPrimary" />
android:text="@string/register" />
</RelativeLayout>
</RelativeLayout>

View File

@ -48,8 +48,6 @@
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="8dp"
app:defaultNavHost="true"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />

View File

@ -267,6 +267,7 @@
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:text="@string/packmod"
app:icon="@drawable/zip" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".ActivateActivity">
tools:context=".WebModInfoActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
@ -18,285 +18,38 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="详情" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="投币" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="评论" />
</com.google.android.material.tabs.TabLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/viewPager2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
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="match_parent"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:id="@+id/loadLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:visibility="visible">
<TextView
android:id="@+id/tipView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/loading_data"
android:visibility="gone" />
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:visibility="visible" />
</LinearLayout>
<RelativeLayout
android:id="@+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="60dp"
android:animateLayoutChanges="true"
android:visibility="gone">
<LinearLayout
android:id="@+id/auditLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginHorizontal="16dp"
android:paddingBottom="8dp">
<TextView
style="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/audit" />
</LinearLayout>
<com.google.android.material.card.MaterialCardView
android:id="@+id/cardView"
style="@style/Widget.Material3.CardView.Elevated"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/auditLayout"
android:layout_marginHorizontal="16dp"
android:visibility="visible">
<RelativeLayout
android:id="@+id/openUserSpace"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginHorizontal="8dp"
android:layout_marginVertical="16dp"
android:orientation="vertical">
<ImageView
android:id="@+id/headIconView"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/image" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="8dp"
android:layout_toStartOf="@id/spaceView"
android:layout_toEndOf="@id/headIconView"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/userNameView"
style="@style/TextAppearance.Material3.BodyLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/name" />
<TextView
android:id="@+id/userInfoView"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/fans_information" />
</LinearLayout>
<ImageView
android:id="@+id/spaceView"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_margin="8dp"
android:src="@drawable/next" />
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
<LinearLayout
android:id="@+id/cardView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/cardView"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="16dp"
android:orientation="vertical"
android:visibility="visible">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iconView"
android:layout_width="90dp"
android:layout_height="90dp"
android:padding="8dp"
android:src="@drawable/image" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="8dp"
android:layout_toEndOf="@id/iconView"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/titleView"
style="@style/TextAppearance.Material3.TitleMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="标题" />
<TextView
android:id="@+id/numView"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="单位数" />
<TextView
android:id="@+id/updateTimeView"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="上次更新时间" />
</LinearLayout>
</RelativeLayout>
<com.kongzue.stacklabelview.StackLabel
android:id="@+id/belongStackLabelView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
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
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_marginTop="8dp" />
</com.google.android.material.card.MaterialCardView>
<TextView
android:id="@+id/modInfoView"
style="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="描述" />
<com.google.android.material.divider.MaterialDivider
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:dividerThickness="0.8dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/cardView2"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="16dp"
android:orientation="vertical"
android:visibility="visible">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/discussion"
style="@style/TextAppearance.Material3.HeadlineSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="@string/discussion" />
<Button
android:id="@+id/sendDiscussion"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:text="@string/send_discussion" />
</RelativeLayout>
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/commentLinearProgressIndicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:indeterminate="true" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/modCommentRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/button"
@ -305,8 +58,7 @@
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:text="@string/installation"
app:icon="@drawable/cloud_download"
android:visibility="gone" />
app:icon="@drawable/cloud_download" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:paddingHorizontal="16dp"
android:paddingTop="8dp">
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Elevated"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="24dp"
android:orientation="vertical">
<TextView
style="@style/TextAppearance.Material3.HeadlineSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/insert_coins" />
<com.google.android.material.button.MaterialButton
android:layout_width="match_parent"
android:enabled="true"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/insert_coins" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="已有5人投币。" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<TextView
style="@style/TextAppearance.Material3.HeadlineSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="投币记录" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />
</LinearLayout>

View File

@ -25,8 +25,10 @@
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:visibility="gone"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="8dp"
android:visibility="gone">
<androidx.recyclerview.widget.RecyclerView

View File

@ -34,9 +34,8 @@
android:id="@+id/mapList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="8dp"
android:layout_marginRight="16dp"
android:visibility="gone" />
</LinearLayout>

View File

@ -34,6 +34,8 @@
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:visibility="gone"
android:layout_marginTop="8dp"
android:layout_marginHorizontal="16dp"
android:layout_height="match_parent">

View File

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/swipeRefreshLayout"
android:paddingHorizontal="16dp"
android:paddingTop="8dp"
tools:context=".fragments.ModCommentsFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
style="@style/TextAppearance.Material3.HeadlineSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="@string/discussion" />
<Button
android:id="@+id/sendDiscussion"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:text="@string/send_discussion" />
</RelativeLayout>
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/linearProgressIndicator"
android:layout_width="match_parent"
android:layout_marginTop="8dp"
android:visibility="gone"
android:layout_height="wrap_content"
android:indeterminate="true" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="8dp" />
<LinearLayout
android:id="@+id/noContentLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<TextView
style="@style/TextAppearance.Material3.HeadlineSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no_content" />
</LinearLayout>
</LinearLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

View File

@ -7,7 +7,9 @@
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="8dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"

View File

@ -20,18 +20,17 @@
android:visibility="gone" />
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
android:id="@+id/swipeRefreshLayout">
android:layout_marginHorizontal="16dp"
android:layout_marginTop="8dp"
android:visibility="gone">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginTop="8dp"
android:layout_marginRight="16dp" />
android:layout_height="match_parent" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

View File

@ -6,8 +6,7 @@
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:gravity="center"
android:orientation="vertical"
android:paddingHorizontal="8dp">
android:orientation="vertical">
<ProgressBar
@ -28,14 +27,14 @@
android:id="@+id/nestedScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="8dp"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="8dp"
android:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Filled"
@ -45,7 +44,8 @@
<com.youth.banner.Banner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="200dp" />
android:layout_height="200dp"
app:banner_indicator_selected_color="?attr/colorPrimary" />
</com.google.android.material.card.MaterialCardView>

View File

@ -2,4 +2,5 @@
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:layout_marginHorizontal="16dp" />

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
style="@style/TextAppearance.Material3.TitleMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/user_group" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="24dp" />
</LinearLayout>

View File

@ -50,7 +50,7 @@
android:text="@string/name" />
<TextView
android:id="@+id/emailView"
android:id="@+id/coinView"
style="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@ -0,0 +1,217 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/loadLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tipView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
</LinearLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/contentLayout"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="60dp"
android:layout_marginHorizontal="16dp"
android:animateLayoutChanges="true"
android:orientation="vertical">
<TextView
android:id="@+id/hideTextView"
android:visibility="gone"
style="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/audit" />
<com.google.android.material.card.MaterialCardView
android:id="@+id/cardView"
style="@style/Widget.Material3.CardView.Elevated"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:visibility="gone">
<RelativeLayout
android:id="@+id/openUserSpace"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginHorizontal="8dp"
android:layout_marginVertical="16dp"
android:orientation="vertical">
<ImageView
android:id="@+id/headIconView"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/image" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="8dp"
android:layout_toStartOf="@id/spaceView"
android:layout_toEndOf="@id/headIconView"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/userNameView"
style="@style/TextAppearance.Material3.BodyLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/name" />
<TextView
android:id="@+id/userInfoView"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/fans_information" />
</LinearLayout>
<ImageView
android:id="@+id/spaceView"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_margin="8dp"
android:src="@drawable/next" />
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
<LinearLayout
android:id="@+id/cardView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="vertical"
android:visibility="visible">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iconView"
android:layout_width="90dp"
android:layout_height="90dp"
android:padding="8dp"
android:src="@drawable/image" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="8dp"
android:layout_toEndOf="@id/iconView"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/titleView"
style="@style/TextAppearance.Material3.TitleMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="标题" />
<TextView
android:id="@+id/numView"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="单位数" />
<TextView
android:id="@+id/updateTimeView"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="上次更新时间" />
</LinearLayout>
</RelativeLayout>
<com.google.android.material.chip.ChipGroup
android:id="@+id/chipGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="match_parent"
android:layout_marginTop="16dp"
android:layout_height="wrap_content">
<com.youth.banner.Banner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_marginTop="8dp" />
</com.google.android.material.card.MaterialCardView>
<TextView
android:id="@+id/modInfoView"
style="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="描述" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingVertical="16dp">
<ImageView
android:id="@+id/imageView"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_centerVertical="true"
android:src="@drawable/image" />
<TextView
android:id="@+id/titleView"
android:layout_marginStart="16dp"
style="@style/TextAppearance.Material3.TitleMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/imageView"
android:text="@string/title" />
</RelativeLayout>

View File

@ -55,10 +55,10 @@
android:title="@string/set_up" />
<!-- <item-->
<!-- android:id="@+id/donation"-->
<!-- android:icon="@drawable/donation"-->
<!-- android:title="@string/donation" />-->
<item
android:id="@+id/user_group"
android:icon="@drawable/ic_outline_free_breakfast_24"
android:title="@string/user_group" />
<item

View File

@ -8,25 +8,25 @@
android:id="@+id/community_item"
android:name="com.coldmint.rust.pro.fragments.CommunityFragment"
android:label="@string/community"
tools:layout="@layout/community_fragment" />
tools:layout="@layout/fragment_community" />
<fragment
android:id="@+id/mod_item"
android:name="com.coldmint.rust.pro.fragments.WarehouseFragment"
android:label="@string/warehouse"
tools:layout="@layout/mod_fragment" />
tools:layout="@layout/fragment_mod" />
<fragment
android:id="@+id/database_item"
android:name="com.coldmint.rust.pro.fragments.DatabaseFragment"
android:label="@string/menu_title3"
tools:layout="@layout/database_fragment" />
tools:layout="@layout/fragment_database" />
<fragment
android:id="@+id/template_item"
android:name="com.coldmint.rust.pro.fragments.TemplateFragment"
android:label="@string/template_title"
tools:layout="@layout/template_fragemnt" />
tools:layout="@layout/fragment_local_template" />
</navigation>

View File

@ -292,7 +292,9 @@
<string name="template_title">模板包</string>
<string name="template_list">模板列表</string>
<string name="close">关闭</string>
<string name="qq_group">qq群</string>
<string name="qq_group">qq频道</string>
<string name="details">详情</string>
<string name="insert_coins">投币</string>
<string name="del_completed">已删除\"%1$s\"。</string>
@ -348,7 +350,6 @@
<string name="update_num">已更新%1$s个记录。</string>
<string name="clean_up_code_cache_complete">代码缓存清理完成。</string>
<string name="clean">清空</string>
<string name="details">详情</string>
<string name="show_details">查看详情</string>
<string name="goto_line">跳转到错误位置</string>
<string name="code_navigation">代码导航</string>
@ -467,6 +468,7 @@
<string name="directory_does_not_exist">目录不存在。</string>
<string name="special_thanks_to">特别鸣谢</string>
<string name="email">邮箱</string>
<string name="coin_number">硬币:%1$d</string>
<string name="register_successed">注册成功</string>
<string name="registration_success_message">账号激活码已发送至您的邮箱。若没有收到,则邮箱可能被视为垃圾邮件了。请检查您的垃圾箱。</string>
<string name="please_login_first">请先登录。</string>
@ -910,6 +912,8 @@
<string name="all">全部</string>
<string name="new_password">新密码</string>
<string name="edit_text_color_dark">暗色主题字体颜色</string>
<string name="user_group">用户群</string>
<string name="discord_group">Discord服务器</string>
<!-- <string name="search_suggestions_null">无搜索建议。</string>-->
<!-- <string name="search_suggestions_number">共%1$d个搜索建议。</string>-->

View File

@ -13,6 +13,7 @@ data class DynamicItemDataBean(
val gender: Int,
val headIcon: String?,
val id: Int,
val location: String?,
val loginTime: String,
val permission: String,
val time: String,

View File

@ -11,6 +11,7 @@ data class WebModCommentData(
val headIcon: String?,
val id: Int,
val time: String,
val userName: String
val userName: String,
val location: String?
)
}

View File

@ -25,6 +25,8 @@ data class ActivationInfo(
val activation: Boolean,
@SerializedName("headIcon")
val headIcon: String?,
@SerializedName("coinNumber")
val coinNumber: Int,
@SerializedName("banTime")
val banTime: String?,
@SerializedName("email")