diff --git a/OsmAnd-telegram/res/values/strings.xml b/OsmAnd-telegram/res/values/strings.xml index fe976517fb..3e134ade9b 100644 --- a/OsmAnd-telegram/res/values/strings.xml +++ b/OsmAnd-telegram/res/values/strings.xml @@ -1,4 +1,9 @@ + Send location as + Choose how messages with your location will look like. + Map + Text + Map and text Last update from Telegram Pick a name you haven\'t already used %1$s added. diff --git a/OsmAnd-telegram/src/net/osmand/telegram/TelegramSettings.kt b/OsmAnd-telegram/src/net/osmand/telegram/TelegramSettings.kt index 5525ec3b6b..346fa3f5c7 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/TelegramSettings.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/TelegramSettings.kt @@ -44,7 +44,7 @@ private val LOC_HISTORY_VALUES_SEC = listOf( const val SHARE_TYPE_MAP = "Map" const val SHARE_TYPE_TEXT = "Text" -const val SHARE_TYPE_MAP_AND_TEXT = "Map and text" +const val SHARE_TYPE_MAP_AND_TEXT = "Map_and_text" private val SHARE_TYPE_VALUES = listOf(SHARE_TYPE_MAP, SHARE_TYPE_TEXT, SHARE_TYPE_MAP_AND_TEXT) private const val SEND_MY_LOC_DEFAULT_INDEX = 6 @@ -626,26 +626,31 @@ class TelegramSettings(private val app: TelegramApplication) { inner class ShareTypePref : DurationPref( R.drawable.ic_action_location_history, - R.string.location_history, - R.string.location_history_desc, + R.string.send_location_as, + R.string.send_location_as_descr, emptyList() ) { override fun getCurrentValue(): String { - return when (shareTypeValue) { - SHARE_TYPE_MAP -> "Map" - SHARE_TYPE_TEXT -> "Text" - SHARE_TYPE_MAP_AND_TEXT -> "Map and text" - else -> "" - } + return getTextValue(shareTypeValue) } override fun setCurrentValue(index: Int) { shareTypeValue = SHARE_TYPE_VALUES[index] } - override fun getMenuItems() = SHARE_TYPE_VALUES + override fun getMenuItems(): List { + return SHARE_TYPE_VALUES.map { getTextValue(it) } + } + private fun getTextValue(shareType: String): String { + return when (shareType) { + SHARE_TYPE_MAP -> app.getString(R.string.shared_string_map) + SHARE_TYPE_TEXT -> app.getString(R.string.shared_string_text) + SHARE_TYPE_MAP_AND_TEXT -> app.getString(R.string.map_and_text) + else -> "" + } + } } abstract inner class DurationPref( diff --git a/OsmAnd-telegram/src/net/osmand/telegram/ui/MyLocationTabFragment.kt b/OsmAnd-telegram/src/net/osmand/telegram/ui/MyLocationTabFragment.kt index 1c5e5b0c9d..bb56ec9643 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/ui/MyLocationTabFragment.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/ui/MyLocationTabFragment.kt @@ -582,9 +582,7 @@ class MyLocationTabFragment : Fragment(), TelegramListener { } TelegramUiHelper.setupPhoto(app, holder.icon, photoPath, placeholderId, false) - holder.icon?.setOnClickListener { - app.forceUpdateMyLocation() - } + val title = when (item) { is TdApi.Chat -> item.title is TdApi.User -> TelegramUiHelper.getUserName(item)