Skip to content

Commit

Permalink
solve ktlint + detekt warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Hibbe <[email protected]>
  • Loading branch information
mahibi committed Sep 6, 2023
1 parent 9f234e1 commit e839f6f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
16 changes: 11 additions & 5 deletions app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1234,10 +1234,10 @@ class CallActivity : CallBaseActivity() {
private fun toggleMedia(enable: Boolean, video: Boolean) {
var message: String
if (video) {
message = "videoOff"
message = SIGNALING_MESSAGE_VIDEO_OFF
if (enable) {
binding!!.cameraButton.alpha = OPACITY_ENABLED
message = "videoOn"
message = SIGNALING_MESSAGE_VIDEO_ON
startVideoCapture()
} else {
binding!!.cameraButton.alpha = OPACITY_DISABLED
Expand All @@ -1258,9 +1258,9 @@ class CallActivity : CallBaseActivity() {
binding!!.selfVideoRenderer.visibility = View.INVISIBLE
}
} else {
message = "audioOff"
message = SIGNALING_MESSAGE_AUDIO_OFF
if (enable) {
message = "audioOn"
message = SIGNALING_MESSAGE_AUDIO_ON
binding!!.microphoneButton.alpha = OPACITY_ENABLED
} else {
binding!!.microphoneButton.alpha = OPACITY_DISABLED
Expand Down Expand Up @@ -3050,7 +3050,7 @@ class CallActivity : CallBaseActivity() {
val newX = event.rawX - binding!!.selfVideoViewWrapper.width / 2f
binding!!.selfVideoViewWrapper.y = newY
binding!!.selfVideoViewWrapper.x = newX
} else if (event.actionMasked == MotionEvent.ACTION_UP && duration < 100) {
} else if (event.actionMasked == MotionEvent.ACTION_UP && duration < SWITCH_CAMERA_THRESHOLD_DURATION) {
switchCamera()
}
return true
Expand Down Expand Up @@ -3084,11 +3084,17 @@ class CallActivity : CallBaseActivity() {
const val CALL_DURATION_EMPTY = "--:--"
const val API_RETRIES: Long = 3

const val SWITCH_CAMERA_THRESHOLD_DURATION = 100

private const val SAMPLE_RATE = 8000
private const val MICROPHONE_VALUE_THRESHOLD = 20
private const val MICROPHONE_VALUE_SLEEP: Long = 1000

private const val SIGNALING_MESSAGE_SPEAKING_STARTED = "speaking"
private const val SIGNALING_MESSAGE_SPEAKING_STOPPED = "stoppedSpeaking"
private const val SIGNALING_MESSAGE_VIDEO_ON = "videoOn"
private const val SIGNALING_MESSAGE_VIDEO_OFF = "videoOff"
private const val SIGNALING_MESSAGE_AUDIO_ON = "audioOn"
private const val SIGNALING_MESSAGE_AUDIO_OFF = "audioOff"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ abstract class SharedItemsViewHolder(
item.id,
item.mimeType,
true,
FileViewerUtils.ProgressUi(progressBar, null, image),
FileViewerUtils.ProgressUi(progressBar, null, image)
)
}

Expand Down
8 changes: 5 additions & 3 deletions app/src/main/java/com/nextcloud/talk/utils/FileViewerUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,11 @@ class FileViewerUtils(private val context: Context, private val user: User) {
if (progressUi.previewImage.isShown && openWhenDownloaded) {
openFileByMimetype(fileName, mimetype)
} else {
Log.d(TAG, "file " + fileName +
" was downloaded but it's not opened because view is not shown on screen or " +
"openWhenDownloaded is false"
Log.d(
TAG,
"file " + fileName +
" was downloaded but it's not opened because view is not shown on screen or " +
"openWhenDownloaded is false"
)
}
progressUi.messageText?.text = fileName
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/item_system_message.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
android:layout_marginStart="@dimen/standard_margin"
android:layout_marginTop="@dimen/standard_eighth_margin"
android:layout_marginEnd="@dimen/standard_margin"
android:layout_marginBottom="@dimen/standard_eighth_margin">
android:layout_marginBottom="@dimen/standard_eighth_margin"
tools:ignore="UselessParent">

<ImageView
android:id="@+id/expandCollapseIcon"
Expand Down

0 comments on commit e839f6f

Please sign in to comment.