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,8 +1272,8 @@ 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 -> {
|
||||||
|
@ -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.search(
|
||||||
|
find,
|
||||||
|
EditorSearcher.SearchOptions(false, false)
|
||||||
|
)
|
||||||
viewBinding.codeEditor.searcher.gotoNext()
|
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.search(
|
||||||
|
find,
|
||||||
|
EditorSearcher.SearchOptions(false, false)
|
||||||
|
)
|
||||||
viewBinding.codeEditor.searcher.gotoPrevious()
|
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.search(
|
||||||
|
find,
|
||||||
|
EditorSearcher.SearchOptions(false, false)
|
||||||
|
)
|
||||||
viewBinding.codeEditor.searcher.replaceAll(re)
|
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()
|
||||||
|
if (find.isNotBlank() && re.isNotBlank()) {
|
||||||
viewBinding.codeEditor.searcher.search(
|
viewBinding.codeEditor.searcher.search(
|
||||||
find,
|
find,
|
||||||
EditorSearcher.SearchOptions(false, false)
|
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)
|
||||||
|
.setErrorTip { s, textInputLayout ->
|
||||||
if (s.matches(Regex("^http://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?$|^https://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?$"))) {
|
if (s.matches(Regex("^http://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?$|^https://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?$"))) {
|
||||||
textInputLayout.error = getString(R.string.from_url_tip)
|
textInputLayout.error = getString(R.string.from_url_tip)
|
||||||
} else {
|
} else {
|
||||||
textInputLayout.isErrorEnabled = false
|
textInputLayout.isErrorEnabled = false
|
||||||
}
|
}
|
||||||
}.setPositiveButton(R.string.dialog_ok){
|
}.setPositiveButton(R.string.dialog_ok) { input ->
|
||||||
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)
|
||||||
|
.setErrorTip { s, textInputLayout ->
|
||||||
if (s.matches(Regex("^http://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?$|^https://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?$"))) {
|
if (s.matches(Regex("^http://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?$|^https://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?$"))) {
|
||||||
textInputLayout.error = getString(R.string.from_url_tip)
|
textInputLayout.error = getString(R.string.from_url_tip)
|
||||||
} else {
|
} else {
|
||||||
textInputLayout.isErrorEnabled = false
|
textInputLayout.isErrorEnabled = false
|
||||||
}
|
}
|
||||||
}.setPositiveButton(R.string.dialog_ok){
|
}.setPositiveButton(R.string.dialog_ok) { input ->
|
||||||
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
|
||||||
if (finalIcon != null && finalIcon.isNotBlank()) {
|
|
||||||
viewBinding.imageView.isVisible = true
|
viewBinding.imageView.isVisible = true
|
||||||
|
if (finalIcon != null && finalIcon.isNotBlank()) {
|
||||||
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,8 +57,14 @@ class SearchResultAdapter(
|
||||||
.into(viewBinding.imageView)
|
.into(viewBinding.imageView)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (data.type == "user"){
|
||||||
|
viewBinding.imageView.setImageResource(R.drawable.head_icon)
|
||||||
|
}else if (data.type == "mod"){
|
||||||
|
viewBinding.imageView.setImageResource(R.drawable.image)
|
||||||
|
}else{
|
||||||
viewBinding.imageView.isVisible = false
|
viewBinding.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')
|
||||||
val thisContext = if (index > -1 && data.type == "mod") {
|
val thisContext = if (index > -1 && data.type == "mod") {
|
||||||
|
|
|
@ -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,6 +184,7 @@ 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
|
||||||
|
if (isAdded) {
|
||||||
val adapter = UnitAdapter(requireContext(), dataList, "")
|
val adapter = UnitAdapter(requireContext(), dataList, "")
|
||||||
adapter.setItemEvent { i, unitItemBinding, viewHolder, sourceFileClass ->
|
adapter.setItemEvent { i, unitItemBinding, viewHolder, sourceFileClass ->
|
||||||
unitItemBinding.root.setOnClickListener {
|
unitItemBinding.root.setOnClickListener {
|
||||||
|
@ -204,6 +205,7 @@ class AllUnitsFragment(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -201,7 +201,8 @@ class RecommendedFragment : BaseFragment<FragmentRecommendedBinding>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun createAdapter(dataList: MutableList<WebModListData.Data>): WebModAdapter {
|
fun createAdapter(dataList: MutableList<WebModListData.Data>): WebModAdapter? {
|
||||||
|
if (isAdded) {
|
||||||
val adapter = WebModAdapter(context = requireContext(), dataList = dataList)
|
val adapter = WebModAdapter(context = requireContext(), dataList = dataList)
|
||||||
adapter.setItemEvent { i, webModItemBinding, viewHolder, data ->
|
adapter.setItemEvent { i, webModItemBinding, viewHolder, data ->
|
||||||
webModItemBinding.root.setOnClickListener {
|
webModItemBinding.root.setOnClickListener {
|
||||||
|
@ -214,6 +215,9 @@ class RecommendedFragment : BaseFragment<FragmentRecommendedBinding>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return adapter
|
return adapter
|
||||||
|
} else {
|
||||||
|
return null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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,6 +22,7 @@ class WarehouseFragment : BaseFragment<FragmentWarehouseBinding>() {
|
||||||
|
|
||||||
|
|
||||||
private fun loadTab() {
|
private fun loadTab() {
|
||||||
|
if (isAdded) {
|
||||||
val mainActivity = activity as MainActivity
|
val mainActivity = activity as MainActivity
|
||||||
val tableLayout = mainActivity.tabLayout
|
val tableLayout = mainActivity.tabLayout
|
||||||
if (tableLayout == null) {
|
if (tableLayout == null) {
|
||||||
|
@ -41,6 +42,7 @@ class WarehouseFragment : BaseFragment<FragmentWarehouseBinding>() {
|
||||||
}.attach()
|
}.attach()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentWarehouseBinding {
|
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentWarehouseBinding {
|
||||||
return FragmentWarehouseBinding.inflate(layoutInflater)
|
return FragmentWarehouseBinding.inflate(layoutInflater)
|
||||||
|
|
|
@ -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,18 +30,14 @@
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="16dp">
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<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:id="@+id/pathInputLayout"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_centerVertical="true"
|
android:hint="@string/path"
|
||||||
android:layout_toStartOf="@id/button"
|
app:endIconDrawable="@drawable/ic_outline_edit_24"
|
||||||
android:hint="@string/path">
|
app:endIconMode="custom">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/pathEdit"
|
android:id="@+id/pathEdit"
|
||||||
|
@ -52,18 +49,6 @@
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</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"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -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 {
|
||||||
|
try {
|
||||||
gson.fromJson(code, ModConfigurationData::class.java)
|
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,9 +253,11 @@ 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())
|
||||||
|
if (temBitmap != null) {
|
||||||
canvas.drawBitmap(temBitmap, startX.toFloat(), startY.toFloat(), paint)
|
canvas.drawBitmap(temBitmap, startX.toFloat(), startY.toFloat(), paint)
|
||||||
temBitmap.recycle()
|
temBitmap.recycle()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDraw(canvas: Canvas?) {
|
override fun onDraw(canvas: Canvas?) {
|
||||||
super.onDraw(canvas)
|
super.onDraw(canvas)
|
||||||
|
|
|
@ -158,7 +158,7 @@ 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
|
||||||
|
@ -166,8 +166,8 @@ class TurretView(context: Context, attributeSet: AttributeSet? = null) :
|
||||||
}
|
}
|
||||||
val androidCoordinate =
|
val androidCoordinate =
|
||||||
turretSketchpadView!!.toAndroidCoordinate(turretData.gameCoordinateData)
|
turretSketchpadView!!.toAndroidCoordinate(turretData.gameCoordinateData)
|
||||||
bitmapW = bitmap.width
|
bitmapW = bitmap!!.width
|
||||||
bitmapH = bitmap.height
|
bitmapH = bitmap!!.height
|
||||||
canvas?.drawBitmap(
|
canvas?.drawBitmap(
|
||||||
bitmap,
|
bitmap,
|
||||||
(androidCoordinate.x - bitmapW / 2).toFloat(),
|
(androidCoordinate.x - bitmapW / 2).toFloat(),
|
||||||
|
@ -177,6 +177,7 @@ class TurretView(context: Context, attributeSet: AttributeSet? = null) :
|
||||||
if (!bitmap.isRecycled) {
|
if (!bitmap.isRecycled) {
|
||||||
bitmap.recycle()
|
bitmap.recycle()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
LogCat.e(debugKey, "未设置炮塔数据,停止绘制。")
|
LogCat.e(debugKey, "未设置炮塔数据,停止绘制。")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user