[vlc-devel] [PATCH 2/2] AudioPlaylistAdaptor: Account for plurals
Edward Wang
edward.c.wang at compdigitec.com
Sat Feb 11 19:59:52 CET 2012
---
vlc-android/res/values/strings.xml | 4 ++++
.../videolan/vlc/android/AudioPlaylistAdapter.java | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 3160165..a15b702 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -31,6 +31,10 @@
<string name="unknown_artist">Unknown Artist</string>
<string name="unknown_album">Unknown Album</string>
<string name="songs">Songs</string>
+ <plurals name="songs">
+ <item quantity="one">1 song</item>
+ <item quantity="other">%d songs</item>
+ </plurals>
<string name="artists">Artists</string>
<string name="albums">Albums</string>
<string name="genres">Genres</string>
diff --git a/vlc-android/src/org/videolan/vlc/android/AudioPlaylistAdapter.java b/vlc-android/src/org/videolan/vlc/android/AudioPlaylistAdapter.java
index 256b93c..3cb5d6d 100644
--- a/vlc-android/src/org/videolan/vlc/android/AudioPlaylistAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/android/AudioPlaylistAdapter.java
@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.List;
import android.content.Context;
+import android.content.res.Resources;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -82,8 +83,8 @@ public class AudioPlaylistAdapter extends ArrayAdapter<String> {
String name = mTitles.get(position);
ArrayList<Media> list = mPlaylists.get(name);
holder.title.setText(name);
- holder.text.setText(R.string.songs);
- holder.text.setText(list.size() + " " + holder.text.getText());
+ Resources res = getContext().getResources();
+ holder.text.setText(res.getQuantityString(R.plurals.songs, list.size(), list.size()));
return v;
}
--
1.7.5.4
More information about the vlc-devel
mailing list