Add map layer after aidl connection established

This commit is contained in:
Vitaliy 2020-01-13 15:32:16 +02:00
parent dd2c696ecd
commit aa1b3cbb01

View file

@ -42,24 +42,7 @@ class TelegramApplication : Application(), OsmandHelperListener {
telegramHelper.messageActiveTimeSec = settings.locHistoryTime telegramHelper.messageActiveTimeSec = settings.locHistoryTime
uiUtils = UiUtils(this) uiUtils = UiUtils(this)
osmandAidlHelper = OsmandAidlHelper(this) osmandAidlHelper = OsmandAidlHelper(this)
osmandAidlHelper.listener = object : OsmandHelperListener { osmandAidlHelper.listener = this
override fun onOsmandConnectionStateChanged(connected: Boolean) {
if (connected) {
osmandAidlHelper.clearNavDrawerItems("net.osmand.telegram")
osmandAidlHelper.clearNavDrawerItems("net.osmand.telegram.debug")
osmandAidlHelper.setNavDrawerItems(
applicationContext.packageName,
listOf(getString(R.string.app_name_short)),
listOf("osmand_telegram://main_activity"),
listOf("ic_action_location_sharing_app"),
listOf(-1)
)
showLocationHelper.addDirectionContextMenuButton()
showLocationHelper.startShowingLocation()
showLocationHelper.addOrUpdateStatusWidget(-1, false)
}
}
}
osmandAidlHelper.setUpdatesListener(object : UpdatesListener { osmandAidlHelper.setUpdatesListener(object : UpdatesListener {
override fun update() { override fun update() {
if (settings.hasAnyChatToShowOnMap()) { if (settings.hasAnyChatToShowOnMap()) {
@ -143,8 +126,19 @@ class TelegramApplication : Application(), OsmandHelperListener {
override fun onOsmandConnectionStateChanged(connected: Boolean) { override fun onOsmandConnectionStateChanged(connected: Boolean) {
if (connected) { if (connected) {
osmandAidlHelper.clearNavDrawerItems("net.osmand.telegram")
osmandAidlHelper.clearNavDrawerItems("net.osmand.telegram.debug")
osmandAidlHelper.setNavDrawerItems(
applicationContext.packageName,
listOf(getString(R.string.app_name_short)),
listOf("osmand_telegram://main_activity"),
listOf("ic_action_location_sharing_app"),
listOf(-1)
)
showLocationHelper.setupMapLayer() showLocationHelper.setupMapLayer()
showLocationHelper.addDirectionContextMenuButton() showLocationHelper.addDirectionContextMenuButton()
showLocationHelper.startShowingLocation()
showLocationHelper.addOrUpdateStatusWidget(-1, false)
} }
} }