Tab selection from app shortcut.

This commit is contained in:
Amine 2018-11-07 20:45:51 +01:00
parent fb1614070e
commit 4efd76fcbc

View File

@ -145,6 +145,8 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
private var badgeAll: Int = -1 private var badgeAll: Int = -1
private var badgeFavs: Int = -1 private var badgeFavs: Int = -1
private var fromTabShortcut: Boolean = false
private lateinit var tagsBadge: Map<Long, Int> private lateinit var tagsBadge: Map<Long, Int>
private lateinit var db: AppDatabase private lateinit var db: AppDatabase
@ -161,6 +163,10 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
fromTabShortcut = intent.getIntExtra("shortcutTab", -1) != -1
elementsShown = intent.getIntExtra("shortcutTab", UNREAD_SHOWN)
setContentView(R.layout.activity_home) setContentView(R.layout.activity_home)
handleThemeBinding() handleThemeBinding()
@ -318,6 +324,10 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
bottomBar.setMode(BottomNavigationBar.MODE_SHIFTING) bottomBar.setMode(BottomNavigationBar.MODE_SHIFTING)
bottomBar.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_STATIC) bottomBar.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_STATIC)
if (fromTabShortcut) {
bottomBar.selectTab(elementsShown - 1)
}
} }
override fun onResume() { override fun onResume() {