Fixed back navigation when cliked on chat message notification
This commit is contained in:
parent
137177d619
commit
23211f49ea
7 changed files with 21 additions and 19 deletions
|
@ -16,13 +16,14 @@ Group changes to describe their impact on the project, as follows:
|
||||||
- Reply to chat message feature (with original message preview)
|
- Reply to chat message feature (with original message preview)
|
||||||
- Voice recordings in chat feature
|
- Voice recordings in chat feature
|
||||||
- Allow video recording in chat file sharing
|
- Allow video recording in chat file sharing
|
||||||
|
- Unread messages indicator in chat conversation that separates read & unread messages
|
||||||
- Notify incoming/outgoing calls on bluetooth devices using self-managed connections from telecom manager API
|
- Notify incoming/outgoing calls on bluetooth devices using self-managed connections from telecom manager API
|
||||||
- New video call UI on foldable device like Galaxy Z Fold
|
- New video call UI on foldable device like Galaxy Z Fold
|
||||||
- Setting to automatically record all calls
|
- Setting to automatically record all calls
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- UI has been reworked around SlidingPane component to better handle tablets & foldable devices
|
- UI has been reworked around SlidingPane component to better handle tablets & foldable devices
|
||||||
- No longer scroll to bottom of chat room when new messages are received, a new button shows up to do it
|
- No longer scroll to bottom of chat room when new messages are received, a new button shows up to do it and it displays conversation's unread messages count
|
||||||
- Animations have been replaced to use com.google.android.material.transition ones
|
- Animations have been replaced to use com.google.android.material.transition ones
|
||||||
- Using new [Unified Content API](https://developer.android.com/about/versions/12/features/unified-content-api) to share files from keyboard (or other sources)
|
- Using new [Unified Content API](https://developer.android.com/about/versions/12/features/unified-content-api) to share files from keyboard (or other sources)
|
||||||
- Bumped dependencies, gradle updated from 4.2.2 to 7.0.2
|
- Bumped dependencies, gradle updated from 4.2.2 to 7.0.2
|
||||||
|
@ -31,7 +32,8 @@ Group changes to describe their impact on the project, as follows:
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Chat notifications disappearing when app restarts
|
- Chat notifications disappearing when app restarts
|
||||||
- "Infinite backstack", now each view is stored once (at most) in the backstack
|
- "Infinite backstack", now each view is stored (at most) once in the backstack
|
||||||
|
- Going back to the dialer when pressing back in a chat room after clicking on a chat message notification
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- Global push notification setting in Network, use the switch in each Account instead
|
- Global push notification setting in Network, use the switch in each Account instead
|
||||||
|
|
|
@ -24,7 +24,6 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.activity.OnBackPressedCallback
|
import androidx.activity.OnBackPressedCallback
|
||||||
import androidx.activity.addCallback
|
|
||||||
import androidx.core.view.doOnPreDraw
|
import androidx.core.view.doOnPreDraw
|
||||||
import androidx.databinding.DataBindingUtil
|
import androidx.databinding.DataBindingUtil
|
||||||
import androidx.databinding.ViewDataBinding
|
import androidx.databinding.ViewDataBinding
|
||||||
|
@ -56,10 +55,14 @@ abstract class GenericFragment<T : ViewDataBinding> : Fragment() {
|
||||||
return _binding!!.root
|
return _binding!!.root
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onResume() {
|
||||||
super.onCreate(savedInstanceState)
|
super.onResume()
|
||||||
|
requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner, onBackPressedCallback)
|
||||||
|
}
|
||||||
|
|
||||||
requireActivity().onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
override fun onPause() {
|
||||||
|
onBackPressedCallback.remove()
|
||||||
|
super.onPause()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
|
@ -90,7 +93,7 @@ abstract class GenericFragment<T : ViewDataBinding> : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ise: IllegalStateException) {
|
} catch (ise: IllegalStateException) {
|
||||||
Log.e("[Generic Fragment] Can't go back: $ise")
|
Log.e("[Generic Fragment] [$this] Can't go back: $ise")
|
||||||
onBackPressedCallback.isEnabled = false
|
onBackPressedCallback.isEnabled = false
|
||||||
requireActivity().onBackPressed()
|
requireActivity().onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,6 +182,7 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
||||||
|
|
||||||
override fun onPostCreate(savedInstanceState: Bundle?) {
|
override fun onPostCreate(savedInstanceState: Bundle?) {
|
||||||
super.onPostCreate(savedInstanceState)
|
super.onPostCreate(savedInstanceState)
|
||||||
|
|
||||||
registerComponentCallbacks(componentCallbacks)
|
registerComponentCallbacks(componentCallbacks)
|
||||||
findNavController(R.id.nav_host_fragment).addOnDestinationChangedListener(this)
|
findNavController(R.id.nav_host_fragment).addOnDestinationChangedListener(this)
|
||||||
|
|
||||||
|
@ -225,18 +226,6 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
||||||
tabsFragment.visibility = if (tabsFragmentVisible1 && tabsFragmentVisible2) View.VISIBLE else View.GONE
|
tabsFragment.visibility = if (tabsFragmentVisible1 && tabsFragmentVisible2) View.VISIBLE else View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showTabsFragment() {
|
|
||||||
tabsFragment.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
|
|
||||||
fun hideTabsFragment() {
|
|
||||||
tabsFragment.visibility = View.GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
fun hideStatusFragment() {
|
|
||||||
statusFragment.visibility = View.GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun View.hideKeyboard() {
|
private fun View.hideKeyboard() {
|
||||||
val imm = context.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
|
val imm = context.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
imm.hideSoftInputFromWindow(windowToken, 0)
|
imm.hideSoftInputFromWindow(windowToken, 0)
|
||||||
|
|
|
@ -57,5 +57,7 @@ class ListTopBarFragment : GenericFragment<ListEditTopBarFragmentBinding>() {
|
||||||
binding.setDeleteClickListener {
|
binding.setDeleteClickListener {
|
||||||
viewModel.deleteSelectionEvent.value = Event(true)
|
viewModel.deleteSelectionEvent.value = Event(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onBackPressedCallback.isEnabled = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,5 +68,7 @@ class StatusFragment : GenericFragment<StatusFragmentBinding>() {
|
||||||
binding.setRefreshClickListener {
|
binding.setRefreshClickListener {
|
||||||
viewModel.refreshRegister()
|
viewModel.refreshRegister()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onBackPressedCallback.isEnabled = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,8 @@ class TabsFragment : GenericFragment<TabsFragmentBinding>(), NavController.OnDes
|
||||||
}
|
}
|
||||||
navigateToChatRooms()
|
navigateToChatRooms()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onBackPressedCallback.isEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
|
|
|
@ -113,6 +113,8 @@ class SideMenuFragment : GenericFragment<SideMenuFragmentBinding>() {
|
||||||
requireActivity().finishAndRemoveTask()
|
requireActivity().finishAndRemoveTask()
|
||||||
coreContext.stop()
|
coreContext.stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onBackPressedCallback.isEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
|
|
Loading…
Reference in a new issue