mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-06-05 22:09:15 +02:00
allow toggling filename visibility in the grid view
This commit is contained in:
@ -112,7 +112,7 @@ class MainActivity : SimpleActivity() {
|
||||
R.id.sort -> showSortingDialog()
|
||||
R.id.add_favorite -> addFavorite()
|
||||
R.id.remove_favorite -> removeFavorite()
|
||||
R.id.toggle_filename -> toggleFilenameVisibility()
|
||||
R.id.toggle_filename -> fragment.toggleFilenameVisibility()
|
||||
R.id.set_as_home -> setAsHome()
|
||||
R.id.change_view_type -> changeViewType()
|
||||
R.id.temporarily_show_hidden -> tryToggleTemporarilyShowHidden()
|
||||
@ -269,10 +269,6 @@ class MainActivity : SimpleActivity() {
|
||||
config.removeFavorite(fragment.currentPath)
|
||||
}
|
||||
|
||||
private fun toggleFilenameVisibility() {
|
||||
|
||||
}
|
||||
|
||||
private fun goToFavorite() {
|
||||
val favorites = config.favorites
|
||||
val items = ArrayList<RadioItem>(favorites.size)
|
||||
|
@ -75,6 +75,7 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
|
||||
private val config = activity.config
|
||||
private val viewType = config.getFolderViewType(listItems.firstOrNull { !it.isSectionTitle }?.mPath?.getParentPath() ?: "")
|
||||
private val isListViewType = viewType == VIEW_TYPE_LIST
|
||||
private var displayFilenamesInGrid = config.displayFilenames
|
||||
|
||||
init {
|
||||
setupDragListener(true)
|
||||
@ -708,6 +709,11 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
fun updateDisplayFilenamesInGrid() {
|
||||
displayFilenamesInGrid = activity.config.displayFilenames
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
fun isASectionTitle(position: Int) = listItems.getOrNull(position)?.isSectionTitle ?: false
|
||||
|
||||
override fun onViewRecycled(holder: ViewHolder) {
|
||||
@ -747,6 +753,12 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
|
||||
item_check?.background?.applyColorFilter(primaryColor)
|
||||
}
|
||||
|
||||
if (!isListViewType && !listItem.isDirectory) {
|
||||
item_name.beVisibleIf(displayFilenamesInGrid)
|
||||
} else {
|
||||
item_name.beVisible()
|
||||
}
|
||||
|
||||
if (listItem.isDirectory) {
|
||||
item_icon.setImageDrawable(folderDrawable)
|
||||
item_details?.text = getChildrenCnt(listItem)
|
||||
|
@ -529,6 +529,11 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
|
||||
calculateContentHeight(storedItems)
|
||||
}
|
||||
|
||||
fun toggleFilenameVisibility() {
|
||||
context?.config?.displayFilenames = !context!!.config.displayFilenames
|
||||
getRecyclerAdapter()?.updateDisplayFilenamesInGrid()
|
||||
}
|
||||
|
||||
override fun breadcrumbClicked(id: Int) {
|
||||
if (id == 0) {
|
||||
StoragePickerDialog(activity as SimpleActivity, currentPath, context!!.config.enableRootAccess, true) {
|
||||
|
@ -109,4 +109,8 @@ class Config(context: Context) : BaseConfig(context) {
|
||||
val isPortrait = context.resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT
|
||||
return if (isPortrait) 3 else 5
|
||||
}
|
||||
|
||||
var displayFilenames: Boolean
|
||||
get() = prefs.getBoolean(DISPLAY_FILE_NAMES, true)
|
||||
set(displayFilenames) = prefs.edit().putBoolean(DISPLAY_FILE_NAMES, displayFilenames).apply()
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ const val VIEW_TYPE = "view_type"
|
||||
const val VIEW_TYPE_PREFIX = "view_type_folder_"
|
||||
const val FILE_COLUMN_CNT = "file_column_cnt"
|
||||
const val FILE_LANDSCAPE_COLUMN_CNT = "file_landscape_column_cnt"
|
||||
const val DISPLAY_FILE_NAMES = "display_file_names"
|
||||
|
||||
// open as
|
||||
const val OPEN_AS_DEFAULT = 0
|
||||
|
Reference in New Issue
Block a user