diff --git a/app/build.gradle b/app/build.gradle index 7807cf6a6..82eeefd6a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -58,7 +58,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:2e11262b38' + implementation 'com.github.SimpleMobileTools:Simple-Commons:f07ca31126' implementation 'com.github.Stericson:RootTools:df729dcb13' implementation 'com.github.Stericson:RootShell:1.6' implementation 'com.alexvasilkov:gesture-views:2.5.2' diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt index 7ff1ecde3..3a8873e11 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt @@ -414,6 +414,7 @@ class MainActivity : SimpleActivity() { } private fun toggleFilenameVisibility() { + config.displayFilenames = !config.displayFilenames getAllFragments().forEach { it?.toggleFilenameVisibility() } @@ -455,8 +456,10 @@ class MainActivity : SimpleActivity() { } private fun changeViewType() { - ChangeViewTypeDialog(this, getCurrentFragment().currentPath) { - getCurrentFragment().refreshItems() + ChangeViewTypeDialog(this, getCurrentFragment().currentPath, getCurrentFragment() is ItemsFragment) { + getAllFragments().forEach { + it?.refreshItems() + } } } @@ -472,7 +475,9 @@ class MainActivity : SimpleActivity() { private fun toggleTemporarilyShowHidden(show: Boolean) { config.temporarilyShowHidden = show - openPath(getCurrentFragment().currentPath) + getAllFragments().forEach { + it?.refreshItems() + } } private fun launchAbout() { diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/ChangeViewTypeDialog.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/ChangeViewTypeDialog.kt index c22f49775..0fe222574 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/ChangeViewTypeDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/ChangeViewTypeDialog.kt @@ -3,6 +3,8 @@ package com.simplemobiletools.filemanager.pro.dialogs import android.view.View import androidx.appcompat.app.AlertDialog import com.simplemobiletools.commons.activities.BaseSimpleActivity +import com.simplemobiletools.commons.extensions.beGone +import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.helpers.VIEW_TYPE_GRID import com.simplemobiletools.commons.helpers.VIEW_TYPE_LIST @@ -10,7 +12,7 @@ import com.simplemobiletools.filemanager.pro.R import com.simplemobiletools.filemanager.pro.extensions.config import kotlinx.android.synthetic.main.dialog_change_view_type.view.* -class ChangeViewTypeDialog(val activity: BaseSimpleActivity, val path: String = "", val callback: () -> Unit) { +class ChangeViewTypeDialog(val activity: BaseSimpleActivity, val path: String = "", showFolderCheck: Boolean = true, val callback: () -> Unit) { private var view: View private var config = activity.config @@ -24,6 +26,11 @@ class ChangeViewTypeDialog(val activity: BaseSimpleActivity, val path: String = } change_view_type_dialog_radio.check(viewToCheck) + if (!showFolderCheck) { + use_for_this_folder_divider.beGone() + change_view_type_dialog_use_for_this_folder.beGone() + } + change_view_type_dialog_use_for_this_folder.apply { isChecked = config.hasCustomViewType(this@ChangeViewTypeDialog.path) } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt index 7a727ed3d..99ec9043a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt @@ -477,7 +477,6 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF } override fun toggleFilenameVisibility() { - context?.config?.displayFilenames = !context!!.config.displayFilenames getRecyclerAdapter()?.updateDisplayFilenamesInGrid() } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/RecentsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/RecentsFragment.kt index 0f0187b55..8781dc8e1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/RecentsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/RecentsFragment.kt @@ -44,6 +44,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage override fun setupColors(textColor: Int, adjustedPrimaryColor: Int) {} private fun getRecents(callback: (recents: ArrayList) -> Unit) { + val showHidden = context?.config?.shouldShowHidden ?: return val uri = MediaStore.Files.getContentUri("external") val projection = arrayOf( MediaStore.Files.FileColumns.DATA, @@ -52,7 +53,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage MediaStore.Files.FileColumns.SIZE ) - val sortOrder = "${MediaStore.Files.FileColumns.DATE_MODIFIED} DESC LIMIT 50" + val sortOrder = "${MediaStore.Files.FileColumns.DATE_MODIFIED} DESC" val cursor = context?.contentResolver?.query(uri, projection, null, null, sortOrder) val listItems = arrayListOf() @@ -64,7 +65,9 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage val size = cursor.getLongValue(MediaStore.Files.FileColumns.SIZE) val modified = cursor.getLongValue(MediaStore.Files.FileColumns.DATE_MODIFIED) * 1000 val fileDirItem = ListItem(path, name, false, 0, size, modified, false) - listItems.add(fileDirItem) + if (showHidden || !name.startsWith(".")) { + listItems.add(fileDirItem) + } } while (cursor.moveToNext()) } } @@ -77,12 +80,10 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage private fun getRecyclerAdapter() = recents_list.adapter as? ItemsAdapter override fun toggleFilenameVisibility() { - context?.config?.displayFilenames = !context!!.config.displayFilenames getRecyclerAdapter()?.updateDisplayFilenamesInGrid() } override fun increaseColumnCount() { - context?.config?.fileColumnCnt = ++(recents_list.layoutManager as MyGridLayoutManager).spanCount columnCountChanged() } diff --git a/app/src/main/res/layout/recents_fragment.xml b/app/src/main/res/layout/recents_fragment.xml index a71d17dce..534e98034 100644 --- a/app/src/main/res/layout/recents_fragment.xml +++ b/app/src/main/res/layout/recents_fragment.xml @@ -30,6 +30,7 @@ android:layout_height="match_parent" android:clipToPadding="false" android:layoutAnimation="@anim/layout_animation" + android:paddingTop="@dimen/medium_margin" android:scrollbars="none" app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager" /> diff --git a/app/src/main/res/menu/menu.xml b/app/src/main/res/menu/menu.xml index 229d5aa5d..73ae07aa8 100644 --- a/app/src/main/res/menu/menu.xml +++ b/app/src/main/res/menu/menu.xml @@ -1,72 +1,73 @@ + xmlns:app="http://schemas.android.com/apk/res-auto"> + app:showAsAction="collapseActionView|always" /> + app:showAsAction="always" /> + app:showAsAction="always" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> - + app:showAsAction="ifRoom" /> + + app:showAsAction="never" /> + app:showAsAction="never" /> + app:showAsAction="never" /> + app:showAsAction="never" /> + app:showAsAction="never" /> + app:showAsAction="never" />