add a label at the last settings item

This commit is contained in:
tibbi 2021-11-15 18:00:48 +01:00
parent 5e31e72504
commit 22ecef42cf
2 changed files with 19 additions and 0 deletions

View file

@ -102,6 +102,7 @@ class SettingsActivity : SimpleActivity() {
} }
private fun setupReplaceTitle() { private fun setupReplaceTitle() {
settings_show_filename.text = getReplaceTitleText()
settings_show_filename_holder.setOnClickListener { settings_show_filename_holder.setOnClickListener {
val items = arrayListOf( val items = arrayListOf(
RadioItem(SHOW_FILENAME_NEVER, getString(R.string.never)), RadioItem(SHOW_FILENAME_NEVER, getString(R.string.never)),
@ -111,8 +112,17 @@ class SettingsActivity : SimpleActivity() {
RadioGroupDialog(this@SettingsActivity, items, config.showFilename) { RadioGroupDialog(this@SettingsActivity, items, config.showFilename) {
config.showFilename = it as Int config.showFilename = it as Int
settings_show_filename.text = getReplaceTitleText()
sendIntent(REFRESH_LIST) sendIntent(REFRESH_LIST)
} }
} }
} }
private fun getReplaceTitleText() = getString(
when (config.showFilename) {
SHOW_FILENAME_NEVER -> R.string.never
SHOW_FILENAME_IF_UNAVAILABLE -> R.string.title_is_not_available
else -> R.string.always
}
)
} }

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/settings_scrollview" android:id="@+id/settings_scrollview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
@ -135,6 +136,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/show_filename" /> android:text="@string/show_filename" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_show_filename"
style="@style/SettingsTextValueStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/settings_show_filename_label"
tools:text="@string/title_is_not_available" />
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>