Fix some magic numbers, bump score

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2023-07-26 17:02:46 +02:00 committed by Marcel Hibbe
parent a941945400
commit efc8a1a2dd
2 changed files with 21 additions and 13 deletions

View File

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

View File

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