Cleanup element call and UI (#4641)
* Use ElementTheme.colors.bgCanvasDefault instead of MaterialTheme.colorScheme.background Even if the value is the same, we should use color from ElementTheme. * Remove background management of ElementCallActivity. It does not work as expected and also changing theme during a call would require to load the url again with the new theme. * Do not use isSystemInDarkTheme() directly. * Use bgSubtleSecondary for background color of Preview. * Use default colors for Preview. * Fix copy paste issue. * Update screenshots --------- Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
parent
b636c69843
commit
f6fe5fda35
8 changed files with 12 additions and 38 deletions
|
|
@ -10,7 +10,6 @@ package io.element.android.features.call.impl.ui
|
|||
import android.Manifest
|
||||
import android.app.PictureInPictureParams
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.media.AudioAttributes
|
||||
import android.media.AudioFocusRequest
|
||||
import android.media.AudioManager
|
||||
|
|
@ -78,7 +77,6 @@ class ElementCallActivity :
|
|||
|
||||
private val requestPermissionsLauncher = registerPermissionResultLauncher()
|
||||
|
||||
private var isDarkMode = false
|
||||
private val webViewTarget = mutableStateOf<CallType?>(null)
|
||||
|
||||
private var eventSink: ((CallScreenEvents) -> Unit)? = null
|
||||
|
|
@ -102,10 +100,6 @@ class ElementCallActivity :
|
|||
return
|
||||
}
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
updateUiMode(resources.configuration)
|
||||
}
|
||||
|
||||
pictureInPicturePresenter.setPipView(this)
|
||||
|
||||
audioManager = getSystemService(AUDIO_SERVICE) as AudioManager
|
||||
|
|
@ -174,11 +168,6 @@ class ElementCallActivity :
|
|||
}
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
updateUiMode(newConfig)
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
super.onNewIntent(intent)
|
||||
setCallType(intent)
|
||||
|
|
@ -283,19 +272,6 @@ class ElementCallActivity :
|
|||
}
|
||||
}
|
||||
|
||||
private fun updateUiMode(configuration: Configuration) {
|
||||
val prevDarkMode = isDarkMode
|
||||
val currentNightMode = configuration.uiMode and Configuration.UI_MODE_NIGHT_YES
|
||||
isDarkMode = currentNightMode != 0
|
||||
if (prevDarkMode != isDarkMode) {
|
||||
if (isDarkMode) {
|
||||
window.setBackgroundDrawableResource(android.R.drawable.screen_background_dark)
|
||||
} else {
|
||||
window.setBackgroundDrawableResource(android.R.drawable.screen_background_light)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun setPipParams() {
|
||||
setPictureInPictureParams(getPictureInPictureParams())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue