Skip to content

Commit 26e47ff

Browse files
committed
remove PreferencesManager's sections for better accessibility
1 parent 4d3625d commit 26e47ff

35 files changed

+289
-317
lines changed

app/src/main/java/com/raival/compose/file/explorer/App.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import com.raival.compose.file.explorer.coil.apk.ApkFileDecoder
2121
import com.raival.compose.file.explorer.coil.pdf.PdfFileDecoder
2222
import com.raival.compose.file.explorer.common.FileExplorerLogger
2323
import com.raival.compose.file.explorer.screen.main.MainActivityManager
24-
import com.raival.compose.file.explorer.screen.main.tab.files.FilesTabManager
2524
import com.raival.compose.file.explorer.screen.main.tab.files.coil.DocumentFileMapper
2625
import com.raival.compose.file.explorer.screen.main.tab.files.holder.LocalFileHolder
2726
import com.raival.compose.file.explorer.screen.main.tab.files.task.TaskManager
@@ -83,7 +82,6 @@ class App : Application(), coil3.SingletonImageLoader.Factory {
8382

8483
val textEditorManager: TextEditorManager by lazy { TextEditorManager().also { setupTextMate() } }
8584
val mainActivityManager: MainActivityManager by lazy { MainActivityManager().also { it.setup() } }
86-
val filesTabManager: FilesTabManager by lazy { FilesTabManager() }
8785
val preferencesManager: PreferencesManager by lazy { PreferencesManager() }
8886
val viewersManager: ViewersManager by lazy {
8987
setupTextMate()

app/src/main/java/com/raival/compose/file/explorer/common/Utils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ fun Int.isMultipleOf100(): Boolean {
653653

654654
@SuppressLint("SimpleDateFormat")
655655
fun Long.toFormattedDate(): String =
656-
SimpleDateFormat(globalClass.preferencesManager.appearancePrefs.dateTimeFormat).format(this)
656+
SimpleDateFormat(globalClass.preferencesManager.dateTimeFormat).format(this)
657657

658658
fun Long.toFormattedSize(): String {
659659
if (this <= 0) return "0 B"

app/src/main/java/com/raival/compose/file/explorer/screen/main/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class MainActivity : BaseActivity() {
104104

105105
StartupTabsSettingsScreen(mainActivityState.showStartupTabsDialog) {
106106
mainActivityManager.toggleStartupTabsDialog(false)
107-
globalClass.preferencesManager.behaviorPrefs.startupTabs = it.toJson()
107+
globalClass.preferencesManager.startupTabs = it.toJson()
108108
}
109109

110110
Column(Modifier.fillMaxSize()) {

app/src/main/java/com/raival/compose/file/explorer/screen/main/MainActivityManager.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ class MainActivityManager {
215215
}
216216

217217
// Replace the active tab with the home tab (if turned on in settings)
218-
if (getActiveTab() !is HomeTab && !globalClass.preferencesManager.behaviorPrefs.skipHomeWhenTabClosed) {
218+
if (getActiveTab() !is HomeTab && !globalClass.preferencesManager.skipHomeWhenTabClosed) {
219219
replaceCurrentTabWith(HomeTab())
220220
return false
221221
}
@@ -267,7 +267,7 @@ class MainActivityManager {
267267
fun loadStartupTabs() {
268268
managerScope.launch {
269269
val startupTabs: StartupTabs =
270-
fromJson(globalClass.preferencesManager.behaviorPrefs.startupTabs)
270+
fromJson(globalClass.preferencesManager.startupTabs)
271271
?: StartupTabs.default()
272272

273273
val tabs = arrayListOf<Tab>()

app/src/main/java/com/raival/compose/file/explorer/screen/main/tab/files/FilesTab.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ class FilesTab(
270270
val newContent =
271271
(activeFolder as LocalFileHolder).file.listFiles()?.toCollection(arrayListOf())
272272
?.apply {
273-
if (!globalClass.preferencesManager.fileListPrefs.showHiddenFiles) {
273+
if (!globalClass.preferencesManager.showHiddenFiles) {
274274
removeIf { it.name.startsWith(".") }
275275
}
276276
}

app/src/main/java/com/raival/compose/file/explorer/screen/main/tab/files/FilesTabManager.kt

Lines changed: 0 additions & 14 deletions
This file was deleted.

app/src/main/java/com/raival/compose/file/explorer/screen/main/tab/files/holder/ContentHolder.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ abstract class ContentHolder {
103103
}
104104

105105
open suspend fun listSortedContent(): ArrayList<out ContentHolder> {
106-
val sortingPrefs = globalClass.preferencesManager.filesSortingPrefs.getSortingPrefsFor(this)
106+
val sortingPrefs = globalClass.preferencesManager.getSortingPrefsFor(this)
107107

108108
return listContent().apply {
109109
when (sortingPrefs.sortMethod) {
@@ -122,7 +122,7 @@ abstract class ContentHolder {
122122

123123
if (sortingPrefs.showFoldersFirst) sortWith(sortFoldersFirst)
124124

125-
if (!globalClass.preferencesManager.fileListPrefs.showHiddenFiles) {
125+
if (!globalClass.preferencesManager.showHiddenFiles) {
126126
removeIf { it.isHidden() }
127127
}
128128
}

app/src/main/java/com/raival/compose/file/explorer/screen/main/tab/files/holder/LocalFileHolder.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class LocalFileHolder(val file: File) : ContentHolder() {
3232
buildString {
3333
append(lastModified.toFormattedDate())
3434
if (file.isDirectory) {
35-
if (globalClass.preferencesManager.fileListPrefs.showFolderContentCount && file.canRead()) {
35+
if (globalClass.preferencesManager.showFolderContentCount && file.canRead()) {
3636
append(separator)
3737
append(getFormattedFileCount())
3838
}

app/src/main/java/com/raival/compose/file/explorer/screen/main/tab/files/holder/ZipFileHolder.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class ZipFileHolder(
181181
return buildString {
182182
append(node.lastModified.toFormattedDate())
183183
if (node.isDirectory) {
184-
if (globalClass.preferencesManager.fileListPrefs.showFolderContentCount) {
184+
if (globalClass.preferencesManager.showFolderContentCount) {
185185
append(separator)
186186
append(getFormattedFileCount())
187187
}

app/src/main/java/com/raival/compose/file/explorer/screen/main/tab/files/provider/StorageProvider.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ object StorageProvider {
248248
return videoFiles
249249
}
250250

251-
fun getBookmarks() = globalClass.filesTabManager.bookmarks
251+
fun getBookmarks() = globalClass.preferencesManager.bookmarks
252252
.map { LocalFileHolder(File(it)) } as ArrayList<LocalFileHolder>
253253

254254
fun getAudioFiles(): ArrayList<LocalFileHolder> {
@@ -287,7 +287,7 @@ object StorageProvider {
287287
): ArrayList<LocalFileHolder> {
288288
val recentFiles = ArrayList<LocalFileHolder>()
289289
val contentResolver: ContentResolver = globalClass.contentResolver
290-
val showHiddenFiles = globalClass.preferencesManager.fileListPrefs.showHiddenFiles
290+
val showHiddenFiles = globalClass.preferencesManager.showHiddenFiles
291291

292292
val uri: Uri = MediaStore.Files.getContentUri("external")
293293

0 commit comments

Comments
 (0)