Remove unnecessary code
This commit is contained in:
parent
a06ed64627
commit
03193b0a16
1 changed files with 20 additions and 20 deletions
|
@ -14,7 +14,7 @@ import net.osmand.telegram.notifications.NotificationHelper
|
||||||
import net.osmand.telegram.utils.AndroidUtils
|
import net.osmand.telegram.utils.AndroidUtils
|
||||||
import net.osmand.telegram.utils.UiUtils
|
import net.osmand.telegram.utils.UiUtils
|
||||||
|
|
||||||
class TelegramApplication : Application(), OsmandHelperListener {
|
class TelegramApplication : Application() {
|
||||||
|
|
||||||
val telegramHelper = TelegramHelper.instance
|
val telegramHelper = TelegramHelper.instance
|
||||||
lateinit var settings: TelegramSettings private set
|
lateinit var settings: TelegramSettings private set
|
||||||
|
@ -42,7 +42,25 @@ 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 = 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.setupMapLayer()
|
||||||
|
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()) {
|
||||||
|
@ -124,24 +142,6 @@ class TelegramApplication : Application(), OsmandHelperListener {
|
||||||
return internetConnectionAvailable
|
return internetConnectionAvailable
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun startTelegramService(intent: Int, serviceOffInterval: Long = 0) {
|
private fun startTelegramService(intent: Int, serviceOffInterval: Long = 0) {
|
||||||
var i = intent
|
var i = intent
|
||||||
var interval = serviceOffInterval
|
var interval = serviceOffInterval
|
||||||
|
|
Loading…
Reference in a new issue