Merge pull request #7350 from osmandapp/TrackerImprovements
Tracker Improvements
This commit is contained in:
commit
5d97afcc3d
3 changed files with 21 additions and 7 deletions
|
@ -42,9 +42,11 @@ 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 : OsmandAidlHelper.OsmandHelperListener {
|
osmandAidlHelper.listener = object : 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(
|
osmandAidlHelper.setNavDrawerItems(
|
||||||
applicationContext.packageName,
|
applicationContext.packageName,
|
||||||
listOf(getString(R.string.app_name_short)),
|
listOf(getString(R.string.app_name_short)),
|
||||||
|
|
|
@ -1043,6 +1043,16 @@ class OsmandAidlHelper(private val app: TelegramApplication) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun clearNavDrawerItems(appPackage: String): Boolean {
|
||||||
|
if (mIOsmAndAidlInterface != null) {
|
||||||
|
try {
|
||||||
|
return mIOsmAndAidlInterface!!.setNavDrawerItems(SetNavDrawerItemsParams(appPackage, emptyList()))
|
||||||
|
} catch (e: RemoteException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put navigation on pause.
|
* Put navigation on pause.
|
||||||
|
|
|
@ -156,6 +156,7 @@ class UserGpxInfoFragment : BaseDialogFragment() {
|
||||||
updateDateAndTimeButton()
|
updateDateAndTimeButton()
|
||||||
|
|
||||||
liveBtn = mainView.findViewById<TextView>(R.id.live_btn).apply {
|
liveBtn = mainView.findViewById<TextView>(R.id.live_btn).apply {
|
||||||
|
if (userId != telegramHelper.getCurrentUserId()) {
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
val enabled = !liveTrackEnabled()
|
val enabled = !liveTrackEnabled()
|
||||||
settings.updateLiveTrack(userId, chatId, deviceName, enabled)
|
settings.updateLiveTrack(userId, chatId, deviceName, enabled)
|
||||||
|
@ -165,6 +166,7 @@ class UserGpxInfoFragment : BaseDialogFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
updateLiveTrackBtn()
|
updateLiveTrackBtn()
|
||||||
|
|
||||||
avgElevationTv = mainView.findViewById<TextView>(R.id.average_altitude_text)
|
avgElevationTv = mainView.findViewById<TextView>(R.id.average_altitude_text)
|
||||||
|
|
Loading…
Reference in a new issue