From 47d9883c04ba7a4f45bdb2bd1867b5c42dd85682 Mon Sep 17 00:00:00 2001 From: VishnuSanal <t.v.s10123@gmail.com> 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 <t.v.s10123@gmail.com> --- 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 <t.v.s10123@gmail.com> Date: Sat, 27 May 2023 16:11:44 +0530 Subject: [PATCH 2/3] chore: run new spotless config Signed-off-by: VishnuSanal <t.v.s10123@gmail.com> --- .../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<String>() 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<VoidValue>(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<Array<String>>() 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<Array<String>>() 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<Array<String>>() 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<HybridFileParcelable>): - DragAndDropDialog { + private fun newInstance(pasteLocation: String, files: ArrayList<HybridFileParcelable>): 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<Ap if (mimeType == MimeTypes.ALL_MIME_TYPES || forceChooser || !getPreferenceAndStartActivity( - uri, - mimeType, - useNewStack, - activity - ) + uri, + mimeType, + useNewStack, + activity + ) ) { if (forceChooser) { clearMimeTypePreference( @@ -115,8 +115,7 @@ class OpenFileDialogFragment : BaseBottomSheetFragment(), AdjustListViewForTv<Ap } } - private fun newInstance(uri: Uri, mimeType: String, useNewStack: Boolean): - OpenFileDialogFragment { + private fun newInstance(uri: Uri, mimeType: String, useNewStack: Boolean): OpenFileDialogFragment { val args = Bundle() val fragment = OpenFileDialogFragment() diff --git a/app/src/main/java/com/amaze/filemanager/ui/dialogs/SftpConnectDialog.kt b/app/src/main/java/com/amaze/filemanager/ui/dialogs/SftpConnectDialog.kt index e4cbda8de7..a2fba6c499 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/dialogs/SftpConnectDialog.kt +++ b/app/src/main/java/com/amaze/filemanager/ui/dialogs/SftpConnectDialog.kt @@ -331,8 +331,7 @@ class SftpConnectDialog : DialogFragment() { } } - private fun handleOnPositiveButton(edit: Boolean): - MaterialDialog.SingleButtonCallback = + private fun handleOnPositiveButton(edit: Boolean): MaterialDialog.SingleButtonCallback = MaterialDialog.SingleButtonCallback { _, _ -> 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<Intent> { + private fun createOpenDocumentTreeIntentCallback(callback: (directoryUri: Uri) -> Unit): ActivityResultLauncher<Intent> { 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<Ma ) R.string.deselect_all else R.string.select_all ) if (mainFragmentViewModel.openMode != OpenMode.FILE && !mainFragmentViewModel - .getIsCloudOpenMode() + .getIsCloudOpenMode() ) { hideOption(R.id.addshortcut, menu) hideOption(R.id.compress, menu) diff --git a/app/src/main/java/com/amaze/filemanager/utils/ProgressHandler.java b/app/src/main/java/com/amaze/filemanager/utils/ProgressHandler.java index 58267ba44c..407739fdb4 100644 --- a/app/src/main/java/com/amaze/filemanager/utils/ProgressHandler.java +++ b/app/src/main/java/com/amaze/filemanager/utils/ProgressHandler.java @@ -41,11 +41,13 @@ public class ProgressHandler { * (see Java Language Specification 17.7) */ private volatile long writtenSize = 0L; + /** total number of source files to be processed */ private volatile int sourceFiles = 0; /** number of source files processed so far */ private volatile int sourceFilesProcessed = 0; + /** file name currently being processed */ private volatile String fileName; diff --git a/app/src/main/java/com/amaze/filemanager/utils/TinyDB.kt b/app/src/main/java/com/amaze/filemanager/utils/TinyDB.kt index 057ac30ad3..8eb0889937 100644 --- a/app/src/main/java/com/amaze/filemanager/utils/TinyDB.kt +++ b/app/src/main/java/com/amaze/filemanager/utils/TinyDB.kt @@ -29,9 +29,9 @@ import android.text.TextUtils */ object TinyDB { /* - * The "‚" character is not a comma, it is the SINGLE LOW-9 QUOTATION MARK. U-201A - * + U-2017 + U-201A are used for separating the items in a list. - */ + * The "‚" character is not a comma, it is the SINGLE LOW-9 QUOTATION MARK. U-201A + * + U-2017 + U-201A are used for separating the items in a list. + */ private const val DIVIDER = "‚‗‚" /** diff --git a/app/src/play/java/com/amaze/filemanager/filesystem/compressed/extractcontents/helpers/RarExtractor.kt b/app/src/play/java/com/amaze/filemanager/filesystem/compressed/extractcontents/helpers/RarExtractor.kt index f87b70f4a9..b80b1647c8 100644 --- a/app/src/play/java/com/amaze/filemanager/filesystem/compressed/extractcontents/helpers/RarExtractor.kt +++ b/app/src/play/java/com/amaze/filemanager/filesystem/compressed/extractcontents/helpers/RarExtractor.kt @@ -160,7 +160,7 @@ class RarExtractor( /* junrar doesn't throw exceptions if wrong archive password is supplied, until extracted file CRC is compared against the one stored in archive. So we can only rely on verifying CRC during extracting - */ + */ val inputStream = BufferedInputStream(rarFile.getInputStream(entry)) val outputStream = CheckedOutputStream( BufferedOutputStream(FileUtil.getOutputStream(outputFile, context)), diff --git a/app/src/play/java/com/amaze/filemanager/utils/Billing.kt b/app/src/play/java/com/amaze/filemanager/utils/Billing.kt index 9a1e9f1164..4b77a89a43 100644 --- a/app/src/play/java/com/amaze/filemanager/utils/Billing.kt +++ b/app/src/play/java/com/amaze/filemanager/utils/Billing.kt @@ -246,11 +246,11 @@ class Billing(private val activity: BasicActivity) : private fun showPaymentsDialog(context: BasicActivity) { /* - * As of Billing library 4.0, all callbacks are running on background thread. - * Need to use AppConfig.runInApplicationThread() for UI interactions - * - * - */ + * As of Billing library 4.0, all callbacks are running on background thread. + * Need to use AppConfig.runInApplicationThread() for UI interactions + * + * + */ AppConfig.getInstance() .runInApplicationThread( Callable { diff --git a/app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/compress/CompressedHelperForBadArchiveTest.kt b/app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/compress/CompressedHelperForBadArchiveTest.kt index 908f1cc79f..0104ad98e2 100644 --- a/app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/compress/CompressedHelperForBadArchiveTest.kt +++ b/app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/compress/CompressedHelperForBadArchiveTest.kt @@ -62,7 +62,7 @@ class CompressedHelperForBadArchiveTest { private fun doTestBadArchive(data: ByteArray) { for ( - archiveType in supportedArchiveExtensions().subtract(excludedArchiveTypes) + archiveType in supportedArchiveExtensions().subtract(excludedArchiveTypes) ) { val badArchive = File( Environment.getExternalStorageDirectory(), diff --git a/app/src/test/java/com/amaze/filemanager/database/UtilsHandlerTest.kt b/app/src/test/java/com/amaze/filemanager/database/UtilsHandlerTest.kt index 9a208729fa..f482ea157b 100644 --- a/app/src/test/java/com/amaze/filemanager/database/UtilsHandlerTest.kt +++ b/app/src/test/java/com/amaze/filemanager/database/UtilsHandlerTest.kt @@ -185,13 +185,13 @@ class UtilsHandlerTest { Pair(it[0], it[1]) } for ( - d in arrayOf( - DIRECTORY_DOWNLOADS, - DIRECTORY_DCIM, - DIRECTORY_MUSIC, - DIRECTORY_MOVIES, - DIRECTORY_PICTURES - ) + d in arrayOf( + DIRECTORY_DOWNLOADS, + DIRECTORY_DCIM, + DIRECTORY_MUSIC, + DIRECTORY_MOVIES, + DIRECTORY_PICTURES + ) ) { assertTrue( verify.contains( diff --git a/app/src/test/java/com/amaze/filemanager/filesystem/HybridFileTest.kt b/app/src/test/java/com/amaze/filemanager/filesystem/HybridFileTest.kt index eba4d8dbde..2e1b257277 100644 --- a/app/src/test/java/com/amaze/filemanager/filesystem/HybridFileTest.kt +++ b/app/src/test/java/com/amaze/filemanager/filesystem/HybridFileTest.kt @@ -200,12 +200,12 @@ class HybridFileTest { @Test fun testGetName() { for ( - name: String in arrayOf( - "newfolder", - "new folder 2", - "new%20folder%203", - "あいうえお" - ) + name: String in arrayOf( + "newfolder", + "new folder 2", + "new%20folder%203", + "あいうえお" + ) ) { val file = HybridFile(OpenMode.FTP, "ftp://user:password@127.0.0.1/$name") assertEquals( diff --git a/app/src/test/java/com/amaze/filemanager/filesystem/ftp/FtpHybridFileTest.kt b/app/src/test/java/com/amaze/filemanager/filesystem/ftp/FtpHybridFileTest.kt index 76e1770dce..ebf9b13918 100644 --- a/app/src/test/java/com/amaze/filemanager/filesystem/ftp/FtpHybridFileTest.kt +++ b/app/src/test/java/com/amaze/filemanager/filesystem/ftp/FtpHybridFileTest.kt @@ -273,13 +273,13 @@ open class FtpHybridFileTest { @FlakyTest() fun testMkdir() { for ( - dir: String in arrayOf( + dir: String in arrayOf( // "newfolder", // "new folder 2", - "new%20folder%203", - "あいうえお", - "multiple/levels/down the pipe" - ) + "new%20folder%203", + "あいうえお", + "multiple/levels/down the pipe" + ) ) { val newFile = HybridFile(OpenMode.FTP, "$ftpUrl/$dir") val latch = CountDownLatch(1) diff --git a/app/src/test/java/com/amaze/filemanager/filesystem/usb/ReflectionHelpers.java b/app/src/test/java/com/amaze/filemanager/filesystem/usb/ReflectionHelpers.java index faa833c091..5b92dd8333 100644 --- a/app/src/test/java/com/amaze/filemanager/filesystem/usb/ReflectionHelpers.java +++ b/app/src/test/java/com/amaze/filemanager/filesystem/usb/ReflectionHelpers.java @@ -79,8 +79,11 @@ static void addUsbOtgDevice(Activity activity) { @RequiresApi(Build.VERSION_CODES.LOLLIPOP) static void configureUsbDevice(UsbDevice device) - throws NoSuchMethodException, ClassNotFoundException, InvocationTargetException, - InstantiationException, IllegalAccessException { + throws NoSuchMethodException, + ClassNotFoundException, + InvocationTargetException, + InstantiationException, + IllegalAccessException { UsbConfiguration usbConfiguration = callUsbConfigurationConstructor(0, "", 0, 0); configureUsbConfiguration(usbConfiguration); @@ -91,8 +94,11 @@ static void configureUsbDevice(UsbDevice device) @RequiresApi(Build.VERSION_CODES.LOLLIPOP) static void configureUsbConfiguration(UsbConfiguration usbConfiguration) - throws NoSuchMethodException, ClassNotFoundException, InvocationTargetException, - InstantiationException, IllegalAccessException { + throws NoSuchMethodException, + ClassNotFoundException, + InvocationTargetException, + InstantiationException, + IllegalAccessException { UsbInterface usbInterface = callUsbInterfaceConstructor(01, 0, "", USB_CLASS_MASS_STORAGE, 0, 0); @@ -103,8 +109,11 @@ static void configureUsbConfiguration(UsbConfiguration usbConfiguration) @RequiresApi(Build.VERSION_CODES.KITKAT) static Parcelable[] configureUsbDevice() - throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, - InstantiationException, IllegalAccessException { + throws ClassNotFoundException, + NoSuchMethodException, + InvocationTargetException, + InstantiationException, + IllegalAccessException { UsbInterface usbInterface = (UsbInterface) callUsbInterfaceConstructor(01, USB_CLASS_MASS_STORAGE, 0, 0, null); @@ -123,8 +132,11 @@ static UsbDevice callUsbDeviceConstructor( @Nullable String productName, @NonNull String version, @Nullable String serialNumber) - throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, - InvocationTargetException, InstantiationException { + throws ClassNotFoundException, + NoSuchMethodException, + IllegalAccessException, + InvocationTargetException, + InstantiationException { Class<UsbDevice> clazz = (Class<UsbDevice>) Class.forName("android.hardware.usb.UsbDevice"); Constructor<UsbDevice> 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<UsbDevice> clazz = (Class<UsbDevice>) Class.forName("android.hardware.usb.UsbDevice"); Constructor<UsbDevice> 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<UsbDevice> clazz = (Class<UsbDevice>) Class.forName("android.hardware.usb.UsbDevice"); Constructor<UsbDevice> 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<UsbConfiguration> clazz = (Class<UsbConfiguration>) 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<UsbInterface> clazz = (Class<UsbInterface>) 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<UsbInterface> clazz = (Class<UsbInterface>) 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 <t.v.s10123@gmail.com> 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<String>() 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<VoidValue>(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<Array<String>>() 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<Array<String>>() 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<Array<String>>() 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<HybridFileParcelable>): DragAndDropDialog { + private fun newInstance(pasteLocation: String, files: ArrayList<HybridFileParcelable>): + 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<Ap if (mimeType == MimeTypes.ALL_MIME_TYPES || forceChooser || !getPreferenceAndStartActivity( - uri, - mimeType, - useNewStack, - activity - ) + uri, + mimeType, + useNewStack, + activity + ) ) { if (forceChooser) { clearMimeTypePreference( @@ -115,7 +115,8 @@ class OpenFileDialogFragment : BaseBottomSheetFragment(), AdjustListViewForTv<Ap } } - private fun newInstance(uri: Uri, mimeType: String, useNewStack: Boolean): OpenFileDialogFragment { + private fun newInstance(uri: Uri, mimeType: String, useNewStack: Boolean): + OpenFileDialogFragment { val args = Bundle() val fragment = OpenFileDialogFragment() 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 e79d92e3cd..9705abd126 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 3b9f025411..29412de076 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 @@ -419,7 +419,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) @@ -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<Intent> { + private fun createOpenDocumentTreeIntentCallback(callback: (directoryUri: Uri) -> Unit): + ActivityResultLauncher<Intent> { 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<Ma } if (mainFragmentViewModel.openMode != OpenMode.FILE && !mainFragmentViewModel - .getIsCloudOpenMode() + .getIsCloudOpenMode() ) { hideOption(R.id.addshortcut, menu) hideOption(R.id.compress, menu) diff --git a/app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/compress/CompressedHelperForBadArchiveTest.kt b/app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/compress/CompressedHelperForBadArchiveTest.kt index 0104ad98e2..908f1cc79f 100644 --- a/app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/compress/CompressedHelperForBadArchiveTest.kt +++ b/app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/compress/CompressedHelperForBadArchiveTest.kt @@ -62,7 +62,7 @@ class CompressedHelperForBadArchiveTest { private fun doTestBadArchive(data: ByteArray) { for ( - archiveType in supportedArchiveExtensions().subtract(excludedArchiveTypes) + archiveType in supportedArchiveExtensions().subtract(excludedArchiveTypes) ) { val badArchive = File( Environment.getExternalStorageDirectory(), diff --git a/app/src/test/java/com/amaze/filemanager/database/UtilsHandlerTest.kt b/app/src/test/java/com/amaze/filemanager/database/UtilsHandlerTest.kt index 3eaa3d9cf6..842c7506f8 100644 --- a/app/src/test/java/com/amaze/filemanager/database/UtilsHandlerTest.kt +++ b/app/src/test/java/com/amaze/filemanager/database/UtilsHandlerTest.kt @@ -185,13 +185,13 @@ class UtilsHandlerTest { Pair(it[0], it[1]) } for ( - d in arrayOf( - DIRECTORY_DOWNLOADS, - DIRECTORY_DCIM, - DIRECTORY_MUSIC, - DIRECTORY_MOVIES, - DIRECTORY_PICTURES - ) + d in arrayOf( + DIRECTORY_DOWNLOADS, + DIRECTORY_DCIM, + DIRECTORY_MUSIC, + DIRECTORY_MOVIES, + DIRECTORY_PICTURES + ) ) { assertTrue( verify.contains( diff --git a/app/src/test/java/com/amaze/filemanager/filesystem/HybridFileTest.kt b/app/src/test/java/com/amaze/filemanager/filesystem/HybridFileTest.kt index 2e1b257277..eba4d8dbde 100644 --- a/app/src/test/java/com/amaze/filemanager/filesystem/HybridFileTest.kt +++ b/app/src/test/java/com/amaze/filemanager/filesystem/HybridFileTest.kt @@ -200,12 +200,12 @@ class HybridFileTest { @Test fun testGetName() { for ( - name: String in arrayOf( - "newfolder", - "new folder 2", - "new%20folder%203", - "あいうえお" - ) + name: String in arrayOf( + "newfolder", + "new folder 2", + "new%20folder%203", + "あいうえお" + ) ) { val file = HybridFile(OpenMode.FTP, "ftp://user:password@127.0.0.1/$name") assertEquals( diff --git a/app/src/test/java/com/amaze/filemanager/filesystem/ftp/FtpHybridFileTest.kt b/app/src/test/java/com/amaze/filemanager/filesystem/ftp/FtpHybridFileTest.kt index ebf9b13918..76e1770dce 100644 --- a/app/src/test/java/com/amaze/filemanager/filesystem/ftp/FtpHybridFileTest.kt +++ b/app/src/test/java/com/amaze/filemanager/filesystem/ftp/FtpHybridFileTest.kt @@ -273,13 +273,13 @@ open class FtpHybridFileTest { @FlakyTest() fun testMkdir() { for ( - dir: String in arrayOf( + dir: String in arrayOf( // "newfolder", // "new folder 2", - "new%20folder%203", - "あいうえお", - "multiple/levels/down the pipe" - ) + "new%20folder%203", + "あいうえお", + "multiple/levels/down the pipe" + ) ) { val newFile = HybridFile(OpenMode.FTP, "$ftpUrl/$dir") val latch = CountDownLatch(1) diff --git a/app/src/test/java/com/amaze/filemanager/filesystem/usb/ReflectionHelpers.java b/app/src/test/java/com/amaze/filemanager/filesystem/usb/ReflectionHelpers.java index 5b92dd8333..faa833c091 100644 --- a/app/src/test/java/com/amaze/filemanager/filesystem/usb/ReflectionHelpers.java +++ b/app/src/test/java/com/amaze/filemanager/filesystem/usb/ReflectionHelpers.java @@ -79,11 +79,8 @@ static void addUsbOtgDevice(Activity activity) { @RequiresApi(Build.VERSION_CODES.LOLLIPOP) static void configureUsbDevice(UsbDevice device) - throws NoSuchMethodException, - ClassNotFoundException, - InvocationTargetException, - InstantiationException, - IllegalAccessException { + throws NoSuchMethodException, ClassNotFoundException, InvocationTargetException, + InstantiationException, IllegalAccessException { UsbConfiguration usbConfiguration = callUsbConfigurationConstructor(0, "", 0, 0); configureUsbConfiguration(usbConfiguration); @@ -94,11 +91,8 @@ static void configureUsbDevice(UsbDevice device) @RequiresApi(Build.VERSION_CODES.LOLLIPOP) static void configureUsbConfiguration(UsbConfiguration usbConfiguration) - throws NoSuchMethodException, - ClassNotFoundException, - InvocationTargetException, - InstantiationException, - IllegalAccessException { + throws NoSuchMethodException, ClassNotFoundException, InvocationTargetException, + InstantiationException, IllegalAccessException { UsbInterface usbInterface = callUsbInterfaceConstructor(01, 0, "", USB_CLASS_MASS_STORAGE, 0, 0); @@ -109,11 +103,8 @@ static void configureUsbConfiguration(UsbConfiguration usbConfiguration) @RequiresApi(Build.VERSION_CODES.KITKAT) static Parcelable[] configureUsbDevice() - throws ClassNotFoundException, - NoSuchMethodException, - InvocationTargetException, - InstantiationException, - IllegalAccessException { + throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, + InstantiationException, IllegalAccessException { UsbInterface usbInterface = (UsbInterface) callUsbInterfaceConstructor(01, USB_CLASS_MASS_STORAGE, 0, 0, null); @@ -132,11 +123,8 @@ static UsbDevice callUsbDeviceConstructor( @Nullable String productName, @NonNull String version, @Nullable String serialNumber) - throws ClassNotFoundException, - NoSuchMethodException, - IllegalAccessException, - InvocationTargetException, - InstantiationException { + throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, + InvocationTargetException, InstantiationException { Class<UsbDevice> clazz = (Class<UsbDevice>) Class.forName("android.hardware.usb.UsbDevice"); Constructor<UsbDevice> 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<UsbDevice> clazz = (Class<UsbDevice>) Class.forName("android.hardware.usb.UsbDevice"); Constructor<UsbDevice> 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<UsbDevice> clazz = (Class<UsbDevice>) Class.forName("android.hardware.usb.UsbDevice"); Constructor<UsbDevice> 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<UsbConfiguration> clazz = (Class<UsbConfiguration>) 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<UsbInterface> clazz = (Class<UsbInterface>) 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<UsbInterface> clazz = (Class<UsbInterface>) Class.forName("android.hardware.usb.UsbInterface");