From 6a94feaf0ee00c86e8c6935c241792393067f216 Mon Sep 17 00:00:00 2001 From: Paul Akhamiogu Date: Wed, 25 Aug 2021 00:37:18 +0100 Subject: [PATCH 01/37] first attempt --- app/build.gradle | 3 +- .../filemanager/pro/extensions/Context.kt | 3 +- .../pro/fragments/ItemsFragment.kt | 61 +++++++++++++++---- settings.gradle | 2 + 4 files changed, 54 insertions(+), 15 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 7e6382db..3efe573d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -58,7 +58,8 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:16ae1d2c03' +// implementation 'com.github.SimpleMobileTools:Simple-Commons:e56c724d04' + implementation project(":commons") 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/Context.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/extensions/Context.kt index 07b1f5f5..0e30de4a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/extensions/Context.kt @@ -3,8 +3,9 @@ package com.simplemobiletools.filemanager.pro.extensions import android.content.Context import com.simplemobiletools.commons.extensions.isPathOnOTG import com.simplemobiletools.commons.extensions.isPathOnSD +import com.simplemobiletools.commons.extensions.otgPath +import com.simplemobiletools.commons.extensions.sdCardPath import com.simplemobiletools.filemanager.pro.helpers.Config val Context.config: Config get() = Config.newInstance(applicationContext) - fun Context.isPathOnRoot(path: String) = !(path.startsWith(config.internalStoragePath) || isPathOnOTG(path) || (isPathOnSD(path))) 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 e935585a..4e6d22b3 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 @@ -3,6 +3,7 @@ package com.simplemobiletools.filemanager.pro.fragments import android.content.Context import android.os.Parcelable import android.util.AttributeSet +import android.util.Log import androidx.recyclerview.widget.GridLayoutManager import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.dialogs.StoragePickerDialog @@ -23,12 +24,13 @@ import com.simplemobiletools.filemanager.pro.helpers.MAX_COLUMN_COUNT import com.simplemobiletools.filemanager.pro.helpers.RootHelpers import com.simplemobiletools.filemanager.pro.interfaces.ItemOperationsListener import com.simplemobiletools.filemanager.pro.models.ListItem -import kotlinx.android.synthetic.main.items_fragment.view.* import java.io.File import java.util.* import kotlin.collections.ArrayList +import kotlinx.android.synthetic.main.items_fragment.view.* -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 @@ -156,18 +158,47 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF private fun getItems(path: String, callback: (originalPath: String, items: ArrayList) -> Unit) { skipItemUpdating = false - ensureBackgroundThread { - if (activity?.isDestroyed == false && activity?.isFinishing == false) { - val config = context!!.config - if (context!!.isPathOnOTG(path) && config.OTGTreeUri.isNotEmpty()) { - val getProperFileSize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0 - context!!.getOTGItems(path, config.shouldShowHidden, getProperFileSize) { - callback(path, getListItemsFromFileDirItems(it)) + Log.d(TAG, "getItems: $path") + + if (isRPlus() && context.isAndroidDataRoot(path)) { + activity?.handleSAFDialog(path) { granted -> + Log.d(TAG, "getItems: $granted") + if (!granted) { + return@handleSAFDialog + } + ensureBackgroundThread { + if (activity?.isDestroyed == false && activity?.isFinishing == false) { + val config = context!!.config + if (context!!.isPathOnOTG(path) && config.OTGTreeUri.isNotEmpty()) { + val getProperFileSize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0 + context!!.getOTGItems(path, config.shouldShowHidden, getProperFileSize) { + callback(path, getListItemsFromFileDirItems(it)) + } + }else if (!config.enableRootAccess || !context!!.isPathOnRoot(path)) { + val getProperFileSize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0 + context!!.getStorageItems(path, config.shouldShowHidden, getProperFileSize){ + callback(path, getListItemsFromFileDirItems(it)) + } + } else { + RootHelpers(activity!!).getFiles(path, callback) + } + } + } + } + } else { + ensureBackgroundThread { + if (activity?.isDestroyed == false && activity?.isFinishing == false) { + val config = context!!.config + if (context!!.isPathOnOTG(path) && config.OTGTreeUri.isNotEmpty()) { + val getProperFileSize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0 + context!!.getOTGItems(path, config.shouldShowHidden, getProperFileSize) { + callback(path, getListItemsFromFileDirItems(it)) + } + } else if (!config.enableRootAccess || !context!!.isPathOnRoot(path)) { + getRegularItemsOf(path, callback) + } else { + RootHelpers(activity!!).getFiles(path, callback) } - } else if (!config.enableRootAccess || !context!!.isPathOnRoot(path)) { - getRegularItemsOf(path, callback) - } else { - RootHelpers(activity!!).getFiles(path, callback) } } } @@ -526,4 +557,8 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF override fun selectedPaths(paths: ArrayList) { (activity as MainActivity).pickedPaths(paths) } + + companion object { + private const val TAG = "ItemsFragment" + } } diff --git a/settings.gradle b/settings.gradle index e7b4def4..772c2522 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,3 @@ include ':app' +include ':commons' +project(":commons").projectDir = new File("/Users/cyberman/StudioProjects/Simple-Commons/commons") From 471d77e19f76ab768cafdbfd1f1a163488cd338a Mon Sep 17 00:00:00 2001 From: darthpaul Date: Sat, 23 Oct 2021 23:03:34 +0100 Subject: [PATCH 02/37] read files from Andoid/data and Android/obb --- .../pro/fragments/ItemsFragment.kt | 110 ++++++++---------- 1 file changed, 46 insertions(+), 64 deletions(-) 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 55d4187b..0468818a 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 @@ -3,7 +3,6 @@ package com.simplemobiletools.filemanager.pro.fragments import android.content.Context import android.os.Parcelable import android.util.AttributeSet -import android.util.Log import androidx.recyclerview.widget.GridLayoutManager import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.dialogs.StoragePickerDialog @@ -120,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() @@ -158,47 +159,18 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF private fun getItems(path: String, callback: (originalPath: String, items: ArrayList) -> Unit) { skipItemUpdating = false - Log.d(TAG, "getItems: $path") - - if (isRPlus() && context.isAndroidDataRoot(path)) { - activity?.handleSAFDialog(path) { granted -> - Log.d(TAG, "getItems: $granted") - if (!granted) { - return@handleSAFDialog - } - ensureBackgroundThread { - if (activity?.isDestroyed == false && activity?.isFinishing == false) { - val config = context!!.config - if (context!!.isPathOnOTG(path) && config.OTGTreeUri.isNotEmpty()) { - val getProperFileSize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0 - context!!.getOTGItems(path, config.shouldShowHidden, getProperFileSize) { - callback(path, getListItemsFromFileDirItems(it)) - } - }else if (!config.enableRootAccess || !context!!.isPathOnRoot(path)) { - val getProperFileSize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0 - context!!.getStorageItems(path, config.shouldShowHidden, getProperFileSize){ - callback(path, getListItemsFromFileDirItems(it)) - } - } else { - RootHelpers(activity!!).getFiles(path, callback) - } - } - } - } - } else { - ensureBackgroundThread { - if (activity?.isDestroyed == false && activity?.isFinishing == false) { - val config = context!!.config - if (context!!.isPathOnOTG(path) && config.OTGTreeUri.isNotEmpty()) { - val getProperFileSize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0 - context!!.getOTGItems(path, config.shouldShowHidden, getProperFileSize) { - callback(path, getListItemsFromFileDirItems(it)) - } - } else if (!config.enableRootAccess || !context!!.isPathOnRoot(path)) { - getRegularItemsOf(path, callback) - } else { - RootHelpers(activity!!).getFiles(path, callback) + ensureBackgroundThread { + if (activity?.isDestroyed == false && activity?.isFinishing == false) { + val config = context!!.config + if (context!!.isPathOnOTG(path) && config.OTGTreeUri.isNotEmpty()) { + val getProperFileSize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0 + context!!.getOTGItems(path, config.shouldShowHidden, getProperFileSize) { + callback(path, getListItemsFromFileDirItems(it)) } + } else if (!config.enableRootAccess || !context!!.isPathOnRoot(path)) { + getRegularItemsOf(path, callback) + } else { + RootHelpers(activity!!).getFiles(path, callback) } } } @@ -206,33 +178,47 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF private fun getRegularItemsOf(path: String, callback: (originalPath: String, items: ArrayList) -> Unit) { val items = ArrayList() - val files = File(path).listFiles()?.filterNotNull() - if (context == null || files == null) { + + if (context == null) { callback(path, items) return } val isSortingBySize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0 val getProperChildCount = context!!.config.getFolderViewType(currentPath) == VIEW_TYPE_LIST - val lastModifieds = context!!.getFolderLastModifieds(path) - for (file in files) { - val fileDirItem = getFileDirItemFromFile(file, isSortingBySize, lastModifieds, false) - if (fileDirItem != null) { - items.add(fileDirItem) + if (isRPlus() && context.isSAFOnlyRoot(path)) { + activity?.handlePrimarySAFDialog(path) { + context.getStorageItemsWithTreeUri(path, context.config.shouldShowHidden, getProperChildCount) { + callback(path, getListItemsFromFileDirItems(it)) + } } - } + } else { + val files = File(path).listFiles()?.filterNotNull() + if (files == null) { + callback(path, items) + return + } + val lastModifieds = context!!.getFolderLastModifieds(path) - // send out the initial item list asap, get proper child count asynchronously as it can be slow - callback(path, items) + for (file in files) { + val fileDirItem = getFileDirItemFromFile(file, isSortingBySize, lastModifieds, false) + if (fileDirItem != null) { + items.add(fileDirItem) + } + } - if (getProperChildCount) { - items.filter { it.mIsDirectory }.forEach { - if (context != null) { - val childrenCount = it.getDirectChildrenCount(context!!, showHidden) - if (childrenCount != 0) { - activity?.runOnUiThread { - getRecyclerAdapter()?.updateChildCount(it.mPath, childrenCount) + // send out the initial item list asap, get proper child count asynchronously as it can be slow + callback(path, items) + + if (getProperChildCount) { + items.filter { it.mIsDirectory }.forEach { + if (context != null) { + val childrenCount = it.getDirectChildrenCount(context!!, showHidden) + if (childrenCount != 0) { + activity?.runOnUiThread { + getRecyclerAdapter()?.updateChildCount(it.mPath, childrenCount) + } } } } @@ -557,8 +543,4 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF override fun selectedPaths(paths: ArrayList) { (activity as MainActivity).pickedPaths(paths) } - - companion object { - private const val TAG = "ItemsFragment" - } } From 644842322b7ff73da04d2db19598d310b800f673 Mon Sep 17 00:00:00 2001 From: darthpaul Date: Thu, 28 Oct 2021 23:46:22 +0100 Subject: [PATCH 03/37] read handle create file/directory --- .../pro/dialogs/CreateNewItemDialog.kt | 82 ++++++++++++------- 1 file changed, 52 insertions(+), 30 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt index 2131dd0d..170d994b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt @@ -3,6 +3,7 @@ package com.simplemobiletools.filemanager.pro.dialogs import android.view.View import androidx.appcompat.app.AlertDialog import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.commons.helpers.isRPlus import com.simplemobiletools.filemanager.pro.R import com.simplemobiletools.filemanager.pro.activities.SimpleActivity import com.simplemobiletools.filemanager.pro.helpers.RootHelpers @@ -15,37 +16,37 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca init { AlertDialog.Builder(activity) - .setPositiveButton(R.string.ok, null) - .setNegativeButton(R.string.cancel, null) - .create().apply { - activity.setupDialogStuff(view, this, R.string.create_new) { - showKeyboard(view.item_name) - getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(View.OnClickListener { - val name = view.item_name.value - if (name.isEmpty()) { - activity.toast(R.string.empty_name) - } else if (name.isAValidFilename()) { - val newPath = "$path/$name" - if (activity.getDoesFilePathExist(newPath)) { - activity.toast(R.string.name_taken) - return@OnClickListener - } + .setPositiveButton(R.string.ok, null) + .setNegativeButton(R.string.cancel, null) + .create().apply { + activity.setupDialogStuff(view, this, R.string.create_new) { + showKeyboard(view.item_name) + getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(View.OnClickListener { + val name = view.item_name.value + if (name.isEmpty()) { + activity.toast(R.string.empty_name) + } else if (name.isAValidFilename()) { + val newPath = "$path/$name" + if (activity.getDoesFilePathExist(newPath)) { + activity.toast(R.string.name_taken) + return@OnClickListener + } - if (view.dialog_radio_group.checkedRadioButtonId == R.id.dialog_radio_directory) { - createDirectory(newPath, this) { - callback(it) - } - } else { - createFile(newPath, this) { - callback(it) - } + if (view.dialog_radio_group.checkedRadioButtonId == R.id.dialog_radio_directory) { + createDirectory(newPath, this) { + callback(it) } } else { - activity.toast(R.string.invalid_name) + createFile(newPath, this) { + callback(it) + } } - }) - } + } else { + activity.toast(R.string.invalid_name) + } + }) } + } } private fun createDirectory(path: String, alertDialog: AlertDialog, callback: (Boolean) -> Unit) { @@ -66,8 +67,18 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca success(alertDialog) } path.startsWith(activity.internalStoragePath, true) -> { - if (File(path).mkdirs()) { - success(alertDialog) + if (isRPlus() && activity.isSAFOnlyRoot(path)) { + if (activity.createSAFOnlyDirectory(path)) { + success(alertDialog) + } else { + val error = String.format(activity.getString(R.string.could_not_create_folder), path) + activity.showErrorToast(error) + callback(false) + } + } else { + if (File(path).mkdirs()) { + success(alertDialog) + } } } else -> { @@ -103,9 +114,20 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca } } path.startsWith(activity.internalStoragePath, true) -> { - if (File(path).createNewFile()) { - success(alertDialog) + if (isRPlus() && activity.isSAFOnlyRoot(path)) { + if (activity.createSAFOnlyFile(path)) { + success(alertDialog) + } else { + val error = String.format(activity.getString(R.string.could_not_create_file), path) + activity.showErrorToast(error) + callback(false) + } + } else { + if (File(path).createNewFile()) { + success(alertDialog) + } } + } else -> { RootHelpers(activity).createFileFolder(path, true) { From 26d79d5f4afa732ff3d250ffb5db721186c01308 Mon Sep 17 00:00:00 2001 From: darthpaul Date: Sun, 31 Oct 2021 10:05:50 +0000 Subject: [PATCH 04/37] handle MANAGE_EXTERNAL_STORAGE permission for >=API 30 --- app/src/main/AndroidManifest.xml | 1 + .../pro/activities/MainActivity.kt | 50 +++++++++++++++++-- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a7adeefd..e9f14943 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -6,6 +6,7 @@ + 1 } @@ -268,8 +275,8 @@ class MainActivity : SimpleActivity() { } private fun tryInitFileManager() { - val hadPermission = hasPermission(PERMISSION_WRITE_STORAGE) - handlePermission(PERMISSION_WRITE_STORAGE) { + val hadPermission = hasStoragePermission() + handleStoragePermission { checkOTGPath() if (it) { if (main_view_pager.adapter == null) { @@ -286,6 +293,43 @@ class MainActivity : SimpleActivity() { } } + private fun handleStoragePermission(callback: (granted: Boolean) -> Unit) { + actionOnPermission = null + if (hasStoragePermission()) { + callback(true) + } else { + if (isRPlus()) { + isAskingPermissions = true + actionOnPermission = callback + try { + val intent = Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION) + intent.addCategory("android.intent.category.DEFAULT") + intent.data = Uri.parse(String.format("package:%s", applicationContext.packageName)) + startActivityForResult(intent, MANAGE_STORAGE_RC) + } catch (e: Exception) { + e.printStackTrace() + val intent = Intent() + intent.action = Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION + startActivityForResult(intent, MANAGE_STORAGE_RC) + } + } else { + handlePermission(PERMISSION_WRITE_STORAGE, callback) + } + } + } + + private fun hasStoragePermission(): Boolean { + return if (isRPlus()) Environment.isExternalStorageManager() else hasPermission(PERMISSION_WRITE_STORAGE) + } + + override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) { + super.onActivityResult(requestCode, resultCode, resultData) + isAskingPermissions = false + if(requestCode == MANAGE_STORAGE_RC && isRPlus()){ + actionOnPermission?.invoke(Environment.isExternalStorageManager()) + } + } + private fun initFileManager(refreshRecents: Boolean) { if (intent.action == Intent.ACTION_VIEW && intent.data != null) { val data = intent.data 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 05/37] 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 06/37] 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 6dbfdb0c24cd5d14afb44c993a3ca27dc9ace614 Mon Sep 17 00:00:00 2001 From: darthpaul Date: Tue, 2 Nov 2021 07:45:33 +0000 Subject: [PATCH 07/37] handle copy/move, share, create new directory --- .../pro/activities/MainActivity.kt | 4 +- .../filemanager/pro/adapters/ItemsAdapter.kt | 57 ++++++++++++++----- .../pro/dialogs/CreateNewItemDialog.kt | 55 +++++++++++------- .../pro/fragments/ItemsFragment.kt | 6 +- 4 files changed, 81 insertions(+), 41 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 89aa76e4..d3e29a79 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 @@ -304,7 +304,7 @@ class MainActivity : SimpleActivity() { try { val intent = Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION) intent.addCategory("android.intent.category.DEFAULT") - intent.data = Uri.parse(String.format("package:%s", applicationContext.packageName)) + intent.data = Uri.parse("package:$packageName") startActivityForResult(intent, MANAGE_STORAGE_RC) } catch (e: Exception) { e.printStackTrace() @@ -325,7 +325,7 @@ class MainActivity : SimpleActivity() { override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) { super.onActivityResult(requestCode, resultCode, resultData) isAskingPermissions = false - if(requestCode == MANAGE_STORAGE_RC && isRPlus()){ + if (requestCode == MANAGE_STORAGE_RC && isRPlus()) { actionOnPermission?.invoke(Environment.isExternalStorageManager()) } } 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..dc332ffa 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 @@ -327,13 +327,25 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList) { if (activity.getIsPathDirectory(path)) { val shouldShowHidden = activity.config.shouldShowHidden - if (activity.isPathOnOTG(path)) { - activity.getDocumentFile(path)?.listFiles()?.filter { if (shouldShowHidden) true else !it.name!!.startsWith(".") }?.forEach { - addFileUris(it.uri.toString(), paths) + when { + activity.isRestrictedAndroidDir(path) -> { + activity.getStorageItemsWithTreeUri(path, shouldShowHidden, false){ files-> + files.forEach { + addFileUris(activity.getPrimaryAndroidSAFUri(it.path).toString(), paths) + } + } } - } else { - File(path).listFiles()?.filter { if (shouldShowHidden) true else !it.name.startsWith('.') }?.forEach { - addFileUris(it.absolutePath, paths) + + activity.isPathOnOTG(path) -> { + activity.getDocumentFile(path)?.listFiles()?.filter { if (shouldShowHidden) true else !it.name!!.startsWith(".") }?.forEach { + addFileUris(it.uri.toString(), paths) + } + } + + else -> { + File(path).listFiles()?.filter { if (shouldShowHidden) true else !it.name.startsWith('.') }?.forEach { + addFileUris(it.absolutePath, paths) + } } } } else { @@ -363,7 +375,8 @@ 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) { - val sourceFolder = sourceFile.toFileDirItem(activity) - activity.deleteFile(sourceFolder, true) { + val sourcePath = sourceFileDir.path + if (activity.isRestrictedAndroidDir(sourcePath) && activity.getDoesFilePathExist(sourcePath)) { + activity.deleteFile(sourceFileDir, true) { listener?.refreshItems() activity.runOnUiThread { finishActMode() } } } else { - listener?.refreshItems() - finishActMode() + val sourceFile = File(sourcePath) + if (activity.getDoesFilePathExist(source) && activity.getIsPathDirectory(source) && + sourceFile.list()?.isEmpty() == true && sourceFile.getProperSize(true) == 0L && sourceFile.getFileCount(true) == 0 + ) { + val sourceFolder = sourceFile.toFileDirItem(activity) + activity.deleteFile(sourceFolder, true) { + listener?.refreshItems() + activity.runOnUiThread { + finishActMode() + } + } + } else { + listener?.refreshItems() + finishActMode() + } } } } else { @@ -828,10 +852,13 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList { - if (isRPlus() && activity.isSAFOnlyRoot(path)) { - if (activity.createSAFOnlyDirectory(path)) { - success(alertDialog) - } else { - val error = String.format(activity.getString(R.string.could_not_create_folder), path) - activity.showErrorToast(error) - callback(false) + if (activity.isRestrictedAndroidDir(path)) { + activity.handlePrimarySAFDialog(path) { + if (!it) { + callback(false) + return@handlePrimarySAFDialog + } + if (activity.createSAFOnlyDirectory(path)) { + success(alertDialog) + } else { + val error = String.format(activity.getString(R.string.could_not_create_folder), path) + activity.showErrorToast(error) + callback(false) + } } } else { if (File(path).mkdirs()) { @@ -96,6 +102,22 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca private fun createFile(path: String, alertDialog: AlertDialog, callback: (Boolean) -> Unit) { try { when { + activity.isRestrictedAndroidDir(path) -> { + activity.handlePrimarySAFDialog(path) { + if (!it) { + callback(false) + return@handlePrimarySAFDialog + } + if (activity.createSAFOnlyFile(path)) { + success(alertDialog) + } else { + val error = String.format(activity.getString(R.string.could_not_create_file), path) + activity.showErrorToast(error) + callback(false) + } + } + } + activity.needsStupidWritePermissions(path) -> { activity.handleSAFDialog(path) { if (!it) { @@ -113,22 +135,13 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca success(alertDialog) } } - path.startsWith(activity.internalStoragePath, true) -> { - if (isRPlus() && activity.isSAFOnlyRoot(path)) { - if (activity.createSAFOnlyFile(path)) { - success(alertDialog) - } else { - val error = String.format(activity.getString(R.string.could_not_create_file), path) - activity.showErrorToast(error) - callback(false) - } - } else { - if (File(path).createNewFile()) { - success(alertDialog) - } - } + path.startsWith(activity.internalStoragePath, true) -> { + if (File(path).createNewFile()) { + success(alertDialog) + } } + else -> { RootHelpers(activity).createFileFolder(path, true) { if (it) { 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 0468818a..8174e4d0 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 @@ -187,7 +187,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF val isSortingBySize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0 val getProperChildCount = context!!.config.getFolderViewType(currentPath) == VIEW_TYPE_LIST - if (isRPlus() && context.isSAFOnlyRoot(path)) { + if (context.isRestrictedAndroidDir(path)) { activity?.handlePrimarySAFDialog(path) { context.getStorageItemsWithTreeUri(path, context.config.shouldShowHidden, getProperChildCount) { callback(path, getListItemsFromFileDirItems(it)) @@ -214,7 +214,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF if (getProperChildCount) { items.filter { it.mIsDirectory }.forEach { if (context != null) { - val childrenCount = it.getDirectChildrenCount(context!!, showHidden) + val childrenCount = it.getDirectChildrenCount(activity as BaseSimpleActivity, showHidden) if (childrenCount != 0) { activity?.runOnUiThread { getRecyclerAdapter()?.updateChildCount(it.mPath, childrenCount) @@ -235,7 +235,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF var lastModified = lastModifieds.remove(curPath) val isDirectory = if (lastModified != null) false else file.isDirectory - val children = if (isDirectory && getProperChildCount) file.getDirectChildrenCount(showHidden) else 0 + val children = if (isDirectory && getProperChildCount) file.getDirectChildrenCount(context, showHidden) else 0 val size = if (isDirectory) { if (isSortingBySize) { file.getProperSize(showHidden) From 1e067e36142267b09382c9ca32c6766ad9724759 Mon Sep 17 00:00:00 2001 From: darthpaul Date: Tue, 2 Nov 2021 21:49:21 +0000 Subject: [PATCH 08/37] handle compress/decompress --- .../filemanager/pro/adapters/ItemsAdapter.kt | 232 ++++++++++-------- 1 file changed, 135 insertions(+), 97 deletions(-) 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 dc332ffa..3b1a8493 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 @@ -41,6 +41,7 @@ import com.simplemobiletools.filemanager.pro.helpers.* import com.simplemobiletools.filemanager.pro.interfaces.ItemOperationsListener import com.simplemobiletools.filemanager.pro.models.ListItem import com.stericson.RootTools.RootTools +import java.io.BufferedInputStream import kotlinx.android.synthetic.main.item_file_dir_grid.view.* import kotlinx.android.synthetic.main.item_file_dir_list.view.* import kotlinx.android.synthetic.main.item_file_dir_list.view.item_frame @@ -50,13 +51,18 @@ import kotlinx.android.synthetic.main.item_section.view.* import java.io.Closeable import java.io.File import java.io.FileInputStream +import java.net.URI +import java.net.URLEncoder import java.util.* import java.util.zip.ZipEntry import java.util.zip.ZipFile +import java.util.zip.ZipInputStream 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 @@ -329,7 +335,7 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList { - activity.getStorageItemsWithTreeUri(path, shouldShowHidden, false){ files-> + activity.getStorageItemsWithTreeUri(path, shouldShowHidden, false) { files -> files.forEach { addFileUris(activity.getPrimaryAndroidSAFUri(it.path).toString(), paths) } @@ -463,22 +469,27 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList + if (!granted) { + return@handlePrimarySAFDialog } + activity.handleSAFDialog(firstPath) { + if (!it) { + return@handleSAFDialog + } - activity.toast(R.string.compressing) - val paths = getSelectedFileDirItems().map { it.path } - ensureBackgroundThread { - if (compressPaths(paths, destination)) { - activity.runOnUiThread { - activity.toast(R.string.compression_successful) - listener?.refreshItems() - finishActMode() + activity.toast(R.string.compressing) + val paths = getSelectedFileDirItems().map { it.path } + ensureBackgroundThread { + if (compressPaths(paths, destination)) { + activity.runOnUiThread { + activity.toast(R.string.compression_successful) + listener?.refreshItems() + finishActMode() + } + } else { + activity.toast(R.string.compressing_failed) } - } else { - activity.toast(R.string.compressing_failed) } } } @@ -513,88 +524,94 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList, callback: (success: Boolean) -> Unit) { - sourcePaths.forEach { - try { - val zipFile = ZipFile(it) - val entries = zipFile.entries() - val fileDirItems = ArrayList() - while (entries.hasMoreElements()) { - val entry = entries.nextElement() - val currPath = if (entry.isDirectory) it else "${it.getParentPath().trimEnd('/')}/${entry.name}" - val fileDirItem = FileDirItem(currPath, entry.name, entry.isDirectory, 0, entry.size) - fileDirItems.add(fileDirItem) - } - - val destinationPath = fileDirItems.first().getParentPath().trimEnd('/') - activity.checkConflicts(fileDirItems, destinationPath, 0, LinkedHashMap()) { - ensureBackgroundThread { - decompressPaths(sourcePaths, it, callback) + sourcePaths.forEach { path -> + val zipInputStream = ZipInputStream(BufferedInputStream(activity.getFileInputStreamSync(path))) + zipInputStream.use { + try { + val fileDirItems = ArrayList() + var entry = zipInputStream.nextEntry + while (entry != null) { + val currPath = if (entry.isDirectory) path else "${path.getParentPath().trimEnd('/')}/${entry.name}" + val fileDirItem = FileDirItem(currPath, entry.name, entry.isDirectory, 0, entry.size) + fileDirItems.add(fileDirItem) + zipInputStream.closeEntry() + entry = zipInputStream.nextEntry } + zipInputStream.closeEntry() + val destinationPath = fileDirItems.first().getParentPath().trimEnd('/') + activity.checkConflicts(fileDirItems, destinationPath, 0, LinkedHashMap()) { + ensureBackgroundThread { + decompressPaths(sourcePaths, it, callback) + } + } + } catch (exception: Exception) { + exception.printStackTrace() + activity.showErrorToast(exception) } - } catch (exception: Exception) { - activity.showErrorToast(exception) } } } private fun decompressPaths(paths: List, conflictResolutions: LinkedHashMap, callback: (success: Boolean) -> Unit) { - paths.forEach { - try { - val zipFile = ZipFile(it) - val entries = zipFile.entries() - val zipFileName = it.getFilenameFromPath() - val newFolderName = zipFileName.subSequence(0, zipFileName.length - 4) - while (entries.hasMoreElements()) { - val entry = entries.nextElement() - val parentPath = it.getParentPath() - val newPath = "$parentPath/$newFolderName/${entry.name.trimEnd('/')}" + paths.forEach { path -> + val zipInputStream = ZipInputStream(BufferedInputStream(activity.getFileInputStreamSync(path))) + zipInputStream.use { + try { + var entry = zipInputStream.nextEntry + val zipFileName = path.getFilenameFromPath() + val newFolderName = zipFileName.subSequence(0, zipFileName.length - 4) + while (entry != null) { + val parentPath = path.getParentPath() + val newPath = "$parentPath/$newFolderName/${entry.name.trimEnd('/')}" - val resolution = getConflictResolution(conflictResolutions, newPath) - val doesPathExist = activity.getDoesFilePathExist(newPath) - if (doesPathExist && resolution == CONFLICT_OVERWRITE) { - val fileDirItem = FileDirItem(newPath, newPath.getFilenameFromPath(), entry.isDirectory) - if (activity.getIsPathDirectory(it)) { - activity.deleteFolderBg(fileDirItem, false) { - if (it) { - extractEntry(newPath, entry, zipFile) - } else { - callback(false) - } - } - } else { - activity.deleteFileBg(fileDirItem, false) { - if (it) { - extractEntry(newPath, entry, zipFile) - } else { - callback(false) + val resolution = getConflictResolution(conflictResolutions, newPath) + val doesPathExist = activity.getDoesFilePathExist(newPath) + if (doesPathExist && resolution == CONFLICT_OVERWRITE) { + val fileDirItem = FileDirItem(newPath, newPath.getFilenameFromPath(), entry.isDirectory) + if (activity.getIsPathDirectory(path)) { + activity.deleteFolderBg(fileDirItem, false) { + if (it) { + extractEntry(newPath, entry, zipInputStream) + } else { + callback(false) + } + } + } else { + activity.deleteFileBg(fileDirItem, false) { + if (it) { + extractEntry(newPath, entry, zipInputStream) + } else { + callback(false) + } } } + } else if (!doesPathExist) { + extractEntry(newPath, entry, zipInputStream) } - } else if (!doesPathExist) { - extractEntry(newPath, entry, zipFile) + + zipInputStream.closeEntry() + entry = zipInputStream.nextEntry } + callback(true) + } catch (e: Exception) { + e.printStackTrace() + activity.showErrorToast(e) + callback(false) } - callback(true) - } catch (e: Exception) { - activity.showErrorToast(e) - callback(false) } } } - private fun extractEntry(newPath: String, entry: ZipEntry, zipFile: ZipFile) { + private fun extractEntry(newPath: String, entry: ZipEntry, zipInputStream: ZipInputStream) { if (entry.isDirectory) { if (!activity.createDirectorySync(newPath) && !activity.getDoesFilePathExist(newPath)) { val error = String.format(activity.getString(R.string.could_not_create_file), newPath) activity.showErrorToast(error) } } else { - val ins = zipFile.getInputStream(entry) - ins.use { - val fos = activity.getFileOutputStreamSync(newPath, newPath.getMimeType()) - if (fos != null) { - ins.copyTo(fos) - } + val fos = activity.getFileOutputStreamSync(newPath, newPath.getMimeType()) + if (fos != null) { + zipInputStream.copyTo(fos) } } } @@ -610,48 +627,68 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList, targetPath: String): Boolean { - val queue = LinkedList() + val queue = LinkedList() val fos = activity.getFileOutputStreamSync(targetPath, "application/zip") ?: return false val zout = ZipOutputStream(fos) var res: Closeable = fos try { - sourcePaths.forEach { + sourcePaths.forEach { currentPath -> var name: String - var mainFile = File(it) - val base = mainFile.parentFile.toURI() + var mainFilePath = currentPath + val base = "${mainFilePath.getParentPath()}/" res = zout - queue.push(mainFile) - if (activity.getIsPathDirectory(mainFile.absolutePath)) { - name = "${mainFile.name.trimEnd('/')}/" + queue.push(mainFilePath) + if (activity.getIsPathDirectory(mainFilePath)) { + name = "${mainFilePath.getFilenameFromPath()}/" zout.putNextEntry(ZipEntry(name)) } while (!queue.isEmpty()) { - mainFile = queue.pop() - if (activity.getIsPathDirectory(mainFile.absolutePath)) { - for (file in mainFile.listFiles()) { - name = base.relativize(file.toURI()).path - if (activity.getIsPathDirectory(file.absolutePath)) { - queue.push(file) - name = "${name.trimEnd('/')}/" - zout.putNextEntry(ZipEntry(name)) - } else { - zout.putNextEntry(ZipEntry(name)) - FileInputStream(file).copyTo(zout) - zout.closeEntry() + mainFilePath = queue.pop() + if (activity.getIsPathDirectory(mainFilePath)) { + if (activity.isRestrictedAndroidDir(mainFilePath)) { + activity.getStorageItemsWithTreeUri(mainFilePath, true) { files -> + for (file in files) { + name = file.path.relativizeWith(base) + if (activity.getIsPathDirectory(file.path)) { + queue.push(file.path) + name = "${name.trimEnd('/')}/" + zout.putNextEntry(ZipEntry(name)) + } else { + zout.putNextEntry(ZipEntry(name)) + activity.getFileInputStreamSync(file.path)!!.copyTo(zout) + zout.closeEntry() + } + } + } + } else { + val mainFile = File(mainFilePath) + for (file in mainFile.listFiles()) { + name = file.path.relativizeWith(base) + if (activity.getIsPathDirectory(file.absolutePath)) { + queue.push(file.absolutePath) + name = "${name.trimEnd('/')}/" + zout.putNextEntry(ZipEntry(name)) + } else { + zout.putNextEntry(ZipEntry(name)) + activity.getFileInputStreamSync(file.path)!!.copyTo(zout) + zout.closeEntry() + } } } + } else { - name = if (base.path == it) it.getFilenameFromPath() else base.relativize(mainFile.toURI()).path + name = if (base == currentPath) currentPath.getFilenameFromPath() else mainFilePath.relativizeWith(base) zout.putNextEntry(ZipEntry(name)) - FileInputStream(mainFile).copyTo(zout) + activity.getFileInputStreamSync(mainFilePath)!!.copyTo(zout) zout.closeEntry() } } } } catch (exception: Exception) { + exception.printStackTrace() activity.showErrorToast(exception) return false } finally { @@ -835,7 +872,8 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList Date: Thu, 4 Nov 2021 20:34:46 +0100 Subject: [PATCH 09/37] 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 10/37] 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 2de754e4cfe76629a29aafae5e232574e9493676 Mon Sep 17 00:00:00 2001 From: darthpaul Date: Wed, 10 Nov 2021 20:46:05 +0000 Subject: [PATCH 11/37] fix query for recents fragment --- .../pro/dialogs/CreateNewItemDialog.kt | 4 +- .../pro/fragments/RecentsFragment.kt | 45 ++++++++++++++----- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt index 914bd382..e24728c1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt @@ -66,7 +66,7 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca documentFile.createDirectory(path.getFilenameFromPath()) success(alertDialog) } - path.startsWith(activity.internalStoragePath, true) -> { + isRPlus() || path.startsWith(activity.internalStoragePath, true) -> { if (activity.isRestrictedAndroidDir(path)) { activity.handlePrimarySAFDialog(path) { if (!it) { @@ -136,7 +136,7 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca } } - path.startsWith(activity.internalStoragePath, true) -> { + isRPlus() || path.startsWith(activity.internalStoragePath, true) -> { if (File(path).createNewFile()) { success(alertDialog) } 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 03983da8..8893e599 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 @@ -1,14 +1,14 @@ package com.simplemobiletools.filemanager.pro.fragments +import android.content.ContentResolver import android.content.Context import android.provider.MediaStore.Files import android.provider.MediaStore.Files.FileColumns import android.util.AttributeSet +import androidx.core.os.bundleOf 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.helpers.* import com.simplemobiletools.commons.models.FileDirItem import com.simplemobiletools.commons.views.MyGridLayoutManager import com.simplemobiletools.filemanager.pro.R @@ -24,6 +24,8 @@ import kotlinx.android.synthetic.main.recents_fragment.view.* import java.util.* class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet), ItemOperationsListener { + private val RECENTS_LIMIT = 50 + override fun setupFragment(activity: SimpleActivity) { if (this.activity == null) { this.activity = activity @@ -120,17 +122,36 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage FileColumns.SIZE ) - val sortOrder = "${FileColumns.DATE_MODIFIED} DESC LIMIT 50" + val cursor = if (isOreoPlus()) { + val queryArgs = bundleOf( + ContentResolver.QUERY_ARG_LIMIT to RECENTS_LIMIT, + ContentResolver.QUERY_ARG_SORT_COLUMNS to arrayOf(FileColumns.DATE_MODIFIED), + ContentResolver.QUERY_ARG_SORT_DIRECTION to ContentResolver.QUERY_SORT_DIRECTION_DESCENDING + ) + context?.contentResolver?.query(uri, projection, queryArgs, null) + } else { + val sortOrder = "${FileColumns.DATE_MODIFIED} DESC LIMIT $RECENTS_LIMIT" + context?.contentResolver?.query(uri, projection, null, null, sortOrder) + } - context?.queryCursor(uri, projection, sortOrder = sortOrder, showErrors = true) { cursor -> - val path = cursor.getStringValue(FileColumns.DATA) - val name = cursor.getStringValue(FileColumns.DISPLAY_NAME) ?: path.getFilenameFromPath() - val size = cursor.getLongValue(FileColumns.SIZE) - val modified = cursor.getLongValue(FileColumns.DATE_MODIFIED) * 1000 - val fileDirItem = ListItem(path, name, false, 0, size, modified, false) - if ((showHidden || !name.startsWith(".")) && activity?.getDoesFilePathExist(path) == true) { - listItems.add(fileDirItem) + try { + cursor?.use { + if (cursor.moveToFirst()) { + do { + val path = cursor.getStringValue(FileColumns.DATA) + val name = cursor.getStringValue(FileColumns.DISPLAY_NAME) ?: path.getFilenameFromPath() + val size = cursor.getLongValue(FileColumns.SIZE) + val modified = cursor.getLongValue(FileColumns.DATE_MODIFIED) * 1000 + val fileDirItem = ListItem(path, name, false, 0, size, modified, false) + if ((showHidden || !name.startsWith(".")) && activity?.getDoesFilePathExist(path) == true) { + listItems.add(fileDirItem) + } + } while (cursor.moveToNext()) + } } + } catch (e: Exception) { + e.printStackTrace() + activity?.showErrorToast(e) } activity?.runOnUiThread { From b7ef3993f27e511bb67062a66e3e4fb279512944 Mon Sep 17 00:00:00 2001 From: darthpaul Date: Fri, 12 Nov 2021 06:54:59 +0000 Subject: [PATCH 12/37] exclude SD and OTG from SAF restricted directories --- app/build.gradle | 6 ++--- .../filemanager/pro/adapters/ItemsAdapter.kt | 8 ++----- .../pro/dialogs/CreateNewItemDialog.kt | 8 +++---- .../pro/fragments/ItemsFragment.kt | 7 +++++- .../pro/fragments/RecentsFragment.kt | 23 +++++++++---------- build.gradle | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 2 +- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 88cc1fee..898fcb10 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,13 +9,13 @@ if (keystorePropertiesFile.exists()) { } android { - compileSdkVersion 29 + compileSdkVersion 30 buildToolsVersion "29.0.3" defaultConfig { applicationId "com.simplemobiletools.filemanager.pro" minSdkVersion 21 - targetSdkVersion 29 + targetSdkVersion 30 versionCode 108 versionName "6.9.4" multiDexEnabled true @@ -58,7 +58,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:649211e294' + implementation project(":commons") 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/adapters/ItemsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt index 3b1a8493..ab97cdfb 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 @@ -50,12 +50,8 @@ import kotlinx.android.synthetic.main.item_file_dir_list.view.item_name import kotlinx.android.synthetic.main.item_section.view.* import java.io.Closeable import java.io.File -import java.io.FileInputStream -import java.net.URI -import java.net.URLEncoder import java.util.* import java.util.zip.ZipEntry -import java.util.zip.ZipFile import java.util.zip.ZipInputStream import java.util.zip.ZipOutputStream @@ -469,9 +465,9 @@ class ItemsAdapter( CompressAsDialog(activity, firstPath) { val destination = it - activity.handlePrimarySAFDialog(firstPath) { granted -> + activity.handlePrimaryAndroidSAFDialog(firstPath) { granted -> if (!granted) { - return@handlePrimarySAFDialog + return@handlePrimaryAndroidSAFDialog } activity.handleSAFDialog(firstPath) { if (!it) { diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt index e24728c1..fa731fbc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt @@ -68,10 +68,10 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca } isRPlus() || path.startsWith(activity.internalStoragePath, true) -> { if (activity.isRestrictedAndroidDir(path)) { - activity.handlePrimarySAFDialog(path) { + activity.handlePrimaryAndroidSAFDialog(path) { if (!it) { callback(false) - return@handlePrimarySAFDialog + return@handlePrimaryAndroidSAFDialog } if (activity.createSAFOnlyDirectory(path)) { success(alertDialog) @@ -103,10 +103,10 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca try { when { activity.isRestrictedAndroidDir(path) -> { - activity.handlePrimarySAFDialog(path) { + activity.handlePrimaryAndroidSAFDialog(path) { if (!it) { callback(false) - return@handlePrimarySAFDialog + return@handlePrimaryAndroidSAFDialog } if (activity.createSAFOnlyFile(path)) { success(alertDialog) 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 8174e4d0..13e6da3a 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 @@ -188,7 +188,12 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF val getProperChildCount = context!!.config.getFolderViewType(currentPath) == VIEW_TYPE_LIST if (context.isRestrictedAndroidDir(path)) { - activity?.handlePrimarySAFDialog(path) { + activity?.handlePrimaryAndroidSAFDialog(path) { + if (!it) { + activity?.toast(R.string.no_storage_permissions) + return@handlePrimaryAndroidSAFDialog + } + context.getStorageItemsWithTreeUri(path, context.config.shouldShowHidden, getProperChildCount) { callback(path, getListItemsFromFileDirItems(it)) } 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 8893e599..2deea1b6 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 @@ -122,19 +122,18 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage FileColumns.SIZE ) - val cursor = if (isOreoPlus()) { - val queryArgs = bundleOf( - ContentResolver.QUERY_ARG_LIMIT to RECENTS_LIMIT, - ContentResolver.QUERY_ARG_SORT_COLUMNS to arrayOf(FileColumns.DATE_MODIFIED), - ContentResolver.QUERY_ARG_SORT_DIRECTION to ContentResolver.QUERY_SORT_DIRECTION_DESCENDING - ) - context?.contentResolver?.query(uri, projection, queryArgs, null) - } else { - val sortOrder = "${FileColumns.DATE_MODIFIED} DESC LIMIT $RECENTS_LIMIT" - context?.contentResolver?.query(uri, projection, null, null, sortOrder) - } - try { + val cursor = if (isOreoPlus()) { + val queryArgs = bundleOf( + ContentResolver.QUERY_ARG_LIMIT to RECENTS_LIMIT, + ContentResolver.QUERY_ARG_SORT_COLUMNS to arrayOf(FileColumns.DATE_MODIFIED), + ContentResolver.QUERY_ARG_SORT_DIRECTION to ContentResolver.QUERY_SORT_DIRECTION_DESCENDING + ) + context?.contentResolver?.query(uri, projection, queryArgs, null) + } else { + val sortOrder = "${FileColumns.DATE_MODIFIED} DESC LIMIT $RECENTS_LIMIT" + context?.contentResolver?.query(uri, projection, null, null, sortOrder) + } cursor?.use { if (cursor.moveToFirst()) { do { diff --git a/build.gradle b/build.gradle index e0fb0bd8..9b82dbc6 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.3' 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 diff --git a/settings.gradle b/settings.gradle index 772c2522..707304a6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,3 @@ include ':app' include ':commons' -project(":commons").projectDir = new File("/Users/cyberman/StudioProjects/Simple-Commons/commons") +project(":commons").projectDir = new File("/Users/darthpaul/StudioProjects/Simple-Commons/commons") 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 13/37] 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 14/37] 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 From 33f7861ff2e33b3be8e4467174976d98ec8e659f Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 13 Nov 2021 17:24:01 +0100 Subject: [PATCH 15/37] removing an invalid Indonesian translation file --- app/src/main/res/values-in/strings.xml | 105 ------------------------- 1 file changed, 105 deletions(-) delete mode 100644 app/src/main/res/values-in/strings.xml diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml deleted file mode 100644 index d66dd18f..00000000 --- a/app/src/main/res/values-in/strings.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - Simple File Manager - File Manager - Tekan sekali lagi untuk keluar - Buka folder beranda - Setel sebagai folder beranda - Folder beranda diperbarui - Salin jalur ke papan klip - Jalur disalin - Silakan pilih berkas audio - Cari folder - Tindakan ini hanya bekerja pada perangkat dengan akses root - Recents - Show recents - - - Buka sebagai - Berkas teks - Berkas gambar - Berkas audio - Berkas video - Berkas lainnya - - - Kompres - Dekompres - Kompres sebagai - Mengompres… - Dekompres… - Berhasil mengompres - Berhasil dekompresi - Gagal mengompres - Gagal dekompresi - - - Kelola favorit - Buka favorit - Anda bisa menambahkan folder yang sering digunakan ke favorit untuk kemudahan akses dari mana saja. - - - Penyunting Berkas - - - Storage analysis - Images - Videos - Audio - Documents - Downloads - Archives - Others - free - Total storage: %s - - - Aktifkan akses root - Require pressing Back twice to leave the app - - - - Simple File Manager Pro - Manage files easy & fast - - 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. - - 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. - - This modern file organizer supports fast browsing of root files, SD cards and USB devices. - - 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. - - You can obviously select sorting by multiple different values, toggle between ascending and descending, or use a folder specific sorting. - - 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. - - To get a file or folders path quickly, you can easily select it by long pressing and copying it in the clipboard. - - You can create handy desktop shortcuts for accessing your favorite items quickly. - - 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. - - 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. - - Sama sekali tidak berisi iklan dan tidak membutuhkan perizinan yang tidak perlu. Sepenuhnya sumber terbuka, dengan warna yang bisa disesuaikan. - - Check out the full suite of Simple Tools here: - https://www.simplemobiletools.com - - Standalone website of Simple File Manager Pro: - https://www.simplemobiletools.com/filemanager - - Facebook: - https://www.facebook.com/simplemobiletools - - Reddit: - https://www.reddit.com/r/SimpleMobileTools - - - - From 429ff7a3fa5ae82cfe21bd12b9aac738968ab9f7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 13 Nov 2021 17:46:14 +0100 Subject: [PATCH 16/37] correcting the galician language file --- app/src/main/res/values-gl/strings.xml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index f08e4f66..fba54c8c 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -11,6 +11,8 @@ Seleccione un ficheiro de audio Buscar cartafol Esta operación só funciona en dispositivos con root + Recents + Show recents Abrir como @@ -39,14 +41,27 @@ Editor de ficheiros + + Storage analysis + Images + Videos + Audio + Documents + Downloads + Archives + Others + free + Total storage: %s + Activar acceso root + Require pressing Back twice to leave the app - Simple File Manager Pro - Manage files easily & fast + Simple File Manager Pro - Manage files easily & fast - Quick file management with no ads. Browse files easily, securely & fast + Quick file management with no ads. Browse files easily, securely & fast Un xestor de ficheiros rápido e lixeiro para uso diario. Ofrece unha funcionalidade de busca útil e podes personalizar o cartafol de inicio e seleccionar os cartafoles favoritos para un acceso rápido. From 627bbb519a1efcbd9eb1fb1e6c2e2961a90c966d Mon Sep 17 00:00:00 2001 From: darthpaul Date: Sun, 14 Nov 2021 00:06:56 +0000 Subject: [PATCH 17/37] cleaning up --- .../filemanager/pro/adapters/ItemsAdapter.kt | 20 ++++---- .../pro/dialogs/CreateNewItemDialog.kt | 47 +++++++++---------- .../filemanager/pro/extensions/Context.kt | 3 +- .../pro/fragments/ItemsFragment.kt | 6 +-- .../pro/fragments/RecentsFragment.kt | 1 - app/src/main/res/menu/cab.xml | 6 +-- app/src/main/res/values-gl/strings.xml | 4 +- 7 files changed, 42 insertions(+), 45 deletions(-) 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 4308519c..c38f499e 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 @@ -330,10 +330,10 @@ class ItemsAdapter( if (activity.getIsPathDirectory(path)) { val shouldShowHidden = activity.config.shouldShowHidden when { - activity.isRestrictedAndroidDir(path) -> { - activity.getStorageItemsWithTreeUri(path, shouldShowHidden, false) { files -> + activity.isRestrictedSAFOnlyRoot(path) -> { + activity.getAndroidSAFFileItems(path, shouldShowHidden, false) { files -> files.forEach { - addFileUris(activity.getPrimaryAndroidSAFUri(it.path).toString(), paths) + addFileUris(activity.getAndroidSAFUri(it.path).toString(), paths) } } } @@ -403,7 +403,7 @@ class ItemsAdapter( if (!isCopyOperation) { files.forEach { sourceFileDir -> val sourcePath = sourceFileDir.path - if (activity.isRestrictedAndroidDir(sourcePath) && activity.getDoesFilePathExist(sourcePath)) { + if (activity.isRestrictedSAFOnlyRoot(sourcePath) && activity.getDoesFilePathExist(sourcePath)) { activity.deleteFile(sourceFileDir, true) { listener?.refreshFragment() activity.runOnUiThread { @@ -521,8 +521,7 @@ class ItemsAdapter( private fun tryDecompressingPaths(sourcePaths: List, callback: (success: Boolean) -> Unit) { sourcePaths.forEach { path -> - val zipInputStream = ZipInputStream(BufferedInputStream(activity.getFileInputStreamSync(path))) - zipInputStream.use { + ZipInputStream(BufferedInputStream(activity.getFileInputStreamSync(path))).use { zipInputStream -> try { val fileDirItems = ArrayList() var entry = zipInputStream.nextEntry @@ -541,6 +540,7 @@ class ItemsAdapter( } } } catch (exception: Exception) { + exception.printStackTrace() activity.showErrorToast(exception) } } @@ -643,8 +643,8 @@ class ItemsAdapter( while (!queue.isEmpty()) { mainFilePath = queue.pop() if (activity.getIsPathDirectory(mainFilePath)) { - if (activity.isRestrictedAndroidDir(mainFilePath)) { - activity.getStorageItemsWithTreeUri(mainFilePath, true) { files -> + if (activity.isRestrictedSAFOnlyRoot(mainFilePath)) { + activity.getAndroidSAFFileItems(mainFilePath, true) { files -> for (file in files) { name = file.path.relativizeWith(base) if (activity.getIsPathDirectory(file.path)) { @@ -884,8 +884,8 @@ class ItemsAdapter( path } - if (activity.isRestrictedAndroidDir(path)) { - itemToLoad = activity.getPrimaryAndroidSAFUri(path) + if (activity.isRestrictedSAFOnlyRoot(path)) { + itemToLoad = activity.getAndroidSAFUri(path) } else if (hasOTGConnected && itemToLoad is String && activity.isPathOnOTG(itemToLoad) && baseConfig.OTGTreeUri.isNotEmpty() && baseConfig.OTGPartition.isNotEmpty()) { itemToLoad = getOTGPublicPath(itemToLoad) } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt index fa731fbc..d54116c4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt @@ -51,6 +51,27 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca private fun createDirectory(path: String, alertDialog: AlertDialog, callback: (Boolean) -> Unit) { when { + isRPlus() || path.startsWith(activity.internalStoragePath, true) -> { + if (activity.isRestrictedSAFOnlyRoot(path)) { + activity.handlePrimaryAndroidSAFDialog(path) { + if (!it) { + callback(false) + return@handlePrimaryAndroidSAFDialog + } + if (activity.createAndroidSAFDirectory(path)) { + success(alertDialog) + } else { + val error = String.format(activity.getString(R.string.could_not_create_folder), path) + activity.showErrorToast(error) + callback(false) + } + } + } else { + if (File(path).mkdirs()) { + success(alertDialog) + } + } + } activity.needsStupidWritePermissions(path) -> activity.handleSAFDialog(path) { if (!it) { return@handleSAFDialog @@ -66,27 +87,6 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca documentFile.createDirectory(path.getFilenameFromPath()) success(alertDialog) } - isRPlus() || path.startsWith(activity.internalStoragePath, true) -> { - if (activity.isRestrictedAndroidDir(path)) { - activity.handlePrimaryAndroidSAFDialog(path) { - if (!it) { - callback(false) - return@handlePrimaryAndroidSAFDialog - } - if (activity.createSAFOnlyDirectory(path)) { - success(alertDialog) - } else { - val error = String.format(activity.getString(R.string.could_not_create_folder), path) - activity.showErrorToast(error) - callback(false) - } - } - } else { - if (File(path).mkdirs()) { - success(alertDialog) - } - } - } else -> { RootHelpers(activity).createFileFolder(path, false) { if (it) { @@ -102,13 +102,13 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca private fun createFile(path: String, alertDialog: AlertDialog, callback: (Boolean) -> Unit) { try { when { - activity.isRestrictedAndroidDir(path) -> { + activity.isRestrictedSAFOnlyRoot(path) -> { activity.handlePrimaryAndroidSAFDialog(path) { if (!it) { callback(false) return@handlePrimaryAndroidSAFDialog } - if (activity.createSAFOnlyFile(path)) { + if (activity.createAndroidSAFFile(path)) { success(alertDialog) } else { val error = String.format(activity.getString(R.string.could_not_create_file), path) @@ -141,7 +141,6 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca success(alertDialog) } } - else -> { RootHelpers(activity).createFileFolder(path, true) { if (it) { diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/extensions/Context.kt index 0e30de4a..07b1f5f5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/extensions/Context.kt @@ -3,9 +3,8 @@ package com.simplemobiletools.filemanager.pro.extensions import android.content.Context import com.simplemobiletools.commons.extensions.isPathOnOTG import com.simplemobiletools.commons.extensions.isPathOnSD -import com.simplemobiletools.commons.extensions.otgPath -import com.simplemobiletools.commons.extensions.sdCardPath import com.simplemobiletools.filemanager.pro.helpers.Config val Context.config: Config get() = Config.newInstance(applicationContext) + fun Context.isPathOnRoot(path: String) = !(path.startsWith(config.internalStoragePath) || isPathOnOTG(path) || (isPathOnSD(path))) 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 784841d3..56856166 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 @@ -187,15 +187,15 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF val isSortingBySize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0 val getProperChildCount = context!!.config.getFolderViewType(currentPath) == VIEW_TYPE_LIST - if (context.isRestrictedAndroidDir(path)) { + if (context.isRestrictedSAFOnlyRoot(path)) { activity?.handlePrimaryAndroidSAFDialog(path) { if (!it) { activity?.toast(R.string.no_storage_permissions) return@handlePrimaryAndroidSAFDialog } - context.getStorageItemsWithTreeUri(path, context.config.shouldShowHidden, getProperChildCount) { - callback(path, getListItemsFromFileDirItems(it)) + context.getAndroidSAFFileItems(path, context.config.shouldShowHidden, getProperChildCount) { fileItems -> + callback(path, getListItemsFromFileDirItems(fileItems)) } } } else { 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 39541e45..a2f0c66e 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 @@ -149,7 +149,6 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage } } } catch (e: Exception) { - e.printStackTrace() activity?.showErrorToast(e) } diff --git a/app/src/main/res/menu/cab.xml b/app/src/main/res/menu/cab.xml index b179b77b..7dfbb6db 100644 --- a/app/src/main/res/menu/cab.xml +++ b/app/src/main/res/menu/cab.xml @@ -13,12 +13,12 @@ app:showAsAction="always"/> - Simple File Manager Pro - Manage files easily & fast + Simple File Manager Pro - Manage files easily & fast - Quick file management with no ads. Browse files easily, securely & fast + Quick file management with no ads. Browse files easily, securely & fast Un xestor de ficheiros rápido e lixeiro para uso diario. Ofrece unha funcionalidade de busca útil e podes personalizar o cartafol de inicio e seleccionar os cartafoles favoritos para un acceso rápido. From 781870e73260db031ecfb25b2436cd50689aa598 Mon Sep 17 00:00:00 2001 From: darthpaul Date: Sun, 14 Nov 2021 22:19:28 +0000 Subject: [PATCH 18/37] method renaming and reformat --- .../filemanager/pro/adapters/ItemsAdapter.kt | 4 +- .../pro/dialogs/CreateNewItemDialog.kt | 8 +-- .../pro/fragments/ItemsFragment.kt | 66 ++++++++----------- .../pro/fragments/RecentsFragment.kt | 5 +- 4 files changed, 37 insertions(+), 46 deletions(-) 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 c38f499e..69907b87 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 @@ -465,9 +465,9 @@ class ItemsAdapter( CompressAsDialog(activity, firstPath) { val destination = it - activity.handlePrimaryAndroidSAFDialog(firstPath) { granted -> + activity.handleAndroidSAFDialog(firstPath) { granted -> if (!granted) { - return@handlePrimaryAndroidSAFDialog + return@handleAndroidSAFDialog } activity.handleSAFDialog(firstPath) { if (!it) { diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt index d54116c4..86fb1370 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt @@ -53,10 +53,10 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca when { isRPlus() || path.startsWith(activity.internalStoragePath, true) -> { if (activity.isRestrictedSAFOnlyRoot(path)) { - activity.handlePrimaryAndroidSAFDialog(path) { + activity.handleAndroidSAFDialog(path) { if (!it) { callback(false) - return@handlePrimaryAndroidSAFDialog + return@handleAndroidSAFDialog } if (activity.createAndroidSAFDirectory(path)) { success(alertDialog) @@ -103,10 +103,10 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca try { when { activity.isRestrictedSAFOnlyRoot(path) -> { - activity.handlePrimaryAndroidSAFDialog(path) { + activity.handleAndroidSAFDialog(path) { if (!it) { callback(false) - return@handlePrimaryAndroidSAFDialog + return@handleAndroidSAFDialog } if (activity.createAndroidSAFFile(path)) { success(alertDialog) 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 56856166..9917bf05 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 @@ -162,7 +162,18 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF ensureBackgroundThread { if (activity?.isDestroyed == false && activity?.isFinishing == false) { val config = context!!.config - if (context!!.isPathOnOTG(path) && config.OTGTreeUri.isNotEmpty()) { + if (context.isRestrictedSAFOnlyRoot(path)) { + activity?.handleAndroidSAFDialog(path) { + if (!it) { + activity?.toast(R.string.no_storage_permissions) + return@handleAndroidSAFDialog + } + val getProperChildCount = context!!.config.getFolderViewType(currentPath) == VIEW_TYPE_LIST + context.getAndroidSAFFileItems(path, context.config.shouldShowHidden, getProperChildCount) { fileItems -> + callback(path, getListItemsFromFileDirItems(fileItems)) + } + } + } else if (context!!.isPathOnOTG(path) && config.OTGTreeUri.isNotEmpty()) { val getProperFileSize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0 context!!.getOTGItems(path, config.shouldShowHidden, getProperFileSize) { callback(path, getListItemsFromFileDirItems(it)) @@ -178,52 +189,33 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF private fun getRegularItemsOf(path: String, callback: (originalPath: String, items: ArrayList) -> Unit) { val items = ArrayList() - - if (context == null) { + val files = File(path).listFiles()?.filterNotNull() + if (context == null || files == null) { callback(path, items) return } val isSortingBySize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0 val getProperChildCount = context!!.config.getFolderViewType(currentPath) == VIEW_TYPE_LIST + val lastModifieds = context!!.getFolderLastModifieds(path) - if (context.isRestrictedSAFOnlyRoot(path)) { - activity?.handlePrimaryAndroidSAFDialog(path) { - if (!it) { - activity?.toast(R.string.no_storage_permissions) - return@handlePrimaryAndroidSAFDialog - } - - context.getAndroidSAFFileItems(path, context.config.shouldShowHidden, getProperChildCount) { fileItems -> - callback(path, getListItemsFromFileDirItems(fileItems)) - } + for (file in files) { + val fileDirItem = getFileDirItemFromFile(file, isSortingBySize, lastModifieds, false) + if (fileDirItem != null) { + items.add(fileDirItem) } - } else { - val files = File(path).listFiles()?.filterNotNull() - if (files == null) { - callback(path, items) - return - } - val lastModifieds = context!!.getFolderLastModifieds(path) + } - for (file in files) { - val fileDirItem = getFileDirItemFromFile(file, isSortingBySize, lastModifieds, false) - if (fileDirItem != null) { - items.add(fileDirItem) - } - } + // send out the initial item list asap, get proper child count asynchronously as it can be slow + callback(path, items) - // send out the initial item list asap, get proper child count asynchronously as it can be slow - callback(path, items) - - if (getProperChildCount) { - items.filter { it.mIsDirectory }.forEach { - if (context != null) { - val childrenCount = it.getDirectChildrenCount(activity as BaseSimpleActivity, showHidden) - if (childrenCount != 0) { - activity?.runOnUiThread { - getRecyclerAdapter()?.updateChildCount(it.mPath, childrenCount) - } + if (getProperChildCount) { + items.filter { it.mIsDirectory }.forEach { + if (context != null) { + val childrenCount = it.getDirectChildrenCount(activity as BaseSimpleActivity, showHidden) + if (childrenCount != 0) { + activity?.runOnUiThread { + getRecyclerAdapter()?.updateChildCount(it.mPath, childrenCount) } } } 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 a2f0c66e..49438aa6 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 @@ -123,7 +123,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage ) try { - val cursor = if (isOreoPlus()) { + if (isOreoPlus()) { val queryArgs = bundleOf( ContentResolver.QUERY_ARG_LIMIT to RECENTS_LIMIT, ContentResolver.QUERY_ARG_SORT_COLUMNS to arrayOf(FileColumns.DATE_MODIFIED), @@ -133,8 +133,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage } else { val sortOrder = "${FileColumns.DATE_MODIFIED} DESC LIMIT $RECENTS_LIMIT" context?.contentResolver?.query(uri, projection, null, null, sortOrder) - } - cursor?.use { + }?.use { cursor -> if (cursor.moveToFirst()) { do { val path = cursor.getStringValue(FileColumns.DATA) From c695fd0955361c86409bff4130cf35c65fc14298 Mon Sep 17 00:00:00 2001 From: darthpaul Date: Sun, 14 Nov 2021 22:33:51 +0000 Subject: [PATCH 19/37] update commons --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 80dfb569..63dfec45 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -58,7 +58,7 @@ android { } dependencies { - implementation project(":commons") + implementation 'com.github.SimpleMobileTools:Simple-Commons:c7f376f7cd' implementation 'com.github.Stericson:RootTools:df729dcb13' implementation 'com.github.Stericson:RootShell:1.6' implementation 'com.alexvasilkov:gesture-views:2.5.2' From d92af2f97dda08c7110ab389e8c70807e7743283 Mon Sep 17 00:00:00 2001 From: darthpaul Date: Sun, 14 Nov 2021 23:00:12 +0000 Subject: [PATCH 20/37] ensure decompression is in background thread --- .../filemanager/pro/adapters/ItemsAdapter.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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 69907b87..e5aaf931 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 @@ -505,15 +505,17 @@ class ItemsAdapter( } val paths = getSelectedFileDirItems().asSequence().map { it.path }.filter { it.isZipFile() }.toList() - tryDecompressingPaths(paths) { - if (it) { - activity.toast(R.string.decompression_successful) + ensureBackgroundThread { + tryDecompressingPaths(paths) { success -> activity.runOnUiThread { - listener?.refreshFragment() - finishActMode() + if (success) { + activity.toast(R.string.decompression_successful) + listener?.refreshFragment() + finishActMode() + } else { + activity.toast(R.string.decompressing_failed) + } } - } else { - activity.toast(R.string.decompressing_failed) } } } @@ -540,7 +542,6 @@ class ItemsAdapter( } } } catch (exception: Exception) { - exception.printStackTrace() activity.showErrorToast(exception) } } @@ -589,7 +590,6 @@ class ItemsAdapter( } callback(true) } catch (e: Exception) { - e.printStackTrace() activity.showErrorToast(e) callback(false) } From 1965a5d8ed53914cb5390acfdf5f2ebd7728fc90 Mon Sep 17 00:00:00 2001 From: Eric Date: Sun, 14 Nov 2021 04:31:30 +0000 Subject: [PATCH 21/37] Translated using Weblate (Chinese (Simplified)) Currently translated at 100.0% (47 of 47 strings) Translation: Simple Mobile Tools/Simple File Manager Translate-URL: https://hosted.weblate.org/projects/simple-mobile-tools/simple-file-manager/zh_Hans/ --- app/src/main/res/values-zh-rCN/strings.xml | 28 ++++++++-------------- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index ffde2c32..6633bac2 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -11,9 +11,8 @@ 请选择一个音频文件 搜索文件夹 该选项仅在 root 后的设备上工作 - Recents - Show recents - + 最近 + 显示最近 打开为 文本文件 @@ -21,7 +20,6 @@ 音频文件 视频文件 其他文件 - 压缩 解压缩 @@ -32,31 +30,26 @@ 解压缩成功 压缩失败 解压缩失败 - 管理收藏 前往收藏 您可以将经常访问的文件夹添加至收藏便于从任意位置快速访问。 - 文件编辑器 - - Storage analysis - Images - Videos + 存储分析 + 图片 + 视频 Audio Documents Downloads - Archives - Others + 存档 + 其他 free - Total storage: %s - + 总存储: %s 启用 root 访问 - Require pressing Back twice to leave the app - + 需要按两次返回键才能离开应用程序 简易文件管理 Pro - 轻松管理文件 & 快速体验 @@ -97,9 +90,8 @@ Reddit: https://www.reddit.com/r/SimpleMobileTools - - + \ No newline at end of file From 77ec965e40103d8dbad2e41bf25544a6a8bbbf37 Mon Sep 17 00:00:00 2001 From: darthpaul Date: Mon, 15 Nov 2021 09:04:02 +0000 Subject: [PATCH 22/37] update settings.gradle --- settings.gradle | 2 -- 1 file changed, 2 deletions(-) diff --git a/settings.gradle b/settings.gradle index 707304a6..e7b4def4 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1 @@ include ':app' -include ':commons' -project(":commons").projectDir = new File("/Users/darthpaul/StudioProjects/Simple-Commons/commons") From 212b50070a491bed704f649993d39b955255262b Mon Sep 17 00:00:00 2001 From: teemue Date: Mon, 15 Nov 2021 17:58:13 +0000 Subject: [PATCH 23/37] Translated using Weblate (Finnish) Currently translated at 100.0% (47 of 47 strings) Translation: Simple Mobile Tools/Simple File Manager Translate-URL: https://hosted.weblate.org/projects/simple-mobile-tools/simple-file-manager/fi/ --- app/src/main/res/values-fi/strings.xml | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 93640037..4785e3ac 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -13,7 +13,6 @@ Tämä toiminto vaatii rootatun laitteen Viimeaikaiset Näytä viimeaikaiset - Avaa... Tekstitiedostona @@ -21,7 +20,6 @@ Äänitiedostona Videotiedostona Jonakin muuna tiedostona - Pakkaa Pura @@ -32,34 +30,29 @@ Purkaminen valmis Pakkaaminen epäonnistui Purkaminen epäonnistui - Hallitse suosikkeja Mene suosikkiin Voit lisätä usein käyttämiäsi kansiota suosikeiksi, jolloin niiden käyttö on helppoa mistä vain. - Tiedostoeditori - - Storage analysis - Images - Videos + Tallennustilan analyysi + Kuvat + Videot Audio Documents Downloads - Archives - Others + Arkistot + Muut free Total storage: %s - Ota käyttöön root-ominaisuudet Ota käyttöön sovelluksesta poistuminen kahdella takaisin-painikkeen painalluksella - - Simple File Manager Pro - Manage files easy & fast + Simple File Manager Pro - Tehokas tiedostohallinta Helppo tiedostonhallinta turvallisesti yksityisyyttä kunnioittaen, ei mainoksia. @@ -97,9 +90,8 @@ Reddit: https://www.reddit.com/r/SimpleMobileTools - - + \ No newline at end of file From 55bbd8e3e438a42092f8c43f54d3eebb35aae277 Mon Sep 17 00:00:00 2001 From: "J. Lavoie" Date: Tue, 16 Nov 2021 01:40:35 +0000 Subject: [PATCH 24/37] Translated using Weblate (French) Currently translated at 100.0% (47 of 47 strings) Translation: Simple Mobile Tools/Simple File Manager Translate-URL: https://hosted.weblate.org/projects/simple-mobile-tools/simple-file-manager/fr/ --- app/src/main/res/values-fr/strings.xml | 32 ++++++++++---------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 8aa938f9..d64f3877 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -11,9 +11,8 @@ Veuillez sélectionner un fichier audio Chercher dans le dossier Cette opération ne fonctionne que sur les périphériques rooté - Recents - Show recents - + Récents + Afficher les récents Ouvert comme Fichier texte @@ -21,7 +20,6 @@ Fichier audio Fichier vidéo Autre fichier - Compresser Décompresser @@ -32,36 +30,31 @@ Décompression réussie Compression ratée Décompression ratée - Gérer les favoris Aller au favori Vous pouvez ajouter des dossiers souvent utilisés comme favoris pour y avoir accès rapidement depuis n\'importe où. - Éditeur de fichier - - Storage analysis + Analyse du stockage Images - Videos + Vidéos Audio Documents - Downloads + Téléchargements Archives - Others - free - Total storage: %s - + Autres + libre + Stockage total : %s Activer les droits root - Require pressing Back twice to leave the app - + Obligation d\'appuyer deux fois sur la touche Retour pour quitter l\'application - Simple File Manager Pro - Manage files easy & fast + Simple File Manager Pro – Gérer les fichiers facilement et rapidement - Easy app for managing your files without ads, respecting your privacy & security + Une application simple pour gérer vos fichiers sans publicité, en respectant votre vie privée et votre sécurité 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. @@ -97,9 +90,8 @@ Reddit: https://www.reddit.com/r/SimpleMobileTools - - + \ No newline at end of file From e4c952b482ce06e42546a978c844f92a7d439536 Mon Sep 17 00:00:00 2001 From: "J. Lavoie" Date: Tue, 16 Nov 2021 01:46:44 +0000 Subject: [PATCH 25/37] Translated using Weblate (Italian) Currently translated at 100.0% (47 of 47 strings) Translation: Simple Mobile Tools/Simple File Manager Translate-URL: https://hosted.weblate.org/projects/simple-mobile-tools/simple-file-manager/it/ --- app/src/main/res/values-it/strings.xml | 28 +++++++++----------------- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 2cb54a09..5f527b41 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -13,7 +13,6 @@ Questa operazione funziona solo nei dispositivi con permessi di root Recenti Mostra i recenti - Apri come File di testo @@ -21,7 +20,6 @@ File audio File video Altro - Comprimi Decomprimi @@ -32,31 +30,26 @@ Decompressione completata Impossibile comprimere Impossibile decomprimere - Gestisci i preferiti Vai al preferito Si possono aggiungere le cartelle usate frequentemente ai preferiti, per un rapido accesso da qualsiasi posizione. - Editor dei file - - Storage analysis - Images - Videos + Analisi dello stoccaggio + Immagini + Video Audio - Documents - Downloads - Archives - Others - free - Total storage: %s - + Documenti + Scaricamenti + Archivi + Altri + libero + Memoria totale: %s Abilita accesso root Richiedi di premere Indietro due volte per uscire dall\'app - Semplice Gestore di file Pro - Facile e veloce @@ -97,9 +90,8 @@ Reddit: https://www.reddit.com/r/SimpleMobileTools - - + \ No newline at end of file From dc55b35dae1756bbdc7a892ceeb75ee6e015dfa8 Mon Sep 17 00:00:00 2001 From: darthpaul Date: Tue, 16 Nov 2021 22:18:51 +0000 Subject: [PATCH 26/37] remove printing exeception stacktrace --- .../simplemobiletools/filemanager/pro/activities/MainActivity.kt | 1 - 1 file changed, 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 b21a76f7..0e8ab0bb 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 @@ -320,7 +320,6 @@ class MainActivity : SimpleActivity() { intent.data = Uri.parse("package:$packageName") startActivityForResult(intent, MANAGE_STORAGE_RC) } catch (e: Exception) { - e.printStackTrace() val intent = Intent() intent.action = Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION startActivityForResult(intent, MANAGE_STORAGE_RC) From f0165b73e754c0995492747f03a3628391e3787e Mon Sep 17 00:00:00 2001 From: Rex_sa Date: Tue, 16 Nov 2021 10:30:02 +0000 Subject: [PATCH 27/37] Translated using Weblate (Arabic) Currently translated at 100.0% (47 of 47 strings) Translation: Simple Mobile Tools/Simple File Manager Translate-URL: https://hosted.weblate.org/projects/simple-mobile-tools/simple-file-manager/ar/ --- app/src/main/res/values-ar/strings.xml | 72 ++++++-------------------- 1 file changed, 15 insertions(+), 57 deletions(-) diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 69168260..f21271d8 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -9,11 +9,10 @@ نسخ المسار الى الحافظة تم نسخ المسار الرجاء تحديد ملف صوتي - Search folder - This operation works only on rooted devices - Recents - Show recents - + مجلد البحث + تعمل هذه العملية فقط على الأجهزة المتجذرة + الأحدث + إظهار الأحدث Open as Text file @@ -21,7 +20,6 @@ Audio file Video file Other file - ضغط فك الضغط @@ -32,74 +30,34 @@ نجح التفكيك أخفق الضغط أخفق إلغاء الضغط - إدارة المفضلة الذهاب الى المفضلة يمكنك إضافة المجلدات المستخدمة بشكل متكرر إلى المفضلة لسهولة الوصول إليها من أي مكان. - محرر الملفات - - Storage analysis - Images - Videos + تحليل التخزين + الصور + الفيديوات Audio Documents Downloads - Archives - Others + الأرشيف + الاخرين free - Total storage: %s - + إجمالي مساحة التخزين: %s تفعيل الدخول الى مسار الروت - Require pressing Back twice to leave the app - + تتطلب الضغط على رجوع مرتين لمغادرة التطبيق - Simple File Manager Pro - Manage files easy & fast + مدير الملفات البسيط برو -- إدارة الملفات سهلة وسريعة - 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. - - 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. - - This modern file organizer supports fast browsing of root files, SD cards and USB devices. - - 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. - - You can obviously select sorting by multiple different values, toggle between ascending and descending, or use a folder specific sorting. - - 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. - - To get a file or folders path quickly, you can easily select it by long pressing and copying it in the clipboard. - - You can create handy desktop shortcuts for accessing your favorite items quickly. - - 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. - - 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. - - Contains no ads or unnecessary permissions. It is fully opensource, provides customizable colors. - - Check out the full suite of Simple Tools here: - https://www.simplemobiletools.com - - Standalone website of Simple File Manager Pro: - https://www.simplemobiletools.com/filemanager - - Facebook: - https://www.facebook.com/simplemobiletools - - Reddit: - https://www.reddit.com/r/SimpleMobileTools - - + التطبيق السهل لإدارة الملفات الخاصة بك دون إعلانات، واحترام خصوصيتك والأمن + مدير ملفات سريع خفيف الوزن للاستخدام اليومي. وهو يوفر وظيفة بحث المستخدم، يمكنك أيضا تخصيص المجلد الرئيسي وتحديد المجلدات المفضلة للوصول السريع. يحتوي التطبيق على العديد من الوظائف الأمنية القوية ذات الصلة، مثل كلمة المرور لحماية العناصر المخفية، وحذف الملفات، أو التطبيق بأكمله. يمكنك الاختيار بين استخدام نمط أو دبوس أو بصمة إصبع للحفاظ على خصوصية بياناتك. يدعم منظم الملفات الحديث هذا التصفح السريع للملفات الجذرية وبطاقات SD وأجهزة USB. للحفاظ على الإنتاجية الخاصة بك، فمن الواضح أن لديها كل عمليات الملفات القياسية مثل إعادة تسمية، نسخ، نقل، حذف، مشاركة الخ. ويمكن أيضا أن تستخدم لتوفير بعض التخزين، لأنه يسمح ضغط وفك الضغط أيضا. يمكنك بسهولة إنشاء ملفات أو مجلدات جديدة إذا كنت ترغب في ذلك. من الواضح أنه يمكنك تحديد الفرز حسب قيم مختلفة متعددة أو التبديل بين تصاعدي و تنازلي أو استخدام فرز مجلد معين. من خلال عدد قليل من النقرات يمكنك أيضا التحقق من خصائص الملف أو المجلد ، والتي تظهر حقولا مختلفة مثل حجم الملف ، وتاريخ التعديل الأخير ، أو قيم EXIF مثل تاريخ الإنشاء ، طراز الكاميرا في الصور وما إلى ذلك. للحصول على مسار ملف أو مجلدات بسرعة، يمكنك تحديده بسهولة عن طريق الضغط عليه ونسخه لفترة طويلة في الحافظة. يمكنك إنشاء اختصارات سطح المكتب مفيد للوصول إلى العناصر المفضلة لديك بسرعة. وهو يحتوي على محرر ملفات خفيف يمكنك استخدامه إما لطباعة المستندات أو تحريرها أو قراءتها بسهولة باستخدام إيماءات التكبير/ التصغير، كلما دعت الحاجة. لأنه يأتي مع تصميم المواد وموضوع الظلام افتراضيا، ويوفر تجربة مستخدم كبيرة لسهولة الاستخدام. عدم الوصول إلى الإنترنت يمنحك المزيد من الخصوصية والأمان والاستقرار أكثر من التطبيقات الأخرى. لا يحتوي على إعلانات أو أذونات غير ضرورية. فمن مفتوحة المصدر تماما، ويوفر ألوان قابلة للتخصيص. تحقق من مجموعة كاملة من أدوات بسيطة هنا: https://www.simplemobiletools.com موقع مستقل من مدير الملفات البسيطة برو: https://www.simplemobiletools.com/filemanager Facebook: https://www.facebook.com/simplemobiletools Reddit: https://www.reddit.com/r/SimpleMobileTools - + \ No newline at end of file From b0df840b4e2527fcaf2f95b38a6dea5bfcb137c7 Mon Sep 17 00:00:00 2001 From: "J. Lavoie" Date: Tue, 16 Nov 2021 13:10:46 +0000 Subject: [PATCH 28/37] Translated using Weblate (German) Currently translated at 100.0% (47 of 47 strings) Translation: Simple Mobile Tools/Simple File Manager Translate-URL: https://hosted.weblate.org/projects/simple-mobile-tools/simple-file-manager/de/ --- app/src/main/res/values-de/strings.xml | 40 +++++++++++--------------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 0ea975b8..49e3328a 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -8,12 +8,11 @@ Start-Verzeichnis aktualisiert Kopiere Pfad in die Zwischenablage Pfad kopiert - Bitte wähle eine Audiodatei aus. + Bitte wähle eine Audiodatei aus Ordner suchen - Dies kann nur auf gerooteten Geräten durchgeführt werden. + Dies kann nur auf gerooteten Geräten durchgeführt werden Neueste Zeige die Neuesten - Öffnen als Text-Datei @@ -21,47 +20,41 @@ Audio-Datei Video-Datei Anderer Dateityp - Komprimieren Entpacken Komprimieren als Komprimiere… Entpacke… - Komprimieren erfolgreich. - Entpacken erfolgreich. - Komprimieren fehlgeschlagen. - Entpacken fehlgeschlagen. - + Komprimieren erfolgreich + Entpacken erfolgreich + Komprimieren fehlgeschlagen + Entpacken fehlgeschlagen Verwalte Favoriten Gehe zu Favoriten - Du kannst häufig benutzte Ordner für einen einfacheren Zugriff zu den Favoriten hinzufügen - + Du kannst häufig benutzte Ordner für einen einfacheren Zugriff zu den Favoriten hinzufügen. Dateieditor - - Storage analysis - Images + Speicheranalyse + Bilder Videos Audio Documents Downloads - Archives - Others + Archiv + Andere free - Total storage: %s - + Gesamter Speicherplatz: %s Root-Zugriff erlauben - Require pressing Back twice to leave the app - + Zweimaliges Drücken von Zurück ist erforderlich, um die Anwendung zu verlassen - Simple File Manager Pro - Manage files easy & fast + Simple File Manager Pro - Dateien einfach und schnell verwalten - Easy app for managing your files without ads, respecting your privacy & security + Einfache Anwendung zur Verwaltung Ihrer Dateien ohne Werbung, unter Wahrung Ihrer Privatsphäre und Sicherheit Ein leichter, schneller Dateimanager für den täglichen Gebrauch. Es bietet eine nützliche Suchfunktion; zudem kannst du den Home-Ordner anpassen und Lieblingsordner für den schnellen Zugriff konfigurieren. @@ -97,9 +90,8 @@ Reddit: https://www.reddit.com/r/SimpleMobileTools - - + \ No newline at end of file From 91f0dbc572e31624839f063f5b38e81c2c8e48da Mon Sep 17 00:00:00 2001 From: solokot Date: Tue, 16 Nov 2021 09:02:37 +0000 Subject: [PATCH 29/37] Translated using Weblate (Russian) Currently translated at 100.0% (47 of 47 strings) Translation: Simple Mobile Tools/Simple File Manager Translate-URL: https://hosted.weblate.org/projects/simple-mobile-tools/simple-file-manager/ru/ --- app/src/main/res/values-ru/strings.xml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index d11cf7c7..1e8a18ad 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -13,7 +13,6 @@ Это работает только на устройствах с root-доступом Recents Show recents - Открыть как Текст @@ -21,7 +20,6 @@ Аудио Видео Другое - Сжать Распаковать @@ -32,18 +30,15 @@ Распаковка успешна Не удалось сжать Не удалось распаковать - Настроить избранное Открыть избранное Вы можете добавить часто используемые папки в избранное для быстрого доступа к ним. - Редактор файлов - Storage analysis - Images + Изображения Videos Audio Documents @@ -52,11 +47,9 @@ Others free Total storage: %s - Включить root-доступ Require pressing Back twice to leave the app - Simple File Manager Pro - Manage files easy & fast @@ -97,9 +90,8 @@ Reddit: https://www.reddit.com/r/SimpleMobileTools - - + \ No newline at end of file From 13fdcf9089bf4de4f75ad8b95b0ed0321f7fd47a Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 21 Nov 2021 21:40:06 +0100 Subject: [PATCH 30/37] updating commons + some compatibility --- app/build.gradle | 2 +- app/src/main/AndroidManifest.xml | 10 ---------- .../filemanager/pro/activities/MainActivity.kt | 2 +- .../filemanager/pro/fragments/ItemsFragment.kt | 2 +- app/src/main/res/drawable/ic_decompress_vector.xml | 10 ++-------- app/src/main/res/drawable/ic_home_vector.xml | 10 ++-------- app/src/main/res/drawable/ic_storage_vector.xml | 10 ++-------- app/src/main/res/menu/cab.xml | 6 +++--- app/src/main/res/menu/menu.xml | 10 ++++++---- build.gradle | 2 +- 10 files changed, 19 insertions(+), 45 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d0459fe6..a94e34c7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -58,7 +58,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:5079455be9' + implementation 'com.github.SimpleMobileTools:Simple-Commons:c184f98ca8' 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/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3f67a418..83eadc0a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -113,21 +113,11 @@ android:label="@string/about" android:parentActivityName=".activities.MainActivity"/> - - - - - + + diff --git a/app/src/main/res/drawable/ic_home_vector.xml b/app/src/main/res/drawable/ic_home_vector.xml index df0f6832..d409807a 100644 --- a/app/src/main/res/drawable/ic_home_vector.xml +++ b/app/src/main/res/drawable/ic_home_vector.xml @@ -1,9 +1,3 @@ - - + + diff --git a/app/src/main/res/drawable/ic_storage_vector.xml b/app/src/main/res/drawable/ic_storage_vector.xml index 80565aae..d620cacb 100644 --- a/app/src/main/res/drawable/ic_storage_vector.xml +++ b/app/src/main/res/drawable/ic_storage_vector.xml @@ -1,9 +1,3 @@ - - + + diff --git a/app/src/main/res/menu/cab.xml b/app/src/main/res/menu/cab.xml index b179b77b..050c0845 100644 --- a/app/src/main/res/menu/cab.xml +++ b/app/src/main/res/menu/cab.xml @@ -13,12 +13,12 @@ app:showAsAction="always"/> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> diff --git a/build.gradle b/build.gradle index 9b82dbc6..87eca93f 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.31' + ext.kotlin_version = '1.6.0' repositories { google() From 2b0b6e1079206886e12093446adfa3e3ad14fc03 Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Sun, 21 Nov 2021 22:13:21 +0100 Subject: [PATCH 31/37] Update build.gradle --- app/build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 63dfec45..e14f7c00 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,7 +10,6 @@ if (keystorePropertiesFile.exists()) { android { compileSdkVersion 30 - buildToolsVersion "29.0.3" defaultConfig { applicationId "com.simplemobiletools.filemanager.pro" From 28f63a3eb6d75f635a111009f24d4abc906cd2e9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 21 Nov 2021 22:19:30 +0100 Subject: [PATCH 32/37] adding a new string for the Manage Storage permission --- 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-gl/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-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 f21271d8..a4a804ba 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -13,6 +13,7 @@ تعمل هذه العملية فقط على الأجهزة المتجذرة الأحدث إظهار الأحدث + Please grant our app access to all your files, it might not work well without it. Open as Text file diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index e62163df..051dba80 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -13,6 +13,7 @@ Bu əməliyyat yalnız root\'lu cihazlarda işləyir Recents Show recents + Please grant our app access to all your files, it might not work well without it. Open as diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 8b7c7677..1c67b4f5 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -13,6 +13,7 @@ Tato operace funguje pouze u rootnutých zařízení Recents Show recents + Please grant our app access to all your files, it might not work well without it. Otevřít jako diff --git a/app/src/main/res/values-cy/strings.xml b/app/src/main/res/values-cy/strings.xml index a8b96a55..86ff256e 100644 --- a/app/src/main/res/values-cy/strings.xml +++ b/app/src/main/res/values-cy/strings.xml @@ -13,6 +13,7 @@ Dyw\'r weithred hon ond yn gweithio ar ddyfeisiau wedi\'u gwreddio Recents Show recents + Please grant our app access to all your files, it might not work well without it. Agor fel diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index ba6f4c87..b30f7b57 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -13,6 +13,7 @@ Denne funkton virker kun på rootede enheder Recents Show recents + Please grant our app access to all your files, it might not work well without it. Åbn som diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 49e3328a..a935fec0 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -13,6 +13,7 @@ Dies kann nur auf gerooteten Geräten durchgeführt werden Neueste Zeige die Neuesten + Please grant our app access to all your files, it might not work well without it. Öffnen als Text-Datei diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index ee1ef195..fc937dda 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -13,6 +13,7 @@ Αυτό το χαρακτηριστικό λειτουργεί μόνο σε συσκευές με πρόσβαση στον ριζικό κατάλογο. Πρόσφατα Εμφάνιση προσφάτων + Please grant our app access to all your files, it might not work well without it. Άνοιγμα ως diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index d1593f10..5942a91a 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -13,6 +13,7 @@ Esta operación solo funciona en dispositivos rooteados Recientes Mostrar recientes + Please grant our app access to all your files, it might not work well without it. Abrir como diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 4785e3ac..874b599d 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -13,6 +13,7 @@ Tämä toiminto vaatii rootatun laitteen Viimeaikaiset Näytä viimeaikaiset + Please grant our app access to all your files, it might not work well without it. Avaa... Tekstitiedostona diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index d64f3877..ce848235 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -13,6 +13,7 @@ Cette opération ne fonctionne que sur les périphériques rooté Récents Afficher les récents + Please grant our app access to all your files, it might not work well without it. Ouvert comme Fichier texte diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index fba54c8c..6e44b0fd 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -13,6 +13,7 @@ Esta operación só funciona en dispositivos con root Recents Show recents + Please grant our app access to all your files, it might not work well without it. Abrir como diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index 3f35d2b2..78cda8c7 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -13,6 +13,7 @@ यह ऑपरेशन केवल रूटेड डिवाइस पर काम करता है हाल के हाल ही में दिखाएं + Please grant our app access to all your files, it might not work well without it. इस रूप में खोलें टेकस्ट फ़ाइलें diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 4d2ba8df..e925648e 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -13,6 +13,7 @@ Ova radnja funkcionira samo na uređajima s root pristupom Recents Show recents + Please grant our app access to all your files, it might not work well without it. Otvori kao diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index e6a55178..95b44239 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -13,6 +13,7 @@ This operation works only on rooted devices Recents Show recents + Please grant our app access to all your files, it might not work well without it. Open as diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index d66dd18f..2fa1b20e 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -13,6 +13,7 @@ Tindakan ini hanya bekerja pada perangkat dengan akses root Recents Show recents + Please grant our app access to all your files, it might not work well without it. Buka sebagai diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 5f527b41..63a233de 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -13,6 +13,7 @@ Questa operazione funziona solo nei dispositivi con permessi di root Recenti Mostra i recenti + Please grant our app access to all your files, it might not work well without it. Apri come File di testo diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 56fc6b74..fd1caa37 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -13,6 +13,7 @@ この操作はルート化された端末でのみ機能します Recents Show recents + Please grant our app access to all your files, it might not work well without it. ファイル形式を指定して開く diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index a7e5de56..a7053551 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -13,6 +13,7 @@ This operation works only on rooted devices Recents Show recents + Please grant our app access to all your files, it might not work well without it. Open as diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 159be3cd..462b2d31 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -13,6 +13,7 @@ This operation works only on rooted devices Recents Show recents + Please grant our app access to all your files, it might not work well without it. Open as diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 964dbbc8..1f6b7f47 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -13,6 +13,7 @@ Denne handlingen fungerer bare på rootede enheter. Recents Show recents + Please grant our app access to all your files, it might not work well without it. Open as diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 9931b450..bcfe0cc6 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -13,6 +13,7 @@ Deze bewerking is alleen mogelijk op een geroot apparaat Recent geopend Recente items tonen + Please grant our app access to all your files, it might not work well without it. Openen als diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 6c8818b3..d8cfe516 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -13,6 +13,7 @@ Ta operacja działa tylko na zrootowanych urządzeniach Ostatnie Pokaż ostatnie + Please grant our app access to all your files, it might not work well without it. Otwórz jako diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index d2c97711..b49239aa 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -13,6 +13,7 @@ Esta operação só funciona em dispositivos rooteados Recentes Mostrar recentes + Please grant our app access to all your files, it might not work well without it. Abrir como diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index bc93f98d..95d59d8c 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -13,6 +13,7 @@ Esta operação apenas funciona em dispositivos com root Recentes Mostrar recentes + Please grant our app access to all your files, it might not work well without it. Abrir como diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 1e8a18ad..36f64221 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -13,6 +13,7 @@ Это работает только на устройствах с root-доступом Recents Show recents + Please grant our app access to all your files, it might not work well without it. Открыть как Текст diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 1d24eb67..04d295f3 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -13,6 +13,7 @@ Táto operácia funguje iba na rootnutých zariadeniach Nedávne Zobraziť nedávne + Prosím povoľte našej apke prístup ku všetkým vašim súborom. Bez neho nebude fungovať správne. Otvoriť ako diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index e5fa79ee..af14e7d8 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -13,6 +13,7 @@ Åtgärden fungerar bara på rotade enheter Recents Show recents + Please grant our app access to all your files, it might not work well without it. Öppna som diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 404d852e..a5d54ba0 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -13,6 +13,7 @@ Bu işlem sadece rootlu cihazlarda çalışır Son dosyalar Son dosyaları göster + Please grant our app access to all your files, it might not work well without it. Farklı aç diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 0c4245c9..ed2bb413 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -13,6 +13,7 @@ Ця команда працює лише на пристроях з root-доступом Останні Показати останні + Please grant our app access to all your files, it might not work well without it. Відкрити як файл diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 6633bac2..e1a628b3 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -13,6 +13,7 @@ 该选项仅在 root 后的设备上工作 最近 显示最近 + Please grant our app access to all your files, it might not work well without it. 打开为 文本文件 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 02c1b313..fbf8dfcf 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -13,6 +13,7 @@ 這操作只對已root的裝置有用 Recents Show recents + Please grant our app access to all your files, it might not work well without it. 開啟成 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c7d2c25e..d02a1d87 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -13,6 +13,7 @@ This operation works only on rooted devices Recents Show recents + Please grant our app access to all your files, it might not work well without it. Open as From 3c8a67349aeb190b93bb85bc944770bd43123cf8 Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Sun, 21 Nov 2021 22:58:20 +0100 Subject: [PATCH 33/37] Update build.gradle --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index e14f7c00..71592065 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -57,7 +57,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:c7f376f7cd' + implementation 'com.github.SimpleMobileTools:Simple-Commons:4e6eeb901f' implementation 'com.github.Stericson:RootTools:df729dcb13' implementation 'com.github.Stericson:RootShell:1.6' implementation 'com.alexvasilkov:gesture-views:2.5.2' From 3294bc26a77bed10862a76d24411ea81772b65ad Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Sun, 21 Nov 2021 22:58:45 +0100 Subject: [PATCH 34/37] show a confirmation dialog before redirecting to the device settings --- .../pro/activities/MainActivity.kt | 43 +++++++++++++------ 1 file changed, 29 insertions(+), 14 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 00439b06..9ce9de22 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 @@ -1,5 +1,6 @@ package com.simplemobiletools.filemanager.pro.activities +import android.annotation.SuppressLint import android.app.Activity import android.app.SearchManager import android.content.ClipData @@ -16,9 +17,10 @@ import android.provider.Settings import android.view.Menu import android.view.MenuItem import androidx.appcompat.widget.SearchView -import androidx.core.app.ActivityCompat import androidx.core.view.MenuItemCompat import androidx.viewpager.widget.ViewPager +import com.simplemobiletools.commons.dialogs.ConfirmationAdvancedDialog +import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.* @@ -46,7 +48,6 @@ 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.lang.Exception import java.util.* class MainActivity : SimpleActivity() { @@ -306,23 +307,31 @@ class MainActivity : SimpleActivity() { } } + @SuppressLint("InlinedApi") private fun handleStoragePermission(callback: (granted: Boolean) -> Unit) { actionOnPermission = null if (hasStoragePermission()) { callback(true) } else { if (isRPlus()) { - isAskingPermissions = true - actionOnPermission = callback - try { - val intent = Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION) - intent.addCategory("android.intent.category.DEFAULT") - intent.data = Uri.parse("package:$packageName") - startActivityForResult(intent, MANAGE_STORAGE_RC) - } catch (e: Exception) { - val intent = Intent() - intent.action = Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION - startActivityForResult(intent, MANAGE_STORAGE_RC) + ConfirmationAdvancedDialog(this, "", R.string.access_storage_prompt, R.string.ok, 0) { success -> + if (success ) { + isAskingPermissions = true + actionOnPermission = callback + try { + val intent = Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION) + intent.addCategory("android.intent.category.DEFAULT") + intent.data = Uri.parse("package:$packageName") + startActivityForResult(intent, MANAGE_STORAGE_RC) + } catch (e: Exception) { + showErrorToast(e) + val intent = Intent() + intent.action = Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION + startActivityForResult(intent, MANAGE_STORAGE_RC) + } + } else { + finish() + } } } else { handlePermission(PERMISSION_WRITE_STORAGE, callback) @@ -330,10 +339,16 @@ class MainActivity : SimpleActivity() { } } + @SuppressLint("NewApi") private fun hasStoragePermission(): Boolean { - return if (isRPlus()) Environment.isExternalStorageManager() else hasPermission(PERMISSION_WRITE_STORAGE) + return if (isRPlus()) { + Environment.isExternalStorageManager() + } else { + hasPermission(PERMISSION_WRITE_STORAGE) + } } + @SuppressLint("NewApi") override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) { super.onActivityResult(requestCode, resultCode, resultData) isAskingPermissions = false From de00b6929994e5a399262733f07c22370f6196ee Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Sun, 21 Nov 2021 23:18:24 +0100 Subject: [PATCH 35/37] do not fill out the breadcrumbs before handling permissions --- .../filemanager/pro/fragments/ItemsFragment.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 9917bf05..3b31bcdc 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 @@ -23,10 +23,10 @@ import com.simplemobiletools.filemanager.pro.helpers.MAX_COLUMN_COUNT import com.simplemobiletools.filemanager.pro.helpers.RootHelpers import com.simplemobiletools.filemanager.pro.interfaces.ItemOperationsListener import com.simplemobiletools.filemanager.pro.models.ListItem +import kotlinx.android.synthetic.main.items_fragment.view.* import java.io.File import java.util.* import kotlin.collections.ArrayList -import kotlinx.android.synthetic.main.items_fragment.view.* class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet), ItemOperationsListener, Breadcrumbs.BreadcrumbsListener { @@ -58,13 +58,18 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF initDrawables() } - breadcrumbs.updateColor(textColor) items_fastscroller.updateBubbleColors() + + if (currentPath != "") { + breadcrumbs.updateColor(textColor) + } } override fun setupFontSize() { getRecyclerAdapter()?.updateFontSizes() - breadcrumbs.updateFontSize(context!!.getTextSize()) + if (currentPath != "") { + breadcrumbs.updateFontSize(context!!.getTextSize()) + } } override fun setupDateTimeFormat() { From ed304cabe8882ac7d64a62ae3ff95a31aa99b31a Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 22 Nov 2021 11:37:46 +0100 Subject: [PATCH 36/37] replacing the old fastscroller with the new one --- app/build.gradle | 2 +- .../pro/activities/MimeTypesActivity.kt | 34 ++++---------- .../pro/adapters/DecompressItemsAdapter.kt | 3 +- .../filemanager/pro/adapters/ItemsAdapter.kt | 13 +++--- .../pro/adapters/ManageFavoritesAdapter.kt | 6 ++- .../pro/fragments/ItemsFragment.kt | 45 ++++--------------- .../pro/fragments/RecentsFragment.kt | 2 +- .../main/res/layout/activity_mimetypes.xml | 30 ++++++------- app/src/main/res/layout/items_fragment.xml | 31 ++++++------- 9 files changed, 58 insertions(+), 108 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 71592065..33bb03be 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -57,7 +57,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:4e6eeb901f' + implementation 'com.github.SimpleMobileTools:Simple-Commons:51f1996098' 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/MimeTypesActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt index 6d89e220..7a6e236b 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 @@ -61,6 +61,9 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { ensureBackgroundThread { reFetchItems() } + + val adjustedPrimaryColor = getAdjustedPrimaryColor() + mimetypes_fastscroller.updateColors(adjustedPrimaryColor, adjustedPrimaryColor.getContrastColor()) } override fun onCreateOptionsMenu(menu: Menu): Boolean { @@ -130,13 +133,13 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { lastSearchedText = searchText when { searchText.isEmpty() -> { - mimetypes_list.beVisible() + mimetypes_fastscroller.beVisible() getRecyclerAdapter()?.updateItems(storedItems) mimetypes_placeholder.beGoneIf(storedItems.isNotEmpty()) mimetypes_placeholder_2.beGone() } searchText.length == 1 -> { - mimetypes_list.beGone() + mimetypes_fastscroller.beGone() mimetypes_placeholder.beVisible() mimetypes_placeholder_2.beVisible() } @@ -150,14 +153,9 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { runOnUiThread { getRecyclerAdapter()?.updateItems(listItems, text) - mimetypes_list.beVisibleIf(listItems.isNotEmpty()) + mimetypes_fastscroller.beVisibleIf(listItems.isNotEmpty()) mimetypes_placeholder.beVisibleIf(listItems.isEmpty()) mimetypes_placeholder_2.beGone() - - mimetypes_list.onGlobalLayout { - items_fastscroller.setScrollToY(mimetypes_list.computeVerticalScrollOffset()) - calculateContentHeight(listItems) - } } } } @@ -232,7 +230,7 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { isSearchOpen = false lastSearchedText = "" - mimetypes_list.beVisible() + mimetypes_fastscroller.beVisible() mimetypes_placeholder.beGoneIf(storedItems.isNotEmpty()) mimetypes_placeholder_2.beGone() } @@ -321,7 +319,7 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { } storedItems = items - ItemsAdapter(this as SimpleActivity, storedItems, this, mimetypes_list, false, items_fastscroller, null) { + ItemsAdapter(this as SimpleActivity, storedItems, this, mimetypes_list, false, null) { tryOpenPathIntent((it as ListItem).path, false) }.apply { setupZoomListener(zoomListener) @@ -332,13 +330,6 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { 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) ?: "") - } - mimetypes_placeholder.beVisibleIf(items.isEmpty()) } @@ -390,18 +381,9 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { 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 setupLayoutManager() { if (config.getFolderViewType(currentMimeType) == VIEW_TYPE_GRID) { currentViewType = VIEW_TYPE_GRID diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/DecompressItemsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/DecompressItemsAdapter.kt index 9c3c561c..abc7a9a9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/DecompressItemsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/DecompressItemsAdapter.kt @@ -12,7 +12,6 @@ import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions import com.bumptech.glide.request.RequestOptions import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor -import com.simplemobiletools.commons.extensions.getFileSignature import com.simplemobiletools.commons.extensions.getTextSize import com.simplemobiletools.commons.extensions.getTimeFormat import com.simplemobiletools.commons.helpers.getFilePlaceholderDrawables @@ -25,7 +24,7 @@ import kotlinx.android.synthetic.main.item_file_dir_list.view.* import java.util.* class DecompressItemsAdapter(activity: SimpleActivity, var listItems: MutableList, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit) : - MyRecyclerViewAdapter(activity, recyclerView, null, itemClick) { + MyRecyclerViewAdapter(activity, recyclerView, itemClick) { private lateinit var fileDrawable: Drawable private lateinit var folderDrawable: Drawable 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 e5aaf931..b4b3d241 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 @@ -24,13 +24,13 @@ import com.bumptech.glide.load.resource.bitmap.CenterCrop import com.bumptech.glide.load.resource.bitmap.RoundedCorners import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions import com.bumptech.glide.request.RequestOptions +import com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter import com.simplemobiletools.commons.dialogs.* import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.commons.models.FileDirItem import com.simplemobiletools.commons.models.RadioItem -import com.simplemobiletools.commons.views.FastScroller import com.simplemobiletools.commons.views.MyRecyclerView import com.simplemobiletools.filemanager.pro.R import com.simplemobiletools.filemanager.pro.activities.SimpleActivity @@ -41,13 +41,13 @@ import com.simplemobiletools.filemanager.pro.helpers.* import com.simplemobiletools.filemanager.pro.interfaces.ItemOperationsListener import com.simplemobiletools.filemanager.pro.models.ListItem import com.stericson.RootTools.RootTools -import java.io.BufferedInputStream import kotlinx.android.synthetic.main.item_file_dir_grid.view.* import kotlinx.android.synthetic.main.item_file_dir_list.view.* import kotlinx.android.synthetic.main.item_file_dir_list.view.item_frame import kotlinx.android.synthetic.main.item_file_dir_list.view.item_icon import kotlinx.android.synthetic.main.item_file_dir_list.view.item_name import kotlinx.android.synthetic.main.item_section.view.* +import java.io.BufferedInputStream import java.io.Closeable import java.io.File import java.util.* @@ -57,9 +57,9 @@ 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 + val isPickMultipleIntent: Boolean, val swipeRefreshLayout: SwipeRefreshLayout?, itemClick: (Any) -> Unit ) : - MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) { + MyRecyclerViewAdapter(activity, recyclerView, itemClick), RecyclerViewFastScroller.OnPopupTextUpdate { private val TYPE_FILE_DIR = 1 private val TYPE_SECTION = 2 @@ -326,6 +326,7 @@ class ItemsAdapter( } } + @SuppressLint("NewApi") private fun addFileUris(path: String, paths: ArrayList) { if (activity.getIsPathDirectory(path)) { val shouldShowHidden = activity.config.shouldShowHidden @@ -621,6 +622,7 @@ class ItemsAdapter( } } + @SuppressLint("NewApi") private fun compressPaths(sourcePaths: List, targetPath: String): Boolean { val queue = LinkedList() val fos = activity.getFileOutputStreamSync(targetPath, "application/zip") ?: return false @@ -759,7 +761,6 @@ class ItemsAdapter( textToHighlight = highlightText notifyDataSetChanged() } - fastScroller?.measureRecyclerView() } fun updateFontSizes() { @@ -899,4 +900,6 @@ class ItemsAdapter( fileDrawable = resources.getDrawable(R.drawable.ic_file_generic) fileDrawables = getFilePlaceholderDrawables(activity) } + + override fun onChange(position: Int) = listItems.getOrNull(position)?.getBubbleText(activity, dateFormat, timeFormat) ?: "" } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ManageFavoritesAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ManageFavoritesAdapter.kt index 43801fe3..3c281b5a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ManageFavoritesAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ManageFavoritesAdapter.kt @@ -12,8 +12,10 @@ import com.simplemobiletools.filemanager.pro.extensions.config import kotlinx.android.synthetic.main.item_manage_favorite.view.* import java.util.* -class ManageFavoritesAdapter(activity: BaseSimpleActivity, var favorites: ArrayList, val listener: RefreshRecyclerViewListener?, - recyclerView: MyRecyclerView, itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, null, itemClick) { +class ManageFavoritesAdapter( + activity: BaseSimpleActivity, var favorites: ArrayList, val listener: RefreshRecyclerViewListener?, + recyclerView: MyRecyclerView, itemClick: (Any) -> Unit +) : MyRecyclerViewAdapter(activity, recyclerView, itemClick) { private val config = activity.config 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 3b31bcdc..730de038 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 @@ -1,5 +1,6 @@ package com.simplemobiletools.filemanager.pro.fragments +import android.annotation.SuppressLint import android.content.Context import android.os.Parcelable import android.util.AttributeSet @@ -50,7 +51,6 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF override fun onResume(textColor: Int, primaryColor: Int) { context!!.updateTextColors(this) - items_fastscroller.updatePrimaryColor() storedItems = ArrayList() getRecyclerAdapter()?.apply { updatePrimaryColor(primaryColor) @@ -58,7 +58,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF initDrawables() } - items_fastscroller.updateBubbleColors() + items_fastscroller.updateColors(primaryColor, primaryColor.getContrastColor()) if (currentPath != "") { breadcrumbs.updateColor(textColor) @@ -124,10 +124,7 @@ 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_swipe_refresh) { if ((it as? ListItem)?.isSectionTitle == true) { openDirectory(it.mPath) searchClosed() @@ -143,18 +140,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF items_list.scheduleLayoutAnimation() } - val dateFormat = context!!.config.dateFormat - val timeFormat = context!!.getTimeFormat() - items_fastscroller.setViews(items_list, items_swipe_refresh) { - val listItem = getRecyclerAdapter()?.listItems?.getOrNull(it) - items_fastscroller.updateBubbleText(listItem?.getBubbleText(context, dateFormat, timeFormat) ?: "") - } - getRecyclerLayoutManager().onRestoreInstanceState(scrollStates[currentPath]) - items_list.onGlobalLayout { - items_fastscroller.setScrollToY(items_list.computeVerticalScrollOffset()) - calculateContentHeight(storedItems) - } } } @@ -162,6 +148,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF private fun getRecyclerLayoutManager() = (items_list.layoutManager as MyGridLayoutManager) + @SuppressLint("NewApi") private fun getItems(path: String, callback: (originalPath: String, items: ArrayList) -> Unit) { skipItemUpdating = false ensureBackgroundThread { @@ -289,13 +276,13 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF when { searchText.isEmpty() -> { - items_list.beVisible() + items_fastscroller.beVisible() getRecyclerAdapter()?.updateItems(storedItems) items_placeholder.beGone() items_placeholder_2.beGone() } searchText.length == 1 -> { - items_list.beGone() + items_fastscroller.beGone() items_placeholder.beVisible() items_placeholder_2.beVisible() } @@ -332,14 +319,9 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF activity?.runOnUiThread { getRecyclerAdapter()?.updateItems(listItems, text) - items_list.beVisibleIf(listItems.isNotEmpty()) + items_fastscroller.beVisibleIf(listItems.isNotEmpty()) items_placeholder.beVisibleIf(listItems.isEmpty()) items_placeholder_2.beGone() - - items_list.onGlobalLayout { - items_fastscroller.setScrollToY(items_list.computeVerticalScrollOffset()) - calculateContentHeight(listItems) - } } } } @@ -391,13 +373,13 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF isSearchOpen = false if (!skipItemUpdating) { getRecyclerAdapter()?.updateItems(storedItems) - calculateContentHeight(storedItems) } + skipItemUpdating = false lastSearchedText = "" items_swipe_refresh.isEnabled = true - items_list.beVisible() + items_fastscroller.beVisible() items_placeholder.beGone() items_placeholder_2.beGone() } @@ -472,14 +454,6 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF } } - private fun calculateContentHeight(items: MutableList) { - val layoutManager = items_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(items_list.computeVerticalScrollOffset()) - } - override fun increaseColumnCount() { if (currentViewType == VIEW_TYPE_GRID) { context?.config?.fileColumnCnt = ++(items_list.layoutManager as MyGridLayoutManager).spanCount @@ -498,7 +472,6 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF activity?.invalidateOptionsMenu() getRecyclerAdapter()?.apply { notifyItemRangeChanged(0, listItems.size) - calculateContentHeight(listItems) } } 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 49438aa6..417f867c 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 @@ -55,7 +55,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage return } - ItemsAdapter(activity as SimpleActivity, recents, this, recents_list, isPickMultipleIntent, null, recents_swipe_refresh) { + ItemsAdapter(activity as SimpleActivity, recents, this, recents_list, isPickMultipleIntent, recents_swipe_refresh) { clickedPath((it as FileDirItem).path) }.apply { recents_list.adapter = this diff --git a/app/src/main/res/layout/activity_mimetypes.xml b/app/src/main/res/layout/activity_mimetypes.xml index 3b377baf..b50e0a79 100644 --- a/app/src/main/res/layout/activity_mimetypes.xml +++ b/app/src/main/res/layout/activity_mimetypes.xml @@ -35,24 +35,20 @@ android:textStyle="italic" android:visibility="gone" /> - + android:layout_height="wrap_content"> - + - - - + diff --git a/app/src/main/res/layout/items_fragment.xml b/app/src/main/res/layout/items_fragment.xml index 19834892..9ef0a3cd 100644 --- a/app/src/main/res/layout/items_fragment.xml +++ b/app/src/main/res/layout/items_fragment.xml @@ -60,27 +60,22 @@ android:textStyle="italic" android:visibility="gone" /> - - - + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@+id/breadcrumbs"> - + - + From 046033c5aa3121f5c6f064997bd6ec7bec8a3093 Mon Sep 17 00:00:00 2001 From: spkprs Date: Mon, 22 Nov 2021 15:15:11 +0200 Subject: [PATCH 37/37] Update strings.xml --- app/src/main/res/values-el/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index fc937dda..f78bc953 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -13,7 +13,7 @@ Αυτό το χαρακτηριστικό λειτουργεί μόνο σε συσκευές με πρόσβαση στον ριζικό κατάλογο. Πρόσφατα Εμφάνιση προσφάτων - Please grant our app access to all your files, it might not work well without it. + Παρακαλώ παραχωρήστε την πρόσβαση σε όλα τα αρχεία σας, γιατί χωρίς αυτή μπορεί να μην λειτουργεί καλά. Άνοιγμα ως