mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/357 - Changes delete text depending on the number of items selected
This commit is contained in:
parent
2431d61130
commit
912d8dbb04
@ -125,12 +125,14 @@ class HistoryAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun bind(mode: HistoryState.Mode) {
|
fun bind(mode: HistoryState.Mode) {
|
||||||
when(mode) {
|
val text = if (mode is HistoryState.Mode.Editing && mode.selectedItems.isNotEmpty()) {
|
||||||
is HistoryState.Mode.Normal ->
|
text.context.resources.getString(R.string.delete_history_items, mode.selectedItems.size)
|
||||||
text.text = text.context.resources.getText(R.string.delete_history)
|
} else {
|
||||||
is HistoryState.Mode.Editing ->
|
text.context.resources.getString(R.string.delete_history)
|
||||||
text.text = text.context.resources.getString(R.string.delete_history_items, mode.selectedItems.size)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button.contentDescription = text
|
||||||
|
this.text.text = text
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -4,9 +4,12 @@
|
|||||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/delete_history_button"
|
android:id="@+id/delete_history_button"
|
||||||
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
android:background="@drawable/delete_history_background"
|
android:background="@drawable/delete_history_background"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:padding="6dp"
|
android:padding="6dp"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
@ -19,5 +22,7 @@
|
|||||||
android:drawablePadding="8dp"
|
android:drawablePadding="8dp"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:clickable="false"
|
||||||
|
android:focusable="false"
|
||||||
android:layout_gravity="center" />
|
android:layout_gravity="center" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
@ -152,5 +152,5 @@
|
|||||||
|
|
||||||
<!-- Text for the button to clear selected history items. The first parameter
|
<!-- Text for the button to clear selected history items. The first parameter
|
||||||
is the number of items you have selected -->
|
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>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user