Skip to content

Commit db5365a

Browse files
style: reformat kt code for ktlint
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
1 parent af0e67a commit db5365a

8 files changed

Lines changed: 43 additions & 61 deletions

File tree

app/src/main/java/com/owncloud/android/authentication/PassCodeManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class PassCodeManager(private val preferences: AppPreferences, private val clock
7777
}
7878
}
7979

80-
if (!askedForPin && preferences.lockTimestamp != 0L || askPinWhenDeviceLocked) {
80+
if ((!askedForPin && preferences.lockTimestamp != 0L) || askPinWhenDeviceLocked) {
8181
updateLockTimestamp()
8282
askPinWhenDeviceLocked = false
8383
}

app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ class FileDisplayActivity :
261261

262262
loadSavedInstanceState(savedInstanceState)
263263

264-
/** USER INTERFACE */
264+
// USER INTERFACE
265265
initLayout()
266266
initUI()
267267
initTaskRetainerFragment()
@@ -536,15 +536,15 @@ class FileDisplayActivity :
536536
}
537537

538538
private fun initFragments() {
539-
/** First fragment */
539+
// First fragment
540540
val listOfFiles = this.listOfFilesFragment
541541
if (listOfFiles != null && TextUtils.isEmpty(searchQuery)) {
542542
listOfFiles.listDirectory(getCurrentDir(), file, MainApp.isOnlyOnDevice())
543543
} else {
544544
Log_OC.e(TAG, "Still have a chance to lose the initialization of list fragment >(")
545545
}
546546

547-
/** reset views */
547+
// reset views
548548
resetScrollingAndUpdateActionBar()
549549
}
550550

