Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Ability to select columns to be shown on folder item ([#321])

## [1.6.1] - 2026-02-14
### Changed
Expand Down Expand Up @@ -133,6 +135,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#250]: https://github.com/FossifyOrg/File-Manager/issues/250
[#251]: https://github.com/FossifyOrg/File-Manager/issues/251
[#267]: https://github.com/FossifyOrg/File-Manager/issues/267
[#321]: https://github.com/FossifyOrg/File-Manager/issues/321

[Unreleased]: https://github.com/FossifyOrg/File-Manager/compare/1.6.1...HEAD
[1.6.1]: https://github.com/FossifyOrg/File-Manager/compare/1.6.0...1.6.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.fossify.commons.helpers.*
import org.fossify.commons.models.RadioItem
import org.fossify.filemanager.R
import org.fossify.filemanager.databinding.ActivitySettingsBinding
import org.fossify.filemanager.dialogs.ManageFolderColumnsDialog
import org.fossify.filemanager.dialogs.ManageVisibleTabsDialog
import org.fossify.filemanager.extensions.config
import org.fossify.filemanager.helpers.RootHelpers
Expand Down Expand Up @@ -38,6 +39,7 @@ class SettingsActivity : SimpleActivity() {
setupLanguage()
setupManageFavorites()
setupManageShownTabs()
setupCustomizeFolderOptions()
setupChangeDateTimeFormat()
setupFontSize()
setupShowHidden()
Expand Down Expand Up @@ -188,6 +190,12 @@ class SettingsActivity : SimpleActivity() {
}
}

private fun setupCustomizeFolderOptions(){
binding.settingsManageFolderColumnsHolder.setOnClickListener {
ManageFolderColumnsDialog(this)
}
}

private fun setupAppPasswordProtection() {
binding.settingsAppPasswordProtection.isChecked = config.isAppPasswordProtectionOn
binding.settingsAppPasswordProtectionHolder.setOnClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1070,37 +1070,86 @@ class ItemsAdapter(
}

if (listItem.isDirectory) {
itemIcon?.setImageDrawable(folderDrawable)
itemDetails?.text = getChildrenCnt(listItem)
itemDate?.beGone()
setupDirectoryView(itemIcon, listItem, itemDetails, itemDate)
} else {
itemDetails?.text = listItem.size.formatSize()
itemDate?.beVisible()
itemDate?.text = listItem.modified.formatDate(activity, dateFormat, timeFormat)

val drawable = fileDrawables.getOrElse(
key = fileName.substringAfterLast(".").lowercase(Locale.getDefault()),
defaultValue = { fileDrawable }
)
val options = RequestOptions()
.signature(listItem.getKey())
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.error(drawable)
.transform(CenterCrop(), RoundedCorners(10))

val itemToLoad = getImagePathToLoad(listItem.path)
if (!activity.isDestroyed && itemIcon != null) {
Glide.with(activity)
.load(itemToLoad)
.transition(DrawableTransitionOptions.withCrossFade())
.apply(options)
.into(itemIcon!!)
}
setupFileView(itemIcon, listItem, itemDetails, itemDate, fileName)
}
}
}
}

private fun setupDirectoryView(
itemIcon: ImageView?,
listItem: ListItem,
itemDetails: TextView?,
itemDate: TextView?
){
itemIcon?.setImageDrawable(folderDrawable)
val parts = mutableListOf<String>()

if (config.showFolderChildrenCount) {
parts.add(getChildrenCnt(listItem))
}

if (config.showFolderSize) {
parts.add(listItem.mSize.formatSize())
loadFolderSize(listItem, getItemKeyPosition(listItem.path.hashCode()))
}

itemDetails?.text = parts.joinToString(" • ")
setupFolderDate(listItem,itemDate)
}

private fun setupFileView(
itemIcon: ImageView?,
listItem: ListItem,
itemDetails: TextView?,
itemDate: TextView?,
fileName : String
){
itemDetails?.text = listItem.size.formatSize()
itemDate?.beVisible()
itemDate?.text = listItem.modified.formatDate(activity, dateFormat, timeFormat)

val drawable = fileDrawables.getOrElse(
key = fileName.substringAfterLast(".").lowercase(Locale.getDefault()),
defaultValue = { fileDrawable }
)
val options = RequestOptions()
.signature(listItem.getKey())
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.error(drawable)
.transform(CenterCrop(), RoundedCorners(10))

val itemToLoad = getImagePathToLoad(listItem.path)
if (!activity.isDestroyed && itemIcon != null) {
Glide.with(activity)
.load(itemToLoad)
.transition(DrawableTransitionOptions.withCrossFade())
.apply(options)
.into(itemIcon!!)
}
}

private fun loadFolderSize(listItem: ListItem, position: Int) {
ensureBackgroundThread {
val size = File(listItem.path).getProperSize(config.shouldShowHidden())
activity.runOnUiThread {
listItem.mSize = size
notifyItemChanged(position, Unit)
}
}
}

private fun setupFolderDate(listItem : ListItem,dateView: TextView?) {
if (config.showFolderLastModifiedAt) {
dateView?.beVisible()
dateView?.text = listItem.modified.formatDate(activity, dateFormat, timeFormat)
} else {
dateView?.beGone()
}
}

private fun getChildrenCnt(item: FileDirItem): String {
val children = item.children
return activity.resources.getQuantityString(R.plurals.items, children, children)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package org.fossify.filemanager.dialogs

import org.fossify.commons.activities.BaseSimpleActivity
import org.fossify.commons.extensions.getAlertDialogBuilder
import org.fossify.commons.extensions.setupDialogStuff
import org.fossify.commons.views.MyAppCompatCheckbox
import org.fossify.filemanager.databinding.DialogManageFolderColumsBinding
import org.fossify.filemanager.extensions.config

class ManageFolderColumnsDialog(val activity: BaseSimpleActivity) {
private var config = activity.config
private val binding: DialogManageFolderColumsBinding = DialogManageFolderColumsBinding
.inflate(activity.layoutInflater)
private var showFolderSize : Boolean = config.showFolderSize
private var showChildrenCount : Boolean = config.showFolderChildrenCount
private var showModifiedAt : Boolean = config.showFolderLastModifiedAt

init {

setupColumnCheckboxSelection()

activity.getAlertDialogBuilder()
.setPositiveButton("OK",{dialog,which -> dialogConfirmed()})
.setNegativeButton("Cancel",null)
.apply {
activity.setupDialogStuff(binding.root, this)
}
}

private fun setupColumnCheckboxSelection(){
setupCheckbox(binding.manageFolderColumnsSize, showFolderSize) { showFolderSize = it }
setupCheckbox(binding.manageFolderColumnsChildrenCount, showChildrenCount) { showChildrenCount = it }
setupCheckbox(binding.manageFolderColumnsModifiedAt, showModifiedAt) { showModifiedAt = it }
}

private fun setupCheckbox(checkbox: MyAppCompatCheckbox, initialState: Boolean, onChanged: (Boolean) -> Unit) {
checkbox.isChecked = initialState
checkbox.setOnClickListener {
onChanged(checkbox.isChecked)
}
}

private fun dialogConfirmed(){
if(config.showFolderSize != showFolderSize){
config.showFolderSize = showFolderSize
}

if(config.showFolderChildrenCount != showChildrenCount){
config.showFolderChildrenCount = showChildrenCount
}

if(config.showFolderLastModifiedAt != showModifiedAt){
config.showFolderLastModifiedAt = showModifiedAt
}
}
}
19 changes: 19 additions & 0 deletions app/src/main/kotlin/org/fossify/filemanager/helpers/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,23 @@ class Config(context: Context) : BaseConfig(context) {
var wasStorageAnalysisTabAdded: Boolean
get() = prefs.getBoolean(WAS_STORAGE_ANALYSIS_TAB_ADDED, false)
set(wasStorageAnalysisTabAdded) = prefs.edit().putBoolean(WAS_STORAGE_ANALYSIS_TAB_ADDED, wasStorageAnalysisTabAdded).apply()

var showFolderSize : Boolean
get() = prefs.getBoolean(FOLDER_SHOW_SIZE, false)
set(showFolderSize) = prefs.edit()
.putBoolean(FOLDER_SHOW_SIZE,showFolderSize)
.apply()

var showFolderLastModifiedAt : Boolean
get() = prefs.getBoolean(FOLDER_SHOW_LAST_MODIFIED_AT,false)
set(folderShowLastModifiedAt) = prefs.edit()
.putBoolean(FOLDER_SHOW_LAST_MODIFIED_AT,folderShowLastModifiedAt)
.apply()

var showFolderChildrenCount : Boolean
get() = prefs.getBoolean(FOLDER_SHOW_CHILDREN_COUNT,true)
set(showFolderChildrenCount) = prefs.edit()
.putBoolean(FOLDER_SHOW_CHILDREN_COUNT,showFolderChildrenCount)
.apply()

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ const val FILE_LANDSCAPE_COLUMN_CNT = "file_landscape_column_cnt"
const val DISPLAY_FILE_NAMES = "display_file_names"
const val SHOW_TABS = "show_tabs"
const val WAS_STORAGE_ANALYSIS_TAB_ADDED = "was_storage_analysis_tab_added"
const val FOLDER_SHOW_SIZE = "show_folder_size"
const val FOLDER_SHOW_LAST_MODIFIED_AT = "show_folder_last_modified_at"
const val FOLDER_SHOW_CHILDREN_COUNT = "show_folder_children_count"

// open as
const val OPEN_AS_DEFAULT = 0
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/res/layout/activity_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,21 @@

</RelativeLayout>

<RelativeLayout
android:id="@+id/settings_manage_folder_columns_holder"
style="@style/SettingsHolderTextViewOneLinerStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<org.fossify.commons.views.MyTextView
android:id="@+id/settings_manage_folder_columns"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/manage_folder_columns" />

</RelativeLayout>

<RelativeLayout
android:id="@+id/settings_change_date_time_format_holder"
style="@style/SettingsHolderTextViewOneLinerStyle"
Expand Down
41 changes: 41 additions & 0 deletions app/src/main/res/layout/dialog_manage_folder_colums.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/manage_folder_columns_scroll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<LinearLayout
android:id="@+id/manage_folder_columns_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingStart="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin">

<org.fossify.commons.views.MyAppCompatCheckbox
android:id="@+id/manage_folder_columns_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/activity_margin"
android:paddingBottom="@dimen/activity_margin"
android:text="@string/column_folder_size" />

<org.fossify.commons.views.MyAppCompatCheckbox
android:id="@+id/manage_folder_columns_children_count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/activity_margin"
android:paddingBottom="@dimen/activity_margin"
android:text="@string/column_folder_children_count" />

<org.fossify.commons.views.MyAppCompatCheckbox
android:id="@+id/manage_folder_columns_modified_at"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/activity_margin"
android:paddingBottom="@dimen/activity_margin"
android:text="@string/column_folder_last_modified_at" />

</LinearLayout>
</ScrollView>
13 changes: 7 additions & 6 deletions app/src/main/res/layout/item_file_dir_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,24 @@
android:alpha="0.6"
android:paddingStart="@dimen/tiny_margin"
android:textSize="@dimen/smaller_text_size"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/item_date"
app:layout_constraintBottom_toTopOf="@+id/item_date"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/item_icon"
app:layout_constraintTop_toBottomOf="@+id/item_name"
app:layout_constraintVertical_bias="0.5"
tools:text="1 KB" />

<TextView
android:id="@+id/item_date"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:alpha="0.6"
android:gravity="end"
android:paddingStart="@dimen/tiny_margin"
android:textSize="@dimen/smaller_text_size"
app:layout_constraintBottom_toBottomOf="@+id/item_details"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/item_details"
app:layout_constraintStart_toEndOf="@id/item_icon"
app:layout_constraintTop_toBottomOf="@+id/item_details"
tools:text="1.1.1970" />

</androidx.constraintlayout.widget.ConstraintLayout>
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
<!-- Settings -->
<string name="enable_root_access">Enable root access</string>
<string name="press_back_twice">Require pressing Back twice to leave the app</string>
<string name="manage_folder_columns">Manage folder columns</string>
<string name="column_folder_size">Size</string>
<string name="column_folder_children_count">Children count</string>
<string name="column_folder_last_modified_at">Last modified at</string>
<!--
Haven't found some strings? There's more at
https://github.com/FossifyOrg/Commons/tree/master/commons/src/main/res
Expand Down
Loading