Hide StaticImage camera in video settings

This commit is contained in:
Sylvain Berfini 2020-04-23 16:31:12 +02:00
parent 16b5ff4ee5
commit 4e375754ed
3 changed files with 19 additions and 3 deletions

View file

@ -25,6 +25,7 @@ import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.R
import org.linphone.activities.main.settings.SettingListenerStub
import org.linphone.core.Factory
import org.linphone.core.tools.Log
class VideoSettingsViewModel : GenericSettingsViewModel() {
val enableVideoListener = object : SettingListenerStub() {
@ -122,11 +123,23 @@ class VideoSettingsViewModel : GenericSettingsViewModel() {
private fun initCameraDevicesList() {
val labels = arrayListOf<String>()
for (camera in core.videoDevicesList) {
labels.add(camera)
if (prefs.hideStaticImageCamera && camera.startsWith("StaticImage")) {
Log.w("[Video Settings] Do not display StaticImage camera")
} else {
labels.add(camera)
}
}
cameraDeviceLabels.value = labels
cameraDeviceIndex.value = labels.indexOf(core.videoDevice)
val index = labels.indexOf(core.videoDevice)
if (index == -1) {
val firstDevice = cameraDeviceLabels.value.orEmpty().firstOrNull()
Log.w("[Video Settings] Device not found in labels list: ${core.videoDevice}, replace it by $firstDevice")
cameraDeviceIndex.value = 0
core.videoDevice = firstDevice
} else {
cameraDeviceIndex.value = index
}
}
private fun initVideoSizeList() {

View file

@ -84,6 +84,9 @@ class CorePreferences constructor(private val context: Context) {
get() = config.getBool("app", "video_preview", false)
set(value) = config.setBool("app", "video_preview", value)
val hideStaticImageCamera: Boolean
get() = config.getBool("app", "hide_static_image_camera", true)
/* Chat */
var makePublicDownloadedImages: Boolean

View file

@ -12,7 +12,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'com.google.gms:google-services:4.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jlleitschuh.gradle:ktlint-gradle:9.1.1"