From 77d2632513b0d5dbbda39c30f962919260a7734f Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Fri, 29 Nov 2024 12:19:53 +0100 Subject: [PATCH] style(detekt): Improve score Signed-off-by: Andy Scherzinger --- .../main/java/com/nextcloud/talk/activities/CallActivity.kt | 6 +++++- .../talk/chat/data/network/OfflineFirstChatRepository.kt | 3 ++- app/src/main/java/com/nextcloud/talk/utils/DisplayUtils.kt | 3 ++- detekt.yml | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt index 4ef229499..593d49ef6 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt @@ -2121,7 +2121,7 @@ class CallActivity : CallBaseActivity() { private fun startVideoCapture() { if (videoCapturer != null) { - videoCapturer!!.startCapture(1280, 720, 30) + videoCapturer!!.startCapture(WIDTH, HEIGHT, FRAME_RATE) } } @@ -3210,6 +3210,10 @@ class CallActivity : CallBaseActivity() { private const val MICROPHONE_VALUE_THRESHOLD = 20 private const val MICROPHONE_VALUE_SLEEP: Long = 1000 + private const val FRAME_RATE: Int = 30 + private const val WIDTH: Int = 1280 + private const val HEIGHT: Int = 720 + private const val SIGNALING_MESSAGE_SPEAKING_STARTED = "speaking" private const val SIGNALING_MESSAGE_SPEAKING_STOPPED = "stoppedSpeaking" private const val SIGNALING_MESSAGE_VIDEO_ON = "videoOn" diff --git a/app/src/main/java/com/nextcloud/talk/chat/data/network/OfflineFirstChatRepository.kt b/app/src/main/java/com/nextcloud/talk/chat/data/network/OfflineFirstChatRepository.kt index 7be5caaed..361f40ce0 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/data/network/OfflineFirstChatRepository.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/data/network/OfflineFirstChatRepository.kt @@ -274,7 +274,8 @@ class OfflineFirstChatRepository @Inject constructor( if (!monitor.isOnline.first() || itIsPaused) { Thread.sleep(HALF_SECOND) } else { - // sync database with server (This is a long blocking call because long polling (lookIntoFuture) is set) + // sync database with server + // (This is a long blocking call because long polling (lookIntoFuture) is set) networkParams.putSerializable(BundleKeys.KEY_FIELD_MAP, fieldMap) Log.d(TAG, "Starting online request for long polling") diff --git a/app/src/main/java/com/nextcloud/talk/utils/DisplayUtils.kt b/app/src/main/java/com/nextcloud/talk/utils/DisplayUtils.kt index cb8268cab..fc497de79 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/DisplayUtils.kt +++ b/app/src/main/java/com/nextcloud/talk/utils/DisplayUtils.kt @@ -79,6 +79,7 @@ object DisplayUtils { private const val HTTP_MIN_LENGTH: Int = 7 private const val HTTPS_MIN_LENGTH: Int = 7 private const val DATE_TIME_PARTS_SIZE = 2 + private const val ONE_MINUTE_IN_MILLIS: Int = 60000 fun isDarkModeOn(context: Context): Boolean { val currentNightMode = context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK return currentNightMode == Configuration.UI_MODE_NIGHT_YES @@ -490,7 +491,7 @@ object DisplayUtils { } // < 60 seconds -> seconds ago val diff = System.currentTimeMillis() - time - dateString = if (diff > 0 && diff < 60 * 1000 && minResolution == DateUtils.SECOND_IN_MILLIS) { + dateString = if (diff in 1..