Skip to content

Commit

Permalink
initial codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Avinash-Codes committed Dec 17, 2024
1 parent f3c7b30 commit f82a546
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,14 @@ class DashboardActivity : DashboardElementActivity(), OnHomeItemClickListener, N
when (item.itemId) {
R.id.action_chat -> {
if (user?.id?.startsWith("guest") == false) {
openCallFragment(ChatHistoryListFragment())
val fragmentManager = supportFragmentManager
val existingFragment = fragmentManager.findFragmentByTag(ChatHistoryListFragment::class.java.simpleName)
if (existingFragment == null) {
openCallFragment(
ChatHistoryListFragment(),
ChatHistoryListFragment::class.java.simpleName
)
}
} else {
guestDialog(this)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,10 @@ abstract class DashboardElementActivity : SyncActivity(), FragmentManager.OnBack
}

fun openCallFragment(newFragment: Fragment, tag: String?) {
if (!isDestroyed && !isFinishing) {
supportFragmentManager.beginTransaction()
.replace(R.id.fragment_container, newFragment, tag)
.addToBackStack(null)
.commitAllowingStateLoss()
}
supportFragmentManager.beginTransaction()
.replace(R.id.fragment_container, newFragment, tag)
.addToBackStack(tag)
.commit()
}

override fun onPrepareOptionsMenu(menu: Menu): Boolean {
Expand Down

0 comments on commit f82a546

Please sign in to comment.