mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2024-12-25 00:14:00 +01:00
Merge pull request #4031 from ebraminio/valueof
Replace some of String.valueOf uses with to String.format to get locale's digits
This commit is contained in:
commit
c166edd46a
@ -37,6 +37,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* BaseAdapter for the navigation drawer
|
||||
@ -246,19 +247,19 @@ public class NavListAdapter extends BaseAdapter
|
||||
if (tag.equals(QueueFragment.TAG)) {
|
||||
int queueSize = itemAccess.getQueueSize();
|
||||
if (queueSize > 0) {
|
||||
holder.count.setText(String.valueOf(queueSize));
|
||||
holder.count.setText(String.format(Locale.getDefault(), "%d", queueSize));
|
||||
holder.count.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else if (tag.equals(EpisodesFragment.TAG)) {
|
||||
int unreadItems = itemAccess.getNumberOfNewItems();
|
||||
if (unreadItems > 0) {
|
||||
holder.count.setText(String.valueOf(unreadItems));
|
||||
holder.count.setText(String.format(Locale.getDefault(), "%d", unreadItems));
|
||||
holder.count.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else if (tag.equals(SubscriptionFragment.TAG)) {
|
||||
int sum = itemAccess.getFeedCounterSum();
|
||||
if (sum > 0) {
|
||||
holder.count.setText(String.valueOf(sum));
|
||||
holder.count.setText(String.format(Locale.getDefault(), "%d", sum));
|
||||
holder.count.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else if(tag.equals(DownloadsFragment.TAG) && UserPreferences.isEnableAutodownload()) {
|
||||
@ -351,7 +352,7 @@ public class NavListAdapter extends BaseAdapter
|
||||
int counter = itemAccess.getFeedCounter(feed.getId());
|
||||
if(counter > 0) {
|
||||
holder.count.setVisibility(View.VISIBLE);
|
||||
holder.count.setText(String.valueOf(counter));
|
||||
holder.count.setText(String.format(Locale.getDefault(), "%d", counter));
|
||||
} else {
|
||||
holder.count.setVisibility(View.GONE);
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import android.widget.TextView;
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Locale;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
@ -88,7 +89,8 @@ public class SubscriptionsAdapter extends BaseAdapter implements AdapterView.OnI
|
||||
holder.feedTitle.setVisibility(View.VISIBLE);
|
||||
int count = itemAccess.getFeedCounter(feed.getId());
|
||||
if(count > 0) {
|
||||
holder.count.setPrimaryText(String.valueOf(itemAccess.getFeedCounter(feed.getId())));
|
||||
holder.count.setPrimaryText(String.format(Locale.getDefault(), "%d",
|
||||
itemAccess.getFeedCounter(feed.getId())));
|
||||
holder.count.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.count.setVisibility(View.GONE);
|
||||
|
@ -3,6 +3,9 @@ package de.danoeh.antennapod.dialog;
|
||||
import android.content.Context;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
|
||||
@ -45,7 +48,7 @@ public class SkipPreferenceDialog {
|
||||
UserPreferences.setRewindSecs(seconds);
|
||||
}
|
||||
if (textView != null) {
|
||||
textView.setText(String.valueOf(seconds));
|
||||
textView.setText(String.format(Locale.getDefault(), "%d", seconds));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user