1.修复近期收集的严重崩溃问题。2.调整全部页面仅竖屏显示。3.优化弹出菜单的样式适配M3。4.调整默认编辑框颜色。5.优化搜索结果页面的显示。6.解决替换文本崩溃的问题。
This commit is contained in:
parent
c8f45509c4
commit
7dd6e16c49
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -26,19 +26,24 @@
|
||||||
android:usesCleartextTraffic="true">
|
android:usesCleartextTraffic="true">
|
||||||
<activity
|
<activity
|
||||||
android:name=".FeedbackActivity"
|
android:name=".FeedbackActivity"
|
||||||
android:exported="false" />
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".ChangePasswordActivity"
|
android:name=".ChangePasswordActivity"
|
||||||
android:exported="false" />
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".NetworkTemplatePackageDetailsActivity"
|
android:name=".NetworkTemplatePackageDetailsActivity"
|
||||||
android:exported="false" />
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".CustomizeEditTextActivity"
|
android:name=".CustomizeEditTextActivity"
|
||||||
android:exported="false" />
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".SearchActivity"
|
android:name=".SearchActivity"
|
||||||
android:exported="false" />
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="androidx.core.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
|
|
|
@ -325,6 +325,7 @@ class CustomizeEditTextActivity : BaseActivity<ActivityCustomizeEditTextBinding>
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
if (item.itemId == android.R.id.home) {
|
if (item.itemId == android.R.id.home) {
|
||||||
showSaveDialogIfNeed()
|
showSaveDialogIfNeed()
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item)
|
return super.onOptionsItemSelected(item)
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,7 +265,7 @@ class EditActivity : BaseActivity<ActivityEditBinding>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tab.view.setOnLongClickListener {
|
tab.view.setOnLongClickListener {
|
||||||
val popupMenu = PopupMenu(this@EditActivity, it)
|
val popupMenu = GlobalMethod.createPopMenu(it)
|
||||||
popupMenu.menu.add(R.string.open_directory_of_file)
|
popupMenu.menu.add(R.string.open_directory_of_file)
|
||||||
if (viewModel.openedSourceFileListLiveData.value.size > 1) {
|
if (viewModel.openedSourceFileListLiveData.value.size > 1) {
|
||||||
popupMenu.menu.add(R.string.close)
|
popupMenu.menu.add(R.string.close)
|
||||||
|
@ -514,7 +514,7 @@ class EditActivity : BaseActivity<ActivityEditBinding>() {
|
||||||
private fun initStartView() {
|
private fun initStartView() {
|
||||||
editStartBinding.fileList.layoutManager = LinearLayoutManager(this)
|
editStartBinding.fileList.layoutManager = LinearLayoutManager(this)
|
||||||
editStartBinding.fab.setOnClickListener {
|
editStartBinding.fab.setOnClickListener {
|
||||||
val popupMenu = PopupMenu(this@EditActivity, editStartBinding.fab)
|
val popupMenu = GlobalMethod.createPopMenu(editStartBinding.fab)
|
||||||
if (fileAdapter != null) {
|
if (fileAdapter != null) {
|
||||||
val selectPath = fileAdapter!!.selectPath
|
val selectPath = fileAdapter!!.selectPath
|
||||||
if (selectPath != null) {
|
if (selectPath != null) {
|
||||||
|
@ -686,7 +686,7 @@ class EditActivity : BaseActivity<ActivityEditBinding>() {
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
val popupMenu = PopupMenu(this@EditActivity, it)
|
val popupMenu = GlobalMethod.createPopMenu(it)
|
||||||
val cutBoardMenu = popupMenu.menu.addSubMenu(R.string.cut_board_operation)
|
val cutBoardMenu = popupMenu.menu.addSubMenu(R.string.cut_board_operation)
|
||||||
val fileMenu = popupMenu.menu.addSubMenu(R.string.file_operation)
|
val fileMenu = popupMenu.menu.addSubMenu(R.string.file_operation)
|
||||||
val bookmarksMenu = popupMenu.menu.addSubMenu(R.string.mine_bookmarks)
|
val bookmarksMenu = popupMenu.menu.addSubMenu(R.string.mine_bookmarks)
|
||||||
|
@ -1272,9 +1272,9 @@ class EditActivity : BaseActivity<ActivityEditBinding>() {
|
||||||
R.id.display_source_code -> {
|
R.id.display_source_code -> {
|
||||||
val file = File(viewModel.getNowOpenFilePath())
|
val file = File(viewModel.getNowOpenFilePath())
|
||||||
val code = FileOperator.readFile(file)
|
val code = FileOperator.readFile(file)
|
||||||
MaterialAlertDialogBuilder(this).setTitle(file.name).setMessage(code).setNegativeButton(R.string.dialog_ok){
|
MaterialAlertDialogBuilder(this).setTitle(file.name).setMessage(code)
|
||||||
i,i2->
|
.setNegativeButton(R.string.dialog_ok) { i, i2 ->
|
||||||
}.setCancelable(false).show()
|
}.setCancelable(false).show()
|
||||||
}
|
}
|
||||||
R.id.clear_code_cache -> {
|
R.id.clear_code_cache -> {
|
||||||
Snackbar.make(
|
Snackbar.make(
|
||||||
|
@ -1298,9 +1298,9 @@ class EditActivity : BaseActivity<ActivityEditBinding>() {
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
R.id.code_navigation -> {
|
// R.id.code_navigation -> {
|
||||||
// viewModel.executorService.submit {
|
// viewModel.executorService.submit {
|
||||||
// val labels = viewBinding.codeEditor.textAnalyzeResult.navigation
|
// val labels = viewBinding.codeEditor..navigation
|
||||||
// if (labels == null || labels.size == 0) {
|
// if (labels == null || labels.size == 0) {
|
||||||
// runOnUiThread {
|
// runOnUiThread {
|
||||||
// Snackbar.make(
|
// Snackbar.make(
|
||||||
|
@ -1342,7 +1342,7 @@ class EditActivity : BaseActivity<ActivityEditBinding>() {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
}
|
// }
|
||||||
R.id.save_text -> {
|
R.id.save_text -> {
|
||||||
val openedSourceFile =
|
val openedSourceFile =
|
||||||
viewModel.openedSourceFileListLiveData.getOpenedSourceFile(viewBinding.tabLayout.selectedTabPosition)
|
viewModel.openedSourceFileListLiveData.getOpenedSourceFile(viewBinding.tabLayout.selectedTabPosition)
|
||||||
|
@ -1395,7 +1395,7 @@ class EditActivity : BaseActivity<ActivityEditBinding>() {
|
||||||
viewBinding.searchLayout.isVisible = true
|
viewBinding.searchLayout.isVisible = true
|
||||||
viewBinding.allButton.isVisible = false
|
viewBinding.allButton.isVisible = false
|
||||||
viewBinding.replaceEditText.setText("")
|
viewBinding.replaceEditText.setText("")
|
||||||
viewBinding.replaceEditText.isVisible = false
|
viewBinding.replaceLayout.isVisible = false
|
||||||
viewBinding.findEditText.setText("")
|
viewBinding.findEditText.setText("")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1413,31 +1413,48 @@ class EditActivity : BaseActivity<ActivityEditBinding>() {
|
||||||
}
|
}
|
||||||
viewBinding.nextButton.setOnClickListener {
|
viewBinding.nextButton.setOnClickListener {
|
||||||
val find = viewBinding.findEditText.text.toString()
|
val find = viewBinding.findEditText.text.toString()
|
||||||
viewBinding.codeEditor.searcher.search(find, EditorSearcher.SearchOptions(false, false))
|
if (find.isNotBlank()) {
|
||||||
viewBinding.codeEditor.searcher.gotoNext()
|
viewBinding.codeEditor.searcher.search(
|
||||||
|
find,
|
||||||
|
EditorSearcher.SearchOptions(false, false)
|
||||||
|
)
|
||||||
|
viewBinding.codeEditor.searcher.gotoNext()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
viewBinding.lastButton.setOnClickListener {
|
viewBinding.lastButton.setOnClickListener {
|
||||||
val find = viewBinding.findEditText.text.toString()
|
val find = viewBinding.findEditText.text.toString()
|
||||||
viewBinding.codeEditor.searcher.search(find, EditorSearcher.SearchOptions(false, false))
|
if (find.isNotBlank()) {
|
||||||
viewBinding.codeEditor.searcher.gotoPrevious()
|
viewBinding.codeEditor.searcher.search(
|
||||||
|
find,
|
||||||
|
EditorSearcher.SearchOptions(false, false)
|
||||||
|
)
|
||||||
|
viewBinding.codeEditor.searcher.gotoPrevious()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
viewBinding.allButton.setOnClickListener {
|
viewBinding.allButton.setOnClickListener {
|
||||||
val find = viewBinding.findEditText.text.toString()
|
val find = viewBinding.findEditText.text.toString()
|
||||||
val re = viewBinding.replaceEditText.text.toString()
|
val re = viewBinding.replaceEditText.text.toString()
|
||||||
viewBinding.codeEditor.searcher.search(find, EditorSearcher.SearchOptions(false, false))
|
if (find.isNotBlank() && re.isNotBlank()) {
|
||||||
viewBinding.codeEditor.searcher.replaceAll(re)
|
viewBinding.codeEditor.searcher.search(
|
||||||
|
find,
|
||||||
|
EditorSearcher.SearchOptions(false, false)
|
||||||
|
)
|
||||||
|
viewBinding.codeEditor.searcher.replaceAll(re)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
viewBinding.replaceButton.setOnClickListener {
|
viewBinding.replaceButton.setOnClickListener {
|
||||||
val isVisible = viewBinding.replaceLayout.isVisible
|
val isVisible = viewBinding.replaceLayout.isVisible
|
||||||
if (isVisible) {
|
if (isVisible) {
|
||||||
val find = viewBinding.findEditText.text.toString()
|
val find = viewBinding.findEditText.text.toString()
|
||||||
val re = viewBinding.replaceEditText.text.toString()
|
val re = viewBinding.replaceEditText.text.toString()
|
||||||
viewBinding.codeEditor.searcher.search(
|
if (find.isNotBlank() && re.isNotBlank()) {
|
||||||
find,
|
viewBinding.codeEditor.searcher.search(
|
||||||
EditorSearcher.SearchOptions(false, false)
|
find,
|
||||||
)
|
EditorSearcher.SearchOptions(false, false)
|
||||||
viewBinding.codeEditor.searcher.replaceThis(re)
|
)
|
||||||
|
viewBinding.codeEditor.searcher.replaceThis(re)
|
||||||
|
viewBinding.codeEditor.searcher.gotoNext()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
viewBinding.replaceLayout.isVisible = true
|
viewBinding.replaceLayout.isVisible = true
|
||||||
viewBinding.allButton.isVisible = true
|
viewBinding.allButton.isVisible = true
|
||||||
|
|
|
@ -262,7 +262,7 @@ class EditModInfoActivity : BaseActivity<ActivityEditModInfoBinding>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
viewBinding.iconView.setOnClickListener {
|
viewBinding.iconView.setOnClickListener {
|
||||||
val popupMenu = PopupMenu(this@EditModInfoActivity, viewBinding.iconView)
|
val popupMenu = GlobalMethod.createPopMenu(it)
|
||||||
if (mNeedIcon) {
|
if (mNeedIcon) {
|
||||||
popupMenu.menu.add(R.string.change_image)
|
popupMenu.menu.add(R.string.change_image)
|
||||||
popupMenu.menu.add(R.string.del_image)
|
popupMenu.menu.add(R.string.del_image)
|
||||||
|
|
|
@ -149,7 +149,7 @@ class EditUserInfoActivity : BaseActivity<ActivityEditUserInfoBinding>() {
|
||||||
})
|
})
|
||||||
|
|
||||||
viewBinding.iconView.setOnClickListener {
|
viewBinding.iconView.setOnClickListener {
|
||||||
val popupMenu = PopupMenu(this, viewBinding.iconView)
|
val popupMenu = GlobalMethod.createPopMenu(it)
|
||||||
popupMenu.menu.add(R.string.from_url)
|
popupMenu.menu.add(R.string.from_url)
|
||||||
if (needIcon) {
|
if (needIcon) {
|
||||||
popupMenu.menu.add(R.string.change_image)
|
popupMenu.menu.add(R.string.change_image)
|
||||||
|
@ -168,18 +168,18 @@ class EditUserInfoActivity : BaseActivity<ActivityEditUserInfoBinding>() {
|
||||||
startIntent.putExtra("data", fileBundle)
|
startIntent.putExtra("data", fileBundle)
|
||||||
startActivityForResult(startIntent, 1)
|
startActivityForResult(startIntent, 1)
|
||||||
} else if (title == getString(R.string.from_url)) {
|
} else if (title == getString(R.string.from_url)) {
|
||||||
InputDialog(this).setTitle(R.string.from_url).setMessage(R.string.from_url_tip).setErrorTip { s, textInputLayout ->
|
InputDialog(this).setTitle(R.string.from_url).setMessage(R.string.from_url_tip)
|
||||||
if (s.matches(Regex("^http://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?$|^https://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?$"))) {
|
.setErrorTip { s, textInputLayout ->
|
||||||
textInputLayout.error = getString(R.string.from_url_tip)
|
if (s.matches(Regex("^http://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?$|^https://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?$"))) {
|
||||||
} else {
|
textInputLayout.error = getString(R.string.from_url_tip)
|
||||||
textInputLayout.isErrorEnabled = false
|
} else {
|
||||||
}
|
textInputLayout.isErrorEnabled = false
|
||||||
}.setPositiveButton(R.string.dialog_ok){
|
}
|
||||||
input->
|
}.setPositiveButton(R.string.dialog_ok) { input ->
|
||||||
needCleanCache = true
|
needCleanCache = true
|
||||||
loadIcon(input)
|
loadIcon(input)
|
||||||
true
|
true
|
||||||
}.setNegativeButton(R.string.dialog_close){
|
}.setNegativeButton(R.string.dialog_close) {
|
||||||
|
|
||||||
}.show()
|
}.show()
|
||||||
} else {
|
} else {
|
||||||
|
@ -195,7 +195,7 @@ class EditUserInfoActivity : BaseActivity<ActivityEditUserInfoBinding>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
viewBinding.coverView.setOnClickListener {
|
viewBinding.coverView.setOnClickListener {
|
||||||
val popupMenu = PopupMenu(this, viewBinding.coverView)
|
val popupMenu = GlobalMethod.createPopMenu(it)
|
||||||
popupMenu.menu.add(R.string.from_url)
|
popupMenu.menu.add(R.string.from_url)
|
||||||
if (needCover) {
|
if (needCover) {
|
||||||
popupMenu.menu.add(R.string.change_image)
|
popupMenu.menu.add(R.string.change_image)
|
||||||
|
@ -214,18 +214,18 @@ class EditUserInfoActivity : BaseActivity<ActivityEditUserInfoBinding>() {
|
||||||
startIntent.putExtra("data", fileBundle)
|
startIntent.putExtra("data", fileBundle)
|
||||||
startActivityForResult(startIntent, 2)
|
startActivityForResult(startIntent, 2)
|
||||||
} else if (title == getString(R.string.from_url)) {
|
} else if (title == getString(R.string.from_url)) {
|
||||||
InputDialog(this).setTitle(R.string.from_url).setMessage(R.string.from_url_tip).setErrorTip { s, textInputLayout ->
|
InputDialog(this).setTitle(R.string.from_url).setMessage(R.string.from_url_tip)
|
||||||
if (s.matches(Regex("^http://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?$|^https://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?$"))) {
|
.setErrorTip { s, textInputLayout ->
|
||||||
textInputLayout.error = getString(R.string.from_url_tip)
|
if (s.matches(Regex("^http://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?$|^https://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?$"))) {
|
||||||
} else {
|
textInputLayout.error = getString(R.string.from_url_tip)
|
||||||
textInputLayout.isErrorEnabled = false
|
} else {
|
||||||
}
|
textInputLayout.isErrorEnabled = false
|
||||||
}.setPositiveButton(R.string.dialog_ok){
|
}
|
||||||
input->
|
}.setPositiveButton(R.string.dialog_ok) { input ->
|
||||||
needCleanCache = true
|
needCleanCache = true
|
||||||
loadCover(input)
|
loadCover(input)
|
||||||
true
|
true
|
||||||
}.setNegativeButton(R.string.dialog_close){
|
}.setNegativeButton(R.string.dialog_close) {
|
||||||
|
|
||||||
}.show()
|
}.show()
|
||||||
|
|
||||||
|
@ -341,6 +341,14 @@ class EditUserInfoActivity : BaseActivity<ActivityEditUserInfoBinding>() {
|
||||||
val type = FileOperator.getFileType(newIconFile)
|
val type = FileOperator.getFileType(newIconFile)
|
||||||
if (type == "png" || type == "jpg") {
|
if (type == "png" || type == "jpg") {
|
||||||
val bitmap = BitmapFactory.decodeFile(newIconFile.absolutePath)
|
val bitmap = BitmapFactory.decodeFile(newIconFile.absolutePath)
|
||||||
|
if (bitmap == null) {
|
||||||
|
Snackbar.make(
|
||||||
|
viewBinding.button,
|
||||||
|
getString(R.string.parsing_picture_error),
|
||||||
|
Snackbar.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
return
|
||||||
|
}
|
||||||
if (bitmap.height == bitmap.width) {
|
if (bitmap.height == bitmap.width) {
|
||||||
needCleanCache = true
|
needCleanCache = true
|
||||||
loadIcon(filePath)
|
loadIcon(filePath)
|
||||||
|
|
|
@ -28,7 +28,7 @@ class ErrorInfoActivity : BaseActivity<ActivityErrorInfoBinding>() {
|
||||||
|
|
||||||
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
|
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
|
||||||
if (canUseView) {
|
if (canUseView) {
|
||||||
viewBinding.toolbar.title = getText(R.string.see_error_info)
|
setTitle(R.string.see_error_info)
|
||||||
setReturnButton()
|
setReturnButton()
|
||||||
viewBinding.recyclerView.layoutManager = LinearLayoutManager(this)
|
viewBinding.recyclerView.layoutManager = LinearLayoutManager(this)
|
||||||
val path = AppSettings.dataRootDirectory + "/carsh/"
|
val path = AppSettings.dataRootDirectory + "/carsh/"
|
||||||
|
|
|
@ -18,6 +18,7 @@ import android.widget.*
|
||||||
import android.widget.Toast.makeText
|
import android.widget.Toast.makeText
|
||||||
import androidx.activity.result.ActivityResultLauncher
|
import androidx.activity.result.ActivityResultLauncher
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
|
@ -189,6 +190,7 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
} else super.onKeyDown(keyCode, event)
|
} else super.onKeyDown(keyCode, event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.LOLLIPOP_MR1)
|
||||||
fun initAction() {
|
fun initAction() {
|
||||||
viewBinding.fab.setOnClickListener {
|
viewBinding.fab.setOnClickListener {
|
||||||
val intent = Intent()
|
val intent = Intent()
|
||||||
|
@ -222,7 +224,7 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
FileManagerViewModel.StartType.DEFAULT, FileManagerViewModel.StartType.SELECT_FILE, FileManagerViewModel.StartType.SELECT_DIRECTORY -> {
|
FileManagerViewModel.StartType.DEFAULT, FileManagerViewModel.StartType.SELECT_FILE, FileManagerViewModel.StartType.SELECT_DIRECTORY -> {
|
||||||
val popupMenu = PopupMenu(this@FileManagerActivity, viewBinding.fab)
|
var popupMenu = GlobalMethod.createPopMenu(viewBinding.fab)
|
||||||
if (adapter != null) {
|
if (adapter != null) {
|
||||||
val selectPath = adapter!!.selectPath
|
val selectPath = adapter!!.selectPath
|
||||||
if (selectPath != null) {
|
if (selectPath != null) {
|
||||||
|
@ -738,7 +740,7 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
val finalFile = file
|
val finalFile = file
|
||||||
val popupMenu = PopupMenu(this, fileItemBinding.more)
|
val popupMenu = GlobalMethod.createPopMenu(fileItemBinding.more)
|
||||||
popupMenu.inflate(R.menu.menu_files_actions)
|
popupMenu.inflate(R.menu.menu_files_actions)
|
||||||
val bookAction = popupMenu.menu.findItem(R.id.bookmarkAction)
|
val bookAction = popupMenu.menu.findItem(R.id.bookmarkAction)
|
||||||
bookAction.title = if (viewModel.getBookmarkManager().contains(finalFile)) {
|
bookAction.title = if (viewModel.getBookmarkManager().contains(finalFile)) {
|
||||||
|
@ -858,7 +860,7 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
val nowLength = it.length
|
val nowLength = it.length
|
||||||
val path = if (rootLength < nowLength) {
|
val path = if (rootLength < nowLength) {
|
||||||
root + it.substring(rootLength)
|
root + it.substring(rootLength)
|
||||||
}else{
|
} else {
|
||||||
it
|
it
|
||||||
}
|
}
|
||||||
val lineParser = LineParser(path)
|
val lineParser = LineParser(path)
|
||||||
|
|
|
@ -70,7 +70,7 @@ class OrderListActivity : BaseActivity<ActivityOrderListBinding>() {
|
||||||
if (canLoadAll) {
|
if (canLoadAll) {
|
||||||
//如果可以加载全部用户资料(是管理员模式)
|
//如果可以加载全部用户资料(是管理员模式)
|
||||||
val popupMenu =
|
val popupMenu =
|
||||||
PopupMenu(this@OrderListActivity, itemOrderBinding.root)
|
GlobalMethod.createPopMenu(itemOrderBinding.root)
|
||||||
popupMenu.menu.add("设置订单")
|
popupMenu.menu.add("设置订单")
|
||||||
popupMenu.menu.add("查看用户资料")
|
popupMenu.menu.add("查看用户资料")
|
||||||
popupMenu.show()
|
popupMenu.show()
|
||||||
|
|
|
@ -13,6 +13,7 @@ import androidx.core.view.isVisible
|
||||||
import com.coldmint.rust.core.tool.FileOperator
|
import com.coldmint.rust.core.tool.FileOperator
|
||||||
import com.coldmint.rust.pro.adapters.FileAdapter
|
import com.coldmint.rust.pro.adapters.FileAdapter
|
||||||
import com.coldmint.rust.pro.databinding.ActivityRecyclingStationBinding
|
import com.coldmint.rust.pro.databinding.ActivityRecyclingStationBinding
|
||||||
|
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
|
|
||||||
|
@ -70,7 +71,7 @@ class RecyclingStationActivity : BaseActivity<ActivityRecyclingStationBinding>()
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
val popupMenu =
|
val popupMenu =
|
||||||
PopupMenu(this@RecyclingStationActivity, fileItemBinding.more)
|
GlobalMethod.createPopMenu(fileItemBinding.more)
|
||||||
popupMenu.menu.add(R.string.recovery_file)
|
popupMenu.menu.add(R.string.recovery_file)
|
||||||
popupMenu.menu.add(R.string.delete_title)
|
popupMenu.menu.add(R.string.delete_title)
|
||||||
popupMenu.setOnMenuItemClickListener(PopupMenu.OnMenuItemClickListener { item ->
|
popupMenu.setOnMenuItemClickListener(PopupMenu.OnMenuItemClickListener { item ->
|
||||||
|
|
|
@ -452,7 +452,7 @@ class ReleaseModActivity : BaseActivity<ActivityReleaseModBinding>() {
|
||||||
|
|
||||||
private fun initIconView() {
|
private fun initIconView() {
|
||||||
viewBinding.iconView.setOnClickListener {
|
viewBinding.iconView.setOnClickListener {
|
||||||
val popupMenu = PopupMenu(this, viewBinding.iconView)
|
val popupMenu = GlobalMethod.createPopMenu(it)
|
||||||
popupMenu.menu.add(R.string.from_url)
|
popupMenu.menu.add(R.string.from_url)
|
||||||
if (needIcon) {
|
if (needIcon) {
|
||||||
popupMenu.menu.add(R.string.change_image)
|
popupMenu.menu.add(R.string.change_image)
|
||||||
|
|
|
@ -70,10 +70,7 @@ class WorkManagementActivity : BaseActivity<ActivityWorkmangementBinding>() {
|
||||||
WebModAllInfoAdapter(this@WorkManagementActivity, data)
|
WebModAllInfoAdapter(this@WorkManagementActivity, data)
|
||||||
adapter.setItemEvent { i, itemWebmodAllInfoBinding, viewHolder, data ->
|
adapter.setItemEvent { i, itemWebmodAllInfoBinding, viewHolder, data ->
|
||||||
itemWebmodAllInfoBinding.more.setOnClickListener {
|
itemWebmodAllInfoBinding.more.setOnClickListener {
|
||||||
val popupMenu = PopupMenu(
|
val popupMenu = GlobalMethod.createPopMenu(it)
|
||||||
this@WorkManagementActivity,
|
|
||||||
itemWebmodAllInfoBinding.more
|
|
||||||
)
|
|
||||||
when (data.hidden) {
|
when (data.hidden) {
|
||||||
0 -> {
|
0 -> {
|
||||||
popupMenu.menu.add(R.string.sold_out_mod)
|
popupMenu.menu.add(R.string.sold_out_mod)
|
||||||
|
|
|
@ -73,7 +73,7 @@ class ApplicationListAdapter(
|
||||||
viewBinding.appVersionView.text = data.versionName
|
viewBinding.appVersionView.text = data.versionName
|
||||||
viewBinding.packageNameView.text = data.packageName
|
viewBinding.packageNameView.text = data.packageName
|
||||||
viewBinding.root.setOnClickListener {
|
viewBinding.root.setOnClickListener {
|
||||||
val popupMenu = PopupMenu(context, viewBinding.root)
|
val popupMenu = GlobalMethod.createPopMenu(viewBinding.root)
|
||||||
popupMenu.menu.add(R.string.set_game_pack)
|
popupMenu.menu.add(R.string.set_game_pack)
|
||||||
popupMenu.menu.add(R.string.exportApk)
|
popupMenu.menu.add(R.string.exportApk)
|
||||||
popupMenu.menu.add(R.string.application_information)
|
popupMenu.menu.add(R.string.application_information)
|
||||||
|
|
|
@ -63,7 +63,7 @@ class DynamicAdapter(context: Context, dataList: MutableList<DynamicItemDataBean
|
||||||
TextStyleMaker.instance.clickEvent(context, type, data)
|
TextStyleMaker.instance.clickEvent(context, type, data)
|
||||||
}
|
}
|
||||||
viewBinding.textview.setOnLongClickListener { view ->
|
viewBinding.textview.setOnLongClickListener { view ->
|
||||||
val menu = PopupMenu(context, view)
|
val menu = GlobalMethod.createPopMenu(view)
|
||||||
menu.menu.add(R.string.copy)
|
menu.menu.add(R.string.copy)
|
||||||
menu.menu.add(R.string.delete_title)
|
menu.menu.add(R.string.delete_title)
|
||||||
menu.setOnMenuItemClickListener {
|
menu.setOnMenuItemClickListener {
|
||||||
|
|
|
@ -13,6 +13,7 @@ import com.afollestad.materialdialogs.input.input
|
||||||
import com.coldmint.rust.core.tool.FileOperator
|
import com.coldmint.rust.core.tool.FileOperator
|
||||||
import com.coldmint.rust.pro.base.BaseAdapter
|
import com.coldmint.rust.pro.base.BaseAdapter
|
||||||
import com.coldmint.rust.pro.databinding.MapAndMusicItemBinding
|
import com.coldmint.rust.pro.databinding.MapAndMusicItemBinding
|
||||||
|
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
|
|
||||||
|
@ -28,7 +29,7 @@ class MapAndMusicAdapter(context: Context, dataList: ArrayList<File>, val isMusi
|
||||||
) {
|
) {
|
||||||
val fileType = FileOperator.getFileType(targetFile)
|
val fileType = FileOperator.getFileType(targetFile)
|
||||||
var fileName = FileOperator.getPrefixName(targetFile)
|
var fileName = FileOperator.getPrefixName(targetFile)
|
||||||
val popupMenu = PopupMenu(context, viewBinding.root)
|
val popupMenu = GlobalMethod.createPopMenu(viewBinding.root)
|
||||||
if (isMusic) {
|
if (isMusic) {
|
||||||
if (fileName.startsWith(prefixName)) {
|
if (fileName.startsWith(prefixName)) {
|
||||||
popupMenu.menu.add(R.string.enable_loop)
|
popupMenu.menu.add(R.string.enable_loop)
|
||||||
|
|
|
@ -9,6 +9,7 @@ import androidx.core.view.isVisible
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.coldmint.rust.core.dataBean.user.SearchResultDataBean
|
import com.coldmint.rust.core.dataBean.user.SearchResultDataBean
|
||||||
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.UserHomePageActivity
|
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
|
||||||
|
@ -46,8 +47,8 @@ class SearchResultAdapter(
|
||||||
position: Int
|
position: Int
|
||||||
) {
|
) {
|
||||||
val finalIcon = data.icon
|
val finalIcon = data.icon
|
||||||
|
viewBinding.imageView.isVisible = true
|
||||||
if (finalIcon != null && finalIcon.isNotBlank()) {
|
if (finalIcon != null && finalIcon.isNotBlank()) {
|
||||||
viewBinding.imageView.isVisible = true
|
|
||||||
if (data.type == "user") {
|
if (data.type == "user") {
|
||||||
Glide.with(context).load(ServerConfiguration.getRealLink(finalIcon))
|
Glide.with(context).load(ServerConfiguration.getRealLink(finalIcon))
|
||||||
.apply(GlobalMethod.getRequestOptions(true)).into(viewBinding.imageView)
|
.apply(GlobalMethod.getRequestOptions(true)).into(viewBinding.imageView)
|
||||||
|
@ -56,7 +57,13 @@ class SearchResultAdapter(
|
||||||
.into(viewBinding.imageView)
|
.into(viewBinding.imageView)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
viewBinding.imageView.isVisible = false
|
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
|
viewBinding.titleView.text = data.title
|
||||||
val index = data.content.indexOf('\n')
|
val index = data.content.indexOf('\n')
|
||||||
|
|
|
@ -31,24 +31,7 @@ class WebModAdapter( context: Context, dataList: MutableList<WebModListData.Dat
|
||||||
position: Int
|
position: Int
|
||||||
) {
|
) {
|
||||||
viewBinding.modNameView.text = data.name
|
viewBinding.modNameView.text = data.name
|
||||||
val text = data.describe
|
viewBinding.modIntroductionView.text = data.describe
|
||||||
val index = text.indexOf('\n')
|
|
||||||
if (index > -1) {
|
|
||||||
val show = text.subSequence(0, index)
|
|
||||||
if (show.length > WebMod.maxDescribeLength) {
|
|
||||||
viewBinding.modIntroductionView.text =
|
|
||||||
show.subSequence(0, WebMod.maxDescribeLength).toString() + "..."
|
|
||||||
} else {
|
|
||||||
viewBinding.modIntroductionView.text = show
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (text.length > WebMod.maxDescribeLength) {
|
|
||||||
viewBinding.modIntroductionView.text =
|
|
||||||
text.subSequence(0, WebMod.maxDescribeLength).toString() + "..."
|
|
||||||
} else {
|
|
||||||
viewBinding.modIntroductionView.text = text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
viewBinding.modInfo.text = String.format(
|
viewBinding.modInfo.text = String.format(
|
||||||
context.getString(R.string.web_mod_info),
|
context.getString(R.string.web_mod_info),
|
||||||
data.updateTime,
|
data.updateTime,
|
||||||
|
|
|
@ -12,6 +12,7 @@ import androidx.core.app.ActivityCompat.startActivityForResult
|
||||||
import com.coldmint.dialog.BaseAppDialog
|
import com.coldmint.dialog.BaseAppDialog
|
||||||
import com.coldmint.rust.pro.FileManagerActivity
|
import com.coldmint.rust.pro.FileManagerActivity
|
||||||
import com.coldmint.rust.pro.databinding.EditBookmarkBinding
|
import com.coldmint.rust.pro.databinding.EditBookmarkBinding
|
||||||
|
import com.google.android.material.textfield.TextInputLayout
|
||||||
|
|
||||||
class BookmarkDialog(context: Context) : BaseAppDialog<BookmarkDialog>(context) {
|
class BookmarkDialog(context: Context) : BaseAppDialog<BookmarkDialog>(context) {
|
||||||
|
|
||||||
|
@ -55,8 +56,10 @@ class BookmarkDialog(context: Context) : BaseAppDialog<BookmarkDialog>(context)
|
||||||
* @param func Function1<[@kotlin.ParameterName] EditBookmarkBinding, Unit>
|
* @param func Function1<[@kotlin.ParameterName] EditBookmarkBinding, Unit>
|
||||||
*/
|
*/
|
||||||
fun setButtonAction(func: ((editBookmarkBinding: EditBookmarkBinding) -> Unit)) {
|
fun setButtonAction(func: ((editBookmarkBinding: EditBookmarkBinding) -> Unit)) {
|
||||||
editBookmarkBinding.button.setOnClickListener {
|
editBookmarkBinding.pathInputLayout.setEndIconOnClickListener {
|
||||||
func.invoke(editBookmarkBinding)
|
func.invoke(
|
||||||
|
editBookmarkBinding
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,22 +184,24 @@ class AllUnitsFragment(
|
||||||
viewBinding.swipeRefreshLayout.isVisible = true
|
viewBinding.swipeRefreshLayout.isVisible = true
|
||||||
viewBinding.progressBar.isVisible = false
|
viewBinding.progressBar.isVisible = false
|
||||||
viewBinding.unitError.isVisible = false
|
viewBinding.unitError.isVisible = false
|
||||||
val adapter = UnitAdapter(requireContext(), dataList, "")
|
if (isAdded) {
|
||||||
adapter.setItemEvent { i, unitItemBinding, viewHolder, sourceFileClass ->
|
val adapter = UnitAdapter(requireContext(), dataList, "")
|
||||||
unitItemBinding.root.setOnClickListener {
|
adapter.setItemEvent { i, unitItemBinding, viewHolder, sourceFileClass ->
|
||||||
openEditActivity(sourceFileClass)
|
unitItemBinding.root.setOnClickListener {
|
||||||
|
openEditActivity(sourceFileClass)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
adapter.setItemChangeEvent { changeType, i, sourceFileClass, i2 ->
|
||||||
adapter.setItemChangeEvent { changeType, i, sourceFileClass, i2 ->
|
whenNumberChanged?.invoke(i2)
|
||||||
whenNumberChanged?.invoke(i2)
|
if (i2 == 0) {
|
||||||
if (i2 == 0) {
|
loadFiles()
|
||||||
loadFiles()
|
}
|
||||||
}
|
}
|
||||||
|
FastScrollerBuilder(viewBinding.unitList).useMd2Style()
|
||||||
|
.setPopupTextProvider(adapter).build()
|
||||||
|
viewBinding.unitList.adapter = adapter
|
||||||
|
whenNumberChanged?.invoke(dataList.size)
|
||||||
}
|
}
|
||||||
FastScrollerBuilder(viewBinding.unitList).useMd2Style()
|
|
||||||
.setPopupTextProvider(adapter).build()
|
|
||||||
viewBinding.unitList.adapter = adapter
|
|
||||||
whenNumberChanged?.invoke(dataList.size)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,19 +201,23 @@ class RecommendedFragment : BaseFragment<FragmentRecommendedBinding>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun createAdapter(dataList: MutableList<WebModListData.Data>): WebModAdapter {
|
fun createAdapter(dataList: MutableList<WebModListData.Data>): WebModAdapter? {
|
||||||
val adapter = WebModAdapter(context = requireContext(), dataList = dataList)
|
if (isAdded) {
|
||||||
adapter.setItemEvent { i, webModItemBinding, viewHolder, data ->
|
val adapter = WebModAdapter(context = requireContext(), dataList = dataList)
|
||||||
webModItemBinding.root.setOnClickListener {
|
adapter.setItemEvent { i, webModItemBinding, viewHolder, data ->
|
||||||
val bundle = Bundle()
|
webModItemBinding.root.setOnClickListener {
|
||||||
bundle.putString("modId", data.id)
|
val bundle = Bundle()
|
||||||
bundle.putString("modName", data.name)
|
bundle.putString("modId", data.id)
|
||||||
val intent = Intent(requireContext(), WebModInfoActivity::class.java)
|
bundle.putString("modName", data.name)
|
||||||
intent.putExtra("data", bundle)
|
val intent = Intent(requireContext(), WebModInfoActivity::class.java)
|
||||||
requireContext().startActivity(intent)
|
intent.putExtra("data", bundle)
|
||||||
|
requireContext().startActivity(intent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return adapter
|
||||||
|
} else {
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
return adapter
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.coldmint.rust.core.dataBean.user.SearchResultDataBean
|
||||||
import com.coldmint.rust.pro.adapters.SearchResultAdapter
|
import com.coldmint.rust.pro.adapters.SearchResultAdapter
|
||||||
import com.coldmint.rust.pro.base.BaseFragment
|
import com.coldmint.rust.pro.base.BaseFragment
|
||||||
import com.coldmint.rust.pro.databinding.FragmentSearchResultBinding
|
import com.coldmint.rust.pro.databinding.FragmentSearchResultBinding
|
||||||
|
import com.google.android.material.divider.MaterialDividerItemDecoration
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 搜索结果碎片
|
* 搜索结果碎片
|
||||||
|
@ -24,6 +25,11 @@ class SearchResultFragment(
|
||||||
|
|
||||||
val adapter = SearchResultAdapter(requireContext(), keyword, filterList())
|
val adapter = SearchResultAdapter(requireContext(), keyword, filterList())
|
||||||
viewBinding.recyclerView.adapter = adapter
|
viewBinding.recyclerView.adapter = adapter
|
||||||
|
val divider = MaterialDividerItemDecoration(
|
||||||
|
requireContext(),
|
||||||
|
MaterialDividerItemDecoration.VERTICAL
|
||||||
|
)
|
||||||
|
viewBinding.recyclerView.addItemDecoration(divider)
|
||||||
viewBinding.recyclerView.layoutManager = LinearLayoutManager(requireContext())
|
viewBinding.recyclerView.layoutManager = LinearLayoutManager(requireContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,23 +22,25 @@ class WarehouseFragment : BaseFragment<FragmentWarehouseBinding>() {
|
||||||
|
|
||||||
|
|
||||||
private fun loadTab() {
|
private fun loadTab() {
|
||||||
val mainActivity = activity as MainActivity
|
if (isAdded) {
|
||||||
val tableLayout = mainActivity.tabLayout
|
val mainActivity = activity as MainActivity
|
||||||
if (tableLayout == null) {
|
val tableLayout = mainActivity.tabLayout
|
||||||
viewBinding.pager.postDelayed({ loadTab() }, MainActivity.linkInterval)
|
if (tableLayout == null) {
|
||||||
} else {
|
viewBinding.pager.postDelayed({ loadTab() }, MainActivity.linkInterval)
|
||||||
tableLayout.isVisible = true
|
} else {
|
||||||
TabLayoutMediator(tableLayout, viewBinding.pager)
|
tableLayout.isVisible = true
|
||||||
{ tab, position ->
|
TabLayoutMediator(tableLayout, viewBinding.pager)
|
||||||
when (position) {
|
{ tab, position ->
|
||||||
0 -> {
|
when (position) {
|
||||||
tab.text = getText(R.string.mod_title)
|
0 -> {
|
||||||
|
tab.text = getText(R.string.mod_title)
|
||||||
|
}
|
||||||
|
1 -> {
|
||||||
|
tab.text = getText(R.string.map)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
1 -> {
|
}.attach()
|
||||||
tab.text = getText(R.string.map)
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}.attach()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,9 @@ import android.graphics.Paint
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.widget.PopupMenu
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.core.graphics.drawable.DrawableCompat
|
import androidx.core.graphics.drawable.DrawableCompat
|
||||||
|
@ -118,6 +120,23 @@ object GlobalMethod {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建PopMenu
|
||||||
|
*/
|
||||||
|
fun createPopMenu(view: View): PopupMenu {
|
||||||
|
val context = view.context;
|
||||||
|
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||||
|
PopupMenu(
|
||||||
|
context,
|
||||||
|
view,
|
||||||
|
Gravity.NO_GRAVITY,
|
||||||
|
0, R.style.Widget_Material3_PopupMenu
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
PopupMenu(context, view)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* int颜色值转String
|
* int颜色值转String
|
||||||
* @param color Int
|
* @param color Int
|
||||||
|
|
|
@ -252,15 +252,15 @@ class StartViewModel(application: Application) : BaseAndroidViewModel(applicatio
|
||||||
AppSettings.Setting.DynamicColor,
|
AppSettings.Setting.DynamicColor,
|
||||||
DynamicColors.isDynamicColorAvailable()
|
DynamicColors.isDynamicColorAvailable()
|
||||||
)
|
)
|
||||||
AppSettings.initSetting(AppSettings.Setting.KeywordColor, "#FF0031C2")
|
AppSettings.initSetting(AppSettings.Setting.KeywordColor, "#2196f3")
|
||||||
AppSettings.initSetting(AppSettings.Setting.SectionColor, "#FFE10000")
|
AppSettings.initSetting(AppSettings.Setting.SectionColor, "#e91e63")
|
||||||
AppSettings.initSetting(AppSettings.Setting.TextColor, "#FF000000")
|
AppSettings.initSetting(AppSettings.Setting.TextColor, "#212121")
|
||||||
AppSettings.initSetting(AppSettings.Setting.AnnotationColor, "#FF00AF2C")
|
AppSettings.initSetting(AppSettings.Setting.AnnotationColor, "#4caf50")
|
||||||
|
|
||||||
AppSettings.initSetting(AppSettings.Setting.KeywordColorDark, "#FF5D5DFF")
|
AppSettings.initSetting(AppSettings.Setting.KeywordColorDark, "#2196f3")
|
||||||
AppSettings.initSetting(AppSettings.Setting.SectionColorDark, "#FFA7002A")
|
AppSettings.initSetting(AppSettings.Setting.SectionColorDark, "#e91e63")
|
||||||
AppSettings.initSetting(AppSettings.Setting.TextColorDark, "#FFE2E2E2")
|
AppSettings.initSetting(AppSettings.Setting.TextColorDark, "#eeeeee")
|
||||||
AppSettings.initSetting(AppSettings.Setting.AnnotationColorDark, "#FF00B500")
|
AppSettings.initSetting(AppSettings.Setting.AnnotationColorDark, "#4caf50")
|
||||||
AppSettings.initSetting(AppSettings.Setting.CodeEditBackGroundEnable, false)
|
AppSettings.initSetting(AppSettings.Setting.CodeEditBackGroundEnable, false)
|
||||||
AppSettings.initSetting(AppSettings.Setting.BlurTransformationValue, 1)
|
AppSettings.initSetting(AppSettings.Setting.BlurTransformationValue, 1)
|
||||||
AppSettings.initSetting(AppSettings.Setting.CodeEditBackGroundPath, "")
|
AppSettings.initSetting(AppSettings.Setting.CodeEditBackGroundPath, "")
|
||||||
|
|
|
@ -63,11 +63,12 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:animateLayoutChanges="true"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="8dp"
|
android:layout_margin="8dp"
|
||||||
|
android:animateLayoutChanges="true"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
@ -84,11 +85,11 @@
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/replaceLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/replaceLayout"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
|
android:visibility="gone"
|
||||||
android:hint="@string/replace">
|
android:hint="@string/replace">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
@ -129,13 +130,13 @@
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/allButton"
|
android:id="@+id/allButton"
|
||||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/all" />
|
android:text="@string/all"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/closeButton"
|
android:id="@+id/closeButton"
|
||||||
|
|
|
@ -21,15 +21,15 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabItem
|
<!-- <com.google.android.material.tabs.TabItem-->
|
||||||
android:layout_width="wrap_content"
|
<!-- android:layout_width="wrap_content"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:text="全部" />
|
<!-- android:text="全部" />-->
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabItem
|
<!-- <com.google.android.material.tabs.TabItem-->
|
||||||
android:layout_width="wrap_content"
|
<!-- android:layout_width="wrap_content"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:text="最近" />
|
<!-- android:text="最近" />-->
|
||||||
|
|
||||||
</com.google.android.material.tabs.TabLayout>
|
</com.google.android.material.tabs.TabLayout>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
@ -13,9 +14,9 @@
|
||||||
android:text="@string/title" />
|
android:text="@string/title" />
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/nameInputLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/nameInputLayout"
|
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
android:hint="@string/name">
|
android:hint="@string/name">
|
||||||
|
|
||||||
|
@ -29,40 +30,24 @@
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/pathInputLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp">
|
android:layout_marginTop="8dp"
|
||||||
|
android:hint="@string/path"
|
||||||
|
app:endIconDrawable="@drawable/ic_outline_edit_24"
|
||||||
|
app:endIconMode="custom">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/pathEdit"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/pathInputLayout"
|
android:imeOptions="actionDone"
|
||||||
android:layout_centerVertical="true"
|
android:inputType="textMultiLine" />
|
||||||
android:layout_toStartOf="@id/button"
|
|
||||||
android:hint="@string/path">
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
android:id="@+id/pathEdit"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:imeOptions="actionDone"
|
|
||||||
android:inputType="textMultiLine" />
|
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:text="@string/select_directents" />
|
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/buttonContainer"
|
android:id="@+id/buttonContainer"
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
|
android:paddingVertical="4dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
app:showAsAction="always" />
|
app:showAsAction="always" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
|
android:visible="false"
|
||||||
android:id="@+id/code_navigation"
|
android:id="@+id/code_navigation"
|
||||||
android:title="@string/code_navigation" />
|
android:title="@string/code_navigation" />
|
||||||
|
|
||||||
|
|
|
@ -286,6 +286,7 @@
|
||||||
<string name="create_new_section">创建节</string>
|
<string name="create_new_section">创建节</string>
|
||||||
<string name="subtitle">你好,世界!|新的开始,新的体验。|2.0重置版|给薄荷打钱~</string>
|
<string name="subtitle">你好,世界!|新的开始,新的体验。|2.0重置版|给薄荷打钱~</string>
|
||||||
<string name="web_link">网页链接</string>
|
<string name="web_link">网页链接</string>
|
||||||
|
<string name="parsing_picture_error">解析图片出错。</string>
|
||||||
|
|
||||||
<!-- Preference Titles -->
|
<!-- Preference Titles -->
|
||||||
<string name="sync_header">开发者选项</string>
|
<string name="sync_header">开发者选项</string>
|
||||||
|
|
|
@ -33,7 +33,12 @@ class ModConfigurationManager(file: File) {
|
||||||
return if (code == null) {
|
return if (code == null) {
|
||||||
null
|
null
|
||||||
} else {
|
} else {
|
||||||
gson.fromJson(code, ModConfigurationData::class.java)
|
try {
|
||||||
|
gson.fromJson(code, ModConfigurationData::class.java)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,11 +65,11 @@ class TurretManager(val sourceFile: SourceFile) {
|
||||||
var x = 0
|
var x = 0
|
||||||
var y = 0
|
var y = 0
|
||||||
val xData = sourceFile.readValueFromSection("x", it)
|
val xData = sourceFile.readValueFromSection("x", it)
|
||||||
if (xData != null) {
|
if (xData != null && xData.isNotBlank()) {
|
||||||
x = xData.toFloat().toInt()
|
x = xData.toFloat().toInt()
|
||||||
}
|
}
|
||||||
val yData = sourceFile.readValueFromSection("y", it)
|
val yData = sourceFile.readValueFromSection("y", it)
|
||||||
if (yData != null) {
|
if (yData != null&& yData.isNotBlank()) {
|
||||||
y = yData.toFloat().toInt()
|
y = yData.toFloat().toInt()
|
||||||
}
|
}
|
||||||
val turretData = TurretData(name, CoordinateData(x, y))
|
val turretData = TurretData(name, CoordinateData(x, y))
|
||||||
|
|
|
@ -26,7 +26,7 @@ class TurretSketchpadView(context: Context, attributeSet: AttributeSet? = null)
|
||||||
* @param size Float
|
* @param size Float
|
||||||
* @return Bitmap
|
* @return Bitmap
|
||||||
*/
|
*/
|
||||||
fun scaleBitmap(bitmap: Bitmap, size: Float): Bitmap {
|
fun scaleBitmap(bitmap: Bitmap, size: Float): Bitmap? {
|
||||||
//创建新的图像背景
|
//创建新的图像背景
|
||||||
val matrix = Matrix()
|
val matrix = Matrix()
|
||||||
matrix.setScale(size, size)
|
matrix.setScale(size, size)
|
||||||
|
@ -253,8 +253,10 @@ class TurretSketchpadView(context: Context, attributeSet: AttributeSet? = null)
|
||||||
private fun drawImage(canvas: Canvas, bitmap: Bitmap) {
|
private fun drawImage(canvas: Canvas, bitmap: Bitmap) {
|
||||||
val paint = Paint()
|
val paint = Paint()
|
||||||
val temBitmap = scaleBitmap(bitmap, cellSize.toFloat())
|
val temBitmap = scaleBitmap(bitmap, cellSize.toFloat())
|
||||||
canvas.drawBitmap(temBitmap, startX.toFloat(), startY.toFloat(), paint)
|
if (temBitmap != null) {
|
||||||
temBitmap.recycle()
|
canvas.drawBitmap(temBitmap, startX.toFloat(), startY.toFloat(), paint)
|
||||||
|
temBitmap.recycle()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDraw(canvas: Canvas?) {
|
override fun onDraw(canvas: Canvas?) {
|
||||||
|
|
|
@ -158,24 +158,25 @@ class TurretView(context: Context, attributeSet: AttributeSet? = null) :
|
||||||
if (bitmap == null) {
|
if (bitmap == null) {
|
||||||
LogCat.e(debugKey, "无法加载炮塔图像。")
|
LogCat.e(debugKey, "无法加载炮塔图像。")
|
||||||
return
|
return
|
||||||
}
|
} else {
|
||||||
if (turretData.scaleValue != 1f) {
|
if (turretData.scaleValue != 1f) {
|
||||||
bitmap = TurretSketchpadView.scaleBitmap(
|
bitmap = TurretSketchpadView.scaleBitmap(
|
||||||
bitmap, turretData.scaleValue
|
bitmap, turretData.scaleValue
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val androidCoordinate =
|
||||||
|
turretSketchpadView!!.toAndroidCoordinate(turretData.gameCoordinateData)
|
||||||
|
bitmapW = bitmap!!.width
|
||||||
|
bitmapH = bitmap!!.height
|
||||||
|
canvas?.drawBitmap(
|
||||||
|
bitmap,
|
||||||
|
(androidCoordinate.x - bitmapW / 2).toFloat(),
|
||||||
|
(androidCoordinate.y - bitmapH / 2).toFloat(),
|
||||||
|
paint
|
||||||
)
|
)
|
||||||
}
|
if (!bitmap.isRecycled) {
|
||||||
val androidCoordinate =
|
bitmap.recycle()
|
||||||
turretSketchpadView!!.toAndroidCoordinate(turretData.gameCoordinateData)
|
}
|
||||||
bitmapW = bitmap.width
|
|
||||||
bitmapH = bitmap.height
|
|
||||||
canvas?.drawBitmap(
|
|
||||||
bitmap,
|
|
||||||
(androidCoordinate.x - bitmapW / 2).toFloat(),
|
|
||||||
(androidCoordinate.y - bitmapH / 2).toFloat(),
|
|
||||||
paint
|
|
||||||
)
|
|
||||||
if (!bitmap.isRecycled) {
|
|
||||||
bitmap.recycle()
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LogCat.e(debugKey, "未设置炮塔数据,停止绘制。")
|
LogCat.e(debugKey, "未设置炮塔数据,停止绘制。")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user