adding some top menu related improvements
This commit is contained in:
parent
4e5d55be9f
commit
0c648d4f88
|
@ -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'
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -477,7 +477,6 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
|||
}
|
||||
|
||||
override fun toggleFilenameVisibility() {
|
||||
context?.config?.displayFilenames = !context!!.config.displayFilenames
|
||||
getRecyclerAdapter()?.updateDisplayFilenamesInGrid()
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
|||
override fun setupColors(textColor: Int, adjustedPrimaryColor: Int) {}
|
||||
|
||||
private fun getRecents(callback: (recents: ArrayList<ListItem>) -> 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<ListItem>()
|
||||
|
||||
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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" />
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
|
|
@ -1,72 +1,73 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/search"
|
||||
android:icon="@drawable/ic_search_vector"
|
||||
android:title="@string/search"
|
||||
app:actionViewClass="androidx.appcompat.widget.SearchView"
|
||||
app:showAsAction="collapseActionView|always"/>
|
||||
app:showAsAction="collapseActionView|always" />
|
||||
<item
|
||||
android:id="@+id/go_home"
|
||||
android:icon="@drawable/ic_home_vector"
|
||||
android:title="@string/go_to_home_folder"
|
||||
app:showAsAction="always"/>
|
||||
app:showAsAction="always" />
|
||||
<item
|
||||
android:id="@+id/go_to_favorite"
|
||||
android:icon="@drawable/ic_folder_open_vector"
|
||||
android:title="@string/go_to_favorite"
|
||||
app:showAsAction="always"/>
|
||||
app:showAsAction="always" />
|
||||
<item
|
||||
android:id="@+id/sort"
|
||||
android:icon="@drawable/ic_sort_vector"
|
||||
android:title="@string/sort_by"
|
||||
app:showAsAction="ifRoom"/>
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/add_favorite"
|
||||
android:icon="@drawable/ic_star_off_vector"
|
||||
android:title="@string/add_to_favorites"
|
||||
app:showAsAction="ifRoom"/>
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/remove_favorite"
|
||||
android:icon="@drawable/ic_star_on_vector"
|
||||
android:title="@string/remove_from_favorites"
|
||||
app:showAsAction="ifRoom"/>
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/toggle_filename"
|
||||
android:icon="@drawable/ic_label_vector"
|
||||
android:title="@string/toggle_filename"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/change_view_type"
|
||||
android:icon="@drawable/ic_change_view_vector"
|
||||
android:title="@string/change_view_type"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/set_as_home"
|
||||
android:title="@string/set_as_home_folder"
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/change_view_type"
|
||||
android:title="@string/change_view_type"
|
||||
app:showAsAction="never"/>
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/temporarily_show_hidden"
|
||||
android:title="@string/temporarily_show_hidden"
|
||||
app:showAsAction="never"/>
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/stop_showing_hidden"
|
||||
android:title="@string/stop_showing_hidden"
|
||||
app:showAsAction="never"/>
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/increase_column_count"
|
||||
android:title="@string/increase_column_count"
|
||||
app:showAsAction="never"/>
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/reduce_column_count"
|
||||
android:title="@string/reduce_column_count"
|
||||
app:showAsAction="never"/>
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/settings"
|
||||
android:title="@string/settings"
|
||||
app:showAsAction="never"/>
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/about"
|
||||
android:title="@string/about"
|
||||
app:showAsAction="never"/>
|
||||
app:showAsAction="never" />
|
||||
</menu>
|
||||
|
|
Loading…
Reference in New Issue