#68 integrate a singular and plural version of <string name="ab_selected">

This commit is contained in:
Stefan Niedermann 2016-02-08 22:52:53 +01:00
parent 39930e9357
commit b7141f3e0a
3 changed files with 18 additions and 4 deletions

View file

@ -308,8 +308,8 @@ public class NotesListViewActivity extends AppCompatActivity implements
} else { } else {
v.setSelected(true); v.setSelected(true);
} }
mActionMode.setTitle(String.valueOf(adapter.getSelected().size()) int size = adapter.getSelected().size();
+ " " + getString(R.string.ab_selected)); mActionMode.setTitle(String.valueOf(getResources().getQuantityString(R.plurals.ab_selected, size, size)));
int checkedItemCount = adapter.getSelected().size(); int checkedItemCount = adapter.getSelected().size();
boolean hasCheckedItems = checkedItemCount > 0; boolean hasCheckedItems = checkedItemCount > 0;
@ -350,8 +350,7 @@ public class NotesListViewActivity extends AppCompatActivity implements
v.setSelected(selected); v.setSelected(selected);
mActionMode = startSupportActionMode(new MultiSelectedActionModeCallback()); mActionMode = startSupportActionMode(new MultiSelectedActionModeCallback());
int checkedItemCount = adapter.getSelected().size(); int checkedItemCount = adapter.getSelected().size();
mActionMode.setTitle(String.valueOf(checkedItemCount) mActionMode.setTitle(getResources().getQuantityString(R.plurals.ab_selected, checkedItemCount, checkedItemCount));
+ " " + getString(R.string.ab_selected));
} }
return selected; return selected;
} }

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<plurals
name="ab_selected">
<item quantity="one">%d selected fr</item>
<item quantity="other">%d selected fr</item>
</plurals>
</resources>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<plurals
name="ab_selected">
<item quantity="other">%d selected</item>
</plurals>
</resources>