diff --git a/OsmAnd-telegram/src/net/osmand/telegram/TelegramApplication.kt b/OsmAnd-telegram/src/net/osmand/telegram/TelegramApplication.kt index 53c34fbd07..c37a837a2a 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/TelegramApplication.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/TelegramApplication.kt @@ -24,7 +24,7 @@ class TelegramApplication : Application(), OsmandHelperListener { lateinit var shareLocationHelper: ShareLocationHelper private set lateinit var showLocationHelper: ShowLocationHelper private set lateinit var notificationHelper: NotificationHelper private set - lateinit var osmandHelper: OsmandAidlHelper private set + lateinit var osmandAidlHelper: OsmandAidlHelper private set lateinit var locationProvider: TelegramLocationProvider private set var telegramService: TelegramService? = null @@ -40,7 +40,7 @@ class TelegramApplication : Application(), OsmandHelperListener { settings = TelegramSettings(this) uiUtils = UiUtils(this) - osmandHelper = OsmandAidlHelper(this) + osmandAidlHelper = OsmandAidlHelper(this) shareLocationHelper = ShareLocationHelper(this) showLocationHelper = ShowLocationHelper(this) notificationHelper = NotificationHelper(this) @@ -55,7 +55,7 @@ class TelegramApplication : Application(), OsmandHelperListener { } fun cleanupResources() { - osmandHelper.cleanupResources() + osmandAidlHelper.cleanupResources() telegramHelper.close() } diff --git a/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt b/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt index 01ea26e7bf..4607696c2a 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt @@ -17,14 +17,14 @@ private const val MAP_LAYER_ID = "telegram_layer" class ShowLocationHelper(private val app: TelegramApplication) { private val telegramHelper = app.telegramHelper - private val osmandHelper = app.osmandHelper + private val osmandAidlHelper = app.osmandAidlHelper var showingLocation: Boolean = false private set fun setupMapLayer() { execOsmandApi { - osmandHelper.addMapLayer(MAP_LAYER_ID, "Telegram", 5.5f, null) + osmandAidlHelper.addMapLayer(MAP_LAYER_ID, "Telegram", 5.5f, null) } } @@ -72,12 +72,12 @@ class ShowLocationHelper(private val app: TelegramApplication) { if (photoUri != null) { params[AMapPoint.POINT_IMAGE_URI_PARAM] = photoUri.toString() } - osmandHelper.addMapPoint(MAP_LAYER_ID, "${chatTitle}_${message.senderUserId}", userName, userName, + osmandAidlHelper.addMapPoint(MAP_LAYER_ID, "${chatTitle}_${message.senderUserId}", userName, userName, chatTitle, Color.RED, ALatLon(content.location.latitude, content.location.longitude), null, params) } else if (chatTitle != null && content is MessageOsmAndBotLocation && content.isValid()) { val name = content.name setupMapLayer() - osmandHelper.addMapPoint(MAP_LAYER_ID, "${chatTitle}_$name", name, name, + osmandAidlHelper.addMapPoint(MAP_LAYER_ID, "${chatTitle}_$name", name, name, chatTitle, Color.RED, ALatLon(content.lat, content.lon), null, null) } } @@ -121,17 +121,17 @@ class ShowLocationHelper(private val app: TelegramApplication) { private fun removeMapPoint(chatTitle: String, message: TdApi.Message) { val content = message.content if (content is TdApi.MessageLocation) { - osmandHelper.removeMapPoint(MAP_LAYER_ID, "${chatTitle}_${message.senderUserId}") + osmandAidlHelper.removeMapPoint(MAP_LAYER_ID, "${chatTitle}_${message.senderUserId}") } else if (content is MessageOsmAndBotLocation) { - osmandHelper.removeMapPoint(MAP_LAYER_ID, "${chatTitle}_${content.name}") + osmandAidlHelper.removeMapPoint(MAP_LAYER_ID, "${chatTitle}_${content.name}") } } private fun execOsmandApi(action: (() -> Unit)) { - if (osmandHelper.isOsmandConnected()) { + if (osmandAidlHelper.isOsmandConnected()) { action.invoke() - } else if (osmandHelper.isOsmandBound()) { - osmandHelper.connectOsmand() + } else if (osmandAidlHelper.isOsmandBound()) { + osmandAidlHelper.connectOsmand() } } } \ No newline at end of file diff --git a/OsmAnd-telegram/src/net/osmand/telegram/ui/LiveNowTabFragment.kt b/OsmAnd-telegram/src/net/osmand/telegram/ui/LiveNowTabFragment.kt index c218b1778e..3920008d96 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/ui/LiveNowTabFragment.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/ui/LiveNowTabFragment.kt @@ -37,7 +37,7 @@ class LiveNowTabFragment : Fragment(), TelegramListener, TelegramIncomingMessage get() = activity?.application as TelegramApplication private val telegramHelper get() = app.telegramHelper - private val osmandHelper get() = app.osmandHelper + private val osmandAidlHelper get() = app.osmandAidlHelper private val settings get() = app.settings private lateinit var adapter: LiveNowListAdapter @@ -295,7 +295,7 @@ class LiveNowTabFragment : Fragment(), TelegramListener, TelegramIncomingMessage settings.showChatOnMap(chatTitle, allSelected) if (settings.hasAnyChatToShowOnMap()) { - if (osmandHelper.isOsmandNotInstalled()) { + if (osmandAidlHelper.isOsmandNotInstalled()) { if (allSelected) { activity?.let { MainActivity.OsmandMissingDialogFragment() diff --git a/OsmAnd-telegram/src/net/osmand/telegram/ui/MainActivity.kt b/OsmAnd-telegram/src/net/osmand/telegram/ui/MainActivity.kt index 700cf1e100..74752ea9b3 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/ui/MainActivity.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/ui/MainActivity.kt @@ -52,7 +52,7 @@ class MainActivity : AppCompatActivity(), TelegramListener, ActionButtonsListene get() = application as TelegramApplication private val telegramHelper get() = app.telegramHelper - private val osmandHelper get() = app.osmandHelper + private val osmandAidlHelper get() = app.osmandAidlHelper private val settings get() = app.settings private val listeners: MutableList> = mutableListOf() @@ -131,8 +131,8 @@ class MainActivity : AppCompatActivity(), TelegramListener, ActionButtonsListene telegramHelper.init() } - if (osmandHelper.isOsmandBound() && !osmandHelper.isOsmandConnected()) { - osmandHelper.connectOsmand() + if (osmandAidlHelper.isOsmandBound() && !osmandAidlHelper.isOsmandConnected()) { + osmandAidlHelper.connectOsmand() } } @@ -161,7 +161,7 @@ class MainActivity : AppCompatActivity(), TelegramListener, ActionButtonsListene } else { requestLocationPermission() } - if (settings.hasAnyChatToShowOnMap() && osmandHelper.isOsmandNotInstalled()) { + if (settings.hasAnyChatToShowOnMap() && osmandAidlHelper.isOsmandNotInstalled()) { showOsmandMissingDialog() } } @@ -393,7 +393,7 @@ class MainActivity : AppCompatActivity(), TelegramListener, ActionButtonsListene settings.stopSharingLocationToChats() app.shareLocationHelper.stopSharingLocation() } - if (settings.hasAnyChatToShowOnMap() && osmandHelper.isOsmandNotInstalled()) { + if (settings.hasAnyChatToShowOnMap() && osmandAidlHelper.isOsmandNotInstalled()) { showOsmandMissingDialog() } } @@ -490,7 +490,7 @@ class MainActivity : AppCompatActivity(), TelegramListener, ActionButtonsListene holder.showOnMapSwitch?.setOnCheckedChangeListener { _, isChecked -> settings.showChatOnMap(chatTitle, isChecked) if (settings.hasAnyChatToShowOnMap()) { - if (osmandHelper.isOsmandNotInstalled()) { + if (osmandAidlHelper.isOsmandNotInstalled()) { if (isChecked) { showOsmandMissingDialog() }