Format numbers in locale as well (not all languages use the same)

Done according to
https://developer.android.com/training/basics/supporting-devices/languages#FormatNumbers
parent c14ebe82
...@@ -10,6 +10,8 @@ import org.briarproject.briar.R; ...@@ -10,6 +10,8 @@ import org.briarproject.briar.R;
import org.briarproject.briar.android.contact.BaseContactListAdapter.OnContactClickListener; import org.briarproject.briar.android.contact.BaseContactListAdapter.OnContactClickListener;
import org.briarproject.briar.android.util.UiUtils; import org.briarproject.briar.android.util.UiUtils;
import java.util.Locale;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import static android.support.v4.view.ViewCompat.setTransitionName; import static android.support.v4.view.ViewCompat.setTransitionName;
...@@ -36,7 +38,7 @@ class ContactListItemViewHolder extends ContactItemViewHolder<ContactListItem> { ...@@ -36,7 +38,7 @@ class ContactListItemViewHolder extends ContactItemViewHolder<ContactListItem> {
// unread count // unread count
int unreadCount = item.getUnreadCount(); int unreadCount = item.getUnreadCount();
if (unreadCount > 0) { if (unreadCount > 0) {
unread.setText(String.valueOf(unreadCount)); unread.setText(String.format(Locale.getDefault(), "%d", unreadCount));
unread.setVisibility(View.VISIBLE); unread.setVisibility(View.VISIBLE);
} else { } else {
unread.setVisibility(View.INVISIBLE); unread.setVisibility(View.INVISIBLE);
......
...@@ -8,6 +8,8 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault; ...@@ -8,6 +8,8 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import org.briarproject.briar.R; import org.briarproject.briar.R;
import org.briarproject.briar.android.threaded.ThreadItemAdapter.ThreadItemListener; import org.briarproject.briar.android.threaded.ThreadItemAdapter.ThreadItemListener;
import java.util.Locale;
import static android.view.View.GONE; import static android.view.View.GONE;
import static android.view.View.VISIBLE; import static android.view.View.VISIBLE;
...@@ -45,7 +47,8 @@ public class ThreadPostViewHolder<I extends ThreadItem> ...@@ -45,7 +47,8 @@ public class ThreadPostViewHolder<I extends ThreadItem>
} }
if (item.getLevel() > 5) { if (item.getLevel() > 5) {
lvlText.setVisibility(VISIBLE); lvlText.setVisibility(VISIBLE);
lvlText.setText(String.valueOf(item.getLevel())); lvlText.setText(
String.format(Locale.getDefault(), "%d", item.getLevel()));
} else { } else {
lvlText.setVisibility(GONE); lvlText.setVisibility(GONE);
} }
......
...@@ -12,6 +12,8 @@ import android.widget.TextView; ...@@ -12,6 +12,8 @@ import android.widget.TextView;
import org.briarproject.briar.R; import org.briarproject.briar.R;
import java.util.Locale;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import de.hdodenhof.circleimageview.CircleImageView; import de.hdodenhof.circleimageview.CircleImageView;
...@@ -44,7 +46,7 @@ public class TextAvatarView extends FrameLayout { ...@@ -44,7 +46,7 @@ public class TextAvatarView extends FrameLayout {
public void setUnreadCount(int count) { public void setUnreadCount(int count) {
if (count > 0) { if (count > 0) {
badge.setText(String.valueOf(count)); badge.setText(String.format(Locale.getDefault(), "%d", count));
badge.setVisibility(VISIBLE); badge.setVisibility(VISIBLE);
} else { } else {
badge.setVisibility(INVISIBLE); badge.setVisibility(INVISIBLE);
......
...@@ -12,6 +12,8 @@ import android.widget.TextView; ...@@ -12,6 +12,8 @@ import android.widget.TextView;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault; import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import org.briarproject.briar.R; import org.briarproject.briar.R;
import java.util.Locale;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@UiThread @UiThread
...@@ -69,7 +71,7 @@ public class UnreadMessageButton extends FrameLayout { ...@@ -69,7 +71,7 @@ public class UnreadMessageButton extends FrameLayout {
} else { } else {
fab.show(); fab.show();
unread.setVisibility(VISIBLE); unread.setVisibility(VISIBLE);
unread.setText(String.valueOf(count)); unread.setText(String.format(Locale.getDefault(), "%d", count));
} }
} }
......
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