diff --git a/.gradle/7.3.3/executionHistory/executionHistory.bin b/.gradle/7.3.3/executionHistory/executionHistory.bin index eb437e9..2f9c988 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 0808c27..fa7ea29 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 c2d9856..b207703 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 a0d8741..04eab04 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 cd801b2..dbe03b4 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 1e950d1..e6fc8dc 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 9aac74a..39474ab 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 5437485..242ee0d 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 3bddf36..b0f3220 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,11 +24,11 @@ android { buildToolsVersion "30.0.3" defaultConfig { - applicationId "com.coldmint.rust.pro" + applicationId "com.coldmint.rust.beta" minSdkVersion 21 targetSdkVersion 32 versionCode 18 - versionName "2.0 release8 p3(2022-4-26)" + versionName "2.1 alpha(2022-7-6)" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/com/coldmint/rust/pro/ActivateActivity.kt b/app/src/main/java/com/coldmint/rust/pro/ActivateActivity.kt index 6ddda39..99d9974 100644 --- a/app/src/main/java/com/coldmint/rust/pro/ActivateActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/ActivateActivity.kt @@ -15,8 +15,6 @@ import androidx.core.view.isVisible import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView -import com.afollestad.materialdialogs.MaterialDialog -import com.afollestad.materialdialogs.list.listItems import com.coldmint.rust.core.dataBean.ApiResponse import com.coldmint.rust.core.dataBean.CouponListDataBean import com.coldmint.rust.core.dataBean.PlanDataBean @@ -33,6 +31,7 @@ import com.coldmint.rust.pro.databean.FunctionInfo import com.coldmint.rust.pro.databinding.ActivityActivateBinding import com.coldmint.rust.pro.tool.AppSettings import com.coldmint.rust.pro.tool.GlobalMethod +import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.snackbar.Snackbar class ActivateActivity : BaseActivity() { @@ -283,10 +282,12 @@ class ActivateActivity : BaseActivity() { ) } if (finalCouponId != null) { - MaterialDialog(this).title(R.string.coupon).message(R.string.use_coupon) - .positiveButton(R.string.dialog_ok).positiveButton { + MaterialAlertDialogBuilder(this).setTitle(R.string.coupon) + .setMessage(R.string.use_coupon) + .setPositiveButton(R.string.dialog_ok) { i, i2 -> func.invoke() - }.negativeButton(R.string.dialog_cancel).show() + }.setNegativeButton(R.string.dialog_cancel) { i, i2 -> + }.show() } else { func.invoke() } diff --git a/app/src/main/java/com/coldmint/rust/pro/BookmarkManagerActivity.kt b/app/src/main/java/com/coldmint/rust/pro/BookmarkManagerActivity.kt index fbf48a7..198e5e8 100644 --- a/app/src/main/java/com/coldmint/rust/pro/BookmarkManagerActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/BookmarkManagerActivity.kt @@ -11,14 +11,14 @@ import android.content.Intent import android.view.KeyEvent import android.view.MenuItem import android.view.View +import androidx.appcompat.app.AlertDialog import androidx.core.view.isVisible -import com.afollestad.materialdialogs.MaterialDialog -import com.afollestad.materialdialogs.customview.customView import com.coldmint.rust.pro.adapters.BookmarkAdapter import com.coldmint.rust.pro.base.BaseActivity import com.coldmint.rust.pro.databean.Bookmark import com.coldmint.rust.pro.databinding.ActivityBookmarkManagerBinding import com.coldmint.rust.pro.databinding.EditBookmarkBinding +import com.google.android.material.dialog.MaterialAlertDialogBuilder import java.io.File import java.util.ArrayList @@ -46,7 +46,7 @@ class BookmarkManagerActivity : BaseActivity() { attachFileItemBinding.root.setOnLongClickListener { bookmarkAdapter.showDeleteItemDialog( bookmark.name, - viewHolder.adapterPosition, onClickPositiveButton = { d, b -> + viewHolder.adapterPosition, onClickPositiveButton = { i:Int, b -> bookmarkManager.removeBookmark(bookmark) if (list.isEmpty()) { showNoBookmarkToView() @@ -113,64 +113,65 @@ class BookmarkManagerActivity : BaseActivity() { startActivityForResult(intent, 1) } - val materialDialog = - MaterialDialog(this).title(text = title).customView(view = editBookmarkBinding.root) - .positiveButton(R.string.dialog_ok).negativeButton(R.string.dialog_close) - .noAutoDismiss().cancelable(false) - materialDialog.positiveButton { - val newPath = pathView.text.toString() - val newName = nameView.text.toString() - if (newName.isEmpty()) { - setErrorAndInput(nameView, getString(R.string.enter_bookmark_name)) - return@positiveButton - } - if (newPath.isEmpty()) { - setErrorAndInput(pathView, getString(R.string.enter_file_path)) - return@positiveButton - } - val file = File(newPath) - if (!file.exists()) { - setErrorAndInput(pathView, getString(R.string.bookmark_jump_failed)) - return@positiveButton - } - if (name == null) { - val addBookmark = bookmarkManager.addBookmark(newPath, newName) - if (addBookmark) { - updateView(bookmarkManager.list()) - - } else { - setErrorAndInput( - pathView, - getString(R.string.bookmark_already_exists) - ) + var dialog: AlertDialog? = null + val materialAlertDialogBuilder = MaterialAlertDialogBuilder(this) + .setView(editBookmarkBinding.root) + .setTitle(title) + .setPositiveButton(R.string.dialog_ok) + { i, i2 -> + val newPath = pathView.text.toString() + val newName = nameView.text.toString() + if (newName.isEmpty()) { + setErrorAndInput(nameView, getString(R.string.enter_bookmark_name)) + return@setPositiveButton } - } else { - if (name == newName && path == newPath) { - materialDialog.dismiss() + if (newPath.isEmpty()) { + setErrorAndInput(pathView, getString(R.string.enter_file_path)) + return@setPositiveButton + } + val file = File(newPath) + if (!file.exists()) { + setErrorAndInput(pathView, getString(R.string.bookmark_jump_failed)) + return@setPositiveButton + } + if (name == null) { + val addBookmark = bookmarkManager.addBookmark(newPath, newName) + if (addBookmark) { + updateView(bookmarkManager.list()) + + } else { + setErrorAndInput( + pathView, + getString(R.string.bookmark_already_exists) + ) + } } else { - if (path != null) { - val oldBookmark = Bookmark(path, name) - val newBookmark = Bookmark(newPath, newName) - val addBookmark = - bookmarkManager.replaceBookmark(oldBookmark, newBookmark) - if (addBookmark) { - updateView(bookmarkManager.list()) - materialDialog.dismiss() - } else { - setErrorAndInput( - pathView, - getString(R.string.bookmark_already_exists) - ) + if (name == newName && path == newPath) { + dialog?.dismiss() + } else { + if (path != null) { + val oldBookmark = Bookmark(path, name) + val newBookmark = Bookmark(newPath, newName) + val addBookmark = + bookmarkManager.replaceBookmark(oldBookmark, newBookmark) + if (addBookmark) { + updateView(bookmarkManager.list()) + dialog?.dismiss() + } else { + setErrorAndInput( + pathView, + getString(R.string.bookmark_already_exists) + ) + } } } } } - materialDialog.dismiss() - } - materialDialog.negativeButton { - materialDialog.dismiss() - } - materialDialog.show() + .setNegativeButton(R.string.dialog_close) { i, i2 -> + dialog?.dismiss() + } + .setCancelable(false) + dialog = materialAlertDialogBuilder.show() } 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 d84b2c4..8d04f34 100644 --- a/app/src/main/java/com/coldmint/rust/pro/CreationWizardActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/CreationWizardActivity.kt @@ -27,82 +27,137 @@ class CreationWizardActivity : BaseActivity() { viewBinding.recyclerView.layoutManager = LinearLayoutManager(this) when (temType) { "mod" -> { - val dataList = ArrayList() - dataList.add( - GuideData( - R.string.create_mod_lable, - R.string.create_mod_describe, - R.drawable.ic_outline_create_24 - ) - ) - dataList.add( - GuideData( - R.string.import_mod, - R.string.import_mod_from_file_manager_describe, - R.drawable.folder - ) - ) - dataList.add( - GuideData( - R.string.import_mod_from_package_directory, - R.string.import_mod_from_package_directory_describe, - R.drawable.zip - ) - ) - dataList.add( - GuideData( - R.string.import_mod_from_recycle_bin, - R.string.import_mod_from_recycle_bin_describe, - R.drawable.auto_delete - ) - ) - val adapter = GuideAdapter(this, dataList) - adapter.setItemEvent { i, itemGuideBinding, viewHolder, guideData -> - itemGuideBinding.root.setOnClickListener { - finish() - when (guideData.titleRes) { - R.string.create_mod_lable -> { - startActivity( - Intent( - this, - CreateModActivity::class.java - ) - ) - } - R.string.import_mod -> { - val startIntent = - Intent(this, FileManagerActivity::class.java) - val fileBundle = Bundle() - fileBundle.putString("type", "selectFile") - startIntent.putExtra("data", fileBundle) - startActivity(startIntent) - } - R.string.import_mod_from_package_directory -> { - val startIntent = - Intent(this, FileManagerActivity::class.java) - val fileBundle = Bundle() - fileBundle.putString("type", "selectFile") - val packDirectory = appSettings.getValue( - AppSettings.Setting.PackDirectory, - AppSettings.dataRootDirectory + "/bin/" - ) - fileBundle.putString("path", packDirectory) - fileBundle.putString("rootpath", packDirectory) - startIntent.putExtra("data", fileBundle) - startActivity(startIntent) - } - R.string.import_mod_from_recycle_bin -> { - startActivity(Intent(this, RecyclingStationActivity::class.java)) - } - } - } - } - - viewBinding.recyclerView.adapter = adapter + loadMod() + } + "template" -> { + loadTemplate() } } } + /** + * 加载模板活动 + */ + fun loadTemplate() { + val dataList = ArrayList() + dataList.add( + GuideData( + R.string.create_template, + R.string.create_template_describe, + R.drawable.ic_outline_create_24 + ) + ) + dataList.add( + GuideData( + R.string.import_template, + R.string.import_template_describe, + R.drawable.folder + ) + ) + val adapter = GuideAdapter(this, dataList) + adapter.setItemEvent { i, itemGuideBinding, viewHolder, guideData -> + itemGuideBinding.root.setOnClickListener { + finish() + when (guideData.titleRes) { + R.string.create_template -> { + startActivity( + Intent( + this, + CreateTemplateActivity::class.java + ) + ) + } + R.string.import_template -> { + val startIntent = + Intent(this, FileManagerActivity::class.java) + val fileBundle = Bundle() + fileBundle.putString("type", "selectFile") + startIntent.putExtra("data", fileBundle) + startActivity(startIntent ) + } + } + } + } + viewBinding.recyclerView.adapter = adapter + } + + /** + * 加载模组活动 + */ + fun loadMod() { + val dataList = ArrayList() + dataList.add( + GuideData( + R.string.create_mod_lable, + R.string.create_mod_describe, + R.drawable.ic_outline_create_24 + ) + ) + dataList.add( + GuideData( + R.string.import_mod, + R.string.import_mod_from_file_manager_describe, + R.drawable.folder + ) + ) + dataList.add( + GuideData( + R.string.import_mod_from_package_directory, + R.string.import_mod_from_package_directory_describe, + R.drawable.zip + ) + ) + dataList.add( + GuideData( + R.string.import_mod_from_recycle_bin, + R.string.import_mod_from_recycle_bin_describe, + R.drawable.auto_delete + ) + ) + val adapter = GuideAdapter(this, dataList) + adapter.setItemEvent { i, itemGuideBinding, viewHolder, guideData -> + itemGuideBinding.root.setOnClickListener { + finish() + when (guideData.titleRes) { + R.string.create_mod_lable -> { + startActivity( + Intent( + this, + CreateModActivity::class.java + ) + ) + } + R.string.import_mod -> { + val startIntent = + Intent(this, FileManagerActivity::class.java) + val fileBundle = Bundle() + fileBundle.putString("type", "selectFile") + startIntent.putExtra("data", fileBundle) + startActivity(startIntent) + } + R.string.import_mod_from_package_directory -> { + val startIntent = + Intent(this, FileManagerActivity::class.java) + val fileBundle = Bundle() + fileBundle.putString("type", "selectFile") + val packDirectory = appSettings.getValue( + AppSettings.Setting.PackDirectory, + AppSettings.dataRootDirectory + "/bin/" + ) + fileBundle.putString("path", packDirectory) + fileBundle.putString("rootpath", packDirectory) + startIntent.putExtra("data", fileBundle) + startActivity(startIntent) + } + R.string.import_mod_from_recycle_bin -> { + startActivity(Intent(this, RecyclingStationActivity::class.java)) + } + } + } + } + viewBinding.recyclerView.adapter = adapter + } + override fun getViewBindingObject(): ActivityCreationWizardBinding { return ActivityCreationWizardBinding.inflate(layoutInflater) } 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 f637cc9..7fba68c 100644 --- a/app/src/main/java/com/coldmint/rust/pro/MainActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/MainActivity.kt @@ -2,13 +2,11 @@ package com.coldmint.rust.pro import android.Manifest +import android.content.DialogInterface import com.coldmint.rust.pro.base.BaseActivity import com.coldmint.rust.pro.tool.GlobalMethod -import com.coldmint.rust.core.iflynote.SquareBracketData import android.content.pm.PackageInfo import com.coldmint.rust.pro.tool.AppSettings -import com.afollestad.materialdialogs.MaterialDialog -import com.afollestad.materialdialogs.bottomsheets.BottomSheet import android.content.Intent import android.content.pm.PackageManager import com.google.android.material.snackbar.Snackbar @@ -25,6 +23,7 @@ import androidx.core.view.isVisible import androidx.lifecycle.ViewModelProvider import androidx.navigation.findNavController import androidx.navigation.ui.* +import com.afollestad.materialdialogs.MaterialDialog import com.bumptech.glide.Glide import com.coldmint.rust.core.CompressionManager import com.coldmint.rust.core.TemplatePackage @@ -42,6 +41,8 @@ import com.coldmint.rust.core.web.ServerConfiguration import com.coldmint.rust.pro.databinding.ActivityMainBinding import com.coldmint.rust.pro.databinding.HeadLayoutBinding import com.coldmint.rust.pro.viewmodel.StartViewModel +import com.google.android.material.bottomsheet.BottomSheetDialogFragment +import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.tabs.TabLayout import com.google.gson.Gson import com.permissionx.guolindev.PermissionX @@ -188,23 +189,23 @@ class MainActivity : BaseActivity() { } //显示对话框 runOnUiThread { - val materialDialog = MaterialDialog(this@MainActivity, BottomSheet()) - materialDialog.title(text = data.title).message(text = data.content) + val materialAlertDialogBuilder = + MaterialAlertDialogBuilder(this).setTitle(data.title).setMessage(data.content) if (data.forced) { - materialDialog.noAutoDismiss() //禁用点击空白关闭 - materialDialog.cancelable(false) + materialAlertDialogBuilder.setCancelable(false) } else { - materialDialog.negativeButton( + materialAlertDialogBuilder.setNegativeButton( R.string.dialog_cancel - ) + ) { i, i2 -> + } } - materialDialog.positiveButton( + materialAlertDialogBuilder.setPositiveButton( R.string.downlod - ) { + ) { i, i2 -> AppOperator.useBrowserAccessWebPage(this, data.link) } - materialDialog.show() + materialAlertDialogBuilder.show() } } } @@ -223,20 +224,19 @@ class MainActivity : BaseActivity() { val versionCode = packageInfo.versionCode //如果在1.15 p3及以上 (159) if (versionCode >= 159) { - MaterialDialog(this).show { - title(R.string.game_configured).message(R.string.unable_to_detect) - .positiveButton(R.string.show_details) - .positiveButton { - startActivity( - Intent( - this@MainActivity, - GameCheckActivity::class.java - ) + MaterialAlertDialogBuilder(this).setTitle(R.string.game_configured) + .setMessage(R.string.unable_to_detect) + .setPositiveButton(R.string.show_details) { i, i2 -> + startActivity( + Intent( + this@MainActivity, + GameCheckActivity::class.java ) - }.neutralButton(R.string.no_longer_prompt).neutralButton { - appSettings.setValue(AppSettings.Setting.SetGameStorage, true) - }.negativeButton(R.string.dialog_cancel).cancelable(false) - } + ) + }.setNeutralButton(R.string.no_longer_prompt) { i, i2 -> + appSettings.setValue(AppSettings.Setting.SetGameStorage, true) + }.setNeutralButton(R.string.dialog_cancel) { i, i2 -> + }.setCancelable(false).show() } else { appSettings.setValue(AppSettings.Setting.SetGameStorage, true) } @@ -319,29 +319,9 @@ class MainActivity : BaseActivity() { startActivity(intent) } templateItem -> { - val popupMenu = PopupMenu(this@MainActivity, viewBinding.mainButton) - popupMenu.menu.add(R.string.create_template) - popupMenu.menu.add(R.string.import_template) - popupMenu.setOnMenuItemClickListener { item -> - val title = item.title.toString() - if (title == getString(R.string.create_template)) { - startActivity( - Intent( - this@MainActivity, - CreateTemplateActivity::class.java - ) - ) - } else if (title == getString(R.string.import_template)) { - val startIntent = - Intent(this@MainActivity, FileManagerActivity::class.java) - val fileBundle = Bundle() - fileBundle.putString("type", "selectFile") - startIntent.putExtra("data", fileBundle) - startActivityForResult(startIntent, 2) - } - true - } - popupMenu.show() + val intent = Intent(this, CreationWizardActivity::class.java) + intent.putExtra("type", "template") + startActivity(intent) } else -> { Toast.makeText(this@MainActivity, "请设置事件", Toast.LENGTH_SHORT).show() @@ -581,17 +561,16 @@ class MainActivity : BaseActivity() { } if (newInfo.versionNum < oldInfo.versionNum) { handler.post { - MaterialDialog(this).show { - title(text = oldInfo.name).cancelable(false).message( - text = String.format( - getString(R.string.covers_the_import), - newInfo.versionName, oldInfo.versionName - ) - ).positiveButton(R.string.dialog_ok).positiveButton { - FileOperator.delete_files(templateDirectory) - importTemplate(formFile, templateDirectory) - }.negativeButton(R.string.dialog_cancel) - } + MaterialAlertDialogBuilder(this).setTitle(oldInfo.name).setMessage( + String.format( + getString(R.string.covers_the_import), + newInfo.versionName, oldInfo.versionName + ) + ).setPositiveButton(R.string.dialog_ok) { i, i2 -> + FileOperator.delete_files(templateDirectory) + importTemplate(formFile, templateDirectory) + }.setNegativeButton(R.string.dialog_cancel) { i, i2 -> + }.show() } return@Runnable } else { @@ -663,16 +642,15 @@ class MainActivity : BaseActivity() { override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { if (keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_DOWN) { - MaterialDialog(this).show { - title(R.string.dialog_close).message( - text = String.format( - getString(R.string.exit_tip), - getString(R.string.app_name) - ) - ).cancelable(false).positiveButton(R.string.dialog_ok) { - finish() - }.negativeButton(R.string.dialog_cancel) - } + MaterialAlertDialogBuilder(this).setTitle(R.string.dialog_close).setMessage( + String.format( + getString(R.string.exit_tip), + getString(R.string.app_name) + ) + ).setPositiveButton(R.string.dialog_ok) { i, i2 -> + finish() + }.setNegativeButton(R.string.dialog_cancel) { i, i2 -> + }.show() return true } return super.onKeyDown(keyCode, event) @@ -722,19 +700,17 @@ class MainActivity : BaseActivity() { startViewModel.needLoginLiveData.observe(this) { if (it) { - MaterialDialog(this, BottomSheet()).show { - title(R.string.login).message(R.string.login_tip).cancelable(false) - .positiveButton(R.string.login) { - startActivity( - Intent( - context, - LoginActivity::class.java - ) - ) - }.negativeButton(R.string.dialog_close).negativeButton { - finish() - } - } + MaterialAlertDialogBuilder(this).setTitle(R.string.login) + .setMessage(R.string.login_tip).setPositiveButton(R.string.login) { i, i2 -> + startActivity( + Intent( + this, + LoginActivity::class.java + ) + ) + }.setNegativeButton(R.string.dialog_close) { i, i2 -> + finish() + }.show() } else { showGameConfiguredDialog() } 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 ba332d1..a1b5203 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 @@ -14,15 +14,15 @@ import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import androidx.viewbinding.ViewBinding -import com.afollestad.materialdialogs.MaterialDialog -import com.afollestad.materialdialogs.checkbox.checkBoxPrompt import com.coldmint.rust.pro.R import com.coldmint.rust.pro.databinding.ActivityWebModInfoBinding import com.coldmint.rust.pro.interfaces.ItemChangeEvent import com.coldmint.rust.pro.interfaces.ItemEvent import android.text.style.ForegroundColorSpan import android.text.style.StyleSpan +import androidx.appcompat.app.AlertDialog import androidx.core.text.toSpannable +import com.google.android.material.dialog.MaterialAlertDialogBuilder abstract class BaseAdapter( @@ -147,38 +147,39 @@ abstract class BaseAdapter( * @param cancelable Boolean 是否可取消 * @param checkBoxPrompt 选择框显示的文本 */ + @Deprecated("已废弃") fun showDeleteItemDialog( name: String, index: Int, - onClickPositiveButton: ((MaterialDialog, Boolean) -> Boolean)? = null, + onClickPositiveButton: ((Int, Boolean) -> Boolean)? = null, cancelable: Boolean = false, checkBoxPrompt: String? = null - ): MaterialDialog { - var checked = false - val dialog = MaterialDialog(context) - if (checkBoxPrompt != null) { - dialog.checkBoxPrompt(text = checkBoxPrompt, onToggle = { - checked = it - }) - } - dialog.title(R.string.delete_title).message( - text = String.format( - context.getString(R.string.delete_prompt), - name - ) - ).positiveButton(R.string.dialog_ok).positiveButton { - if (onClickPositiveButton == null) { - removeItem(index) - } else { - if (onClickPositiveButton.invoke(dialog, checked)) { - removeItem(index) - } - } - }.negativeButton(R.string.dialog_cancel).cancelable(cancelable) - handler.post { - dialog.show() - } - return dialog + ) { +// var checked = false +// val dialog = MaterialAlertDialogBuilder(context) +// if (checkBoxPrompt != null) { +// dialog.checkBoxPrompt(text = checkBoxPrompt, onToggle = { +// checked = it +// }) +// } +// dialog.title(R.string.delete_title).message( +// text = String.format( +// context.getString(R.string.delete_prompt), +// name +// ) +// ).positiveButton(R.string.dialog_ok).positiveButton { +// if (onClickPositiveButton == null) { +// removeItem(index) +// } else { +// if (onClickPositiveButton.invoke(dialog, checked)) { +// removeItem(index) +// } +// } +// }.negativeButton(R.string.dialog_cancel).cancelable(cancelable) +// handler.post { +// dialog.show() +// } +// return dialog } /** diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f76b13d..d694be4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -119,6 +119,7 @@ 编辑文本 导入模板包 + 从文件管理导入模板包。 导入模组 从文件管理导入模组。 回收站 @@ -193,6 +194,7 @@ 附加 模板名称 创建模板包 + 创建一个模板包,用于存放单位动态模板。 请输入模板名称。 请输入开发者。 请输入描述。 diff --git a/local.properties b/local.properties index dbd4035..c71c5c8 100644 --- a/local.properties +++ b/local.properties @@ -4,5 +4,5 @@ # Location of the SDK. This is only used by Gradle. # For customization when using a Version Control System, please read the # header note. -#Wed Jul 06 10:56:35 CST 2022 -sdk.dir=D\:\\Android_SDK +#Wed Jul 06 21:08:32 CST 2022 +sdk.dir=D\:\\Document\\AndroidSdk