From a27e44f38d4a50029c771d811a243a6177e4cfe3 Mon Sep 17 00:00:00 2001 From: Wolfgang Meier Date: Fri, 24 Sep 2021 14:10:33 +0200 Subject: [PATCH 01/70] Allow all mime-types when using the 'Save As' function --- app/src/main/AndroidManifest.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a7adeefd..39f0a441 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -90,9 +90,7 @@ - - - + From 2f451917ad263787163cfaa225b528e7d1b970ee Mon Sep 17 00:00:00 2001 From: lnux-usr <85266419+lnux-usr@users.noreply.github.com> Date: Sun, 26 Sep 2021 16:53:46 -0300 Subject: [PATCH 02/70] Update pt-br translations --- app/src/main/res/values-pt-rBR/strings.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 250d7145..2a51a176 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -11,8 +11,8 @@ Por favor, selecione um arquivo de áudio Procurar pasta Esta operação só funciona em dispositivos rooteados - Recents - Show recents + Recentes + Mostrar recentes Abrir como @@ -30,8 +30,8 @@ Descompactando… Compactado com sucesso Descompactado com sucesso - Compactação falhou - Descompactação falhou + A compactação falhou + A descompactação falhou Gerenciar favoritos @@ -43,7 +43,7 @@ Ativar o acesso root - Require pressing Back twice to leave the app + Requira o duplo pressionamento do botão "voltar" para sair do app From 48c3b3470af9188e3402e98ed1117bef77f6d279 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 9 Oct 2021 22:24:35 +0200 Subject: [PATCH 03/70] updating kotlin and gradle --- build.gradle | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index e0fb0bd8..1d186814 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.5.30' + ext.kotlin_version = '1.5.31' repositories { google() @@ -9,7 +9,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:4.2.2' + classpath 'com.android.tools.build:gradle:7.0.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7490f4ab..0896a415 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip From 08ea0b9b9c71d7b7c31e9faef7e7d0eef7625bac Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 10 Oct 2021 18:57:42 +0200 Subject: [PATCH 04/70] updating commons --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 88cc1fee..bd72d31d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -58,7 +58,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:649211e294' + implementation 'com.github.SimpleMobileTools:Simple-Commons:a000a4b6a8' implementation 'com.github.Stericson:RootTools:df729dcb13' implementation 'com.github.Stericson:RootShell:1.6' implementation 'com.alexvasilkov:gesture-views:2.5.2' From 095e1781a8e23f7e97699df28e123dd1115455da Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 10 Oct 2021 20:02:57 +0200 Subject: [PATCH 05/70] fix #497, properly handle file/files copied/moved success message --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index bd72d31d..7049d7f7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -58,7 +58,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:a000a4b6a8' + implementation 'com.github.SimpleMobileTools:Simple-Commons:69346a62e0' implementation 'com.github.Stericson:RootTools:df729dcb13' implementation 'com.github.Stericson:RootShell:1.6' implementation 'com.alexvasilkov:gesture-views:2.5.2' From 1af8303bbb7a54b5d42dd1ca83d1b57795126194 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 10 Oct 2021 22:44:30 +0200 Subject: [PATCH 06/70] adding the core of a new Storage fragment --- .../pro/activities/MainActivity.kt | 7 +-- .../pro/fragments/StorageFragment.kt | 51 +++++++++++++++++++ 2 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt 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 da278734..6e9cf8a8 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 @@ -138,6 +138,7 @@ class MainActivity : SimpleActivity() { override fun onPrepareOptionsMenu(menu: Menu?): Boolean { val currentFragment = getCurrentFragment() ?: return true + val currentViewType = config.getFolderViewType(currentFragment.currentPath) val favorites = config.favorites menu!!.apply { @@ -148,15 +149,15 @@ class MainActivity : SimpleActivity() { findItem(R.id.remove_favorite).isVisible = currentFragment is ItemsFragment && favorites.contains(currentFragment.currentPath) findItem(R.id.go_to_favorite).isVisible = currentFragment is ItemsFragment && favorites.isNotEmpty() - findItem(R.id.toggle_filename).isVisible = config.getFolderViewType(currentFragment.currentPath) == VIEW_TYPE_GRID + findItem(R.id.toggle_filename).isVisible = currentViewType == VIEW_TYPE_GRID findItem(R.id.go_home).isVisible = currentFragment is ItemsFragment && currentFragment.currentPath != config.homeFolder findItem(R.id.set_as_home).isVisible = currentFragment is ItemsFragment && currentFragment.currentPath != config.homeFolder findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden - findItem(R.id.increase_column_count).isVisible = config.getFolderViewType(currentFragment.currentPath) == VIEW_TYPE_GRID && config.fileColumnCnt < MAX_COLUMN_COUNT - findItem(R.id.reduce_column_count).isVisible = config.getFolderViewType(currentFragment.currentPath) == VIEW_TYPE_GRID && config.fileColumnCnt > 1 + findItem(R.id.increase_column_count).isVisible = currentViewType == VIEW_TYPE_GRID && config.fileColumnCnt < MAX_COLUMN_COUNT + findItem(R.id.reduce_column_count).isVisible = currentViewType == VIEW_TYPE_GRID && config.fileColumnCnt > 1 } return true diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt new file mode 100644 index 00000000..7e6fb471 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -0,0 +1,51 @@ +package com.simplemobiletools.filemanager.pro.fragments + +import android.content.Context +import android.net.Uri +import android.provider.MediaStore +import android.util.AttributeSet +import com.simplemobiletools.commons.extensions.getLongValue +import com.simplemobiletools.commons.extensions.queryCursor +import com.simplemobiletools.filemanager.pro.activities.SimpleActivity + +class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) { + override fun setupFragment(activity: SimpleActivity) {} + + override fun refreshItems() {} + + override fun setupColors(textColor: Int, primaryColor: Int) {} + + override fun toggleFilenameVisibility() {} + + override fun increaseColumnCount() {} + + override fun reduceColumnCount() {} + + override fun setupFontSize() {} + + override fun setupDateTimeFormat() {} + + override fun searchQueryChanged(text: String) {} + + override fun finishActMode() {} + + private fun getFileTypeSize(uri: Uri): Long { + val projection = arrayOf( + MediaStore.Files.FileColumns.SIZE + ) + + var totalSize = 0L + try { + context.queryCursor(uri, projection) { cursor -> + try { + val size = cursor.getLongValue(MediaStore.Files.FileColumns.SIZE) + totalSize += size + } catch (e: Exception) { + } + } + } catch (e: Exception) { + } + + return totalSize + } +} From dbfab9c0cf5ad5c863a80740e3fbffcd290847bd Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 10 Oct 2021 22:58:03 +0200 Subject: [PATCH 07/70] moving some functions from MyViewPagerFragment to ItemOperationsListener --- .../filemanager/pro/activities/MainActivity.kt | 17 +++++++++-------- .../pro/fragments/MyViewPagerFragment.kt | 14 -------------- .../pro/fragments/StorageFragment.kt | 16 +--------------- .../pro/interfaces/ItemOperationsListener.kt | 14 ++++++++++++++ 4 files changed, 24 insertions(+), 37 deletions(-) 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 6e9cf8a8..0fc51d75 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 @@ -33,6 +33,7 @@ import com.simplemobiletools.filemanager.pro.fragments.MyViewPagerFragment import com.simplemobiletools.filemanager.pro.helpers.MAX_COLUMN_COUNT import com.simplemobiletools.filemanager.pro.helpers.RootHelpers import com.simplemobiletools.filemanager.pro.helpers.tabsList +import com.simplemobiletools.filemanager.pro.interfaces.ItemOperationsListener import com.stericson.RootTools.RootTools import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.items_fragment.* @@ -94,13 +95,13 @@ class MainActivity : SimpleActivity() { if (storedFontSize != config.fontSize) { getAllFragments().forEach { - it?.setupFontSize() + (it as? ItemOperationsListener)?.setupFontSize() } } if (storedDateFormat != config.dateFormat || storedTimeFormat != getTimeFormat()) { getAllFragments().forEach { - it?.setupDateTimeFormat() + (it as? ItemOperationsListener)?.setupDateTimeFormat() } } @@ -237,7 +238,7 @@ class MainActivity : SimpleActivity() { override fun onQueryTextChange(newText: String): Boolean { if (isSearchOpen) { - getCurrentFragment()?.searchQueryChanged(newText) + (getCurrentFragment() as? ItemOperationsListener)?.searchQueryChanged(newText) } return true } @@ -342,7 +343,7 @@ class MainActivity : SimpleActivity() { main_view_pager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener { override fun onPageScrollStateChanged(state: Int) { if (isSearchOpen) { - getCurrentFragment()?.searchQueryChanged("") + (getCurrentFragment() as? ItemOperationsListener)?.searchQueryChanged("") searchMenuItem?.collapseActionView() } } @@ -352,7 +353,7 @@ class MainActivity : SimpleActivity() { override fun onPageSelected(position: Int) { main_tabs_holder.getTabAt(position)?.select() getAllFragments().forEach { - it?.finishActMode() + (it as? ItemOperationsListener)?.finishActMode() } invalidateOptionsMenu() } @@ -463,19 +464,19 @@ class MainActivity : SimpleActivity() { private fun toggleFilenameVisibility() { config.displayFilenames = !config.displayFilenames getAllFragments().forEach { - it?.toggleFilenameVisibility() + (it as? ItemOperationsListener)?.toggleFilenameVisibility() } } private fun increaseColumnCount() { getAllFragments().forEach { - it?.increaseColumnCount() + (it as? ItemOperationsListener)?.increaseColumnCount() } } private fun reduceColumnCount() { getAllFragments().forEach { - it?.reduceColumnCount() + (it as? ItemOperationsListener)?.reduceColumnCount() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/MyViewPagerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/MyViewPagerFragment.kt index 831efe0a..e601a9f2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/MyViewPagerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/MyViewPagerFragment.kt @@ -38,19 +38,5 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet) abstract fun setupColors(textColor: Int, primaryColor: Int) - abstract fun setupFontSize() - - abstract fun setupDateTimeFormat() - - abstract fun searchQueryChanged(text: String) - - abstract fun finishActMode() - - abstract fun toggleFilenameVisibility() - - abstract fun increaseColumnCount() - - abstract fun reduceColumnCount() - abstract fun refreshItems() } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index 7e6fb471..0d7e2b3c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -15,21 +15,7 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage override fun setupColors(textColor: Int, primaryColor: Int) {} - override fun toggleFilenameVisibility() {} - - override fun increaseColumnCount() {} - - override fun reduceColumnCount() {} - - override fun setupFontSize() {} - - override fun setupDateTimeFormat() {} - - override fun searchQueryChanged(text: String) {} - - override fun finishActMode() {} - - private fun getFileTypeSize(uri: Uri): Long { + private fun getMediaTypeSize(uri: Uri): Long { val projection = arrayOf( MediaStore.Files.FileColumns.SIZE ) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/interfaces/ItemOperationsListener.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/interfaces/ItemOperationsListener.kt index 5f248f41..8c2cc5d4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/interfaces/ItemOperationsListener.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/interfaces/ItemOperationsListener.kt @@ -9,4 +9,18 @@ interface ItemOperationsListener { fun deleteFiles(files: ArrayList) fun selectedPaths(paths: ArrayList) + + fun searchQueryChanged(text: String) + + fun setupDateTimeFormat() + + fun setupFontSize() + + fun toggleFilenameVisibility() + + fun increaseColumnCount() + + fun reduceColumnCount() + + fun finishActMode() } From 25a621da277570e463550d662d86f20147eed9f8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 10 Oct 2021 23:02:40 +0200 Subject: [PATCH 08/70] renaming refreshItems to refreshFragment --- .../pro/activities/MainActivity.kt | 8 ++++---- .../filemanager/pro/adapters/ItemsAdapter.kt | 20 +++++++++---------- .../pro/fragments/ItemsFragment.kt | 6 +++--- .../pro/fragments/MyViewPagerFragment.kt | 2 +- .../pro/fragments/RecentsFragment.kt | 6 +++--- .../pro/fragments/StorageFragment.kt | 2 +- .../pro/interfaces/ItemOperationsListener.kt | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) 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 0fc51d75..5a4e0a7d 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 @@ -316,7 +316,7 @@ class MainActivity : SimpleActivity() { } if (refreshRecents) { - recents_fragment?.refreshItems() + recents_fragment?.refreshFragment() } } @@ -449,7 +449,7 @@ class MainActivity : SimpleActivity() { private fun showSortingDialog() { ChangeSortingDialog(this, getCurrentFragment()!!.currentPath) { - (getCurrentFragment() as? ItemsFragment)?.refreshItems() + (getCurrentFragment() as? ItemsFragment)?.refreshFragment() } } @@ -506,7 +506,7 @@ class MainActivity : SimpleActivity() { private fun changeViewType() { ChangeViewTypeDialog(this, getCurrentFragment()!!.currentPath, getCurrentFragment() is ItemsFragment) { getAllFragments().forEach { - it?.refreshItems() + it?.refreshFragment() } } } @@ -524,7 +524,7 @@ class MainActivity : SimpleActivity() { private fun toggleTemporarilyShowHidden(show: Boolean) { config.temporarilyShowHidden = show getAllFragments().forEach { - it?.refreshItems() + it?.refreshFragment() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt index 48caa7a5..e53ffd34 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt @@ -214,20 +214,20 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList RenameItemsDialog(activity, paths) { activity.runOnUiThread { - listener?.refreshItems() + listener?.refreshFragment() finishActMode() } } else -> RenameDialog(activity, paths, false) { activity.runOnUiThread { - listener?.refreshItems() + listener?.refreshFragment() finishActMode() } } @@ -258,7 +258,7 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList recents_swipe_refresh?.isRefreshing = false diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index 0d7e2b3c..acdb7c86 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -11,7 +11,7 @@ import com.simplemobiletools.filemanager.pro.activities.SimpleActivity class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) { override fun setupFragment(activity: SimpleActivity) {} - override fun refreshItems() {} + override fun refreshFragment() {} override fun setupColors(textColor: Int, primaryColor: Int) {} diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/interfaces/ItemOperationsListener.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/interfaces/ItemOperationsListener.kt index 8c2cc5d4..1542aa40 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/interfaces/ItemOperationsListener.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/interfaces/ItemOperationsListener.kt @@ -4,7 +4,7 @@ import com.simplemobiletools.commons.models.FileDirItem import java.util.* interface ItemOperationsListener { - fun refreshItems() + fun refreshFragment() fun deleteFiles(files: ArrayList) From 997a44f857321488011fce4ff915194705716cfe Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Oct 2021 16:06:12 +0200 Subject: [PATCH 09/70] adding some size fetching into the Storage fragment --- .../filemanager/pro/fragments/StorageFragment.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index acdb7c86..5e92089a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -2,14 +2,22 @@ package com.simplemobiletools.filemanager.pro.fragments import android.content.Context import android.net.Uri +import android.os.Environment import android.provider.MediaStore import android.util.AttributeSet import com.simplemobiletools.commons.extensions.getLongValue +import com.simplemobiletools.commons.extensions.getProperSize import com.simplemobiletools.commons.extensions.queryCursor import com.simplemobiletools.filemanager.pro.activities.SimpleActivity class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) { - override fun setupFragment(activity: SimpleActivity) {} + override fun setupFragment(activity: SimpleActivity) { + val imagesSize = getMediaTypeSize(MediaStore.Images.Media.EXTERNAL_CONTENT_URI) + val videosSize = getMediaTypeSize(MediaStore.Video.Media.EXTERNAL_CONTENT_URI) + val audioSize = getMediaTypeSize(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI) + val documents = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).getProperSize(true) + val downloads = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getProperSize(true) + } override fun refreshFragment() {} From a246ca514f2b59e59aaa26477051b42e9c607a16 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Oct 2021 17:55:11 +0200 Subject: [PATCH 10/70] adding some storage stat fetchers into the storage fragment --- .../pro/fragments/StorageFragment.kt | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index 5e92089a..0e15960b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -1,10 +1,14 @@ package com.simplemobiletools.filemanager.pro.fragments +import android.annotation.SuppressLint +import android.app.usage.StorageStatsManager import android.content.Context import android.net.Uri import android.os.Environment +import android.os.storage.StorageManager import android.provider.MediaStore import android.util.AttributeSet +import androidx.appcompat.app.AppCompatActivity import com.simplemobiletools.commons.extensions.getLongValue import com.simplemobiletools.commons.extensions.getProperSize import com.simplemobiletools.commons.extensions.queryCursor @@ -42,4 +46,29 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage return totalSize } + + @SuppressLint("NewApi") + private fun getStorageStats() { + if (activity == null) { + return + } + + val externalDirs = activity!!.getExternalFilesDirs(null) + val storageManager = activity!!.getSystemService(AppCompatActivity.STORAGE_SERVICE) as StorageManager + + externalDirs.forEach { file -> + val storageVolume = storageManager.getStorageVolume(file) ?: return + if (storageVolume.isPrimary) { + // internal storage + val storageStatsManager = activity!!.getSystemService(AppCompatActivity.STORAGE_STATS_SERVICE) as StorageStatsManager + val uuid = StorageManager.UUID_DEFAULT + val totalSpace = storageStatsManager.getTotalBytes(uuid) + val freeSpace = storageStatsManager.getFreeBytes(uuid) + } else { + // sd card + val totalSpace = file.totalSpace + val freeSpace = file.freeSpace + } + } + } } From 6dd545e4b56816269a3863c0324a2795d5119f5c Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Oct 2021 18:20:05 +0200 Subject: [PATCH 11/70] adding the new helper extension for formatting file size --- app/build.gradle | 2 +- .../filemanager/pro/extensions/Long.kt | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/filemanager/pro/extensions/Long.kt diff --git a/app/build.gradle b/app/build.gradle index 7049d7f7..e1bac656 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -58,7 +58,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:69346a62e0' + implementation 'com.github.SimpleMobileTools:Simple-Commons:cad50847e3' 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/extensions/Long.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/extensions/Long.kt new file mode 100644 index 00000000..61cee2fe --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/extensions/Long.kt @@ -0,0 +1,14 @@ +package com.simplemobiletools.filemanager.pro.extensions + +import java.text.DecimalFormat + +// use 1000 instead of 1024 at dividing +fun Long.formatSizeThousand(): String { + if (this <= 0) { + return "0 B" + } + + val units = arrayOf("B", "kB", "MB", "GB", "TB") + val digitGroups = (Math.log10(toDouble()) / Math.log10(1000.0)).toInt() + return "${DecimalFormat("#,##0.#").format(this / Math.pow(1000.0, digitGroups.toDouble()))} ${units[digitGroups]}" +} From ba5fb52e848d94d8a65153ecb983418bd37fd4a6 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Oct 2021 20:22:30 +0200 Subject: [PATCH 12/70] adding some strings related to the storage analysis tab --- app/src/main/res/values-ar/strings.xml | 11 ++++++++ app/src/main/res/values-az/strings.xml | 11 ++++++++ app/src/main/res/values-cs/strings.xml | 11 ++++++++ app/src/main/res/values-cy/strings.xml | 11 ++++++++ app/src/main/res/values-da/strings.xml | 11 ++++++++ app/src/main/res/values-de/strings.xml | 11 ++++++++ app/src/main/res/values-el/strings.xml | 11 ++++++++ app/src/main/res/values-es/strings.xml | 11 ++++++++ app/src/main/res/values-fi/strings.xml | 11 ++++++++ app/src/main/res/values-fr/strings.xml | 11 ++++++++ app/src/main/res/values-hi/strings.xml | 11 ++++++++ app/src/main/res/values-hr/strings.xml | 11 ++++++++ app/src/main/res/values-hu/strings.xml | 11 ++++++++ app/src/main/res/values-id/strings.xml | 11 ++++++++ app/src/main/res/values-in/strings.xml | 11 ++++++++ app/src/main/res/values-it/strings.xml | 11 ++++++++ app/src/main/res/values-ja/strings.xml | 11 ++++++++ app/src/main/res/values-ko-rKR/strings.xml | 11 ++++++++ app/src/main/res/values-lt/strings.xml | 11 ++++++++ app/src/main/res/values-nb/strings.xml | 11 ++++++++ app/src/main/res/values-nl/strings.xml | 11 ++++++++ app/src/main/res/values-pl/strings.xml | 29 +++++++++++++++------- app/src/main/res/values-pt-rBR/strings.xml | 11 ++++++++ app/src/main/res/values-pt/strings.xml | 11 ++++++++ app/src/main/res/values-ru/strings.xml | 11 ++++++++ app/src/main/res/values-sk/strings.xml | 11 ++++++++ app/src/main/res/values-sv/strings.xml | 11 ++++++++ app/src/main/res/values-tr/strings.xml | 11 ++++++++ app/src/main/res/values-uk/strings.xml | 11 ++++++++ app/src/main/res/values-zh-rCN/strings.xml | 11 ++++++++ app/src/main/res/values-zh-rTW/strings.xml | 11 ++++++++ app/src/main/res/values/strings.xml | 11 ++++++++ 32 files changed, 361 insertions(+), 9 deletions(-) diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index e6793476..91e23896 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -41,6 +41,17 @@ محرر الملفات + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + تفعيل الدخول الى مسار الروت Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index f7e5c44c..9f86a5b7 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -41,6 +41,17 @@ Fayl Redaktəsi + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Root icazəsini aktivləşdir Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index ab458b37..46a6e63c 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -41,6 +41,17 @@ Editor souborů + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Povolit přístup ke kořenovým souborům Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-cy/strings.xml b/app/src/main/res/values-cy/strings.xml index 6d0455a2..f0b39b46 100644 --- a/app/src/main/res/values-cy/strings.xml +++ b/app/src/main/res/values-cy/strings.xml @@ -41,6 +41,17 @@ Golygydd Ffeiliau + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Galluogi mynediad craidd Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index b7c632f5..e13693ca 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -41,6 +41,17 @@ Fileditor + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Aktiver root-adgang Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 50918b12..8693ffd7 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -41,6 +41,17 @@ Dateieditor + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Root-Zugriff erlauben Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 7c3fced8..d32bc5bd 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -41,6 +41,17 @@ Επεξεργαστής αρχείων + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Ενεργοποιήστε την πρόσβαση ριζικού καταλόγου Απαιτείται διπλό πάτημα του πλήκτρου \"Πίσω\" για κλείσιμο εφαρμογής diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 7d70f0de..9d608f9d 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -41,6 +41,17 @@ Editor de archivos + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Activar acceso root Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 95f1bcbc..3b3d9062 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -41,6 +41,17 @@ Tiedostoeditori + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Ota käyttöön root-ominaisuudet Ota käyttöön sovelluksesta poistuminen kahdella takaisin-painikkeen painalluksella diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 24bbe478..e4b84a3c 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -41,6 +41,17 @@ Éditeur de fichier + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Activer les droits root Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index b93d0e4d..fb6850c3 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -40,6 +40,17 @@ फ़ाइल संपादक + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + रूट एक्सेस Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index b2cf5f5d..199abc6c 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -41,6 +41,17 @@ Uređivač datoteka + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Omogući root pristup Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 0ec5ee90..dfc2f067 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -41,6 +41,17 @@ File Editor + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Enable root access Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index 27a29229..b2c653f8 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -41,6 +41,17 @@ Penyunting Berkas + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Aktifkan akses root Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml index 27a29229..b2c653f8 100644 --- a/app/src/main/res/values-in/strings.xml +++ b/app/src/main/res/values-in/strings.xml @@ -41,6 +41,17 @@ Penyunting Berkas + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Aktifkan akses root Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 9e0bb93f..90040c1a 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -41,6 +41,17 @@ Editor dei file + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Abilita accesso root Richiedi di premere Indietro due volte per uscire dall\'app diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index bb5edda2..3be4ce58 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -41,6 +41,17 @@ ファイル エディター + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + ルートアクセスを有効にする Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index 73cdc747..d0dff7f8 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -41,6 +41,17 @@ 텍스트 편집기 + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + 루트 접근 활성화 Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 8bda0b84..9dc4f2ae 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -41,6 +41,17 @@ Bylų redaktorius + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Įgalinti šakninę prieigą Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index ae9eaa45..2b043f29 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -41,6 +41,17 @@ Filredigerer + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Aktiver root-tilgang Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 586a9957..bdb508b6 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -41,6 +41,17 @@ Bewerken + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Root-toegang inschakelen Twee keer op de terugknop drukken om af te sluiten diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 79e821e9..d0d554e0 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -8,8 +8,8 @@ Folder główny zaktualizowany Kopiuj ścieżkę do schowka Ścieżka skopiowana -    Proszę wybrać plik audio -    Przeszukaj folder + Proszę wybrać plik audio + Przeszukaj folder Ta operacja działa tylko na zrootowanych urządzeniach Recents Show recents @@ -23,13 +23,13 @@ Inny plik -    Skompresuj + Skompresuj Rozpakuj -    Skompresuj jako + Skompresuj jako Kompresowanie… Rozpakowywanie… -    Kompresja udana -    Rozpakowywanie udane + Kompresja udana + Rozpakowywanie udane Kompresja nie powiodła się Rozpakowywanie nie powiodło się @@ -39,7 +39,18 @@ Możesz dodać często używane foldery do ulubionych, aby mieć do nich łatwy dostęp z dowolnego miejsca. -    Edytor Plików + Edytor Plików + + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s Zezwól na dostęp do uprawnień roota @@ -49,7 +60,7 @@ Prosty Menedżer Plików Pro - Zarządzaj plikami -    Easy app for managing your files without ads, respecting your privacy & security + Easy app for managing your files without ads, respecting your privacy & security A lightweight quick file manager for everyday use. It offers a userful search functionality, you can also customize the home folder and select favorite folders for quick access. @@ -71,7 +82,7 @@ It comes with material design and dark theme by default, provides great user experience for easy usage. The lack of internet access gives you more privacy, security and stability than other apps. -       Aplikacja nie zawiera żadnych żadnych reklam, nie potrzebuje masy uprawnień, jest w pełni otwartoźródłowa, posiada ciemny motyw dla osób z wrażliwymi oczami. + Aplikacja nie zawiera żadnych żadnych reklam, nie potrzebuje masy uprawnień, jest w pełni otwartoźródłowa, posiada ciemny motyw dla osób z wrażliwymi oczami. Check out the full suite of Simple Tools here: https://www.simplemobiletools.com diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 2a51a176..55154130 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -41,6 +41,17 @@ Editor de Arquivos + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Ativar o acesso root Requira o duplo pressionamento do botão "voltar" para sair do app diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 78d0d477..e728ea4e 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -41,6 +41,17 @@ Editor de ficheiros + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Ativar acesso root Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index aa7b8ae8..2878992e 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -41,6 +41,17 @@ Редактор файлов + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Включить root-доступ Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 1479f3d3..2950f643 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -41,6 +41,17 @@ Editor súborov + + Analýza úložiska + Obrázky + Videá + Audio + Dokumenty + Stiahnuté + Iné + využitých + Úložisko celkom: %s + Povoliť prístup ku koreňovým súborom Vyžadovať stlačenie Späť na opustenie apky dvakrát diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 3f70a673..e8f62b14 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -41,6 +41,17 @@ Filredigerare + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Aktivera rotåtkomst Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 90b168cd..1fc35d59 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -41,6 +41,17 @@ Dosya Düzenleyici + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Root erişimini etkinleştir Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index f7579027..092e9ec7 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -41,6 +41,17 @@ Редактор файлів + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Активувати root-доступ Натисніть Назад двічі, щоб вийти з додатка diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index af88fd20..90617112 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -41,6 +41,17 @@ 文件编辑器 + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + 启用 root 访问 Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 6f59b334..b63907b7 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -41,6 +41,17 @@ 檔案編輯器 + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + 啟用root權限 Require pressing Back twice to leave the app diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index af92bdb8..2ca5be6e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -41,6 +41,17 @@ File Editor + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Others + free + Total storage: %s + Enable root access Require pressing Back twice to leave the app From fdbd093ff61b689f6935d99263e12b1d0624d9e4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Oct 2021 20:41:20 +0200 Subject: [PATCH 13/70] adding some initial storage analysis tab related things --- app/build.gradle | 2 +- .../filemanager/pro/activities/MainActivity.kt | 6 ++++++ .../filemanager/pro/dialogs/ManageVisibleTabsDialog.kt | 2 ++ .../simplemobiletools/filemanager/pro/helpers/Config.kt | 4 ++++ .../filemanager/pro/helpers/Constants.kt | 1 + app/src/main/res/layout/dialog_manage_visible_tabs.xml | 8 ++++++++ 6 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index e1bac656..c06f38a8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -58,7 +58,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:cad50847e3' + implementation 'com.github.SimpleMobileTools:Simple-Commons:5079455be9' 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 5a4e0a7d..e191c4c3 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 @@ -60,6 +60,12 @@ class MainActivity : SimpleActivity() { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) appLaunched(BuildConfig.APPLICATION_ID) + + if (!config.wasStorageAnalysisTabAdded) { + config.wasStorageAnalysisTabAdded = true + config.showTabs += TAB_STORAGE_ANALYSIS + } + setupTabColors(config.lastUsedViewPagerPage) storeStateVariables() mIsPasswordProtectionPending = config.isAppPasswordProtectionOn diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/ManageVisibleTabsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/ManageVisibleTabsDialog.kt index 0af6b3ab..37f8abc2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/ManageVisibleTabsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/ManageVisibleTabsDialog.kt @@ -5,6 +5,7 @@ import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.helpers.TAB_FILES import com.simplemobiletools.commons.helpers.TAB_RECENT_FILES +import com.simplemobiletools.commons.helpers.TAB_STORAGE_ANALYSIS import com.simplemobiletools.commons.views.MyAppCompatCheckbox import com.simplemobiletools.filemanager.pro.R import com.simplemobiletools.filemanager.pro.extensions.config @@ -18,6 +19,7 @@ class ManageVisibleTabsDialog(val activity: BaseSimpleActivity) { tabs.apply { put(TAB_FILES, R.id.manage_visible_tabs_files) put(TAB_RECENT_FILES, R.id.manage_visible_tabs_recent_files) + put(TAB_STORAGE_ANALYSIS, R.id.manage_visible_tabs_storage_analysis) } val showTabs = activity.config.showTabs diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Config.kt index 7c73b2bc..57f67961 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Config.kt @@ -121,4 +121,8 @@ class Config(context: Context) : BaseConfig(context) { var showTabs: Int get() = prefs.getInt(SHOW_TABS, ALL_TABS_MASK) set(showTabs) = prefs.edit().putInt(SHOW_TABS, showTabs).apply() + + var wasStorageAnalysisTabAdded: Boolean + get() = prefs.getBoolean(WAS_STORAGE_ANALYSIS_TAB_ADDED, false) + set(wasStorageAnalysisTabAdded) = prefs.edit().putBoolean(WAS_STORAGE_ANALYSIS_TAB_ADDED, wasStorageAnalysisTabAdded).apply() } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt index 9a0c221f..784d2992 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt @@ -20,6 +20,7 @@ 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" const val SHOW_TABS = "show_tabs" +const val WAS_STORAGE_ANALYSIS_TAB_ADDED = "was_storage_analysis_tab_added" // open as const val OPEN_AS_DEFAULT = 0 diff --git a/app/src/main/res/layout/dialog_manage_visible_tabs.xml b/app/src/main/res/layout/dialog_manage_visible_tabs.xml index f6b28f7d..799ae011 100644 --- a/app/src/main/res/layout/dialog_manage_visible_tabs.xml +++ b/app/src/main/res/layout/dialog_manage_visible_tabs.xml @@ -29,5 +29,13 @@ android:paddingBottom="@dimen/activity_margin" android:text="@string/recent_files_tab" /> + + From f750539695a303b99335f2748f9a37bb354cfc64 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Oct 2021 21:08:31 +0200 Subject: [PATCH 14/70] adding the storage tab at the viewpager --- .../filemanager/pro/activities/MainActivity.kt | 14 +++++++++++--- .../filemanager/pro/adapters/ViewPagerAdapter.kt | 5 +++++ .../filemanager/pro/helpers/Constants.kt | 5 +++-- app/src/main/res/drawable/ic_storage_vector.xml | 9 +++++++++ app/src/main/res/layout/storage_fragment.xml | 7 +++++++ 5 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 app/src/main/res/drawable/ic_storage_vector.xml create mode 100644 app/src/main/res/layout/storage_fragment.xml 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 e191c4c3..c8fa1001 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 @@ -30,6 +30,7 @@ import com.simplemobiletools.filemanager.pro.extensions.config import com.simplemobiletools.filemanager.pro.extensions.tryOpenPathIntent import com.simplemobiletools.filemanager.pro.fragments.ItemsFragment import com.simplemobiletools.filemanager.pro.fragments.MyViewPagerFragment +import com.simplemobiletools.filemanager.pro.fragments.StorageFragment import com.simplemobiletools.filemanager.pro.helpers.MAX_COLUMN_COUNT import com.simplemobiletools.filemanager.pro.helpers.RootHelpers import com.simplemobiletools.filemanager.pro.helpers.tabsList @@ -39,6 +40,7 @@ import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.items_fragment.* import kotlinx.android.synthetic.main.items_fragment.view.* import kotlinx.android.synthetic.main.recents_fragment.* +import kotlinx.android.synthetic.main.storage_fragment.* import java.io.File import java.util.* @@ -151,6 +153,7 @@ class MainActivity : SimpleActivity() { menu!!.apply { findItem(R.id.search).isVisible = currentFragment is ItemsFragment findItem(R.id.sort).isVisible = currentFragment is ItemsFragment + findItem(R.id.change_view_type).isVisible = currentFragment !is StorageFragment findItem(R.id.add_favorite).isVisible = currentFragment is ItemsFragment && !favorites.contains(currentFragment.currentPath) findItem(R.id.remove_favorite).isVisible = currentFragment is ItemsFragment && favorites.contains(currentFragment.currentPath) @@ -160,7 +163,7 @@ class MainActivity : SimpleActivity() { findItem(R.id.go_home).isVisible = currentFragment is ItemsFragment && currentFragment.currentPath != config.homeFolder findItem(R.id.set_as_home).isVisible = currentFragment is ItemsFragment && currentFragment.currentPath != config.homeFolder - findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden + findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden && currentFragment !is StorageFragment findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden findItem(R.id.increase_column_count).isVisible = currentViewType == VIEW_TYPE_GRID && config.fileColumnCnt < MAX_COLUMN_COUNT @@ -412,7 +415,8 @@ class MainActivity : SimpleActivity() { private fun getTabIcon(position: Int): Drawable { val drawableId = when (position) { 0 -> R.drawable.ic_folder_vector - else -> R.drawable.ic_clock_vector + 1 -> R.drawable.ic_clock_vector + else -> R.drawable.ic_storage_vector } return resources.getColoredDrawableWithColor(drawableId, config.textColor) @@ -638,7 +642,7 @@ class MainActivity : SimpleActivity() { private fun getInactiveTabIndexes(activeIndex: Int) = (0 until tabsList.size).filter { it != activeIndex } - private fun getAllFragments(): ArrayList = arrayListOf(items_fragment, recents_fragment) + private fun getAllFragments(): ArrayList = arrayListOf(items_fragment, recents_fragment, storage_fragment) private fun getCurrentFragment(): MyViewPagerFragment? { val showTabs = config.showTabs @@ -651,6 +655,10 @@ class MainActivity : SimpleActivity() { fragments.add(recents_fragment) } + if (showTabs and TAB_STORAGE_ANALYSIS != 0) { + fragments.add(storage_fragment) + } + return fragments.getOrNull(main_view_pager.currentItem) } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ViewPagerAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ViewPagerAdapter.kt index e0158b82..36ced7d7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ViewPagerAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ViewPagerAdapter.kt @@ -5,6 +5,7 @@ import android.view.ViewGroup import androidx.viewpager.widget.PagerAdapter import com.simplemobiletools.commons.helpers.TAB_FILES import com.simplemobiletools.commons.helpers.TAB_RECENT_FILES +import com.simplemobiletools.commons.helpers.TAB_STORAGE_ANALYSIS import com.simplemobiletools.filemanager.pro.R import com.simplemobiletools.filemanager.pro.activities.SimpleActivity import com.simplemobiletools.filemanager.pro.extensions.config @@ -44,6 +45,10 @@ class ViewPagerAdapter(val activity: SimpleActivity) : PagerAdapter() { fragments.add(R.layout.recents_fragment) } + if (showTabs and TAB_STORAGE_ANALYSIS != 0) { + fragments.add(R.layout.storage_fragment) + } + return fragments[position] } } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt index 784d2992..72f7acb7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt @@ -2,6 +2,7 @@ package com.simplemobiletools.filemanager.pro.helpers import com.simplemobiletools.commons.helpers.TAB_FILES import com.simplemobiletools.commons.helpers.TAB_RECENT_FILES +import com.simplemobiletools.commons.helpers.TAB_STORAGE_ANALYSIS const val PATH = "path" const val MAX_COLUMN_COUNT = 20 @@ -30,5 +31,5 @@ const val OPEN_AS_AUDIO = 3 const val OPEN_AS_VIDEO = 4 const val OPEN_AS_OTHER = 5 -const val ALL_TABS_MASK = TAB_FILES or TAB_RECENT_FILES -val tabsList = arrayListOf(TAB_FILES, TAB_RECENT_FILES) +const val ALL_TABS_MASK = TAB_FILES or TAB_RECENT_FILES or TAB_STORAGE_ANALYSIS +val tabsList = arrayListOf(TAB_FILES, TAB_RECENT_FILES, TAB_STORAGE_ANALYSIS) diff --git a/app/src/main/res/drawable/ic_storage_vector.xml b/app/src/main/res/drawable/ic_storage_vector.xml new file mode 100644 index 00000000..80565aae --- /dev/null +++ b/app/src/main/res/drawable/ic_storage_vector.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/storage_fragment.xml b/app/src/main/res/layout/storage_fragment.xml new file mode 100644 index 00000000..f4393f42 --- /dev/null +++ b/app/src/main/res/layout/storage_fragment.xml @@ -0,0 +1,7 @@ + + + + From d31060739e500458a214808d7f49a41f9d5e7533 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Oct 2021 21:59:57 +0200 Subject: [PATCH 15/70] filling in some initial Storage fragment views --- .../pro/fragments/StorageFragment.kt | 30 ++++++++++++------ app/src/main/res/layout/storage_fragment.xml | 31 ++++++++++++++++++- app/src/main/res/values/dimens.xml | 1 + 3 files changed, 52 insertions(+), 10 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index 0e15960b..a6d76ad2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -12,7 +12,12 @@ import androidx.appcompat.app.AppCompatActivity import com.simplemobiletools.commons.extensions.getLongValue import com.simplemobiletools.commons.extensions.getProperSize import com.simplemobiletools.commons.extensions.queryCursor +import com.simplemobiletools.commons.extensions.updateTextColors +import com.simplemobiletools.commons.helpers.ensureBackgroundThread +import com.simplemobiletools.filemanager.pro.R import com.simplemobiletools.filemanager.pro.activities.SimpleActivity +import com.simplemobiletools.filemanager.pro.extensions.formatSizeThousand +import kotlinx.android.synthetic.main.storage_fragment.view.* class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) { override fun setupFragment(activity: SimpleActivity) { @@ -21,11 +26,17 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage val audioSize = getMediaTypeSize(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI) val documents = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).getProperSize(true) val downloads = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getProperSize(true) + + ensureBackgroundThread { + getStorageStats(activity) + } } override fun refreshFragment() {} - override fun setupColors(textColor: Int, primaryColor: Int) {} + override fun setupColors(textColor: Int, primaryColor: Int) { + context.updateTextColors(storage_fragment) + } private fun getMediaTypeSize(uri: Uri): Long { val projection = arrayOf( @@ -48,22 +59,23 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage } @SuppressLint("NewApi") - private fun getStorageStats() { - if (activity == null) { - return - } - - val externalDirs = activity!!.getExternalFilesDirs(null) - val storageManager = activity!!.getSystemService(AppCompatActivity.STORAGE_SERVICE) as StorageManager + private fun getStorageStats(activity: SimpleActivity) { + val externalDirs = activity.getExternalFilesDirs(null) + val storageManager = activity.getSystemService(AppCompatActivity.STORAGE_SERVICE) as StorageManager externalDirs.forEach { file -> val storageVolume = storageManager.getStorageVolume(file) ?: return if (storageVolume.isPrimary) { // internal storage - val storageStatsManager = activity!!.getSystemService(AppCompatActivity.STORAGE_STATS_SERVICE) as StorageStatsManager + val storageStatsManager = activity.getSystemService(AppCompatActivity.STORAGE_STATS_SERVICE) as StorageStatsManager val uuid = StorageManager.UUID_DEFAULT val totalSpace = storageStatsManager.getTotalBytes(uuid) val freeSpace = storageStatsManager.getFreeBytes(uuid) + + activity.runOnUiThread { + free_space_value.text = freeSpace.formatSizeThousand() + total_space.text = String.format(context.getString(R.string.total_storage), totalSpace.formatSizeThousand()) + } } else { // sd card val totalSpace = file.totalSpace diff --git a/app/src/main/res/layout/storage_fragment.xml b/app/src/main/res/layout/storage_fragment.xml index f4393f42..1ffd50f2 100644 --- a/app/src/main/res/layout/storage_fragment.xml +++ b/app/src/main/res/layout/storage_fragment.xml @@ -1,7 +1,36 @@ + android:layout_height="match_parent" + android:padding="@dimen/activity_margin"> + + + + + + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index d2443b57..bfda7798 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -1,3 +1,4 @@ 60dp + 46sp From 87d3cf6501b1ac4e6e942da68cb17213c0753e68 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Oct 2021 22:08:23 +0200 Subject: [PATCH 16/70] avoid recreating the content of tabs at swiping --- .../simplemobiletools/filemanager/pro/activities/MainActivity.kt | 1 + 1 file changed, 1 insertion(+) 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 c8fa1001..934438ce 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 @@ -331,6 +331,7 @@ class MainActivity : SimpleActivity() { private fun initFragments() { main_view_pager.adapter = ViewPagerAdapter(this) + main_view_pager.offscreenPageLimit = 2 main_view_pager.currentItem = config.lastUsedViewPagerPage main_view_pager.onPageChangeListener { main_tabs_holder.getTabAt(it)?.select() From 17343f5448fb99e52d700067e30fbab02f41dd81 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Oct 2021 22:14:49 +0200 Subject: [PATCH 17/70] lets show the free storage label only if we have the values --- .../filemanager/pro/fragments/StorageFragment.kt | 6 ++---- app/src/main/res/layout/storage_fragment.xml | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index a6d76ad2..92ffa1c1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -9,10 +9,7 @@ import android.os.storage.StorageManager import android.provider.MediaStore import android.util.AttributeSet import androidx.appcompat.app.AppCompatActivity -import com.simplemobiletools.commons.extensions.getLongValue -import com.simplemobiletools.commons.extensions.getProperSize -import com.simplemobiletools.commons.extensions.queryCursor -import com.simplemobiletools.commons.extensions.updateTextColors +import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.filemanager.pro.R import com.simplemobiletools.filemanager.pro.activities.SimpleActivity @@ -75,6 +72,7 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage activity.runOnUiThread { free_space_value.text = freeSpace.formatSizeThousand() total_space.text = String.format(context.getString(R.string.total_storage), totalSpace.formatSizeThousand()) + free_space_label.beVisible() } } else { // sd card diff --git a/app/src/main/res/layout/storage_fragment.xml b/app/src/main/res/layout/storage_fragment.xml index 1ffd50f2..60e814a8 100644 --- a/app/src/main/res/layout/storage_fragment.xml +++ b/app/src/main/res/layout/storage_fragment.xml @@ -23,7 +23,8 @@ android:layout_marginStart="@dimen/medium_margin" android:layout_toEndOf="@+id/free_space_value" android:text="@string/storage_free" - android:textSize="@dimen/big_text_size" /> + android:textSize="@dimen/big_text_size" + android:visibility="gone" /> Date: Mon, 11 Oct 2021 22:21:51 +0200 Subject: [PATCH 18/70] adding a storage usage progress indicator --- .../filemanager/pro/fragments/StorageFragment.kt | 4 ++++ app/src/main/res/layout/storage_fragment.xml | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index 92ffa1c1..b949772d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -70,6 +70,10 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage val freeSpace = storageStatsManager.getFreeBytes(uuid) activity.runOnUiThread { + storage_usage_progressbar.max = (totalSpace / 1000).toInt() + storage_usage_progressbar.progress = ((totalSpace - freeSpace) / 1000).toInt() + storage_usage_progressbar.beVisible() + free_space_value.text = freeSpace.formatSizeThousand() total_space.text = String.format(context.getString(R.string.total_storage), totalSpace.formatSizeThousand()) free_space_label.beVisible() diff --git a/app/src/main/res/layout/storage_fragment.xml b/app/src/main/res/layout/storage_fragment.xml index 60e814a8..91474701 100644 --- a/app/src/main/res/layout/storage_fragment.xml +++ b/app/src/main/res/layout/storage_fragment.xml @@ -26,11 +26,21 @@ android:textSize="@dimen/big_text_size" android:visibility="gone" /> + + From ff4ccbf439206425dc7170d9619c18d473409fee Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Oct 2021 22:28:33 +0200 Subject: [PATCH 19/70] make sure the storage usage progressbar has the proper color --- .../filemanager/pro/fragments/StorageFragment.kt | 9 ++++++--- app/src/main/res/layout/storage_fragment.xml | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index b949772d..6d95d2d4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -33,6 +33,9 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage override fun setupColors(textColor: Int, primaryColor: Int) { context.updateTextColors(storage_fragment) + + main_storage_usage_progressbar.setIndicatorColor(primaryColor) + main_storage_usage_progressbar.trackColor = primaryColor.adjustAlpha(0.3f) } private fun getMediaTypeSize(uri: Uri): Long { @@ -70,9 +73,9 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage val freeSpace = storageStatsManager.getFreeBytes(uuid) activity.runOnUiThread { - storage_usage_progressbar.max = (totalSpace / 1000).toInt() - storage_usage_progressbar.progress = ((totalSpace - freeSpace) / 1000).toInt() - storage_usage_progressbar.beVisible() + main_storage_usage_progressbar.max = (totalSpace / 1000000).toInt() + main_storage_usage_progressbar.progress = ((totalSpace - freeSpace) / 1000000).toInt() + main_storage_usage_progressbar.beVisible() free_space_value.text = freeSpace.formatSizeThousand() total_space.text = String.format(context.getString(R.string.total_storage), totalSpace.formatSizeThousand()) diff --git a/app/src/main/res/layout/storage_fragment.xml b/app/src/main/res/layout/storage_fragment.xml index 91474701..58ccdc15 100644 --- a/app/src/main/res/layout/storage_fragment.xml +++ b/app/src/main/res/layout/storage_fragment.xml @@ -27,7 +27,7 @@ android:visibility="gone" /> From bf25cdfb2b7179405b08770f3310ee613e821cc8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Oct 2021 22:51:36 +0200 Subject: [PATCH 20/70] add an Images progressbar at the storage analyzer --- .../pro/fragments/StorageFragment.kt | 30 ++++++++++----- app/src/main/res/layout/storage_fragment.xml | 37 ++++++++++++++++++- 2 files changed, 56 insertions(+), 11 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index 6d95d2d4..a04f7570 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -18,14 +18,19 @@ import kotlinx.android.synthetic.main.storage_fragment.view.* class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) { override fun setupFragment(activity: SimpleActivity) { - val imagesSize = getMediaTypeSize(MediaStore.Images.Media.EXTERNAL_CONTENT_URI) - val videosSize = getMediaTypeSize(MediaStore.Video.Media.EXTERNAL_CONTENT_URI) - val audioSize = getMediaTypeSize(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI) - val documents = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).getProperSize(true) - val downloads = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getProperSize(true) - ensureBackgroundThread { getStorageStats(activity) + + val imagesSize = getMediaTypeSize(MediaStore.Images.Media.EXTERNAL_CONTENT_URI) + val videosSize = getMediaTypeSize(MediaStore.Video.Media.EXTERNAL_CONTENT_URI) + val audioSize = getMediaTypeSize(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI) + val documents = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).getProperSize(true) + val downloads = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getProperSize(true) + + activity.runOnUiThread { + images_size.text = imagesSize.formatSize() + images_progressbar.progress = (imagesSize / 1000000).toInt() + } } } @@ -36,6 +41,10 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage main_storage_usage_progressbar.setIndicatorColor(primaryColor) main_storage_usage_progressbar.trackColor = primaryColor.adjustAlpha(0.3f) + + val redColor = context.resources.getColor(R.color.md_red_700) + images_progressbar.setIndicatorColor(redColor) + images_progressbar.trackColor = redColor.adjustAlpha(0.3f) } private fun getMediaTypeSize(uri: Uri): Long { @@ -73,10 +82,13 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage val freeSpace = storageStatsManager.getFreeBytes(uuid) activity.runOnUiThread { - main_storage_usage_progressbar.max = (totalSpace / 1000000).toInt() - main_storage_usage_progressbar.progress = ((totalSpace - freeSpace) / 1000000).toInt() - main_storage_usage_progressbar.beVisible() + arrayOf(main_storage_usage_progressbar, images_progressbar).forEach { + it.max = (totalSpace / 1000000).toInt() + } + main_storage_usage_progressbar.progress = ((totalSpace - freeSpace) / 1000000).toInt() + + main_storage_usage_progressbar.beVisible() free_space_value.text = freeSpace.formatSizeThousand() total_space.text = String.format(context.getString(R.string.total_storage), totalSpace.formatSizeThousand()) free_space_label.beVisible() diff --git a/app/src/main/res/layout/storage_fragment.xml b/app/src/main/res/layout/storage_fragment.xml index 58ccdc15..c0304c61 100644 --- a/app/src/main/res/layout/storage_fragment.xml +++ b/app/src/main/res/layout/storage_fragment.xml @@ -1,5 +1,6 @@ + android:visibility="invisible" /> + android:visibility="invisible" + app:trackThickness="4dp" /> + + + + + + From 49103cc405f08eedcf060da0824f6f24f7b76b8b Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Oct 2021 22:57:09 +0200 Subject: [PATCH 21/70] show the videos size too --- .../pro/fragments/StorageFragment.kt | 9 ++++- app/src/main/res/layout/storage_fragment.xml | 34 +++++++++++++++++-- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index a04f7570..f3e37ddb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -30,6 +30,9 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage activity.runOnUiThread { images_size.text = imagesSize.formatSize() images_progressbar.progress = (imagesSize / 1000000).toInt() + + videos_size.text = videosSize.formatSize() + videos_progressbar.progress = (videosSize / 1000000).toInt() } } } @@ -45,6 +48,10 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage val redColor = context.resources.getColor(R.color.md_red_700) images_progressbar.setIndicatorColor(redColor) images_progressbar.trackColor = redColor.adjustAlpha(0.3f) + + val greenColor = context.resources.getColor(R.color.md_green_700) + videos_progressbar.setIndicatorColor(greenColor) + videos_progressbar.trackColor = greenColor.adjustAlpha(0.3f) } private fun getMediaTypeSize(uri: Uri): Long { @@ -82,7 +89,7 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage val freeSpace = storageStatsManager.getFreeBytes(uuid) activity.runOnUiThread { - arrayOf(main_storage_usage_progressbar, images_progressbar).forEach { + arrayOf(main_storage_usage_progressbar, images_progressbar, videos_progressbar).forEach { it.max = (totalSpace / 1000000).toInt() } diff --git a/app/src/main/res/layout/storage_fragment.xml b/app/src/main/res/layout/storage_fragment.xml index c0304c61..e25d2840 100644 --- a/app/src/main/res/layout/storage_fragment.xml +++ b/app/src/main/res/layout/storage_fragment.xml @@ -52,7 +52,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/total_space" - android:layout_marginTop="@dimen/big_text_size" + android:layout_marginTop="@dimen/big_margin" android:text="@string/images" android:textSize="@dimen/bigger_text_size" /> @@ -62,7 +62,7 @@ android:layout_height="wrap_content" android:layout_below="@+id/total_space" android:layout_alignParentEnd="true" - android:layout_marginTop="@dimen/big_text_size" + android:layout_marginTop="@dimen/big_margin" android:alpha="0.7" android:textSize="@dimen/normal_text_size" tools:text="20 GB" /> @@ -77,4 +77,34 @@ android:max="100" app:trackThickness="2dp" /> + + + + + + From 7409a569dec2d718ef8805741321211d6c1fdfec Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Oct 2021 23:04:25 +0200 Subject: [PATCH 22/70] adding audio storage --- .../pro/fragments/StorageFragment.kt | 13 ++++++-- app/src/main/res/layout/storage_fragment.xml | 30 +++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index f3e37ddb..184a7ff9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -24,8 +24,8 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage val imagesSize = getMediaTypeSize(MediaStore.Images.Media.EXTERNAL_CONTENT_URI) val videosSize = getMediaTypeSize(MediaStore.Video.Media.EXTERNAL_CONTENT_URI) val audioSize = getMediaTypeSize(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI) - val documents = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).getProperSize(true) - val downloads = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getProperSize(true) + val documentsSize = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).getProperSize(true) + val downloadsSize = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getProperSize(true) activity.runOnUiThread { images_size.text = imagesSize.formatSize() @@ -33,6 +33,9 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage videos_size.text = videosSize.formatSize() videos_progressbar.progress = (videosSize / 1000000).toInt() + + audio_size.text = audioSize.formatSize() + audio_progressbar.progress = (audioSize / 1000000).toInt() } } } @@ -52,6 +55,10 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage val greenColor = context.resources.getColor(R.color.md_green_700) videos_progressbar.setIndicatorColor(greenColor) videos_progressbar.trackColor = greenColor.adjustAlpha(0.3f) + + val blueColor = context.resources.getColor(R.color.md_blue_700) + audio_progressbar.setIndicatorColor(blueColor) + audio_progressbar.trackColor = blueColor.adjustAlpha(0.3f) } private fun getMediaTypeSize(uri: Uri): Long { @@ -89,7 +96,7 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage val freeSpace = storageStatsManager.getFreeBytes(uuid) activity.runOnUiThread { - arrayOf(main_storage_usage_progressbar, images_progressbar, videos_progressbar).forEach { + arrayOf(main_storage_usage_progressbar, images_progressbar, videos_progressbar, audio_progressbar).forEach { it.max = (totalSpace / 1000000).toInt() } diff --git a/app/src/main/res/layout/storage_fragment.xml b/app/src/main/res/layout/storage_fragment.xml index e25d2840..0ff44b46 100644 --- a/app/src/main/res/layout/storage_fragment.xml +++ b/app/src/main/res/layout/storage_fragment.xml @@ -107,4 +107,34 @@ android:max="100" app:trackThickness="2dp" /> + + + + + + From 5d5a4c3a7dc2be41b703dc193229febd18c66686 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Oct 2021 23:28:01 +0200 Subject: [PATCH 23/70] use a better way of calculating file sizes by mime type --- .../pro/fragments/StorageFragment.kt | 37 ++++++++++++++----- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index 184a7ff9..d76b1b74 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -3,7 +3,6 @@ package com.simplemobiletools.filemanager.pro.fragments import android.annotation.SuppressLint import android.app.usage.StorageStatsManager import android.content.Context -import android.net.Uri import android.os.Environment import android.os.storage.StorageManager import android.provider.MediaStore @@ -17,13 +16,18 @@ import com.simplemobiletools.filemanager.pro.extensions.formatSizeThousand import kotlinx.android.synthetic.main.storage_fragment.view.* class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) { + private val IMAGES = "images" + private val VIDEOS = "videos" + private val AUDIO = "audio" + override fun setupFragment(activity: SimpleActivity) { ensureBackgroundThread { getStorageStats(activity) - val imagesSize = getMediaTypeSize(MediaStore.Images.Media.EXTERNAL_CONTENT_URI) - val videosSize = getMediaTypeSize(MediaStore.Video.Media.EXTERNAL_CONTENT_URI) - val audioSize = getMediaTypeSize(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI) + val filesSize = getSizesByMimeType() + val imagesSize = filesSize[IMAGES]!! + val videosSize = filesSize[VIDEOS]!! + val audioSize = filesSize[AUDIO]!! val documentsSize = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).getProperSize(true) val downloadsSize = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getProperSize(true) @@ -61,24 +65,39 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage audio_progressbar.trackColor = blueColor.adjustAlpha(0.3f) } - private fun getMediaTypeSize(uri: Uri): Long { + private fun getSizesByMimeType(): HashMap { + val uri = MediaStore.Files.getContentUri("external") val projection = arrayOf( - MediaStore.Files.FileColumns.SIZE + MediaStore.Files.FileColumns.SIZE, + MediaStore.Files.FileColumns.MIME_TYPE ) - var totalSize = 0L + var imagesSize = 0L + var videosSize = 0L + var audioSize = 0L try { context.queryCursor(uri, projection) { cursor -> try { + val mimeType = cursor.getStringValue(MediaStore.Files.FileColumns.MIME_TYPE) ?: return@queryCursor val size = cursor.getLongValue(MediaStore.Files.FileColumns.SIZE) - totalSize += size + when (mimeType.substringBefore("/")) { + "image" -> imagesSize += size + "video" -> videosSize += size + "audio" -> audioSize += size + } } catch (e: Exception) { } } } catch (e: Exception) { } - return totalSize + val mimeTypeSizes = HashMap().apply { + put(IMAGES, imagesSize) + put(VIDEOS, videosSize) + put(AUDIO, audioSize) + } + + return mimeTypeSizes } @SuppressLint("NewApi") From 13c0afef3c155b5cc9be3a8e45a1e54a70ef64c2 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Oct 2021 23:38:42 +0200 Subject: [PATCH 24/70] adding Documents at the storage analyzer --- .../pro/fragments/StorageFragment.kt | 27 +++++++++++++++-- app/src/main/res/layout/storage_fragment.xml | 30 +++++++++++++++++++ 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index d76b1b74..8de05919 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -14,11 +14,17 @@ import com.simplemobiletools.filemanager.pro.R import com.simplemobiletools.filemanager.pro.activities.SimpleActivity import com.simplemobiletools.filemanager.pro.extensions.formatSizeThousand import kotlinx.android.synthetic.main.storage_fragment.view.* +import java.util.* +import kotlin.collections.HashMap class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) { private val IMAGES = "images" private val VIDEOS = "videos" private val AUDIO = "audio" + private val DOCUMENTS = "documents" + + // what else should we count as a document except "text/*" mimetype + private val extraDocumentMimeTypes = arrayListOf("application/pdf", "application/msword") override fun setupFragment(activity: SimpleActivity) { ensureBackgroundThread { @@ -28,7 +34,7 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage val imagesSize = filesSize[IMAGES]!! val videosSize = filesSize[VIDEOS]!! val audioSize = filesSize[AUDIO]!! - val documentsSize = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).getProperSize(true) + val documentsSize = filesSize[DOCUMENTS]!! val downloadsSize = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getProperSize(true) activity.runOnUiThread { @@ -40,6 +46,9 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage audio_size.text = audioSize.formatSize() audio_progressbar.progress = (audioSize / 1000000).toInt() + + documents_size.text = documentsSize.formatSize() + documents_progressbar.progress = (documentsSize / 1000000).toInt() } } } @@ -63,6 +72,10 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage val blueColor = context.resources.getColor(R.color.md_blue_700) audio_progressbar.setIndicatorColor(blueColor) audio_progressbar.trackColor = blueColor.adjustAlpha(0.3f) + + val yellowColor = context.resources.getColor(R.color.md_yellow_700) + documents_progressbar.setIndicatorColor(yellowColor) + documents_progressbar.trackColor = yellowColor.adjustAlpha(0.3f) } private fun getSizesByMimeType(): HashMap { @@ -75,15 +88,22 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage var imagesSize = 0L var videosSize = 0L var audioSize = 0L + var documentsSize = 0L try { context.queryCursor(uri, projection) { cursor -> try { val mimeType = cursor.getStringValue(MediaStore.Files.FileColumns.MIME_TYPE) ?: return@queryCursor val size = cursor.getLongValue(MediaStore.Files.FileColumns.SIZE) - when (mimeType.substringBefore("/")) { + when (mimeType.substringBefore("/").lowercase(Locale.getDefault())) { "image" -> imagesSize += size "video" -> videosSize += size "audio" -> audioSize += size + "text" -> documentsSize += size + else -> { + if (extraDocumentMimeTypes.contains(mimeType.lowercase(Locale.getDefault()))) { + documentsSize += size + } + } } } catch (e: Exception) { } @@ -95,6 +115,7 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage put(IMAGES, imagesSize) put(VIDEOS, videosSize) put(AUDIO, audioSize) + put(DOCUMENTS, documentsSize) } return mimeTypeSizes @@ -115,7 +136,7 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage val freeSpace = storageStatsManager.getFreeBytes(uuid) activity.runOnUiThread { - arrayOf(main_storage_usage_progressbar, images_progressbar, videos_progressbar, audio_progressbar).forEach { + arrayOf(main_storage_usage_progressbar, images_progressbar, videos_progressbar, audio_progressbar, documents_progressbar).forEach { it.max = (totalSpace / 1000000).toInt() } diff --git a/app/src/main/res/layout/storage_fragment.xml b/app/src/main/res/layout/storage_fragment.xml index 0ff44b46..253dbe41 100644 --- a/app/src/main/res/layout/storage_fragment.xml +++ b/app/src/main/res/layout/storage_fragment.xml @@ -137,4 +137,34 @@ android:max="100" app:trackThickness="2dp" /> + + + + + + From bc03e4f5e50f28615cd5de120f059da0cc08c9b2 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Oct 2021 23:44:27 +0200 Subject: [PATCH 25/70] adding a new string for Archives --- app/src/main/res/values-ar/strings.xml | 1 + app/src/main/res/values-az/strings.xml | 1 + app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-cy/strings.xml | 1 + app/src/main/res/values-da/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-el/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fi/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-hi/strings.xml | 1 + app/src/main/res/values-hr/strings.xml | 1 + app/src/main/res/values-hu/strings.xml | 1 + app/src/main/res/values-id/strings.xml | 1 + app/src/main/res/values-in/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-ko-rKR/strings.xml | 1 + app/src/main/res/values-lt/strings.xml | 1 + app/src/main/res/values-nb/strings.xml | 1 + app/src/main/res/values-nl/strings.xml | 1 + app/src/main/res/values-pl/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-pt/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-sk/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values-tr/strings.xml | 1 + app/src/main/res/values-uk/strings.xml | 1 + app/src/main/res/values-zh-rCN/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 32 files changed, 32 insertions(+) diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 91e23896..69168260 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index 9f86a5b7..e62163df 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 46a6e63c..8b7c7677 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-cy/strings.xml b/app/src/main/res/values-cy/strings.xml index f0b39b46..a8b96a55 100644 --- a/app/src/main/res/values-cy/strings.xml +++ b/app/src/main/res/values-cy/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index e13693ca..ba6f4c87 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 8693ffd7..0ea975b8 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index d32bc5bd..bb1e384a 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 9d608f9d..b53cead5 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 3b3d9062..93640037 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index e4b84a3c..8aa938f9 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index fb6850c3..3f35d2b2 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -47,6 +47,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 199abc6c..4d2ba8df 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index dfc2f067..e6a55178 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index b2c653f8..d66dd18f 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml index b2c653f8..d66dd18f 100644 --- a/app/src/main/res/values-in/strings.xml +++ b/app/src/main/res/values-in/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 90040c1a..2cb54a09 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 3be4ce58..56fc6b74 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index d0dff7f8..a7e5de56 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 9dc4f2ae..159be3cd 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 2b043f29..964dbbc8 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index bdb508b6..d60784c8 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index d0d554e0..fc9aed7d 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 55154130..d2c97711 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index e728ea4e..8e92b414 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 2878992e..d11cf7c7 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 2950f643..1d24eb67 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -48,6 +48,7 @@ Audio Dokumenty Stiahnuté + Archívy Iné využitých Úložisko celkom: %s diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index e8f62b14..e5fa79ee 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 1fc35d59..6e5f85e3 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 092e9ec7..0c4245c9 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 90617112..ffde2c32 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index b63907b7..02c1b313 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2ca5be6e..c7d2c25e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -48,6 +48,7 @@ Audio Documents Downloads + Archives Others free Total storage: %s From 35bc57f705851dea35f5620ba1da713f309c5f2e Mon Sep 17 00:00:00 2001 From: Agnieszka C <85929121+Aga-C@users.noreply.github.com> Date: Tue, 12 Oct 2021 11:19:34 +0200 Subject: [PATCH 26/70] Updated Polish translation --- app/src/main/res/values-pl/strings.xml | 84 +++++++++---------- .../metadata/android/pl/full_description.txt | 34 +++++++- .../metadata/android/pl/short_description.txt | 2 +- fastlane/metadata/android/pl/title.txt | 2 +- 4 files changed, 74 insertions(+), 48 deletions(-) diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index fc9aed7d..6c8818b3 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -1,18 +1,18 @@ - Prosty Menedżer Plików - Menedżer Plików - Naciśnij jeszcze raz, aby wyjść - Przejdź do folderu głównego - Ustaw jako folder główny - Folder główny zaktualizowany + Prosty menedżer plików + Menedżer plików + Naciśnij ponownie przycisk wstecz, aby wyjść + Przejdź do folderu domowego + Ustaw jako folder domowy + Folder domowy zaktualizowany Kopiuj ścieżkę do schowka Ścieżka skopiowana - Proszę wybrać plik audio + Wybierz plik audio Przeszukaj folder Ta operacja działa tylko na zrootowanych urządzeniach - Recents - Show recents + Ostatnie + Pokaż ostatnie Otwórz jako @@ -23,14 +23,14 @@ Inny plik - Skompresuj + Spakuj Rozpakuj - Skompresuj jako - Kompresowanie… + Spakuj jako + Pakowanie… Rozpakowywanie… - Kompresja udana - Rozpakowywanie udane - Kompresja nie powiodła się + Pakowanie powiodło się + Rozpakowywanie powiodło się + Pakowanie nie powiodło się Rozpakowywanie nie powiodło się @@ -39,56 +39,56 @@ Możesz dodać często używane foldery do ulubionych, aby mieć do nich łatwy dostęp z dowolnego miejsca. - Edytor Plików + Edytor plików - Storage analysis - Images - Videos + Analiza pamięci + Obrazy + Wideo Audio - Documents - Downloads - Archives - Others - free - Total storage: %s + Dokumenty + Pobrane + Archiwa + Inne + wolne + Całkowita pamięć: %s - Zezwól na dostęp do uprawnień roota - Require pressing Back twice to leave the app + Włącz dostęp do roota + Wymagaj dwukrotnego naciśnięcia przycisku Wstecz, aby wyjść z aplikacji - Prosty Menedżer Plików Pro - Zarządzaj plikami + Prosty menedżer plików Pro - Zarządzaj plikami - Easy app for managing your files without ads, respecting your privacy & security + Prosta aplikacja do zarządzania plikami bez reklam, szanująca Twoją prywatność - A lightweight quick file manager for everyday use. It offers a userful search functionality, you can also customize the home folder and select favorite folders for quick access. + Lekki, szybki menedżer plików do codziennego użytku. Oferuje użyteczną funkcję wyszukiwania, możesz także dostosować folder domowy i wybrać ulubione foldery, aby uzyskać szybki dostęp. - The app contains multiple powerful security related functions, like password protecting hidden items, deleting files, or the whole app. You can choose between using a pattern, pin, or a fingerprint to keep your data private. + Aplikacja zawiera wiele zaawansowanych funkcji związanych z bezpieczeństwem, takich jak ochrona hasłem ukrytych elementów lub całej aplikacji. Aby zachować prywatność danych, możesz wybrać wzór, PIN lub odcisk palca. - This modern file organizer supports fast browsing of root files, SD cards and USB devices. + Ten nowoczesny organizer plików obsługuje szybkie przeglądanie plików w folderze głównym, kart SD i urządzeń USB. - To keep your productive, it obviously has all the standard file operations like rename, copy, move, delete, share etc. It can also be used for saving up some storage, since it allows compressing and decompressing too. You can easily create new files or folders if you wish so. + Aby utrzymać Twoją produktywność, oczywiście ma wszystkie standardowe operacje na plikach, takie jak zmiana nazwy, kopiowanie, przenoszenie, usuwanie, udostępnianie itp. Może być też używany do oszczędzania miejsca, ponieważ umożliwia również pakowanie i rozpakowywanie. Jeśli chcesz, możesz łatwo tworzyć nowe pliki lub foldery. - You can obviously select sorting by multiple different values, toggle between ascending and descending, or use a folder specific sorting. + Możesz oczywiście wybrać sortowanie według wielu różnych wartości, przełączać się między rosnącym i malejącym lub użyć sortowania specyficznego dla folderu. - By just a few clicks you can also check file or folder properties, which shows various fields like the file size, date of the last modification, or EXIF values like the creation date, camera model at photos etc. + Za pomocą kilku naciśnięć możesz również sprawdzić właściwości pliku lub folderu, które pokazują różne pola, takie jak rozmiar pliku, data ostatniej modyfikacji lub wartości EXIF (data utworzenia, model aparatu itp.). - To get a file or folders path quickly, you can easily select it by long pressing and copying it in the clipboard. + Aby szybko uzyskać ścieżkę do pliku lub folderów, możesz ją łatwo wybrać, naciskając i kopiując ją do schowka. - You can create handy desktop shortcuts for accessing your favorite items quickly. + Możesz tworzyć przydatne skróty na pulpicie, aby szybko uzyskać dostęp do ulubionych elementów. - It contains a light file editor that you can use either for printing documents, editing them, or read easily with using zoom gestures, whenever needed. + Zawiera lekki edytor plików, którego można używać do drukowania dokumentów, ich edycji lub łatwego czytania za pomocą gestów powiększania, gdy jest to konieczne. - It comes with material design and dark theme by default, provides great user experience for easy usage. The lack of internet access gives you more privacy, security and stability than other apps. + Domyślnie jest wyposażony w Material Design i ciemny motyw, zapewniając doskonałe doświadczenie użytkownika dla łatwego użytkowania. Brak dostępu do Internetu zapewnia większą prywatność, bezpieczeństwo i stabilność niż inne aplikacje. - Aplikacja nie zawiera żadnych żadnych reklam, nie potrzebuje masy uprawnień, jest w pełni otwartoźródłowa, posiada ciemny motyw dla osób z wrażliwymi oczami. + Nie zawiera reklam ani niepotrzebnych uprawnień. Jest w pełni otwartoźródłowy, zapewnia konfigurowalną kolorystykę. - Check out the full suite of Simple Tools here: + Sprawdź pełen zestaw od Simple Tools tutaj: https://www.simplemobiletools.com - Standalone website of Simple File Manager Pro: + Strona internetowa Prostego menedżera plików Pro: https://www.simplemobiletools.com/filemanager Facebook: diff --git a/fastlane/metadata/android/pl/full_description.txt b/fastlane/metadata/android/pl/full_description.txt index f841258a..1983ac89 100644 --- a/fastlane/metadata/android/pl/full_description.txt +++ b/fastlane/metadata/android/pl/full_description.txt @@ -1,7 +1,33 @@ -Może być używany także do przeglądania systemowych zakamarków i zewnętrznych kart pamięci. Z łatwością możesz zmieniać nazwy, przenosić, kopiować, usuwać i udostępniać pliki. +Lekki, szybki menedżer plików do codziennego użytku. Oferuje użyteczną funkcję wyszukiwania, możesz także dostosować folder domowy i wybrać ulubione foldery, aby uzyskać szybki dostęp. -Uprawnienie odnośnie linii papilarnych potrzebne jest do blokowania widoczności plików i folderów lub też dostępu do aplikacji. +Aplikacja zawiera wiele zaawansowanych funkcji związanych z bezpieczeństwem, takich jak ochrona hasłem ukrytych elementów lub całej aplikacji. Aby zachować prywatność danych, możesz wybrać wzór, PIN lub odcisk palca. -Aplikacja nie zawiera żadnych żadnych reklam, nie potrzebuje masy uprawnień, jest w pełni otwartoźródłowa, posiada ciemny motyw dla osób z wrażliwymi oczami. +Ten nowoczesny organizer plików obsługuje szybkie przeglądanie plików w folderze głównym, kart SD i urządzeń USB. -Niniejsza aplikacja jest tylko częścią naszej kolekcji prostych narzędzi. Ta, jak i pozostałe, dostępne są na stronie https://www.simplemobiletools.com +Aby utrzymać Twoją produktywność, oczywiście ma wszystkie standardowe operacje na plikach, takie jak zmiana nazwy, kopiowanie, przenoszenie, usuwanie, udostępnianie itp. Może być też używany do oszczędzania miejsca, ponieważ umożliwia również pakowanie i rozpakowywanie. Jeśli chcesz, możesz łatwo tworzyć nowe pliki lub foldery. + +Możesz oczywiście wybrać sortowanie według wielu różnych wartości, przełączać się między rosnącym i malejącym lub użyć sortowania specyficznego dla folderu. + +Za pomocą kilku naciśnięć możesz również sprawdzić właściwości pliku lub folderu, które pokazują różne pola, takie jak rozmiar pliku, data ostatniej modyfikacji lub wartości EXIF (data utworzenia, model aparatu itp.). + +Aby szybko uzyskać ścieżkę do pliku lub folderów, możesz ją łatwo wybrać, naciskając i kopiując ją do schowka. + +Możesz tworzyć przydatne skróty na pulpicie, aby szybko uzyskać dostęp do ulubionych elementów. + +Zawiera lekki edytor plików, którego można używać do drukowania dokumentów, ich edycji lub łatwego czytania za pomocą gestów powiększania, gdy jest to konieczne. + +Domyślnie jest wyposażony w Material Design i ciemny motyw, zapewniając doskonałe doświadczenie użytkownika dla łatwego użytkowania. Brak dostępu do Internetu zapewnia większą prywatność, bezpieczeństwo i stabilność niż inne aplikacje. + +Nie zawiera reklam ani niepotrzebnych uprawnień. Jest w pełni otwartoźródłowy, zapewnia konfigurowalną kolorystykę. + +Sprawdź pełen zestaw od Simple Tools tutaj: +https://www.simplemobiletools.com + +Strona internetowa Prostego menedżera plików Pro: +https://www.simplemobiletools.com/filemanager + +Facebook: +https://www.facebook.com/simplemobiletools + +Reddit: +https://www.reddit.com/r/SimpleMobileTools \ No newline at end of file diff --git a/fastlane/metadata/android/pl/short_description.txt b/fastlane/metadata/android/pl/short_description.txt index c74f717d..b7e56ab3 100644 --- a/fastlane/metadata/android/pl/short_description.txt +++ b/fastlane/metadata/android/pl/short_description.txt @@ -1 +1 @@ -A simple file manager for browsing and editing files and directories. +Prosta aplikacja do zarządzania plikami bez reklam, szanująca Twoją prywatność diff --git a/fastlane/metadata/android/pl/title.txt b/fastlane/metadata/android/pl/title.txt index ac7f0fef..cf475903 100644 --- a/fastlane/metadata/android/pl/title.txt +++ b/fastlane/metadata/android/pl/title.txt @@ -1 +1 @@ -Prosty menedżer plików +Prosty menedżer plików Pro - Zarządzaj plikami From 1b956e336feddfabf95b341f7481207feeb39ac5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 12 Oct 2021 12:14:13 +0200 Subject: [PATCH 27/70] adding a basic implementation of archive file fetching --- .../pro/fragments/StorageFragment.kt | 46 +++++++++++++------ app/src/main/res/layout/storage_fragment.xml | 30 ++++++++++++ 2 files changed, 61 insertions(+), 15 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index 8de05919..a24a5675 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -3,7 +3,6 @@ package com.simplemobiletools.filemanager.pro.fragments import android.annotation.SuppressLint import android.app.usage.StorageStatsManager import android.content.Context -import android.os.Environment import android.os.storage.StorageManager import android.provider.MediaStore import android.util.AttributeSet @@ -22,33 +21,40 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage private val VIDEOS = "videos" private val AUDIO = "audio" private val DOCUMENTS = "documents" + private val ARCHIVES = "archives" + + private val SIZE_DIVIDER = 100000 // what else should we count as a document except "text/*" mimetype private val extraDocumentMimeTypes = arrayListOf("application/pdf", "application/msword") + private val archiveMimeTypes = arrayListOf("application/zip", "application/x-tar") override fun setupFragment(activity: SimpleActivity) { ensureBackgroundThread { - getStorageStats(activity) + getMainStorageStats(activity) val filesSize = getSizesByMimeType() val imagesSize = filesSize[IMAGES]!! val videosSize = filesSize[VIDEOS]!! val audioSize = filesSize[AUDIO]!! val documentsSize = filesSize[DOCUMENTS]!! - val downloadsSize = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getProperSize(true) + val archivesSize = filesSize[ARCHIVES]!! activity.runOnUiThread { images_size.text = imagesSize.formatSize() - images_progressbar.progress = (imagesSize / 1000000).toInt() + images_progressbar.progress = (imagesSize / SIZE_DIVIDER).toInt() videos_size.text = videosSize.formatSize() - videos_progressbar.progress = (videosSize / 1000000).toInt() + videos_progressbar.progress = (videosSize / SIZE_DIVIDER).toInt() audio_size.text = audioSize.formatSize() - audio_progressbar.progress = (audioSize / 1000000).toInt() + audio_progressbar.progress = (audioSize / SIZE_DIVIDER).toInt() documents_size.text = documentsSize.formatSize() - documents_progressbar.progress = (documentsSize / 1000000).toInt() + documents_progressbar.progress = (documentsSize / SIZE_DIVIDER).toInt() + + archives_size.text = archivesSize.formatSize() + archives_progressbar.progress = (archivesSize / SIZE_DIVIDER).toInt() } } } @@ -76,6 +82,10 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage val yellowColor = context.resources.getColor(R.color.md_yellow_700) documents_progressbar.setIndicatorColor(yellowColor) documents_progressbar.trackColor = yellowColor.adjustAlpha(0.3f) + + val greyColor = context.resources.getColor(R.color.md_grey_700) + archives_progressbar.setIndicatorColor(greyColor) + archives_progressbar.trackColor = greyColor.adjustAlpha(0.3f) } private fun getSizesByMimeType(): HashMap { @@ -89,19 +99,21 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage var videosSize = 0L var audioSize = 0L var documentsSize = 0L + var archivesSize = 0L try { context.queryCursor(uri, projection) { cursor -> try { - val mimeType = cursor.getStringValue(MediaStore.Files.FileColumns.MIME_TYPE) ?: return@queryCursor + val mimeType = cursor.getStringValue(MediaStore.Files.FileColumns.MIME_TYPE)?.lowercase(Locale.getDefault()) ?: return@queryCursor val size = cursor.getLongValue(MediaStore.Files.FileColumns.SIZE) - when (mimeType.substringBefore("/").lowercase(Locale.getDefault())) { + when (mimeType.substringBefore("/")) { "image" -> imagesSize += size "video" -> videosSize += size "audio" -> audioSize += size "text" -> documentsSize += size else -> { - if (extraDocumentMimeTypes.contains(mimeType.lowercase(Locale.getDefault()))) { - documentsSize += size + when { + extraDocumentMimeTypes.contains(mimeType) -> documentsSize += size + archiveMimeTypes.contains(mimeType) -> archivesSize += size } } } @@ -116,13 +128,14 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage put(VIDEOS, videosSize) put(AUDIO, audioSize) put(DOCUMENTS, documentsSize) + put(ARCHIVES, archivesSize) } return mimeTypeSizes } @SuppressLint("NewApi") - private fun getStorageStats(activity: SimpleActivity) { + private fun getMainStorageStats(activity: SimpleActivity) { val externalDirs = activity.getExternalFilesDirs(null) val storageManager = activity.getSystemService(AppCompatActivity.STORAGE_SERVICE) as StorageManager @@ -136,11 +149,14 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage val freeSpace = storageStatsManager.getFreeBytes(uuid) activity.runOnUiThread { - arrayOf(main_storage_usage_progressbar, images_progressbar, videos_progressbar, audio_progressbar, documents_progressbar).forEach { - it.max = (totalSpace / 1000000).toInt() + arrayOf( + main_storage_usage_progressbar, images_progressbar, videos_progressbar, audio_progressbar, documents_progressbar, + archives_progressbar + ).forEach { + it.max = (totalSpace / SIZE_DIVIDER).toInt() } - main_storage_usage_progressbar.progress = ((totalSpace - freeSpace) / 1000000).toInt() + main_storage_usage_progressbar.progress = ((totalSpace - freeSpace) / SIZE_DIVIDER).toInt() main_storage_usage_progressbar.beVisible() free_space_value.text = freeSpace.formatSizeThousand() diff --git a/app/src/main/res/layout/storage_fragment.xml b/app/src/main/res/layout/storage_fragment.xml index 253dbe41..42832b7f 100644 --- a/app/src/main/res/layout/storage_fragment.xml +++ b/app/src/main/res/layout/storage_fragment.xml @@ -167,4 +167,34 @@ android:max="100" app:trackThickness="2dp" /> + + + + + + From 91db92b51d414f0311868262319f725940cd8baa Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 12 Oct 2021 14:02:17 +0200 Subject: [PATCH 28/70] adding recognition to a couple more mimetypes --- .../filemanager/pro/fragments/StorageFragment.kt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index a24a5675..544f49b8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -25,9 +25,13 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage private val SIZE_DIVIDER = 100000 - // what else should we count as a document except "text/*" mimetype - private val extraDocumentMimeTypes = arrayListOf("application/pdf", "application/msword") - private val archiveMimeTypes = arrayListOf("application/zip", "application/x-tar") + // what else should we count as an audio except "audio/*" mimetype + private val extraAudioMimeTypes = arrayListOf("application/ogg") + private val extraDocumentMimeTypes = arrayListOf( + "application/pdf", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + ) + private val archiveMimeTypes = arrayListOf("application/zip", "application/x-tar", "application/octet-stream", "application/json") override fun setupFragment(activity: SimpleActivity) { ensureBackgroundThread { @@ -92,7 +96,8 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage val uri = MediaStore.Files.getContentUri("external") val projection = arrayOf( MediaStore.Files.FileColumns.SIZE, - MediaStore.Files.FileColumns.MIME_TYPE + MediaStore.Files.FileColumns.MIME_TYPE, + MediaStore.Files.FileColumns.DISPLAY_NAME ) var imagesSize = 0L @@ -105,6 +110,7 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage try { val mimeType = cursor.getStringValue(MediaStore.Files.FileColumns.MIME_TYPE)?.lowercase(Locale.getDefault()) ?: return@queryCursor val size = cursor.getLongValue(MediaStore.Files.FileColumns.SIZE) + val name = cursor.getStringValue(MediaStore.Files.FileColumns.DISPLAY_NAME) when (mimeType.substringBefore("/")) { "image" -> imagesSize += size "video" -> videosSize += size @@ -113,6 +119,7 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage else -> { when { extraDocumentMimeTypes.contains(mimeType) -> documentsSize += size + extraAudioMimeTypes.contains(mimeType) -> audioSize += size archiveMimeTypes.contains(mimeType) -> archivesSize += size } } From 46fa498acc7a5c1e0f6ffce362c5b780bee3d644 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 12 Oct 2021 14:09:05 +0200 Subject: [PATCH 29/70] adding Others to the storage analyzer --- .../pro/fragments/StorageFragment.kt | 30 ++++++++++++------- app/src/main/res/layout/storage_fragment.xml | 30 +++++++++++++++++++ 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index 544f49b8..ad6264a0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -22,6 +22,7 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage private val AUDIO = "audio" private val DOCUMENTS = "documents" private val ARCHIVES = "archives" + private val OTHERS = "others" private val SIZE_DIVIDER = 100000 @@ -43,6 +44,7 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage val audioSize = filesSize[AUDIO]!! val documentsSize = filesSize[DOCUMENTS]!! val archivesSize = filesSize[ARCHIVES]!! + val othersSize = filesSize[OTHERS]!! activity.runOnUiThread { images_size.text = imagesSize.formatSize() @@ -59,6 +61,9 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage archives_size.text = archivesSize.formatSize() archives_progressbar.progress = (archivesSize / SIZE_DIVIDER).toInt() + + others_size.text = othersSize.formatSize() + others_progressbar.progress = (othersSize / SIZE_DIVIDER).toInt() } } } @@ -79,25 +84,28 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage videos_progressbar.setIndicatorColor(greenColor) videos_progressbar.trackColor = greenColor.adjustAlpha(0.3f) - val blueColor = context.resources.getColor(R.color.md_blue_700) - audio_progressbar.setIndicatorColor(blueColor) - audio_progressbar.trackColor = blueColor.adjustAlpha(0.3f) + val lightBlueColor = context.resources.getColor(R.color.md_light_blue_700) + audio_progressbar.setIndicatorColor(lightBlueColor) + audio_progressbar.trackColor = lightBlueColor.adjustAlpha(0.3f) val yellowColor = context.resources.getColor(R.color.md_yellow_700) documents_progressbar.setIndicatorColor(yellowColor) documents_progressbar.trackColor = yellowColor.adjustAlpha(0.3f) - val greyColor = context.resources.getColor(R.color.md_grey_700) - archives_progressbar.setIndicatorColor(greyColor) - archives_progressbar.trackColor = greyColor.adjustAlpha(0.3f) + val whiteColor = context.resources.getColor(R.color.md_grey_white) + archives_progressbar.setIndicatorColor(whiteColor) + archives_progressbar.trackColor = whiteColor.adjustAlpha(0.3f) + + val pinkColor = context.resources.getColor(R.color.md_pink_700) + others_progressbar.setIndicatorColor(pinkColor) + others_progressbar.trackColor = pinkColor.adjustAlpha(0.3f) } private fun getSizesByMimeType(): HashMap { val uri = MediaStore.Files.getContentUri("external") val projection = arrayOf( MediaStore.Files.FileColumns.SIZE, - MediaStore.Files.FileColumns.MIME_TYPE, - MediaStore.Files.FileColumns.DISPLAY_NAME + MediaStore.Files.FileColumns.MIME_TYPE ) var imagesSize = 0L @@ -105,12 +113,12 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage var audioSize = 0L var documentsSize = 0L var archivesSize = 0L + var othersSize = 0L try { context.queryCursor(uri, projection) { cursor -> try { val mimeType = cursor.getStringValue(MediaStore.Files.FileColumns.MIME_TYPE)?.lowercase(Locale.getDefault()) ?: return@queryCursor val size = cursor.getLongValue(MediaStore.Files.FileColumns.SIZE) - val name = cursor.getStringValue(MediaStore.Files.FileColumns.DISPLAY_NAME) when (mimeType.substringBefore("/")) { "image" -> imagesSize += size "video" -> videosSize += size @@ -121,6 +129,7 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage extraDocumentMimeTypes.contains(mimeType) -> documentsSize += size extraAudioMimeTypes.contains(mimeType) -> audioSize += size archiveMimeTypes.contains(mimeType) -> archivesSize += size + else -> othersSize += size } } } @@ -136,6 +145,7 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage put(AUDIO, audioSize) put(DOCUMENTS, documentsSize) put(ARCHIVES, archivesSize) + put(OTHERS, othersSize) } return mimeTypeSizes @@ -158,7 +168,7 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage activity.runOnUiThread { arrayOf( main_storage_usage_progressbar, images_progressbar, videos_progressbar, audio_progressbar, documents_progressbar, - archives_progressbar + archives_progressbar, others_progressbar ).forEach { it.max = (totalSpace / SIZE_DIVIDER).toInt() } diff --git a/app/src/main/res/layout/storage_fragment.xml b/app/src/main/res/layout/storage_fragment.xml index 42832b7f..ec88b237 100644 --- a/app/src/main/res/layout/storage_fragment.xml +++ b/app/src/main/res/layout/storage_fragment.xml @@ -197,4 +197,34 @@ android:max="100" app:trackThickness="2dp" /> + + + + + + From ec6cafecd8a87da1f77359e9cf2b809559e4991e Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 12 Oct 2021 15:32:33 +0200 Subject: [PATCH 30/70] add some files without mimetype to Others too --- .../filemanager/pro/fragments/StorageFragment.kt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index ad6264a0..a2453ada 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -105,7 +105,8 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage val uri = MediaStore.Files.getContentUri("external") val projection = arrayOf( MediaStore.Files.FileColumns.SIZE, - MediaStore.Files.FileColumns.MIME_TYPE + MediaStore.Files.FileColumns.MIME_TYPE, + MediaStore.Files.FileColumns.DATA ) var imagesSize = 0L @@ -117,8 +118,18 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage try { context.queryCursor(uri, projection) { cursor -> try { - val mimeType = cursor.getStringValue(MediaStore.Files.FileColumns.MIME_TYPE)?.lowercase(Locale.getDefault()) ?: return@queryCursor + val mimeType = cursor.getStringValue(MediaStore.Files.FileColumns.MIME_TYPE)?.lowercase(Locale.getDefault()) val size = cursor.getLongValue(MediaStore.Files.FileColumns.SIZE) + if (mimeType == null) { + if (size > 0 && size != 4096L) { + val path = cursor.getStringValue(MediaStore.Files.FileColumns.DATA) + if (!context.getIsPathDirectory(path)) { + othersSize += size + } + } + return@queryCursor + } + when (mimeType.substringBefore("/")) { "image" -> imagesSize += size "video" -> videosSize += size From 87c3a905e9a2be83400505b62bdb5923e2ed974e Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 10:38:28 +0200 Subject: [PATCH 31/70] recognize more mimetypes as documents or archives --- .../pro/fragments/StorageFragment.kt | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index a2453ada..ed5f0725 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -29,10 +29,27 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage // what else should we count as an audio except "audio/*" mimetype private val extraAudioMimeTypes = arrayListOf("application/ogg") private val extraDocumentMimeTypes = arrayListOf( - "application/pdf", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + "application/pdf", + "application/msword", + "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "application/javascript" ) - private val archiveMimeTypes = arrayListOf("application/zip", "application/x-tar", "application/octet-stream", "application/json") + + private val archiveMimeTypes = + arrayListOf( + "application/zip", + "application/octet-stream", + "application/json", + "application/x-tar", + "application/x-rar-compressed", + "application/x-zip-compressed", + "application/x-7z-compressed", + "application/x-compressed", + "application/x-gzip", + "application/java-archive", + "multipart/x-zip" + ) override fun setupFragment(activity: SimpleActivity) { ensureBackgroundThread { From 0961ceb096974a0be7c9a2419965b9f35cb1fc8c Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 10:43:54 +0200 Subject: [PATCH 32/70] minor code style formatting --- .../pro/fragments/StorageFragment.kt | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index ed5f0725..4b021ad8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -36,20 +36,19 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage "application/javascript" ) - private val archiveMimeTypes = - arrayListOf( - "application/zip", - "application/octet-stream", - "application/json", - "application/x-tar", - "application/x-rar-compressed", - "application/x-zip-compressed", - "application/x-7z-compressed", - "application/x-compressed", - "application/x-gzip", - "application/java-archive", - "multipart/x-zip" - ) + private val archiveMimeTypes = arrayListOf( + "application/zip", + "application/octet-stream", + "application/json", + "application/x-tar", + "application/x-rar-compressed", + "application/x-zip-compressed", + "application/x-7z-compressed", + "application/x-compressed", + "application/x-gzip", + "application/java-archive", + "multipart/x-zip" + ) override fun setupFragment(activity: SimpleActivity) { ensureBackgroundThread { From cc58ea1b8741ce3503db739f1ec146f5b2e3693e Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 11:09:45 +0200 Subject: [PATCH 33/70] make the storage analyzer items clickable --- .../pro/fragments/StorageFragment.kt | 19 + app/src/main/res/layout/storage_fragment.xml | 449 ++++++++++-------- 2 files changed, 272 insertions(+), 196 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index 4b021ad8..a5e8d34e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -3,8 +3,10 @@ package com.simplemobiletools.filemanager.pro.fragments import android.annotation.SuppressLint import android.app.usage.StorageStatsManager import android.content.Context +import android.content.Intent import android.os.storage.StorageManager import android.provider.MediaStore +import android.provider.Settings import android.util.AttributeSet import androidx.appcompat.app.AppCompatActivity import com.simplemobiletools.commons.extensions.* @@ -16,6 +18,7 @@ import kotlinx.android.synthetic.main.storage_fragment.view.* import java.util.* import kotlin.collections.HashMap + class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) { private val IMAGES = "images" private val VIDEOS = "videos" @@ -82,6 +85,22 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage others_progressbar.progress = (othersSize / SIZE_DIVIDER).toInt() } } + + free_space_holder.setOnClickListener { + try { + val storageSettingsIntent = Intent(Settings.ACTION_INTERNAL_STORAGE_SETTINGS) + activity.startActivity(storageSettingsIntent) + } catch (e: Exception) { + activity.showErrorToast(e) + } + } + + images_holder.setOnClickListener { } + videos_holder.setOnClickListener { } + audio_holder.setOnClickListener { } + documents_holder.setOnClickListener { } + archives_holder.setOnClickListener { } + others_holder.setOnClickListener { } } override fun refreshFragment() {} diff --git a/app/src/main/res/layout/storage_fragment.xml b/app/src/main/res/layout/storage_fragment.xml index ec88b237..196b8662 100644 --- a/app/src/main/res/layout/storage_fragment.xml +++ b/app/src/main/res/layout/storage_fragment.xml @@ -5,226 +5,283 @@ android:id="@+id/storage_fragment" android:layout_width="match_parent" android:layout_height="match_parent" - android:padding="@dimen/activity_margin"> + tools:ignore="RelativeOverlap"> - + android:background="?attr/selectableItemBackground" + android:paddingStart="@dimen/activity_margin" + android:paddingTop="@dimen/activity_margin" + android:paddingEnd="@dimen/activity_margin"> - + + + + + + + + + + android:layout_below="@+id/free_space_holder" + android:background="?attr/selectableItemBackground" + android:paddingStart="@dimen/activity_margin" + android:paddingTop="@dimen/normal_margin" + android:paddingEnd="@dimen/activity_margin" + android:paddingBottom="@dimen/normal_margin"> - + - + + + + + + android:layout_below="@+id/images_holder" + android:background="?attr/selectableItemBackground" + android:paddingStart="@dimen/activity_margin" + android:paddingTop="@dimen/normal_margin" + android:paddingEnd="@dimen/activity_margin" + android:paddingBottom="@dimen/normal_margin"> - + + + + + + + + android:layout_below="@+id/videos_holder" + android:background="?attr/selectableItemBackground" + android:paddingStart="@dimen/activity_margin" + android:paddingTop="@dimen/normal_margin" + android:paddingEnd="@dimen/activity_margin" + android:paddingBottom="@dimen/normal_margin"> - + + + + + + + + android:layout_below="@+id/audio_holder" + android:background="?attr/selectableItemBackground" + android:paddingStart="@dimen/activity_margin" + android:paddingTop="@dimen/normal_margin" + android:paddingEnd="@dimen/activity_margin" + android:paddingBottom="@dimen/normal_margin"> - + - + + + + + + android:layout_below="@+id/documents_holder" + android:background="?attr/selectableItemBackground" + android:paddingStart="@dimen/activity_margin" + android:paddingTop="@dimen/normal_margin" + android:paddingEnd="@dimen/activity_margin" + android:paddingBottom="@dimen/normal_margin"> - + + + + + + + + android:layout_below="@+id/archives_holder" + android:background="?attr/selectableItemBackground" + android:paddingStart="@dimen/activity_margin" + android:paddingTop="@dimen/normal_margin" + android:paddingEnd="@dimen/activity_margin" + android:paddingBottom="@dimen/normal_margin"> - + - - - - - - - - - - - - - - - - - - - - - - - + + + From 7c02fe8e90cadd9f10b5a0160ff62045f7de2034 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 11:12:34 +0200 Subject: [PATCH 34/70] make the whole storage analyzer scrollable --- .../pro/fragments/StorageFragment.kt | 1 - app/src/main/res/layout/storage_fragment.xml | 508 +++++++++--------- 2 files changed, 260 insertions(+), 249 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index a5e8d34e..ac1c0bd9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -18,7 +18,6 @@ import kotlinx.android.synthetic.main.storage_fragment.view.* import java.util.* import kotlin.collections.HashMap - class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) { private val IMAGES = "images" private val VIDEOS = "videos" diff --git a/app/src/main/res/layout/storage_fragment.xml b/app/src/main/res/layout/storage_fragment.xml index 196b8662..4148a10a 100644 --- a/app/src/main/res/layout/storage_fragment.xml +++ b/app/src/main/res/layout/storage_fragment.xml @@ -4,284 +4,296 @@ xmlns:tools="http://schemas.android.com/tools" android:id="@+id/storage_fragment" android:layout_width="match_parent" - android:layout_height="match_parent" - tools:ignore="RelativeOverlap"> + android:layout_height="match_parent"> - + android:layout_height="wrap_content"> - + tools:ignore="RelativeOverlap"> - + - + - - + - + - + + - + - - + - + - + + - + - - + - + - + + - + - - + - + - + + - + - - + - + - + + - + - - + - + - + + - + - - + + + + + + + + From b30fa5e154f1739fd0c597dda61174ae1e96b94d Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 11:28:57 +0200 Subject: [PATCH 35/70] adding some placeholder dots at storage during loading --- .../filemanager/pro/fragments/StorageFragment.kt | 2 ++ app/src/main/res/layout/storage_fragment.xml | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index ac1c0bd9..8cee5733 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -53,6 +53,8 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage ) override fun setupFragment(activity: SimpleActivity) { + total_space.text = String.format(context.getString(R.string.total_storage), "…") + ensureBackgroundThread { getMainStorageStats(activity) diff --git a/app/src/main/res/layout/storage_fragment.xml b/app/src/main/res/layout/storage_fragment.xml index 4148a10a..cf9ce9b3 100644 --- a/app/src/main/res/layout/storage_fragment.xml +++ b/app/src/main/res/layout/storage_fragment.xml @@ -15,7 +15,7 @@ android:id="@+id/storage_holder" android:layout_width="wrap_content" android:layout_height="wrap_content" - tools:ignore="RelativeOverlap"> + tools:ignore="HardcodedText,RelativeOverlap"> @@ -54,7 +55,6 @@ android:layout_marginTop="@dimen/medium_margin" android:layout_marginBottom="@dimen/medium_margin" android:max="100" - android:visibility="invisible" app:trackThickness="4dp" /> @@ -129,6 +130,7 @@ android:layout_height="wrap_content" android:layout_alignParentEnd="true" android:alpha="0.7" + android:text="…" android:textSize="@dimen/normal_text_size" tools:text="20 GB" /> @@ -167,6 +169,7 @@ android:layout_height="wrap_content" android:layout_alignParentEnd="true" android:alpha="0.7" + android:text="…" android:textSize="@dimen/normal_text_size" tools:text="20 GB" /> @@ -205,6 +208,7 @@ android:layout_height="wrap_content" android:layout_alignParentEnd="true" android:alpha="0.7" + android:text="…" android:textSize="@dimen/normal_text_size" tools:text="20 GB" /> @@ -243,6 +247,7 @@ android:layout_height="wrap_content" android:layout_alignParentEnd="true" android:alpha="0.7" + android:text="…" android:textSize="@dimen/normal_text_size" tools:text="20 GB" /> @@ -281,6 +286,7 @@ android:layout_height="wrap_content" android:layout_alignParentEnd="true" android:alpha="0.7" + android:text="…" android:textSize="@dimen/normal_text_size" tools:text="20 GB" /> From 591c4c56ad61818d1f43bcb44b4ff53843bda1c1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 12:02:54 +0200 Subject: [PATCH 36/70] adding an initial implementation of Mimetypes activity --- app/src/main/AndroidManifest.xml | 2 + .../pro/activities/MimeTypesActivity.kt | 151 ++++++++++++++++++ .../pro/fragments/StorageFragment.kt | 28 ++-- .../filemanager/pro/helpers/Constants.kt | 8 + .../main/res/layout/activity_mimetypes.xml | 10 ++ 5 files changed, 186 insertions(+), 13 deletions(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt create mode 100644 app/src/main/res/layout/activity_mimetypes.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 39f0a441..da0bb60d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -54,6 +54,8 @@ + + diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt new file mode 100644 index 00000000..bfd42b69 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt @@ -0,0 +1,151 @@ +package com.simplemobiletools.filemanager.pro.activities + +import android.app.SearchManager +import android.content.Context +import android.os.Bundle +import android.view.Menu +import android.view.MenuItem +import androidx.appcompat.widget.SearchView +import androidx.core.view.MenuItemCompat +import com.simplemobiletools.commons.extensions.handleHiddenFolderPasswordProtection +import com.simplemobiletools.commons.extensions.toast +import com.simplemobiletools.commons.helpers.VIEW_TYPE_GRID +import com.simplemobiletools.filemanager.pro.R +import com.simplemobiletools.filemanager.pro.dialogs.ChangeSortingDialog +import com.simplemobiletools.filemanager.pro.dialogs.ChangeViewTypeDialog +import com.simplemobiletools.filemanager.pro.extensions.config +import com.simplemobiletools.filemanager.pro.helpers.* + +class MimeTypesActivity : SimpleActivity() { + private var isSearchOpen = false + private var searchMenuItem: MenuItem? = null + private var currentMimeType = "" + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_mimetypes) + currentMimeType = intent.getStringExtra(SHOW_MIMETYPE) ?: return + title = getString( + when (currentMimeType) { + IMAGES -> R.string.images + VIDEOS -> R.string.videos + AUDIO -> R.string.audio + DOCUMENTS -> R.string.documents + ARCHIVES -> R.string.archives + OTHERS -> R.string.others + else -> { + toast(R.string.unknown_error_occurred) + finish() + return + } + } + ) + } + + override fun onCreateOptionsMenu(menu: Menu): Boolean { + menuInflater.inflate(R.menu.menu, menu) + setupSearch(menu) + updateMenuItemColors(menu) + return true + } + + override fun onPrepareOptionsMenu(menu: Menu?): Boolean { + val currentViewType = config.getFolderViewType(currentMimeType) + + menu!!.apply { + findItem(R.id.add_favorite).isVisible = false + findItem(R.id.remove_favorite).isVisible = false + findItem(R.id.go_to_favorite).isVisible = false + + findItem(R.id.toggle_filename).isVisible = currentViewType == VIEW_TYPE_GRID + findItem(R.id.go_home).isVisible = false + findItem(R.id.set_as_home).isVisible = false + findItem(R.id.settings).isVisible = false + findItem(R.id.about).isVisible = false + + findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden + findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden + + findItem(R.id.increase_column_count).isVisible = currentViewType == VIEW_TYPE_GRID && config.fileColumnCnt < MAX_COLUMN_COUNT + findItem(R.id.reduce_column_count).isVisible = currentViewType == VIEW_TYPE_GRID && config.fileColumnCnt > 1 + } + + return true + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + when (item.itemId) { + R.id.sort -> showSortingDialog() + R.id.toggle_filename -> toggleFilenameVisibility() + R.id.change_view_type -> changeViewType() + R.id.temporarily_show_hidden -> tryToggleTemporarilyShowHidden() + R.id.stop_showing_hidden -> tryToggleTemporarilyShowHidden() + R.id.increase_column_count -> increaseColumnCount() + R.id.reduce_column_count -> reduceColumnCount() + else -> return super.onOptionsItemSelected(item) + } + return true + } + + private fun setupSearch(menu: Menu) { + val searchManager = getSystemService(Context.SEARCH_SERVICE) as SearchManager + searchMenuItem = menu.findItem(R.id.search) + (searchMenuItem!!.actionView as SearchView).apply { + setSearchableInfo(searchManager.getSearchableInfo(componentName)) + isSubmitButtonEnabled = false + queryHint = getString(R.string.search) + setOnQueryTextListener(object : SearchView.OnQueryTextListener { + override fun onQueryTextSubmit(query: String) = false + + override fun onQueryTextChange(newText: String): Boolean { + if (isSearchOpen) { + } + return true + } + }) + } + + MenuItemCompat.setOnActionExpandListener(searchMenuItem, object : MenuItemCompat.OnActionExpandListener { + override fun onMenuItemActionExpand(item: MenuItem?): Boolean { + isSearchOpen = true + return true + } + + override fun onMenuItemActionCollapse(item: MenuItem?): Boolean { + isSearchOpen = false + return true + } + }) + } + + private fun showSortingDialog() { + ChangeSortingDialog(this, currentMimeType) { + } + } + + private fun toggleFilenameVisibility() { + config.displayFilenames = !config.displayFilenames + } + + private fun increaseColumnCount() {} + + private fun reduceColumnCount() {} + + private fun changeViewType() { + ChangeViewTypeDialog(this, currentMimeType, true) { } + } + + private fun tryToggleTemporarilyShowHidden() { + if (config.temporarilyShowHidden) { + toggleTemporarilyShowHidden(false) + } else { + handleHiddenFolderPasswordProtection { + toggleTemporarilyShowHidden(true) + } + } + } + + private fun toggleTemporarilyShowHidden(show: Boolean) { + config.temporarilyShowHidden = show + } +} diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index 8cee5733..c704f236 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -12,20 +12,15 @@ import androidx.appcompat.app.AppCompatActivity import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.filemanager.pro.R +import com.simplemobiletools.filemanager.pro.activities.MimeTypesActivity import com.simplemobiletools.filemanager.pro.activities.SimpleActivity import com.simplemobiletools.filemanager.pro.extensions.formatSizeThousand +import com.simplemobiletools.filemanager.pro.helpers.* import kotlinx.android.synthetic.main.storage_fragment.view.* import java.util.* import kotlin.collections.HashMap class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) { - private val IMAGES = "images" - private val VIDEOS = "videos" - private val AUDIO = "audio" - private val DOCUMENTS = "documents" - private val ARCHIVES = "archives" - private val OTHERS = "others" - private val SIZE_DIVIDER = 100000 // what else should we count as an audio except "audio/*" mimetype @@ -96,12 +91,12 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage } } - images_holder.setOnClickListener { } - videos_holder.setOnClickListener { } - audio_holder.setOnClickListener { } - documents_holder.setOnClickListener { } - archives_holder.setOnClickListener { } - others_holder.setOnClickListener { } + images_holder.setOnClickListener { launchMimetypeActivity(IMAGES) } + videos_holder.setOnClickListener { launchMimetypeActivity(VIDEOS) } + audio_holder.setOnClickListener { launchMimetypeActivity(AUDIO) } + documents_holder.setOnClickListener { launchMimetypeActivity(DOCUMENTS) } + archives_holder.setOnClickListener { launchMimetypeActivity(ARCHIVES) } + others_holder.setOnClickListener { launchMimetypeActivity(OTHERS) } } override fun refreshFragment() {} @@ -137,6 +132,13 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage others_progressbar.trackColor = pinkColor.adjustAlpha(0.3f) } + private fun launchMimetypeActivity(mimetype: String) { + Intent(context, MimeTypesActivity::class.java).apply { + putExtra(SHOW_MIMETYPE, mimetype) + context.startActivity(this) + } + } + private fun getSizesByMimeType(): HashMap { val uri = MediaStore.Files.getContentUri("external") val projection = arrayOf( diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt index 72f7acb7..df113a02 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt @@ -33,3 +33,11 @@ const val OPEN_AS_OTHER = 5 const val ALL_TABS_MASK = TAB_FILES or TAB_RECENT_FILES or TAB_STORAGE_ANALYSIS val tabsList = arrayListOf(TAB_FILES, TAB_RECENT_FILES, TAB_STORAGE_ANALYSIS) + +const val IMAGES = "images" +const val VIDEOS = "videos" +const val AUDIO = "audio" +const val DOCUMENTS = "documents" +const val ARCHIVES = "archives" +const val OTHERS = "others" +const val SHOW_MIMETYPE = "show_mimetype" diff --git a/app/src/main/res/layout/activity_mimetypes.xml b/app/src/main/res/layout/activity_mimetypes.xml new file mode 100644 index 00000000..2a71c40f --- /dev/null +++ b/app/src/main/res/layout/activity_mimetypes.xml @@ -0,0 +1,10 @@ + + From 05f99b49ba4d4e385a534189c96fd03367e5608f Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 12:23:35 +0200 Subject: [PATCH 37/70] moving the extra mimetypes into the Constants file --- .../pro/fragments/StorageFragment.kt | 24 ------------------- .../filemanager/pro/helpers/Constants.kt | 24 +++++++++++++++++++ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index c704f236..669850d3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -23,30 +23,6 @@ import kotlin.collections.HashMap class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) { private val SIZE_DIVIDER = 100000 - // what else should we count as an audio except "audio/*" mimetype - private val extraAudioMimeTypes = arrayListOf("application/ogg") - private val extraDocumentMimeTypes = arrayListOf( - "application/pdf", - "application/msword", - "application/vnd.openxmlformats-officedocument.wordprocessingml.document", - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", - "application/javascript" - ) - - private val archiveMimeTypes = arrayListOf( - "application/zip", - "application/octet-stream", - "application/json", - "application/x-tar", - "application/x-rar-compressed", - "application/x-zip-compressed", - "application/x-7z-compressed", - "application/x-compressed", - "application/x-gzip", - "application/java-archive", - "multipart/x-zip" - ) - override fun setupFragment(activity: SimpleActivity) { total_space.text = String.format(context.getString(R.string.total_storage), "…") diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt index df113a02..8c6b99df 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt @@ -41,3 +41,27 @@ const val DOCUMENTS = "documents" const val ARCHIVES = "archives" const val OTHERS = "others" const val SHOW_MIMETYPE = "show_mimetype" + +// what else should we count as an audio except "audio/*" mimetype +val extraAudioMimeTypes = arrayListOf("application/ogg") +val extraDocumentMimeTypes = arrayListOf( + "application/pdf", + "application/msword", + "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "application/javascript" +) + +val archiveMimeTypes = arrayListOf( + "application/zip", + "application/octet-stream", + "application/json", + "application/x-tar", + "application/x-rar-compressed", + "application/x-zip-compressed", + "application/x-7z-compressed", + "application/x-compressed", + "application/x-gzip", + "application/java-archive", + "multipart/x-zip" +) From ffc838037fb8eb3d9d3b504bf3db1a34a1829bef Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 14:06:32 +0200 Subject: [PATCH 38/70] adding the actual file fetcher at the mimetype activity --- .../pro/activities/MimeTypesActivity.kt | 66 ++++++++++++++++++- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt index bfd42b69..52d2d0a1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt @@ -3,18 +3,20 @@ package com.simplemobiletools.filemanager.pro.activities import android.app.SearchManager import android.content.Context import android.os.Bundle +import android.provider.MediaStore import android.view.Menu import android.view.MenuItem import androidx.appcompat.widget.SearchView import androidx.core.view.MenuItemCompat -import com.simplemobiletools.commons.extensions.handleHiddenFolderPasswordProtection -import com.simplemobiletools.commons.extensions.toast +import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.VIEW_TYPE_GRID +import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.filemanager.pro.R import com.simplemobiletools.filemanager.pro.dialogs.ChangeSortingDialog import com.simplemobiletools.filemanager.pro.dialogs.ChangeViewTypeDialog import com.simplemobiletools.filemanager.pro.extensions.config import com.simplemobiletools.filemanager.pro.helpers.* +import java.util.* class MimeTypesActivity : SimpleActivity() { private var isSearchOpen = false @@ -40,6 +42,14 @@ class MimeTypesActivity : SimpleActivity() { } } ) + + ensureBackgroundThread { + getProperFilePaths { paths -> + runOnUiThread { + + } + } + } } override fun onCreateOptionsMenu(menu: Menu): Boolean { @@ -87,6 +97,58 @@ class MimeTypesActivity : SimpleActivity() { return true } + private fun getProperFilePaths(callback: (ArrayList) -> Unit) { + val filePaths = ArrayList() + val uri = MediaStore.Files.getContentUri("external") + val projection = arrayOf( + MediaStore.Files.FileColumns.MIME_TYPE, + MediaStore.Files.FileColumns.DATA + ) + + try { + queryCursor(uri, projection) { cursor -> + try { + val fullMimetype = cursor.getStringValue(MediaStore.Files.FileColumns.MIME_TYPE)?.lowercase(Locale.getDefault()) ?: return@queryCursor + val path = cursor.getStringValue(MediaStore.Files.FileColumns.DATA) + + val mimetype = fullMimetype.substringBefore("/") + when (currentMimeType) { + IMAGES -> { + if (mimetype == "image") { + filePaths.add(path) + } + } + VIDEOS -> { + if (mimetype == "video") { + filePaths.add(path) + } + } + AUDIO -> { + if (mimetype == "audio" || extraAudioMimeTypes.contains(fullMimetype)) { + filePaths.add(path) + } + } + DOCUMENTS -> { + if (mimetype == "text" || extraDocumentMimeTypes.contains(fullMimetype)) { + filePaths.add(path) + } + } + ARCHIVES -> { + if (archiveMimeTypes.contains(fullMimetype)) { + filePaths.add(path) + } + } + } + } catch (e: Exception) { + } + } + } catch (e: Exception) { + showErrorToast(e) + } + + callback(filePaths) + } + private fun setupSearch(menu: Menu) { val searchManager = getSystemService(Context.SEARCH_SERVICE) as SearchManager searchMenuItem = menu.findItem(R.id.search) From 8fb2f56506d5829664bd005f46824db70c9918b5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 15:57:41 +0200 Subject: [PATCH 39/70] add file fetching at mime type activity --- .../pro/activities/MimeTypesActivity.kt | 41 ++++++++++++++----- .../filemanager/pro/models/ListItem.kt | 1 + 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt index 52d2d0a1..80899fd0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt @@ -11,11 +11,13 @@ import androidx.core.view.MenuItemCompat import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.VIEW_TYPE_GRID import com.simplemobiletools.commons.helpers.ensureBackgroundThread +import com.simplemobiletools.commons.models.FileDirItem import com.simplemobiletools.filemanager.pro.R import com.simplemobiletools.filemanager.pro.dialogs.ChangeSortingDialog import com.simplemobiletools.filemanager.pro.dialogs.ChangeViewTypeDialog import com.simplemobiletools.filemanager.pro.extensions.config import com.simplemobiletools.filemanager.pro.helpers.* +import com.simplemobiletools.filemanager.pro.models.ListItem import java.util.* class MimeTypesActivity : SimpleActivity() { @@ -44,7 +46,11 @@ class MimeTypesActivity : SimpleActivity() { ) ensureBackgroundThread { - getProperFilePaths { paths -> + getProperFileDirItems { fileDirItems -> + FileDirItem.sorting = config.getFolderSorting(currentMimeType) + fileDirItems.sort() + val listItems = getListItemsFromFileDirItems(fileDirItems) + runOnUiThread { } @@ -97,12 +103,15 @@ class MimeTypesActivity : SimpleActivity() { return true } - private fun getProperFilePaths(callback: (ArrayList) -> Unit) { - val filePaths = ArrayList() + private fun getProperFileDirItems(callback: (ArrayList) -> Unit) { + val fileDirItems = ArrayList() val uri = MediaStore.Files.getContentUri("external") val projection = arrayOf( MediaStore.Files.FileColumns.MIME_TYPE, - MediaStore.Files.FileColumns.DATA + MediaStore.Files.FileColumns.DATA, + MediaStore.Files.FileColumns.DISPLAY_NAME, + MediaStore.Files.FileColumns.SIZE, + MediaStore.Files.FileColumns.DATE_MODIFIED ) try { @@ -110,32 +119,35 @@ class MimeTypesActivity : SimpleActivity() { try { val fullMimetype = cursor.getStringValue(MediaStore.Files.FileColumns.MIME_TYPE)?.lowercase(Locale.getDefault()) ?: return@queryCursor val path = cursor.getStringValue(MediaStore.Files.FileColumns.DATA) + val name = cursor.getStringValue(MediaStore.Files.FileColumns.DISPLAY_NAME) + val size = cursor.getLongValue(MediaStore.Files.FileColumns.SIZE) + val lastModified = cursor.getLongValue(MediaStore.Files.FileColumns.DATE_MODIFIED) * 1000 val mimetype = fullMimetype.substringBefore("/") when (currentMimeType) { IMAGES -> { if (mimetype == "image") { - filePaths.add(path) + fileDirItems.add(FileDirItem(path, name, false, 0, size, lastModified)) } } VIDEOS -> { if (mimetype == "video") { - filePaths.add(path) + fileDirItems.add(FileDirItem(path, name, false, 0, size, lastModified)) } } AUDIO -> { if (mimetype == "audio" || extraAudioMimeTypes.contains(fullMimetype)) { - filePaths.add(path) + fileDirItems.add(FileDirItem(path, name, false, 0, size, lastModified)) } } DOCUMENTS -> { if (mimetype == "text" || extraDocumentMimeTypes.contains(fullMimetype)) { - filePaths.add(path) + fileDirItems.add(FileDirItem(path, name, false, 0, size, lastModified)) } } ARCHIVES -> { if (archiveMimeTypes.contains(fullMimetype)) { - filePaths.add(path) + fileDirItems.add(FileDirItem(path, name, false, 0, size, lastModified)) } } } @@ -146,7 +158,16 @@ class MimeTypesActivity : SimpleActivity() { showErrorToast(e) } - callback(filePaths) + callback(fileDirItems) + } + + private fun getListItemsFromFileDirItems(fileDirItems: ArrayList): ArrayList { + val listItems = ArrayList() + fileDirItems.forEach { + val listItem = ListItem(it.path, it.name, false, 0, it.size, it.modified, false) + listItems.add(listItem) + } + return listItems } private fun setupSearch(menu: Menu) { diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/models/ListItem.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/models/ListItem.kt index 00ab9431..6250d79b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/models/ListItem.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/models/ListItem.kt @@ -2,5 +2,6 @@ package com.simplemobiletools.filemanager.pro.models import com.simplemobiletools.commons.models.FileDirItem +// isSectionTitle is used only at search results for showing the current folders path data class ListItem(val mPath: String, val mName: String = "", var mIsDirectory: Boolean = false, var mChildren: Int = 0, var mSize: Long = 0L, var mModified: Long = 0L, var isSectionTitle: Boolean) : FileDirItem(mPath, mName, mIsDirectory, mChildren, mSize, mModified) From b42680508f649811160463da213789795943dbbb Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 16:13:25 +0200 Subject: [PATCH 40/70] list the proper files at mimetype activity --- app/src/main/AndroidManifest.xml | 4 +- .../pro/activities/MimeTypesActivity.kt | 51 ++++++++++++++++--- .../filemanager/pro/adapters/ItemsAdapter.kt | 21 +++++--- .../main/res/layout/activity_mimetypes.xml | 33 +++++++++--- 4 files changed, 86 insertions(+), 23 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index da0bb60d..3f67a418 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -54,7 +54,9 @@ - + ) -> Unit) { val fileDirItems = ArrayList() + val showHidden = config.shouldShowHidden val uri = MediaStore.Files.getContentUri("external") val projection = arrayOf( MediaStore.Files.FileColumns.MIME_TYPE, @@ -118,8 +139,12 @@ class MimeTypesActivity : SimpleActivity() { queryCursor(uri, projection) { cursor -> try { val fullMimetype = cursor.getStringValue(MediaStore.Files.FileColumns.MIME_TYPE)?.lowercase(Locale.getDefault()) ?: return@queryCursor - val path = cursor.getStringValue(MediaStore.Files.FileColumns.DATA) val name = cursor.getStringValue(MediaStore.Files.FileColumns.DISPLAY_NAME) + if (!showHidden && name.startsWith(".")) { + return@queryCursor + } + + val path = cursor.getStringValue(MediaStore.Files.FileColumns.DATA) val size = cursor.getLongValue(MediaStore.Files.FileColumns.SIZE) val lastModified = cursor.getLongValue(MediaStore.Files.FileColumns.DATE_MODIFIED) * 1000 @@ -206,13 +231,27 @@ class MimeTypesActivity : SimpleActivity() { } } - private fun toggleFilenameVisibility() { + override fun refreshFragment() {} + + override fun deleteFiles(files: ArrayList) {} + + override fun selectedPaths(paths: ArrayList) {} + + override fun searchQueryChanged(text: String) {} + + override fun setupDateTimeFormat() {} + + override fun setupFontSize() {} + + override fun toggleFilenameVisibility() { config.displayFilenames = !config.displayFilenames } - private fun increaseColumnCount() {} + override fun increaseColumnCount() {} - private fun reduceColumnCount() {} + override fun reduceColumnCount() {} + + override fun finishActMode() {} private fun changeViewType() { ChangeViewTypeDialog(this, currentMimeType, true) { } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt index e53ffd34..67f3bc68 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt @@ -55,8 +55,10 @@ import java.util.zip.ZipEntry import java.util.zip.ZipFile import java.util.zip.ZipOutputStream -class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList, val listener: ItemOperationsListener?, recyclerView: MyRecyclerView, - val isPickMultipleIntent: Boolean, fastScroller: FastScroller?, val swipeRefreshLayout: SwipeRefreshLayout, itemClick: (Any) -> Unit) : +class ItemsAdapter( + activity: SimpleActivity, var listItems: MutableList, val listener: ItemOperationsListener?, recyclerView: MyRecyclerView, + val isPickMultipleIntent: Boolean, fastScroller: FastScroller?, val swipeRefreshLayout: SwipeRefreshLayout?, itemClick: (Any) -> Unit +) : MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) { private val TYPE_FILE_DIR = 1 @@ -136,12 +138,12 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList val sourceFile = File(sourceFileDir.path) if (activity.getDoesFilePathExist(source) && activity.getIsPathDirectory(source) && - sourceFile.list()?.isEmpty() == true && sourceFile.getProperSize(true) == 0L && sourceFile.getFileCount(true) == 0) { + sourceFile.list()?.isEmpty() == true && sourceFile.getProperSize(true) == 0L && sourceFile.getFileCount(true) == 0 + ) { val sourceFolder = sourceFile.toFileDirItem(activity) activity.deleteFile(sourceFolder, true) { listener?.refreshFragment() @@ -811,7 +815,8 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList - + android:id="@+id/mimetypes_holder" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> + + + + + + + + + From c249b33a5bb0723574d24722f9fe74269c368e54 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 16:18:52 +0200 Subject: [PATCH 41/70] open selected file after clicking in the storage analysis --- .../filemanager/pro/activities/MimeTypesActivity.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt index 872a8f86..740ec198 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt @@ -17,6 +17,7 @@ import com.simplemobiletools.filemanager.pro.adapters.ItemsAdapter import com.simplemobiletools.filemanager.pro.dialogs.ChangeSortingDialog import com.simplemobiletools.filemanager.pro.dialogs.ChangeViewTypeDialog import com.simplemobiletools.filemanager.pro.extensions.config +import com.simplemobiletools.filemanager.pro.extensions.tryOpenPathIntent import com.simplemobiletools.filemanager.pro.helpers.* import com.simplemobiletools.filemanager.pro.interfaces.ItemOperationsListener import com.simplemobiletools.filemanager.pro.models.ListItem @@ -56,7 +57,7 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { val listItems = getListItemsFromFileDirItems(fileDirItems) runOnUiThread { ItemsAdapter(this as SimpleActivity, listItems, this, mimetypes_list, false, items_fastscroller, null) { - + tryOpenPathIntent((it as ListItem).path, false) }.apply { mimetypes_list.adapter = this } From e000962a9402d1ab96496a56976fccd9f302241a Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 16:39:53 +0200 Subject: [PATCH 42/70] refresh mimetype activity list on changing sorting --- .../pro/activities/MimeTypesActivity.kt | 158 ++++++++++-------- 1 file changed, 84 insertions(+), 74 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt index 740ec198..e6ae160b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt @@ -52,33 +52,12 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { ensureBackgroundThread { getProperFileDirItems { fileDirItems -> - FileDirItem.sorting = config.getFolderSorting(currentMimeType) - fileDirItems.sort() val listItems = getListItemsFromFileDirItems(fileDirItems) - runOnUiThread { - ItemsAdapter(this as SimpleActivity, listItems, this, mimetypes_list, false, items_fastscroller, null) { - tryOpenPathIntent((it as ListItem).path, false) - }.apply { - mimetypes_list.adapter = this - } - - if (areSystemAnimationsEnabled) { - mimetypes_list.scheduleLayoutAnimation() - } - - val dateFormat = config.dateFormat - val timeFormat = getTimeFormat() - items_fastscroller.setViews(mimetypes_list) { - val listItem = getRecyclerAdapter()?.listItems?.getOrNull(it) - items_fastscroller.updateBubbleText(listItem?.getBubbleText(this, dateFormat, timeFormat) ?: "") - } - } + setupAdapter(listItems) } } } - private fun getRecyclerAdapter() = mimetypes_list.adapter as? ItemsAdapter - override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu, menu) setupSearch(menu) @@ -121,9 +100,63 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { R.id.reduce_column_count -> reduceColumnCount() else -> return super.onOptionsItemSelected(item) } + return true } + override fun refreshFragment() {} + + override fun deleteFiles(files: ArrayList) {} + + override fun selectedPaths(paths: ArrayList) {} + + override fun searchQueryChanged(text: String) {} + + override fun setupDateTimeFormat() {} + + override fun setupFontSize() {} + + override fun toggleFilenameVisibility() { + config.displayFilenames = !config.displayFilenames + } + + override fun increaseColumnCount() {} + + override fun reduceColumnCount() {} + + override fun finishActMode() {} + + private fun setupSearch(menu: Menu) { + val searchManager = getSystemService(Context.SEARCH_SERVICE) as SearchManager + searchMenuItem = menu.findItem(R.id.search) + (searchMenuItem!!.actionView as SearchView).apply { + setSearchableInfo(searchManager.getSearchableInfo(componentName)) + isSubmitButtonEnabled = false + queryHint = getString(R.string.search) + setOnQueryTextListener(object : SearchView.OnQueryTextListener { + override fun onQueryTextSubmit(query: String) = false + + override fun onQueryTextChange(newText: String): Boolean { + if (isSearchOpen) { + } + return true + } + }) + } + + MenuItemCompat.setOnActionExpandListener(searchMenuItem, object : MenuItemCompat.OnActionExpandListener { + override fun onMenuItemActionExpand(item: MenuItem?): Boolean { + isSearchOpen = true + return true + } + + override fun onMenuItemActionCollapse(item: MenuItem?): Boolean { + isSearchOpen = false + return true + } + }) + } + private fun getProperFileDirItems(callback: (ArrayList) -> Unit) { val fileDirItems = ArrayList() val showHidden = config.shouldShowHidden @@ -187,6 +220,30 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { callback(fileDirItems) } + private fun setupAdapter(listItems: ArrayList) { + FileDirItem.sorting = config.getFolderSorting(currentMimeType) + listItems.sort() + + runOnUiThread { + ItemsAdapter(this as SimpleActivity, listItems, this, mimetypes_list, false, items_fastscroller, null) { + tryOpenPathIntent((it as ListItem).path, false) + }.apply { + mimetypes_list.adapter = this + } + + if (areSystemAnimationsEnabled) { + mimetypes_list.scheduleLayoutAnimation() + } + + val dateFormat = config.dateFormat + val timeFormat = getTimeFormat() + items_fastscroller.setViews(mimetypes_list) { + val listItem = getRecyclerAdapter()?.listItems?.getOrNull(it) + items_fastscroller.updateBubbleText(listItem?.getBubbleText(this, dateFormat, timeFormat) ?: "") + } + } + } + private fun getListItemsFromFileDirItems(fileDirItems: ArrayList): ArrayList { val listItems = ArrayList() fileDirItems.forEach { @@ -196,64 +253,17 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { return listItems } - private fun setupSearch(menu: Menu) { - val searchManager = getSystemService(Context.SEARCH_SERVICE) as SearchManager - searchMenuItem = menu.findItem(R.id.search) - (searchMenuItem!!.actionView as SearchView).apply { - setSearchableInfo(searchManager.getSearchableInfo(componentName)) - isSubmitButtonEnabled = false - queryHint = getString(R.string.search) - setOnQueryTextListener(object : SearchView.OnQueryTextListener { - override fun onQueryTextSubmit(query: String) = false - - override fun onQueryTextChange(newText: String): Boolean { - if (isSearchOpen) { - } - return true - } - }) - } - - MenuItemCompat.setOnActionExpandListener(searchMenuItem, object : MenuItemCompat.OnActionExpandListener { - override fun onMenuItemActionExpand(item: MenuItem?): Boolean { - isSearchOpen = true - return true - } - - override fun onMenuItemActionCollapse(item: MenuItem?): Boolean { - isSearchOpen = false - return true - } - }) - } + private fun getRecyclerAdapter() = mimetypes_list.adapter as? ItemsAdapter private fun showSortingDialog() { ChangeSortingDialog(this, currentMimeType) { + val listItems = getRecyclerAdapter()?.listItems + if (listItems != null) { + setupAdapter(listItems as ArrayList) + } } } - override fun refreshFragment() {} - - override fun deleteFiles(files: ArrayList) {} - - override fun selectedPaths(paths: ArrayList) {} - - override fun searchQueryChanged(text: String) {} - - override fun setupDateTimeFormat() {} - - override fun setupFontSize() {} - - override fun toggleFilenameVisibility() { - config.displayFilenames = !config.displayFilenames - } - - override fun increaseColumnCount() {} - - override fun reduceColumnCount() {} - - override fun finishActMode() {} - private fun changeViewType() { ChangeViewTypeDialog(this, currentMimeType, true) { } } From 98a5c5969e5a94623d1698f02fd6d3f9366ab7de Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 16:45:13 +0200 Subject: [PATCH 43/70] avoid showing some menu items at the storage fragment --- .../filemanager/pro/activities/MainActivity.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 934438ce..6f7c7b82 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 @@ -164,10 +164,11 @@ class MainActivity : SimpleActivity() { findItem(R.id.set_as_home).isVisible = currentFragment is ItemsFragment && currentFragment.currentPath != config.homeFolder findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden && currentFragment !is StorageFragment - findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden + findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden && currentFragment !is StorageFragment - findItem(R.id.increase_column_count).isVisible = currentViewType == VIEW_TYPE_GRID && config.fileColumnCnt < MAX_COLUMN_COUNT - findItem(R.id.reduce_column_count).isVisible = currentViewType == VIEW_TYPE_GRID && config.fileColumnCnt > 1 + findItem(R.id.increase_column_count).isVisible = + currentViewType == VIEW_TYPE_GRID && config.fileColumnCnt < MAX_COLUMN_COUNT && currentFragment !is StorageFragment + findItem(R.id.reduce_column_count).isVisible = currentViewType == VIEW_TYPE_GRID && config.fileColumnCnt > 1 && currentFragment !is StorageFragment } return true From 226040e26b2f1e56ddfe1bab760a51fd3af2651d Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 16:50:09 +0200 Subject: [PATCH 44/70] refresh mime types list on some menu actions --- .../pro/activities/MimeTypesActivity.kt | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt index e6ae160b..9154eb3d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt @@ -51,10 +51,7 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { ) ensureBackgroundThread { - getProperFileDirItems { fileDirItems -> - val listItems = getListItemsFromFileDirItems(fileDirItems) - setupAdapter(listItems) - } + reFetchItems() } } @@ -104,7 +101,9 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { return true } - override fun refreshFragment() {} + override fun refreshFragment() { + recreateList() + } override fun deleteFiles(files: ArrayList) {} @@ -118,9 +117,11 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { override fun toggleFilenameVisibility() { config.displayFilenames = !config.displayFilenames + getRecyclerAdapter()?.updateDisplayFilenamesInGrid() } - override fun increaseColumnCount() {} + override fun increaseColumnCount() { + } override fun reduceColumnCount() {} @@ -257,15 +258,28 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { private fun showSortingDialog() { ChangeSortingDialog(this, currentMimeType) { - val listItems = getRecyclerAdapter()?.listItems - if (listItems != null) { - setupAdapter(listItems as ArrayList) - } + recreateList() } } private fun changeViewType() { - ChangeViewTypeDialog(this, currentMimeType, true) { } + ChangeViewTypeDialog(this, currentMimeType, true) { + recreateList() + } + } + + private fun reFetchItems() { + getProperFileDirItems { fileDirItems -> + val listItems = getListItemsFromFileDirItems(fileDirItems) + setupAdapter(listItems) + } + } + + private fun recreateList() { + val listItems = getRecyclerAdapter()?.listItems + if (listItems != null) { + setupAdapter(listItems as ArrayList) + } } private fun tryToggleTemporarilyShowHidden() { @@ -280,5 +294,6 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { private fun toggleTemporarilyShowHidden(show: Boolean) { config.temporarilyShowHidden = show + reFetchItems() } } From cc66fbe65ca6bd39b6b5b81405ec52cfb7239080 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 17:06:25 +0200 Subject: [PATCH 45/70] allow changing the column count at mimetype activity --- .../pro/activities/MimeTypesActivity.kt | 28 ++++++++++++++++++- .../main/res/layout/activity_mimetypes.xml | 1 + 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt index 9154eb3d..da9a3638 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt @@ -12,6 +12,7 @@ import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.VIEW_TYPE_GRID import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.models.FileDirItem +import com.simplemobiletools.commons.views.MyGridLayoutManager import com.simplemobiletools.filemanager.pro.R import com.simplemobiletools.filemanager.pro.adapters.ItemsAdapter import com.simplemobiletools.filemanager.pro.dialogs.ChangeSortingDialog @@ -121,9 +122,18 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { } override fun increaseColumnCount() { + if (config.getFolderViewType(currentMimeType) == VIEW_TYPE_GRID) { + config.fileColumnCnt = ++(mimetypes_list.layoutManager as MyGridLayoutManager).spanCount + columnCountChanged() + } } - override fun reduceColumnCount() {} + override fun reduceColumnCount() { + if (config.getFolderViewType(currentMimeType) == VIEW_TYPE_GRID) { + config.fileColumnCnt = --(mimetypes_list.layoutManager as MyGridLayoutManager).spanCount + columnCountChanged() + } + } override fun finishActMode() {} @@ -282,6 +292,22 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { } } + private fun columnCountChanged() { + invalidateOptionsMenu() + getRecyclerAdapter()?.apply { + notifyItemRangeChanged(0, listItems.size) + calculateContentHeight(listItems) + } + } + + private fun calculateContentHeight(items: MutableList) { + val layoutManager = mimetypes_list.layoutManager as MyGridLayoutManager + val thumbnailHeight = layoutManager.getChildAt(0)?.height ?: 0 + val fullHeight = ((items.size - 1) / layoutManager.spanCount + 1) * thumbnailHeight + items_fastscroller.setContentHeight(fullHeight) + items_fastscroller.setScrollToY(mimetypes_list.computeVerticalScrollOffset()) + } + private fun tryToggleTemporarilyShowHidden() { if (config.temporarilyShowHidden) { toggleTemporarilyShowHidden(false) diff --git a/app/src/main/res/layout/activity_mimetypes.xml b/app/src/main/res/layout/activity_mimetypes.xml index 331eafff..f04eeadd 100644 --- a/app/src/main/res/layout/activity_mimetypes.xml +++ b/app/src/main/res/layout/activity_mimetypes.xml @@ -11,6 +11,7 @@ android:layout_height="match_parent" android:clipToPadding="false" android:layoutAnimation="@anim/layout_animation" + android:paddingTop="@dimen/small_margin" android:scrollbars="none" app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager" /> From fbcbe3275cb45733fe115b5f3b6ca1357cafffc6 Mon Sep 17 00:00:00 2001 From: spkprs Date: Wed, 13 Oct 2021 19:21:49 +0300 Subject: [PATCH 46/70] Update strings.xml --- app/src/main/res/values-el/strings.xml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index bb1e384a..ee1ef195 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -42,16 +42,16 @@ Επεξεργαστής αρχείων - Storage analysis - Images - Videos - Audio - Documents - Downloads - Archives - Others - free - Total storage: %s + Ανάλυση Αποθήκευσης + Εικόνες + Βίντεο + Ήχοι + Έγγραφα + Λήψεις + Αρχεία + Άλλα + ελεύθερα + Σύνολο: %s Ενεργοποιήστε την πρόσβαση ριζικού καταλόγου From f1e08743070653e826de7675c5f132581ee3bd12 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Wed, 13 Oct 2021 19:02:13 +0200 Subject: [PATCH 47/70] Dutch --- app/src/main/res/values-nl/strings.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index d60784c8..9931b450 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -42,16 +42,16 @@ Bewerken - Storage analysis - Images - Videos - Audio - Documents + Opslaganalyse + Afbeeldingen + Video + Geluid + Documenten Downloads - Archives - Others - free - Total storage: %s + Archieven + Overig + vrij + Totale opslag: %s Root-toegang inschakelen From a6976c4834d22efe63b99745228a59e997bfb69e Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 19:08:36 +0200 Subject: [PATCH 48/70] do not show empty files at the mimetype activity --- .../filemanager/pro/activities/MimeTypesActivity.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt index da9a3638..2b2031c0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt @@ -189,8 +189,12 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { return@queryCursor } - val path = cursor.getStringValue(MediaStore.Files.FileColumns.DATA) val size = cursor.getLongValue(MediaStore.Files.FileColumns.SIZE) + if (size == 0L) { + return@queryCursor + } + + val path = cursor.getStringValue(MediaStore.Files.FileColumns.DATA) val lastModified = cursor.getLongValue(MediaStore.Files.FileColumns.DATE_MODIFIED) * 1000 val mimetype = fullMimetype.substringBefore("/") From 9e25f74925402a058282d992f7298faebebc4af7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 19:08:54 +0200 Subject: [PATCH 49/70] fixing some mimetype file displaying related issues --- .../pro/activities/MimeTypesActivity.kt | 123 ++++++++++++++---- 1 file changed, 100 insertions(+), 23 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt index 2b2031c0..ac3e93a3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt @@ -8,11 +8,14 @@ import android.view.Menu import android.view.MenuItem import androidx.appcompat.widget.SearchView import androidx.core.view.MenuItemCompat +import androidx.recyclerview.widget.GridLayoutManager import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.VIEW_TYPE_GRID +import com.simplemobiletools.commons.helpers.VIEW_TYPE_LIST import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.models.FileDirItem import com.simplemobiletools.commons.views.MyGridLayoutManager +import com.simplemobiletools.commons.views.MyRecyclerView import com.simplemobiletools.filemanager.pro.R import com.simplemobiletools.filemanager.pro.adapters.ItemsAdapter import com.simplemobiletools.filemanager.pro.dialogs.ChangeSortingDialog @@ -28,8 +31,11 @@ import java.util.* class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { private var isSearchOpen = false - private var searchMenuItem: MenuItem? = null private var currentMimeType = "" + private var searchMenuItem: MenuItem? = null + private var zoomListener: MyRecyclerView.MyZoomListener? = null + private var storedItems = ArrayList() + private var currentViewType = VIEW_TYPE_LIST override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -122,14 +128,14 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { } override fun increaseColumnCount() { - if (config.getFolderViewType(currentMimeType) == VIEW_TYPE_GRID) { + if (currentViewType == VIEW_TYPE_GRID) { config.fileColumnCnt = ++(mimetypes_list.layoutManager as MyGridLayoutManager).spanCount columnCountChanged() } } override fun reduceColumnCount() { - if (config.getFolderViewType(currentMimeType) == VIEW_TYPE_GRID) { + if (currentViewType == VIEW_TYPE_GRID) { config.fileColumnCnt = --(mimetypes_list.layoutManager as MyGridLayoutManager).spanCount columnCountChanged() } @@ -235,27 +241,31 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { callback(fileDirItems) } - private fun setupAdapter(listItems: ArrayList) { + private fun addItems(items: ArrayList) { FileDirItem.sorting = config.getFolderSorting(currentMimeType) - listItems.sort() + items.sort() - runOnUiThread { - ItemsAdapter(this as SimpleActivity, listItems, this, mimetypes_list, false, items_fastscroller, null) { - tryOpenPathIntent((it as ListItem).path, false) - }.apply { - mimetypes_list.adapter = this - } + if (isDestroyed || isFinishing) { + return + } - if (areSystemAnimationsEnabled) { - mimetypes_list.scheduleLayoutAnimation() - } + storedItems = items + ItemsAdapter(this as SimpleActivity, storedItems, this, mimetypes_list, false, items_fastscroller, null) { + tryOpenPathIntent((it as ListItem).path, false) + }.apply { + setupZoomListener(zoomListener) + mimetypes_list.adapter = this + } - val dateFormat = config.dateFormat - val timeFormat = getTimeFormat() - items_fastscroller.setViews(mimetypes_list) { - val listItem = getRecyclerAdapter()?.listItems?.getOrNull(it) - items_fastscroller.updateBubbleText(listItem?.getBubbleText(this, dateFormat, timeFormat) ?: "") - } + if (areSystemAnimationsEnabled) { + mimetypes_list.scheduleLayoutAnimation() + } + + val dateFormat = config.dateFormat + val timeFormat = getTimeFormat() + items_fastscroller.setViews(mimetypes_list) { + val listItem = getRecyclerAdapter()?.listItems?.getOrNull(it) + items_fastscroller.updateBubbleText(listItem?.getBubbleText(this, dateFormat, timeFormat) ?: "") } } @@ -279,20 +289,27 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { private fun changeViewType() { ChangeViewTypeDialog(this, currentMimeType, true) { recreateList() + setupLayoutManager() } } private fun reFetchItems() { getProperFileDirItems { fileDirItems -> val listItems = getListItemsFromFileDirItems(fileDirItems) - setupAdapter(listItems) + + runOnUiThread { + addItems(listItems) + if (currentViewType != config.getFolderViewType(currentMimeType)) { + setupLayoutManager() + } + } } } private fun recreateList() { val listItems = getRecyclerAdapter()?.listItems if (listItems != null) { - setupAdapter(listItems as ArrayList) + addItems(listItems as ArrayList) } } @@ -312,6 +329,64 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { items_fastscroller.setScrollToY(mimetypes_list.computeVerticalScrollOffset()) } + private fun setupLayoutManager() { + if (config.getFolderViewType(currentMimeType) == VIEW_TYPE_GRID) { + currentViewType = VIEW_TYPE_GRID + setupGridLayoutManager() + } else { + currentViewType = VIEW_TYPE_LIST + setupListLayoutManager() + } + + mimetypes_list.adapter = null + initZoomListener() + addItems(storedItems) + } + + private fun setupGridLayoutManager() { + val layoutManager = mimetypes_list.layoutManager as MyGridLayoutManager + layoutManager.spanCount = config.fileColumnCnt ?: 3 + + layoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() { + override fun getSpanSize(position: Int): Int { + return if (getRecyclerAdapter()?.isASectionTitle(position) == true) { + layoutManager.spanCount + } else { + 1 + } + } + } + } + + private fun setupListLayoutManager() { + val layoutManager = mimetypes_list.layoutManager as MyGridLayoutManager + layoutManager.spanCount = 1 + zoomListener = null + } + + private fun initZoomListener() { + if (config.getFolderViewType(currentMimeType) == VIEW_TYPE_GRID) { + val layoutManager = mimetypes_list.layoutManager as MyGridLayoutManager + zoomListener = object : MyRecyclerView.MyZoomListener { + override fun zoomIn() { + if (layoutManager.spanCount > 1) { + reduceColumnCount() + getRecyclerAdapter()?.finishActMode() + } + } + + override fun zoomOut() { + if (layoutManager.spanCount < MAX_COLUMN_COUNT) { + increaseColumnCount() + getRecyclerAdapter()?.finishActMode() + } + } + } + } else { + zoomListener = null + } + } + private fun tryToggleTemporarilyShowHidden() { if (config.temporarilyShowHidden) { toggleTemporarilyShowHidden(false) @@ -324,6 +399,8 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { private fun toggleTemporarilyShowHidden(show: Boolean) { config.temporarilyShowHidden = show - reFetchItems() + ensureBackgroundThread { + reFetchItems() + } } } From 149a8e628d287d92daedb9224e0843c21b74cd44 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 19:45:37 +0200 Subject: [PATCH 50/70] add file deletion from mimetype activity --- .../filemanager/pro/activities/MimeTypesActivity.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt index ac3e93a3..24ccd578 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt @@ -112,7 +112,15 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { recreateList() } - override fun deleteFiles(files: ArrayList) {} + override fun deleteFiles(files: ArrayList) { + deleteFiles(files, false) { + if (!it) { + runOnUiThread { + toast(R.string.unknown_error_occurred) + } + } + } + } override fun selectedPaths(paths: ArrayList) {} From 5b1d6ea32b95f94b3ab6b466b8885c25ce54e639 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 20:03:40 +0200 Subject: [PATCH 51/70] refresh Storage fragment data on resume --- .../pro/activities/MainActivity.kt | 2 +- .../pro/adapters/ViewPagerAdapter.kt | 2 +- .../pro/fragments/ItemsFragment.kt | 2 +- .../pro/fragments/MyViewPagerFragment.kt | 2 +- .../pro/fragments/RecentsFragment.kt | 2 +- .../pro/fragments/StorageFragment.kt | 80 ++++++++++--------- 6 files changed, 47 insertions(+), 43 deletions(-) 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 6f7c7b82..12e356e4 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 @@ -98,7 +98,7 @@ class MainActivity : SimpleActivity() { } getAllFragments().forEach { - it?.setupColors(config.textColor, config.primaryColor) + it?.onResume(config.textColor, config.primaryColor) } if (storedFontSize != config.fontSize) { diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ViewPagerAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ViewPagerAdapter.kt index 36ced7d7..95fa3e75 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ViewPagerAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ViewPagerAdapter.kt @@ -20,7 +20,7 @@ class ViewPagerAdapter(val activity: SimpleActivity) : PagerAdapter() { (view as MyViewPagerFragment).apply { setupFragment(activity) - setupColors(activity.config.textColor, activity.config.primaryColor) + onResume(activity.config.textColor, activity.config.primaryColor) } return view 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 8fd14aac..4b0cf9fb 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 @@ -47,7 +47,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF } } - override fun setupColors(textColor: Int, primaryColor: Int) { + override fun onResume(textColor: Int, primaryColor: Int) { context!!.updateTextColors(this) items_fastscroller.updatePrimaryColor() storedItems = ArrayList() diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/MyViewPagerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/MyViewPagerFragment.kt index f254ca38..28d501a7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/MyViewPagerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/MyViewPagerFragment.kt @@ -36,7 +36,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet) abstract fun setupFragment(activity: SimpleActivity) - abstract fun setupColors(textColor: Int, primaryColor: Int) + abstract fun onResume(textColor: Int, primaryColor: Int) abstract fun refreshFragment() } 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 66098d98..297b6975 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 @@ -64,7 +64,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage } } - override fun setupColors(textColor: Int, primaryColor: Int) { + override fun onResume(textColor: Int, primaryColor: Int) { recents_placeholder.setTextColor(textColor) getRecyclerAdapter()?.apply { diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index 669850d3..1a2cceb3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -25,38 +25,7 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage override fun setupFragment(activity: SimpleActivity) { total_space.text = String.format(context.getString(R.string.total_storage), "…") - - ensureBackgroundThread { - getMainStorageStats(activity) - - val filesSize = getSizesByMimeType() - val imagesSize = filesSize[IMAGES]!! - val videosSize = filesSize[VIDEOS]!! - val audioSize = filesSize[AUDIO]!! - val documentsSize = filesSize[DOCUMENTS]!! - val archivesSize = filesSize[ARCHIVES]!! - val othersSize = filesSize[OTHERS]!! - - activity.runOnUiThread { - images_size.text = imagesSize.formatSize() - images_progressbar.progress = (imagesSize / SIZE_DIVIDER).toInt() - - videos_size.text = videosSize.formatSize() - videos_progressbar.progress = (videosSize / SIZE_DIVIDER).toInt() - - audio_size.text = audioSize.formatSize() - audio_progressbar.progress = (audioSize / SIZE_DIVIDER).toInt() - - documents_size.text = documentsSize.formatSize() - documents_progressbar.progress = (documentsSize / SIZE_DIVIDER).toInt() - - archives_size.text = archivesSize.formatSize() - archives_progressbar.progress = (archivesSize / SIZE_DIVIDER).toInt() - - others_size.text = othersSize.formatSize() - others_progressbar.progress = (othersSize / SIZE_DIVIDER).toInt() - } - } + getSizes() free_space_holder.setOnClickListener { try { @@ -77,7 +46,8 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage override fun refreshFragment() {} - override fun setupColors(textColor: Int, primaryColor: Int) { + override fun onResume(textColor: Int, primaryColor: Int) { + getSizes() context.updateTextColors(storage_fragment) main_storage_usage_progressbar.setIndicatorColor(primaryColor) @@ -115,6 +85,40 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage } } + private fun getSizes() { + ensureBackgroundThread { + getMainStorageStats(context) + + val filesSize = getSizesByMimeType() + val imagesSize = filesSize[IMAGES]!! + val videosSize = filesSize[VIDEOS]!! + val audioSize = filesSize[AUDIO]!! + val documentsSize = filesSize[DOCUMENTS]!! + val archivesSize = filesSize[ARCHIVES]!! + val othersSize = filesSize[OTHERS]!! + + post { + images_size.text = imagesSize.formatSize() + images_progressbar.progress = (imagesSize / SIZE_DIVIDER).toInt() + + videos_size.text = videosSize.formatSize() + videos_progressbar.progress = (videosSize / SIZE_DIVIDER).toInt() + + audio_size.text = audioSize.formatSize() + audio_progressbar.progress = (audioSize / SIZE_DIVIDER).toInt() + + documents_size.text = documentsSize.formatSize() + documents_progressbar.progress = (documentsSize / SIZE_DIVIDER).toInt() + + archives_size.text = archivesSize.formatSize() + archives_progressbar.progress = (archivesSize / SIZE_DIVIDER).toInt() + + others_size.text = othersSize.formatSize() + others_progressbar.progress = (othersSize / SIZE_DIVIDER).toInt() + } + } + } + private fun getSizesByMimeType(): HashMap { val uri = MediaStore.Files.getContentUri("external") val projection = arrayOf( @@ -177,20 +181,20 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage } @SuppressLint("NewApi") - private fun getMainStorageStats(activity: SimpleActivity) { - val externalDirs = activity.getExternalFilesDirs(null) - val storageManager = activity.getSystemService(AppCompatActivity.STORAGE_SERVICE) as StorageManager + private fun getMainStorageStats(context: Context) { + val externalDirs = context.getExternalFilesDirs(null) + val storageManager = context.getSystemService(AppCompatActivity.STORAGE_SERVICE) as StorageManager externalDirs.forEach { file -> val storageVolume = storageManager.getStorageVolume(file) ?: return if (storageVolume.isPrimary) { // internal storage - val storageStatsManager = activity.getSystemService(AppCompatActivity.STORAGE_STATS_SERVICE) as StorageStatsManager + val storageStatsManager = context.getSystemService(AppCompatActivity.STORAGE_STATS_SERVICE) as StorageStatsManager val uuid = StorageManager.UUID_DEFAULT val totalSpace = storageStatsManager.getTotalBytes(uuid) val freeSpace = storageStatsManager.getFreeBytes(uuid) - activity.runOnUiThread { + post { arrayOf( main_storage_usage_progressbar, images_progressbar, videos_progressbar, audio_progressbar, documents_progressbar, archives_progressbar, others_progressbar From a74315fc6680f91ae845ff2f7d99c4a1b5c762b1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 20:12:30 +0200 Subject: [PATCH 52/70] properly handle Others mimetype files when needed --- .../filemanager/pro/activities/MimeTypesActivity.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt index 24ccd578..15516578 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt @@ -238,6 +238,14 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { fileDirItems.add(FileDirItem(path, name, false, 0, size, lastModified)) } } + OTHERS -> { + if (mimetype != "image" && mimetype != "video" && mimetype != "audio" && mimetype != "text" && + !extraAudioMimeTypes.contains(fullMimetype) && !extraDocumentMimeTypes.contains(fullMimetype) && + !archiveMimeTypes.contains(fullMimetype) + ) { + fileDirItems.add(FileDirItem(path, name, false, 0, size, lastModified)) + } + } } } catch (e: Exception) { } From 8e31bc2e76514055dc7b2fef17b2a728fea73151 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 20:32:54 +0200 Subject: [PATCH 53/70] adding Search at the mimetype activity --- .../pro/activities/MimeTypesActivity.kt | 57 ++++++++++++++++++- .../pro/fragments/ItemsFragment.kt | 43 +++++++------- .../main/res/layout/activity_mimetypes.xml | 30 ++++++++++ 3 files changed, 109 insertions(+), 21 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt index 15516578..7d07b9c8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt @@ -32,6 +32,7 @@ import java.util.* class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { private var isSearchOpen = false private var currentMimeType = "" + private var lastSearchedText = "" private var searchMenuItem: MenuItem? = null private var zoomListener: MyRecyclerView.MyZoomListener? = null private var storedItems = ArrayList() @@ -124,7 +125,44 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { override fun selectedPaths(paths: ArrayList) {} - override fun searchQueryChanged(text: String) {} + override fun searchQueryChanged(text: String) { + val searchText = text.trim() + lastSearchedText = searchText + when { + searchText.isEmpty() -> { + mimetypes_list.beVisible() + getRecyclerAdapter()?.updateItems(storedItems) + mimetypes_placeholder.beGone() + mimetypes_placeholder_2.beGone() + } + searchText.length == 1 -> { + mimetypes_list.beGone() + mimetypes_placeholder.beVisible() + mimetypes_placeholder_2.beVisible() + } + else -> { + ensureBackgroundThread { + if (lastSearchedText != searchText) { + return@ensureBackgroundThread + } + + val listItems = storedItems.filter { it.name.contains(searchText, true) } as ArrayList + + runOnUiThread { + getRecyclerAdapter()?.updateItems(listItems, text) + mimetypes_list.beVisibleIf(listItems.isNotEmpty()) + mimetypes_placeholder.beVisibleIf(listItems.isEmpty()) + mimetypes_placeholder_2.beGone() + + mimetypes_list.onGlobalLayout { + items_fastscroller.setScrollToY(mimetypes_list.computeVerticalScrollOffset()) + calculateContentHeight(listItems) + } + } + } + } + } + } override fun setupDateTimeFormat() {} @@ -163,6 +201,7 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { override fun onQueryTextChange(newText: String): Boolean { if (isSearchOpen) { + searchQueryChanged(newText) } return true } @@ -172,16 +211,32 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { MenuItemCompat.setOnActionExpandListener(searchMenuItem, object : MenuItemCompat.OnActionExpandListener { override fun onMenuItemActionExpand(item: MenuItem?): Boolean { isSearchOpen = true + searchOpened() return true } override fun onMenuItemActionCollapse(item: MenuItem?): Boolean { isSearchOpen = false + searchClosed() return true } }) } + fun searchOpened() { + isSearchOpen = true + lastSearchedText = "" + } + + fun searchClosed() { + isSearchOpen = false + lastSearchedText = "" + + mimetypes_list.beVisible() + mimetypes_placeholder.beGone() + mimetypes_placeholder_2.beGone() + } + private fun getProperFileDirItems(callback: (ArrayList) -> Unit) { val fileDirItems = ArrayList() val showHidden = config.shouldShowHidden 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 4b0cf9fb..008576da 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 @@ -28,7 +28,8 @@ import java.io.File import java.util.* import kotlin.collections.ArrayList -class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet), ItemOperationsListener, Breadcrumbs.BreadcrumbsListener { +class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet), ItemOperationsListener, + Breadcrumbs.BreadcrumbsListener { private var showHidden = false private var skipItemUpdating = false private var isSearchOpen = false @@ -118,8 +119,10 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF breadcrumbs.updateFontSize(context!!.getTextSize()) } - ItemsAdapter(activity as SimpleActivity, storedItems, this, items_list, isPickMultipleIntent, items_fastscroller, - items_swipe_refresh) { + ItemsAdapter( + activity as SimpleActivity, storedItems, this, items_list, isPickMultipleIntent, items_fastscroller, + items_swipe_refresh + ) { if ((it as? ListItem)?.isSectionTitle == true) { openDirectory(it.mPath) searchClosed() @@ -264,24 +267,24 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF override fun searchQueryChanged(text: String) { val searchText = text.trim() lastSearchedText = searchText - ensureBackgroundThread { - if (context == null) { - return@ensureBackgroundThread - } + if (context == null) { + return + } - when { - searchText.isEmpty() -> activity?.runOnUiThread { - items_list.beVisible() - getRecyclerAdapter()?.updateItems(storedItems) - items_placeholder.beGone() - items_placeholder_2.beGone() - } - searchText.length == 1 -> activity?.runOnUiThread { - items_list.beGone() - items_placeholder.beVisible() - items_placeholder_2.beVisible() - } - else -> { + when { + searchText.isEmpty() -> { + items_list.beVisible() + getRecyclerAdapter()?.updateItems(storedItems) + items_placeholder.beGone() + items_placeholder_2.beGone() + } + searchText.length == 1 -> { + items_list.beGone() + items_placeholder.beVisible() + items_placeholder_2.beVisible() + } + else -> { + ensureBackgroundThread { val files = searchFiles(searchText, currentPath) files.sortBy { it.getParentPath() } diff --git a/app/src/main/res/layout/activity_mimetypes.xml b/app/src/main/res/layout/activity_mimetypes.xml index f04eeadd..3b377baf 100644 --- a/app/src/main/res/layout/activity_mimetypes.xml +++ b/app/src/main/res/layout/activity_mimetypes.xml @@ -5,6 +5,36 @@ android:layout_width="wrap_content" android:layout_height="wrap_content"> + + + + Date: Wed, 13 Oct 2021 20:41:35 +0200 Subject: [PATCH 54/70] show the storage analysis tab on Android 8+ only --- .../filemanager/pro/activities/MainActivity.kt | 2 +- .../filemanager/pro/dialogs/ManageVisibleTabsDialog.kt | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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 12e356e4..7c98a81b 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 @@ -63,7 +63,7 @@ class MainActivity : SimpleActivity() { setContentView(R.layout.activity_main) appLaunched(BuildConfig.APPLICATION_ID) - if (!config.wasStorageAnalysisTabAdded) { + if (!config.wasStorageAnalysisTabAdded && isOreoPlus()) { config.wasStorageAnalysisTabAdded = true config.showTabs += TAB_STORAGE_ANALYSIS } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/ManageVisibleTabsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/ManageVisibleTabsDialog.kt index 37f8abc2..b1642c62 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/ManageVisibleTabsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/ManageVisibleTabsDialog.kt @@ -2,14 +2,17 @@ package com.simplemobiletools.filemanager.pro.dialogs import androidx.appcompat.app.AlertDialog import com.simplemobiletools.commons.activities.BaseSimpleActivity +import com.simplemobiletools.commons.extensions.beGone import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.helpers.TAB_FILES import com.simplemobiletools.commons.helpers.TAB_RECENT_FILES import com.simplemobiletools.commons.helpers.TAB_STORAGE_ANALYSIS +import com.simplemobiletools.commons.helpers.isOreoPlus import com.simplemobiletools.commons.views.MyAppCompatCheckbox import com.simplemobiletools.filemanager.pro.R import com.simplemobiletools.filemanager.pro.extensions.config import com.simplemobiletools.filemanager.pro.helpers.ALL_TABS_MASK +import kotlinx.android.synthetic.main.dialog_manage_visible_tabs.view.* class ManageVisibleTabsDialog(val activity: BaseSimpleActivity) { private var view = activity.layoutInflater.inflate(R.layout.dialog_manage_visible_tabs, null) @@ -22,6 +25,10 @@ class ManageVisibleTabsDialog(val activity: BaseSimpleActivity) { put(TAB_STORAGE_ANALYSIS, R.id.manage_visible_tabs_storage_analysis) } + if (!isOreoPlus()) { + view.manage_visible_tabs_storage_analysis.beGone() + } + val showTabs = activity.config.showTabs for ((key, value) in tabs) { view.findViewById(value).isChecked = showTabs and key != 0 From 60ecf449751a6257635dd1853f25164525ed05ad Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 22:50:42 +0200 Subject: [PATCH 55/70] refetch mimetype items at refreshing, dont just recreate the list --- .../filemanager/pro/activities/MimeTypesActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt index 7d07b9c8..cf5aba49 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt @@ -110,7 +110,7 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { } override fun refreshFragment() { - recreateList() + reFetchItems() } override fun deleteFiles(files: ArrayList) { From 3f449cd515ca24fd81dba694caef9ea5ba956372 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 22:58:15 +0200 Subject: [PATCH 56/70] show a placeholder if no files are shown at the mimetypes list --- .../filemanager/pro/activities/MimeTypesActivity.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt index cf5aba49..6d89e220 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt @@ -132,7 +132,7 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { searchText.isEmpty() -> { mimetypes_list.beVisible() getRecyclerAdapter()?.updateItems(storedItems) - mimetypes_placeholder.beGone() + mimetypes_placeholder.beGoneIf(storedItems.isNotEmpty()) mimetypes_placeholder_2.beGone() } searchText.length == 1 -> { @@ -233,7 +233,7 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { lastSearchedText = "" mimetypes_list.beVisible() - mimetypes_placeholder.beGone() + mimetypes_placeholder.beGoneIf(storedItems.isNotEmpty()) mimetypes_placeholder_2.beGone() } @@ -338,6 +338,8 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { val listItem = getRecyclerAdapter()?.listItems?.getOrNull(it) items_fastscroller.updateBubbleText(listItem?.getBubbleText(this, dateFormat, timeFormat) ?: "") } + + mimetypes_placeholder.beVisibleIf(items.isEmpty()) } private fun getListItemsFromFileDirItems(fileDirItems: ArrayList): ArrayList { From 2f73baf13ecd15d22fb35e8422ba3875cd349bf0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 13 Oct 2021 23:04:28 +0200 Subject: [PATCH 57/70] change archives color from white to teal for visibility with light bgs --- .../filemanager/pro/fragments/StorageFragment.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index 1a2cceb3..bab9e9a4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -69,9 +69,9 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage documents_progressbar.setIndicatorColor(yellowColor) documents_progressbar.trackColor = yellowColor.adjustAlpha(0.3f) - val whiteColor = context.resources.getColor(R.color.md_grey_white) - archives_progressbar.setIndicatorColor(whiteColor) - archives_progressbar.trackColor = whiteColor.adjustAlpha(0.3f) + val tealColor = context.resources.getColor(R.color.md_teal_700) + archives_progressbar.setIndicatorColor(tealColor) + archives_progressbar.trackColor = tealColor.adjustAlpha(0.3f) val pinkColor = context.resources.getColor(R.color.md_pink_700) others_progressbar.setIndicatorColor(pinkColor) From f9cc9dd90c0a13fefba693503fbf1a57d1bce66a Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 14 Oct 2021 21:46:35 +0200 Subject: [PATCH 58/70] avoid adding the storage analysis tab at fresh installs --- .../filemanager/pro/activities/MainActivity.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 7c98a81b..bbe10230 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 @@ -65,7 +65,9 @@ class MainActivity : SimpleActivity() { if (!config.wasStorageAnalysisTabAdded && isOreoPlus()) { config.wasStorageAnalysisTabAdded = true - config.showTabs += TAB_STORAGE_ANALYSIS + if (config.showTabs and TAB_STORAGE_ANALYSIS == 0) { + config.showTabs += TAB_STORAGE_ANALYSIS + } } setupTabColors(config.lastUsedViewPagerPage) From d98084a90837b9c7fb458e2e7fd2736c93decd74 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 14 Oct 2021 21:48:52 +0200 Subject: [PATCH 59/70] update version to 6.10.0 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c06f38a8..c88a74a7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,8 +16,8 @@ android { applicationId "com.simplemobiletools.filemanager.pro" minSdkVersion 21 targetSdkVersion 29 - versionCode 108 - versionName "6.9.4" + versionCode 109 + versionName "6.10.0" multiDexEnabled true setProperty("archivesBaseName", "file-manager") vectorDrawables.useSupportLibrary = true From f7bdfd316269aeb7e84babdb0c44a649dbc3ac2c Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 14 Oct 2021 21:49:00 +0200 Subject: [PATCH 60/70] updating changelog --- CHANGELOG.md | 10 +++++++++- fastlane/metadata/android/en-US/changelogs/109.txt | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/109.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index e636b643..b00faf77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,15 @@ Changelog ========== -Version 6.10.0 *(2021-08-27)* +Version 6.10.0 *(2021-10-14)* +---------------------------- + + * Added a Storage Analyzer tab on Android 8+ + * Allow saving any file type with the Save as action + * Some Android 11 related file operation improvements + * Couple stability, translation and UX improvements + +Version 6.9.4 *(2021-08-27)* ---------------------------- * Rewrote the current folder path into a 1 liner diff --git a/fastlane/metadata/android/en-US/changelogs/109.txt b/fastlane/metadata/android/en-US/changelogs/109.txt new file mode 100644 index 00000000..219250d3 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/109.txt @@ -0,0 +1,4 @@ + * Added a Storage Analyzer tab on Android 8+ + * Allow saving any file type with the Save as action + * Some Android 11 related file operation improvements + * Couple stability, translation and UX improvements From 684e952eeb2077477d11bb5c53e79188b6c734b6 Mon Sep 17 00:00:00 2001 From: lavenderwaste <70259286+lavenderwaste@users.noreply.github.com> Date: Thu, 14 Oct 2021 23:26:24 +0000 Subject: [PATCH 61/70] Update strings.xml updating spanish strings --- app/src/main/res/values-es/strings.xml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index b53cead5..14c0f1f8 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -11,8 +11,8 @@ Por favor, seleccione un archivo de audio Buscar carpeta Esta operación solo funciona en dispositivos rooteados - Recents - Show recents + Recientes + Mostrar recientes Abrir como @@ -42,20 +42,20 @@ Editor de archivos - Storage analysis - Images + Análisis de almacenamiento + Imágenes Videos Audio - Documents - Downloads - Archives - Others - free - Total storage: %s + Documentos + Descargas + Archivos + Otros + gratis + Almacenamiento total: %s Activar acceso root - Require pressing Back twice to leave the app + Se requiere presionar el botón atras dos veces para salir de la app From c7ae139ad618eb860272c18f3d7be9cb8bb791c1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 16 Oct 2021 09:47:45 +0200 Subject: [PATCH 62/70] adding some crashfixes --- .../filemanager/pro/activities/ReadTextActivity.kt | 7 ++++++- .../filemanager/pro/fragments/StorageFragment.kt | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/ReadTextActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/ReadTextActivity.kt index 7b2eb97d..408aa936 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/ReadTextActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/ReadTextActivity.kt @@ -231,7 +231,12 @@ class ReadTextActivity : SimpleActivity() { filePath = uri.path!! val file = File(filePath) if (file.exists()) { - file.readText() + try { + file.readText() + } catch (e: Exception) { + showErrorToast(e) + "" + } } else { toast(R.string.unknown_error_occurred) "" diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt index bab9e9a4..e6b0f785 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/StorageFragment.kt @@ -11,6 +11,7 @@ import android.util.AttributeSet import androidx.appcompat.app.AppCompatActivity import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.ensureBackgroundThread +import com.simplemobiletools.commons.helpers.isOreoPlus import com.simplemobiletools.filemanager.pro.R import com.simplemobiletools.filemanager.pro.activities.MimeTypesActivity import com.simplemobiletools.filemanager.pro.activities.SimpleActivity @@ -86,6 +87,10 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage } private fun getSizes() { + if (!isOreoPlus()) { + return + } + ensureBackgroundThread { getMainStorageStats(context) From e5cfa9ee9a50a50e646aeaad53b0180bb99d7fef Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 16 Oct 2021 09:50:39 +0200 Subject: [PATCH 63/70] update version to 6.10.1 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c88a74a7..d0459fe6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,8 +16,8 @@ android { applicationId "com.simplemobiletools.filemanager.pro" minSdkVersion 21 targetSdkVersion 29 - versionCode 109 - versionName "6.10.0" + versionCode 110 + versionName "6.10.1" multiDexEnabled true setProperty("archivesBaseName", "file-manager") vectorDrawables.useSupportLibrary = true From cabcfb8cc9da3bf0a73c6faef4c6ea253654c461 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 16 Oct 2021 09:50:46 +0200 Subject: [PATCH 64/70] updating changelog --- CHANGELOG.md | 5 +++++ fastlane/metadata/android/en-US/changelogs/110.txt | 1 + 2 files changed, 6 insertions(+) create mode 100644 fastlane/metadata/android/en-US/changelogs/110.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index b00faf77..b80d6ec0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Changelog ========== +Version 6.10.1 *(2021-10-16)* +---------------------------- + + * Added some stability and translation improvements + Version 6.10.0 *(2021-10-14)* ---------------------------- diff --git a/fastlane/metadata/android/en-US/changelogs/110.txt b/fastlane/metadata/android/en-US/changelogs/110.txt new file mode 100644 index 00000000..049bce3d --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/110.txt @@ -0,0 +1 @@ + * Added some stability and translation improvements From 6a0d431a9f90b86fa664bfa1bdb1b6299d320dce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Marques?= Date: Sun, 31 Oct 2021 16:20:38 +0000 Subject: [PATCH 65/70] Update strings.xml --- app/src/main/res/values-pt/strings.xml | 46 +++++++++++++------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 8e92b414..bdf99a53 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -11,7 +11,7 @@ Selecione um ficheiro de áudio Pesquisar pasta Esta operação apenas funciona em dispositivos com root - Recents + Recentes Mostrar recentes @@ -23,15 +23,15 @@ Outro tipo - Comprimir - Descomprimir - Comprimir como - A comprimir… - A descomprimir… - Compressão terminada - Descompressão terminada - Falha ao comprimir - Falha ao descomprimir + Compactar + Descompactar + Compactar como + A compactar… + A descompactar… + Compactação terminada + Descompactação terminada + Falha ao compactar + Falha ao descompactar Gerir favoritos @@ -42,20 +42,20 @@ Editor de ficheiros - Storage analysis - Images - Videos - Audio - Documents - Downloads - Archives - Others - free - Total storage: %s + Análise ao armazenamento + Imagens + Vídeos + Áudio + Documentos + Descargas + Arquivos + Outros + livre + Armazenamento total: %s Ativar acesso root - Require pressing Back twice to leave the app + Tem que premir duas vezes a tecla Back para sair da aplicação @@ -85,10 +85,10 @@ Não contém anúncios nem permissões desnecessárias. Disponibiliza um tema escuro e é totalmente \'open source\'. - Consulte o conjunto completo das aplicações Simple Tools aqui: + Consulte o conjunto completo de aplicações Simple Tools aqui: https://www.simplemobiletools.com - Site específico da aplicação Simple File Manager Pro: + Site da aplicação Simple File Manager Pro: https://www.simplemobiletools.com/filemanager Facebook: From 93c15f8bb775c31664d031825b7ec2b9e434a471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Marques?= Date: Mon, 1 Nov 2021 16:53:38 +0000 Subject: [PATCH 66/70] Update strings.xml --- app/src/main/res/values-pt/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index bdf99a53..bc93f98d 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -55,7 +55,7 @@ Ativar acesso root - Tem que premir duas vezes a tecla Back para sair da aplicação + Premir duas vezes a tecla Back para sair da aplicação From 1eb61fa4ef04f5cd0dac790a756461e6306dad26 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 4 Nov 2021 20:34:46 +0100 Subject: [PATCH 67/70] updating a spanish string --- app/src/main/res/values-es/strings.xml | 2 +- build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 14c0f1f8..d1593f10 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -50,7 +50,7 @@ Descargas Archivos Otros - gratis + libre Almacenamiento total: %s diff --git a/build.gradle b/build.gradle index 1d186814..9b82dbc6 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.0.2' + classpath 'com.android.tools.build:gradle:7.0.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong From 466decd51acd2e22e35bf5f7016e42047ee4f4bd Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Mon, 8 Nov 2021 20:17:35 +0100 Subject: [PATCH 68/70] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e9c3061e..bda7e7bb 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ Contains no ads or unnecessary permissions. It is fully opensource, provides cus This app is just one piece of a bigger series of apps. You can find the rest of them at https://www.simplemobiletools.com -Get it on Google Play -Get it on F-Droid +Get it on Google Play +Get it on F-Droid
App image From db8d4ee781b7cd9166f0679a06ef5816580400cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuz=20Ersen?= Date: Fri, 12 Nov 2021 18:05:30 +0000 Subject: [PATCH 69/70] Update strings.xml (Turkish) --- app/src/main/res/values-tr/strings.xml | 34 +++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 6e5f85e3..404d852e 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -11,8 +11,8 @@ Lütfen bir ses dosyası seçin Klasör ara Bu işlem sadece rootlu cihazlarda çalışır - Recents - Show recents + Son dosyalar + Son dosyaları göster Farklı aç @@ -42,20 +42,20 @@ Dosya Düzenleyici - Storage analysis - Images - Videos - Audio - Documents - Downloads - Archives - Others - free - Total storage: %s + Depolama analizi + Resimler + Videolar + Sesler + Belgeler + İndirilenler + Arşivler + Diğerleri + boş + Toplam depolama: %s Root erişimini etkinleştir - Require pressing Back twice to leave the app + Uygulamadan çıkmak için Geri tuşuna iki kez basmayı gerektir @@ -65,7 +65,7 @@ Günlük kullanım için hafif ve hızlı bir dosya yöneticisi. Kullanıcı dostu bir arama işlevi sunar, ayrıca ana klasörü özelleştirebilir ve hızlı erişim için favori klasörleri seçebilirsiniz. - Uygulama, gizli öğeleri parolayla koruma, dosyaları silme veya tüm uygulama gibi güvenlikle ilgili çok sayıda güçlü işlev içerir. Verilerinizi gizli tutmak için desen, pin veya parmak izi kullanmayı seçebilirsiniz. + Uygulama, gizli ögeleri parolayla koruma, dosyaları silme veya tüm uygulama gibi güvenlikle ilgili çok sayıda güçlü işlev içerir. Verilerinizi gizli tutmak için desen, pin veya parmak izi kullanmayı seçebilirsiniz. Bu modern dosya düzenleyici, root dosyalarının, SD kartların ve USB cihazlarının hızlı taranmasını destekler. @@ -77,11 +77,11 @@ Bir dosya veya klasör yolunu hızlı bir şekilde almak için, uzun basıp panoya kopyalayarak onu kolayca seçebilirsiniz. - Favori öğelerinize hızlı bir şekilde erişmek için kullanışlı masaüstü kısayolları oluşturabilirsiniz. + Favori ögelerinize hızlı bir şekilde erişmek için kullanışlı masaüstü kısayolları oluşturabilirsiniz. - Belgeleri yazdırmak, düzenlemek veya gerektiğinde yakınlaştırma hareketlerini kullanarak kolayca okumak için kullanabileceğiniz hafif bir dosya düzenleyici içerir. + Belgeleri yazdırmak, düzenlemek veya gerektiğinde yakınlaştırma hareketlerini kullanarak kolayca okumak için kullanabileceğiniz hafif bir dosya düzenleyici içerir. - Varsayılan olarak materyal tasarım ve koyu tema ile birlikte gelir, kolay kullanım için harika bir kullanıcı deneyimi sağlar. İnternet erişiminin olmaması size diğer uygulamalardan daha fazla gizlilik, güvenlik ve istikrar sağlar. + Varsayılan olarak materyal tasarım ve koyu tema ile birlikte gelir, kolay kullanım için harika bir kullanıcı deneyimi sağlar. İnternet erişiminin olmaması size diğer uygulamalardan daha fazla gizlilik, güvenlik ve istikrar sağlar. Reklam veya gereksiz izinler içermez. Tamamen açık kaynaktır, özelleştirilebilir renkler sunar. From 9baf4bb935c99cd2d4d2939bccced19fa4d801ba Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 12 Nov 2021 21:48:58 +0100 Subject: [PATCH 70/70] moving the galician string into the proper place --- app/src/main/res/{values-gl => values-gl/strings.xml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename app/src/main/res/{values-gl => values-gl/strings.xml} (99%) diff --git a/app/src/main/res/values-gl b/app/src/main/res/values-gl/strings.xml similarity index 99% rename from app/src/main/res/values-gl rename to app/src/main/res/values-gl/strings.xml index c73bb29e..f08e4f66 100644 --- a/app/src/main/res/values-gl +++ b/app/src/main/res/values-gl/strings.xml @@ -65,11 +65,11 @@ Podes crear accesos directos nas pantallas para acceder rapidamente aos teus elementos favoritos. Contén un editor de ficheiros lixeiro que pode empregar para imprimir documentos, editalos ou lelos facilmente usando xestos de zoom, sempre que sexa necesario. - + E, por último, vén cun deseño material e un tema escuro de xeito predeterminado, fornece unha excelente experiencia de usuario cun uso sinxelo. Ao non requirir acceso a Internet, tes máis privacidade, seguridade e estabilidade Non contén anuncios nin permisos innecesarios. Dispón dun tema escuro e é totalmente de código aberto. - + Visita a páxina nesta ligazón: https://www.simplemobiletools.com