Răsfoiți Sursa

reformat kotlin code

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 3 ani în urmă
părinte
comite
45ed897c34

+ 22 - 10
app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt

@@ -615,7 +615,11 @@ class ChatController(args: Bundle) :
 
 
     private fun checkReadOnlyState() {
     private fun checkReadOnlyState() {
         if (currentConversation != null) {
         if (currentConversation != null) {
-            if (currentConversation?.shouldShowLobby(conversationUser) ?: false || currentConversation?.conversationReadOnlyState != null && currentConversation?.conversationReadOnlyState == Conversation.ConversationReadOnlyState.CONVERSATION_READ_ONLY) {
+            if (currentConversation?.shouldShowLobby(conversationUser) ?: false ||
+                currentConversation?.conversationReadOnlyState != null &&
+                currentConversation?.conversationReadOnlyState ==
+                Conversation.ConversationReadOnlyState.CONVERSATION_READ_ONLY
+            ) {
 
 
                 conversationVoiceCallMenuItem?.icon?.alpha = 99
                 conversationVoiceCallMenuItem?.icon?.alpha = 99
                 conversationVideoMenuItem?.icon?.alpha = 99
                 conversationVideoMenuItem?.icon?.alpha = 99
@@ -745,7 +749,10 @@ class ChatController(args: Bundle) :
     }
     }
 
 
     override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
     override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
-        if (requestCode == UploadAndShareFilesWorker.REQUEST_PERMISSION && grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+        if (requestCode == UploadAndShareFilesWorker.REQUEST_PERMISSION &&
+            grantResults.isNotEmpty() &&
+            grantResults[0] == PackageManager.PERMISSION_GRANTED
+        ) {
             Log.d(ConversationsListController.TAG, "upload starting after permissions were granted")
             Log.d(ConversationsListController.TAG, "upload starting after permissions were granted")
             uploadFiles(filesToUpload)
             uploadFiles(filesToUpload)
         } else {
         } else {
@@ -843,10 +850,11 @@ class ChatController(args: Bundle) :
         super.onAttach(view)
         super.onAttach(view)
         eventBus?.register(this)
         eventBus?.register(this)
 
 
-        if (conversationUser?.userId != "?" && conversationUser?.hasSpreedFeatureCapability("mention-flag") ?: false && activity != null) {
-            activity?.findViewById<View>(R.id.toolbar)?.setOnClickListener { v ->
-                showConversationInfoScreen()
-            }
+        if (conversationUser?.userId != "?" &&
+            conversationUser?.hasSpreedFeatureCapability("mention-flag") ?: false &&
+            activity != null
+        ) {
+            activity?.findViewById<View>(R.id.toolbar)?.setOnClickListener { v -> showConversationInfoScreen() }
         }
         }
 
 
         isLeavingForConversation = false
         isLeavingForConversation = false
@@ -1327,9 +1335,9 @@ class ChatController(args: Bundle) :
                             TextUtils.isEmpty(chatMessageList[i + 1].systemMessage) &&
                             TextUtils.isEmpty(chatMessageList[i + 1].systemMessage) &&
                             chatMessageList[i + 1].actorId == chatMessageList[i].actorId &&
                             chatMessageList[i + 1].actorId == chatMessageList[i].actorId &&
                             countGroupedMessages < 4 && DateFormatter.isSameDay(
                             countGroupedMessages < 4 && DateFormatter.isSameDay(
-                                chatMessageList[i].createdAt,
-                                chatMessageList[i + 1].createdAt
-                            )
+                                    chatMessageList[i].createdAt,
+                                    chatMessageList[i + 1].createdAt
+                                )
                         ) {
                         ) {
                             chatMessageList[i].isGrouped = true
                             chatMessageList[i].isGrouped = true
                             countGroupedMessages++
                             countGroupedMessages++
@@ -1373,7 +1381,11 @@ class ChatController(args: Bundle) :
                     chatMessage.isLinkPreviewAllowed = isLinkPreviewAllowed
                     chatMessage.isLinkPreviewAllowed = isLinkPreviewAllowed
 
 
                     val shouldScroll =
                     val shouldScroll =
-                        !isThereANewNotice && !shouldAddNewMessagesNotice && layoutManager?.findFirstVisibleItemPosition() == 0 || adapter != null && adapter?.itemCount == 0
+                        !isThereANewNotice &&
+                            !shouldAddNewMessagesNotice &&
+                            layoutManager?.findFirstVisibleItemPosition() == 0 ||
+                            adapter != null &&
+                            adapter?.itemCount == 0
 
 
                     if (!shouldAddNewMessagesNotice && !shouldScroll && popupBubble != null) {
                     if (!shouldAddNewMessagesNotice && !shouldScroll && popupBubble != null) {
                         if (!popupBubble!!.isShown) {
                         if (!popupBubble!!.isShown) {

+ 3 - 2
app/src/main/java/com/nextcloud/talk/jobs/UploadAndShareFilesWorker.kt

@@ -75,7 +75,8 @@ class UploadAndShareFilesWorker(val context: Context, workerParameters: WorkerPa
 
 
         if (!isStoragePermissionGranted(context)) {
         if (!isStoragePermissionGranted(context)) {
             Log.w(
             Log.w(
-                TAG, "Storage permission is not granted. As a developer please make sure you check for" +
+                TAG,
+                "Storage permission is not granted. As a developer please make sure you check for" +
                     "permissions via UploadAndShareFilesWorker.isStoragePermissionGranted() and " +
                     "permissions via UploadAndShareFilesWorker.isStoragePermissionGranted() and " +
                     "UploadAndShareFilesWorker.requestStoragePermission() beforehand. If you already " +
                     "UploadAndShareFilesWorker.requestStoragePermission() beforehand. If you already " +
                     "did but end up with this warning, the user most likely revoked the permission"
                     "did but end up with this warning, the user most likely revoked the permission"
@@ -203,7 +204,7 @@ class UploadAndShareFilesWorker(val context: Context, workerParameters: WorkerPa
                     Log.d(TAG, "Permission is revoked")
                     Log.d(TAG, "Permission is revoked")
                     return false
                     return false
                 }
                 }
-            } else { //permission is automatically granted on sdk<23 upon installation
+            } else { // permission is automatically granted on sdk<23 upon installation
                 Log.d(TAG, "Permission is granted")
                 Log.d(TAG, "Permission is granted")
                 return true
                 return true
             }
             }