6.6.2 - Alpha5 - 增加 "文件扩展名" 设置选项
This commit is contained in:
@@ -142,9 +142,21 @@ object Pref {
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
val isHiddenFilesShow
|
||||
val isHiddenFilesShown
|
||||
get() = getString(R.string.key_hidden_files, key(R.string.default_key_hidden_files)) == key(R.string.key_hidden_files_show)
|
||||
|
||||
@JvmStatic
|
||||
val isFileExtensionsShownForAll
|
||||
get() = getString(R.string.key_file_extensions, key(R.string.default_key_file_extensions)) == key(R.string.key_file_extensions_show_all)
|
||||
|
||||
@JvmStatic
|
||||
val isFileExtensionsShownForAllButExecutable
|
||||
get() = getString(R.string.key_file_extensions, key(R.string.default_key_file_extensions)) == key(R.string.key_file_extensions_show_all_but_executable)
|
||||
|
||||
@JvmStatic
|
||||
val isFileExtensionsHidden
|
||||
get() = getString(R.string.key_file_extensions, key(R.string.default_key_file_extensions)) == key(R.string.key_file_extensions_not_show)
|
||||
|
||||
@JvmStatic
|
||||
val isRecordToastEnabled
|
||||
get() = getBoolean(
|
||||
|
||||
@@ -41,7 +41,7 @@ public class ExplorerFileProvider implements ExplorerProvider {
|
||||
}
|
||||
|
||||
protected Observable<PFile> listFiles(PFile directory) {
|
||||
boolean isShowHidden = Pref.isHiddenFilesShow();
|
||||
boolean isShowHidden = Pref.isHiddenFilesShown();
|
||||
return Observable.just(directory)
|
||||
.flatMap(dir -> {
|
||||
PFile[] files;
|
||||
|
||||
@@ -382,10 +382,7 @@ public class ScriptOperations {
|
||||
.negativeText(R.string.text_cancel)
|
||||
.positiveText(R.string.text_ok)
|
||||
.positiveColorRes(R.color.dialog_button_caution)
|
||||
.onPositive((dialog, which) -> {
|
||||
deleteWithoutConfirm(scriptFile);
|
||||
Explorers.workspace().refreshAll();
|
||||
})
|
||||
.onPositive((dialog, which) -> deleteWithoutConfirm(scriptFile))
|
||||
.build()
|
||||
.show();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.autojs.autojs.ui.explorer
|
||||
|
||||
import android.content.Context
|
||||
import org.autojs.autojs.core.pref.Pref
|
||||
import org.autojs.autojs.model.explorer.ExplorerFileItem
|
||||
import org.autojs.autojs.model.explorer.ExplorerItem
|
||||
import org.autojs.autojs.model.explorer.ExplorerPage
|
||||
@@ -22,11 +23,20 @@ object ExplorerViewHelper {
|
||||
item is ExplorerSamplePage && item.isRoot -> context.getString(R.string.text_sample)
|
||||
item is ExplorerPage -> item.getName()
|
||||
else -> when (item.type) {
|
||||
FileUtils.TYPE.JAVASCRIPT, FileUtils.TYPE.AUTO -> when (item) {
|
||||
is ExplorerFileItem -> item.file.simplifiedName
|
||||
else -> getNameWithoutExtension(item.name)
|
||||
FileUtils.TYPE.JAVASCRIPT, FileUtils.TYPE.AUTO -> when {
|
||||
Pref.isFileExtensionsShownForAll -> when (item) {
|
||||
is ExplorerFileItem -> item.file.name
|
||||
else -> item.name
|
||||
}
|
||||
else -> when (item) {
|
||||
is ExplorerFileItem -> item.file.simplifiedName
|
||||
else -> getNameWithoutExtension(item.name)
|
||||
}
|
||||
}
|
||||
else -> when {
|
||||
Pref.isFileExtensionsHidden -> getNameWithoutExtension(item.name)
|
||||
else -> item.name
|
||||
}
|
||||
else -> item.name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.autojs.autojs.ui.settings
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import org.autojs.autojs.theme.preference.MaterialListPreference
|
||||
import org.autojs.autojs.util.ViewUtils
|
||||
import org.autojs.autojs6.R
|
||||
|
||||
class FileExtensionsPreference : MaterialListPreference {
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes)
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
override fun onChangeConfirmed(dialog: MaterialDialog) {
|
||||
ViewUtils.showToast(prefContext, R.string.text_refresh_explorer_may_needed, true)
|
||||
super.onChangeConfirmed(dialog)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user