From 47d9883c04ba7a4f45bdb2bd1867b5c42dd85682 Mon Sep 17 00:00:00 2001 From: VishnuSanal Date: Sat, 27 May 2023 16:11:24 +0530 Subject: [PATCH 1/3] chore: update versions of spotless, ktlint & googleJavaFormat. also updates the config to match the newer version + disabling rules that ain't consistent with the current code style Signed-off-by: VishnuSanal --- build.gradle | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 7197d6553f..87367435ec 100644 --- a/build.gradle +++ b/build.gradle @@ -55,7 +55,7 @@ buildscript { } plugins { - id "com.diffplug.spotless" version "6.5.0" + id "com.diffplug.spotless" version "6.19.0" } allprojects { @@ -77,16 +77,29 @@ spotless { java { licenseHeaderFile 'spotless.license-java' target 'app/src/**/*.java', 'commons_compress_7z/src/**/*.java', 'file_operations/src/**/*.java' - googleJavaFormat('1.15.0') + googleJavaFormat('1.17.0') removeUnusedImports() // removes any unused imports importOrder 'java', 'javax', 'org', 'com', 'android', 'androidx', '' } kotlin { licenseHeaderFile 'spotless.license-java' target 'app/src/**/*.kt', 'file_operations/src/**/*.kt' - ktlint("0.44.0").setUseExperimental(true).userData(['disabled_rules': 'no-wildcard-imports', - 'kotlin_imports_layout': 'idea', 'indent_size': '4', - 'max_line_length': '100']) + ktlint("0.49.1") + .setEditorConfigPath(null) + .editorConfigOverride( + [ + 'ktlint_standard_no-wildcard-imports': 'disabled', + 'kotlin_imports_layout': 'idea', + 'indent_size': '4', + 'max_line_length': 'off', + + 'ij_kotlin_allow_trailing_comma': 'false', + 'ij_kotlin_allow_trailing_comma_on_call_site': 'false', + + 'ktlint_standard_multiline-if-else' : 'disabled' + ] + ) + trimTrailingWhitespace() indentWithSpaces() endWithNewline() From a24a0338cf7ca71934f64f6a6f1d47097b3b9677 Mon Sep 17 00:00:00 2001 From: VishnuSanal Date: Sat, 27 May 2023 16:11:44 +0530 Subject: [PATCH 2/3] chore: run new spotless config Signed-off-by: VishnuSanal --- .../adapters/AppsRecyclerAdapter.kt | 6 +- .../asynctasks/ssh/SshAuthenticationTask.kt | 2 +- .../write/WriteTextFileCallable.java | 4 +- .../asynchronous/services/ftp/FtpService.kt | 2 +- .../filemanager/database/UtilsHandler.kt | 20 +++--- .../filemanager/filesystem/FileProperties.kt | 4 +- .../filesystem/files/EncryptDecryptUtils.java | 1 + .../ui/activities/MainActivity.java | 2 + .../ui/dialogs/DragAndDropDialog.kt | 3 +- .../ui/dialogs/OpenFileDialogFragment.kt | 13 ++-- .../ui/dialogs/SftpConnectDialog.kt | 3 +- .../ui/drag/RecyclerAdapterDragListener.kt | 2 +- .../fragments/CompressedExplorerFragment.kt | 4 +- .../ui/fragments/FtpServerFragment.kt | 3 +- .../ui/fragments/ProcessViewerFragment.java | 1 + .../SecurityPrefsFragment.kt | 6 +- .../utils/MainActivityActionMode.kt | 2 +- .../filemanager/utils/ProgressHandler.java | 2 + .../com/amaze/filemanager/utils/TinyDB.kt | 6 +- .../extractcontents/helpers/RarExtractor.kt | 2 +- .../com/amaze/filemanager/utils/Billing.kt | 10 +-- .../CompressedHelperForBadArchiveTest.kt | 2 +- .../filemanager/database/UtilsHandlerTest.kt | 14 ++--- .../filemanager/filesystem/HybridFileTest.kt | 12 ++-- .../filesystem/ftp/FtpHybridFileTest.kt | 10 +-- .../filesystem/usb/ReflectionHelpers.java | 63 +++++++++++++------ .../compressed/sevenz/CoderBase.java | 1 + 27 files changed, 116 insertions(+), 84 deletions(-) diff --git a/app/src/main/java/com/amaze/filemanager/adapters/AppsRecyclerAdapter.kt b/app/src/main/java/com/amaze/filemanager/adapters/AppsRecyclerAdapter.kt index 7f4022e692..8c976973c0 100644 --- a/app/src/main/java/com/amaze/filemanager/adapters/AppsRecyclerAdapter.kt +++ b/app/src/main/java/com/amaze/filemanager/adapters/AppsRecyclerAdapter.kt @@ -286,9 +286,9 @@ class AppsRecyclerAdapter( v.setOnClickListener { view: View? -> var context = fragment.context if (( - fragment.requireActivity() - as MainActivity - ).appTheme.getSimpleTheme(fragment.requireContext()) == AppTheme.BLACK + fragment.requireActivity() + as MainActivity + ).appTheme.getSimpleTheme(fragment.requireContext()) == AppTheme.BLACK ) { context = ContextThemeWrapper(context, R.style.overflow_black) } diff --git a/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/ssh/SshAuthenticationTask.kt b/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/ssh/SshAuthenticationTask.kt index d992963289..370551960d 100644 --- a/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/ssh/SshAuthenticationTask.kt +++ b/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/ssh/SshAuthenticationTask.kt @@ -64,7 +64,7 @@ class SshAuthenticationTask( ) ) } else if (TransportException::class.java - .isAssignableFrom(error.javaClass) + .isAssignableFrom(error.javaClass) ) { val disconnectReason = TransportException::class.java.cast(error)!!.disconnectReason diff --git a/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/texteditor/write/WriteTextFileCallable.java b/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/texteditor/write/WriteTextFileCallable.java index e4be052993..fbee9e4336 100644 --- a/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/texteditor/write/WriteTextFileCallable.java +++ b/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/texteditor/write/WriteTextFileCallable.java @@ -72,7 +72,9 @@ public WriteTextFileCallable( @WorkerThread @Override public Unit call() - throws IOException, StreamNotFoundException, ShellNotRunningException, + throws IOException, + StreamNotFoundException, + ShellNotRunningException, IllegalArgumentException { OutputStream outputStream; File destFile = null; diff --git a/app/src/main/java/com/amaze/filemanager/asynchronous/services/ftp/FtpService.kt b/app/src/main/java/com/amaze/filemanager/asynchronous/services/ftp/FtpService.kt index 097db8a122..84552c44e2 100644 --- a/app/src/main/java/com/amaze/filemanager/asynchronous/services/ftp/FtpService.kt +++ b/app/src/main/java/com/amaze/filemanager/asynchronous/services/ftp/FtpService.kt @@ -348,7 +348,7 @@ class FtpService : Service(), Runnable { @JvmStatic fun defaultPath(context: Context): String { return if (PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(KEY_PREFERENCE_SAF_FILESYSTEM, false) && SDK_INT > M + .getBoolean(KEY_PREFERENCE_SAF_FILESYSTEM, false) && SDK_INT > M ) { DocumentsContract.buildTreeDocumentUri( "com.android.externalstorage.documents", diff --git a/app/src/main/java/com/amaze/filemanager/database/UtilsHandler.kt b/app/src/main/java/com/amaze/filemanager/database/UtilsHandler.kt index 6a194585fb..a98f38aebf 100644 --- a/app/src/main/java/com/amaze/filemanager/database/UtilsHandler.kt +++ b/app/src/main/java/com/amaze/filemanager/database/UtilsHandler.kt @@ -222,8 +222,8 @@ class UtilsHandler( get() { val paths = LinkedList() for ( - history in utilitiesDatabase.historyEntryDao().list().subscribeOn(Schedulers.io()) - .blockingGet() + history in utilitiesDatabase.historyEntryDao().list().subscribeOn(Schedulers.io()) + .blockingGet() ) { paths.add(history.path) } @@ -237,8 +237,8 @@ class UtilsHandler( get() { val paths = ConcurrentRadixTree(DefaultCharArrayNodeFactory()) for ( - path in utilitiesDatabase.hiddenEntryDao().listPaths().subscribeOn(Schedulers.io()) - .blockingGet() + path in utilitiesDatabase.hiddenEntryDao().listPaths().subscribeOn(Schedulers.io()) + .blockingGet() ) { paths.put(path, VoidValue.SINGLETON) } @@ -268,8 +268,8 @@ class UtilsHandler( get() { val row = ArrayList>() for ( - bookmark in utilitiesDatabase.bookmarkEntryDao().list() - .subscribeOn(Schedulers.io()).blockingGet() + bookmark in utilitiesDatabase.bookmarkEntryDao().list() + .subscribeOn(Schedulers.io()).blockingGet() ) { row.add(arrayOf(bookmark.name, bookmark.path)) } @@ -283,8 +283,8 @@ class UtilsHandler( get() { val retval = ArrayList>() for ( - entry in utilitiesDatabase.smbEntryDao().list().subscribeOn(Schedulers.io()) - .blockingGet() + entry in utilitiesDatabase.smbEntryDao().list().subscribeOn(Schedulers.io()) + .blockingGet() ) { try { retval.add(arrayOf(entry.name, entry.path)) @@ -322,8 +322,8 @@ class UtilsHandler( get() { val retval = ArrayList>() for ( - entry in utilitiesDatabase.sftpEntryDao().list().subscribeOn(Schedulers.io()) - .blockingGet() + entry in utilitiesDatabase.sftpEntryDao().list().subscribeOn(Schedulers.io()) + .blockingGet() ) { val path = entry.path if (path == null) { diff --git a/app/src/main/java/com/amaze/filemanager/filesystem/FileProperties.kt b/app/src/main/java/com/amaze/filemanager/filesystem/FileProperties.kt index ed6f8128f5..cbb7f0b81c 100644 --- a/app/src/main/java/com/amaze/filemanager/filesystem/FileProperties.kt +++ b/app/src/main/java/com/amaze/filemanager/filesystem/FileProperties.kt @@ -240,8 +240,8 @@ object FileProperties { return if (ANDROID_DEVICE_DATA_DIRS.containsPath(path)) { path } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q && ANDROID_DEVICE_DATA_DIRS.any { - path.startsWith(it) && path != it - } + path.startsWith(it) && path != it + } ) { val suffix = path.substringAfter(Environment.getExternalStorageDirectory().absolutePath) diff --git a/app/src/main/java/com/amaze/filemanager/filesystem/files/EncryptDecryptUtils.java b/app/src/main/java/com/amaze/filemanager/filesystem/files/EncryptDecryptUtils.java index b2418779c6..0c8b85f86e 100644 --- a/app/src/main/java/com/amaze/filemanager/filesystem/files/EncryptDecryptUtils.java +++ b/app/src/main/java/com/amaze/filemanager/filesystem/files/EncryptDecryptUtils.java @@ -65,6 +65,7 @@ public class EncryptDecryptUtils { public static final String DECRYPT_BROADCAST = "decrypt_broadcast"; private static final Logger LOG = LoggerFactory.getLogger(EncryptDecryptUtils.class); + /** * Queries database to map path and password. Starts the encryption process after database query * diff --git a/app/src/main/java/com/amaze/filemanager/ui/activities/MainActivity.java b/app/src/main/java/com/amaze/filemanager/ui/activities/MainActivity.java index 04cd312614..d92548bc4d 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/activities/MainActivity.java +++ b/app/src/main/java/com/amaze/filemanager/ui/activities/MainActivity.java @@ -276,6 +276,7 @@ public class MainActivity extends PermissionsActivity private UtilsHandler utilsHandler; private CloudHandler cloudHandler; private CloudLoaderAsyncTask cloudLoaderAsyncTask; + /** * This is for a hack. * @@ -2417,6 +2418,7 @@ public boolean onActionSelected(SpeedDialActionItem actionItem) { return true; } } + /** * Invoke {@link FtpServerFragment#changeFTPServerPath(String)} to change FTP server share path. * diff --git a/app/src/main/java/com/amaze/filemanager/ui/dialogs/DragAndDropDialog.kt b/app/src/main/java/com/amaze/filemanager/ui/dialogs/DragAndDropDialog.kt index 17618177a5..d18565c617 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/dialogs/DragAndDropDialog.kt +++ b/app/src/main/java/com/amaze/filemanager/ui/dialogs/DragAndDropDialog.kt @@ -90,8 +90,7 @@ class DragAndDropDialog : DialogFragment() { ) } } - private fun newInstance(pasteLocation: String, files: ArrayList): - DragAndDropDialog { + private fun newInstance(pasteLocation: String, files: ArrayList): DragAndDropDialog { val dragAndDropDialog = DragAndDropDialog() val args = Bundle() args.putString(KEY_PASTE_LOCATION, pasteLocation) diff --git a/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt b/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt index 9d9a68ac37..6b16649f87 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt +++ b/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt @@ -95,11 +95,11 @@ class OpenFileDialogFragment : BaseBottomSheetFragment(), AdjustListViewForTv createConnectionSettings(edit).run { when (prefix) { diff --git a/app/src/main/java/com/amaze/filemanager/ui/drag/RecyclerAdapterDragListener.kt b/app/src/main/java/com/amaze/filemanager/ui/drag/RecyclerAdapterDragListener.kt index 9705abd126..e79d92e3cd 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/drag/RecyclerAdapterDragListener.kt +++ b/app/src/main/java/com/amaze/filemanager/ui/drag/RecyclerAdapterDragListener.kt @@ -189,7 +189,7 @@ class RecyclerAdapterDragListener( TAG, "Didn't find checked items in adapter, " + "checking dataUtils size ${ - dataUtils.checkedItemsList?.size ?: "null"}" + dataUtils.checkedItemsList?.size ?: "null"}" ) checkedItems = dataUtils.checkedItemsList } diff --git a/app/src/main/java/com/amaze/filemanager/ui/fragments/CompressedExplorerFragment.kt b/app/src/main/java/com/amaze/filemanager/ui/fragments/CompressedExplorerFragment.kt index 8c15f05167..ce26b62575 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/fragments/CompressedExplorerFragment.kt +++ b/app/src/main/java/com/amaze/filemanager/ui/fragments/CompressedExplorerFragment.kt @@ -408,7 +408,7 @@ class CompressedExplorerFragment : Fragment(), BottomBarButtonPath { if (SDK_INT >= LOLLIPOP) { val window = requireActivity().window if (requireMainActivity() - .getBoolean(PreferencesConstants.PREFERENCE_COLORED_NAVIGATION) + .getBoolean(PreferencesConstants.PREFERENCE_COLORED_NAVIGATION) ) { window.navigationBarColor = Utils.getColor(context, android.R.color.black) @@ -497,7 +497,7 @@ class CompressedExplorerFragment : Fragment(), BottomBarButtonPath { if (SDK_INT >= LOLLIPOP) { val window = requireActivity().window if (requireMainActivity() - .getBoolean(PreferencesConstants.PREFERENCE_COLORED_NAVIGATION) + .getBoolean(PreferencesConstants.PREFERENCE_COLORED_NAVIGATION) ) { window.navigationBarColor = requireMainActivity().skinStatusBar diff --git a/app/src/main/java/com/amaze/filemanager/ui/fragments/FtpServerFragment.kt b/app/src/main/java/com/amaze/filemanager/ui/fragments/FtpServerFragment.kt index 4e12699f06..8bef574831 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/fragments/FtpServerFragment.kt +++ b/app/src/main/java/com/amaze/filemanager/ui/fragments/FtpServerFragment.kt @@ -413,8 +413,7 @@ class FtpServerFragment : Fragment(R.layout.fragment_ftp) { } @Suppress("LabeledExpression") - private fun createOpenDocumentTreeIntentCallback(callback: (directoryUri: Uri) -> Unit): - ActivityResultLauncher { + private fun createOpenDocumentTreeIntentCallback(callback: (directoryUri: Uri) -> Unit): ActivityResultLauncher { return registerForActivityResult( ActivityResultContracts.StartActivityForResult() ) { diff --git a/app/src/main/java/com/amaze/filemanager/ui/fragments/ProcessViewerFragment.java b/app/src/main/java/com/amaze/filemanager/ui/fragments/ProcessViewerFragment.java index fd0c302751..d2c5c636b2 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/fragments/ProcessViewerFragment.java +++ b/app/src/main/java/com/amaze/filemanager/ui/fragments/ProcessViewerFragment.java @@ -88,6 +88,7 @@ public class ProcessViewerFragment extends Fragment { private CardView mCardView; private LineChart mLineChart; private LineData mLineData = new LineData(); + /** Time in seconds just for showing to the user. No guarantees. */ private long looseTimeInSeconds = 0L; diff --git a/app/src/main/java/com/amaze/filemanager/ui/fragments/preferencefragments/SecurityPrefsFragment.kt b/app/src/main/java/com/amaze/filemanager/ui/fragments/preferencefragments/SecurityPrefsFragment.kt index b44290f82d..d115fcd903 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/fragments/preferencefragments/SecurityPrefsFragment.kt +++ b/app/src/main/java/com/amaze/filemanager/ui/fragments/preferencefragments/SecurityPrefsFragment.kt @@ -187,9 +187,9 @@ class SecurityPrefsFragment : BasePrefsFragment() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2 || activity.prefs.getBoolean( - PreferencesConstants.PREFERENCE_CRYPT_FINGERPRINT, - false - ) + PreferencesConstants.PREFERENCE_CRYPT_FINGERPRINT, + false + ) ) { // encryption feature not available masterPasswordPreference?.isEnabled = false diff --git a/app/src/main/java/com/amaze/filemanager/utils/MainActivityActionMode.kt b/app/src/main/java/com/amaze/filemanager/utils/MainActivityActionMode.kt index 6070db83e6..95152460ec 100644 --- a/app/src/main/java/com/amaze/filemanager/utils/MainActivityActionMode.kt +++ b/app/src/main/java/com/amaze/filemanager/utils/MainActivityActionMode.kt @@ -131,7 +131,7 @@ class MainActivityActionMode(private val mainActivityReference: WeakReference clazz = (Class) Class.forName("android.hardware.usb.UsbDevice"); Constructor constructor = @@ -164,8 +176,11 @@ static UsbDevice callUsbDeviceConstructor( @Nullable String manufacturerName, @Nullable String productName, @Nullable String serialNumber) - throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, - InvocationTargetException, InstantiationException { + throws ClassNotFoundException, + NoSuchMethodException, + IllegalAccessException, + InvocationTargetException, + InstantiationException { Class clazz = (Class) Class.forName("android.hardware.usb.UsbDevice"); Constructor constructor = @@ -201,8 +216,11 @@ static UsbDevice callUsbDeviceConstructor( int subClass, int protocol, @NonNull Parcelable[] interfaces) - throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, - InvocationTargetException, InstantiationException { + throws ClassNotFoundException, + NoSuchMethodException, + IllegalAccessException, + InvocationTargetException, + InstantiationException { Class clazz = (Class) Class.forName("android.hardware.usb.UsbDevice"); Constructor constructor = @@ -222,8 +240,11 @@ static UsbDevice callUsbDeviceConstructor( @RequiresApi(Build.VERSION_CODES.LOLLIPOP) static UsbConfiguration callUsbConfigurationConstructor( int id, @Nullable String name, int attributes, int maxPower) - throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, - InvocationTargetException, InstantiationException { + throws ClassNotFoundException, + NoSuchMethodException, + IllegalAccessException, + InvocationTargetException, + InstantiationException { Class clazz = (Class) Class.forName("android.hardware.usb.UsbConfiguration"); @@ -236,8 +257,11 @@ static UsbConfiguration callUsbConfigurationConstructor( @RequiresApi(Build.VERSION_CODES.LOLLIPOP) static UsbInterface callUsbInterfaceConstructor( int id, int alternateSetting, @Nullable String name, int usbClass, int subClass, int protocol) - throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, - InvocationTargetException, InstantiationException { + throws ClassNotFoundException, + NoSuchMethodException, + IllegalAccessException, + InvocationTargetException, + InstantiationException { Class clazz = (Class) Class.forName("android.hardware.usb.UsbInterface"); @@ -250,8 +274,11 @@ static UsbInterface callUsbInterfaceConstructor( @RequiresApi(Build.VERSION_CODES.KITKAT) static UsbInterface callUsbInterfaceConstructor( int id, int usbClass, int subClass, int protocol, @Nullable Parcelable[] endpoints) - throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, - InvocationTargetException, InstantiationException { + throws ClassNotFoundException, + NoSuchMethodException, + IllegalAccessException, + InvocationTargetException, + InstantiationException { Class clazz = (Class) Class.forName("android.hardware.usb.UsbInterface"); diff --git a/commons_compress_7z/src/main/java/com/amaze/filemanager/filesystem/compressed/sevenz/CoderBase.java b/commons_compress_7z/src/main/java/com/amaze/filemanager/filesystem/compressed/sevenz/CoderBase.java index f43b19565f..51449f310d 100644 --- a/commons_compress_7z/src/main/java/com/amaze/filemanager/filesystem/compressed/sevenz/CoderBase.java +++ b/commons_compress_7z/src/main/java/com/amaze/filemanager/filesystem/compressed/sevenz/CoderBase.java @@ -29,6 +29,7 @@ /** Base Codec class. */ abstract class CoderBase { private final Class[] acceptableOptions; + /** * @param acceptableOptions types that can be used as options for this codec. */ From 932e9e5b3b1bd6b435242e3463bcd9389c6618f9 Mon Sep 17 00:00:00 2001 From: VishnuSanal Date: Sun, 10 Dec 2023 13:16:05 +0530 Subject: [PATCH 3/3] run spotless --- .../asynctasks/ssh/SshAuthenticationTask.kt | 2 +- .../write/WriteTextFileCallable.java | 4 +- .../asynchronous/services/ftp/FtpService.kt | 2 +- .../filemanager/database/UtilsHandler.kt | 20 +++--- .../filemanager/filesystem/FileProperties.kt | 4 +- .../ui/dialogs/DragAndDropDialog.kt | 3 +- .../ui/dialogs/OpenFileDialogFragment.kt | 13 ++-- .../ui/drag/RecyclerAdapterDragListener.kt | 2 +- .../fragments/CompressedExplorerFragment.kt | 4 +- .../ui/fragments/FtpServerFragment.kt | 3 +- .../SecurityPrefsFragment.kt | 6 +- .../utils/MainActivityActionMode.kt | 2 +- .../CompressedHelperForBadArchiveTest.kt | 2 +- .../filemanager/database/UtilsHandlerTest.kt | 14 ++--- .../filemanager/filesystem/HybridFileTest.kt | 12 ++-- .../filesystem/ftp/FtpHybridFileTest.kt | 10 +-- .../filesystem/usb/ReflectionHelpers.java | 63 ++++++------------- 17 files changed, 70 insertions(+), 96 deletions(-) diff --git a/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/ssh/SshAuthenticationTask.kt b/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/ssh/SshAuthenticationTask.kt index 370551960d..d992963289 100644 --- a/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/ssh/SshAuthenticationTask.kt +++ b/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/ssh/SshAuthenticationTask.kt @@ -64,7 +64,7 @@ class SshAuthenticationTask( ) ) } else if (TransportException::class.java - .isAssignableFrom(error.javaClass) + .isAssignableFrom(error.javaClass) ) { val disconnectReason = TransportException::class.java.cast(error)!!.disconnectReason diff --git a/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/texteditor/write/WriteTextFileCallable.java b/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/texteditor/write/WriteTextFileCallable.java index fbee9e4336..e4be052993 100644 --- a/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/texteditor/write/WriteTextFileCallable.java +++ b/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/texteditor/write/WriteTextFileCallable.java @@ -72,9 +72,7 @@ public WriteTextFileCallable( @WorkerThread @Override public Unit call() - throws IOException, - StreamNotFoundException, - ShellNotRunningException, + throws IOException, StreamNotFoundException, ShellNotRunningException, IllegalArgumentException { OutputStream outputStream; File destFile = null; diff --git a/app/src/main/java/com/amaze/filemanager/asynchronous/services/ftp/FtpService.kt b/app/src/main/java/com/amaze/filemanager/asynchronous/services/ftp/FtpService.kt index 032112b255..37e1c68589 100644 --- a/app/src/main/java/com/amaze/filemanager/asynchronous/services/ftp/FtpService.kt +++ b/app/src/main/java/com/amaze/filemanager/asynchronous/services/ftp/FtpService.kt @@ -342,7 +342,7 @@ class FtpService : Service(), Runnable { @JvmStatic fun defaultPath(context: Context): String { return if (PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(KEY_PREFERENCE_SAF_FILESYSTEM, false) && SDK_INT > M + .getBoolean(KEY_PREFERENCE_SAF_FILESYSTEM, false) && SDK_INT > M ) { DocumentsContract.buildTreeDocumentUri( "com.android.externalstorage.documents", diff --git a/app/src/main/java/com/amaze/filemanager/database/UtilsHandler.kt b/app/src/main/java/com/amaze/filemanager/database/UtilsHandler.kt index a98f38aebf..6a194585fb 100644 --- a/app/src/main/java/com/amaze/filemanager/database/UtilsHandler.kt +++ b/app/src/main/java/com/amaze/filemanager/database/UtilsHandler.kt @@ -222,8 +222,8 @@ class UtilsHandler( get() { val paths = LinkedList() for ( - history in utilitiesDatabase.historyEntryDao().list().subscribeOn(Schedulers.io()) - .blockingGet() + history in utilitiesDatabase.historyEntryDao().list().subscribeOn(Schedulers.io()) + .blockingGet() ) { paths.add(history.path) } @@ -237,8 +237,8 @@ class UtilsHandler( get() { val paths = ConcurrentRadixTree(DefaultCharArrayNodeFactory()) for ( - path in utilitiesDatabase.hiddenEntryDao().listPaths().subscribeOn(Schedulers.io()) - .blockingGet() + path in utilitiesDatabase.hiddenEntryDao().listPaths().subscribeOn(Schedulers.io()) + .blockingGet() ) { paths.put(path, VoidValue.SINGLETON) } @@ -268,8 +268,8 @@ class UtilsHandler( get() { val row = ArrayList>() for ( - bookmark in utilitiesDatabase.bookmarkEntryDao().list() - .subscribeOn(Schedulers.io()).blockingGet() + bookmark in utilitiesDatabase.bookmarkEntryDao().list() + .subscribeOn(Schedulers.io()).blockingGet() ) { row.add(arrayOf(bookmark.name, bookmark.path)) } @@ -283,8 +283,8 @@ class UtilsHandler( get() { val retval = ArrayList>() for ( - entry in utilitiesDatabase.smbEntryDao().list().subscribeOn(Schedulers.io()) - .blockingGet() + entry in utilitiesDatabase.smbEntryDao().list().subscribeOn(Schedulers.io()) + .blockingGet() ) { try { retval.add(arrayOf(entry.name, entry.path)) @@ -322,8 +322,8 @@ class UtilsHandler( get() { val retval = ArrayList>() for ( - entry in utilitiesDatabase.sftpEntryDao().list().subscribeOn(Schedulers.io()) - .blockingGet() + entry in utilitiesDatabase.sftpEntryDao().list().subscribeOn(Schedulers.io()) + .blockingGet() ) { val path = entry.path if (path == null) { diff --git a/app/src/main/java/com/amaze/filemanager/filesystem/FileProperties.kt b/app/src/main/java/com/amaze/filemanager/filesystem/FileProperties.kt index cbb7f0b81c..ed6f8128f5 100644 --- a/app/src/main/java/com/amaze/filemanager/filesystem/FileProperties.kt +++ b/app/src/main/java/com/amaze/filemanager/filesystem/FileProperties.kt @@ -240,8 +240,8 @@ object FileProperties { return if (ANDROID_DEVICE_DATA_DIRS.containsPath(path)) { path } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q && ANDROID_DEVICE_DATA_DIRS.any { - path.startsWith(it) && path != it - } + path.startsWith(it) && path != it + } ) { val suffix = path.substringAfter(Environment.getExternalStorageDirectory().absolutePath) diff --git a/app/src/main/java/com/amaze/filemanager/ui/dialogs/DragAndDropDialog.kt b/app/src/main/java/com/amaze/filemanager/ui/dialogs/DragAndDropDialog.kt index df196c4181..c7b24245ae 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/dialogs/DragAndDropDialog.kt +++ b/app/src/main/java/com/amaze/filemanager/ui/dialogs/DragAndDropDialog.kt @@ -89,7 +89,8 @@ class DragAndDropDialog : DialogFragment() { ) } } - private fun newInstance(pasteLocation: String, files: ArrayList): DragAndDropDialog { + private fun newInstance(pasteLocation: String, files: ArrayList): + DragAndDropDialog { val dragAndDropDialog = DragAndDropDialog() val args = Bundle() args.putString(KEY_PASTE_LOCATION, pasteLocation) diff --git a/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt b/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt index bbcf55e90b..e0b5746617 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt +++ b/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt @@ -95,11 +95,11 @@ class OpenFileDialogFragment : BaseBottomSheetFragment(), AdjustListViewForTv= LOLLIPOP) { val window = requireActivity().window if (requireMainActivity() - .getBoolean(PreferencesConstants.PREFERENCE_COLORED_NAVIGATION) + .getBoolean(PreferencesConstants.PREFERENCE_COLORED_NAVIGATION) ) { window.navigationBarColor = Utils.getColor(context, android.R.color.black) @@ -508,7 +508,7 @@ class CompressedExplorerFragment : Fragment(), BottomBarButtonPath { if (SDK_INT >= LOLLIPOP) { val window = requireActivity().window if (requireMainActivity() - .getBoolean(PreferencesConstants.PREFERENCE_COLORED_NAVIGATION) + .getBoolean(PreferencesConstants.PREFERENCE_COLORED_NAVIGATION) ) { window.navigationBarColor = requireMainActivity().skinStatusBar diff --git a/app/src/main/java/com/amaze/filemanager/ui/fragments/FtpServerFragment.kt b/app/src/main/java/com/amaze/filemanager/ui/fragments/FtpServerFragment.kt index fc048ea292..41de2a8ec9 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/fragments/FtpServerFragment.kt +++ b/app/src/main/java/com/amaze/filemanager/ui/fragments/FtpServerFragment.kt @@ -413,7 +413,8 @@ class FtpServerFragment : Fragment(R.layout.fragment_ftp) { } @Suppress("LabeledExpression") - private fun createOpenDocumentTreeIntentCallback(callback: (directoryUri: Uri) -> Unit): ActivityResultLauncher { + private fun createOpenDocumentTreeIntentCallback(callback: (directoryUri: Uri) -> Unit): + ActivityResultLauncher { return registerForActivityResult( ActivityResultContracts.StartActivityForResult() ) { diff --git a/app/src/main/java/com/amaze/filemanager/ui/fragments/preferencefragments/SecurityPrefsFragment.kt b/app/src/main/java/com/amaze/filemanager/ui/fragments/preferencefragments/SecurityPrefsFragment.kt index 544aad6973..fd2839e654 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/fragments/preferencefragments/SecurityPrefsFragment.kt +++ b/app/src/main/java/com/amaze/filemanager/ui/fragments/preferencefragments/SecurityPrefsFragment.kt @@ -187,9 +187,9 @@ class SecurityPrefsFragment : BasePrefsFragment() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2 || activity.prefs.getBoolean( - PreferencesConstants.PREFERENCE_CRYPT_FINGERPRINT, - false - ) + PreferencesConstants.PREFERENCE_CRYPT_FINGERPRINT, + false + ) ) { // encryption feature not available masterPasswordPreference?.isEnabled = false diff --git a/app/src/main/java/com/amaze/filemanager/utils/MainActivityActionMode.kt b/app/src/main/java/com/amaze/filemanager/utils/MainActivityActionMode.kt index 7216b71619..9407c98981 100644 --- a/app/src/main/java/com/amaze/filemanager/utils/MainActivityActionMode.kt +++ b/app/src/main/java/com/amaze/filemanager/utils/MainActivityActionMode.kt @@ -143,7 +143,7 @@ class MainActivityActionMode(private val mainActivityReference: WeakReference clazz = (Class) Class.forName("android.hardware.usb.UsbDevice"); Constructor constructor = @@ -176,11 +164,8 @@ static UsbDevice callUsbDeviceConstructor( @Nullable String manufacturerName, @Nullable String productName, @Nullable String serialNumber) - throws ClassNotFoundException, - NoSuchMethodException, - IllegalAccessException, - InvocationTargetException, - InstantiationException { + throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, + InvocationTargetException, InstantiationException { Class clazz = (Class) Class.forName("android.hardware.usb.UsbDevice"); Constructor constructor = @@ -216,11 +201,8 @@ static UsbDevice callUsbDeviceConstructor( int subClass, int protocol, @NonNull Parcelable[] interfaces) - throws ClassNotFoundException, - NoSuchMethodException, - IllegalAccessException, - InvocationTargetException, - InstantiationException { + throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, + InvocationTargetException, InstantiationException { Class clazz = (Class) Class.forName("android.hardware.usb.UsbDevice"); Constructor constructor = @@ -240,11 +222,8 @@ static UsbDevice callUsbDeviceConstructor( @RequiresApi(Build.VERSION_CODES.LOLLIPOP) static UsbConfiguration callUsbConfigurationConstructor( int id, @Nullable String name, int attributes, int maxPower) - throws ClassNotFoundException, - NoSuchMethodException, - IllegalAccessException, - InvocationTargetException, - InstantiationException { + throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, + InvocationTargetException, InstantiationException { Class clazz = (Class) Class.forName("android.hardware.usb.UsbConfiguration"); @@ -257,11 +236,8 @@ static UsbConfiguration callUsbConfigurationConstructor( @RequiresApi(Build.VERSION_CODES.LOLLIPOP) static UsbInterface callUsbInterfaceConstructor( int id, int alternateSetting, @Nullable String name, int usbClass, int subClass, int protocol) - throws ClassNotFoundException, - NoSuchMethodException, - IllegalAccessException, - InvocationTargetException, - InstantiationException { + throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, + InvocationTargetException, InstantiationException { Class clazz = (Class) Class.forName("android.hardware.usb.UsbInterface"); @@ -274,11 +250,8 @@ static UsbInterface callUsbInterfaceConstructor( @RequiresApi(Build.VERSION_CODES.KITKAT) static UsbInterface callUsbInterfaceConstructor( int id, int usbClass, int subClass, int protocol, @Nullable Parcelable[] endpoints) - throws ClassNotFoundException, - NoSuchMethodException, - IllegalAccessException, - InvocationTargetException, - InstantiationException { + throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, + InvocationTargetException, InstantiationException { Class clazz = (Class) Class.forName("android.hardware.usb.UsbInterface");