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
|
||||
uiUtils = UiUtils(this)
|
||||
osmandAidlHelper = OsmandAidlHelper(this)
|
||||
osmandAidlHelper.listener = object : OsmandAidlHelper.OsmandHelperListener {
|
||||
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)),
|
||||
|
|
|
@ -1043,6 +1043,16 @@ class OsmandAidlHelper(private val app: TelegramApplication) {
|
|||
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.
|
||||
|
|
|
@ -156,12 +156,14 @@ class UserGpxInfoFragment : BaseDialogFragment() {
|
|||
updateDateAndTimeButton()
|
||||
|
||||
liveBtn = mainView.findViewById<TextView>(R.id.live_btn).apply {
|
||||
setOnClickListener {
|
||||
val enabled = !liveTrackEnabled()
|
||||
settings.updateLiveTrack(userId, chatId, deviceName, enabled)
|
||||
updateLiveTrackBtn()
|
||||
if (enabled) {
|
||||
startHandler()
|
||||
if (userId != telegramHelper.getCurrentUserId()) {
|
||||
setOnClickListener {
|
||||
val enabled = !liveTrackEnabled()
|
||||
settings.updateLiveTrack(userId, chatId, deviceName, enabled)
|
||||
updateLiveTrackBtn()
|
||||
if (enabled) {
|
||||
startHandler()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue