diff --git a/.gradle/7.3.3/executionHistory/executionHistory.bin b/.gradle/7.3.3/executionHistory/executionHistory.bin index 6a1db77..0e4e83f 100644 Binary files a/.gradle/7.3.3/executionHistory/executionHistory.bin and b/.gradle/7.3.3/executionHistory/executionHistory.bin differ diff --git a/.gradle/7.3.3/executionHistory/executionHistory.lock b/.gradle/7.3.3/executionHistory/executionHistory.lock index ec41d7f..4786d1e 100644 Binary files a/.gradle/7.3.3/executionHistory/executionHistory.lock and b/.gradle/7.3.3/executionHistory/executionHistory.lock differ diff --git a/.gradle/7.3.3/fileHashes/fileHashes.bin b/.gradle/7.3.3/fileHashes/fileHashes.bin index fed90c1..6037f1f 100644 Binary files a/.gradle/7.3.3/fileHashes/fileHashes.bin and b/.gradle/7.3.3/fileHashes/fileHashes.bin differ diff --git a/.gradle/7.3.3/fileHashes/fileHashes.lock b/.gradle/7.3.3/fileHashes/fileHashes.lock index 4585e37..35d8388 100644 Binary files a/.gradle/7.3.3/fileHashes/fileHashes.lock and b/.gradle/7.3.3/fileHashes/fileHashes.lock differ diff --git a/.gradle/7.3.3/fileHashes/resourceHashesCache.bin b/.gradle/7.3.3/fileHashes/resourceHashesCache.bin index 75a61e0..0bacc62 100644 Binary files a/.gradle/7.3.3/fileHashes/resourceHashesCache.bin and b/.gradle/7.3.3/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 7f9cf7d..adf8188 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin index b69c498..3eb25fb 100644 Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/.gradle/file-system.probe b/.gradle/file-system.probe index f36b109..efa4d7a 100644 Binary files a/.gradle/file-system.probe and b/.gradle/file-system.probe differ diff --git a/app/build.gradle b/app/build.gradle index 2730ac9..7131c76 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -28,7 +28,7 @@ android { minSdkVersion 21 targetSdkVersion 32 versionCode 18 - versionName "2.1 alpha(2022-7-6)" + versionName "2.1 alpha(2022-7-17)" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/assets/ling.rp b/app/src/main/assets/ling.rp deleted file mode 100644 index 459d862..0000000 Binary files a/app/src/main/assets/ling.rp and /dev/null differ diff --git a/app/src/main/java/com/coldmint/rust/pro/ApplicationListActivity.kt b/app/src/main/java/com/coldmint/rust/pro/ApplicationListActivity.kt index de604c0..3586c6e 100644 --- a/app/src/main/java/com/coldmint/rust/pro/ApplicationListActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/ApplicationListActivity.kt @@ -144,7 +144,7 @@ class ApplicationListActivity : BaseActivity() { * 设置标题和活动栏 */ private fun setTitleAndActionBar() { - viewBinding.toolbar.setTitle(R.string.select_game_pack) + title = getString(R.string.select_game_pack) setReturnButton() } diff --git a/app/src/main/java/com/coldmint/rust/pro/CreationWizardActivity.kt b/app/src/main/java/com/coldmint/rust/pro/CreationWizardActivity.kt index 8d04f34..d227c03 100644 --- a/app/src/main/java/com/coldmint/rust/pro/CreationWizardActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/CreationWizardActivity.kt @@ -16,7 +16,7 @@ class CreationWizardActivity : BaseActivity() { lateinit var type: String override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) { setReturnButton() - title = getString(R.string.creation_wizard) + title = getString(R.string.creation_assistant) val temType = intent.getStringExtra("type") if (temType.isNullOrBlank()) { showToast("请传入类型") diff --git a/app/src/main/java/com/coldmint/rust/pro/EditUserInfoActivity.kt b/app/src/main/java/com/coldmint/rust/pro/EditUserInfoActivity.kt index 90048f9..679b68a 100644 --- a/app/src/main/java/com/coldmint/rust/pro/EditUserInfoActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/EditUserInfoActivity.kt @@ -29,6 +29,7 @@ import com.coldmint.rust.core.web.User import com.coldmint.rust.pro.base.BaseActivity import com.coldmint.rust.pro.databinding.ActivityEditModInfoBinding import com.coldmint.rust.pro.databinding.ActivityEditUserInfoBinding +import com.coldmint.rust.pro.tool.AppSettings import com.coldmint.rust.pro.tool.GlobalMethod import com.google.android.material.snackbar.Snackbar import com.yalantis.ucrop.UCrop @@ -52,7 +53,7 @@ class EditUserInfoActivity : BaseActivity() { } private fun initView() { - viewBinding.toolbar.title = getText(R.string.editData) + title = getText(R.string.editData) setReturnButton() val thisIntent = intent val temUserId = thisIntent.getStringExtra("userId") @@ -254,8 +255,10 @@ class EditUserInfoActivity : BaseActivity() { R.attr.colorPrimaryVariant ) ) + val token = + AppSettings.getInstance(this).getValue(AppSettings.Setting.Token, "") User.updateSpaceInfo( - userId, + token, userName, introduce, gender, diff --git a/app/src/main/java/com/coldmint/rust/pro/FileManagerActivity.kt b/app/src/main/java/com/coldmint/rust/pro/FileManagerActivity.kt index 3bd3ced..7cd08be 100644 --- a/app/src/main/java/com/coldmint/rust/pro/FileManagerActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/FileManagerActivity.kt @@ -49,7 +49,7 @@ class FileManagerActivity : BaseActivity() { private val bookmarkManager: BookmarkManager by lazy { BookmarkManager(this) } private var additionalData: String? = null private fun initView() { - viewBinding.toolbar.setTitle(R.string.file_manager) + title = getString(R.string.file_manager) setReturnButton() viewBinding.fileList.layoutManager = LinearLayoutManager(this@FileManagerActivity) val intent = intent diff --git a/app/src/main/java/com/coldmint/rust/pro/LoginActivity.kt b/app/src/main/java/com/coldmint/rust/pro/LoginActivity.kt index 26ecf03..aa9ab30 100644 --- a/app/src/main/java/com/coldmint/rust/pro/LoginActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/LoginActivity.kt @@ -119,11 +119,11 @@ class LoginActivity : BaseActivity() { 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, - account + userData.data.account ) - appSettings.forceSetValue(AppSettings.Setting.PassWord, passWord) appSettings.forceSetValue( AppSettings.Setting.Token, userData.data.token diff --git a/app/src/main/java/com/coldmint/rust/pro/MainActivity.kt b/app/src/main/java/com/coldmint/rust/pro/MainActivity.kt index 1880f1a..19b1108 100644 --- a/app/src/main/java/com/coldmint/rust/pro/MainActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/MainActivity.kt @@ -11,6 +11,7 @@ import com.google.android.material.snackbar.Snackbar import android.os.* import android.util.Log import android.view.* +import androidx.appcompat.app.ActionBarDrawerToggle import androidx.core.view.GravityCompat import androidx.core.view.isVisible import androidx.lifecycle.ViewModelProvider @@ -91,6 +92,10 @@ class MainActivity : BaseActivity() { setupActionBarWithNavController(navController, appBarConfiguration) viewBinding.navaiagtion.setupWithNavController(navController) viewBinding.navaiagtion.addHeaderView(headLayout.root) + //actionbar动画 + val actionToggle = ActionBarDrawerToggle(this,viewBinding.drawerlayout,viewBinding.toolbar,R.string.app_name,R.string.app_name) + viewBinding.drawerlayout.addDrawerListener(actionToggle) + actionToggle.syncState() } /** @@ -426,50 +431,6 @@ class MainActivity : BaseActivity() { } } - /** - * 初始化搜索项目事件 - */ -// private fun initSearchItem(newSearchView: SearchView) { -// val navigationIcon = viewBinding.toolbar.navigationIcon -// var oldTile: CharSequence = viewBinding.toolbar.title -// val hideView: (collapsed: Boolean) -> Unit = { -// if (it) { -// newSearchView.onActionViewCollapsed() -// } -// viewBinding.toolbar.navigationIcon = navigationIcon -// viewBinding.toolbar.title = oldTile -// } -// newSearchView.queryHint = getString(R.string.search_hint) -// newSearchView.setOnCloseListener { -// hideView.invoke(false) -// return@setOnCloseListener false -// } -// newSearchView.setOnSearchClickListener { -// oldTile = viewBinding.toolbar.title -// viewBinding.toolbar.navigationIcon = null -// viewBinding.toolbar.title = getString(R.string.search) -// } -// -// newSearchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener { -// override fun onQueryTextSubmit(query: String?): Boolean { -// hideView.invoke(true) -// val key = query -// if (key != null) { -// val goIntent = Intent(this@MainActivity, SearchResultActivity::class.java) -// goIntent.putExtra("key", key) -// startActivity(goIntent) -// } -// return false -// } -// -// override fun onQueryTextChange(newText: String?): Boolean { -// return false -// } -// -// }) -// searchView = newSearchView -// } - /** * 导入模板 * @param formFile File 文件 @@ -730,7 +691,6 @@ class MainActivity : BaseActivity() { initNav() observeStartViewModel() checkAppUpdate() -// CommentDialog(this).show() } else { startViewModel.initAllData() } diff --git a/app/src/main/java/com/coldmint/rust/pro/OrderListActivity.kt b/app/src/main/java/com/coldmint/rust/pro/OrderListActivity.kt index 5af951a..a35ba80 100644 --- a/app/src/main/java/com/coldmint/rust/pro/OrderListActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/OrderListActivity.kt @@ -38,7 +38,7 @@ class OrderListActivity : BaseActivity() { override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) { if (canUseView) { - viewBinding.toolbar.title = getText(R.string.order_list) + title = getText(R.string.order_list) setReturnButton() if (account.isBlank()) { showError(getString(R.string.please_login_first)) diff --git a/app/src/main/java/com/coldmint/rust/pro/ReleaseModActivity.kt b/app/src/main/java/com/coldmint/rust/pro/ReleaseModActivity.kt index 5801335..8a371c4 100644 --- a/app/src/main/java/com/coldmint/rust/pro/ReleaseModActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/ReleaseModActivity.kt @@ -889,10 +889,9 @@ class ReleaseModActivity : BaseActivity() { //发布动态 val check = viewBinding.checkbox.isChecked if (check) { - val appId = appSettings.getValue(AppSettings.Setting.AppID, "") + val token = appSettings.getValue(AppSettings.Setting.Token, "") Dynamic.instance.send( - account, - appId, + token, String.format(getString(R.string.auto_send), modId), object : ApiCallBack { override fun onResponse(t: ApiResponse) { @@ -1003,10 +1002,9 @@ class ReleaseModActivity : BaseActivity() { //发布动态 val check = viewBinding.checkbox.isChecked if (check) { - val appId = appSettings.getValue(AppSettings.Setting.AppID, "") + val token = appSettings.getValue(AppSettings.Setting.Token, "") Dynamic.instance.send( - account, - appId, + token, String.format( getString(R.string.auto_send2), modId, diff --git a/app/src/main/java/com/coldmint/rust/pro/ReportListActivity.kt b/app/src/main/java/com/coldmint/rust/pro/ReportListActivity.kt index 1bc535b..9cd5e86 100644 --- a/app/src/main/java/com/coldmint/rust/pro/ReportListActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/ReportListActivity.kt @@ -22,7 +22,7 @@ import com.coldmint.rust.pro.tool.AppSettings class ReportListActivity : BaseActivity() { override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) { if (canUseView) { - viewBinding.toolbar.title = getText(R.string.report_to_deal) + title = getText(R.string.report_to_deal) setReturnButton() val account = appSettings.getValue(AppSettings.Setting.Account, "") if (account.isBlank()) { diff --git a/app/src/main/java/com/coldmint/rust/pro/ReviewModActivity.kt b/app/src/main/java/com/coldmint/rust/pro/ReviewModActivity.kt index e327115..0926c05 100644 --- a/app/src/main/java/com/coldmint/rust/pro/ReviewModActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/ReviewModActivity.kt @@ -28,7 +28,7 @@ class ReviewModActivity : BaseActivity() { override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) { if (canUseView) { - viewBinding.toolbar.title = getText(R.string.review_mod) + title = getText(R.string.review_mod) setReturnButton() if (token.isBlank()) { showInfoToView(resId = R.string.please_login_first) diff --git a/app/src/main/java/com/coldmint/rust/pro/TemplateParserActivity.kt b/app/src/main/java/com/coldmint/rust/pro/TemplateParserActivity.kt index 959d971..2f3c28a 100644 --- a/app/src/main/java/com/coldmint/rust/pro/TemplateParserActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/TemplateParserActivity.kt @@ -189,18 +189,22 @@ class TemplateParserActivity() : BaseActivity() { working = true val filename = viewBinding.fileNameInputView.text.toString() var needFileType = true + val index = filename.lastIndexOf('.') + //文件夹名 + var folderName = filename if (filename.isBlank()) { setErrorAndInput( viewBinding.fileNameInputView, getString(R.string.unit_name_error), viewBinding.fileNameInputLayout ) return@submit - } else if (filename.contains(".")) { + } else if (index > -1) { needFileType = false + folderName = filename.substring(0 until index) } //真实创建目录 val authenticallyCreateDirectory: String = if (mCreateIndependentFolder) { - "$mCreatePath/$filename" + "$mCreatePath/$folderName" } else { mCreatePath } diff --git a/app/src/main/java/com/coldmint/rust/pro/UnitsActivity.kt b/app/src/main/java/com/coldmint/rust/pro/UnitsActivity.kt index 5675a0f..0282c38 100644 --- a/app/src/main/java/com/coldmint/rust/pro/UnitsActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/UnitsActivity.kt @@ -225,7 +225,7 @@ class UnitsActivity : BaseActivity() { override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) { if (canUseView) { - viewBinding.toolbar.setTitle(R.string.mod_action1) + title = getString(R.string.mod_action1) setReturnButton() val intent = intent val bundle = intent.getBundleExtra("data") diff --git a/app/src/main/java/com/coldmint/rust/pro/UserHomePageActivity.kt b/app/src/main/java/com/coldmint/rust/pro/UserHomePageActivity.kt index a6c9f0a..652cb64 100644 --- a/app/src/main/java/com/coldmint/rust/pro/UserHomePageActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/UserHomePageActivity.kt @@ -24,6 +24,7 @@ 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.AppSettings import com.coldmint.rust.pro.tool.GlobalMethod import com.google.android.material.appbar.AppBarLayout @@ -45,19 +46,15 @@ class UserHomePageActivity : BaseActivity() { } - val appID by lazy { - appSettings.getValue(AppSettings.Setting.AppID, "") - } - //旧的备份数据 var oldSpaceInfoData: SpaceInfoData? = null @SuppressLint("CheckResult") private fun initView() { - immersionBar { - transparentStatusBar().statusBarDarkFont(true) - .navigationBarColor(R.color.white_200).navigationBarDarkIcon(true) - } +// immersionBar { +// transparentStatusBar().statusBarDarkFont(true) +// .navigationBarColor(R.color.white_200).navigationBarDarkIcon(true) +// } val thisIntent = intent val temUserId = thisIntent.getStringExtra("userId") @@ -77,9 +74,6 @@ class UserHomePageActivity : BaseActivity() { } viewBinding.toolbar.title = "" setReturnButton() - val params = viewBinding.toolbar.layoutParams as CollapsingToolbarLayout.LayoutParams - params.setMargins(0, statusBarHeight(this), 0, 0) - viewBinding.toolbar.layoutParams = params viewBinding.followLayout.setOnClickListener { openUserList(userId, true) @@ -92,7 +86,6 @@ class UserHomePageActivity : BaseActivity() { } - /** * 打开用户列表 * @param account String 账号 @@ -292,7 +285,6 @@ class UserHomePageActivity : BaseActivity() { super.onResume() User.getSpaceInfo(userId, object : ApiCallBack { override fun onResponse(t: SpaceInfoData) { - if (t.code == ServerConfiguration.Success_Code) { showUserdataIfNeed(t) } else { @@ -307,67 +299,74 @@ class UserHomePageActivity : BaseActivity() { }) } - /** - * 获取状态栏高度 - * @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 - } +// /** +// * 获取状态栏高度 +// * @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 { - MaterialDialog(this, BottomSheet(LayoutMode.WRAP_CONTENT)).show { - input(maxLength = 255).title(R.string.send_dynamic) - .positiveButton(R.string.dialog_ok) - .positiveButton { - val inputField: EditText = it.getInputField() - val text = inputField.text.toString() - if (!text.isBlank()) { - Dynamic.instance.send( - account, - appID, - text, - object : ApiCallBack { - override fun onResponse(t: ApiResponse) { - if (t.code == ServerConfiguration.Success_Code) { - 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() - } + CommentDialog(this).setTitle(R.string.send_dynamic).setCancelable(false) + .setSubmitFun { button, textInputLayout, s, alertDialog -> + val token = + AppSettings.getInstance(this).getValue(AppSettings.Setting.Token, "") + if (!s.isBlank()) { + Dynamic.instance.send( + token, + s, + object : ApiCallBack { + 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) - } + override fun onFailure(e: Exception) { + showInternetError(viewBinding.button, e) + } - }) - } - }.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 - } + }) + } + }.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()) { @@ -393,7 +392,11 @@ class UserHomePageActivity : BaseActivity() { viewBinding.button.text = getString(R.string.followed) } else { viewBinding.button.text = type - Snackbar.make(viewBinding.button, t.message, Snackbar.LENGTH_SHORT) + Snackbar.make( + viewBinding.button, + t.message, + Snackbar.LENGTH_SHORT + ) .show() } diff --git a/app/src/main/java/com/coldmint/rust/pro/WebModInfoActivity.kt b/app/src/main/java/com/coldmint/rust/pro/WebModInfoActivity.kt index a8c5a29..d6689a4 100644 --- a/app/src/main/java/com/coldmint/rust/pro/WebModInfoActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/WebModInfoActivity.kt @@ -14,6 +14,7 @@ import android.widget.EditText import android.widget.Toast import androidx.core.app.NotificationManagerCompat import androidx.core.view.isVisible +import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.LinearLayoutManager import com.afollestad.materialdialogs.LayoutMode import com.afollestad.materialdialogs.MaterialDialog @@ -99,6 +100,9 @@ class WebModInfoActivity : BaseActivity() { } viewBinding.modCommentRecyclerView.layoutManager = LinearLayoutManager(this@WebModInfoActivity) + viewBinding.modCommentRecyclerView.addItemDecoration( + DividerItemDecoration(this@WebModInfoActivity, DividerItemDecoration.VERTICAL) + ) tip = getString(R.string.file_download_progress) } @@ -473,33 +477,34 @@ class WebModInfoActivity : BaseActivity() { } - CommentDialog(this).setSubmitFun { button, textInputLayout, s, alertDialog -> - button.isEnabled = false - WebMod.instance.sendComment( - appSettings.getValue(AppSettings.Setting.Token, ""), - modId, - s, - object : ApiCallBack { - override fun onResponse(t: ApiResponse) { - if (t.code == ServerConfiguration.Success_Code) { - alertDialog.dismiss() - loadModCommentList(modId) - Snackbar.make( - viewBinding.button, - R.string.release_ok, - Snackbar.LENGTH_SHORT - ).show() - } else { - textInputLayout.error = t.message + CommentDialog(this).setCancelable(false) + .setSubmitFun { button, textInputLayout, s, alertDialog -> + button.isEnabled = false + WebMod.instance.sendComment( + appSettings.getValue(AppSettings.Setting.Token, ""), + modId, + s, + object : ApiCallBack { + override fun onResponse(t: ApiResponse) { + if (t.code == ServerConfiguration.Success_Code) { + alertDialog.dismiss() + loadModCommentList(modId) + Snackbar.make( + viewBinding.button, + R.string.release_ok, + Snackbar.LENGTH_SHORT + ).show() + } else { + textInputLayout.error = t.message + } } - } - override fun onFailure(e: Exception) { - textInputLayout.error = e.toString() - } + override fun onFailure(e: Exception) { + textInputLayout.error = e.toString() + } - }) - }.show() + }) + }.show() } } diff --git a/app/src/main/java/com/coldmint/rust/pro/WorkManagementActivity.kt b/app/src/main/java/com/coldmint/rust/pro/WorkManagementActivity.kt index eae6a4f..85d19b1 100644 --- a/app/src/main/java/com/coldmint/rust/pro/WorkManagementActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/WorkManagementActivity.kt @@ -254,7 +254,7 @@ class WorkManagementActivity : BaseActivity() { override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) { if (canUseView) { - viewBinding.toolbar.setTitle(R.string.work_management) + title = getString(R.string.work_management) setReturnButton() viewBinding.recyclerView.layoutManager = LinearLayoutManager(this) } diff --git a/app/src/main/java/com/coldmint/rust/pro/adapters/TemplateListAdapter.kt b/app/src/main/java/com/coldmint/rust/pro/adapters/TemplateListAdapter.kt index 7a38169..4ce875f 100644 --- a/app/src/main/java/com/coldmint/rust/pro/adapters/TemplateListAdapter.kt +++ b/app/src/main/java/com/coldmint/rust/pro/adapters/TemplateListAdapter.kt @@ -263,7 +263,7 @@ class TemplateListAdapter( val exportFile = context.getString(R.string.export) viewBinding.onTouchView.setOnClickListener { val bottomSheetDialog = - BottomSheetDialog(context, R.style.BottomSheetDialog) + BottomSheetDialog(context) val templateBottomDialogBinding = TemplateBottomDialogBinding.inflate(LayoutInflater.from(context)) bottomSheetDialog.setContentView(templateBottomDialogBinding.root) diff --git a/app/src/main/java/com/coldmint/rust/pro/base/BaseAdapter.kt b/app/src/main/java/com/coldmint/rust/pro/base/BaseAdapter.kt index cb4f147..f9f9e0f 100644 --- a/app/src/main/java/com/coldmint/rust/pro/base/BaseAdapter.kt +++ b/app/src/main/java/com/coldmint/rust/pro/base/BaseAdapter.kt @@ -22,6 +22,7 @@ import android.text.style.ForegroundColorSpan import android.text.style.StyleSpan import androidx.appcompat.app.AlertDialog import androidx.core.text.toSpannable +import com.coldmint.dialog.CoreDialog import com.google.android.material.dialog.MaterialAlertDialogBuilder @@ -41,7 +42,6 @@ abstract class BaseAdapter( private val bold = StyleSpan(Typeface.BOLD) - /** * 建立搜索标题,注意当[BaseAdapter.keyWord]为空时永远返回null * @param title String 标题 @@ -147,7 +147,6 @@ abstract class BaseAdapter( * @param cancelable Boolean 是否可取消 * @param checkBoxPrompt 选择框显示的文本 */ - @Deprecated("已废弃") fun showDeleteItemDialog( name: String, index: Int, @@ -155,6 +154,24 @@ abstract class BaseAdapter( cancelable: Boolean = false, checkBoxPrompt: String? = null ) { + val coreDialog = CoreDialog(context).setTitle(R.string.delete_title).setMessage( + String.format( + context.getString(R.string.delete_prompt), + name + ) + ).setNegativeButton(R.string.dialog_cancel) {} + coreDialog.setCancelable(cancelable) + coreDialog.setCheckboxBox(checkBoxPrompt) + coreDialog.setPositiveButton(R.string.dialog_ok) { + if (onClickPositiveButton == null) { + removeItem(index) + } else { + if (onClickPositiveButton.invoke(index, coreDialog.isChecked())) { + removeItem(index) + } + } + }.show() + // var checked = false // val dialog = MaterialAlertDialogBuilder(context) // if (checkBoxPrompt != null) { diff --git a/app/src/main/java/com/coldmint/rust/pro/dialog/CommentDialog.kt b/app/src/main/java/com/coldmint/rust/pro/dialog/CommentDialog.kt index 72f45bf..83eac84 100644 --- a/app/src/main/java/com/coldmint/rust/pro/dialog/CommentDialog.kt +++ b/app/src/main/java/com/coldmint/rust/pro/dialog/CommentDialog.kt @@ -111,6 +111,15 @@ class CommentDialog(context: Context) : BaseAppDialog(context) { } } + override fun setTitle(string: String): CommentDialog { + viewBinding.titleView.text = string + return this + } + + override fun setTitle(stringRes: Int): CommentDialog { + viewBinding.titleView.setText(stringRes) + return this } + /** * 设置提交函数 * 返回true则结束对话框 diff --git a/app/src/main/java/com/coldmint/rust/pro/fragments/ModFragment.kt b/app/src/main/java/com/coldmint/rust/pro/fragments/ModFragment.kt index a124ce2..6790fe0 100644 --- a/app/src/main/java/com/coldmint/rust/pro/fragments/ModFragment.kt +++ b/app/src/main/java/com/coldmint/rust/pro/fragments/ModFragment.kt @@ -1,34 +1,39 @@ package com.coldmint.rust.pro.fragments -import com.coldmint.rust.core.ModClass -import android.view.LayoutInflater -import android.os.Bundle -import com.coldmint.rust.pro.R -import androidx.recyclerview.widget.LinearLayoutManager -import android.os.Looper -import com.coldmint.rust.pro.tool.GlobalMethod -import com.coldmint.rust.pro.tool.AppSettings -import com.google.android.material.snackbar.Snackbar -import com.google.android.material.bottomsheet.BottomSheetDialog -import com.coldmint.rust.core.dataBean.ModConfigurationData +import android.annotation.SuppressLint import android.content.res.ColorStateList +import android.graphics.drawable.Drawable +import android.graphics.drawable.GradientDrawable import android.os.Build +import android.os.Bundle import android.os.Handler -import android.view.View -import android.widget.* +import android.os.Looper +import android.view.LayoutInflater +import android.view.Window +import androidx.core.view.ViewCompat import androidx.core.view.isVisible import androidx.recyclerview.widget.DividerItemDecoration +import androidx.recyclerview.widget.LinearLayoutManager +import com.coldmint.rust.core.ModClass +import com.coldmint.rust.core.dataBean.ModConfigurationData import com.coldmint.rust.core.tool.FileOperator import com.coldmint.rust.pro.MainActivity +import com.coldmint.rust.pro.R import com.coldmint.rust.pro.adapters.ModActionAdapter import com.coldmint.rust.pro.adapters.ModAdapter import com.coldmint.rust.pro.base.BaseFragment import com.coldmint.rust.pro.databinding.ModDialogBinding import com.coldmint.rust.pro.databinding.ModFragmentBinding import com.coldmint.rust.pro.databinding.ModListItemBinding -import com.google.android.material.divider.MaterialDividerItemDecoration +import com.coldmint.rust.pro.tool.AppSettings +import com.coldmint.rust.pro.tool.GlobalMethod +import com.google.android.material.bottomsheet.BottomSheetDialog +import com.google.android.material.color.MaterialColors +import com.google.android.material.dialog.MaterialAlertDialogBuilder +import com.google.android.material.dialog.MaterialDialogs +import com.google.android.material.shape.MaterialShapeDrawable +import com.google.android.material.snackbar.Snackbar import java.io.File -import java.util.ArrayList import java.util.concurrent.Executors import kotlin.concurrent.thread @@ -248,12 +253,15 @@ class ModFragment : BaseFragment() { loadMods() } + @SuppressLint("RestrictedApi") fun onClickItemWork(viewBinding: ModListItemBinding, modClass: ModClass) { val context = requireContext() val modDialogBinding = ModDialogBinding.inflate(LayoutInflater.from(context)) val bottomSheetDialog = - BottomSheetDialog(context, R.style.BottomSheetDialog) + BottomSheetDialog(context) + + modDialogBinding.modNameView.text = viewBinding.modNameView.text modDialogBinding.modNameDescription.text = viewBinding.modIntroductionView.text val configurationManager = modClass.modConfigurationManager diff --git a/app/src/main/java/com/coldmint/rust/pro/fragments/UserInfoFragment.kt b/app/src/main/java/com/coldmint/rust/pro/fragments/UserInfoFragment.kt index 689b759..eaa498e 100644 --- a/app/src/main/java/com/coldmint/rust/pro/fragments/UserInfoFragment.kt +++ b/app/src/main/java/com/coldmint/rust/pro/fragments/UserInfoFragment.kt @@ -21,7 +21,6 @@ import com.coldmint.rust.pro.tool.AppSettings import com.coldmint.rust.pro.tool.GlobalMethod class UserInfoFragment : BaseFragment() { - lateinit var token: String lateinit var account: String /** @@ -103,11 +102,10 @@ class UserInfoFragment : BaseFragment() { override fun onResume() { super.onResume() - + val token = appSettings.getValue(AppSettings.Setting.Token, "") if (token.isNotBlank()) { User.getUserActivationInfo(token, object : ApiCallBack { - override fun onFailure(e: Exception) { viewBinding.nameView.text = account loadRecyclerView(3) @@ -126,9 +124,11 @@ class UserInfoFragment : BaseFragment() { .apply(GlobalMethod.getRequestOptions(true)) .into(viewBinding.headIconView) } + viewBinding.emailView.text = t.data.email loadRecyclerView(t.data.permission) } else { - viewBinding.nameView.text = t.data.userName +// Toast.makeText(requireContext(), t.toString(), Toast.LENGTH_SHORT).show() + viewBinding.nameView.text = account loadRecyclerView(3) } } @@ -138,7 +138,6 @@ class UserInfoFragment : BaseFragment() { } override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) { - token = appSettings.getValue(AppSettings.Setting.Token, "") account = appSettings.getValue(AppSettings.Setting.Account, "") viewBinding.myHomeView.setOnClickListener { val intent = Intent( diff --git a/app/src/main/java/com/coldmint/rust/pro/viewmodel/StartViewModel.kt b/app/src/main/java/com/coldmint/rust/pro/viewmodel/StartViewModel.kt index 2d24a22..31f8605 100644 --- a/app/src/main/java/com/coldmint/rust/pro/viewmodel/StartViewModel.kt +++ b/app/src/main/java/com/coldmint/rust/pro/viewmodel/StartViewModel.kt @@ -313,7 +313,6 @@ class StartViewModel(application: Application) : BaseAndroidViewModel(applicatio } catch (e: Exception) { e.printStackTrace() } - importingTemplatePackage("ling.rp") importingTemplatePackage("baseTemplate.rp") } diff --git a/app/src/main/res/drawable/about.xml b/app/src/main/res/drawable/about.xml index 9f1caff..b9483c7 100644 --- a/app/src/main/res/drawable/about.xml +++ b/app/src/main/res/drawable/about.xml @@ -2,7 +2,8 @@ android:width="200dp" android:height="200dp" android:viewportWidth="1024" - android:viewportHeight="1024"> + android:viewportHeight="1024" + android:tint="?attr/colorControlNormal"> diff --git a/app/src/main/res/drawable/ban.xml b/app/src/main/res/drawable/ban.xml index 3ba757d..e2013bd 100644 --- a/app/src/main/res/drawable/ban.xml +++ b/app/src/main/res/drawable/ban.xml @@ -2,7 +2,8 @@ android:width="200dp" android:height="200dp" android:viewportWidth="1024" - android:viewportHeight="1024"> + android:viewportHeight="1024" + android:tint="?attr/colorControlNormal"> diff --git a/app/src/main/res/drawable/community.xml b/app/src/main/res/drawable/community.xml index d0e8deb..de3c994 100644 --- a/app/src/main/res/drawable/community.xml +++ b/app/src/main/res/drawable/community.xml @@ -2,7 +2,8 @@ android:width="207.22656dp" android:height="200dp" android:viewportWidth="1061" - android:viewportHeight="1024"> + android:viewportHeight="1024" + android:tint="?attr/colorControlNormal"> diff --git a/app/src/main/res/drawable/empty_content.xml b/app/src/main/res/drawable/empty_content.xml index aacc23e..2101831 100644 --- a/app/src/main/res/drawable/empty_content.xml +++ b/app/src/main/res/drawable/empty_content.xml @@ -2,7 +2,8 @@ android:width="266.79688dp" android:height="200dp" android:viewportWidth="1366" - android:viewportHeight="1024"> + android:viewportHeight="1024" + android:tint="?attr/colorControlNormal"> diff --git a/app/src/main/res/drawable/fans_management.xml b/app/src/main/res/drawable/fans_management.xml index 7783754..56b106c 100644 --- a/app/src/main/res/drawable/fans_management.xml +++ b/app/src/main/res/drawable/fans_management.xml @@ -2,7 +2,8 @@ android:width="200dp" android:height="200dp" android:viewportWidth="1024" - android:viewportHeight="1024"> + android:viewportHeight="1024" + android:tint="?attr/colorControlNormal"> diff --git a/app/src/main/res/drawable/ic_baseline_chevron_right_24.xml b/app/src/main/res/drawable/ic_baseline_chevron_right_24.xml index f988e7d..11d8df3 100644 --- a/app/src/main/res/drawable/ic_baseline_chevron_right_24.xml +++ b/app/src/main/res/drawable/ic_baseline_chevron_right_24.xml @@ -1,5 +1,11 @@ - - + + diff --git a/app/src/main/res/drawable/ic_search_black_24dp.xml b/app/src/main/res/drawable/ic_search_black_24dp.xml index affc7ba..13e67fe 100644 --- a/app/src/main/res/drawable/ic_search_black_24dp.xml +++ b/app/src/main/res/drawable/ic_search_black_24dp.xml @@ -1,9 +1,10 @@ + android:width="24dp" + android:height="24dp" + android:tint="?attr/colorControlNormal" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z" /> diff --git a/app/src/main/res/drawable/link.xml b/app/src/main/res/drawable/link.xml index f3ba52d..335986b 100644 --- a/app/src/main/res/drawable/link.xml +++ b/app/src/main/res/drawable/link.xml @@ -1,9 +1,10 @@ - + diff --git a/app/src/main/res/drawable/round_angle.xml b/app/src/main/res/drawable/round_angle.xml deleted file mode 100644 index 2653da3..0000000 --- a/app/src/main/res/drawable/round_angle.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 233b91e..2573d1b 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -4,13 +4,13 @@ android:id="@+id/drawerlayout" android:layout_width="match_parent" android:layout_height="match_parent" - android:animateLayoutChanges="true"> + android:animateLayoutChanges="true" + android:fitsSystemWindows="false"> + android:layout_height="match_parent"> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_user_home_page.xml b/app/src/main/res/layout/activity_user_home_page.xml index dff2ad1..aa299b1 100644 --- a/app/src/main/res/layout/activity_user_home_page.xml +++ b/app/src/main/res/layout/activity_user_home_page.xml @@ -2,7 +2,8 @@ + android:layout_height="match_parent" + android:fitsSystemWindows="true"> + android:visibility="gone" /> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_web_mod_info.xml b/app/src/main/res/layout/activity_web_mod_info.xml index 68f46cf..4875269 100644 --- a/app/src/main/res/layout/activity_web_mod_info.xml +++ b/app/src/main/res/layout/activity_web_mod_info.xml @@ -239,7 +239,8 @@ + android:layout_marginTop="16dp" + app:dividerThickness="0.8dp" /> diff --git a/app/src/main/res/layout/edit_end.xml b/app/src/main/res/layout/edit_end.xml index 9ac771d..6b123e6 100644 --- a/app/src/main/res/layout/edit_end.xml +++ b/app/src/main/res/layout/edit_end.xml @@ -1,5 +1,6 @@ + + android:text="@string/compilation_prompt" /> @@ -41,16 +41,17 @@ android:id="@+id/imageview" android:layout_width="50dp" android:layout_height="50dp" - android:src="@drawable/log" /> + android:src="@drawable/log" + app:tint="?attr/colorControlNormal" /> + android:text="@string/compilation_prompt" /> + android:text="@string/file_manager" /> @@ -40,6 +39,7 @@ android:orientation="vertical"> + android:visibility="gone" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_user_info.xml b/app/src/main/res/layout/fragment_user_info.xml index 9c2de59..920bd2c 100644 --- a/app/src/main/res/layout/fragment_user_info.xml +++ b/app/src/main/res/layout/fragment_user_info.xml @@ -51,6 +51,7 @@ android:text="@string/name" /> + android:src="@drawable/ic_baseline_chevron_right_24" + app:tint="?attr/colorControlNormal" /> diff --git a/app/src/main/res/layout/head_layout.xml b/app/src/main/res/layout/head_layout.xml index e792997..79b3ad6 100644 --- a/app/src/main/res/layout/head_layout.xml +++ b/app/src/main/res/layout/head_layout.xml @@ -1,33 +1,42 @@ + android:layout_marginHorizontal="16dp" + android:layout_marginTop="16dp" + android:text="@string/user_name" /> + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_audit_mod.xml b/app/src/main/res/layout/item_audit_mod.xml index 0be74f4..013f691 100644 --- a/app/src/main/res/layout/item_audit_mod.xml +++ b/app/src/main/res/layout/item_audit_mod.xml @@ -5,9 +5,7 @@ style="@style/Widget.Material3.CardView.Filled" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="8dp" - app:cardElevation="2dp" - card_view:cardCornerRadius="2dp"> + android:layout_marginBottom="8dp"> + style="@style/TextAppearance.Material3.TitleMedium" /> + android:text="@string/publisher_information" /> + android:text="@string/describe" /> @@ -65,23 +63,19 @@ android:layout_below="@id/infoLayout" android:orientation="horizontal"> - + android:text="@string/refused" />