diff --git a/app/build.gradle b/app/build.gradle index 058efc355c07..775bf42914a0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,7 +16,7 @@ buildscript { } plugins { - id "com.diffplug.spotless" version "6.19.0" + id "com.diffplug.spotless" version "6.20.0" } apply plugin: 'com.android.application' diff --git a/app/src/main/java/com/nextcloud/client/core/ManualAsyncRunner.kt b/app/src/main/java/com/nextcloud/client/core/ManualAsyncRunner.kt index dc800ce60ff8..0e602b0254d3 100644 --- a/app/src/main/java/com/nextcloud/client/core/ManualAsyncRunner.kt +++ b/app/src/main/java/com/nextcloud/client/core/ManualAsyncRunner.kt @@ -50,7 +50,10 @@ class ManualAsyncRunner : AsyncRunner { ): Cancellable { val remove: Function1 = queue::remove val taskWrapper = Task( - postResult = { it.run(); true }, + postResult = { + it.run() + true + }, removeFromQueue = remove, taskBody = task, onSuccess = onResult, diff --git a/app/src/main/java/com/nextcloud/client/errorhandling/ShowErrorActivity.kt b/app/src/main/java/com/nextcloud/client/errorhandling/ShowErrorActivity.kt index d1743fc5e602..0ef22714e77b 100644 --- a/app/src/main/java/com/nextcloud/client/errorhandling/ShowErrorActivity.kt +++ b/app/src/main/java/com/nextcloud/client/errorhandling/ShowErrorActivity.kt @@ -87,7 +87,8 @@ class ShowErrorActivity : AppCompatActivity() { override fun onOptionsItemSelected(item: MenuItem): Boolean { return when (item.itemId) { R.id.error_share -> { - onClickedShare(); true + onClickedShare() + true } else -> super.onOptionsItemSelected(item) } diff --git a/app/src/main/java/com/nextcloud/client/etm/pages/EtmAccountsFragment.kt b/app/src/main/java/com/nextcloud/client/etm/pages/EtmAccountsFragment.kt index 80a4ffed6927..9cbbc52c36ac 100644 --- a/app/src/main/java/com/nextcloud/client/etm/pages/EtmAccountsFragment.kt +++ b/app/src/main/java/com/nextcloud/client/etm/pages/EtmAccountsFragment.kt @@ -66,7 +66,8 @@ class EtmAccountsFragment : EtmBaseFragment() { override fun onOptionsItemSelected(item: MenuItem): Boolean { return when (item.itemId) { R.id.etm_accounts_share -> { - onClickedShare(); true + onClickedShare() + true } else -> super.onOptionsItemSelected(item) } diff --git a/app/src/main/java/com/nextcloud/client/etm/pages/EtmBackgroundJobsFragment.kt b/app/src/main/java/com/nextcloud/client/etm/pages/EtmBackgroundJobsFragment.kt index d488b5c16fca..714c018e5942 100644 --- a/app/src/main/java/com/nextcloud/client/etm/pages/EtmBackgroundJobsFragment.kt +++ b/app/src/main/java/com/nextcloud/client/etm/pages/EtmBackgroundJobsFragment.kt @@ -124,19 +124,24 @@ class EtmBackgroundJobsFragment : EtmBaseFragment() { override fun onOptionsItemSelected(item: MenuItem): Boolean { return when (item.itemId) { R.id.etm_background_jobs_cancel -> { - vm.cancelAllJobs(); true + vm.cancelAllJobs() + true } R.id.etm_background_jobs_prune -> { - vm.pruneJobs(); true + vm.pruneJobs() + true } R.id.etm_background_jobs_start_test -> { - vm.startTestJob(periodic = false); true + vm.startTestJob(periodic = false) + true } R.id.etm_background_jobs_schedule_test -> { - vm.startTestJob(periodic = true); true + vm.startTestJob(periodic = true) + true } R.id.etm_background_jobs_cancel_test -> { - vm.cancelTestJob(); true + vm.cancelTestJob() + true } else -> super.onOptionsItemSelected(item) } diff --git a/app/src/main/java/com/nextcloud/client/etm/pages/EtmFileTransferFragment.kt b/app/src/main/java/com/nextcloud/client/etm/pages/EtmFileTransferFragment.kt index 6f3c3b8c4025..989035917d81 100644 --- a/app/src/main/java/com/nextcloud/client/etm/pages/EtmFileTransferFragment.kt +++ b/app/src/main/java/com/nextcloud/client/etm/pages/EtmFileTransferFragment.kt @@ -134,10 +134,12 @@ class EtmFileTransferFragment : EtmBaseFragment() { override fun onOptionsItemSelected(item: MenuItem): Boolean { return when (item.itemId) { R.id.etm_test_download -> { - scheduleTestDownload(); true + scheduleTestDownload() + true } R.id.etm_test_upload -> { - scheduleTestUpload(); true + scheduleTestUpload() + true } else -> super.onOptionsItemSelected(item) } diff --git a/app/src/main/java/com/nextcloud/client/etm/pages/EtmMigrations.kt b/app/src/main/java/com/nextcloud/client/etm/pages/EtmMigrations.kt index 61db9117fc53..3d9b78ed013f 100644 --- a/app/src/main/java/com/nextcloud/client/etm/pages/EtmMigrations.kt +++ b/app/src/main/java/com/nextcloud/client/etm/pages/EtmMigrations.kt @@ -62,7 +62,8 @@ class EtmMigrations : EtmBaseFragment() { override fun onOptionsItemSelected(item: MenuItem): Boolean { return when (item.itemId) { R.id.etm_migrations_delete -> { - onDeleteMigrationsClicked(); true + onDeleteMigrationsClicked() + true } else -> super.onOptionsItemSelected(item) } diff --git a/app/src/main/java/com/nextcloud/client/etm/pages/EtmPreferencesFragment.kt b/app/src/main/java/com/nextcloud/client/etm/pages/EtmPreferencesFragment.kt index 632a6c82a68a..77f95430dbf6 100644 --- a/app/src/main/java/com/nextcloud/client/etm/pages/EtmPreferencesFragment.kt +++ b/app/src/main/java/com/nextcloud/client/etm/pages/EtmPreferencesFragment.kt @@ -61,7 +61,8 @@ class EtmPreferencesFragment : EtmBaseFragment() { override fun onOptionsItemSelected(item: MenuItem): Boolean { return when (item.itemId) { R.id.etm_preferences_share -> { - onClickedShare(); true + onClickedShare() + true } else -> super.onOptionsItemSelected(item) } diff --git a/app/src/main/java/com/nextcloud/client/files/downloader/TransferManagerImpl.kt b/app/src/main/java/com/nextcloud/client/files/downloader/TransferManagerImpl.kt index d8857f7db51e..c7869ef368de 100644 --- a/app/src/main/java/com/nextcloud/client/files/downloader/TransferManagerImpl.kt +++ b/app/src/main/java/com/nextcloud/client/files/downloader/TransferManagerImpl.kt @@ -99,15 +99,27 @@ class TransferManagerImpl( runner.postTask( task = createDownloadTask(request), onProgress = { progress: Int -> registry.progress(uuid, progress) }, - onResult = { result -> registry.complete(uuid, result.success, result.file); registry.startNext() }, - onError = { registry.complete(uuid, false); registry.startNext() } + onResult = { result -> + registry.complete(uuid, result.success, result.file) + registry.startNext() + }, + onError = { + registry.complete(uuid, false) + registry.startNext() + } ) } else if (request is UploadRequest) { runner.postTask( task = createUploadTask(request), onProgress = { progress: Int -> registry.progress(uuid, progress) }, - onResult = { result -> registry.complete(uuid, result.success, result.file); registry.startNext() }, - onError = { registry.complete(uuid, false); registry.startNext() } + onResult = { result -> + registry.complete(uuid, result.success, result.file) + registry.startNext() + }, + onError = { + registry.complete(uuid, false) + registry.startNext() + } ) } } diff --git a/app/src/main/java/com/nextcloud/client/logger/ui/LogsEmailSender.kt b/app/src/main/java/com/nextcloud/client/logger/ui/LogsEmailSender.kt index 4f33635ac848..8c6c55301d2f 100644 --- a/app/src/main/java/com/nextcloud/client/logger/ui/LogsEmailSender.kt +++ b/app/src/main/java/com/nextcloud/client/logger/ui/LogsEmailSender.kt @@ -65,7 +65,10 @@ class LogsEmailSender(private val context: Context, private val clock: Clock, pr fun send(logs: List) { if (task == null) { val outFile = File(context.cacheDir, "attachments/logs.txt") - task = runner.postQuickTask(Task(context, logs, outFile, clock.tz), onResult = { task = null; send(it) }) + task = runner.postQuickTask(Task(context, logs, outFile, clock.tz), onResult = { + task = null + send(it) + }) } } diff --git a/app/src/main/java/com/owncloud/android/utils/FileSortOrder.kt b/app/src/main/java/com/owncloud/android/utils/FileSortOrder.kt index 45e2e5b58c17..9d0f63b6a377 100644 --- a/app/src/main/java/com/owncloud/android/utils/FileSortOrder.kt +++ b/app/src/main/java/com/owncloud/android/utils/FileSortOrder.kt @@ -35,7 +35,10 @@ open class FileSortOrder(@JvmField var name: String, var isAscending: Boolean) { @Suppress("EnumNaming", "EnumEntryName") // already saved in user preferences -.-' enum class Type { - trashBinView, localFileListView // ktlint-disable enum-entry-name-case + trashBinView, + + @Suppress("ktlint:standard:enum-entry-name-case") + localFileListView } enum class SortType { diff --git a/app/src/main/res/values/dims.xml b/app/src/main/res/values/dims.xml index 0fc10f9e1bd2..f892bf4118fb 100644 --- a/app/src/main/res/values/dims.xml +++ b/app/src/main/res/values/dims.xml @@ -82,7 +82,6 @@ 180dp 60dp 12sp - 24dp 12dp 2dp 12dp diff --git a/app/src/test/java/com/nextcloud/client/core/ManualAsyncRunnerTest.kt b/app/src/test/java/com/nextcloud/client/core/ManualAsyncRunnerTest.kt index 3f1f7e82f80f..623ef721cbeb 100644 --- a/app/src/test/java/com/nextcloud/client/core/ManualAsyncRunnerTest.kt +++ b/app/src/test/java/com/nextcloud/client/core/ManualAsyncRunnerTest.kt @@ -60,7 +60,10 @@ class ManualAsyncRunnerTest { MockitoAnnotations.initMocks(this) runner = ManualAsyncRunner() taskCalls = EMPTY - whenever(task.invoke()).thenAnswer { taskCalls++; taskCalls } + whenever(task.invoke()).thenAnswer { + taskCalls++ + taskCalls + } } @Test diff --git a/app/src/test/java/com/nextcloud/client/core/TaskTest.kt b/app/src/test/java/com/nextcloud/client/core/TaskTest.kt index 25e41538dcee..c845d80caa2f 100644 --- a/app/src/test/java/com/nextcloud/client/core/TaskTest.kt +++ b/app/src/test/java/com/nextcloud/client/core/TaskTest.kt @@ -57,7 +57,10 @@ class TaskTest { @Before fun setUp() { MockitoAnnotations.initMocks(this) - val postResult = { r: Runnable -> r.run(); true } + val postResult = { r: Runnable -> + r.run() + true + } task = Task(this::post, removeFromQueue, taskBody, onResult, onError, onProgress) } diff --git a/app/src/test/java/com/nextcloud/client/logger/LoggerTest.kt b/app/src/test/java/com/nextcloud/client/logger/LoggerTest.kt index cf61e6b1db35..795daf224316 100644 --- a/app/src/test/java/com/nextcloud/client/logger/LoggerTest.kt +++ b/app/src/test/java/com/nextcloud/client/logger/LoggerTest.kt @@ -126,9 +126,18 @@ class LoggerTest { val tag = "test tag" val message = "test log message" val latch = CountDownLatch(LATCH_INIT) - doAnswer { it.callRealMethod(); latch.countDown() }.whenever(logHandler).open() - doAnswer { it.callRealMethod(); latch.countDown() }.whenever(logHandler).write(any()) - doAnswer { it.callRealMethod(); latch.countDown() }.whenever(logHandler).close() + doAnswer { + it.callRealMethod() + latch.countDown() + }.whenever(logHandler).open() + doAnswer { + it.callRealMethod() + latch.countDown() + }.whenever(logHandler).write(any()) + doAnswer { + it.callRealMethod() + latch.countDown() + }.whenever(logHandler).close() // GIVEN // logger event loop is running diff --git a/app/src/test/java/com/nextcloud/client/logger/ui/LogsViewModelTest.kt b/app/src/test/java/com/nextcloud/client/logger/ui/LogsViewModelTest.kt index f2bb6e7dcadb..38a3e1e85751 100644 --- a/app/src/test/java/com/nextcloud/client/logger/ui/LogsViewModelTest.kt +++ b/app/src/test/java/com/nextcloud/client/logger/ui/LogsViewModelTest.kt @@ -68,7 +68,10 @@ class LogsViewModelTest { var onLoadedCallback: OnLogsLoaded? = null override val lostEntries: Boolean = false - override fun load(onLoaded: OnLogsLoaded) { this.onLoadedCallback = onLoaded; loadRequestCount++ } + override fun load(onLoaded: OnLogsLoaded) { + this.onLoadedCallback = onLoaded + loadRequestCount++ + } override fun deleteAll() { /* no implementation needed */ }