ソースを参照

Fix some magic numbers, bump score

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 1 年間 前
コミット
efc8a1a2dd
2 ファイル変更21 行追加13 行削除
  1. 20 12
      app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt
  2. 1 1
      detekt.yml

+ 20 - 12
app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt

@@ -1165,11 +1165,11 @@ class CallActivity : CallBaseActivity() {
         if (video) {
             message = "videoOff"
             if (enable) {
-                binding!!.cameraButton.alpha = 1.0f
+                binding!!.cameraButton.alpha = OPACITY_ENABLED
                 message = "videoOn"
                 startVideoCapture()
             } else {
-                binding!!.cameraButton.alpha = 0.7f
+                binding!!.cameraButton.alpha = OPACITY_DISABLED
                 if (videoCapturer != null) {
                     try {
                         videoCapturer!!.stopCapture()
@@ -1190,9 +1190,9 @@ class CallActivity : CallBaseActivity() {
             message = "audioOff"
             if (enable) {
                 message = "audioOn"
-                binding!!.microphoneButton.alpha = 1.0f
+                binding!!.microphoneButton.alpha = OPACITY_ENABLED
             } else {
-                binding!!.microphoneButton.alpha = 0.7f
+                binding!!.microphoneButton.alpha = OPACITY_DISABLED
             }
             if (localStream != null && localStream!!.audioTracks.size > 0) {
                 localStream!!.audioTracks[0].setEnabled(enable)
@@ -1230,14 +1230,14 @@ class CallActivity : CallBaseActivity() {
                 callControlHandler.removeCallbacksAndMessages(null)
                 callInfosHandler.removeCallbacksAndMessages(null)
                 cameraSwitchHandler.removeCallbacksAndMessages(null)
-                alpha = 1.0f
-                duration = 1000
+                alpha = OPACITY_ENABLED
+                duration = SECOND_IN_MILLIES
                 if (binding!!.callControls.visibility != View.VISIBLE) {
-                    binding!!.callControls.alpha = 0.0f
+                    binding!!.callControls.alpha = OPACITY_INVISIBLE
                     binding!!.callControls.visibility = View.VISIBLE
-                    binding!!.callInfosLinearLayout.alpha = 0.0f
+                    binding!!.callInfosLinearLayout.alpha = OPACITY_INVISIBLE
                     binding!!.callInfosLinearLayout.visibility = View.VISIBLE
-                    binding!!.switchSelfVideoButton.alpha = 0.0f
+                    binding!!.switchSelfVideoButton.alpha = OPACITY_INVISIBLE
                     if (videoOn) {
                         binding!!.switchSelfVideoButton.visibility = View.VISIBLE
                     }
@@ -1246,8 +1246,8 @@ class CallActivity : CallBaseActivity() {
                     return
                 }
             } else {
-                alpha = 0.0f
-                duration = 1000
+                alpha = OPACITY_INVISIBLE
+                duration = SECOND_IN_MILLIES
             }
             binding!!.callControls.isEnabled = false
             binding!!.callControls.animate()
@@ -2702,7 +2702,9 @@ class CallActivity : CallBaseActivity() {
                 .retry(3)
                 .subscribeOn(Schedulers.io())
                 .subscribe(object : Observer<SignalingOverall> {
-                    override fun onSubscribe(d: Disposable) {}
+                    override fun onSubscribe(d: Disposable) {
+                        // unused atm
+                    }
                     override fun onNext(signalingOverall: SignalingOverall) {
                         // When sending messages to the internal signaling server the response has been empty since
                         // Talk v2.9.0, so it is not really needed to process it, but there is no harm either in
@@ -2912,5 +2914,11 @@ class CallActivity : CallBaseActivity() {
         private const val MICROPHONE_PIP_INTENT_EXTRA_ACTION = "microphone_pip_action"
         private const val MICROPHONE_PIP_REQUEST_MUTE = 1
         private const val MICROPHONE_PIP_REQUEST_UNMUTE = 2
+
+        const val OPACITY_ENABLED = 1.0f
+        const val OPACITY_DISABLED = 0.7f
+        const val OPACITY_INVISIBLE = 0.0f
+
+        const val SECOND_IN_MILLIES: Long = 1000
     }
 }

+ 1 - 1
detekt.yml

@@ -1,5 +1,5 @@
 build:
-  maxIssues: 74
+  maxIssues: 117
   weights:
     # complexity: 2
     # LongParameterList: 1