Commit 6ee81eb2 authored by Torsten Grote's avatar Torsten Grote

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