back to osmand button fix

This commit is contained in:
veliymolfar 2020-01-10 11:10:40 +02:00
parent 4de8ab7baf
commit df820cac55

View file

@ -244,16 +244,7 @@ class MyLocationTabFragment : Fragment(), TelegramListener {
} }
} }
backToOsmAndBtn = mainView.findViewById<TextView>(R.id.back_to_osmand).apply { backToOsmAndBtn = mainView.findViewById<TextView>(R.id.back_to_osmand)
setOnClickListener {
val startIntent = app.packageManager.getLaunchIntentForPackage("net.osmand.plus")
if (startIntent != null) {
startIntent.addCategory(Intent.CATEGORY_LAUNCHER)
startActivity(startIntent)
}
}
}
lastChatsInfo = settings.lastChatsInfo lastChatsInfo = settings.lastChatsInfo
return mainView return mainView
@ -494,6 +485,25 @@ class MyLocationTabFragment : Fragment(), TelegramListener {
if (sharingMode) 0 else AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL if (sharingMode) 0 else AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL
stopSharingSwitcher.isChecked = true stopSharingSwitcher.isChecked = true
appBarScrollRange = -1 appBarScrollRange = -1
updateBackToOsmBtn()
}
private fun updateBackToOsmBtn() {
val pckg = app.settings.appToConnectPackage
backToOsmAndBtn.apply {
visibility = if (pckg.isNotEmpty() && sharingMode && AndroidUtils.isAppInstalled(app, pckg)) {
setOnClickListener {
val startIntent = app.packageManager.getLaunchIntentForPackage(pckg)
if (startIntent != null) {
startIntent.addCategory(Intent.CATEGORY_LAUNCHER)
startActivity(startIntent)
}
}
View.VISIBLE
} else {
View.GONE
}
}
} }
private fun updateSharingStatus() { private fun updateSharingStatus() {