Added option to show file count in groups (#2281)

This commit is contained in:
Agnieszka C 2021-12-06 18:49:09 +01:00
parent f88e1848d7
commit dc3ed3aa2f
44 changed files with 73 additions and 15 deletions

View file

@ -34,6 +34,7 @@ class ChangeGroupingDialog(val activity: BaseSimpleActivity, val path: String =
currGrouping = config.getFolderGrouping(pathToUse)
setupGroupRadio()
setupOrderRadio()
view.grouping_dialog_show_file_count.isChecked = currGrouping and GROUP_SHOW_FILE_COUNT != 0
}
private fun setupGroupRadio() {
@ -79,6 +80,10 @@ class ChangeGroupingDialog(val activity: BaseSimpleActivity, val path: String =
grouping = grouping or GROUP_DESCENDING
}
if (view.grouping_dialog_show_file_count.isChecked) {
grouping = grouping or GROUP_SHOW_FILE_COUNT
}
if (view.grouping_dialog_use_for_this_folder.isChecked) {
config.saveFolderGrouping(pathToUse, grouping)
} else {

View file

@ -188,6 +188,7 @@ const val GROUP_BY_FOLDER = 32
const val GROUP_BY_LAST_MODIFIED_MONTHLY = 64
const val GROUP_BY_DATE_TAKEN_MONTHLY = 128
const val GROUP_DESCENDING = 1024
const val GROUP_SHOW_FILE_COUNT = 2048
// bottom actions
const val BOTTOM_ACTION_TOGGLE_FAVORITE = 1

View file

@ -805,7 +805,7 @@ class MediaFetcher(val context: Context) {
val yesterday = formatDate((System.currentTimeMillis() - DAY_SECONDS * 1000).toString(), true)
for ((key, value) in mediumGroups) {
var currentGridPosition = 0
val sectionKey = getFormattedKey(key, currentGrouping, today, yesterday)
val sectionKey = getFormattedKey(key, currentGrouping, today, yesterday, value.size)
thumbnailItems.add(ThumbnailSection(sectionKey))
value.forEach {
@ -818,7 +818,7 @@ class MediaFetcher(val context: Context) {
return thumbnailItems
}
private fun getFormattedKey(key: String, grouping: Int, today: String, yesterday: String): String {
private fun getFormattedKey(key: String, grouping: Int, today: String, yesterday: String, count: Int): String {
var result = when {
grouping and GROUP_BY_LAST_MODIFIED_DAILY != 0 || grouping and GROUP_BY_DATE_TAKEN_DAILY != 0 -> getFinalDate(
formatDate(key, true),
@ -836,7 +836,11 @@ class MediaFetcher(val context: Context) {
result = context.getString(R.string.unknown)
}
return result
return if (grouping and GROUP_SHOW_FILE_COUNT != 0) {
"$result ($count)"
} else {
result
}
}
private fun getFinalDate(date: String, today: String, yesterday: String): String {

View file

@ -115,6 +115,14 @@
android:id="@+id/use_for_this_folder_divider"
layout="@layout/divider" />
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/grouping_dialog_show_file_count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/activity_margin"
android:paddingBottom="@dimen/activity_margin"
android:text="@string/show_file_count_section_header" />
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/grouping_dialog_use_for_this_folder"
android:layout_width="match_parent"

View file

@ -144,6 +144,7 @@
<string name="by_date_taken_monthly">آخر تعديل (شهرياً)</string>
<string name="by_file_type">نوع الملف</string>
<string name="by_extension">الإمتداد</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">يرجى ملاحظة أن التجميع والفرز هما حقلان مستقلان</string>
<!-- Widgets -->
<string name="folder_on_widget">المجلد الظاهر فى الويدجت:</string>
@ -361,4 +362,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>
</resources>

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Date taken (monthly)</string>
<string name="by_file_type">File type</string>
<string name="by_extension">Extension</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Please note that grouping and sorting are 2 independent fields</string>
<!-- Widgets -->

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">তোলার তারিখ (মাসিক)</string>
<string name="by_file_type">ফাইল টাইপ</string>
<string name="by_extension">এক্সটেনশন</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Please note that grouping and sorting are 2 independent fields</string>
<!-- Widgets -->

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Data de presa (mensual)</string>
<string name="by_file_type">Tipus de fitxer</string>
<string name="by_extension">Extensió</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Tingueu en compte que lagrupació i la classificació són 2 camps independents</string>
<!-- Widgets -->

View file

@ -138,6 +138,7 @@
<string name="by_date_taken_monthly">Data pořízení (měsíčně)</string>
<string name="by_file_type">Typu souboru</string>
<string name="by_extension">Přípony</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Mějte prosím na paměti, že seskupování a řazení jsou 2 nezávislé hodnoty</string>
<!-- Widgets -->
<string name="folder_on_widget">Složka zobrazená na widgetu:</string>
@ -412,4 +413,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>
</resources>

View file

@ -138,6 +138,7 @@
<string name="by_date_taken_monthly">Dato for optagelse (månedlig)</string>
<string name="by_file_type">Filtype</string>
<string name="by_extension">Filendelse</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Vær opmærksom på at gruppering og sortering er to uafhængige felter</string>
<!-- Widgets -->
<string name="folder_on_widget">Mappe vist på widget:</string>
@ -411,4 +412,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>
</resources>

View file

@ -146,6 +146,7 @@
<string name="by_date_taken_monthly">Aufnahmedatum (monatlich)</string>
<string name="by_file_type">Dateityp (Bilder/Videos)</string>
<string name="by_extension">Dateierweiterung</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Bitte beachte, dass Gruppieren und Sortieren zwei unabhängige Felder sind</string>
<!-- Widgets -->
<string name="folder_on_widget">Ordner, der auf dem Widget angezeigt wird:</string>
@ -364,4 +365,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>
</resources>

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Ημερομ. λήψης (μηνιαία)</string>
<string name="by_file_type">Τύπο αρχείου</string>
<string name="by_extension">Επέκταση</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Σημειώστε ότι ομαδοποίηση και ταξινόμηση είναι 2 ανεξάρτητα πεδία</string>
<!-- Widgets -->

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Fecha de creación (mes)</string>
<string name="by_file_type">Tipo de arhivo</string>
<string name="by_extension">Extensión</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Tenga en cuenta que la agrupación y la clasificación son 2 campos independientes</string>
<!-- Widgets -->

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Ateratze-data (hilero)</string>
<string name="by_file_type">Fitxategi mota</string>
<string name="by_extension">Luzapena</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Kontuan hartu taldekatzea eta ordenatzea bi eremu independente direla.</string>
<!-- Widgets -->

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Kuvanottopäivämäärä (kuukausittainen)</string>
<string name="by_file_type">Tiedoston tyyppi</string>
<string name="by_extension">Tiedoston pääte</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Huomoi, että ryhmitys ja lajittelu ovat kaksi eri toimintoa</string>
<!-- Widgets -->
<string name="folder_on_widget">Pienoissovelluksessa näytettävä kansio:</string>
@ -418,4 +419,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>
</resources>

View file

@ -138,6 +138,7 @@
<string name="by_date_taken_monthly">Date de prise de vue (par mois)</string>
<string name="by_file_type">Type de fichier</string>
<string name="by_extension">Extension</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">\'Grouper par\' et \'Trier par\' sont 2 modes indépendants</string>
<!-- Widgets -->
<string name="folder_on_widget">Dossier affiché dans le widget :</string>

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Data de captura (mensual)</string>
<string name="by_file_type">Tipo de ficheiro</string>
<string name="by_extension">Extensión</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Por favor, ten en conta que agrupar e ordenar son dous campos diferentes</string>
<!-- Widgets -->

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Date taken (monthly)</string>
<string name="by_file_type">Tip datoteke</string>
<string name="by_extension">Vrsta datoteke</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Please note that grouping and sorting are 2 independent fields</string>
<!-- Widgets -->

View file

@ -146,6 +146,7 @@
<string name="by_date_taken_monthly">Felvétel dátuma (havonta)</string>
<string name="by_file_type">Fájltípus</string>
<string name="by_extension">Kiterjesztés</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Vegye figyelembe, hogy a csoportosítás és a rendezés 2 egymástól független mező</string>
<!-- Widgets -->
<string name="folder_on_widget">Mappa megjelenítése a modulon:</string>

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Tanggal diambil (bulanan)</string>
<string name="by_file_type">Tipe berkas</string>
<string name="by_extension">Ekstensi</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Harap dicatat bahwa mengelompokkan dan mengurutkan adalah 2 hal yang berbeda</string>
<!-- Widgets -->

View file

@ -140,6 +140,7 @@
<string name="by_date_taken_monthly">Data creazione (mensile)</string>
<string name="by_file_type">Tipo di file</string>
<string name="by_extension">Estensione</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Notare che il raggruppamento e l\'ordinamento sono due campi indipendenti</string>
<!-- Widgets -->
<string name="folder_on_widget">Cartella mostrata nel widget:</string>
@ -414,4 +415,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>
</resources>

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">撮影日時 (毎月)</string>
<string name="by_file_type">ファイル形式</string>
<string name="by_extension">拡張子</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">グループ化とソートはそれぞれ違ったフィールドであることに注意してください</string>
<!-- Widgets -->

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">찍은 날짜 (월간)</string>
<string name="by_file_type">파일 종류</string>
<string name="by_extension">파일 확장자</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">그룹 방식과 정렬 방식은 다른 항목입니다.</string>
<!-- Widgets -->

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Date taken (monthly)</string>
<string name="by_file_type">File type</string>
<string name="by_extension">Extension</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Please note that grouping and sorting are 2 independent fields</string>
<!-- Widgets -->

View file

@ -138,6 +138,7 @@
<string name="by_date_taken_monthly">Dato tatt (månedlig)</string>
<string name="by_file_type">Filtype</string>
<string name="by_extension">Endelse</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Vær oppmerksom på at gruppering og sortering er to uavhengige områder</string>
<!-- Widgets -->
<string name="folder_on_widget">Mappe vist på modulen:</string>
@ -412,4 +413,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>
</resources>

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Date taken (monthly)</string>
<string name="by_file_type">फाईलको प्रकार</string>
<string name="by_extension">Extension</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Please note that grouping and sorting are 2 independent fields</string>
<!-- Widgets -->

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Datum opname (per maand)</string>
<string name="by_file_type">Bestandstype</string>
<string name="by_extension">Extensie</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Groeperen en sorteren zijn twee aparte opties</string>
<!-- Widgets -->

View file

@ -144,6 +144,7 @@
<string name="by_date_taken_monthly">Data wykonania (miesięcznie)</string>
<string name="by_file_type">Typ pliku</string>
<string name="by_extension">Rozszerzenie</string>
<string name="show_file_count_section_header">Pokazuj liczbę plików w nagłówkach sekcji</string>
<string name="grouping_and_sorting">Uwaga: Grupowanie i sortowanie to dwa niezależne pola</string>
<!-- Widgets -->
<string name="folder_on_widget">Folder wyświetlany w widżecie:</string>
@ -416,4 +417,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>
</resources>

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Data da foto (por mês)</string>
<string name="by_file_type">Tipo de arquivo</string>
<string name="by_extension">Extensão</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Por favor, lembre-se que o agrupamento e classificação são configurados por dois campos independentes</string>
<!-- Widgets -->

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Data de obtenção (mensal)</string>
<string name="by_file_type">Tipo de ficheiro</string>
<string name="by_extension">Extensão</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Tenha em atenção de que agrupamento e ordenação são campos independentes</string>
<!-- Widgets -->

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Data realizării (lunar)</string>
<string name="by_file_type">Tipul de fișier</string>
<string name="by_extension">Extensie</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Vă rugăm să rețineți că gruparea și sortarea sunt două câmpuri independente.</string>
<!-- Widgets -->

View file

@ -140,6 +140,7 @@
<string name="by_date_taken_monthly">Дата съёмки (месяц)</string>
<string name="by_file_type">Тип файла</string>
<string name="by_extension">Расширение</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Обратите внимание, что группировка и сортировка — это два независимых поля</string>
<!-- Widgets -->
<string name="folder_on_widget">Папка, отображаемая в виджете:</string>
@ -414,4 +415,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>
</resources>

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Dátumu vytvorenia (mesačne)</string>
<string name="by_file_type">Typu súboru</string>
<string name="by_extension">Prípony</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Prosím vedzte, že radenie a zoskupovanie súborov sú 2 nezávislé hodnoty</string>
<!-- Widgets -->

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Date taken (monthly)</string>
<string name="by_file_type">Tip datoteke</string>
<string name="by_extension">Končnica</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Združevanje in sortiranje sta dve neodvisni polji.</string>
<!-- Widgets -->

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Date taken (monthly)</string>
<string name="by_file_type">Тип датотеке</string>
<string name="by_extension">Тип датотеке</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Имајте на уму да су груписање и сортирање 2 различите ствари</string>
<!-- Widgets -->

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Fotodatum (månad)</string>
<string name="by_file_type">Filtyp</string>
<string name="by_extension">Filnamnstillägg</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Observera att gruppering och sortering är två oberoende funktioner</string>
<!-- Widgets -->

View file

@ -138,6 +138,7 @@
<string name="by_date_taken_monthly">எடுக்கப்பட்ட தேதி (மாதாந்திர)</string>
<string name="by_file_type">கோப்பு வகை</string>
<string name="by_extension">நீட்டிப்பு</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">ஒன்றிணைத்தல் மற்றும் வரிசைப்படுத்தல் 2 சுயாதீன புலங்கள் என்பதை நினைவில்கொள்க</string>
<!-- Widgets -->
<string name="folder_on_widget">விட்ஜெட்டில் கோப்புறை காட்டப்பட்டுள்ளது:</string>
@ -412,4 +413,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>
</resources>

View file

@ -144,6 +144,7 @@
<string name="by_date_taken_monthly">Çekildiği tarih (aylık)</string>
<string name="by_file_type">Dosya türü</string>
<string name="by_extension">Uzantı</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Lütfen gruplandırmanın ve sıralamanın 2 bağımsız alan olduğunu unutmayın</string>
<!-- Widgets -->
<string name="folder_on_widget">Widget\'ta gösterilen klasör:</string>
@ -418,4 +419,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>
</resources>

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">датою зйомки (по місяцях)</string>
<string name="by_file_type">типом файлу</string>
<string name="by_extension">розширенням</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Зверніть увагу, що групування і сортування - це два окремих поля</string>
<!-- Widgets -->

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Ngày chụp (hàng tháng)</string>
<string name="by_file_type">Loại tệp</string>
<string name="by_extension">Phần mở rộng</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Xin lưu ý rằng Nhóm và Sắp xếp là 2 trường độc lập</string>
<!-- Widgets -->

View file

@ -148,6 +148,7 @@
<string name="by_date_taken_monthly">拍摄时间(按月)</string>
<string name="by_file_type">文件类型</string>
<string name="by_extension">扩展名</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">请注意,分组和排序是两种独立的组织方式</string>
<!-- Widgets -->
<string name="folder_on_widget">在小工具上显示的文件夹:</string>
@ -420,4 +421,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>
</resources>

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Date taken (monthly)</string>
<string name="by_file_type">檔案類型</string>
<string name="by_extension">副檔名</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">請注意,歸類和排序是兩者是獨立的</string>
<!-- Widgets -->

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">拍攝日期 (按月)</string>
<string name="by_file_type">檔案類型</string>
<string name="by_extension">副檔名</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">請注意,歸類和排序兩者是獨立的</string>
<!-- Widgets -->

View file

@ -145,6 +145,7 @@
<string name="by_date_taken_monthly">Date taken (monthly)</string>
<string name="by_file_type">File type</string>
<string name="by_extension">Extension</string>
<string name="show_file_count_section_header">Show file count at section headers</string>
<string name="grouping_and_sorting">Please note that grouping and sorting are 2 independent fields</string>
<!-- Widgets -->