@@ -605,6 +605,7 @@ class FileDisplayActivity :
605605
private fun handleCommonIntents(intent: Intent) {
606606
when (intent.action) {
607607
Intent.ACTION_VIEW -> handleOpenFileViaIntent(intent)
608+
608609
OPEN_FILE -> {
609610
onOpenFileIntent(intent)
610611
}
@@ -788,11 +789,7 @@ class FileDisplayActivity :
788789
var leftFragment: Fragment?
789790
get() = supportFragmentManager.findFragmentByTag(TAG_LIST_OF_FILES)
790791

791-
/**
792-
* Replaces the first fragment managed by the activity with the received as a parameter.
793-
*
794-
* @param fragment New Fragment to set.
795-
*/
792+
// Replaces the first fragment managed by the activity with the received as a parameter.
796793
private set(fragment) {
797794
setLeftFragment(fragment, true)
798795
}
@@ -1235,6 +1232,7 @@ class FileDisplayActivity :
12351232
android.R.id.home -> {
12361233
when {
12371234
shouldOpenDrawer() -> openDrawer()
1235+
12381236
else -> {
12391237
handleBackPressImpl()
12401238
}
@@ -1646,9 +1644,11 @@ class FileDisplayActivity :
16461644
mSyncInProgress -> {
16471645
it.setEmptyListMessage(EmptyListState.LOADING)
16481646
}
1647+
16491648
MainApp.isOnlyOnDevice() -> {
16501649
it.setEmptyListMessage(EmptyListState.ONLY_ON_DEVICE)
16511650
}
1651+
16521652
else -> it.setEmptyListMessage(SearchType.NO_SEARCH)
16531653
}
16541654
}
@@ -2351,21 +2351,6 @@ class FileDisplayActivity :
23512351
* change.
23522352
* @param ignoreFocus reloads file list even without focus, e.g. on tablet mode, focus can still be in detail view
23532353
*/
2354-
2355-
/**
2356-
* Starts an operation to refresh the requested folder.
2357-
*
2358-
*
2359-
* The operation is run in a new background thread created on the fly.
2360-
*
2361-
*
2362-
* The refresh updates is a "light sync": properties of regular files in folder are updated (including associated
2363-
* shares), but not their contents. Only the contents of files marked to be kept-in-sync are synchronized too.
2364-
*
2365-
* @param folder Folder to refresh.
2366-
* @param ignoreETag If 'true', the data from the server will be fetched and sync'ed even if the eTag didn't
2367-
* change.
2368-
*/
23692354
@JvmOverloads
23702355
fun startSyncFolderOperation(folder: OCFile?, ignoreETag: Boolean, ignoreFocus: Boolean = false) {
23712356
Log_OC.d(TAG, "startSyncFolderOperation called, ignoreEtag: $ignoreETag, ignoreFocus: $ignoreFocus")
@@ -2378,7 +2363,7 @@ class FileDisplayActivity :
23782363

23792364
handler.postDelayed({
23802365
val user = getUser()
2381-
if (!ignoreFocus && !hasWindowFocus() || !user.isPresent) {
2366+
if ((!ignoreFocus && !hasWindowFocus()) || !user.isPresent) {
23822367
// do not refresh if the user rotates the device while another window has focus
23832368
// or if the current user is no longer valid
23842369
mSyncInProgress = false
@@ -2532,7 +2517,7 @@ class FileDisplayActivity :
25322517
return // not reachable under normal conditions
25332518
}
25342519
val actualUser = user.get()
2535-
if (showPreview && file.isDown && !file.isDownloading || streamMedia) {
2520+
if ((showPreview && file.isDown && !file.isDownloading) || streamMedia) {
25362521
if (showInActivity) {
25372522
startMediaActivity(file, startPlaybackPosition, autoplay, actualUser)
25382523
} else {

app/src/main/java/com/owncloud/android/ui/adapter/OCFileListDelegate.kt

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,22 @@ class OCFileListDelegate(
216216

217217
// shares
218218
val shouldHideShare = (
219-
hideItemOptions ||
220-
!file.isFolder &&
221-
file.isEncrypted ||
222-
file.isEncrypted &&
223-
!EncryptionUtils.supportsSecureFiledrop(file, user) ||
224-
searchType == SearchType.FAVORITE_SEARCH ||
225-
file.isFolder &&
226-
currentDirectory?.isEncrypted ?: false
219+
(
220+
hideItemOptions ||
221+
(
222+
!file.isFolder &&
223+
file.isEncrypted
224+
) ||
225+
(
226+
file.isEncrypted &&
227+
!EncryptionUtils.supportsSecureFiledrop(file, user)
228+
) ||
229+
(searchType == SearchType.FAVORITE_SEARCH) ||
230+
(
231+
file.isFolder &&
232+
(currentDirectory?.isEncrypted ?: false)
233+
)
234+
)
227235
) // sharing an encrypted subfolder is not possible
228236
if (shouldHideShare) {
229237
viewHolder.shared.visibility = View.GONE
@@ -390,6 +398,7 @@ class OCFileListDelegate(
390398
}
391399

392400
file.isSharedViaLink -> R.drawable.shared_via_link to R.string.shared_icon_shared_via_link
401+
393402
else -> R.drawable.ic_unshared to R.string.shared_icon_share
394403
}
395404
}

app/src/main/java/com/owncloud/android/ui/dialog/MultipleAccountsDialog.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ class MultipleAccountsDialog :
6565
return builder.create()
6666
}
6767

68+
/**
69+
* creates the account list items list including the add-account action in case
70+
* multi account support is enabled.
71+
*
72+
* @return list of account list items
73+
*/
6874
private val accountListItems: List<UserListItem>
69-
/**
70-
* creates the account list items list including the add-account action in case
71-
* multi account support is enabled.
72-
*
73-
* @return list of account list items
74-
*/
7575
get() {
7676
val users = accountManager?.allUsers ?: listOf()
7777

app/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -743,12 +743,12 @@ open class ExtendedListFragment :
743743
}
744744
}
745745

746+
/**
747+
* Get the text of EmptyListMessage TextView.
748+
*
749+
* @return String empty text view text-value
750+
*/
746751
val emptyViewText: String
747-
/**
748-
* Get the text of EmptyListMessage TextView.
749-
*
750-
* @return String empty text view text-value
751-
*/
752752
get() = if (mEmptyListContainer != null && mEmptyListMessage != null) {
753753
mEmptyListMessage?.getText()
754754
.toString()

app/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,14 @@ import kotlin.math.min
8282
* This fragment shows a preview of a downloaded image.
8383
* Trying to get an instance with a NULL [OCFile] will produce an [IllegalStateException].
8484
* If the [OCFile] passed is not downloaded, an [IllegalStateException] is generated on instantiation too.
85-
*/
86-
87-
/**
88-
* Creates an empty fragment for image previews.
8985
*
86+
* Creates an empty fragment for image previews.
9087
*
9188
* MUST BE KEPT: the system uses it when tries to re-instantiate a fragment automatically (for instance, when the
9289
* device is turned a aside).
9390
*
94-
*
9591
* DO NOT CALL IT: an [OCFile] and [User] must be provided for a successful construction
9692
*/
97-
9893
@Suppress("TooManyFunctions")
9994
class PreviewImageFragment :
10095
FileFragment(),

app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.kt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,26 +78,19 @@ import javax.inject.Inject
7878
/**
7979
* This fragment shows a preview of a downloaded media file (audio or video).
8080
*
81-
*
8281
* Trying to get an instance with NULL [OCFile] or ownCloud [User] values will produce an
8382
* [IllegalStateException].
8483
*
85-
*
8684
* By now, if the [OCFile] passed is not downloaded, an [IllegalStateException] is generated on
8785
* instantiation too.
88-
*/
89-
90-
/**
91-
* Creates an empty fragment for previews.
9286
*
87+
* Creates an empty fragment for previews.
9388
*
9489
* MUST BE KEPT: the system uses it when tries to reinstantiate a fragment automatically (for instance, when the
9590
* device is turned a aside).
9691
*
97-
*
9892
* DO NOT CALL IT: an [OCFile] and [User] must be provided for a successful construction
9993
*/
100-
10194
@Suppress("NestedBlockDepth", "ComplexMethod", "LongMethod", "TooManyFunctions")
10295
class PreviewMediaFragment :
10396
FileFragment(),

app/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ abstract class PreviewTextFragment :
235235
return
236236
}
237237

238-
if ((ignoreMimetype || file != null && MimeTypeUtil.MIMETYPE_TEXT_MARKDOWN == file.mimeType) &&
239-
activity != null
238+
if ((ignoreMimetype || ((file != null) && (MimeTypeUtil.MIMETYPE_TEXT_MARKDOWN == file.mimeType))) &&
239+
(activity != null)
240240
) {
241241
if (!preview) {
242242
// clickable links prevent to open full view of rich workspace

0 commit comments

Comments
 (0)