Skip to content

Commit

Permalink
Fix some magic numbers, bump score
Browse files Browse the repository at this point in the history
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
  • Loading branch information
AndyScherzinger authored and mahibi committed Jul 27, 2023
1 parent a941945 commit efc8a1a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
32 changes: 20 additions & 12 deletions app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand Down Expand Up @@ -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
}
Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}
2 changes: 1 addition & 1 deletion detekt.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
build:
maxIssues: 74
maxIssues: 117
weights:
# complexity: 2
# LongParameterList: 1
Expand Down

0 comments on commit efc8a1a

Please sign in to comment.