Fixed tabs fragment not hidden when going into settings or another non primary fragment
This commit is contained in:
parent
03e4415b5c
commit
52363c5466
2 changed files with 19 additions and 13 deletions
|
@ -106,6 +106,9 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
|||
sharedViewModel.layoutChangedEvent.value = Event(true)
|
||||
}
|
||||
|
||||
private var tabsFragmentVisible1 = true
|
||||
private var tabsFragmentVisible2 = true
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
|
@ -179,11 +182,8 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
|||
binding.rootCoordinatorLayout.viewTreeObserver.addOnGlobalLayoutListener {
|
||||
val keyboardVisible = ViewCompat.getRootWindowInsets(binding.rootCoordinatorLayout)?.isVisible(WindowInsetsCompat.Type.ime()) == true
|
||||
Log.d("[Tabs Fragment] Keyboard is ${if (keyboardVisible) "visible" else "invisible"}")
|
||||
if (keyboardVisible) {
|
||||
hideTabsFragment()
|
||||
} else {
|
||||
showTabsFragment()
|
||||
}
|
||||
tabsFragmentVisible2 = !keyboardVisible
|
||||
updateTabsFragmentVisibility()
|
||||
}
|
||||
|
||||
if (intent != null) handleIntentParams(intent)
|
||||
|
@ -205,11 +205,16 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
|||
statusFragment.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
when (destination.id) {
|
||||
tabsFragmentVisible1 = when (destination.id) {
|
||||
R.id.masterCallLogsFragment, R.id.masterContactsFragment, R.id.dialerFragment, R.id.masterChatRoomsFragment ->
|
||||
showTabsFragment()
|
||||
else -> hideTabsFragment()
|
||||
true
|
||||
else -> false
|
||||
}
|
||||
updateTabsFragmentVisibility()
|
||||
}
|
||||
|
||||
private fun updateTabsFragmentVisibility() {
|
||||
tabsFragment.visibility = if (tabsFragmentVisible1 && tabsFragmentVisible2) View.VISIBLE else View.GONE
|
||||
}
|
||||
|
||||
fun showTabsFragment() {
|
||||
|
|
|
@ -117,7 +117,7 @@ class ShortcutsHelper(val context: Context) {
|
|||
.setIntent(intent)
|
||||
.build().toShortcutInfo()
|
||||
} catch (e: Exception) {
|
||||
Log.e("[Shortcuts Helper] ShortcutInfo.Builder exception: $e")
|
||||
Log.e("[Shortcuts Helper] createContactShortcut for contact [${contact.fullName}] exception: $e")
|
||||
}
|
||||
|
||||
return null
|
||||
|
@ -151,11 +151,13 @@ class ShortcutsHelper(val context: Context) {
|
|||
}
|
||||
|
||||
private fun createChatRoomShortcut(context: Context, chatRoom: ChatRoom): ShortcutInfo? {
|
||||
val peerAddress = chatRoom.peerAddress.asStringUriOnly()
|
||||
val localAddress = chatRoom.localAddress.asStringUriOnly()
|
||||
val id = LinphoneUtils.getChatRoomId(localAddress, peerAddress)
|
||||
|
||||
try {
|
||||
val categories: ArraySet<String> = ArraySet()
|
||||
categories.add(ShortcutInfo.SHORTCUT_CATEGORY_CONVERSATION)
|
||||
val peerAddress = chatRoom.peerAddress.asStringUriOnly()
|
||||
val localAddress = chatRoom.localAddress.asStringUriOnly()
|
||||
|
||||
val personsList = arrayListOf<Person>()
|
||||
val subject: String
|
||||
|
@ -202,7 +204,6 @@ class ShortcutsHelper(val context: Context) {
|
|||
intent.putExtra("RemoteSipUri", peerAddress)
|
||||
intent.putExtra("LocalSipUri", localAddress)
|
||||
|
||||
val id = LinphoneUtils.getChatRoomId(localAddress, peerAddress)
|
||||
return ShortcutInfoCompat.Builder(context, id)
|
||||
.setShortLabel(subject)
|
||||
.setIcon(icon)
|
||||
|
@ -213,7 +214,7 @@ class ShortcutsHelper(val context: Context) {
|
|||
.setLocusId(LocusIdCompat(id))
|
||||
.build().toShortcutInfo()
|
||||
} catch (e: Exception) {
|
||||
Log.e("[Shortcuts Helper] ShortcutInfo.Builder exception: $e")
|
||||
Log.e("[Shortcuts Helper] createChatRoomShortcut for id [$id] exception: $e")
|
||||
}
|
||||
|
||||
return null
|
||||
|
|
Loading…
Reference in a new issue