refactor(app): 移除用户主页相关代码
- 删除了多个文件中与用户主页相关的代码和引用 - 移除了 UserHomePageActivity 类及相关跳转逻辑 - 删除了 menu_main.xml 文件 - 移除了 ErrorActivity 中的错误报告功能
This commit is contained in:
parent
20e5e75a35
commit
5970ab466a
|
@ -5,22 +5,16 @@ import android.os.Bundle
|
||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
|
||||||
import cat.ereza.customactivityoncrash.CustomActivityOnCrash
|
import cat.ereza.customactivityoncrash.CustomActivityOnCrash
|
||||||
import com.coldmint.rust.core.dataBean.ApiResponse
|
|
||||||
import com.coldmint.rust.core.debug.LogCat
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
|
||||||
import com.coldmint.rust.core.tool.FileOperator
|
import com.coldmint.rust.core.tool.FileOperator
|
||||||
import com.coldmint.rust.core.web.ErrorReport
|
|
||||||
import com.coldmint.rust.core.web.ServerConfiguration
|
|
||||||
import com.coldmint.rust.pro.base.BaseActivity
|
import com.coldmint.rust.pro.base.BaseActivity
|
||||||
import com.coldmint.rust.pro.databean.ErrorInfo
|
import com.coldmint.rust.pro.databean.ErrorInfo
|
||||||
import com.coldmint.rust.pro.databinding.ActivityErrorBinding
|
import com.coldmint.rust.pro.databinding.ActivityErrorBinding
|
||||||
import com.coldmint.rust.pro.tool.AppSettings
|
|
||||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
|
|
||||||
class ErrorActivity() : BaseActivity<ActivityErrorBinding>() {
|
class ErrorActivity : BaseActivity<ActivityErrorBinding>() {
|
||||||
private val errorInfo by lazy {
|
private val errorInfo by lazy {
|
||||||
ErrorInfo()
|
ErrorInfo()
|
||||||
}
|
}
|
||||||
|
@ -44,31 +38,6 @@ class ErrorActivity() : BaseActivity<ActivityErrorBinding>() {
|
||||||
}
|
}
|
||||||
viewBinding.errorInfo.text = errorInfo.allErrorDetails
|
viewBinding.errorInfo.text = errorInfo.allErrorDetails
|
||||||
LogCat.e("错误日志", errorInfo.allErrorDetails)
|
LogCat.e("错误日志", errorInfo.allErrorDetails)
|
||||||
if (AppSettings.getValue(AppSettings.Setting.ExperiencePlan, true)) {
|
|
||||||
val info = packageManager.getPackageInfo(packageName, 0)
|
|
||||||
ErrorReport.instance.send(
|
|
||||||
errorInfo.allErrorDetails,
|
|
||||||
info.versionName,
|
|
||||||
info.versionCode,
|
|
||||||
object : ApiCallBack<ApiResponse> {
|
|
||||||
override fun onResponse(t: ApiResponse) {
|
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
|
||||||
viewBinding.shareLogButton.isEnabled = false
|
|
||||||
viewBinding.shareLogButton.text = getString(R.string.anonymous_send_completed)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
AppSettings.getValue(
|
|
||||||
AppSettings.Setting.ServerAddress,
|
|
||||||
ServerConfiguration.website
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
saveLog()
|
saveLog()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +68,7 @@ class ErrorActivity() : BaseActivity<ActivityErrorBinding>() {
|
||||||
/**
|
/**
|
||||||
* 创建错误日志
|
* 创建错误日志
|
||||||
*/
|
*/
|
||||||
fun saveLog(): Boolean {
|
private fun saveLog(): Boolean {
|
||||||
return errorInfo.save()
|
return errorInfo.save()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,469 +0,0 @@
|
||||||
package com.coldmint.rust.pro
|
|
||||||
|
|
||||||
import android.animation.ObjectAnimator
|
|
||||||
import android.content.Intent
|
|
||||||
import android.graphics.Color
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.text.Editable
|
|
||||||
import android.text.SpannableString
|
|
||||||
import android.text.TextPaint
|
|
||||||
import android.text.TextWatcher
|
|
||||||
import android.text.method.LinkMovementMethod
|
|
||||||
import android.text.style.ClickableSpan
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import androidx.core.view.isVisible
|
|
||||||
import com.coldmint.dialog.InputDialog
|
|
||||||
import com.coldmint.rust.core.dataBean.ApiResponse
|
|
||||||
import com.coldmint.rust.core.dataBean.LoginRequestData
|
|
||||||
import com.coldmint.rust.core.dataBean.user.UserData
|
|
||||||
import com.coldmint.rust.core.debug.LogCat
|
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
|
||||||
import com.coldmint.rust.core.web.ServerConfiguration
|
|
||||||
import com.coldmint.rust.core.web.User
|
|
||||||
import com.coldmint.rust.core.web.User.verification
|
|
||||||
import com.coldmint.rust.pro.base.BaseActivity
|
|
||||||
import com.coldmint.rust.pro.databinding.ActivityLoginBinding
|
|
||||||
import com.coldmint.rust.pro.tool.AppSettings
|
|
||||||
import com.coldmint.rust.pro.tool.EmailAutoCompleteHelper
|
|
||||||
import com.google.android.material.snackbar.Snackbar
|
|
||||||
|
|
||||||
class LoginActivity : BaseActivity<ActivityLoginBinding>() {
|
|
||||||
private var isLogin = false
|
|
||||||
|
|
||||||
private fun initAction() {
|
|
||||||
// immersionBar {
|
|
||||||
// transparentStatusBar().statusBarDarkFont(true)
|
|
||||||
// .transparentNavigationBar().navigationBarDarkIcon(true)
|
|
||||||
// }
|
|
||||||
LogCat.d("应用识别码", AppSettings.getValue(AppSettings.Setting.AppID, "无"))
|
|
||||||
viewBinding.changeServerView.isVisible = BuildConfig.DEBUG
|
|
||||||
viewBinding.changePasswordView.setOnClickListener {
|
|
||||||
val intent = Intent(this, ChangePasswordActivity::class.java)
|
|
||||||
startActivity(intent)
|
|
||||||
}
|
|
||||||
viewBinding.accountView.addTextChangedListener(object : TextWatcher {
|
|
||||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun afterTextChanged(s: Editable?) {
|
|
||||||
val account = s.toString()
|
|
||||||
checkAccount(account)
|
|
||||||
//设置背景
|
|
||||||
if (account == "kano") {
|
|
||||||
viewBinding.titleView.text = "喜欢,鹿乃!!!"
|
|
||||||
viewBinding.root.setBackgroundResource(R.drawable.kano)
|
|
||||||
ObjectAnimator.ofFloat(viewBinding.root, "alpha", 0.4f, 1.0f)
|
|
||||||
.setDuration(375).start()
|
|
||||||
} else {
|
|
||||||
viewBinding.titleView.text = getString(R.string.login)
|
|
||||||
viewBinding.root.setBackgroundResource(0)
|
|
||||||
}
|
|
||||||
setLoginButtonEnable()
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
val emailAutoCompleteHelper = EmailAutoCompleteHelper(this)
|
|
||||||
emailAutoCompleteHelper.onBindAutoCompleteTextView(viewBinding.accountView)
|
|
||||||
|
|
||||||
viewBinding.passwordView.addTextChangedListener(object : TextWatcher {
|
|
||||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun afterTextChanged(s: Editable?) {
|
|
||||||
val passWord = s.toString()
|
|
||||||
checkPassword(passWord)
|
|
||||||
setLoginButtonEnable()
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
viewBinding.button.setOnClickListener(View.OnClickListener { v ->
|
|
||||||
if (!viewBinding.checkbox.isChecked) {
|
|
||||||
Snackbar.make(
|
|
||||||
viewBinding.button,
|
|
||||||
R.string.please_agree_the_agreement_first,
|
|
||||||
Snackbar.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
return@OnClickListener
|
|
||||||
}
|
|
||||||
inputMethodManager.hideSoftInputFromWindow(v.windowToken, 0)
|
|
||||||
if (!isLogin) {
|
|
||||||
val account = viewBinding.accountView.text.toString()
|
|
||||||
val passWord = viewBinding.passwordView.text.toString()
|
|
||||||
if (!checkAccount(account)) {
|
|
||||||
return@OnClickListener
|
|
||||||
}
|
|
||||||
if (!checkPassword(passWord)) {
|
|
||||||
return@OnClickListener
|
|
||||||
}
|
|
||||||
val appId = AppSettings.getValue(AppSettings.Setting.AppID, "");
|
|
||||||
isLogin = true
|
|
||||||
viewBinding.button.setText(R.string.request_data)
|
|
||||||
User.login(LoginRequestData(account, passWord, appId),
|
|
||||||
object : ApiCallBack<UserData> {
|
|
||||||
override fun onResponse(userData: UserData) {
|
|
||||||
isLogin = false
|
|
||||||
viewBinding.button.setText(R.string.login)
|
|
||||||
if (userData.code == ServerConfiguration.Success_Code) {
|
|
||||||
AppSettings.forceSetValue(AppSettings.Setting.PassWord, passWord)
|
|
||||||
AppSettings.forceSetValue(
|
|
||||||
AppSettings.Setting.Account,
|
|
||||||
userData.data.account
|
|
||||||
)
|
|
||||||
AppSettings.forceSetValue(
|
|
||||||
AppSettings.Setting.Token,
|
|
||||||
userData.data.token
|
|
||||||
)
|
|
||||||
//从服务器获取用户的激活信息。
|
|
||||||
// GlobalMethod.isActive = userData.data.activation
|
|
||||||
//更新本地激活时间
|
|
||||||
val expirationTime = userData.data.expirationTime
|
|
||||||
val time = ServerConfiguration.toLongTime(expirationTime)
|
|
||||||
AppSettings.forceSetValue(AppSettings.Setting.LoginStatus, true)
|
|
||||||
startActivity(Intent(this@LoginActivity, MainActivity::class.java))
|
|
||||||
finish()
|
|
||||||
} else {
|
|
||||||
when (userData.message) {
|
|
||||||
"请先激活您的账户" -> {
|
|
||||||
InputDialog(this@LoginActivity).setTitle(R.string.activate_the_account)
|
|
||||||
.setMessage(R.string.activate_the_account_tip)
|
|
||||||
.setHint(R.string.verification_code)
|
|
||||||
.setCancelable(false).setMaxNumber(6)
|
|
||||||
.setPositiveButton(R.string.dialog_ok) { text ->
|
|
||||||
User.activateAccount(account,
|
|
||||||
text,
|
|
||||||
object : ApiCallBack<ApiResponse> {
|
|
||||||
override fun onResponse(t: ApiResponse) {
|
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
|
||||||
Snackbar.make(
|
|
||||||
viewBinding.button,
|
|
||||||
R.string.activate_the_account_ok,
|
|
||||||
Snackbar.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
} else {
|
|
||||||
Snackbar.make(
|
|
||||||
viewBinding.button,
|
|
||||||
t.message,
|
|
||||||
Snackbar.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
showInternetError(viewBinding.button, e)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
true
|
|
||||||
}.setNegativeButton(R.string.dialog_close) {
|
|
||||||
|
|
||||||
}.show()
|
|
||||||
}
|
|
||||||
|
|
||||||
"找不到用户" -> {
|
|
||||||
setErrorAndInput(
|
|
||||||
viewBinding.accountView,
|
|
||||||
getString(R.string.account_error3),
|
|
||||||
viewBinding.accountInputLayout
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
"找不到邮箱" -> {
|
|
||||||
setErrorAndInput(
|
|
||||||
viewBinding.accountView,
|
|
||||||
getString(R.string.account_error4),
|
|
||||||
viewBinding.accountInputLayout
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
"密码错误" -> {
|
|
||||||
setErrorAndInput(
|
|
||||||
viewBinding.passwordView,
|
|
||||||
getString(R.string.password_error2),
|
|
||||||
viewBinding.passwordInputLayout
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
"请更改登录设备" -> {
|
|
||||||
viewBinding.button.isEnabled = false
|
|
||||||
verification(
|
|
||||||
account,
|
|
||||||
passWord,
|
|
||||||
appId,
|
|
||||||
object : ApiCallBack<ApiResponse> {
|
|
||||||
override fun onResponse(t: ApiResponse) {
|
|
||||||
viewBinding.button.isEnabled = true
|
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
|
||||||
InputDialog(this@LoginActivity).setMaxNumber(
|
|
||||||
6
|
|
||||||
).setHint(R.string.verification_code)
|
|
||||||
.setInputCanBeEmpty(false)
|
|
||||||
.setTitle(R.string.verification)
|
|
||||||
.setMessage(R.string.activate_the_account_tip)
|
|
||||||
.setCancelable(false)
|
|
||||||
.setPositiveButton(R.string.dialog_ok) { it ->
|
|
||||||
User.changeAppId(account,
|
|
||||||
it,
|
|
||||||
appId,
|
|
||||||
object :
|
|
||||||
ApiCallBack<ApiResponse> {
|
|
||||||
override fun onResponse(t: ApiResponse) {
|
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
|
||||||
Snackbar.make(
|
|
||||||
viewBinding.button,
|
|
||||||
R.string.activate_the_account_ok,
|
|
||||||
Snackbar.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
} else {
|
|
||||||
Snackbar.make(
|
|
||||||
viewBinding.button,
|
|
||||||
t.message,
|
|
||||||
Snackbar.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
showInternetError(
|
|
||||||
viewBinding.button,
|
|
||||||
e
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
true
|
|
||||||
}
|
|
||||||
.setNegativeButton(R.string.dialog_close) {
|
|
||||||
|
|
||||||
}.show()
|
|
||||||
} else {
|
|
||||||
Snackbar.make(
|
|
||||||
viewBinding.button,
|
|
||||||
t.message,
|
|
||||||
Snackbar.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
viewBinding.button.isEnabled = true
|
|
||||||
isLogin = false
|
|
||||||
viewBinding.button.setText(R.string.login)
|
|
||||||
showInternetError(viewBinding.button, e)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> {
|
|
||||||
Snackbar.make(
|
|
||||||
viewBinding.button,
|
|
||||||
userData.message,
|
|
||||||
Snackbar.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
isLogin = false
|
|
||||||
viewBinding.button.setText(R.string.login)
|
|
||||||
showInternetError(viewBinding.button, e)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
val agreementAgreed = getString(R.string.agreement_agreed)
|
|
||||||
val spannableString = SpannableString(agreementAgreed)
|
|
||||||
val serviceAgreement = "1"
|
|
||||||
val privacyPolicy = "2"
|
|
||||||
val start = agreementAgreed.indexOf(serviceAgreement)
|
|
||||||
val start2 = agreementAgreed.indexOf(privacyPolicy)
|
|
||||||
if (start > -1 && start2 > -1) {
|
|
||||||
spannableString.setSpan(object : ClickableSpan() {
|
|
||||||
override fun onClick(p0: View) {
|
|
||||||
val link =
|
|
||||||
ServerConfiguration.getRealLink("/resources/agreement/service_agreement.html")
|
|
||||||
val thisIntent = Intent(this@LoginActivity, BrowserActivity::class.java)
|
|
||||||
thisIntent.putExtra("link", link)
|
|
||||||
startActivity(thisIntent)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun updateDrawState(ds: TextPaint) {
|
|
||||||
ds.isUnderlineText = false
|
|
||||||
super.updateDrawState(ds)
|
|
||||||
}
|
|
||||||
}, start, start + serviceAgreement.length, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE)
|
|
||||||
spannableString.setSpan(object : ClickableSpan() {
|
|
||||||
override fun onClick(p0: View) {
|
|
||||||
val link =
|
|
||||||
ServerConfiguration.getRealLink("/resources/agreement/privacy_policy.html")
|
|
||||||
val thisIntent = Intent(this@LoginActivity, BrowserActivity::class.java)
|
|
||||||
thisIntent.putExtra("link", link)
|
|
||||||
startActivity(thisIntent)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun updateDrawState(ds: TextPaint) {
|
|
||||||
ds.isUnderlineText = false
|
|
||||||
super.updateDrawState(ds)
|
|
||||||
}
|
|
||||||
}, start2, start2 + privacyPolicy.length, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE)
|
|
||||||
viewBinding.checkbox.text = spannableString
|
|
||||||
viewBinding.checkbox.setHintTextColor(Color.TRANSPARENT)
|
|
||||||
viewBinding.checkbox.movementMethod = LinkMovementMethod.getInstance();
|
|
||||||
}
|
|
||||||
val agree = AppSettings.getValue(AppSettings.Setting.AgreePolicy, false)
|
|
||||||
viewBinding.checkbox.isChecked = agree
|
|
||||||
viewBinding.checkbox.setOnCheckedChangeListener { p0, p1 ->
|
|
||||||
setLoginButtonEnable()
|
|
||||||
AppSettings.setValue(AppSettings.Setting.AgreePolicy, p1)
|
|
||||||
}
|
|
||||||
|
|
||||||
viewBinding.registerView.setOnClickListener {
|
|
||||||
startActivity(
|
|
||||||
Intent(
|
|
||||||
this@LoginActivity,
|
|
||||||
RegisterActivity::class.java
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
viewBinding.changeServerView.setOnClickListener {
|
|
||||||
InputDialog(this).setTitle(R.string.changing_the_server)
|
|
||||||
.setMessage(R.string.changing_the_server_tip).setMaxNumber(255).setText(
|
|
||||||
AppSettings.getValue(
|
|
||||||
AppSettings.Setting.ServerAddress,
|
|
||||||
ServerConfiguration.website
|
|
||||||
)
|
|
||||||
).setHint(R.string.server_address_configuration).setErrorTip { s, textInputLayout ->
|
|
||||||
textInputLayout.isErrorEnabled =
|
|
||||||
!(s.startsWith("http://") || s.startsWith("https://"))
|
|
||||||
}.setPositiveButton(R.string.dialog_ok) { input ->
|
|
||||||
if (input.isNotBlank()) {
|
|
||||||
AppSettings.setValue(AppSettings.Setting.ServerAddress, input)
|
|
||||||
ServerConfiguration.website = input
|
|
||||||
Snackbar.make(
|
|
||||||
viewBinding.button,
|
|
||||||
R.string.change_server_complete,
|
|
||||||
Snackbar.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
return@setPositiveButton true
|
|
||||||
} else {
|
|
||||||
return@setPositiveButton false
|
|
||||||
}
|
|
||||||
}.setNegativeButton(R.string.dialog_close) {
|
|
||||||
}.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检查账号
|
|
||||||
* @param account String
|
|
||||||
* @param updateView Boolean
|
|
||||||
* @return Boolean
|
|
||||||
*/
|
|
||||||
fun checkAccount(account: String, updateView: Boolean = true): Boolean {
|
|
||||||
return if (account.isBlank()) {
|
|
||||||
if (updateView) {
|
|
||||||
setErrorAndInput(
|
|
||||||
viewBinding.accountView,
|
|
||||||
getString(R.string.please_enter_your_account_or_email),
|
|
||||||
viewBinding.accountInputLayout
|
|
||||||
)
|
|
||||||
}
|
|
||||||
false
|
|
||||||
} else {
|
|
||||||
if (updateView) {
|
|
||||||
viewBinding.accountInputLayout.isErrorEnabled = false
|
|
||||||
}
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置登录按钮
|
|
||||||
*/
|
|
||||||
fun setLoginButtonEnable() {
|
|
||||||
viewBinding.button.isEnabled =
|
|
||||||
checkAccount(viewBinding.accountView.text.toString(), false) && checkPassword(
|
|
||||||
viewBinding.passwordView.text.toString(),
|
|
||||||
false
|
|
||||||
) && viewBinding.checkbox.isChecked
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检查密码
|
|
||||||
* @param passWord String
|
|
||||||
* @param updateView Boolean
|
|
||||||
* @return Boolean
|
|
||||||
*/
|
|
||||||
fun checkPassword(passWord: String, updateView: Boolean = true): Boolean {
|
|
||||||
return if (passWord.isBlank()) {
|
|
||||||
if (updateView) {
|
|
||||||
setErrorAndInput(
|
|
||||||
viewBinding.passwordView,
|
|
||||||
getString(R.string.please_enter_your_password),
|
|
||||||
viewBinding.passwordInputLayout
|
|
||||||
)
|
|
||||||
}
|
|
||||||
false
|
|
||||||
} else {
|
|
||||||
if (passWord.matches(Regex("^[a-zA-Z0-9_]{6,20}\$"))) {
|
|
||||||
if (updateView) {
|
|
||||||
viewBinding.passwordInputLayout.isErrorEnabled = false
|
|
||||||
}
|
|
||||||
true
|
|
||||||
} else {
|
|
||||||
if (updateView) {
|
|
||||||
setErrorAndInput(
|
|
||||||
viewBinding.passwordView,
|
|
||||||
getString(R.string.password_error),
|
|
||||||
viewBinding.passwordInputLayout, false
|
|
||||||
)
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
val account = AppSettings.getValue(AppSettings.Setting.Account, "")
|
|
||||||
val passWord = AppSettings.getValue(AppSettings.Setting.PassWord, "")
|
|
||||||
val inputAccount = viewBinding.accountView.text.toString()
|
|
||||||
val inputPassWord = viewBinding.passwordView.text.toString()
|
|
||||||
if (account.isNotBlank() && inputAccount.isEmpty()) {
|
|
||||||
viewBinding.accountView.setText(account)
|
|
||||||
}
|
|
||||||
if (passWord.isNotBlank() && inputPassWord.isEmpty()) {
|
|
||||||
viewBinding.passwordView.setText(passWord)
|
|
||||||
}
|
|
||||||
super.onResume()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivityLoginBinding {
|
|
||||||
return ActivityLoginBinding.inflate(layoutInflater)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
|
|
||||||
if (canUseView) {
|
|
||||||
initAction()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,8 +7,6 @@ import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.Menu
|
|
||||||
import android.view.MenuItem
|
|
||||||
import androidx.appcompat.app.ActionBarDrawerToggle
|
import androidx.appcompat.app.ActionBarDrawerToggle
|
||||||
import androidx.core.view.GravityCompat
|
import androidx.core.view.GravityCompat
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
@ -62,7 +60,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
companion object {
|
companion object {
|
||||||
//仓库和社区碎片链接TabLayout间隔
|
//仓库和社区碎片链接TabLayout间隔
|
||||||
const val hideViewDelay: Long = 150
|
const val hideViewDelay: Long = 150
|
||||||
// private var time:Long=0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,15 +72,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
)
|
)
|
||||||
val navController = findNavController(R.id.baseFragment)
|
val navController = findNavController(R.id.baseFragment)
|
||||||
navController.navInflater.inflate(R.navigation.main_nav).apply {
|
navController.navInflater.inflate(R.navigation.main_nav).apply {
|
||||||
val use =
|
|
||||||
AppSettings.getValue(AppSettings.Setting.UseTheCommunityAsTheLaunchPage, true)
|
|
||||||
this.setStartDestination(
|
this.setStartDestination(
|
||||||
if (use) {
|
R.id.mod_item
|
||||||
// viewBinding.mainButton.hide()
|
|
||||||
R.id.community_item
|
|
||||||
} else {
|
|
||||||
R.id.mod_item
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
navController.graph = this
|
navController.graph = this
|
||||||
}
|
}
|
||||||
|
@ -620,34 +610,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
|
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_DOWN) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return super.onKeyDown(keyCode, event)
|
|
||||||
}*/
|
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
|
||||||
val inflater = menuInflater
|
|
||||||
inflater.inflate(R.menu.menu_main, menu)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
/*不知道干什么的代码
|
|
||||||
override fun onSupportNavigateUp(): Boolean {
|
|
||||||
val navController = findNavController(R.id.baseFragment)
|
|
||||||
return navController.navigateUp(appBarConfiguration)
|
|
||||||
|| super.onSupportNavigateUp()
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
|
||||||
if (item.itemId == R.id.search) {
|
|
||||||
startActivity(Intent(this, SearchActivity::class.java))
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivityMainBinding {
|
override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivityMainBinding {
|
||||||
return ActivityMainBinding.inflate(layoutInflater)
|
return ActivityMainBinding.inflate(layoutInflater)
|
||||||
|
@ -666,30 +628,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
.apply(GlobalMethod.getRequestOptions(true, !it.data.activation))
|
.apply(GlobalMethod.getRequestOptions(true, !it.data.activation))
|
||||||
.into(headLayout.imageView)
|
.into(headLayout.imageView)
|
||||||
}
|
}
|
||||||
val account = it.data.account
|
|
||||||
headLayout.imageView.setOnClickListener {
|
|
||||||
val opIntent = Intent(this, UserHomePageActivity::class.java)
|
|
||||||
opIntent.putExtra("userId", account)
|
|
||||||
startActivity(opIntent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
startViewModel.needLoginLiveData.observe(this) {
|
|
||||||
if (it) {
|
|
||||||
headLayout.imageView.setImageResource(R.drawable.head_icon)
|
|
||||||
headLayout.nameView.text = getString(R.string.click_profile_picture_login)
|
|
||||||
headLayout.emailView.text = ""
|
|
||||||
headLayout.imageView.setOnClickListener {
|
|
||||||
startActivity(
|
|
||||||
Intent(
|
|
||||||
this,
|
|
||||||
LoginActivity::class.java
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
showGameConfiguredDialog()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
startViewModel.dataSetMsgLiveData.observe(this) {
|
startViewModel.dataSetMsgLiveData.observe(this) {
|
||||||
|
@ -710,26 +648,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
startViewModel.isActivationLiveData.observe(this) {
|
startViewModel.isActivationLiveData.observe(this) {
|
||||||
// GlobalMethod.isActive = it
|
|
||||||
initNavigationMenu(GlobalMethod.isActive)
|
initNavigationMenu(GlobalMethod.isActive)
|
||||||
}
|
}
|
||||||
|
|
||||||
startViewModel.verifyErrorMsgLiveData.observe(this) {
|
|
||||||
if (it.isNotBlank()) {
|
|
||||||
CoreDialog(this).setTitle(R.string.login).setMessage(it)
|
|
||||||
.setCancelable(false).setPositiveButton(R.string.login) {
|
|
||||||
startActivity(
|
|
||||||
Intent(
|
|
||||||
this,
|
|
||||||
LoginActivity::class.java
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}.setNegativeButton(R.string.close) {
|
|
||||||
finish()
|
|
||||||
}.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ import com.google.android.material.snackbar.Snackbar
|
||||||
* @date 2022/1/12 17:52
|
* @date 2022/1/12 17:52
|
||||||
*/
|
*/
|
||||||
class OrderListActivity : BaseActivity<ActivityOrderListBinding>() {
|
class OrderListActivity : BaseActivity<ActivityOrderListBinding>() {
|
||||||
var loadAll = false
|
private var loadAll = false
|
||||||
val account by lazy {
|
val account by lazy {
|
||||||
AppSettings.getValue(AppSettings.Setting.Account, "")
|
AppSettings.getValue(AppSettings.Setting.Account, "")
|
||||||
}
|
}
|
||||||
|
@ -92,14 +92,6 @@ class OrderListActivity : BaseActivity<ActivityOrderListBinding>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"查看用户资料" -> {
|
|
||||||
val thisIntent = Intent(
|
|
||||||
this@OrderListActivity,
|
|
||||||
UserHomePageActivity::class.java
|
|
||||||
)
|
|
||||||
thisIntent.putExtra("userId", data.account)
|
|
||||||
startActivity(thisIntent)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,161 +0,0 @@
|
||||||
package com.coldmint.rust.pro
|
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.core.view.isVisible
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
|
||||||
import com.coldmint.rust.core.dataBean.ApiResponse
|
|
||||||
import com.coldmint.rust.core.dataBean.mod.WebModListData
|
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
|
||||||
import com.coldmint.rust.core.web.ServerConfiguration
|
|
||||||
import com.coldmint.rust.core.web.WebMod
|
|
||||||
import com.coldmint.rust.pro.adapters.AuditModAdapter
|
|
||||||
import com.coldmint.rust.pro.base.BaseActivity
|
|
||||||
import com.coldmint.rust.pro.databinding.ActivityReviewModBinding
|
|
||||||
import com.coldmint.rust.pro.tool.AppSettings
|
|
||||||
import com.coldmint.rust.pro.ui.StableLinearLayoutManager
|
|
||||||
import com.google.android.material.snackbar.Snackbar
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Cold Mint
|
|
||||||
* @date 2022/1/9 16:50
|
|
||||||
*/
|
|
||||||
class ReviewModActivity : BaseActivity<ActivityReviewModBinding>() {
|
|
||||||
val token by lazy {
|
|
||||||
AppSettings.getValue(AppSettings.Setting.Token, "")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
|
|
||||||
if (canUseView) {
|
|
||||||
title = getText(R.string.review_mod)
|
|
||||||
setReturnButton()
|
|
||||||
if (token.isBlank()) {
|
|
||||||
showInfoToView(resId = R.string.please_login_first)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
viewBinding.recyclerView.layoutManager = StableLinearLayoutManager(this)
|
|
||||||
loadList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 加载列表
|
|
||||||
*/
|
|
||||||
fun loadList() {
|
|
||||||
WebMod.instance.getAuditList(object : ApiCallBack<WebModListData> {
|
|
||||||
override fun onResponse(t: WebModListData) {
|
|
||||||
val temData = t.data
|
|
||||||
if (t.code == ServerConfiguration.Success_Code && temData != null) {
|
|
||||||
val mutableList = temData.toMutableList()
|
|
||||||
viewBinding.progressBar.isVisible = false
|
|
||||||
viewBinding.tipView.isVisible = false
|
|
||||||
viewBinding.recyclerView.isVisible = true
|
|
||||||
val adapter = AuditModAdapter(this@ReviewModActivity, mutableList)
|
|
||||||
adapter.setItemEvent { i, itemAuditModBinding, viewHolder, data ->
|
|
||||||
itemAuditModBinding.root.setOnClickListener {
|
|
||||||
val intent =
|
|
||||||
Intent(this@ReviewModActivity, WebModInfoActivity::class.java)
|
|
||||||
val target = data.id
|
|
||||||
val bundle = Bundle()
|
|
||||||
bundle.putString("modName", target)
|
|
||||||
bundle.putString("modId", target)
|
|
||||||
intent.putExtra("data", bundle)
|
|
||||||
startActivity(intent)
|
|
||||||
}
|
|
||||||
itemAuditModBinding.consentView.setOnClickListener {
|
|
||||||
WebMod.instance.auditMod(
|
|
||||||
token,
|
|
||||||
data.id,
|
|
||||||
true,
|
|
||||||
object : ApiCallBack<ApiResponse> {
|
|
||||||
override fun onResponse(t: ApiResponse) {
|
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
|
||||||
val index = mutableList.indexOf(data)
|
|
||||||
mutableList.removeAt(index)
|
|
||||||
adapter.notifyItemRemoved(index)
|
|
||||||
if (mutableList.isEmpty()) {
|
|
||||||
loadList()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Snackbar.make(
|
|
||||||
viewBinding.tipView,
|
|
||||||
t.message,
|
|
||||||
Snackbar.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
showInternetError(viewBinding.tipView, e)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
itemAuditModBinding.refusedView.setOnClickListener {
|
|
||||||
|
|
||||||
WebMod.instance.auditMod(
|
|
||||||
token,
|
|
||||||
data.id,
|
|
||||||
false,
|
|
||||||
object : ApiCallBack<ApiResponse> {
|
|
||||||
override fun onResponse(t: ApiResponse) {
|
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
|
||||||
val index = mutableList.indexOf(data)
|
|
||||||
mutableList.removeAt(index)
|
|
||||||
adapter.notifyItemRemoved(index)
|
|
||||||
if (mutableList.isEmpty()) {
|
|
||||||
loadList()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Snackbar.make(
|
|
||||||
viewBinding.tipView,
|
|
||||||
t.message,
|
|
||||||
Snackbar.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
showInternetError(viewBinding.tipView, e)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
viewBinding.recyclerView.adapter = adapter
|
|
||||||
} else {
|
|
||||||
showInfoToView(str = t.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
showInfoToView(resId = R.string.network_error)
|
|
||||||
}
|
|
||||||
|
|
||||||
}, sortMode = WebMod.SortMode.Latest_Time)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 显示信息在视图上
|
|
||||||
* @param str String?
|
|
||||||
* @param resId Int?
|
|
||||||
*/
|
|
||||||
fun showInfoToView(str: String? = null, resId: Int? = null) {
|
|
||||||
viewBinding.progressBar.isVisible = false
|
|
||||||
viewBinding.recyclerView.isVisible = false
|
|
||||||
viewBinding.tipView.isVisible = true
|
|
||||||
if (str != null) {
|
|
||||||
viewBinding.tipView.text = str
|
|
||||||
}
|
|
||||||
if (resId != null) {
|
|
||||||
viewBinding.tipView.setText(resId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivityReviewModBinding {
|
|
||||||
return ActivityReviewModBinding.inflate(layoutInflater)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,248 +0,0 @@
|
||||||
package com.coldmint.rust.pro
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.Menu
|
|
||||||
import android.view.MenuItem
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.widget.Button
|
|
||||||
import androidx.appcompat.widget.SearchView
|
|
||||||
import androidx.core.view.isVisible
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import com.coldmint.rust.core.dataBean.HotSearchData
|
|
||||||
import com.coldmint.rust.core.dataBean.SearchSuggestionsData
|
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
|
||||||
import com.coldmint.rust.core.web.Search
|
|
||||||
import com.coldmint.rust.pro.adapters.HotSearchAdapter
|
|
||||||
import com.coldmint.rust.pro.adapters.SearchSuggestionsAdapter
|
|
||||||
import com.coldmint.rust.pro.base.BaseActivity
|
|
||||||
import com.coldmint.rust.pro.databinding.ActivitySearchBinding
|
|
||||||
import com.coldmint.rust.pro.databinding.ItemStringBinding
|
|
||||||
import com.coldmint.rust.pro.ui.StableLinearLayoutManager
|
|
||||||
import com.google.android.flexbox.FlexboxLayoutManager
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 搜索界面
|
|
||||||
*/
|
|
||||||
class SearchActivity : BaseActivity<ActivitySearchBinding>() {
|
|
||||||
lateinit var list: MutableList<String>
|
|
||||||
val sharedPreferencesKey = "search_history"
|
|
||||||
|
|
||||||
@SuppressLint("CommitPrefEdits", "NotifyDataSetChanged")
|
|
||||||
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
|
|
||||||
title = getString(R.string.search)
|
|
||||||
setReturnButton()
|
|
||||||
viewBinding.recyclerView.layoutManager = StableLinearLayoutManager(this)
|
|
||||||
viewBinding.hotSearchView.layoutManager = StableLinearLayoutManager(this)
|
|
||||||
loadSearchView()
|
|
||||||
loadHotSearch()
|
|
||||||
list = getSharedPreferences(sharedPreferencesKey, Context.MODE_PRIVATE)
|
|
||||||
.getStringSet("data", mutableSetOf())
|
|
||||||
?.toMutableList() ?: mutableListOf()
|
|
||||||
viewBinding.hotSearchView2.layoutManager = FlexboxLayoutManager(this)
|
|
||||||
viewBinding.hotSearchView2.adapter = adapter
|
|
||||||
viewBinding.deleat.setOnClickListener {
|
|
||||||
val dialog = MaterialAlertDialogBuilder(this@SearchActivity)
|
|
||||||
dialog.setTitle(R.string.search_history)
|
|
||||||
dialog.setMessage(R.string.clear_all_history)
|
|
||||||
dialog.setPositiveButton(R.string.dialog_ok) { _, _ ->
|
|
||||||
while (list.isNotEmpty()) {
|
|
||||||
val index = 0
|
|
||||||
list.removeAt(index)
|
|
||||||
adapter.notifyItemRemoved(index)
|
|
||||||
}
|
|
||||||
getSharedPreferences(sharedPreferencesKey,
|
|
||||||
Context.MODE_PRIVATE).edit().putStringSet(
|
|
||||||
"data", list.toSet()).apply()
|
|
||||||
}
|
|
||||||
dialog.setNegativeButton(R.string.dialog_cancel, null)
|
|
||||||
dialog.show()
|
|
||||||
}
|
|
||||||
viewBinding.searchView.onActionViewExpanded()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun additem(string: String) {
|
|
||||||
// 检查列表中是否已经存在该数据
|
|
||||||
val existingIndex = list.indexOf(string)
|
|
||||||
if (existingIndex != -1) {
|
|
||||||
// 如果已存在,移动到列表最前面
|
|
||||||
list.removeAt(existingIndex)
|
|
||||||
list.add(0, string)
|
|
||||||
adapter.notifyItemMoved(existingIndex, 0)
|
|
||||||
} else {
|
|
||||||
// 如果不存在,添加到列表最前面
|
|
||||||
list.add(0, string)
|
|
||||||
adapter.notifyItemInserted(0)
|
|
||||||
}
|
|
||||||
// 滚动到顶部
|
|
||||||
// viewBinding.hotSearchView2.scrollToPosition(0)
|
|
||||||
// 限制历史记录数量为10
|
|
||||||
if (list.size > 10) {
|
|
||||||
list.removeAt(list.lastIndex)
|
|
||||||
}
|
|
||||||
val editor = getSharedPreferences(sharedPreferencesKey, Context.MODE_PRIVATE).edit()
|
|
||||||
editor.putStringSet("data", list.toSet())
|
|
||||||
editor.apply()
|
|
||||||
if (!viewBinding.searchView.isVisible) {
|
|
||||||
viewBinding.searchLayout.isVisible = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun search(string: String) {
|
|
||||||
val intent = Intent(this@SearchActivity, SearchResultActivity::class.java)
|
|
||||||
intent.putExtra("key", string)
|
|
||||||
startActivity(intent)
|
|
||||||
additem(string)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO:将适配器继承自BaseAdapter,使其不再过度依赖SearchActivity。
|
|
||||||
val adapter: RecyclerView.Adapter<VH> = object : RecyclerView.Adapter<VH>() {
|
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
|
||||||
return VH(ItemStringBinding.bind(
|
|
||||||
LayoutInflater.from(viewBinding.root.context)
|
|
||||||
.inflate(R.layout.item_string, parent, false)))
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: VH, position: Int) {
|
|
||||||
holder.binding.button.text = list[position]
|
|
||||||
|
|
||||||
holder.binding.button.setOnClickListener {
|
|
||||||
val a: Button = it as Button
|
|
||||||
search(a.text.toString())
|
|
||||||
}
|
|
||||||
holder.binding.button.setOnLongClickListener {
|
|
||||||
val str = list[holder.bindingAdapterPosition]
|
|
||||||
MaterialAlertDialogBuilder(it.context).setTitle("确定要删除此记录:$str")
|
|
||||||
.setPositiveButton("确定") { _, _ ->
|
|
||||||
list.remove(str)
|
|
||||||
notifyItemRemoved(holder.bindingAdapterPosition)
|
|
||||||
}.setNegativeButton("取消", null)
|
|
||||||
.show()
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemCount(): Int {
|
|
||||||
val empty = list.isEmpty()
|
|
||||||
viewBinding.searchLayout.isVisible = !empty
|
|
||||||
viewBinding.deleat.isVisible = !empty
|
|
||||||
return list.size
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class VH(itemView: ItemStringBinding) : RecyclerView.ViewHolder(itemView.root) {
|
|
||||||
var binding: ItemStringBinding = itemView
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private fun loadHotSearch() {
|
|
||||||
Search.instance.hotSearch(object : ApiCallBack<HotSearchData> {
|
|
||||||
override fun onResponse(t: HotSearchData) {
|
|
||||||
val adapter = HotSearchAdapter(this@SearchActivity, t.data)
|
|
||||||
adapter.setItemEvent { _, itemHotSearchBinding, _, data ->
|
|
||||||
itemHotSearchBinding.root.setOnClickListener {
|
|
||||||
search(data.keyword)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
viewBinding.hotSearchView.adapter = adapter
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun loadSearchView() {
|
|
||||||
viewBinding.searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener,
|
|
||||||
android.widget.SearchView.OnQueryTextListener {
|
|
||||||
override fun onQueryTextSubmit(query: String?): Boolean {
|
|
||||||
if (!query.isNullOrBlank()) {
|
|
||||||
search(query)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onQueryTextChange(newText: String?): Boolean {
|
|
||||||
if (!newText.isNullOrBlank()) {
|
|
||||||
// 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.isEmpty()) {
|
|
||||||
viewBinding.recyclerView.isVisible = false
|
|
||||||
// viewBinding.searchSuggestionsView.setText(R.string.search_suggestions_null)
|
|
||||||
} else {
|
|
||||||
val adapter =
|
|
||||||
SearchSuggestionsAdapter(
|
|
||||||
this@SearchActivity,
|
|
||||||
newText,
|
|
||||||
dataList
|
|
||||||
)
|
|
||||||
adapter.setItemEvent { _, itemSearchSuggestionsBinding, _, s ->
|
|
||||||
itemSearchSuggestionsBinding.root.setOnClickListener {
|
|
||||||
search(s)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
viewBinding.recyclerView.adapter = adapter
|
|
||||||
viewBinding.recyclerView.isVisible = true
|
|
||||||
// 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)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
// viewBinding.searchSuggestionsView.setText(R.string.search_suggestions_null)
|
|
||||||
viewBinding.recyclerView.isVisible = false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
|
||||||
val add = menu.add("搜索")
|
|
||||||
add.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM)
|
|
||||||
return super.onCreateOptionsMenu(menu)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
|
||||||
if (item.itemId == 0) {
|
|
||||||
if (!viewBinding.searchView.query.isNullOrBlank()) {
|
|
||||||
search(viewBinding.searchView.query.toString())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivitySearchBinding {
|
|
||||||
return ActivitySearchBinding.inflate(layoutInflater)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBackPressed() {
|
|
||||||
if (viewBinding.recyclerView.isVisible) {
|
|
||||||
viewBinding.recyclerView.isVisible = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
super.onBackPressed()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,111 +0,0 @@
|
||||||
package com.coldmint.rust.pro
|
|
||||||
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import androidx.core.view.isVisible
|
|
||||||
import com.coldmint.rust.core.dataBean.user.SearchResultDataBean
|
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
|
||||||
import com.coldmint.rust.core.web.Search
|
|
||||||
import com.coldmint.rust.core.web.ServerConfiguration
|
|
||||||
import com.coldmint.rust.pro.adapters.SearchPageAdapter
|
|
||||||
import com.coldmint.rust.pro.base.BaseActivity
|
|
||||||
import com.coldmint.rust.pro.databinding.ActivitySearchResultBinding
|
|
||||||
import com.google.android.material.tabs.TabLayoutMediator
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 搜索activity
|
|
||||||
*/
|
|
||||||
class SearchResultActivity : BaseActivity<ActivitySearchResultBinding>() {
|
|
||||||
lateinit var keyWord: String
|
|
||||||
val typeMap by lazy {
|
|
||||||
val map = HashMap<String, Int>()
|
|
||||||
map["mod"] = R.string.search_type_mod
|
|
||||||
map["user"] = R.string.search_type_user
|
|
||||||
map["dynamic"] = R.string.search_type_dynamic
|
|
||||||
map["mod_comments"] = R.string.search_type_mod_comments
|
|
||||||
map["mod_versions"] = R.string.search_type_mod_versions
|
|
||||||
map["purchase_plan"] = R.string.search_type_purchase_plan
|
|
||||||
map["template_package"] = R.string.search_type_template_package
|
|
||||||
map
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
|
|
||||||
if (canUseView) {
|
|
||||||
setReturnButton()
|
|
||||||
loadData(keyWord)
|
|
||||||
title = String.format(getString(R.string.search_mod_key), keyWord)
|
|
||||||
} else {
|
|
||||||
val thisIntent = intent
|
|
||||||
val key = thisIntent.getStringExtra("key")
|
|
||||||
if (key == null) {
|
|
||||||
showError("key为null")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
keyWord = key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 加载数据
|
|
||||||
* @param keyWord String
|
|
||||||
*/
|
|
||||||
fun loadData(keyWord: String) {
|
|
||||||
Search.instance.searchAll(keyWord, object : ApiCallBack<SearchResultDataBean> {
|
|
||||||
override fun onResponse(t: SearchResultDataBean) {
|
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
|
||||||
val list = t.data.total
|
|
||||||
if (list.isNotEmpty()) {
|
|
||||||
val adapter = SearchPageAdapter(this@SearchResultActivity, keyWord, t.data)
|
|
||||||
viewBinding.viewPager2.adapter = adapter
|
|
||||||
TabLayoutMediator(viewBinding.tabLayout, viewBinding.viewPager2) { tab, i ->
|
|
||||||
tab.text = if (i == 0) {
|
|
||||||
getString(R.string.search_type_mod_all) + "(" + t.data.total.size + ")"
|
|
||||||
} else {
|
|
||||||
val typeData = t.data.type[i - 1]
|
|
||||||
val id = typeMap[typeData.typeName] ?: -1
|
|
||||||
val name = if (id == -1) {
|
|
||||||
typeData.typeName
|
|
||||||
} else {
|
|
||||||
getString(id)
|
|
||||||
}
|
|
||||||
name + "(" + typeData.num + ")"
|
|
||||||
}
|
|
||||||
}.attach()
|
|
||||||
viewBinding.progressBar.isVisible = false
|
|
||||||
viewBinding.tipView.isVisible = false
|
|
||||||
viewBinding.contentLayout.isVisible = true
|
|
||||||
title = String.format(
|
|
||||||
getString(R.string.search_mod_key),
|
|
||||||
keyWord
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
showInfoToView(t.message)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
showInfoToView(t.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
showInfoToView(this@SearchResultActivity.getString(R.string.network_error))
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 显示信息到视图
|
|
||||||
* @param text String
|
|
||||||
*/
|
|
||||||
fun showInfoToView(text: String) {
|
|
||||||
viewBinding.tipView.isVisible = true
|
|
||||||
viewBinding.tipView.text = text
|
|
||||||
viewBinding.progressBar.isVisible = false
|
|
||||||
viewBinding.contentLayout.isVisible = false
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivitySearchResultBinding {
|
|
||||||
return ActivitySearchResultBinding.inflate(layoutInflater)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -17,7 +17,6 @@ import com.coldmint.rust.core.tool.FileOperator
|
||||||
import com.coldmint.rust.pro.base.BaseActivity
|
import com.coldmint.rust.pro.base.BaseActivity
|
||||||
import com.coldmint.rust.pro.databinding.ActivitySettingsBinding
|
import com.coldmint.rust.pro.databinding.ActivitySettingsBinding
|
||||||
import com.coldmint.rust.pro.tool.AppSettings
|
import com.coldmint.rust.pro.tool.AppSettings
|
||||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
|
||||||
import com.google.android.material.color.DynamicColors
|
import com.google.android.material.color.DynamicColors
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
@ -35,7 +34,7 @@ class SettingsActivity : BaseActivity<ActivitySettingsBinding>() {
|
||||||
val listPreference =
|
val listPreference =
|
||||||
manager.findPreference<Preference>(getString(R.string.setting_app_language)) as ListPreference?
|
manager.findPreference<Preference>(getString(R.string.setting_app_language)) as ListPreference?
|
||||||
listPreference!!.onPreferenceChangeListener =
|
listPreference!!.onPreferenceChangeListener =
|
||||||
Preference.OnPreferenceChangeListener { preference, newValue ->
|
Preference.OnPreferenceChangeListener { _, newValue ->
|
||||||
val oldLanguage =
|
val oldLanguage =
|
||||||
AppSettings.getValue(
|
AppSettings.getValue(
|
||||||
AppSettings.Setting.AppLanguage,
|
AppSettings.Setting.AppLanguage,
|
||||||
|
@ -51,11 +50,6 @@ class SettingsActivity : BaseActivity<ActivitySettingsBinding>() {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
val english_editing_mode =
|
|
||||||
manager.findPreference<MaterialSwitchPreference>(requireContext().getString(R.string.setting_english_editing_mode))
|
|
||||||
*/
|
|
||||||
|
|
||||||
val customizeEdit = manager.findPreference<Preference>("customize_edit")
|
val customizeEdit = manager.findPreference<Preference>("customize_edit")
|
||||||
customizeEdit!!.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
customizeEdit!!.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||||
val intent = Intent(requireContext(), CustomizeEditTextActivity::class.java)
|
val intent = Intent(requireContext(), CustomizeEditTextActivity::class.java)
|
||||||
|
@ -77,9 +71,13 @@ class SettingsActivity : BaseActivity<ActivitySettingsBinding>() {
|
||||||
dynamicColor?.summary = getString(R.string.dynamic_color_disabled)
|
dynamicColor?.summary = getString(R.string.dynamic_color_disabled)
|
||||||
dynamicColor?.isEnabled = false
|
dynamicColor?.isEnabled = false
|
||||||
}
|
}
|
||||||
dynamicColor?.setOnPreferenceChangeListener { preference, newValue ->
|
dynamicColor?.setOnPreferenceChangeListener { _, newValue ->
|
||||||
if (newValue is Boolean) {
|
if (newValue is Boolean) {
|
||||||
if (AppSettings.getValue(AppSettings.Setting.DynamicColor, DynamicColors.isDynamicColorAvailable()) != newValue) {
|
if (AppSettings.getValue(
|
||||||
|
AppSettings.Setting.DynamicColor,
|
||||||
|
DynamicColors.isDynamicColorAvailable()
|
||||||
|
) != newValue
|
||||||
|
) {
|
||||||
activity?.recreate()
|
activity?.recreate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,12 +91,6 @@ class SettingsActivity : BaseActivity<ActivitySettingsBinding>() {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
// val obtainSourceCode = manager.findPreference<Preference>(requireContext().getString(R.string.setting_obtain_source_code))
|
|
||||||
// obtainSourceCode!!.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
|
||||||
// AppOperator.useBrowserAccessWebPage(requireContext(),"https://github.com/Cold-Mint/RustAssistant")
|
|
||||||
// true
|
|
||||||
// }
|
|
||||||
|
|
||||||
val game = manager.findPreference<Preference>("set_game_pack")
|
val game = manager.findPreference<Preference>("set_game_pack")
|
||||||
game!!.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
game!!.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||||
startActivity(Intent(context, ApplicationListActivity::class.java))
|
startActivity(Intent(context, ApplicationListActivity::class.java))
|
||||||
|
@ -125,13 +117,13 @@ class SettingsActivity : BaseActivity<ActivitySettingsBinding>() {
|
||||||
clearCache!!.onPreferenceClickListener =
|
clearCache!!.onPreferenceClickListener =
|
||||||
Preference.OnPreferenceClickListener {
|
Preference.OnPreferenceClickListener {
|
||||||
val items = ArrayList<String>()
|
val items = ArrayList<String>()
|
||||||
val listData = listOf<String>(
|
val listData = listOf(
|
||||||
getString(R.string.history_cache),
|
getString(R.string.history_cache),
|
||||||
getString(R.string.code_cache),
|
getString(R.string.code_cache),
|
||||||
getString(R.string.glide_cache)
|
getString(R.string.glide_cache)
|
||||||
)
|
)
|
||||||
MaterialAlertDialogBuilder(requireContext()).setTitle(R.string.clear_cache)
|
MaterialAlertDialogBuilder(requireContext()).setTitle(R.string.clear_cache)
|
||||||
.setMultiChoiceItems(listData.toTypedArray(), null) { dialog, index, bool ->
|
.setMultiChoiceItems(listData.toTypedArray(), null) { _, index, bool ->
|
||||||
val string = listData[index]
|
val string = listData[index]
|
||||||
if (bool) {
|
if (bool) {
|
||||||
items.add(string)
|
items.add(string)
|
||||||
|
@ -139,7 +131,7 @@ class SettingsActivity : BaseActivity<ActivitySettingsBinding>() {
|
||||||
items.remove(string)
|
items.remove(string)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.setPositiveButton(R.string.dialog_ok) { i, i2 ->
|
.setPositiveButton(R.string.dialog_ok) { _, _ ->
|
||||||
val handler = Handler(Looper.getMainLooper())
|
val handler = Handler(Looper.getMainLooper())
|
||||||
val job = Job()
|
val job = Job()
|
||||||
val scope = CoroutineScope(job)
|
val scope = CoroutineScope(job)
|
||||||
|
@ -185,15 +177,15 @@ class SettingsActivity : BaseActivity<ActivitySettingsBinding>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}.setNegativeButton(R.string.dialog_cancel) { i, i2 ->
|
}.setNegativeButton(R.string.dialog_cancel) { _, _ ->
|
||||||
}.show()
|
}.show()
|
||||||
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
val nightMode: MaterialSwitchPreference? =
|
val nightMode: MaterialSwitchPreference? =
|
||||||
manager.findPreference<MaterialSwitchPreference>(getString(R.string.setting_night_mode))
|
manager.findPreference(getString(R.string.setting_night_mode))
|
||||||
nightMode?.setOnPreferenceChangeListener { preference, newValue ->
|
nightMode?.setOnPreferenceChangeListener { _, newValue ->
|
||||||
val booleanValue = newValue as Boolean
|
val booleanValue = newValue as Boolean
|
||||||
if (booleanValue) {
|
if (booleanValue) {
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
|
||||||
|
@ -205,8 +197,8 @@ class SettingsActivity : BaseActivity<ActivitySettingsBinding>() {
|
||||||
|
|
||||||
|
|
||||||
val nightModeFollowSystem: MaterialSwitchPreference? =
|
val nightModeFollowSystem: MaterialSwitchPreference? =
|
||||||
manager.findPreference<MaterialSwitchPreference>(getString(R.string.setting_night_mode_follow_system))
|
manager.findPreference(getString(R.string.setting_night_mode_follow_system))
|
||||||
nightModeFollowSystem?.setOnPreferenceChangeListener { preference, newValue ->
|
nightModeFollowSystem?.setOnPreferenceChangeListener { _, newValue ->
|
||||||
if (nightMode != null) {
|
if (nightMode != null) {
|
||||||
val useValue = newValue as Boolean
|
val useValue = newValue as Boolean
|
||||||
nightMode.isEnabled = !useValue
|
nightMode.isEnabled = !useValue
|
||||||
|
@ -218,41 +210,33 @@ class SettingsActivity : BaseActivity<ActivitySettingsBinding>() {
|
||||||
if (nightMode != null && nightModeFollowSystem != null) {
|
if (nightMode != null && nightModeFollowSystem != null) {
|
||||||
nightMode.isEnabled = !nightModeFollowSystem.isChecked
|
nightMode.isEnabled = !nightModeFollowSystem.isChecked
|
||||||
}
|
}
|
||||||
if (!GlobalMethod.isActive) {
|
|
||||||
val editGroup = manager.findPreference<PreferenceCategory>("editGroup")
|
|
||||||
if (editGroup != null) {
|
|
||||||
editGroup.isVisible = false
|
|
||||||
}
|
|
||||||
val gamePackGroup = manager.findPreference<PreferenceCategory>("gamePackGroup")
|
|
||||||
if (gamePackGroup != null) {
|
|
||||||
gamePackGroup.isVisible = false
|
|
||||||
}
|
|
||||||
|
|
||||||
val modGroup = manager.findPreference<PreferenceCategory>("modGroup")
|
val editGroup = manager.findPreference<PreferenceCategory>("editGroup")
|
||||||
if (modGroup != null) {
|
if (editGroup != null) {
|
||||||
modGroup.isVisible = false
|
editGroup.isVisible = false
|
||||||
}
|
}
|
||||||
|
val gamePackGroup = manager.findPreference<PreferenceCategory>("gamePackGroup")
|
||||||
|
if (gamePackGroup != null) {
|
||||||
|
gamePackGroup.isVisible = false
|
||||||
|
}
|
||||||
|
|
||||||
val templateGroup = manager.findPreference<PreferenceCategory>("templateGroup")
|
val modGroup = manager.findPreference<PreferenceCategory>("modGroup")
|
||||||
if (templateGroup != null) {
|
if (modGroup != null) {
|
||||||
templateGroup.isVisible = false
|
modGroup.isVisible = false
|
||||||
}
|
}
|
||||||
val developerModeGroup =
|
|
||||||
manager.findPreference<PreferenceCategory>("developerModeGroup")
|
|
||||||
if (developerModeGroup != null) {
|
|
||||||
developerModeGroup.isVisible = false
|
|
||||||
}
|
|
||||||
|
|
||||||
val useCommunity =
|
val templateGroup = manager.findPreference<PreferenceCategory>("templateGroup")
|
||||||
manager.findPreference<MaterialSwitchPreference>(getString(R.string.setting_use_the_community_as_the_launch_page))
|
if (templateGroup != null) {
|
||||||
if (useCommunity != null) {
|
templateGroup.isVisible = false
|
||||||
useCommunity.isVisible = false
|
}
|
||||||
}
|
val developerModeGroup =
|
||||||
|
manager.findPreference<PreferenceCategory>("developerModeGroup")
|
||||||
val mapGroup = manager.findPreference<PreferenceCategory>("mapGroup")
|
if (developerModeGroup != null) {
|
||||||
if (mapGroup != null) {
|
developerModeGroup.isVisible = false
|
||||||
mapGroup.isVisible = false
|
}
|
||||||
}
|
val mapGroup = manager.findPreference<PreferenceCategory>("mapGroup")
|
||||||
|
if (mapGroup != null) {
|
||||||
|
mapGroup.isVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -264,17 +248,17 @@ class SettingsActivity : BaseActivity<ActivitySettingsBinding>() {
|
||||||
|
|
||||||
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
|
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
|
||||||
if (canUseView) {
|
if (canUseView) {
|
||||||
this.getTheme().applyStyle(
|
this.theme.applyStyle(
|
||||||
rikka.material.preference.R.style.ThemeOverlay_Rikka_Material3_Preference,
|
rikka.material.preference.R.style.ThemeOverlay_Rikka_Material3_Preference,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
title = getString(R.string.set_up)
|
title = getString(R.string.set_up)
|
||||||
setReturnButton()
|
setReturnButton()
|
||||||
val settingsFragment = SettingsFragment()
|
supportFragmentManager.beginTransaction().apply {
|
||||||
supportFragmentManager
|
val settingsFragment = SettingsFragment()
|
||||||
.beginTransaction()
|
replace(R.id.settings, settingsFragment)
|
||||||
.replace(R.id.settings, settingsFragment)
|
commit()
|
||||||
.commit()
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,523 +0,0 @@
|
||||||
package com.coldmint.rust.pro
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Intent
|
|
||||||
import android.graphics.Color
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
|
||||||
import androidx.core.view.isVisible
|
|
||||||
import com.bumptech.glide.Glide
|
|
||||||
import com.coldmint.dialog.CoreDialog
|
|
||||||
import com.coldmint.rust.core.dataBean.ApiResponse
|
|
||||||
import com.coldmint.rust.core.dataBean.user.SpaceInfoData
|
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
|
||||||
import com.coldmint.rust.core.tool.DebugHelper
|
|
||||||
import com.coldmint.rust.core.web.*
|
|
||||||
import com.coldmint.rust.pro.adapters.UserHomeStateAdapter
|
|
||||||
import com.coldmint.rust.pro.base.BaseActivity
|
|
||||||
import com.coldmint.rust.pro.databinding.ActivityUserHomePageBinding
|
|
||||||
import com.coldmint.rust.pro.dialog.CommentDialog
|
|
||||||
import com.coldmint.rust.pro.tool.AnimUtil
|
|
||||||
import com.coldmint.rust.pro.tool.AppSettings
|
|
||||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
|
||||||
import com.google.android.material.appbar.CollapsingToolbarLayout
|
|
||||||
import com.google.android.material.snackbar.Snackbar
|
|
||||||
import com.google.android.material.tabs.TabLayout
|
|
||||||
import com.google.android.material.tabs.TabLayoutMediator
|
|
||||||
import com.gyf.immersionbar.ImmersionBar
|
|
||||||
import kotlin.math.abs
|
|
||||||
|
|
||||||
|
|
||||||
class UserHomePageActivity : BaseActivity<ActivityUserHomePageBinding>() {
|
|
||||||
|
|
||||||
lateinit var userId: String
|
|
||||||
var account: String? = null
|
|
||||||
var userName: String? = null
|
|
||||||
var fans: Int = 0
|
|
||||||
val userHomeStateAdapter by lazy {
|
|
||||||
UserHomeStateAdapter(this, userId)
|
|
||||||
}
|
|
||||||
var needShowFab = false
|
|
||||||
|
|
||||||
//旧的备份数据
|
|
||||||
var oldSpaceInfoData: SpaceInfoData? = null
|
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
|
||||||
private fun initView() {
|
|
||||||
if (ImmersionBar.hasNavigationBar(this)) {
|
|
||||||
val layoutParams =
|
|
||||||
viewBinding.fab.layoutParams as CoordinatorLayout.LayoutParams
|
|
||||||
layoutParams.setMargins(
|
|
||||||
GlobalMethod.dp2px(16),
|
|
||||||
GlobalMethod.dp2px(16),
|
|
||||||
GlobalMethod.dp2px(16),
|
|
||||||
ImmersionBar.getNavigationBarHeight(this) + GlobalMethod.dp2px(16)
|
|
||||||
)
|
|
||||||
DebugHelper.printLog("导航适配", "已调整fab按钮的位置。")
|
|
||||||
}
|
|
||||||
val s = ImmersionBar.getStatusBarHeight(this)
|
|
||||||
val layoutParams =
|
|
||||||
viewBinding.toolbar.layoutParams as CollapsingToolbarLayout.LayoutParams
|
|
||||||
layoutParams.setMargins(
|
|
||||||
0,
|
|
||||||
s,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
|
|
||||||
val thisIntent = intent
|
|
||||||
val temUserId = thisIntent.getStringExtra("userId")
|
|
||||||
if (temUserId == null) {
|
|
||||||
showError("请传入用户id")
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
userId = temUserId
|
|
||||||
}
|
|
||||||
|
|
||||||
val temAccount = AppSettings.getValue(AppSettings.Setting.Account, "")
|
|
||||||
if (temAccount.isNotBlank()) {
|
|
||||||
account = temAccount
|
|
||||||
}
|
|
||||||
viewBinding.toolbar.title = ""
|
|
||||||
setReturnButton()
|
|
||||||
viewBinding.followLayout.setOnClickListener {
|
|
||||||
openUserList(userId, true)
|
|
||||||
|
|
||||||
}
|
|
||||||
viewBinding.fansLayout.setOnClickListener {
|
|
||||||
openUserList(userId, false)
|
|
||||||
}
|
|
||||||
initButton()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 打开用户列表
|
|
||||||
* @param account String 账号
|
|
||||||
* @param isFollowMode Boolean 是否加载偶像
|
|
||||||
*/
|
|
||||||
fun openUserList(account: String, isFollowMode: Boolean) {
|
|
||||||
val bundle = Bundle()
|
|
||||||
bundle.putString("account", account)
|
|
||||||
bundle.putBoolean("isFollowMode", isFollowMode)
|
|
||||||
val intent = Intent(this, UserListActivity::class.java)
|
|
||||||
intent.putExtra("data", bundle)
|
|
||||||
startActivity(intent)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化按钮
|
|
||||||
*/
|
|
||||||
private fun initButton() {
|
|
||||||
if (account == null) {
|
|
||||||
viewBinding.button.text = getString(R.string.please_login_first)
|
|
||||||
viewBinding.button.isEnabled = false
|
|
||||||
} else {
|
|
||||||
if (account == userId) {
|
|
||||||
viewBinding.button.text = getString(R.string.editData)
|
|
||||||
} else {
|
|
||||||
Community.getFollowState(account!!, userId, object : ApiCallBack<ApiResponse> {
|
|
||||||
override fun onResponse(t: ApiResponse) {
|
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
|
||||||
val data = t.data
|
|
||||||
if (data != null && ServerConfiguration.isEvent(data)) {
|
|
||||||
when (data) {
|
|
||||||
"@event:已互粉" -> {
|
|
||||||
viewBinding.button.text =
|
|
||||||
getString(R.string.each_other_follow)
|
|
||||||
}
|
|
||||||
"@event:已关注" -> {
|
|
||||||
viewBinding.button.text = getString(R.string.followed)
|
|
||||||
}
|
|
||||||
"@event:关注" -> {
|
|
||||||
viewBinding.button.text = getString(R.string.follow)
|
|
||||||
}
|
|
||||||
"@event:拒绝关注" -> {
|
|
||||||
viewBinding.button.text = getString(R.string.reject_follow)
|
|
||||||
viewBinding.button.isEnabled = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 展示用户数据到视图
|
|
||||||
* @param spaceInfoData SpaceInfoData
|
|
||||||
*/
|
|
||||||
fun showUserdataIfNeed(spaceInfoData: SpaceInfoData) {
|
|
||||||
var isFirst = false
|
|
||||||
if (oldSpaceInfoData == null) {
|
|
||||||
isFirst = true
|
|
||||||
oldSpaceInfoData = spaceInfoData
|
|
||||||
} else {
|
|
||||||
if (oldSpaceInfoData == spaceInfoData) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
userName = spaceInfoData.data.userName
|
|
||||||
|
|
||||||
viewBinding.appBar.addOnOffsetChangedListener { appBarLayout, verticalOffset ->
|
|
||||||
viewBinding.toolbar.title =
|
|
||||||
if ((abs(verticalOffset) >= appBarLayout.totalScrollRange)) {
|
|
||||||
spaceInfoData.data.userName
|
|
||||||
} else {
|
|
||||||
""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
viewBinding.nameView.text = spaceInfoData.data.userName
|
|
||||||
viewBinding.describeView.text =
|
|
||||||
spaceInfoData.data.introduce ?: getString(R.string.defaultIntroduced)
|
|
||||||
viewBinding.loginTimeView.text = String.format(
|
|
||||||
getString(R.string.user_info),
|
|
||||||
spaceInfoData.data.loginTime,
|
|
||||||
spaceInfoData.data.location
|
|
||||||
)
|
|
||||||
|
|
||||||
viewBinding.fab.isVisible = true
|
|
||||||
|
|
||||||
val gender = spaceInfoData.data.gender
|
|
||||||
if (gender > 0) {
|
|
||||||
Glide.with(application).load(R.drawable.boy).apply(GlobalMethod.getRequestOptions())
|
|
||||||
.into(viewBinding.genderView)
|
|
||||||
} else {
|
|
||||||
Glide.with(application).load(R.drawable.girl).apply(GlobalMethod.getRequestOptions())
|
|
||||||
.into(viewBinding.genderView)
|
|
||||||
}
|
|
||||||
|
|
||||||
when (spaceInfoData.data.permission) {
|
|
||||||
1 -> {
|
|
||||||
viewBinding.cardView.isVisible = true
|
|
||||||
viewBinding.cardView.setCardBackgroundColor(Color.parseColor("#f47920"))
|
|
||||||
viewBinding.positionView.setText(R.string.super_admin)
|
|
||||||
}
|
|
||||||
2 -> {
|
|
||||||
viewBinding.cardView.isVisible = true
|
|
||||||
viewBinding.cardView.setCardBackgroundColor(Color.parseColor("#ffd400"))
|
|
||||||
viewBinding.positionView.setText(R.string.admin)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
if (spaceInfoData.data.expirationTime == ServerConfiguration.ForeverTime) {
|
|
||||||
viewBinding.cardView.isVisible = true
|
|
||||||
viewBinding.cardView.setCardBackgroundColor(Color.parseColor("#33a3dc"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val icon = spaceInfoData.data.headIcon
|
|
||||||
if (icon != null) {
|
|
||||||
val iconLink = ServerConfiguration.getRealLink(icon)
|
|
||||||
Glide.with(this@UserHomePageActivity).load(iconLink)
|
|
||||||
.apply(GlobalMethod.getRequestOptions(true))
|
|
||||||
.into(viewBinding.headIconView)
|
|
||||||
}
|
|
||||||
|
|
||||||
val cover = spaceInfoData.data.cover
|
|
||||||
if (cover != null) {
|
|
||||||
Glide.with(this).load(ServerConfiguration.getRealLink(cover))
|
|
||||||
.into(viewBinding.coverView)
|
|
||||||
Glide.with(this).load(ServerConfiguration.getRealLink(cover))
|
|
||||||
.into(viewBinding.fullCoverView)
|
|
||||||
}
|
|
||||||
|
|
||||||
viewBinding.viewPager.adapter = userHomeStateAdapter
|
|
||||||
|
|
||||||
|
|
||||||
viewBinding.coverView.setOnClickListener {
|
|
||||||
if (cover == null) {
|
|
||||||
return@setOnClickListener
|
|
||||||
}
|
|
||||||
viewBinding.coverView.visibility = View.INVISIBLE
|
|
||||||
AnimUtil.doAnim(
|
|
||||||
this,
|
|
||||||
R.anim.overall_drop,
|
|
||||||
listOf(viewBinding.appBar, viewBinding.viewPager)
|
|
||||||
) { views ->
|
|
||||||
views.forEach {
|
|
||||||
it.isVisible = false
|
|
||||||
}
|
|
||||||
needShowFab = viewBinding.fab.isShown
|
|
||||||
if (needShowFab) {
|
|
||||||
viewBinding.fab.hide()
|
|
||||||
}
|
|
||||||
viewBinding.fullCoverView.isVisible = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
viewBinding.fullCoverView.setOnClickListener {
|
|
||||||
if (cover == null) {
|
|
||||||
return@setOnClickListener
|
|
||||||
}
|
|
||||||
viewBinding.fullCoverView.isVisible = false
|
|
||||||
AnimUtil.doAnim(
|
|
||||||
this,
|
|
||||||
R.anim.overall_up,
|
|
||||||
listOf(viewBinding.appBar, viewBinding.viewPager)
|
|
||||||
) { views ->
|
|
||||||
views.forEach {
|
|
||||||
it.isVisible = true
|
|
||||||
}
|
|
||||||
if (needShowFab) {
|
|
||||||
viewBinding.fab.show()
|
|
||||||
}
|
|
||||||
viewBinding.coverView.isVisible = true
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fans = spaceInfoData.data.fans
|
|
||||||
viewBinding.fansNumView.text = ServerConfiguration.numberToString(spaceInfoData.data.fans)
|
|
||||||
viewBinding.followNumView.text =
|
|
||||||
ServerConfiguration.numberToString(spaceInfoData.data.follower)
|
|
||||||
viewBinding.praiseNumView.text =
|
|
||||||
ServerConfiguration.numberToString(spaceInfoData.data.praise)
|
|
||||||
|
|
||||||
if (isFirst) {
|
|
||||||
TabLayoutMediator(viewBinding.tabLayout, viewBinding.viewPager) { tab, position ->
|
|
||||||
when (position) {
|
|
||||||
0 ->
|
|
||||||
tab.text = getString(R.string.homepage)
|
|
||||||
else -> {
|
|
||||||
tab.text = getString(R.string.dynamic)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.attach()
|
|
||||||
viewBinding.fab.hide()
|
|
||||||
viewBinding.tabLayout.addOnTabSelectedListener(object :
|
|
||||||
TabLayout.OnTabSelectedListener {
|
|
||||||
override fun onTabSelected(tab: TabLayout.Tab?) {
|
|
||||||
if (tab != null) {
|
|
||||||
val tiltle = tab.text
|
|
||||||
val dynamic = getString(R.string.dynamic)
|
|
||||||
if (dynamic == tiltle && userId == account) {
|
|
||||||
viewBinding.fab.show()
|
|
||||||
} else {
|
|
||||||
viewBinding.fab.hide()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onTabUnselected(tab: TabLayout.Tab?) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onTabReselected(tab: TabLayout.Tab?) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
User.getSpaceInfo(userId, object : ApiCallBack<SpaceInfoData> {
|
|
||||||
override fun onResponse(t: SpaceInfoData) {
|
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
|
||||||
showUserdataIfNeed(t)
|
|
||||||
} else {
|
|
||||||
showError(t.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
showInternetError(null, e)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 获取状态栏高度
|
|
||||||
// * @param context Context
|
|
||||||
// * @return Int
|
|
||||||
// */
|
|
||||||
// fun statusBarHeight(context: Context): Int {
|
|
||||||
// var height = 0
|
|
||||||
// val res = context.resources
|
|
||||||
// val resId = res.getIdentifier("status_bar_height", "dimen", "android")
|
|
||||||
// if (resId > 0) {
|
|
||||||
// height = res.getDimensionPixelSize(resId)
|
|
||||||
// }
|
|
||||||
// return height
|
|
||||||
// }
|
|
||||||
|
|
||||||
private fun initAction() {
|
|
||||||
viewBinding.fab.setOnClickListener {
|
|
||||||
CommentDialog(this).setTitle(R.string.send_dynamic).setCancelable(false)
|
|
||||||
.setSubmitFun { button, textInputLayout, s, alertDialog ->
|
|
||||||
val token =
|
|
||||||
AppSettings.getValue(AppSettings.Setting.Token, "")
|
|
||||||
if (!s.isBlank()) {
|
|
||||||
Dynamic.instance.send(
|
|
||||||
token,
|
|
||||||
s,
|
|
||||||
object : ApiCallBack<ApiResponse> {
|
|
||||||
override fun onResponse(t: ApiResponse) {
|
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
|
||||||
alertDialog.dismiss()
|
|
||||||
Snackbar.make(
|
|
||||||
viewBinding.button,
|
|
||||||
R.string.release_ok,
|
|
||||||
Snackbar.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
userHomeStateAdapter.updataDynamicList()
|
|
||||||
} else {
|
|
||||||
Snackbar.make(
|
|
||||||
viewBinding.button,
|
|
||||||
t.message,
|
|
||||||
Snackbar.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
showInternetError(viewBinding.button, e)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}.show()
|
|
||||||
// MaterialDialog(this, BottomSheet(LayoutMode.WRAP_CONTENT)).show {
|
|
||||||
// input(maxLength = 255).title()
|
|
||||||
// .positiveButton(R.string.dialog_ok)
|
|
||||||
// .positiveButton {
|
|
||||||
// val inputField: EditText = it.getInputField()
|
|
||||||
// val text = inputField.text.toString()
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }.negativeButton(R.string.dialog_cancel)
|
|
||||||
//
|
|
||||||
// val editText = this.getInputField()
|
|
||||||
// editText.inputType =
|
|
||||||
// EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE
|
|
||||||
// editText.minLines = 3
|
|
||||||
// editText.gravity = Gravity.TOP
|
|
||||||
// editText.isSingleLine = false
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
viewBinding.button.setOnClickListener {
|
|
||||||
when (val type = viewBinding.button.text.toString()) {
|
|
||||||
getString(R.string.follow) -> {
|
|
||||||
viewBinding.button.setBackgroundColor(
|
|
||||||
GlobalMethod.getThemeColor(
|
|
||||||
this,
|
|
||||||
R.attr.colorPrimaryVariant
|
|
||||||
)
|
|
||||||
)
|
|
||||||
viewBinding.button.setText(R.string.request_data)
|
|
||||||
Community.follow(account!!, userId, object : ApiCallBack<ApiResponse> {
|
|
||||||
override fun onResponse(t: ApiResponse) {
|
|
||||||
viewBinding.button.setBackgroundColor(
|
|
||||||
GlobalMethod.getColorPrimary(
|
|
||||||
this@UserHomePageActivity
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
|
||||||
fans++
|
|
||||||
viewBinding.fansNumView.text =
|
|
||||||
ServerConfiguration.numberToString(fans)
|
|
||||||
viewBinding.button.text = getString(R.string.followed)
|
|
||||||
} else {
|
|
||||||
viewBinding.button.text = type
|
|
||||||
Snackbar.make(
|
|
||||||
viewBinding.button,
|
|
||||||
t.message,
|
|
||||||
Snackbar.LENGTH_SHORT
|
|
||||||
)
|
|
||||||
.show()
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
showInternetError(viewBinding.button, e)
|
|
||||||
viewBinding.button.setBackgroundColor(
|
|
||||||
GlobalMethod.getColorPrimary(
|
|
||||||
this@UserHomePageActivity
|
|
||||||
)
|
|
||||||
)
|
|
||||||
viewBinding.button.text = type
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
getString(R.string.followed), getString(R.string.each_other_follow) -> {
|
|
||||||
val de = String.format(getString(R.string.defollow_tip), userName ?: userId)
|
|
||||||
CoreDialog(this).setTitle(R.string.defollow).setMessage(de)
|
|
||||||
.setPositiveButton(R.string.dialog_ok) {
|
|
||||||
viewBinding.button.setBackgroundColor(
|
|
||||||
GlobalMethod.getThemeColor(
|
|
||||||
this@UserHomePageActivity,
|
|
||||||
R.attr.colorPrimaryVariant
|
|
||||||
)
|
|
||||||
)
|
|
||||||
viewBinding.button.setText(R.string.request_data)
|
|
||||||
Community.deFollow(
|
|
||||||
account!!,
|
|
||||||
userId,
|
|
||||||
object : ApiCallBack<ApiResponse> {
|
|
||||||
override fun onResponse(t: ApiResponse) {
|
|
||||||
viewBinding.button.setBackgroundColor(
|
|
||||||
GlobalMethod.getColorPrimary(
|
|
||||||
this@UserHomePageActivity
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
|
||||||
fans--
|
|
||||||
viewBinding.fansNumView.text =
|
|
||||||
ServerConfiguration.numberToString(fans)
|
|
||||||
viewBinding.button.text =
|
|
||||||
getString(R.string.follow)
|
|
||||||
} else {
|
|
||||||
Snackbar.make(
|
|
||||||
viewBinding.button,
|
|
||||||
t.message,
|
|
||||||
Snackbar.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
viewBinding.button.text = type
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
showInternetError(viewBinding.button, e)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}.setNegativeButton(R.string.dialog_cancel) {
|
|
||||||
|
|
||||||
}.show()
|
|
||||||
}
|
|
||||||
getString(R.string.editData) -> {
|
|
||||||
val intent = Intent(this, EditUserInfoActivity::class.java)
|
|
||||||
intent.putExtra("userId", userId)
|
|
||||||
startActivity(intent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivityUserHomePageBinding {
|
|
||||||
return ActivityUserHomePageBinding.inflate(layoutInflater)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
|
|
||||||
if (canUseView) {
|
|
||||||
initView()
|
|
||||||
initAction()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -100,14 +100,6 @@ class UserListActivity : BaseActivity<ActivityUserListBinding>() {
|
||||||
|
|
||||||
adapter.setItemEvent { i, itemUserBinding, viewHolder, data ->
|
adapter.setItemEvent { i, itemUserBinding, viewHolder, data ->
|
||||||
itemUserBinding.root.setOnClickListener {
|
itemUserBinding.root.setOnClickListener {
|
||||||
val intent = Intent(
|
|
||||||
this@UserListActivity,
|
|
||||||
UserHomePageActivity::class.java
|
|
||||||
)
|
|
||||||
intent.putExtra("userId", data.account)
|
|
||||||
startActivity(
|
|
||||||
intent
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
if (canRemoveFans) {
|
if (canRemoveFans) {
|
||||||
itemUserBinding.actionView.isVisible = true
|
itemUserBinding.actionView.isVisible = true
|
||||||
|
|
|
@ -44,7 +44,7 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
|
||||||
File(modFilePath)
|
File(modFilePath)
|
||||||
}
|
}
|
||||||
val token by lazy {
|
val token by lazy {
|
||||||
AppSettings.getValue(AppSettings.Setting.Token, "")
|
""
|
||||||
}
|
}
|
||||||
lateinit var adapter: ModPageDetailsAdapter
|
lateinit var adapter: ModPageDetailsAdapter
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.share_item -> {
|
R.id.share_item -> {
|
||||||
val link = AppSettings.getValue(AppSettings.Setting.ServerAddress, "")
|
val link = ""
|
||||||
val updateData = AppSettings.getValue(AppSettings.Setting.UpdateData, "")
|
val updateData = AppSettings.getValue(AppSettings.Setting.UpdateData, "")
|
||||||
var appUpdateLink = ""
|
var appUpdateLink = ""
|
||||||
if (updateData.isNotBlank()) {
|
if (updateData.isNotBlank()) {
|
||||||
|
@ -357,20 +357,6 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 打开用户主页
|
|
||||||
* @param userId String
|
|
||||||
*/
|
|
||||||
fun gotoUserPage(userId: String) {
|
|
||||||
val intent = Intent(
|
|
||||||
this@WebModInfoActivity,
|
|
||||||
UserHomePageActivity::class.java
|
|
||||||
)
|
|
||||||
intent.putExtra("userId", userId)
|
|
||||||
startActivity(
|
|
||||||
intent
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// private fun initAction() {
|
// private fun initAction() {
|
||||||
// viewBinding.sendDiscussion.setOnClickListener {
|
// viewBinding.sendDiscussion.setOnClickListener {
|
||||||
|
|
|
@ -89,6 +89,7 @@ class WorkManagementActivity : BaseActivity<ActivityWorkmangementBinding>() {
|
||||||
popupMenu.menu.add(R.string.work_of_home_page)
|
popupMenu.menu.add(R.string.work_of_home_page)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -109,23 +110,17 @@ class WorkManagementActivity : BaseActivity<ActivityWorkmangementBinding>() {
|
||||||
intent.putExtra("data", bundle)
|
intent.putExtra("data", bundle)
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.update_record) -> {
|
getString(R.string.update_record) -> {
|
||||||
GlobalMethod.showUpdateLog(
|
GlobalMethod.showUpdateLog(
|
||||||
this@WorkManagementActivity,
|
this@WorkManagementActivity,
|
||||||
data.id
|
data.id
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.submit_the_update) -> {
|
getString(R.string.submit_the_update) -> {
|
||||||
val intent = Intent(
|
|
||||||
this@WorkManagementActivity,
|
|
||||||
ReleaseModActivity::class.java
|
|
||||||
)
|
|
||||||
val bundle = Bundle()
|
|
||||||
bundle.putString("mode", "loadMode")
|
|
||||||
bundle.putString("modId", data.id)
|
|
||||||
intent.putExtra("data", bundle)
|
|
||||||
startActivity(intent)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.sold_out_mod) -> {
|
getString(R.string.sold_out_mod) -> {
|
||||||
CoreDialog(this@WorkManagementActivity).setTitle(
|
CoreDialog(this@WorkManagementActivity).setTitle(
|
||||||
R.string.sold_out_mod
|
R.string.sold_out_mod
|
||||||
|
@ -141,7 +136,9 @@ class WorkManagementActivity : BaseActivity<ActivityWorkmangementBinding>() {
|
||||||
) {
|
) {
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
if (t.code == ServerConfiguration.Success_Code) {
|
||||||
data.hidden = -1
|
data.hidden = -1
|
||||||
adapter.notifyItemChanged(i)
|
adapter.notifyItemChanged(
|
||||||
|
i
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
Snackbar.make(
|
Snackbar.make(
|
||||||
viewBinding.recyclerView,
|
viewBinding.recyclerView,
|
||||||
|
@ -165,6 +162,7 @@ class WorkManagementActivity : BaseActivity<ActivityWorkmangementBinding>() {
|
||||||
}
|
}
|
||||||
.setCancelable(false).show()
|
.setCancelable(false).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.review_audit) -> {
|
getString(R.string.review_audit) -> {
|
||||||
CoreDialog(this@WorkManagementActivity).setTitle(
|
CoreDialog(this@WorkManagementActivity).setTitle(
|
||||||
R.string.review_audit
|
R.string.review_audit
|
||||||
|
@ -174,38 +172,7 @@ class WorkManagementActivity : BaseActivity<ActivityWorkmangementBinding>() {
|
||||||
data.name
|
data.name
|
||||||
)
|
)
|
||||||
).setPositiveButton(R.string.dialog_ok) {
|
).setPositiveButton(R.string.dialog_ok) {
|
||||||
WebMod.instance.afreshAuditMod(
|
|
||||||
AppSettings
|
|
||||||
.getValue(
|
|
||||||
AppSettings.Setting.Token,
|
|
||||||
""
|
|
||||||
),
|
|
||||||
data.id,
|
|
||||||
object :
|
|
||||||
ApiCallBack<ApiResponse> {
|
|
||||||
override fun onResponse(
|
|
||||||
t: ApiResponse
|
|
||||||
) {
|
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
|
||||||
data.hidden = 1
|
|
||||||
adapter.notifyItemChanged(i)
|
|
||||||
} else {
|
|
||||||
Snackbar.make(
|
|
||||||
viewBinding.recyclerView,
|
|
||||||
t.message,
|
|
||||||
Snackbar.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
|
||||||
showInternetError(
|
|
||||||
view = viewBinding.recyclerView,
|
|
||||||
exception = e
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}.setNegativeButton(R.string.dialog_cancel) {
|
}.setNegativeButton(R.string.dialog_cancel) {
|
||||||
|
|
||||||
}.setCancelable(false).show()
|
}.setCancelable(false).show()
|
||||||
|
|
|
@ -208,18 +208,7 @@ class ModActionAdapter(
|
||||||
* 点击了发布
|
* 点击了发布
|
||||||
*/
|
*/
|
||||||
private fun releaseItem() {
|
private fun releaseItem() {
|
||||||
val releaseBundle = Bundle()
|
|
||||||
val modId = modConfigurationData?.modId
|
|
||||||
releaseBundle.putString("modPath", mModpath)
|
|
||||||
if (modId == null) {
|
|
||||||
releaseBundle.putString("mode", "firstReleaseMode")
|
|
||||||
} else {
|
|
||||||
releaseBundle.putString("mode", "loadMode")
|
|
||||||
releaseBundle.putString("modId", modId)
|
|
||||||
}
|
|
||||||
val intent = Intent(mContext, ReleaseModActivity::class.java)
|
|
||||||
intent.putExtra("data", releaseBundle)
|
|
||||||
mContext.startActivity(intent)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -15,7 +15,6 @@ import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||||
import com.coldmint.rust.core.web.Report
|
import com.coldmint.rust.core.web.Report
|
||||||
import com.coldmint.rust.core.web.ServerConfiguration
|
import com.coldmint.rust.core.web.ServerConfiguration
|
||||||
import com.coldmint.rust.pro.R
|
import com.coldmint.rust.pro.R
|
||||||
import com.coldmint.rust.pro.UserHomePageActivity
|
|
||||||
import com.coldmint.rust.pro.WebModInfoActivity
|
import com.coldmint.rust.pro.WebModInfoActivity
|
||||||
import com.coldmint.rust.pro.base.BaseAdapter
|
import com.coldmint.rust.pro.base.BaseAdapter
|
||||||
import com.coldmint.rust.pro.databinding.ItemReportBinding
|
import com.coldmint.rust.pro.databinding.ItemReportBinding
|
||||||
|
@ -71,12 +70,6 @@ class ReportAdapter(
|
||||||
}
|
}
|
||||||
"user" -> {
|
"user" -> {
|
||||||
viewBinding.typeView.setText(R.string.report_user)
|
viewBinding.typeView.setText(R.string.report_user)
|
||||||
viewBinding.openView.setOnClickListener {
|
|
||||||
val intent = Intent(context, UserHomePageActivity::class.java)
|
|
||||||
intent.putExtra("userId", data.target)
|
|
||||||
context.startActivity(intent)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
viewBinding.textview.text = data.why
|
viewBinding.textview.text = data.why
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
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.dataBean.user.SearchResultDataBean
|
|
||||||
import com.coldmint.rust.pro.fragments.SearchResultFragment
|
|
||||||
|
|
||||||
class SearchPageAdapter(
|
|
||||||
fragmentActivity: FragmentActivity, val keyword: String,
|
|
||||||
val data: SearchResultDataBean.Data
|
|
||||||
) : FragmentStateAdapter(fragmentActivity) {
|
|
||||||
|
|
||||||
|
|
||||||
override fun getItemCount(): Int {
|
|
||||||
return data.type.size + 1
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun createFragment(position: Int): Fragment {
|
|
||||||
val typeName = if (position == 0) {
|
|
||||||
"all"
|
|
||||||
} else {
|
|
||||||
data.type[position - 1].typeName
|
|
||||||
}
|
|
||||||
return SearchResultFragment(keyword, data, typeName)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,104 +0,0 @@
|
||||||
package com.coldmint.rust.pro.adapters
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.core.view.isVisible
|
|
||||||
import com.bumptech.glide.Glide
|
|
||||||
import com.coldmint.rust.core.dataBean.user.SearchResultDataBean
|
|
||||||
import com.coldmint.rust.core.web.ServerConfiguration
|
|
||||||
import com.coldmint.rust.pro.R
|
|
||||||
import com.coldmint.rust.pro.UserHomePageActivity
|
|
||||||
import com.coldmint.rust.pro.WebModInfoActivity
|
|
||||||
import com.coldmint.rust.pro.base.BaseAdapter
|
|
||||||
import com.coldmint.rust.pro.databinding.ItemSearchResultBinding
|
|
||||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
|
||||||
import com.coldmint.rust.pro.tool.TextStyleMaker
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 搜索结果适配器
|
|
||||||
* @property context Context
|
|
||||||
* @property iconOptions RequestOptions
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
class SearchResultAdapter(
|
|
||||||
context: Context,
|
|
||||||
val keyWord: String,
|
|
||||||
dataList: MutableList<SearchResultDataBean.Data.Total>
|
|
||||||
) :
|
|
||||||
BaseAdapter<ItemSearchResultBinding, SearchResultDataBean.Data.Total>(context, dataList) {
|
|
||||||
|
|
||||||
|
|
||||||
override fun getViewBindingObject(
|
|
||||||
layoutInflater: LayoutInflater,
|
|
||||||
parent: ViewGroup,
|
|
||||||
viewType: Int
|
|
||||||
): ItemSearchResultBinding {
|
|
||||||
return ItemSearchResultBinding.inflate(layoutInflater, parent, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBingView(
|
|
||||||
data: SearchResultDataBean.Data.Total,
|
|
||||||
viewBinding: ItemSearchResultBinding,
|
|
||||||
viewHolder: ViewHolder<ItemSearchResultBinding>,
|
|
||||||
position: Int
|
|
||||||
) {
|
|
||||||
val finalIcon = data.icon
|
|
||||||
viewBinding.imageView.isVisible = true
|
|
||||||
if (finalIcon != null && finalIcon.isNotBlank()) {
|
|
||||||
if (data.type == "user") {
|
|
||||||
Glide.with(context).load(ServerConfiguration.getRealLink(finalIcon))
|
|
||||||
.apply(GlobalMethod.getRequestOptions(true)).into(viewBinding.imageView)
|
|
||||||
} else {
|
|
||||||
Glide.with(context).load(ServerConfiguration.getRealLink(finalIcon)).apply(GlobalMethod.getRequestOptions())
|
|
||||||
.into(viewBinding.imageView)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (data.type == "user"){
|
|
||||||
viewBinding.imageView.setImageResource(R.drawable.head_icon)
|
|
||||||
}else if (data.type == "mod"){
|
|
||||||
viewBinding.imageView.setImageResource(R.drawable.image)
|
|
||||||
}else{
|
|
||||||
viewBinding.imageView.isVisible = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
viewBinding.titleView.text = data.title
|
|
||||||
val index = data.content.indexOf('\n')
|
|
||||||
val thisContext = if (index > -1 && data.type == "mod") {
|
|
||||||
data.content.subSequence(0, index)
|
|
||||||
} else {
|
|
||||||
data.content
|
|
||||||
}.toString()
|
|
||||||
TextStyleMaker.instance.load(viewBinding.contentView, thisContext) { type, da ->
|
|
||||||
TextStyleMaker.instance.clickEvent(context, type, da)
|
|
||||||
}
|
|
||||||
viewBinding.root.setOnClickListener {
|
|
||||||
val type = data.type
|
|
||||||
when (type) {
|
|
||||||
"mod", "mod_comments", "mod_versions" -> {
|
|
||||||
val bundle = Bundle()
|
|
||||||
bundle.putString("modId", data.id)
|
|
||||||
val intent = Intent(
|
|
||||||
context,
|
|
||||||
WebModInfoActivity::class.java
|
|
||||||
)
|
|
||||||
intent.putExtra("data", bundle)
|
|
||||||
context.startActivity(intent)
|
|
||||||
}
|
|
||||||
"user", "dynamic" -> {
|
|
||||||
val intent = Intent(
|
|
||||||
context,
|
|
||||||
UserHomePageActivity::class.java
|
|
||||||
)
|
|
||||||
intent.putExtra("userId", data.id)
|
|
||||||
context.startActivity(
|
|
||||||
intent
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
package com.coldmint.rust.pro.adapters
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import com.coldmint.rust.pro.base.BaseAdapter
|
|
||||||
import com.coldmint.rust.pro.databinding.ItemSearchSuggestionsBinding
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 搜索建议适配器
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
class SearchSuggestionsAdapter(
|
|
||||||
context: Context,
|
|
||||||
val keyword: String,
|
|
||||||
dataList: MutableList<String>
|
|
||||||
) :
|
|
||||||
BaseAdapter<ItemSearchSuggestionsBinding, String>(context, dataList) {
|
|
||||||
override fun getViewBindingObject(
|
|
||||||
layoutInflater: LayoutInflater,
|
|
||||||
parent: ViewGroup,
|
|
||||||
viewType: Int
|
|
||||||
): ItemSearchSuggestionsBinding {
|
|
||||||
return ItemSearchSuggestionsBinding.inflate(layoutInflater, parent, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBingView(
|
|
||||||
data: String,
|
|
||||||
viewBinding: ItemSearchSuggestionsBinding,
|
|
||||||
viewHolder: ViewHolder<ItemSearchSuggestionsBinding>,
|
|
||||||
position: Int
|
|
||||||
) {
|
|
||||||
viewBinding.titleView.text = createSpannableString(data,keyword)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,17 +1,13 @@
|
||||||
package com.coldmint.rust.pro.adapters
|
package com.coldmint.rust.pro.adapters
|
||||||
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import com.coldmint.rust.pro.R
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import androidx.core.content.ContentProviderCompat.requireContext
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
import com.afollestad.materialdialogs.MaterialDialog
|
||||||
import com.coldmint.dialog.CoreDialog
|
import com.coldmint.dialog.CoreDialog
|
||||||
import com.coldmint.rust.core.CompressionManager
|
import com.coldmint.rust.core.CompressionManager
|
||||||
|
@ -19,8 +15,8 @@ import com.coldmint.rust.core.LocalTemplatePackage
|
||||||
import com.coldmint.rust.core.interfaces.CompressionListener
|
import com.coldmint.rust.core.interfaces.CompressionListener
|
||||||
import com.coldmint.rust.core.tool.AppOperator
|
import com.coldmint.rust.core.tool.AppOperator
|
||||||
import com.coldmint.rust.core.tool.FileOperator
|
import com.coldmint.rust.core.tool.FileOperator
|
||||||
import com.coldmint.rust.pro.CreateTemplateActivity
|
|
||||||
import com.coldmint.rust.pro.FileManagerActivity
|
import com.coldmint.rust.pro.FileManagerActivity
|
||||||
|
import com.coldmint.rust.pro.R
|
||||||
import com.coldmint.rust.pro.base.BaseAdapter
|
import com.coldmint.rust.pro.base.BaseAdapter
|
||||||
import com.coldmint.rust.pro.databinding.TemplateBottomDialogBinding
|
import com.coldmint.rust.pro.databinding.TemplateBottomDialogBinding
|
||||||
import com.coldmint.rust.pro.databinding.TemplateListItemBinding
|
import com.coldmint.rust.pro.databinding.TemplateListItemBinding
|
||||||
|
@ -48,12 +44,12 @@ class TemplateListAdapter(
|
||||||
* @param localTemplatePackage LocalTemplatePackage
|
* @param localTemplatePackage LocalTemplatePackage
|
||||||
*/
|
*/
|
||||||
private fun editInfo(context: Context, localTemplatePackage: LocalTemplatePackage) {
|
private fun editInfo(context: Context, localTemplatePackage: LocalTemplatePackage) {
|
||||||
val bundle = Bundle()
|
// val bundle = Bundle()
|
||||||
bundle.putString("json", FileOperator.readFile(localTemplatePackage.infoFile))
|
// bundle.putString("json", FileOperator.readFile(localTemplatePackage.infoFile))
|
||||||
bundle.putString("path", localTemplatePackage.infoFile.absolutePath)
|
// bundle.putString("path", localTemplatePackage.infoFile.absolutePath)
|
||||||
val intent = Intent(context, CreateTemplateActivity::class.java)
|
// val intent = Intent(context, CreateTemplateActivity::class.java)
|
||||||
intent.putExtra("data", bundle)
|
// intent.putExtra("data", bundle)
|
||||||
context.startActivity(intent)
|
// context.startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,7 +13,6 @@ import com.coldmint.rust.core.web.Community
|
||||||
import com.coldmint.rust.core.web.Dynamic
|
import com.coldmint.rust.core.web.Dynamic
|
||||||
import com.coldmint.rust.core.web.ServerConfiguration
|
import com.coldmint.rust.core.web.ServerConfiguration
|
||||||
import com.coldmint.rust.pro.R
|
import com.coldmint.rust.pro.R
|
||||||
import com.coldmint.rust.pro.UserHomePageActivity
|
|
||||||
import com.coldmint.rust.pro.adapters.DynamicAdapter
|
import com.coldmint.rust.pro.adapters.DynamicAdapter
|
||||||
import com.coldmint.rust.pro.adapters.UserHeadAdapter
|
import com.coldmint.rust.pro.adapters.UserHeadAdapter
|
||||||
import com.coldmint.rust.pro.base.BaseFragment
|
import com.coldmint.rust.pro.base.BaseFragment
|
||||||
|
@ -118,10 +117,6 @@ class FollowFragment : BaseFragment<FragmentFollowBinding>() {
|
||||||
* @param account String
|
* @param account String
|
||||||
*/
|
*/
|
||||||
fun openHomePage(account: String) {
|
fun openHomePage(account: String) {
|
||||||
val goIntent =
|
|
||||||
Intent(requireContext(), UserHomePageActivity::class.java)
|
|
||||||
goIntent.putExtra("userId", account)
|
|
||||||
startActivity(goIntent)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,7 +20,7 @@ class InsertCoinsDialog(context: Context, val modId: String) :
|
||||||
BaseAppDialog<InsertCoinsDialog>(context) {
|
BaseAppDialog<InsertCoinsDialog>(context) {
|
||||||
|
|
||||||
private val token by lazy {
|
private val token by lazy {
|
||||||
AppSettings.getValue(AppSettings.Setting.Token, "")
|
""
|
||||||
}
|
}
|
||||||
|
|
||||||
private val viewBinding by lazy {
|
private val viewBinding by lazy {
|
||||||
|
|
|
@ -3,24 +3,15 @@ package com.coldmint.rust.pro.fragments
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.core.view.isVisible
|
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.CoinStatusData
|
||||||
import com.coldmint.rust.core.dataBean.mod.InsertCoinHistoryData
|
import com.coldmint.rust.core.dataBean.mod.InsertCoinHistoryData
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||||
import com.coldmint.rust.core.web.WebMod
|
import com.coldmint.rust.core.web.WebMod
|
||||||
import com.coldmint.rust.pro.R
|
import com.coldmint.rust.pro.R
|
||||||
import com.coldmint.rust.pro.UserHomePageActivity
|
|
||||||
import com.coldmint.rust.pro.adapters.InsertCoinsAdapter
|
import com.coldmint.rust.pro.adapters.InsertCoinsAdapter
|
||||||
import com.coldmint.rust.pro.base.BaseFragment
|
import com.coldmint.rust.pro.base.BaseFragment
|
||||||
import com.coldmint.rust.pro.databinding.FragmentInsertCoinsBinding
|
import com.coldmint.rust.pro.databinding.FragmentInsertCoinsBinding
|
||||||
import com.coldmint.rust.pro.tool.AppSettings
|
|
||||||
import com.coldmint.rust.pro.ui.StableLinearLayoutManager
|
import com.coldmint.rust.pro.ui.StableLinearLayoutManager
|
||||||
import com.google.android.material.divider.MaterialDividerItemDecoration
|
import com.google.android.material.divider.MaterialDividerItemDecoration
|
||||||
|
|
||||||
|
@ -29,7 +20,7 @@ import com.google.android.material.divider.MaterialDividerItemDecoration
|
||||||
*/
|
*/
|
||||||
class InsertCoinsFragment(val modId: String) : BaseFragment<FragmentInsertCoinsBinding>() {
|
class InsertCoinsFragment(val modId: String) : BaseFragment<FragmentInsertCoinsBinding>() {
|
||||||
private val token by lazy {
|
private val token by lazy {
|
||||||
AppSettings.getValue(AppSettings.Setting.Token, "")
|
""
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
||||||
|
@ -121,14 +112,7 @@ class InsertCoinsFragment(val modId: String) : BaseFragment<FragmentInsertCoinsB
|
||||||
* @param userId String
|
* @param userId String
|
||||||
*/
|
*/
|
||||||
fun gotoUserPage(userId: String) {
|
fun gotoUserPage(userId: String) {
|
||||||
val intent = Intent(
|
|
||||||
requireContext(),
|
|
||||||
UserHomePageActivity::class.java
|
|
||||||
)
|
|
||||||
intent.putExtra("userId", userId)
|
|
||||||
startActivity(
|
|
||||||
intent
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadButton() {
|
fun loadButton() {
|
||||||
|
|
|
@ -92,10 +92,7 @@ class InstalledTemplateFragment : BaseFragment<FragmentInstalledTemplateBinding>
|
||||||
) {
|
) {
|
||||||
numView.setText(R.string.del_moding)
|
numView.setText(R.string.del_moding)
|
||||||
templateClass.delete(
|
templateClass.delete(
|
||||||
AppSettings.getValue(
|
""
|
||||||
AppSettings.Setting.Token,
|
|
||||||
""
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
if (it) {
|
if (it) {
|
||||||
viewModel.loadTemplate(requireContext())
|
viewModel.loadTemplate(requireContext())
|
||||||
|
|
|
@ -2,15 +2,9 @@ package com.coldmint.rust.pro.fragments
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.core.view.isVisible
|
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.ApiResponse
|
||||||
import com.coldmint.rust.core.dataBean.mod.WebModCommentData
|
import com.coldmint.rust.core.dataBean.mod.WebModCommentData
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||||
|
@ -18,7 +12,6 @@ import com.coldmint.rust.core.tool.DebugHelper
|
||||||
import com.coldmint.rust.core.web.ServerConfiguration
|
import com.coldmint.rust.core.web.ServerConfiguration
|
||||||
import com.coldmint.rust.core.web.WebMod
|
import com.coldmint.rust.core.web.WebMod
|
||||||
import com.coldmint.rust.pro.R
|
import com.coldmint.rust.pro.R
|
||||||
import com.coldmint.rust.pro.UserHomePageActivity
|
|
||||||
import com.coldmint.rust.pro.adapters.CommentAdapter
|
import com.coldmint.rust.pro.adapters.CommentAdapter
|
||||||
import com.coldmint.rust.pro.base.BaseFragment
|
import com.coldmint.rust.pro.base.BaseFragment
|
||||||
import com.coldmint.rust.pro.databinding.FragmentModCommentsBinding
|
import com.coldmint.rust.pro.databinding.FragmentModCommentsBinding
|
||||||
|
@ -48,7 +41,7 @@ class ModCommentsFragment(val modId: String) : BaseFragment<FragmentModCommentsB
|
||||||
viewBinding.swipeRefreshLayout.isRefreshing = false
|
viewBinding.swipeRefreshLayout.isRefreshing = false
|
||||||
}
|
}
|
||||||
viewBinding.sendDiscussion.setOnClickListener {
|
viewBinding.sendDiscussion.setOnClickListener {
|
||||||
val token = AppSettings.getValue(AppSettings.Setting.Token, "")
|
val token = ""
|
||||||
if (token.isBlank()) {
|
if (token.isBlank()) {
|
||||||
Snackbar.make(
|
Snackbar.make(
|
||||||
viewBinding.sendDiscussion,
|
viewBinding.sendDiscussion,
|
||||||
|
@ -95,14 +88,7 @@ class ModCommentsFragment(val modId: String) : BaseFragment<FragmentModCommentsB
|
||||||
* @param userId String
|
* @param userId String
|
||||||
*/
|
*/
|
||||||
fun gotoUserPage(userId: String) {
|
fun gotoUserPage(userId: String) {
|
||||||
val intent = Intent(
|
|
||||||
requireContext(),
|
|
||||||
UserHomePageActivity::class.java
|
|
||||||
)
|
|
||||||
intent.putExtra("userId", userId)
|
|
||||||
startActivity(
|
|
||||||
intent
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
|
|
@ -28,7 +28,7 @@ class NetworkTemplateFragment : BaseFragment<FragmentNetworkTemplateBinding>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadList() {
|
fun loadList() {
|
||||||
val token = AppSettings.getValue(AppSettings.Setting.Token, "")
|
val token = ""
|
||||||
TemplatePhp.instance.getTemplatePackageList(token,
|
TemplatePhp.instance.getTemplatePackageList(token,
|
||||||
object : ApiCallBack<WebTemplatePackageListData> {
|
object : ApiCallBack<WebTemplatePackageListData> {
|
||||||
override fun onResponse(t: WebTemplatePackageListData) {
|
override fun onResponse(t: WebTemplatePackageListData) {
|
||||||
|
@ -37,8 +37,11 @@ class NetworkTemplateFragment : BaseFragment<FragmentNetworkTemplateBinding>() {
|
||||||
MyWebTemplateAdapter(requireContext(), t.data)
|
MyWebTemplateAdapter(requireContext(), t.data)
|
||||||
adapter.setItemEvent { i, itemMyWebTemplateBinding, viewHolder, data ->
|
adapter.setItemEvent { i, itemMyWebTemplateBinding, viewHolder, data ->
|
||||||
itemMyWebTemplateBinding.root.setOnClickListener {
|
itemMyWebTemplateBinding.root.setOnClickListener {
|
||||||
val intent = Intent(requireContext(),NetworkTemplatePackageDetailsActivity::class.java)
|
val intent = Intent(
|
||||||
intent.putExtra("id",data.id)
|
requireContext(),
|
||||||
|
NetworkTemplatePackageDetailsActivity::class.java
|
||||||
|
)
|
||||||
|
intent.putExtra("id", data.id)
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,9 +79,8 @@ class SaveTemplateFragment(val name: String, val json: JSONObject) : BottomSheet
|
||||||
val newFile = File(id + "/" + name + ".json")
|
val newFile = File(id + "/" + name + ".json")
|
||||||
FileOperator.writeFile(newFile, json.toString(4))
|
FileOperator.writeFile(newFile, json.toString(4))
|
||||||
} else {
|
} else {
|
||||||
val token = AppSettings.getValue(AppSettings.Setting.Token, "")
|
|
||||||
TemplatePhp.instance.addTemplate(name,
|
TemplatePhp.instance.addTemplate(name,
|
||||||
token,
|
"",
|
||||||
name,
|
name,
|
||||||
json.toString(4),
|
json.toString(4),
|
||||||
id,
|
id,
|
||||||
|
@ -120,10 +119,7 @@ class SaveTemplateFragment(val name: String, val json: JSONObject) : BottomSheet
|
||||||
*/
|
*/
|
||||||
fun loadWebTemplate(func: (() -> Unit)) {
|
fun loadWebTemplate(func: (() -> Unit)) {
|
||||||
TemplatePhp.instance.getTemplatePackageList(
|
TemplatePhp.instance.getTemplatePackageList(
|
||||||
AppSettings.getValue(
|
"", object : ApiCallBack<WebTemplatePackageListData> {
|
||||||
AppSettings.Setting.Token,
|
|
||||||
""
|
|
||||||
), object : ApiCallBack<WebTemplatePackageListData> {
|
|
||||||
override fun onResponse(t: WebTemplatePackageListData) {
|
override fun onResponse(t: WebTemplatePackageListData) {
|
||||||
if (t.data != null) {
|
if (t.data != null) {
|
||||||
t.data.forEach {
|
t.data.forEach {
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
package com.coldmint.rust.pro.fragments
|
|
||||||
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
|
||||||
import com.coldmint.rust.core.dataBean.user.SearchResultDataBean
|
|
||||||
import com.coldmint.rust.pro.adapters.SearchResultAdapter
|
|
||||||
import com.coldmint.rust.pro.base.BaseFragment
|
|
||||||
import com.coldmint.rust.pro.databinding.FragmentSearchResultBinding
|
|
||||||
import com.coldmint.rust.pro.ui.StableLinearLayoutManager
|
|
||||||
import com.google.android.material.divider.MaterialDividerItemDecoration
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 搜索结果碎片
|
|
||||||
* @property keyword String
|
|
||||||
* @property dataList MutableList<Data>
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
class SearchResultFragment(
|
|
||||||
val keyword: String,
|
|
||||||
val data: SearchResultDataBean.Data,
|
|
||||||
val typeName: String
|
|
||||||
) :
|
|
||||||
BaseFragment<FragmentSearchResultBinding>() {
|
|
||||||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
|
||||||
|
|
||||||
val adapter = SearchResultAdapter(requireContext(), keyword, filterList())
|
|
||||||
viewBinding.recyclerView.adapter = adapter
|
|
||||||
val divider = MaterialDividerItemDecoration(
|
|
||||||
requireContext(),
|
|
||||||
MaterialDividerItemDecoration.VERTICAL
|
|
||||||
)
|
|
||||||
viewBinding.recyclerView.addItemDecoration(divider)
|
|
||||||
viewBinding.recyclerView.layoutManager = StableLinearLayoutManager(requireContext())
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 过滤列表(为all返回所有)
|
|
||||||
* @return MutableList<SearchResultDataBean.Data.Total>
|
|
||||||
*/
|
|
||||||
fun filterList(): MutableList<SearchResultDataBean.Data.Total> {
|
|
||||||
if (typeName == "all") {
|
|
||||||
return data.total
|
|
||||||
}
|
|
||||||
val list = ArrayList<SearchResultDataBean.Data.Total>()
|
|
||||||
data.total.forEach {
|
|
||||||
if (it.type == typeName) {
|
|
||||||
list.add(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentSearchResultBinding {
|
|
||||||
return FragmentSearchResultBinding.inflate(layoutInflater)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -170,13 +170,8 @@ class UserInfoFragment : BaseFragment<FragmentUserInfoBinding>() {
|
||||||
|
|
||||||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
||||||
viewBinding.logOutButton.setOnClickListener {
|
viewBinding.logOutButton.setOnClickListener {
|
||||||
AppSettings.setValue(AppSettings.Setting.LoginStatus, false)
|
|
||||||
// GlobalMethod.isActive = false
|
|
||||||
(requireActivity() as MainActivity).startViewModel.isActivationLiveData.value = false
|
|
||||||
startActivity(Intent(requireContext(), LoginActivity::class.java))
|
|
||||||
}
|
}
|
||||||
viewBinding.loginLayout.logView.setOnClickListener {
|
viewBinding.loginLayout.logView.setOnClickListener {
|
||||||
startActivity(Intent(requireContext(), LoginActivity::class.java))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,7 +18,6 @@ import com.coldmint.rust.core.web.User
|
||||||
import com.coldmint.rust.core.web.WebMod
|
import com.coldmint.rust.core.web.WebMod
|
||||||
import com.coldmint.rust.pro.R
|
import com.coldmint.rust.pro.R
|
||||||
import com.coldmint.rust.pro.TagActivity
|
import com.coldmint.rust.pro.TagActivity
|
||||||
import com.coldmint.rust.pro.UserHomePageActivity
|
|
||||||
import com.coldmint.rust.pro.base.BaseFragment
|
import com.coldmint.rust.pro.base.BaseFragment
|
||||||
import com.coldmint.rust.pro.databinding.FragmentWebModDetailsBinding
|
import com.coldmint.rust.pro.databinding.FragmentWebModDetailsBinding
|
||||||
import com.coldmint.rust.pro.tool.AppSettings
|
import com.coldmint.rust.pro.tool.AppSettings
|
||||||
|
|
|
@ -41,7 +41,7 @@ class StartViewModel(application: Application) : BaseAndroidViewModel(applicatio
|
||||||
* 签名错误的LiveData
|
* 签名错误的LiveData
|
||||||
*/
|
*/
|
||||||
val signatureErrorLiveData by lazy {
|
val signatureErrorLiveData by lazy {
|
||||||
MutableLiveData<Boolean>(false)
|
MutableLiveData(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<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_marginHorizontal="16dp" />
|
|
|
@ -1,37 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/rootLayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="16dp">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageView"
|
|
||||||
android:layout_width="60dp"
|
|
||||||
android:layout_height="60dp"
|
|
||||||
android:src="@drawable/image" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/titleView"
|
|
||||||
style="@style/TextAppearance.Material3.TitleMedium"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignTop="@id/imageView"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:layout_toEndOf="@id/imageView"
|
|
||||||
android:text="@string/mod_title" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/contentView"
|
|
||||||
style="@style/TextAppearance.Material3.BodyMedium"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/titleView"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:layout_toEndOf="@id/imageView"
|
|
||||||
android:text="@string/no_content" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<RelativeLayout 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="wrap_content">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:id="@+id/titleView"
|
|
||||||
style="@style/TextAppearance.Material3.TitleMedium"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:layout_toStartOf="@id/imageView"
|
|
||||||
android:text="@string/title" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:id="@+id/imageView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:src="@drawable/ic_baseline_chevron_right_24"
|
|
||||||
app:tint="?colorControlNormal" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
|
@ -1,10 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<item
|
|
||||||
app:showAsAction="always"
|
|
||||||
android:id="@+id/search"
|
|
||||||
android:icon="@drawable/ic_search_black_24dp"
|
|
||||||
android:title="@string/search" />
|
|
||||||
</menu>
|
|
|
@ -44,12 +44,6 @@
|
||||||
app:key="@string/setting_night_mode"
|
app:key="@string/setting_night_mode"
|
||||||
app:summary="@string/night_mode_auto"
|
app:summary="@string/night_mode_auto"
|
||||||
app:useSimpleSummaryProvider="true" />
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
|
||||||
<rikka.material.preference.MaterialSwitchPreference
|
|
||||||
android:title="@string/use_the_community_as_the_launch_page"
|
|
||||||
app:defaultValue="true"
|
|
||||||
app:key="@string/setting_use_the_community_as_the_launch_page"
|
|
||||||
app:summary="@string/use_the_community_as_the_launch_page_tip" />
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/file_manager">
|
<PreferenceCategory android:title="@string/file_manager">
|
||||||
|
@ -61,31 +55,14 @@
|
||||||
app:useSimpleSummaryProvider="true" />
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
|
android:summary="@string/setting_source_file_type_describe"
|
||||||
app:key="@string/setting_source_file_type"
|
app:key="@string/setting_source_file_type"
|
||||||
app:title="@string/setting_source_file_type_title"
|
app:title="@string/setting_source_file_type_title"
|
||||||
android:summary="@string/setting_source_file_type_describe"
|
|
||||||
app:useSimpleSummaryProvider="true" />
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/data_transfer">
|
|
||||||
|
|
||||||
|
|
||||||
<rikka.material.preference.MaterialSwitchPreference
|
|
||||||
android:title="@string/using_mobile_networks"
|
|
||||||
app:defaultValue="false"
|
|
||||||
app:key="@string/setting_use_mobile_network"
|
|
||||||
app:summary="@string/using_mobile_networks_tip" />
|
|
||||||
|
|
||||||
|
|
||||||
<EditTextPreference
|
|
||||||
app:key="@string/setting_server_address"
|
|
||||||
app:title="@string/server_address_configuration"
|
|
||||||
app:useSimpleSummaryProvider="true" />
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
app:key="editGroup"
|
app:key="editGroup"
|
||||||
|
@ -111,8 +88,8 @@
|
||||||
<rikka.material.preference.MaterialSwitchPreference
|
<rikka.material.preference.MaterialSwitchPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="@string/setting_simple_display_of_auto_complete_menu"
|
android:key="@string/setting_simple_display_of_auto_complete_menu"
|
||||||
android:title="@string/simple_display_of_auto_complete_menu"
|
android:summary="@string/simple_display_of_auto_complete_menu_describe"
|
||||||
android:summary="@string/simple_display_of_auto_complete_menu_describe"/>
|
android:title="@string/simple_display_of_auto_complete_menu" />
|
||||||
|
|
||||||
<SeekBarPreference
|
<SeekBarPreference
|
||||||
android:max="160"
|
android:max="160"
|
||||||
|
@ -130,8 +107,8 @@
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
app:key="customize_edit"
|
app:key="customize_edit"
|
||||||
app:title="@string/customize_edit_text"
|
app:summary="@string/customize_edit_text_description"
|
||||||
app:summary="@string/customize_edit_text_description"/>
|
app:title="@string/customize_edit_text" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
@ -240,23 +217,6 @@
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
|
||||||
android:title="@string/update_and_iteration"
|
|
||||||
app:key="updateGroup">
|
|
||||||
<rikka.material.preference.MaterialSwitchPreference
|
|
||||||
app:defaultValue="false"
|
|
||||||
app:key="@string/setting_check_beta_update"
|
|
||||||
app:summary="@string/check_beta_update_describe"
|
|
||||||
app:title="@string/check_beta_update" />
|
|
||||||
|
|
||||||
<rikka.material.preference.MaterialSwitchPreference
|
|
||||||
android:defaultValue="true"
|
|
||||||
android:key="@string/setting_experience_the_plan"
|
|
||||||
app:summary="@string/experience_the_plan_describe"
|
|
||||||
app:title="@string/experience_the_plan" />
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
app:key="cacheGroup"
|
app:key="cacheGroup"
|
||||||
app:title="@string/cache">
|
app:title="@string/cache">
|
||||||
|
@ -272,11 +232,6 @@
|
||||||
app:key="developerModeGroup"
|
app:key="developerModeGroup"
|
||||||
app:title="@string/sync_header">
|
app:title="@string/sync_header">
|
||||||
|
|
||||||
<!-- <Preference-->
|
|
||||||
<!-- app:key="@string/setting_obtain_source_code"-->
|
|
||||||
<!-- android:summary="@string/obtain_source_code_msg"-->
|
|
||||||
<!-- app:title="@string/obtain_source_code"/>-->
|
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
app:key="@string/setting_see_error_info"
|
app:key="@string/setting_see_error_info"
|
||||||
app:summary="@string/see_error_info_tip"
|
app:summary="@string/see_error_info_tip"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user