版本更新

This commit is contained in:
coldmint 2022-09-01 16:47:39 +08:00
parent 5c3d4f09c9
commit f9dee274b0
49 changed files with 937 additions and 200 deletions

Binary file not shown.

View File

@ -24,11 +24,11 @@ android {
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.coldmint.rust.beta"
applicationId "com.coldmint.rust.pro"
minSdkVersion 21
targetSdkVersion 32
versionCode 18
versionName "2.1 alpha1 (2022-8-25)"
versionCode 19
versionName "2.1 Beta1 (2022-9-1)"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@ -0,0 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.coldmint.rust.pro",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 19,
"versionName": "2.1 Beta1 (2022-9-1)",
"outputFile": "app-release.apk"
}
],
"elementType": "File"
}

View File

@ -65,14 +65,14 @@ class SearchActivity : BaseActivity<ActivitySearchBinding>() {
override fun onQueryTextChange(newText: String?): Boolean {
if (newText != null && newText.isNotBlank()) {
// viewBinding.searchSuggestionsView.setText(R.string.search_suggestions_loading)
viewBinding.searchSuggestionsView.setText(R.string.search_suggestions_loading)
Search.instance.suggestions(newText,
object : ApiCallBack<SearchSuggestionsData> {
override fun onResponse(t: SearchSuggestionsData) {
val dataList = t.data
if (dataList.isNullOrEmpty()) {
if (dataList.isEmpty()) {
viewBinding.recyclerView.isVisible = false
// viewBinding.searchSuggestionsView.setText(R.string.search_suggestions_null)
viewBinding.searchSuggestionsView.setText(R.string.search_suggestions_null)
} else {
val adapter =
SearchSuggestionsAdapter(
@ -92,20 +92,20 @@ class SearchActivity : BaseActivity<ActivitySearchBinding>() {
}
viewBinding.recyclerView.adapter = adapter
viewBinding.recyclerView.isVisible = true
// val s = String.format(getString(R.string.search_suggestions_number),dataList.size)
// viewBinding.searchSuggestionsView.text = s
val s = String.format(getString(R.string.search_suggestions_number),dataList.size)
viewBinding.searchSuggestionsView.text = s
}
}
override fun onFailure(e: Exception) {
viewBinding.recyclerView.isVisible = false
// viewBinding.searchSuggestionsView.setText(R.string.search_suggestions_null)
viewBinding.searchSuggestionsView.setText(R.string.search_suggestions_null)
}
})
} else {
// viewBinding.searchSuggestionsView.setText(R.string.search_suggestions_null)
viewBinding.searchSuggestionsView.setText(R.string.search_suggestions_null)
viewBinding.recyclerView.isVisible = false
}
return true

View File

@ -55,7 +55,7 @@ class UserHomePageActivity : BaseActivity<ActivityUserHomePageBinding>() {
private fun initView() {
// immersionBar {
// transparentStatusBar().statusBarDarkFont(true)
// .navigationBarColor(R.color.white_200).navigationBarDarkIcon(true)
// .navigationBarDarkIcon(true)
// }
val thisIntent = intent

View File

@ -7,6 +7,7 @@ import android.view.LayoutInflater
import android.view.View
import android.widget.Toast
import androidx.core.view.isVisible
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.checkbox.BooleanCallback
@ -67,6 +68,14 @@ class UserListActivity : BaseActivity<ActivityUserListBinding>() {
getString(R.string.fans)
}
}
viewBinding.recyclerView.layoutManager =
LinearLayoutManager(this@UserListActivity)
viewBinding.recyclerView.addItemDecoration(
DividerItemDecoration(
this,
DividerItemDecoration.VERTICAL
)
)
loadList(account, isFollowMode, canRemoveFans)
}
}
@ -90,8 +99,7 @@ class UserListActivity : BaseActivity<ActivityUserListBinding>() {
viewBinding.loadLayout.isVisible = false
viewBinding.recyclerView.isVisible = true
val adapter = UserAdapter(this@UserListActivity, dataList)
viewBinding.recyclerView.layoutManager =
LinearLayoutManager(this@UserListActivity)
adapter.setItemEvent { i, itemUserBinding, viewHolder, data ->
itemUserBinding.root.setOnClickListener {
val intent = Intent(

View File

@ -25,6 +25,7 @@ import com.afollestad.materialdialogs.input.getInputField
import com.afollestad.materialdialogs.input.input
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.coldmint.dialog.CoreDialog
import com.coldmint.rust.core.ModClass
import com.coldmint.rust.core.dataBean.ApiResponse
import com.coldmint.rust.core.dataBean.mod.WebModCommentData
@ -76,7 +77,7 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
val token by lazy {
AppSettings.getValue(AppSettings.Setting.Token, "")
}
lateinit var adapter :ModPageDetailsAdapter
lateinit var adapter: ModPageDetailsAdapter
private fun initView() {
setReturnButton()
@ -99,6 +100,9 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
viewBinding.button.text = getString(R.string.installated)
}
adapter = ModPageDetailsAdapter(this, modId)
adapter.modName.observe(this) {
title = it
}
viewBinding.viewPager2.adapter = adapter
TabLayoutMediator(viewBinding.tabLayout, viewBinding.viewPager2) { tab, i ->
tab.text = when (i) {
@ -116,16 +120,16 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
}
}
}.attach()
// viewBinding.button.setOnClickListener {
// val type = viewBinding.button.text
// val installation = getString(R.string.installation)
// when (type) {
// installation -> {
// downloadAction(t)
// }
// }
//
// }
viewBinding.button.setOnClickListener {
val type = viewBinding.button.text
val installation = getString(R.string.installation)
when (type) {
installation -> {
downloadAction(adapter.getLink())
}
}
}
// viewBinding.modCommentRecyclerView.layoutManager =
// LinearLayoutManager(this@WebModInfoActivity)
// viewBinding.modCommentRecyclerView.addItemDecoration(
@ -275,8 +279,11 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
* 下载事件
* @param t WebModInfoData
*/
fun downloadAction(t: WebModInfoData) {
val fileLink = ServerConfiguration.getRealLink(t.data.link)
fun downloadAction(link: String?) {
if (link == null) {
return
}
val fileLink = ServerConfiguration.getRealLink(link)
when (AppOperator.getNetworkType(this)) {
AppOperator.NetWorkType.NetWorkType_Moble -> {
val useMobileNetWork =
@ -284,19 +291,16 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
if (useMobileNetWork) {
downloadWork(fileLink)
} else {
MaterialDialog(this).show {
title(R.string.using_mobile_networks).message(R.string.using_mobile_networks_msg)
.positiveButton(R.string.only_one) {
downloadWork(fileLink)
}
negativeButton(R.string.always_allow) {
CoreDialog(this).setTitle(R.string.using_mobile_networks)
.setMessage(R.string.using_mobile_networks_msg)
.setPositiveButton(R.string.only_one) {
downloadWork(fileLink)
}.setNegativeButton(R.string.always_allow) {
AppSettings.setValue(AppSettings.Setting.UseMobileNetwork, true)
downloadWork(fileLink)
}
neutralButton(R.string.dialog_cancel) {
}.setNeutralButton(R.string.dialog_cancel) {
}
}
}.show()
}
}
AppOperator.NetWorkType.NetWorkType_Wifi -> {
@ -359,11 +363,6 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
val loadFileLayoutBinding = LoadFileLayoutBinding.inflate(layoutInflater)
loadFileLayoutBinding.LinearProgressIndicator.max = 100
var progress = 0
val materialDialog = MaterialDialog(this).show {
title(R.string.downlod).customView(view = loadFileLayoutBinding.root)
.cancelable(false)
.positiveButton(R.string.dialog_close)
}
val fileLoader = FileLoader.getInstantiate(fileLink, targetFile.absolutePath)
fileLoader.download(object : ProgressResponseBody.ResponseProgressListener {
@ -376,25 +375,15 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
progress = trueProgress.toFloat().toInt()
runOnUiThread {
val progressTip = String.format(tip, progress)
if (materialDialog.isShowing) {
loadFileLayoutBinding.LinearProgressIndicator.progress = progress
loadFileLayoutBinding.tipView.text = progressTip
}
viewBinding.button.text = progressTip
}
}
override fun downloadFail(exception: Exception?) {
if (materialDialog.isShowing) {
materialDialog.dismiss()
}
viewBinding.button.setText(R.string.installation)
}
override fun downloadSuccess() {
if (materialDialog.isShowing) {
materialDialog.dismiss()
}
viewBinding.button.isEnabled = false
viewBinding.button.setText(R.string.installated)
WebMod.instance.addDownloadNum(modId)

View File

@ -8,6 +8,7 @@ import android.view.View
import android.widget.PopupMenu
import android.widget.Toast
import androidx.core.view.isVisible
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import com.afollestad.materialdialogs.MaterialDialog
import com.coldmint.rust.core.dataBean.ApiResponse
@ -258,6 +259,12 @@ class WorkManagementActivity : BaseActivity<ActivityWorkmangementBinding>() {
title = getString(R.string.work_management)
setReturnButton()
viewBinding.recyclerView.layoutManager = LinearLayoutManager(this)
viewBinding.recyclerView.addItemDecoration(
DividerItemDecoration(
this,
DividerItemDecoration.VERTICAL
)
)
}
}

View File

@ -0,0 +1,52 @@
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.core.dataBean.mod.InsertCoinHistoryData
import com.coldmint.rust.core.web.ServerConfiguration
import com.coldmint.rust.pro.R
import com.coldmint.rust.pro.base.BaseAdapter
import com.coldmint.rust.pro.databinding.ItemInsertCoinsBinding
import com.coldmint.rust.pro.tool.GlobalMethod
/**
* 投币记录适配器
* @constructor
*/
class InsertCoinsAdapter(context: Context, dataList: MutableList<InsertCoinHistoryData.Data>) :
BaseAdapter<ItemInsertCoinsBinding, InsertCoinHistoryData.Data>(context, dataList) {
private val insertCoinsTip by lazy {
context.getString(R.string.insert_coins_tip)
}
override fun getViewBindingObject(
layoutInflater: LayoutInflater,
parent: ViewGroup,
viewType: Int
): ItemInsertCoinsBinding {
return ItemInsertCoinsBinding.inflate(layoutInflater, parent, false)
}
override fun onBingView(
data: InsertCoinHistoryData.Data,
viewBinding: ItemInsertCoinsBinding,
viewHolder: ViewHolder<ItemInsertCoinsBinding>,
position: Int
) {
val icon = data.headIcon
if (icon == null) {
Glide.with(context).load(R.drawable.head_icon).into(viewBinding.imageView)
} else {
Glide.with(context).load(ServerConfiguration.getRealLink(icon))
.apply(GlobalMethod.getRequestOptions(true)).into(viewBinding.imageView)
}
viewBinding.numberOfCoinView.text = String.format(insertCoinsTip, data.number)
viewBinding.timeView.text = data.time
viewBinding.nameView.text = data.userName
}
}

View File

@ -2,7 +2,9 @@ package com.coldmint.rust.pro.adapters
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.MutableLiveData
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.coldmint.rust.core.dataBean.mod.WebModInfoData
import com.coldmint.rust.core.tool.DebugHelper
import com.coldmint.rust.pro.fragments.InsertCoinsFragment
import com.coldmint.rust.pro.fragments.ModCommentsFragment
@ -21,6 +23,24 @@ class ModPageDetailsAdapter(fragmentActivity: FragmentActivity, val modId: Strin
return 3
}
val modName: MutableLiveData<String> by lazy {
MutableLiveData()
}
/**
* 获取下载链接
* @return String?
*/
fun getLink(): String? {
return if (this::webModDetailsFragment.isInitialized) {
webModDetailsFragment.getLink()
} else {
DebugHelper.printLog("获取下载路径", "详情碎片未初始化返回null", isError = true)
null
}
}
/**
* 获取此模组是否对外开放
* @return Boolean
@ -38,7 +58,7 @@ class ModPageDetailsAdapter(fragmentActivity: FragmentActivity, val modId: Strin
return when (position) {
0 -> {
if (!this::webModDetailsFragment.isInitialized) {
webModDetailsFragment = WebModDetailsFragment(modId)
webModDetailsFragment = WebModDetailsFragment(modId, modName)
}
webModDetailsFragment
}

View File

@ -28,9 +28,7 @@ import com.coldmint.rust.pro.tool.AppSettings
* @date 2021/12/28 10:23
*/
class FollowFragment : BaseFragment<FragmentFollowBinding>() {
val selfAccount by lazy {
AppSettings.getValue(AppSettings.Setting.Account, "")
}
var oldSize: Int = 0
var lastIndex = 0
@ -38,6 +36,7 @@ class FollowFragment : BaseFragment<FragmentFollowBinding>() {
* 加载视图如果需要更新的话
*/
fun loadViewIfNeed() {
val selfAccount = AppSettings.getValue(AppSettings.Setting.Account, "")
if (selfAccount.isBlank()) {
showTip(R.string.please_login_first)
} else {
@ -166,6 +165,7 @@ class FollowFragment : BaseFragment<FragmentFollowBinding>() {
*/
fun loadDynamic(account: String) {
if (account.isBlank()) {
val selfAccount = AppSettings.getValue(AppSettings.Setting.Account, "")
Dynamic.instance.getFollowAllDynamic(selfAccount,
object : ApiCallBack<DynamicItemDataBean> {
override fun onResponse(t: DynamicItemDataBean) {

View File

@ -0,0 +1,71 @@
package com.coldmint.rust.pro.fragments
import android.content.Context
import android.view.LayoutInflater
import com.coldmint.dialog.BaseAppDialog
import com.coldmint.rust.core.dataBean.ApiResponse
import com.coldmint.rust.core.interfaces.ApiCallBack
import com.coldmint.rust.core.interfaces.FileFinderListener
import com.coldmint.rust.core.web.ServerConfiguration
import com.coldmint.rust.core.web.WebMod
import com.coldmint.rust.pro.databinding.DialogInsertCoinsBottomBinding
import com.coldmint.rust.pro.tool.AppSettings
/**
* 投币对话框
* @property viewBinding [@androidx.annotation.NonNull] DialogInsertCoinsBottomBinding
* @constructor
*/
class InsertCoinsDialog(context: Context, val modId: String) :
BaseAppDialog<InsertCoinsDialog>(context) {
private val token by lazy {
AppSettings.getValue(AppSettings.Setting.Token, "")
}
private val viewBinding by lazy {
DialogInsertCoinsBottomBinding.inflate(LayoutInflater.from(context))
}
private var callBackLister: ((Boolean) -> Unit)? = null
/**
* 设置回调
* Boolean是否成功
* @param listener Function1<Boolean, Unit>?
*/
fun setCallBackListener(listener: ((Boolean) -> Unit)?): InsertCoinsDialog {
callBackLister = listener
return this
}
init {
setView(viewBinding.root)
viewBinding.positiveButton.setOnClickListener {
val number = viewBinding.slider.value.toInt()
WebMod.instance.insertCoins(token, modId, number, object : ApiCallBack<ApiResponse> {
override fun onResponse(t: ApiResponse) {
if (t.code == ServerConfiguration.Success_Code) {
dismiss()
callBackLister?.invoke(true)
} else {
viewBinding.textview.text = t.message
callBackLister?.invoke(false)
}
}
override fun onFailure(e: Exception) {
e.printStackTrace()
dismiss()
callBackLister?.invoke(false)
}
})
}
viewBinding.negativeButton.setOnClickListener {
dismiss()
}
}
}

View File

@ -4,16 +4,65 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import com.coldmint.dialog.CoreDialog
import com.coldmint.dialog.InputDialog
import com.coldmint.rust.core.dataBean.mod.CoinStatusData
import com.coldmint.rust.core.dataBean.mod.InsertCoinHistoryData
import com.coldmint.rust.core.interfaces.ApiCallBack
import com.coldmint.rust.core.web.WebMod
import com.coldmint.rust.pro.R
import com.coldmint.rust.pro.adapters.InsertCoinsAdapter
import com.coldmint.rust.pro.base.BaseFragment
import com.coldmint.rust.pro.databinding.FragmentInsertCoinsBinding
import com.coldmint.rust.pro.tool.AppSettings
/**
* 投币碎片
*/
class InsertCoinsFragment(val modId: String) : BaseFragment<FragmentInsertCoinsBinding>() {
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
private val token by lazy {
AppSettings.getValue(AppSettings.Setting.Token, "")
}
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
viewBinding.recyclerView.layoutManager = LinearLayoutManager(requireContext())
viewBinding.recyclerView.addItemDecoration(
DividerItemDecoration(
requireContext(),
DividerItemDecoration.VERTICAL
)
)
viewBinding.swipeRefreshLayout.setOnRefreshListener {
loadList(false)
viewBinding.swipeRefreshLayout.isRefreshing = false
}
viewBinding.button.setOnClickListener {
InsertCoinsDialog(requireContext(), modId).setCallBackListener {
if (it) {
viewBinding.button.isEnabled = false
viewBinding.tipView.text = getString(R.string.insert_coins_ok)
loadList()
}
}.show()
// InputDialog(requireContext()).setTitle(R.string.insert_coins)
// .setMessage(R.string.insert_coins_num_tip)
// .setPositiveButton(R.string.dialog_ok) { it ->
// WebMod.instance.insertCoins(token, modId)
// false
// }.setNegativeButton(R.string.dialog_cancel) {
//
// }.show()
}
loadButton()
}
override fun onResume() {
super.onResume()
loadList()
}
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentInsertCoinsBinding {
@ -21,4 +70,65 @@ class InsertCoinsFragment(val modId: String) : BaseFragment<FragmentInsertCoinsB
}
fun loadList(useLinearProgressIndicator: Boolean = true) {
if (useLinearProgressIndicator) {
viewBinding.linearProgressIndicator.isVisible = true
}
WebMod.instance.getInsertCoinHistory(modId, object : ApiCallBack<InsertCoinHistoryData> {
override fun onResponse(t: InsertCoinHistoryData) {
val dataList = t.data
if (dataList.isNullOrEmpty()) {
viewBinding.recyclerView.isVisible = false
if (useLinearProgressIndicator) {
viewBinding.linearProgressIndicator.isVisible = false
}
viewBinding.loadLayout.isVisible = true
viewBinding.coinRecordsView.text = getString(R.string.coin_records)
} else {
viewBinding.recyclerView.adapter =
InsertCoinsAdapter(requireContext(), dataList)
val data = getString(R.string.coin_records) + "(" + dataList.size + ")"
viewBinding.coinRecordsView.text = data
viewBinding.recyclerView.isVisible = true
if (useLinearProgressIndicator) {
viewBinding.linearProgressIndicator.isVisible = false
}
viewBinding.loadLayout.isVisible = false
}
}
override fun onFailure(e: Exception) {
e.printStackTrace()
viewBinding.recyclerView.isVisible = false
viewBinding.coinRecordsView.text = getString(R.string.coin_records)
if (useLinearProgressIndicator) {
viewBinding.linearProgressIndicator.isVisible = false
}
viewBinding.loadLayout.isVisible = true
}
})
}
fun loadButton() {
WebMod.instance.getCoinStatus(token, modId, object : ApiCallBack<CoinStatusData> {
override fun onResponse(t: CoinStatusData) {
viewBinding.button.isEnabled = !t.data
if (t.data) {
viewBinding.tipView.text = getString(R.string.insert_coins_ok)
} else {
viewBinding.tipView.text = getString(R.string.insert_coins_no)
}
}
override fun onFailure(e: Exception) {
e.printStackTrace()
viewBinding.button.isEnabled = false
viewBinding.tipView.text = getString(R.string.insert_coins_no)
}
})
}
}

View File

@ -1,5 +1,6 @@
package com.coldmint.rust.pro.fragments
import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
@ -17,6 +18,7 @@ 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.UserHomePageActivity
import com.coldmint.rust.pro.adapters.CommentAdapter
import com.coldmint.rust.pro.base.BaseFragment
import com.coldmint.rust.pro.databinding.FragmentModCommentsBinding
@ -80,6 +82,21 @@ class ModCommentsFragment(val modId: String) : BaseFragment<FragmentModCommentsB
}
}
/**
* 打开用户主页
* @param userId String
*/
fun gotoUserPage(userId: String) {
val intent = Intent(
requireContext(),
UserHomePageActivity::class.java
)
intent.putExtra("userId", userId)
startActivity(
intent
)
}
override fun onResume() {
super.onResume()
loadCommentList(modId)
@ -102,16 +119,25 @@ class ModCommentsFragment(val modId: String) : BaseFragment<FragmentModCommentsB
if (useLinearProgressIndicator) {
viewBinding.linearProgressIndicator.isVisible = false
}
viewBinding.titleView.text = getString(R.string.discussion)
viewBinding.recyclerView.isVisible = false
viewBinding.noContentLayout.isVisible = true
} else {
DebugHelper.printLog(key, "${list.size}条数据")
viewBinding.titleView.text =
getString(R.string.discussion) + "(" + list.size + ")"
if (useLinearProgressIndicator) {
viewBinding.linearProgressIndicator.isVisible = false
}
viewBinding.recyclerView.isVisible = true
viewBinding.noContentLayout.isVisible = false
viewBinding.recyclerView.adapter = CommentAdapter(requireContext(), list)
val adapter = CommentAdapter(requireContext(), list)
adapter.setItemEvent { i, itemCommentBinding, viewHolder, data ->
itemCommentBinding.iconView.setOnClickListener {
gotoUserPage(data.account)
}
}
viewBinding.recyclerView.adapter = adapter
}
}
@ -120,6 +146,7 @@ class ModCommentsFragment(val modId: String) : BaseFragment<FragmentModCommentsB
if (useLinearProgressIndicator) {
viewBinding.linearProgressIndicator.isVisible = false
}
viewBinding.titleView.text = getString(R.string.discussion)
viewBinding.recyclerView.isVisible = false
viewBinding.noContentLayout.isVisible = true
}

View File

@ -4,6 +4,7 @@ import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import androidx.core.view.isVisible
import androidx.lifecycle.MutableLiveData
import com.bumptech.glide.Glide
import com.coldmint.rust.core.dataBean.mod.WebModInfoData
import com.coldmint.rust.core.dataBean.user.SpaceInfoData
@ -28,12 +29,22 @@ import com.youth.banner.indicator.CircleIndicator
/**
* 模组详情碎片
*/
class WebModDetailsFragment(val modId: String) : BaseFragment<FragmentWebModDetailsBinding>() {
var developer: String? = null
class WebModDetailsFragment(val modId: String,val modNameLiveData: MutableLiveData<String>) : BaseFragment<FragmentWebModDetailsBinding>() {
private var developer: String? = null
//此模组是否对外开放
private var isOpen = false
private var link: String? = null
fun getLink(): String? {
return link
}
/**
* 获取此模组是否对外开放
* @return Boolean
@ -115,7 +126,9 @@ class WebModDetailsFragment(val modId: String) : BaseFragment<FragmentWebModDeta
override fun onResponse(t: WebModInfoData) {
if (t.code == ServerConfiguration.Success_Code) {
developer = t.data.developer
modNameLiveData.value = t.data.name
isOpen = t.data.hidden == 0
link = t.data.link
viewBinding.loadLayout.isVisible = false
viewBinding.contentLayout.isVisible = true
val icon = t.data.icon

View File

@ -28,6 +28,7 @@
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<LinearLayout
android:layout_marginBottom="120dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

View File

@ -10,12 +10,12 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/rootLayout"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
@ -68,7 +68,6 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="false"
app:elevation="2dp"
app:menu="@menu/menu_drawer_left" />

View File

@ -53,13 +53,13 @@
android:queryBackground="@null"
android:queryHint="@string/search" />
<!-- <TextView-->
<!-- android:id="@+id/searchSuggestionsView"-->
<!-- style="@style/TextAppearance.Material3.BodySmall"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="8dp"-->
<!-- android:text="@string/search_suggestions_null" />-->
<TextView
android:id="@+id/searchSuggestionsView"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/search_suggestions_null" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"

View File

@ -16,6 +16,7 @@
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:contentScrim="?android:windowBackground"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
app:titleCollapseMode="scale"

View File

@ -0,0 +1,63 @@
<?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"
android:orientation="vertical">
<TextView
style="@style/TextAppearance.Material3.HeadlineMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="24dp"
android:text="@string/insert_coins" />
<TextView
android:id="@+id/textview"
android:layout_marginTop="24dp"
style="@style/TextAppearance.Material3.BodyMedium"
android:layout_marginHorizontal="24dp"
android:text="@string/drag_the_slider_to_set_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<com.google.android.material.slider.Slider
android:id="@+id/slider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="16dp"
android:stepSize="1.0"
android:valueFrom="1.0"
android:valueTo="5.0" />
<RelativeLayout
android:layout_marginBottom="24dp"
android:layout_marginHorizontal="24dp"
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>

View File

@ -13,6 +13,7 @@
<TextView
android:id="@+id/textview"
style="@style/TextAppearance.Material3.HeadlineSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"

View File

@ -1,62 +1,97 @@
<?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"
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:id="@+id/swipeRefreshLayout"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingHorizontal="16dp"
android:paddingTop="8dp">
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Elevated"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Elevated"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
<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:id="@+id/button"
style="@style/Widget.Material3.Button.OutlinedButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:enabled="true"
android:text="@string/insert_coins" />
<TextView
android:id="@+id/tipView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/insert_coins_no" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<TextView
android:id="@+id/coinRecordsView"
style="@style/TextAppearance.Material3.HeadlineSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/coin_records" />
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/linearProgressIndicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="24dp"
android:orientation="vertical">
android:visibility="gone"
android:indeterminate="true"
android:layout_marginTop="8dp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />
<LinearLayout
android:id="@+id/loadLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<TextView
style="@style/TextAppearance.Material3.HeadlineSmall"
android:text="@string/no_content"
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人投币。" />
android:layout_height="wrap_content"/>
</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>
</LinearLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

View File

@ -20,6 +20,7 @@
android:layout_height="wrap_content">
<TextView
android:id="@+id/titleView"
style="@style/TextAppearance.Material3.HeadlineSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@ -1,5 +1,6 @@
<?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"
android:orientation="vertical">
@ -29,27 +30,27 @@
<androidx.core.widget.NestedScrollView
android:id="@+id/contentLayout"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="60dp"
android:layout_marginHorizontal="16dp"
android:layout_marginBottom="60dp"
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" />
android:text="@string/audit"
android:visibility="gone" />
<com.google.android.material.card.MaterialCardView
@ -68,12 +69,14 @@
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"
@ -127,20 +130,26 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.card.MaterialCardView
android:id="@+id/iconCardView"
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="wrap_content"
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" />
<ImageView
android:id="@+id/iconView"
android:layout_width="90dp"
android:layout_height="90dp"
android:scaleType="centerCrop"
android:src="@drawable/image" />
</com.google.android.material.card.MaterialCardView>
<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:layout_toEndOf="@id/iconCardView"
android:gravity="center_vertical"
android:orientation="vertical">
@ -176,23 +185,29 @@
</RelativeLayout>
<com.google.android.material.chip.ChipGroup
android:id="@+id/chipGroup"
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />
android:layout_height="wrap_content">
<com.google.android.material.chip.ChipGroup
android:id="@+id/chipGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:singleLine="true" />
</HorizontalScrollView>
<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">
android:layout_height="wrap_content"
android:layout_marginTop="16dp">
<com.youth.banner.Banner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_marginTop="8dp" />
android:layout_height="180dp" />
</com.google.android.material.card.MaterialCardView>

View File

@ -13,12 +13,12 @@
android:layout_margin="16dp">
<ImageView
android:layout_centerVertical="true"
android:id="@+id/mod_icon"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_centerVertical="true"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
@ -49,8 +49,9 @@
android:text="@string/publisher_information" />
<TextView
style="@style/TextAppearance.Material3.BodySmall"
android:singleLine="true"
android:id="@+id/mod_introduction_view"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
@ -66,6 +67,7 @@
android:orientation="horizontal">
<Button
android:layout_marginRight="8dp"
style="@style/Widget.Material3.Button.OutlinedButton"
android:id="@+id/refusedView"
android:layout_width="0dp"
@ -75,6 +77,7 @@
android:text="@string/refused" />
<Button
android:layout_marginLeft="8dp"
android:id="@+id/consentView"
android:layout_width="0dp"
android:layout_height="wrap_content"

View File

@ -12,17 +12,17 @@
<ImageView
android:id="@+id/headIconView"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/head_icon" />
<LinearLayout
android:id="@+id/contentLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@id/headIconView"
android:layout_alignBottom="@id/headIconView"
android:layout_marginLeft="8dp"
android:layout_toRightOf="@id/headIconView"
android:layout_marginStart="8dp"
android:layout_toEndOf="@id/headIconView"
android:gravity="center_vertical"
android:orientation="vertical">
@ -31,7 +31,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/user_name"
android:textSize="16sp" />
style="@style/TextAppearance.Material3.TitleMedium"/>
<TextView
android:id="@+id/timeView"
@ -39,26 +39,19 @@
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/time"
android:textSize="10sp" />
style="@style/TextAppearance.Material3.BodySmall"
/>
</LinearLayout>
<TextView
android:id="@+id/textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/headIconView"
android:layout_marginTop="8dp"
android:layout_below="@id/contentLayout"
android:layout_marginTop="16dp"
style="@style/TextAppearance.Material3.BodyMedium"
android:text="@string/expiration_time_null" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/textview"
android:layout_alignParentRight="true"
android:layout_marginTop="8dp"
android:text="@string/dialog_ok"
android:textColor="?attr/colorPrimary"
android:visibility="gone" />
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>

View File

@ -0,0 +1,47 @@
<?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">
<ImageView
android:id="@+id/imageView"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerVertical="true"
android:src="@drawable/head_icon" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/imageView"
android:orientation="vertical"
android:padding="8dp">
<TextView
android:id="@+id/nameView"
style="@style/TextAppearance.Material3.TitleMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="名称" />
<TextView
android:id="@+id/numberOfCoinView"
style="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/insert_coins_tip" />
<TextView
android:id="@+id/timeView"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="时间" />
</LinearLayout>
</RelativeLayout>

View File

@ -18,7 +18,7 @@
android:id="@+id/titleView"
android:singleLine="true"
android:ellipsize="end"
style="@style/TextAppearance.Material3.BodyMedium"
style="@style/TextAppearance.Material3.TitleMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"

View File

@ -1,26 +1,38 @@
<?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:layout_height="wrap_content"
android:padding="8dp">
<ImageView
android:id="@+id/mod_icon"
android:layout_width="60dp"
android:layout_height="60dp"
<com.google.android.material.card.MaterialCardView
android:id="@+id/modIconCard"
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:src="@drawable/image" />
android:layout_marginBottom="8dp">
<ImageView
android:id="@+id/mod_icon"
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@drawable/image" />
</com.google.android.material.card.MaterialCardView>
<LinearLayout
android:layout_marginLeft="8dp"
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toStartOf="@id/more"
android:layout_toEndOf="@id/mod_icon"
android:layout_toEndOf="@id/modIconCard"
android:gravity="center_vertical"
android:orientation="vertical">
@ -36,8 +48,10 @@
android:id="@+id/mod_introduction_view"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="26dp"
android:layout_marginTop="8dp"
android:ellipsize="end"
android:singleLine="true"
android:text="介绍" />
</LinearLayout>
@ -54,7 +68,7 @@
android:id="@+id/more"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:padding="12dp"
android:src="@drawable/more" />

View File

@ -35,6 +35,8 @@
android:text="模组名称" />
<TextView
android:singleLine="true"
android:ellipsize="end"
android:id="@+id/mod_introduction_view"
style="@style/TextAppearance.Material3.TitleSmall"
android:layout_width="wrap_content"

View File

@ -95,7 +95,6 @@
<string name="enter_file_path">Please enter a file path.</string>
<string name="create_bookmark">Create bookmarks</string>
<string name="name_error">Please enter a mod name.</string>
<string name="unit_name_error">Please enter a unit name.</string>
<string name="action_name_error">Please enter an event name.</string>
<string name="database_null">This dataset could not be loaded, error: %1$s.</string>
<string name="describe_error">Please enter a description.</string>
@ -114,7 +113,6 @@
<string name="mod_action1">Editing unit</string>
<string name="mod_action2">Edit information</string>
<string name="mod_action8">decompress</string>
<string name="mod_action9">Double naming</string>
<string name="mod_action10">Repair information file</string>
<string name="open_action1">Edit text</string>
@ -426,7 +424,6 @@
<string name="pack_directory">Package directory</string>
<string name="info">information</string>
<string name="cut_board_operation">Shear-plate operation</string>
<string name="bookmarks_operation">Bookmarks operation</string>
<string name="bookmark_manager">Bookmark Manager</string>
<string name="jump_a_bookmark">Jump a bookmark</string>
<string name="remove_bookmark">Remove the bookmark</string>
@ -606,11 +603,6 @@
<string name="mod_package">Mod package</string>
<string name="restart_to_take_effect">I found that you have changed the image. Due to Glide cache mechanism, the assistant needs to restart to display the new image. Sorry for the inconvenience.</string>
<string name="extension">extension</string>
<string name="use_adm">Adm Multithreaded download</string>
<string name="use_adm_tip">Allows you to call the Adm downloader for multithreaded downloads.</string>
<string name="setting_use_adm">useAdm</string>
<string name="no_adm_installed">Install Adm first.</string>
<string name="from_adm">Adm Download Directory</string>
<string name="word_wrap">Word wrap</string>
<string name="database_error">The length of json result set is 0</string>
<string name="mod_icon_transition">ModIconTransition</string>

View File

@ -94,7 +94,6 @@
<string name="enter_file_path">ファイルパスを入力してください。</string>
<string name="create_bookmark">しおりを作る</string>
<string name="name_error">モジュール名を入力してください。</string>
<string name="unit_name_error">ユニット名を入力してください。</string>
<string name="action_name_error">キャンペーン名を入力してください。</string>
<string name="database_null">このデータセットはロードできません、エラー原因:%1$s。</string>
<string name="describe_error">記述を入力してください。</string>
@ -113,7 +112,6 @@
<string name="mod_action1">編集単位</string>
<string name="mod_action2">情報を編集する</string>
<string name="mod_action8">だしぬけ</string>
<string name="mod_action9">命名を改める</string>
<string name="mod_action10">リペア情報ファイル</string>
<string name="open_action1">テキストを編集する</string>
@ -425,7 +423,6 @@
<string name="pack_directory">カタログを梱包する</string>
<string name="info">情報</string>
<string name="cut_board_operation">せん断板操作</string>
<string name="bookmarks_operation">しおり操作</string>
<string name="bookmark_manager">ブックマークマネージャ</string>
<string name="jump_a_bookmark">飛びしおり</string>
<string name="remove_bookmark">しおりを取り除く</string>
@ -605,11 +602,6 @@
<string name="mod_package">モジュールパック</string>
<string name="restart_to_take_effect">画像が変更されたことを確認すると、ヘルパーはGlideキャッシュ機構のために新しい画像を表示するために再起動する必要があります。ご不便をおかけして申し訳ありません。</string>
<string name="extension">広げて</string>
<string name="use_adm">Admマルチスレッドダウンロード</string>
<string name="use_adm_tip">Admダウンローダを呼び出し、マルチスレッドダウンロードを可能にする。</string>
<string name="setting_use_adm">使用アドム</string>
<string name="no_adm_installed">Admをインストールしてください。</string>
<string name="from_adm">Admダウンロードディレクトリ</string>
<string name="word_wrap">自動改行</string>
<string name="database_error">json結果のセット長さは0である。</string>
<string name="mod_icon_transition">ModIconTransition</string>

View File

@ -94,7 +94,6 @@
<string name="enter_file_path">Введите, пожалуйста, маршрут файла.</string>
<string name="create_bookmark">Создавать закладку</string>
<string name="name_error">Пожалуйста, введите имя модуля.</string>
<string name="unit_name_error">Введите имя единицы.</string>
<string name="action_name_error">Введите имя мероприятия.</string>
<string name="database_null">Этот набор данных не может быть загружен по ложной причине :% $.</string>
<string name="describe_error">Введите описание, пожалуйста.</string>
@ -113,7 +112,6 @@
<string name="mod_action1">Монтажная единица</string>
<string name="mod_action2">Редактирование.</string>
<string name="mod_action8">декомпресс</string>
<string name="mod_action9">Переименовать.</string>
<string name="mod_action10">Восстанавливать файл информации</string>
<string name="open_action1">Редактировать текст</string>
@ -425,7 +423,6 @@
<string name="pack_directory">Паковать каталог</string>
<string name="info">информац</string>
<string name="cut_board_operation">Операция по монтажу</string>
<string name="bookmarks_operation">Операция закладка</string>
<string name="bookmark_manager">Менеджер закладок</string>
<string name="jump_a_bookmark">закладка</string>
<string name="remove_bookmark">Убрать закладку</string>
@ -605,11 +602,6 @@
<string name="mod_package">Набор Мод</string>
<string name="restart_to_take_effect">Проверка показала, что вы заменили изображение, и поскольку Glide кэш механизм, ассистенту нужна перезагрузка, чтобы показать новое. Простите за неудобства.</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="database_error">Набор результатов json имеет длину 0</string>
<string name="mod_icon_transition">Модикон-переходный период</string>

View File

@ -28,7 +28,6 @@
<string name="dialog_ok">確定</string>
<string name="dialog_cancel">取消</string>
<string name="search">搜索</string>
<string name="unit_name_error">請輸入單位名稱。</string>
<string name="loading_units">加載單位...</string>
<string name="symbol9">整理代碼</string>
<string name="edit_function">保存</string>

View File

@ -36,6 +36,7 @@
<string name="pay_yes">是的,确实收到了</string>
<string name="pay_no">不,没有</string>
<string name="creation_assistant">创建助理</string>
<string name="drag_the_slider_to_set_num">拖动滑块选择数量。</string>
<string name="dialog_cancel">取消</string>
<string name="no_longer_prompt">不再提示</string>
<string name="navigation_tip">共%1$d个项目支持快速导航。</string>
@ -469,6 +470,11 @@
<string name="special_thanks_to">特别鸣谢</string>
<string name="email">邮箱</string>
<string name="coin_number">硬币:%1$d</string>
<string name="insert_coins_tip">投了%1$d个硬币。</string>
<string name="insert_coins_num_tip">要投几个硬币呢?</string>
<string name="coin_records">投币记录</string>
<string name="insert_coins_no">支持一下喜欢的作品吧。</string>
<string name="insert_coins_ok">已收到您的支持了。</string>
<string name="register_successed">注册成功</string>
<string name="registration_success_message">账号激活码已发送至您的邮箱。若没有收到,则邮箱可能被视为垃圾邮件了。请检查您的垃圾箱。</string>
<string name="please_login_first">请先登录。</string>
@ -914,7 +920,8 @@
<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>-->
<string name="search_suggestions_null">无搜索建议。</string>
<string name="search_suggestions_loading">获取搜索建议...</string>
<string name="search_suggestions_number">共%1$d个搜索建议。</string>
</resources>

View File

@ -22,7 +22,8 @@ class CodeTranslate(val context: Context) {
companion object {
const val split = "\n ,:()=%{}+*/\r"
const val debugKey = "代码翻译器"
private var debugKey = "代码翻译器"
private var num = 0
/**
@ -120,9 +121,21 @@ class CodeTranslate(val context: Context) {
fun start(input: String, func: (String) -> Unit) {
val handler = Handler(Looper.getMainLooper())
val scope = CoroutineScope(Job())
num++
debugKey = "代码翻译器-任务${num}"
DebugHelper.printLog(
CodeTranslate.debugKey,
"开始执行(英文模式${englishMode} 翻译模式${translateMode})...",
"代码翻译", isError = true
)
scope.launch {
if (englishMode) {
//如果是英文模式,无论是翻译还是编译都返回其本身。
DebugHelper.printLog(
CodeTranslate.debugKey,
"是英文模式返回其本身。",
"代码翻译", isError = true
)
handler.post {
func.invoke(input)
}
@ -260,7 +273,12 @@ class CodeTranslate(val context: Context) {
codeResult.append("]")
}
} else {
val codeInfo = codeDataBase.getCodeDao().findCodeByCode(code)
//翻译代码
val codeInfo = if (translateMode){
codeDataBase.getCodeDao().findCodeByCode(code)
}else{
codeDataBase.getCodeDao().findCodeByTranslate(code)
}
if (codeInfo == null) {
if (code.contains("_")) {
val lineParser = LineParser(code)
@ -307,7 +325,12 @@ class CodeTranslate(val context: Context) {
CodeBlockType.Reference
}
}
codeResult.append(codeInfo.translate)
if (translateMode)
{
codeResult.append(codeInfo.translate)
}else{
codeResult.append(codeInfo.code)
}
}
}
}

View File

@ -0,0 +1,20 @@
package com.coldmint.rust.core.dataBean.mod
import com.google.gson.annotations.SerializedName
/**
* 投币状态
* @property code Int
* @property `data` Boolean
* @property message String
* @constructor
*/
data class CoinStatusData(
@SerializedName("code")
val code: Int,
@SerializedName("data")
val `data`: Boolean = true,
@SerializedName("message")
val message: String
)

View File

@ -0,0 +1,26 @@
package com.coldmint.rust.core.dataBean.mod
import com.google.gson.annotations.SerializedName
data class InsertCoinHistoryData(
@SerializedName("code")
val code: Int,
@SerializedName("data")
val `data`: MutableList<Data>,
@SerializedName("message")
val message: String
) {
data class Data(
@SerializedName("account")
val account: String,
@SerializedName("headIcon")
val headIcon: String?,
@SerializedName("number")
val number: Int,
@SerializedName("time")
val time: String,
@SerializedName("userName")
val userName: String
)
}

View File

@ -2,6 +2,7 @@ package com.coldmint.rust.core.web
import android.os.Handler
import android.os.Looper
import android.util.Log
import com.coldmint.rust.core.dataBean.HotSearchData
import com.coldmint.rust.core.dataBean.SearchSuggestionsData
import com.coldmint.rust.core.dataBean.user.SearchResultDataBean
@ -86,6 +87,7 @@ class Search private constructor() {
override fun onResponse(call: Call, response: Response) {
try {
val data = response.body!!.string()
Log.d("搜索结果",data)
val finalSearchSuggestionsData =
gson.fromJson(data, SearchSuggestionsData::class.java)
handler.post {

View File

@ -39,6 +39,164 @@ class WebMod private constructor() {
}
/**
* 获取投币状态
* @param token String
* @param modId String
* @param apiCallBack ApiCallBack<CoinStatusData>
*/
fun getCoinStatus(token: String, modId: String, apiCallBack: ApiCallBack<CoinStatusData>) {
val okHttpClient = ServerConfiguration.initOkHttpClient()
val requestBodyBuilder: FormBody.Builder =
FormBody.Builder().add("token", token).add("modId", modId)
val requestBody = requestBodyBuilder.build()
val request =
Request.Builder()
.url(ServerConfiguration.website + "php/mod.php?action=getCoinStatus")
.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 body = response.body
if (body == null) {
handler.post {
apiCallBack.onFailure(NullPointerException())
}
} else {
val data = body.string()
val finalCoinStatusData =
gson.fromJson(data, CoinStatusData::class.java)
handler.post {
apiCallBack.onResponse(finalCoinStatusData)
}
}
} catch (e: Exception) {
e.printStackTrace()
handler.post {
apiCallBack.onFailure(e)
}
}
}
})
}
/**
* 获取投币历史
* @param token String
* @param modId String
* @param apiCallBack ApiCallBack<CoinStatusData>
*/
fun getInsertCoinHistory(modId: String, apiCallBack: ApiCallBack<InsertCoinHistoryData>) {
val okHttpClient = ServerConfiguration.initOkHttpClient()
val requestBodyBuilder: FormBody.Builder =
FormBody.Builder().add("modId", modId)
val requestBody = requestBodyBuilder.build()
val request =
Request.Builder()
.url(ServerConfiguration.website + "php/mod.php?action=getInsertCoinHistory")
.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 body = response.body
if (body == null) {
handler.post {
apiCallBack.onFailure(NullPointerException())
}
} else {
val data = body.string()
val finalCoinStatusData =
gson.fromJson(data, InsertCoinHistoryData::class.java)
handler.post {
apiCallBack.onResponse(finalCoinStatusData)
}
}
} catch (e: Exception) {
e.printStackTrace()
handler.post {
apiCallBack.onFailure(e)
}
}
}
})
}
/**
* 投币模组
* @param token String
* @param modId String
* @param apiCallBack ApiCallBack<CoinStatusData>
*/
fun insertCoins(
token: String,
modId: String,
number: Int,
apiCallBack: ApiCallBack<ApiResponse>
) {
val okHttpClient = ServerConfiguration.initOkHttpClient()
val requestBodyBuilder: FormBody.Builder =
FormBody.Builder().add("modId", modId).add("token", token)
.add("number", number.toString())
val requestBody = requestBodyBuilder.build()
val request =
Request.Builder()
.url(ServerConfiguration.website + "php/mod.php?action=insertCoins")
.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 body = response.body
if (body == null) {
handler.post {
apiCallBack.onFailure(NullPointerException())
}
} else {
val data = body.string()
val finalApiResponse =
gson.fromJson(data, ApiResponse::class.java)
handler.post {
apiCallBack.onResponse(finalApiResponse)
}
}
} catch (e: Exception) {
e.printStackTrace()
handler.post {
apiCallBack.onFailure(e)
}
}
}
})
}
/**
* 加载随机推荐
* @param number Int 推荐数量
@ -585,7 +743,7 @@ class WebMod private constructor() {
override fun onResponse(call: Call, response: Response) {
try {
val data = response.body!!.string()
Log.d("模组信息",data)
Log.d("模组信息", data)
val finalWebModInfoData =
gson.fromJson(data, WebModInfoData::class.java)
handler.post {
@ -957,7 +1115,7 @@ class WebMod private constructor() {
val body = response.body
if (body != null) {
val data = body.string()
Log.d("发布模组响应",data)
Log.d("发布模组响应", data)
val finalApiResponse = gson.fromJson(data, ApiResponse::class.java)
handler.post {
apiCallBack.onResponse(finalApiResponse)

View File

@ -54,7 +54,7 @@ class CoreDialog(context: Context) : BaseAppDialog<CoreDialog>(context) {
* 是否选择了
* @return Boolean
*/
fun isChecked():Boolean{
fun isChecked(): Boolean {
return dialogCoreBinding.checkbox.isChecked
}
@ -129,6 +129,31 @@ class CoreDialog(context: Context) : BaseAppDialog<CoreDialog>(context) {
}
override fun setNeutralButton(text: String, func: () -> Unit): CoreDialog {
dialogCoreBinding.buttonContainer.isVisible = true
dialogCoreBinding.neutralButton.isVisible = true
dialogCoreBinding.neutralButton.text = text
dialogCoreBinding.neutralButton.setOnClickListener {
func.invoke()
if (autoDismiss) {
dialog.dismiss()
}
}
return this
}
override fun setNeutralButton(textRes: Int, func: () -> Unit): CoreDialog {
dialogCoreBinding.buttonContainer.isVisible = true
dialogCoreBinding.neutralButton.isVisible = true
dialogCoreBinding.neutralButton.setText(textRes)
dialogCoreBinding.neutralButton.setOnClickListener {
func.invoke()
if (autoDismiss) {
dialog.dismiss()
}
}
return this }
@Deprecated("无法使用。")
override fun setIcon(iconRes: Int): CoreDialog {
return super.setIcon(iconRes)

View File

@ -36,30 +36,39 @@
<RelativeLayout
android:visibility="gone"
android:id="@+id/buttonContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:visibility="gone">
android:layout_marginTop="24dp">
<Button
android:visibility="gone"
android:id="@+id/neutralButton"
android:layout_alignParentLeft="true"
style="@style/Widget.Material3.Button.TextButton.Dialog.Flush"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title" />
<Button
android:visibility="gone"
android:id="@+id/negativeButton"
style="@style/Widget.Material3.Button.TextButton.Dialog.Flush"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/positiveButton"
android:text="@string/title"
android:visibility="gone" />
android:text="@string/title" />
<Button
android:visibility="gone"
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_marginLeft="8dp"
android:text="@string/title"
android:visibility="gone" />
android:text="@string/title" />
</RelativeLayout>