mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Android 15 will force edge-to-edge, starting supporting it now
This commit is contained in:
parent
e039a562fe
commit
a95c6fb287
28 changed files with 155 additions and 137 deletions
|
|
@ -106,26 +106,31 @@
|
|||
|
||||
<activity
|
||||
android:name=".ui.file_viewer.MediaViewerActivity"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
android:launchMode="singleTask"
|
||||
android:resizeableActivity="true" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.file_viewer.FileViewerActivity"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
android:launchMode="singleTask"
|
||||
android:resizeableActivity="true" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.welcome.WelcomeActivity"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
android:launchMode="singleTask"
|
||||
android:resizeableActivity="true" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.assistant.AssistantActivity"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
android:launchMode="singleTask"
|
||||
android:resizeableActivity="true" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.call.CallActivity"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
android:theme="@style/Theme.LinphoneInCall"
|
||||
android:launchMode="singleTask"
|
||||
android:turnScreenOn="true"
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import android.view.WindowManager
|
|||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.MainThread
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.core.view.children
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
|
@ -67,8 +66,6 @@ open class GenericActivity : AppCompatActivity() {
|
|||
|
||||
@SuppressLint("SourceLockedOrientationActivity")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
WindowCompat.setDecorFitsSystemWindows(window, true)
|
||||
|
||||
enableWindowSecureMode(corePreferences.enableSecureMode)
|
||||
|
||||
val nightMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
|
||||
|
|
|
|||
|
|
@ -23,11 +23,16 @@ import android.content.pm.PackageManager
|
|||
import android.os.Bundle
|
||||
import android.view.ViewGroup
|
||||
import androidx.activity.addCallback
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.doOnPreDraw
|
||||
import androidx.core.view.updatePadding
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.navigation.findNavController
|
||||
import kotlin.math.max
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.R
|
||||
import org.linphone.compatibility.Compatibility
|
||||
|
|
@ -47,13 +52,25 @@ class AssistantActivity : GenericActivity() {
|
|||
private lateinit var binding: AssistantActivityBinding
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
enableEdgeToEdge()
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
binding = DataBindingUtil.setContentView(this, R.layout.assistant_activity)
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
setUpToastsArea(binding.toastsArea)
|
||||
|
||||
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { v, windowInsets ->
|
||||
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
val keyboard = windowInsets.getInsets(WindowInsetsCompat.Type.ime())
|
||||
v.updatePadding(
|
||||
insets.left,
|
||||
insets.top,
|
||||
insets.right,
|
||||
max(insets.bottom, keyboard.bottom)
|
||||
)
|
||||
WindowInsetsCompat.CONSUMED
|
||||
}
|
||||
|
||||
coreContext.postOnCoreThread { core ->
|
||||
if (core.accountList.isEmpty()) {
|
||||
Log.i("$TAG No account configured, disabling back gesture")
|
||||
|
|
|
|||
|
|
@ -24,13 +24,17 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.res.Resources
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.os.PowerManager
|
||||
import androidx.activity.SystemBarStyle
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.WindowInsetsControllerCompat
|
||||
import androidx.core.view.updatePadding
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
|
|
@ -39,6 +43,7 @@ import androidx.window.layout.FoldingFeature
|
|||
import androidx.window.layout.WindowInfoTracker
|
||||
import androidx.window.layout.WindowLayoutInfo
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import kotlin.math.max
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
|
|
@ -116,8 +121,30 @@ class CallActivity : GenericActivity() {
|
|||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
enableEdgeToEdge(
|
||||
statusBarStyle = SystemBarStyle.auto(Color.TRANSPARENT, Color.TRANSPARENT) {
|
||||
true // Force dark mode
|
||||
}
|
||||
)
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
binding = DataBindingUtil.setContentView(this, R.layout.call_activity)
|
||||
binding.lifecycleOwner = this
|
||||
setUpToastsArea(binding.toastsArea)
|
||||
|
||||
ViewCompat.setOnApplyWindowInsetsListener(binding.otherCallsTopBar.root) { v, windowInsets ->
|
||||
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
v.updatePadding(0, insets.top, 0, 0)
|
||||
WindowInsetsCompat.CONSUMED
|
||||
}
|
||||
|
||||
ViewCompat.setOnApplyWindowInsetsListener(binding.callNavContainer) { v, windowInsets ->
|
||||
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
val keyboard = windowInsets.getInsets(WindowInsetsCompat.Type.ime())
|
||||
v.updatePadding(insets.left, 0, insets.right, max(insets.bottom, keyboard.bottom))
|
||||
WindowInsetsCompat.CONSUMED
|
||||
}
|
||||
|
||||
val powerManager = getSystemService(Context.POWER_SERVICE) as PowerManager
|
||||
if (!powerManager.isWakeLockLevelSupported(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK)) {
|
||||
Log.w("$TAG PROXIMITY_SCREEN_OFF_WAKE_LOCK isn't supported on this device!")
|
||||
|
|
@ -128,11 +155,6 @@ class CallActivity : GenericActivity() {
|
|||
"$packageName;proximity_sensor"
|
||||
)
|
||||
|
||||
binding = DataBindingUtil.setContentView(this, R.layout.call_activity)
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
setUpToastsArea(binding.toastsArea)
|
||||
|
||||
lifecycleScope.launch(Dispatchers.Main) {
|
||||
WindowInfoTracker
|
||||
.getOrCreate(this@CallActivity)
|
||||
|
|
@ -269,17 +291,6 @@ class CallActivity : GenericActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
callsViewModel.changeSystemTopBarColorToMultipleCallsEvent.observe(this) {
|
||||
it.consume { useInCallColor ->
|
||||
val color = if (useInCallColor) {
|
||||
getColor(R.color.success_500)
|
||||
} else {
|
||||
getColor(R.color.main1_500)
|
||||
}
|
||||
window.statusBarColor = color
|
||||
}
|
||||
}
|
||||
|
||||
sharedViewModel.toggleFullScreenEvent.observe(this) {
|
||||
it.consume { hide ->
|
||||
hideUI(hide)
|
||||
|
|
@ -442,7 +453,6 @@ class CallActivity : GenericActivity() {
|
|||
Log.i("$TAG Switching full screen mode to ${if (hide) "ON" else "OFF"}")
|
||||
val windowInsetsCompat = WindowInsetsControllerCompat(window, window.decorView)
|
||||
if (hide) {
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
windowInsetsCompat.let {
|
||||
it.hide(WindowInsetsCompat.Type.systemBars())
|
||||
it.systemBarsBehavior =
|
||||
|
|
@ -450,7 +460,6 @@ class CallActivity : GenericActivity() {
|
|||
}
|
||||
} else {
|
||||
windowInsetsCompat.show(WindowInsetsCompat.Type.systemBars())
|
||||
WindowCompat.setDecorFitsSystemWindows(window, true)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import androidx.annotation.UiThread
|
|||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import org.linphone.R
|
||||
import org.linphone.databinding.CallAudioDevicesBottomSheetBinding
|
||||
import org.linphone.ui.call.model.AudioDeviceModel
|
||||
|
||||
|
|
@ -57,9 +56,6 @@ class AudioDevicesMenuDialogFragment(
|
|||
// Makes sure all menu entries are visible,
|
||||
// required for landscape mode (otherwise only first item is visible)
|
||||
dialog.behavior.state = BottomSheetBehavior.STATE_EXPANDED
|
||||
|
||||
// Force this navigation bar color
|
||||
dialog.window?.navigationBarColor = requireContext().getColor(R.color.gray_600)
|
||||
return dialog
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,10 +63,6 @@ class CallsViewModel @UiThread constructor() : GenericViewModel() {
|
|||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
val changeSystemTopBarColorToMultipleCallsEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
private val coreListener = object : CoreListenerStub() {
|
||||
@WorkerThread
|
||||
override fun onCallStateChanged(
|
||||
|
|
@ -270,9 +266,6 @@ class CallsViewModel @UiThread constructor() : GenericViewModel() {
|
|||
)
|
||||
callsTopBarStatus.postValue("") // TODO: improve ?
|
||||
}
|
||||
|
||||
Log.i("$TAG At least one other call, asking activity to change status bar color")
|
||||
changeSystemTopBarColorToMultipleCallsEvent.postValue(Event(true))
|
||||
} else {
|
||||
if (core.callsNb == 1) {
|
||||
callsTopBarIcon.postValue(R.drawable.phone)
|
||||
|
|
@ -291,11 +284,6 @@ class CallsViewModel @UiThread constructor() : GenericViewModel() {
|
|||
}
|
||||
callsTopBarStatus.postValue(LinphoneUtils.callStateToString(call.state))
|
||||
}
|
||||
|
||||
Log.i(
|
||||
"$TAG No more than one call, asking activity to change status bar color back to primary"
|
||||
)
|
||||
changeSystemTopBarColorToMultipleCallsEvent.postValue(Event(false))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import android.content.Intent
|
|||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.util.DisplayMetrics
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.databinding.DataBindingUtil
|
||||
|
|
@ -42,8 +43,8 @@ class FileViewerActivity : GenericActivity() {
|
|||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
enableEdgeToEdge()
|
||||
super.onCreate(savedInstanceState)
|
||||
window.navigationBarColor = getColor(R.color.gray_900)
|
||||
|
||||
binding = DataBindingUtil.setContentView(this, R.layout.file_viewer_activity)
|
||||
binding.lifecycleOwner = this
|
||||
|
|
|
|||
|
|
@ -3,8 +3,12 @@ package org.linphone.ui.file_viewer
|
|||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.updatePadding
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
|
|
@ -49,13 +53,19 @@ class MediaViewerActivity : GenericActivity() {
|
|||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
enableEdgeToEdge()
|
||||
super.onCreate(savedInstanceState)
|
||||
window.navigationBarColor = getColor(R.color.gray_900)
|
||||
|
||||
binding = DataBindingUtil.setContentView(this, R.layout.file_media_viewer_activity)
|
||||
binding.lifecycleOwner = this
|
||||
setUpToastsArea(binding.toastsArea)
|
||||
|
||||
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { v, windowInsets ->
|
||||
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
v.updatePadding(insets.left, insets.top, insets.right, insets.bottom)
|
||||
WindowInsetsCompat.CONSUMED
|
||||
}
|
||||
|
||||
viewModel = ViewModelProvider(this)[MediaListViewModel::class.java]
|
||||
binding.viewModel = viewModel
|
||||
|
||||
|
|
|
|||
|
|
@ -25,15 +25,22 @@ import android.app.Dialog
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.graphics.Color
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
import android.view.Gravity
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewTreeObserver
|
||||
import androidx.activity.SystemBarStyle
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.car.app.connection.CarConnection
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.updatePadding
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
|
|
@ -41,6 +48,7 @@ import androidx.navigation.NavController
|
|||
import androidx.navigation.NavDestination
|
||||
import androidx.navigation.NavOptions
|
||||
import androidx.navigation.findNavController
|
||||
import kotlin.math.max
|
||||
import kotlinx.coroutines.Deferred
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.awaitAll
|
||||
|
|
@ -103,13 +111,42 @@ class MainActivity : GenericActivity() {
|
|||
// Must be done before the setContentView
|
||||
installSplashScreen()
|
||||
|
||||
enableEdgeToEdge(
|
||||
statusBarStyle = SystemBarStyle.auto(Color.TRANSPARENT, Color.TRANSPARENT) {
|
||||
true // Force dark mode to always have white icons in status bar
|
||||
}
|
||||
)
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
binding = DataBindingUtil.setContentView(this, R.layout.main_activity)
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
setUpToastsArea(binding.toastsArea)
|
||||
|
||||
ViewCompat.setOnApplyWindowInsetsListener(binding.inCallTopBar.root) { v, windowInsets ->
|
||||
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
v.updatePadding(0, insets.top, 0, 0)
|
||||
WindowInsetsCompat.CONSUMED
|
||||
}
|
||||
|
||||
ViewCompat.setOnApplyWindowInsetsListener(binding.mainNavContainer) { v, windowInsets ->
|
||||
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
val keyboard = windowInsets.getInsets(WindowInsetsCompat.Type.ime())
|
||||
v.updatePadding(insets.left, 0, insets.right, max(insets.bottom, keyboard.bottom))
|
||||
WindowInsetsCompat.CONSUMED
|
||||
}
|
||||
|
||||
ViewCompat.setOnApplyWindowInsetsListener(binding.drawerMenuContent) { v, windowInsets ->
|
||||
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
val mlp = v.layoutParams as ViewGroup.MarginLayoutParams
|
||||
mlp.leftMargin = insets.left
|
||||
mlp.topMargin = insets.top
|
||||
mlp.rightMargin = insets.right
|
||||
mlp.bottomMargin = insets.bottom
|
||||
v.layoutParams = mlp
|
||||
WindowInsetsCompat.CONSUMED
|
||||
}
|
||||
|
||||
while (!coreContext.isReady()) {
|
||||
Thread.sleep(50)
|
||||
}
|
||||
|
|
@ -123,23 +160,6 @@ class MainActivity : GenericActivity() {
|
|||
ViewModelProvider(this)[SharedMainViewModel::class.java]
|
||||
}
|
||||
|
||||
viewModel.changeSystemTopBarColorEvent.observe(this) {
|
||||
it.consume { mode ->
|
||||
window.statusBarColor = when (mode) {
|
||||
MainViewModel.SINGLE_CALL, MainViewModel.MULTIPLE_CALLS -> {
|
||||
getColor(R.color.success_500)
|
||||
}
|
||||
MainViewModel.NETWORK_NOT_REACHABLE, MainViewModel.NON_DEFAULT_ACCOUNT_NOT_CONNECTED -> {
|
||||
getColor(R.color.danger_500)
|
||||
}
|
||||
MainViewModel.NON_DEFAULT_ACCOUNT_NOTIFICATIONS -> {
|
||||
getColor(R.color.main2_500)
|
||||
}
|
||||
else -> getColor(R.color.main1_500)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.goBackToCallEvent.observe(this) {
|
||||
it.consume {
|
||||
coreContext.showCallActivity()
|
||||
|
|
@ -333,7 +353,7 @@ class MainActivity : GenericActivity() {
|
|||
}
|
||||
|
||||
fun findNavController(): NavController {
|
||||
return findNavController(R.id.main_nav_host_fragment)
|
||||
return findNavController(R.id.main_nav_container)
|
||||
}
|
||||
|
||||
fun loadContacts() {
|
||||
|
|
|
|||
|
|
@ -299,8 +299,8 @@ class ConversationsListFragment : AbstractMainFragment() {
|
|||
setViewModel(listViewModel)
|
||||
initViews(
|
||||
binding.slidingPaneLayout,
|
||||
binding.topBar.search,
|
||||
binding.bottomNavBar.root,
|
||||
binding.topBar,
|
||||
binding.bottomNavBar,
|
||||
R.id.conversationsListFragment
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import androidx.annotation.UiThread
|
|||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import org.linphone.R
|
||||
import org.linphone.databinding.ChatConversationE2eDetailsBottomSheetBinding
|
||||
|
||||
@UiThread
|
||||
|
|
@ -55,9 +54,6 @@ class EndToEndEncryptionDetailsDialogFragment(
|
|||
// Makes sure all menu entries are visible,
|
||||
// required for landscape mode (otherwise only first item is visible)
|
||||
dialog.behavior.state = BottomSheetBehavior.STATE_EXPANDED
|
||||
|
||||
// Force this navigation bar color
|
||||
dialog.window?.navigationBarColor = requireContext().getColor(R.color.gray_600)
|
||||
return dialog
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import androidx.annotation.UiThread
|
|||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import org.linphone.R
|
||||
import org.linphone.databinding.ChatConversationUnsafeDetailsBottomSheetBinding
|
||||
|
||||
@UiThread
|
||||
|
|
@ -55,9 +54,6 @@ class UnsafeConversationDetailsDialogFragment(
|
|||
// Makes sure all menu entries are visible,
|
||||
// required for landscape mode (otherwise only first item is visible)
|
||||
dialog.behavior.state = BottomSheetBehavior.STATE_EXPANDED
|
||||
|
||||
// Force this navigation bar color
|
||||
dialog.window?.navigationBarColor = requireContext().getColor(R.color.gray_600)
|
||||
return dialog
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -206,8 +206,8 @@ class ContactsListFragment : AbstractMainFragment() {
|
|||
setViewModel(listViewModel)
|
||||
initViews(
|
||||
binding.slidingPaneLayout,
|
||||
binding.topBar.search,
|
||||
binding.bottomNavBar.root,
|
||||
binding.topBar,
|
||||
binding.bottomNavBar,
|
||||
R.id.contactsListFragment
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ import androidx.slidingpanelayout.widget.SlidingPaneLayout
|
|||
import com.google.android.material.textfield.TextInputLayout
|
||||
import org.linphone.R
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.databinding.BottomNavBarBinding
|
||||
import org.linphone.databinding.TopBarBinding
|
||||
import org.linphone.ui.main.MainActivity
|
||||
import org.linphone.ui.main.chat.fragment.ConversationsListFragmentDirections
|
||||
import org.linphone.ui.main.contacts.fragment.ContactsListFragmentDirections
|
||||
|
|
@ -142,13 +144,13 @@ abstract class AbstractMainFragment : GenericMainFragment() {
|
|||
|
||||
fun initViews(
|
||||
slidingPane: SlidingPaneLayout,
|
||||
searchBar: TextInputLayout,
|
||||
navBar: View,
|
||||
topBar: TopBarBinding,
|
||||
navBar: BottomNavBarBinding,
|
||||
@IdRes fragmentId: Int
|
||||
) {
|
||||
initSlidingPane(slidingPane)
|
||||
initSearchBar(searchBar)
|
||||
initBottomNavBar(navBar)
|
||||
initSearchBar(topBar.search)
|
||||
initBottomNavBar(navBar.root)
|
||||
initNavigation(fragmentId)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import android.view.Gravity
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewGroup.LayoutParams
|
||||
import android.widget.PopupWindow
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.databinding.DataBindingUtil
|
||||
|
|
|
|||
|
|
@ -243,8 +243,8 @@ class HistoryListFragment : AbstractMainFragment() {
|
|||
setViewModel(listViewModel)
|
||||
initViews(
|
||||
binding.slidingPaneLayout,
|
||||
binding.topBar.search,
|
||||
binding.bottomNavBar.root,
|
||||
binding.topBar,
|
||||
binding.bottomNavBar,
|
||||
R.id.historyListFragment
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,8 +69,6 @@ class MeetingWaitingRoomFragment : GenericMainFragment() {
|
|||
|
||||
private var bottomSheetDialog: BottomSheetDialogFragment? = null
|
||||
|
||||
private var navBarDefaultColor: Int = -1
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
|
|
@ -88,8 +86,6 @@ class MeetingWaitingRoomFragment : GenericMainFragment() {
|
|||
postponeEnterTransition()
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
navBarDefaultColor = requireActivity().window.navigationBarColor
|
||||
|
||||
binding.lifecycleOwner = viewLifecycleOwner
|
||||
|
||||
viewModel = ViewModelProvider(this)[MeetingWaitingRoomViewModel::class.java]
|
||||
|
|
@ -153,9 +149,6 @@ class MeetingWaitingRoomFragment : GenericMainFragment() {
|
|||
}
|
||||
|
||||
override fun onResume() {
|
||||
// Force this navigation bar color
|
||||
requireActivity().window.navigationBarColor = requireContext().getColor(R.color.gray_900)
|
||||
|
||||
super.onResume()
|
||||
|
||||
if (isCameraPermissionGranted()) {
|
||||
|
|
@ -180,13 +173,6 @@ class MeetingWaitingRoomFragment : GenericMainFragment() {
|
|||
super.onPause()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
// Reset default navigation bar color
|
||||
requireActivity().window.navigationBarColor = navBarDefaultColor
|
||||
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
private fun isCameraPermissionGranted(): Boolean {
|
||||
val granted = ContextCompat.checkSelfPermission(
|
||||
requireContext(),
|
||||
|
|
|
|||
|
|
@ -205,8 +205,8 @@ class MeetingsListFragment : AbstractMainFragment() {
|
|||
setViewModel(listViewModel)
|
||||
initViews(
|
||||
binding.slidingPaneLayout,
|
||||
binding.topBar.search,
|
||||
binding.bottomNavBar.root,
|
||||
binding.topBar,
|
||||
binding.bottomNavBar,
|
||||
R.id.meetingsListFragment
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,10 +76,6 @@ class MainViewModel @UiThread constructor() : ViewModel() {
|
|||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
val changeSystemTopBarColorEvent: MutableLiveData<Event<Int>> by lazy {
|
||||
MutableLiveData<Event<Int>>()
|
||||
}
|
||||
|
||||
val goBackToCallEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
|
@ -449,7 +445,6 @@ class MainViewModel @UiThread constructor() : ViewModel() {
|
|||
if (maxedPriorityAlert == null) {
|
||||
Log.i("$TAG No alert to display")
|
||||
showAlert.postValue(false)
|
||||
changeSystemTopBarColorEvent.postValue(Event(NONE))
|
||||
maxAlertLevel.postValue(NONE)
|
||||
} else {
|
||||
val type = maxedPriorityAlert.first
|
||||
|
|
@ -470,8 +465,7 @@ class MainViewModel @UiThread constructor() : ViewModel() {
|
|||
alertLabel.postValue(label)
|
||||
|
||||
if (showAlert.value == true) {
|
||||
Log.i("$TAG Alert top-bar is already visible, updating color if needed")
|
||||
changeSystemTopBarColorEvent.postValue(Event(type))
|
||||
Log.i("$TAG Alert top-bar is already visible")
|
||||
} else {
|
||||
Log.i("$TAG Alert top-bar is currently invisible, starting job to display it")
|
||||
coreContext.postOnMainThread {
|
||||
|
|
@ -481,7 +475,6 @@ class MainViewModel @UiThread constructor() : ViewModel() {
|
|||
delay(delayMs)
|
||||
withContext(Dispatchers.Main) {
|
||||
showAlert.value = true
|
||||
changeSystemTopBarColorEvent.value = Event(type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@ import android.content.Intent
|
|||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.activity.addCallback
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.updatePadding
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
|
|
@ -51,6 +55,7 @@ class WelcomeActivity : GenericActivity() {
|
|||
private val pageChangedCallback = PageChangedCallback()
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
enableEdgeToEdge()
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
// Disable back gesture / button
|
||||
|
|
@ -59,6 +64,12 @@ class WelcomeActivity : GenericActivity() {
|
|||
binding = DataBindingUtil.setContentView(this, R.layout.welcome_activity)
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { v, windowInsets ->
|
||||
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
v.updatePadding(insets.left, insets.top, insets.right, insets.bottom)
|
||||
WindowInsetsCompat.CONSUMED
|
||||
}
|
||||
|
||||
viewPager = binding.pager
|
||||
val pagerAdapter = ScreenSlidePagerAdapter(this)
|
||||
viewPager.adapter = pagerAdapter
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
layout="@layout/call_activity_other_calls_top_bar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="@{callsViewModel.callsCount > 1 || callsViewModel.showTopBar ? View.VISIBLE : View.GONE, default=gone}"
|
||||
android:visibility="@{callViewModel.fullScreenMode ? View.GONE : View.VISIBLE}"
|
||||
app:viewModel="@{callsViewModel}"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/color_success_500"
|
||||
android:minHeight="40dp"
|
||||
android:background="@{viewModel.callsCount > 1 || viewModel.showTopBar ? @color/success_500 : @color/black, default=@color/black}"
|
||||
android:onClick="@{() -> viewModel.topBarClicked()}">
|
||||
|
||||
<ImageView
|
||||
|
|
@ -24,6 +25,7 @@
|
|||
android:layout_marginEnd="10dp"
|
||||
android:src="@{viewModel.callsTopBarIcon, default=@drawable/phone_pause}"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="@{viewModel.callsCount > 1 || viewModel.showTopBar ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/call_display_name"
|
||||
app:layout_constraintBottom_toBottomOf="@id/call_display_name"
|
||||
|
|
@ -42,6 +44,7 @@
|
|||
android:text="@{viewModel.callsTopBarLabel, default=`John Doe`}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
android:visibility="@{viewModel.callsCount > 1 || viewModel.showTopBar ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintEnd_toStartOf="@id/call_time"
|
||||
app:layout_constraintStart_toEndOf="@id/call_icon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
|
|
@ -57,6 +60,7 @@
|
|||
android:text="@{viewModel.callsTopBarStatus, default=`Paused`}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
android:visibility="@{viewModel.callsCount > 1 || viewModel.showTopBar ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/call_display_name"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
|
|
|
|||
|
|
@ -27,14 +27,13 @@
|
|||
layout="@layout/main_activity_notification_top_bar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="@{viewModel.showAlert ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:viewModel="@{viewModel}"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/main_nav_host_fragment"
|
||||
android:id="@+id/main_nav_container"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
|
|
@ -54,7 +53,7 @@
|
|||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
app:layout_constraintWidth_max="@dimen/toast_max_width"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/in_call_top_bar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@{viewModel.maxAlertLevel >= 20 ? @color/success_500 : viewModel.maxAlertLevel >= 10 ? @color/danger_500 : @color/main2_500, default=@color/main2_500}"
|
||||
android:minHeight="40dp"
|
||||
android:background="@{viewModel.maxAlertLevel >= 20 ? @color/success_500 : viewModel.maxAlertLevel >= 10 ? @color/danger_500 : viewModel.maxAlertLevel > 0 ? @color/main2_500 : @color/main1_500, default=@color/main1_500}"
|
||||
android:onClick="@{() -> viewModel.onTopBarClicked()}">
|
||||
|
||||
<ImageView
|
||||
|
|
@ -25,6 +26,7 @@
|
|||
android:layout_marginBottom="5dp"
|
||||
android:src="@{viewModel.alertIcon, default=@drawable/bell_simple}"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="@{viewModel.showAlert ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
|
@ -45,6 +47,7 @@
|
|||
android:textSize="16sp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:visibility="@{viewModel.showAlert ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintEnd_toStartOf="@id/end_barrier"
|
||||
app:layout_constraintStart_toEndOf="@id/icon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
|
|
@ -67,7 +70,7 @@
|
|||
android:text="@{viewModel.callsStatus, default=`Paused`}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
android:visibility="@{viewModel.atLeastOneCall ? View.VISIBLE : View.GONE, default=gone}"
|
||||
android:visibility="@{viewModel.showAlert && viewModel.atLeastOneCall ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/label"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
|
|
@ -82,7 +85,7 @@
|
|||
android:src="@drawable/x"
|
||||
app:tint="@color/white"
|
||||
android:contentDescription="@string/content_description_dismiss_notification"
|
||||
android:visibility="@{viewModel.atLeastOneCall ? View.GONE : View.VISIBLE}"
|
||||
android:visibility="@{!viewModel.showAlert || viewModel.atLeastOneCall ? View.GONE : View.VISIBLE, default=gone}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="AppSplashScreenTheme" parent="Theme.SplashScreen">
|
||||
<item name="windowSplashScreenBackground">@color/black</item>
|
||||
<item name="windowSplashScreenAnimatedIcon">@drawable/linphone_splashscreen</item>
|
||||
|
|
|
|||
|
|
@ -7,14 +7,10 @@
|
|||
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Linphone" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor">?attr/color_main1_500</item>
|
||||
<!-- https://developer.android.com/guide/topics/display-cutout#best_practices_for_display_cutout_support -->
|
||||
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
||||
<item name="android:windowLayoutInDisplayCutoutMode">always</item>
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="android:windowActivityTransitions">true</item>
|
||||
<item name="android:windowBackground">@color/black</item>
|
||||
<item name="android:navigationBarColor">@color/black</item>
|
||||
|
||||
<item name="color_main1_100">@color/orange_main_900</item>
|
||||
<item name="color_main1_100_alpha_50">@color/orange_main_100_alpha_50</item>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<resources>
|
||||
<dimen name="zero">0dp</dimen>
|
||||
|
||||
<dimen name="screen_bottom_margin">32dp</dimen>
|
||||
<dimen name="screen_bottom_margin">10dp</dimen>
|
||||
|
||||
<dimen name="landscape_nav_bar_width">75dp</dimen>
|
||||
<dimen name="sliding_pane_left_fragment_width">350dp</dimen>
|
||||
|
|
|
|||
|
|
@ -7,14 +7,11 @@
|
|||
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Linphone" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor">?attr/color_main1_500</item>
|
||||
<!-- https://developer.android.com/guide/topics/display-cutout#best_practices_for_display_cutout_support -->
|
||||
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
||||
<item name="android:windowLayoutInDisplayCutoutMode">always</item>
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="android:windowActivityTransitions">true</item>
|
||||
<item name="android:windowBackground">@color/white</item>
|
||||
<item name="android:navigationBarColor">@color/white</item>
|
||||
|
||||
<item name="color_main1_100">@color/orange_main_100</item>
|
||||
<item name="color_main1_100_alpha_50">@color/orange_main_100_alpha_50</item>
|
||||
|
|
@ -107,46 +104,38 @@
|
|||
|
||||
<!-- In-call application theme. -->
|
||||
<style name="Theme.LinphoneInCall" parent="Theme.Linphone">
|
||||
<item name="android:navigationBarColor">@color/gray_600</item>
|
||||
<item name="android:windowBackground">@color/black</item>
|
||||
<item name="android:windowBackground">@color/gray_600</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.LinphoneInCallYellow" parent="Theme.LinphoneYellow">
|
||||
<item name="android:navigationBarColor">@color/gray_600</item>
|
||||
<item name="android:windowBackground">@color/black</item>
|
||||
<item name="android:windowBackground">@color/gray_600</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.LinphoneInCallGreen" parent="Theme.LinphoneGreen">
|
||||
<item name="android:navigationBarColor">@color/gray_600</item>
|
||||
<item name="android:windowBackground">@color/black</item>
|
||||
<item name="android:windowBackground">@color/gray_600</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.LinphoneInCallBlue" parent="Theme.LinphoneBlue">
|
||||
<item name="android:navigationBarColor">@color/gray_600</item>
|
||||
<item name="android:windowBackground">@color/black</item>
|
||||
<item name="android:windowBackground">@color/gray_600</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.LinphoneInCallRed" parent="Theme.LinphoneRed">
|
||||
<item name="android:navigationBarColor">@color/gray_600</item>
|
||||
<item name="android:windowBackground">@color/black</item>
|
||||
<item name="android:windowBackground">@color/gray_600</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.LinphoneInCallPink" parent="Theme.LinphonePink">
|
||||
<item name="android:navigationBarColor">@color/gray_600</item>
|
||||
<item name="android:windowBackground">@color/black</item>
|
||||
<item name="android:windowBackground">@color/gray_600</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.LinphoneInCallPurple" parent="Theme.LinphonePurple">
|
||||
<item name="android:navigationBarColor">@color/gray_600</item>
|
||||
<item name="android:windowBackground">@color/black</item>
|
||||
<item name="android:windowBackground">@color/gray_600</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.LinphoneDialog" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<item name="android:statusBarColor">@color/gray_600</item>
|
||||
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
||||
<item name="android:windowLayoutInDisplayCutoutMode">always</item>
|
||||
<item name="android:windowActivityTransitions">true</item>
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
<item name="android:windowBackground">@color/transparent_color</item>
|
||||
<item name="android:navigationBarColor">@color/transparent_color</item>
|
||||
</style>
|
||||
</resources>
|
||||
Loading…
Add table
Reference in a new issue