Clear old nav drawer items

This commit is contained in:
Chumva 2019-07-30 15:21:56 +03:00
parent 71281f85b4
commit 5ee361cd6d

View file

@ -45,7 +45,8 @@ class TelegramApplication : Application(), OsmandHelperListener {
osmandAidlHelper.listener = object : OsmandHelperListener { osmandAidlHelper.listener = object : OsmandHelperListener {
override fun onOsmandConnectionStateChanged(connected: Boolean) { override fun onOsmandConnectionStateChanged(connected: Boolean) {
if (connected) { if (connected) {
val otherPackage = if (applicationContext.packageName != "net.osmand.telegram") "net.osmand.telegram" else "net.osmand.telegram.debug" osmandAidlHelper.clearNavDrawerItems("net.osmand.telegram")
osmandAidlHelper.clearNavDrawerItems("net.osmand.telegram.debug")
osmandAidlHelper.setNavDrawerItems( osmandAidlHelper.setNavDrawerItems(
applicationContext.packageName, applicationContext.packageName,
listOf(getString(R.string.app_name_short)), listOf(getString(R.string.app_name_short)),
@ -53,7 +54,6 @@ class TelegramApplication : Application(), OsmandHelperListener {
listOf("ic_action_location_sharing_app"), listOf("ic_action_location_sharing_app"),
listOf(-1) listOf(-1)
) )
osmandAidlHelper.clearNavDrawerItems(otherPackage)
showLocationHelper.addDirectionContextMenuButton() showLocationHelper.addDirectionContextMenuButton()
showLocationHelper.startShowingLocation() showLocationHelper.startShowingLocation()
} }