Commit ce5be255 authored by Sébastien Toque's avatar Sébastien Toque

Preview: don't display language if unknown

parent e296dc51
......@@ -68,13 +68,16 @@
<string name="detect_headset_detail">Pause lors du débranchement du casque, Reprise lors du branchement du casque</string>
<string name="refresh">Rafraîchir</string>
<string name="track_audio">Piste audio</string>
<plurals name="track_audio_info">
<item quantity="one">Codec: %1$s\nLangue: %2$s\n%3$d canal\nFréquence d\'échantillonage: %4$d Hz</item>
<item quantity="other">Codec: %1$s\nLangue: %2$s\n%3$d canaux\nFréquence d\'échantillonage: %4$d Hz</item>
</plurals>
<string name="track_video">Piste vidéo</string>
<string name="track_video_info">Codec: %1$s\nLangue: %2$s\nRésolution: %3$dx%4$d\nDébit d\'images: %5$.3f</string>
<string name="track_text">Piste sous-titres</string>
<string name="track_text_info">Codec: %1$s\nLangue: %2$s</string>
<string name="track_unknown">Piste inconnue</string>
<string name="track_codec_info">Codec: %1$s\n</string>
<string name="track_language_info">Langue: %1$s\n</string>
<plurals name="track_channels_info">
<item quantity="one">%1$d canal\n</item>
<item quantity="other">%1$d canaux\n</item>
</plurals>
<string name="track_samplerate_info">Fréquence d\'échantillonage: %1$d Hz\n</string>
<string name="track_resolution_info">Résolution: %1$dx%2$d\n</string>
<string name="track_framerate_info">Débit d\'images: %1$.3f\n</string>
</resources>
......@@ -71,15 +71,18 @@
<string name="detect_headset_detail">Pause on headset removed, Resume on headset inserted</string>
<string name="refresh">Refresh</string>
<string name="track_audio">Audio track</string>
<plurals name="track_audio_info">
<item quantity="one">Codec: %1$s\nLanguage: %2$s\n%3$d channel\nSample rate: %4$d Hz</item>
<item quantity="other">Codec: %1$s\nLanguage: %2$s\n%3$d channels\nSample rate: %4$d Hz</item>
</plurals>
<string name="track_video">Video track</string>
<string name="track_video_info">Codec: %1$s\nLanguage: %2$s\nResolution: %3$dx%4$d\nFrame rate: %5$.3f</string>
<string name="track_text">Subtitles track</string>
<string name="track_text_info">Codec: %1$s\nLanguage: %2$s</string>
<string name="track_unknown">Unknown track</string>
<string name="track_codec_info">Codec: %1$s\n</string>
<string name="track_language_info">Language: %1$s\n</string>
<plurals name="track_channels_info">
<item quantity="one">%1$d channel\n</item>
<item quantity="other">%1$d channels\n</item>
</plurals>
<string name="track_samplerate_info">Sample rate: %1$d Hz\n</string>
<string name="track_resolution_info">Resolution: %1$dx%2$d\n</string>
<string name="track_framerate_info">Frame rate: %1$.3f\n</string>
<string name="open_mrl">Open MRL</string>
<string name="open_mrl_dialog_title">Open network stream</string>
<string name="open_mrl_dialog_msg">Enter network MRL: e.g. http://, mms:// or rtsp://</string>
......
......@@ -52,35 +52,51 @@ public class MediaInfoAdapter extends ArrayAdapter<TrackInfo> {
holder = (ViewHolder) v.getTag();
TrackInfo track = getItem(position);
String language = track.Language != null ? track.Language : "und";
String title;
String text;
StringBuilder textBuilder = new StringBuilder(1024);
Resources res = getContext().getResources();
switch (track.Type)
{
case TrackInfo.TYPE_AUDIO:
title = res.getString(R.string.track_audio);
text = res.getQuantityString(R.plurals.track_audio_info, track.Channels, track.Codec, language, track.Channels, track.Samplerate);
appendCommon(textBuilder, res, track);
appendAudio(textBuilder, res, track);
break;
case TrackInfo.TYPE_VIDEO:
title = res.getString(R.string.track_video);
text = res.getString(R.string.track_video_info, track.Codec, language, track.Width, track.Height, track.Framerate);
appendCommon(textBuilder, res, track);
appendVideo(textBuilder, res, track);
break;
case TrackInfo.TYPE_TEXT:
title = res.getString(R.string.track_text);
text = res.getString(R.string.track_text_info, track.Codec, language);
appendCommon(textBuilder, res, track);
break;
default:
title = res.getString(R.string.track_unknown);
text = "";
}
holder.title.setText(title);
holder.text.setText(text);
holder.text.setText(textBuilder.toString());
return v;
}
private void appendCommon(StringBuilder textBuilder, Resources res, TrackInfo track) {
textBuilder.append(res.getString(R.string.track_codec_info, track.Codec));
if (track.Language != null && !track.Language.equalsIgnoreCase("und"))
textBuilder.append(res.getString(R.string.track_language_info, track.Language));
}
private void appendAudio(StringBuilder textBuilder, Resources res, TrackInfo track) {
textBuilder.append(res.getQuantityString(R.plurals.track_channels_info, track.Channels, track.Channels));
textBuilder.append(res.getString(R.string.track_samplerate_info, track.Samplerate));
}
private void appendVideo(StringBuilder textBuilder, Resources res, TrackInfo track) {
textBuilder.append(res.getString(R.string.track_resolution_info, track.Width, track.Height));
textBuilder.append(res.getString(R.string.track_framerate_info, track.Framerate));
}
static class ViewHolder {
TextView title;
TextView text;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment