Detect ITEM_COUNT_* in localizeStreamCount()

ITEM_COUNT_INFINITE and ITEM_COUNT_MORE_THAN_100.
Use localizeStreamCount in PlaylistFragment and PlaylistItemHolder
This commit is contained in:
Stypox 2020-03-20 20:57:56 +01:00 committed by wb9688
parent 2710d9de5b
commit 625419a7db
4 changed files with 18 additions and 14 deletions

View file

@ -6,6 +6,8 @@ import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.preference.PreferenceManager;
import org.schabi.newpipe.extractor.ListExtractor;
import android.text.TextUtils;
import android.util.DisplayMetrics;
@ -151,8 +153,15 @@ public final class Localization {
}
public static String localizeStreamCount(final Context context, final long streamCount) {
return getQuantity(context, R.plurals.videos, R.string.no_videos, streamCount,
localizeNumber(context, streamCount));
switch ((int) streamCount) {
case (int) ListExtractor.ITEM_COUNT_MORE_THAN_100:
return context.getResources().getString(R.string.playlist_more_than_100_items);
case (int) ListExtractor.ITEM_COUNT_INFINITE:
return context.getResources().getString(R.string.playlist_infinite_items);
default:
return getQuantity(context, R.plurals.videos, R.string.no_videos, streamCount,
localizeNumber(context, streamCount));
}
}
public static String localizeWatchingCount(final Context context, final long watchingCount) {