For #357 - Changes delete text depending on the number of items selected
parent
1f276ec9fc
commit
a65bd9b245
|
@ -125,12 +125,14 @@ class HistoryAdapter(
|
|||
}
|
||||
|
||||
fun bind(mode: HistoryState.Mode) {
|
||||
when(mode) {
|
||||
is HistoryState.Mode.Normal ->
|
||||
text.text = text.context.resources.getText(R.string.delete_history)
|
||||
is HistoryState.Mode.Editing ->
|
||||
text.text = text.context.resources.getString(R.string.delete_history_items, mode.selectedItems.size)
|
||||
val text = if (mode is HistoryState.Mode.Editing && mode.selectedItems.isNotEmpty()) {
|
||||
text.context.resources.getString(R.string.delete_history_items, mode.selectedItems.size)
|
||||
} else {
|
||||
text.context.resources.getString(R.string.delete_history)
|
||||
}
|
||||
|
||||
button.contentDescription = text
|
||||
this.text.text = text
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -4,9 +4,12 @@
|
|||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/delete_history_button"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:background="@drawable/delete_history_background"
|
||||
android:layout_margin="16dp"
|
||||
android:padding="6dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
@ -19,5 +22,7 @@
|
|||
android:drawablePadding="8dp"
|
||||
android:textSize="16sp"
|
||||
android:gravity="center"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:layout_gravity="center" />
|
||||
</FrameLayout>
|
|
@ -152,5 +152,5 @@
|
|||
|
||||
<!-- Text for the button to clear selected history items. The first parameter
|
||||
is the number of items you have selected -->
|
||||
<string name="delete_history_items">Delete %1$s Items</string>
|
||||
<string name="delete_history_items">Delete %1$d Items</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue