Add string resources for new setting
This commit is contained in:
parent
89a03881da
commit
59f6feb1dc
3 changed files with 21 additions and 13 deletions
|
@ -1,4 +1,9 @@
|
||||||
<resources>
|
<resources>
|
||||||
|
<string name="send_location_as">Send location as</string>
|
||||||
|
<string name="send_location_as_descr">Choose how messages with your location will look like.</string>
|
||||||
|
<string name="shared_string_map">Map</string>
|
||||||
|
<string name="shared_string_text">Text</string>
|
||||||
|
<string name="map_and_text">Map and text</string>
|
||||||
<string name="last_update_from_telegram">Last update from Telegram</string>
|
<string name="last_update_from_telegram">Last update from Telegram</string>
|
||||||
<string name="enter_another_device_name">Pick a name you haven\'t already used</string>
|
<string name="enter_another_device_name">Pick a name you haven\'t already used</string>
|
||||||
<string name="device_added_successfully">%1$s added.</string>
|
<string name="device_added_successfully">%1$s added.</string>
|
||||||
|
|
|
@ -44,7 +44,7 @@ private val LOC_HISTORY_VALUES_SEC = listOf(
|
||||||
|
|
||||||
const val SHARE_TYPE_MAP = "Map"
|
const val SHARE_TYPE_MAP = "Map"
|
||||||
const val SHARE_TYPE_TEXT = "Text"
|
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 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
|
private const val SEND_MY_LOC_DEFAULT_INDEX = 6
|
||||||
|
@ -626,26 +626,31 @@ class TelegramSettings(private val app: TelegramApplication) {
|
||||||
|
|
||||||
inner class ShareTypePref : DurationPref(
|
inner class ShareTypePref : DurationPref(
|
||||||
R.drawable.ic_action_location_history,
|
R.drawable.ic_action_location_history,
|
||||||
R.string.location_history,
|
R.string.send_location_as,
|
||||||
R.string.location_history_desc,
|
R.string.send_location_as_descr,
|
||||||
emptyList()
|
emptyList()
|
||||||
) {
|
) {
|
||||||
|
|
||||||
override fun getCurrentValue(): String {
|
override fun getCurrentValue(): String {
|
||||||
return when (shareTypeValue) {
|
return getTextValue(shareTypeValue)
|
||||||
SHARE_TYPE_MAP -> "Map"
|
|
||||||
SHARE_TYPE_TEXT -> "Text"
|
|
||||||
SHARE_TYPE_MAP_AND_TEXT -> "Map and text"
|
|
||||||
else -> ""
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setCurrentValue(index: Int) {
|
override fun setCurrentValue(index: Int) {
|
||||||
shareTypeValue = SHARE_TYPE_VALUES[index]
|
shareTypeValue = SHARE_TYPE_VALUES[index]
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getMenuItems() = SHARE_TYPE_VALUES
|
override fun getMenuItems(): List<String> {
|
||||||
|
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(
|
abstract inner class DurationPref(
|
||||||
|
|
|
@ -582,9 +582,7 @@ class MyLocationTabFragment : Fragment(), TelegramListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
TelegramUiHelper.setupPhoto(app, holder.icon, photoPath, placeholderId, false)
|
TelegramUiHelper.setupPhoto(app, holder.icon, photoPath, placeholderId, false)
|
||||||
holder.icon?.setOnClickListener {
|
|
||||||
app.forceUpdateMyLocation()
|
|
||||||
}
|
|
||||||
val title = when (item) {
|
val title = when (item) {
|
||||||
is TdApi.Chat -> item.title
|
is TdApi.Chat -> item.title
|
||||||
is TdApi.User -> TelegramUiHelper.getUserName(item)
|
is TdApi.User -> TelegramUiHelper.getUserName(item)
|
||||||
|
|
Loading…
Reference in a new issue