From aa1b3cbb014af53b5edfa817a52f542fc7dc2e30 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 13 Jan 2020 15:32:16 +0200 Subject: [PATCH] Add map layer after aidl connection established --- .../osmand/telegram/TelegramApplication.kt | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/OsmAnd-telegram/src/net/osmand/telegram/TelegramApplication.kt b/OsmAnd-telegram/src/net/osmand/telegram/TelegramApplication.kt index 4dc883bed3..4c40d9a365 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/TelegramApplication.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/TelegramApplication.kt @@ -42,24 +42,7 @@ class TelegramApplication : Application(), OsmandHelperListener { telegramHelper.messageActiveTimeSec = settings.locHistoryTime uiUtils = UiUtils(this) osmandAidlHelper = OsmandAidlHelper(this) - osmandAidlHelper.listener = object : OsmandHelperListener { - 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.listener = this osmandAidlHelper.setUpdatesListener(object : UpdatesListener { override fun update() { if (settings.hasAnyChatToShowOnMap()) { @@ -143,8 +126,19 @@ class TelegramApplication : Application(), OsmandHelperListener { 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.setupMapLayer() showLocationHelper.addDirectionContextMenuButton() + showLocationHelper.startShowingLocation() + showLocationHelper.addOrUpdateStatusWidget(-1, false) } }