mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 12:19:54 +01:00
Remove empty forum warning bubble.
This commit is contained in:
@@ -52,19 +52,15 @@ class ForumListAdapter
|
|||||||
// Post Count
|
// Post Count
|
||||||
int postCount = item.getPostCount();
|
int postCount = item.getPostCount();
|
||||||
if (postCount > 0) {
|
if (postCount > 0) {
|
||||||
ui.avatar.setProblem(false);
|
|
||||||
ui.postCount.setText(ctx.getResources()
|
ui.postCount.setText(ctx.getResources()
|
||||||
.getQuantityString(R.plurals.posts, postCount,
|
.getQuantityString(R.plurals.posts, postCount,
|
||||||
postCount));
|
postCount));
|
||||||
ui.postCount.setTextColor(
|
ui.postCount.setTextColor(
|
||||||
ContextCompat
|
ContextCompat.getColor(ctx, R.color.briar_text_secondary));
|
||||||
.getColor(ctx, R.color.briar_text_secondary));
|
|
||||||
} else {
|
} else {
|
||||||
ui.avatar.setProblem(true);
|
|
||||||
ui.postCount.setText(ctx.getString(R.string.no_posts));
|
ui.postCount.setText(ctx.getString(R.string.no_posts));
|
||||||
ui.postCount.setTextColor(
|
ui.postCount.setTextColor(
|
||||||
ContextCompat
|
ContextCompat.getColor(ctx, R.color.briar_text_tertiary));
|
||||||
.getColor(ctx, R.color.briar_text_tertiary));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
|
|||||||
@@ -74,9 +74,7 @@ class GroupViewHolder extends RecyclerView.ViewHolder {
|
|||||||
if (group.isEmpty()) {
|
if (group.isEmpty()) {
|
||||||
postCount.setVisibility(GONE);
|
postCount.setVisibility(GONE);
|
||||||
date.setVisibility(GONE);
|
date.setVisibility(GONE);
|
||||||
avatar.setProblem(true);
|
status.setText(ctx.getString(R.string.groups_group_is_empty));
|
||||||
status
|
|
||||||
.setText(ctx.getString(R.string.groups_group_is_empty));
|
|
||||||
status.setVisibility(VISIBLE);
|
status.setVisibility(VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
// Message Count
|
// Message Count
|
||||||
@@ -91,7 +89,6 @@ class GroupViewHolder extends RecyclerView.ViewHolder {
|
|||||||
long lastUpdate = group.getTimestamp();
|
long lastUpdate = group.getTimestamp();
|
||||||
date.setText(UiUtils.formatDate(ctx, lastUpdate));
|
date.setText(UiUtils.formatDate(ctx, lastUpdate));
|
||||||
date.setVisibility(VISIBLE);
|
date.setVisibility(VISIBLE);
|
||||||
avatar.setProblem(false);
|
|
||||||
status.setVisibility(GONE);
|
status.setVisibility(GONE);
|
||||||
}
|
}
|
||||||
remove.setVisibility(GONE);
|
remove.setVisibility(GONE);
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import android.graphics.Color;
|
|||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.support.annotation.UiThread;
|
import android.support.annotation.UiThread;
|
||||||
import android.support.v4.content.ContextCompat;
|
|
||||||
import android.support.v7.widget.AppCompatTextView;
|
import android.support.v7.widget.AppCompatTextView;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -26,7 +25,6 @@ public class TextAvatarView extends FrameLayout {
|
|||||||
private final AppCompatTextView character;
|
private final AppCompatTextView character;
|
||||||
private final CircleImageView background;
|
private final CircleImageView background;
|
||||||
private final TextView badge;
|
private final TextView badge;
|
||||||
private int unreadCount;
|
|
||||||
|
|
||||||
public TextAvatarView(Context context, @Nullable AttributeSet attrs) {
|
public TextAvatarView(Context context, @Nullable AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
@@ -49,30 +47,14 @@ public class TextAvatarView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setUnreadCount(int count) {
|
public void setUnreadCount(int count) {
|
||||||
unreadCount = count;
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
badge.setBackgroundResource(R.drawable.bubble);
|
|
||||||
badge.setText(String.valueOf(count));
|
badge.setText(String.valueOf(count));
|
||||||
badge.setTextColor(ContextCompat.getColor(getContext(),
|
|
||||||
R.color.briar_text_primary_inverse));
|
|
||||||
badge.setVisibility(VISIBLE);
|
badge.setVisibility(VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
badge.setVisibility(INVISIBLE);
|
badge.setVisibility(INVISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProblem(boolean problem) {
|
|
||||||
if (problem) {
|
|
||||||
badge.setBackgroundResource(R.drawable.bubble_problem);
|
|
||||||
badge.setText("!");
|
|
||||||
badge.setTextColor(ContextCompat
|
|
||||||
.getColor(getContext(), R.color.briar_primary));
|
|
||||||
badge.setVisibility(VISIBLE);
|
|
||||||
} else {
|
|
||||||
setUnreadCount(unreadCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBackgroundBytes(byte[] bytes) {
|
public void setBackgroundBytes(byte[] bytes) {
|
||||||
int r = getByte(bytes, 0) * 3 / 4 + 96;
|
int r = getByte(bytes, 0) * 3 / 4 + 96;
|
||||||
int g = getByte(bytes, 1) * 3 / 4 + 96;
|
int g = getByte(bytes, 1) * 3 / 4 + 96;
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:shape="rectangle">
|
|
||||||
|
|
||||||
<corners
|
|
||||||
android:radius="@dimen/unread_bubble_size"/>
|
|
||||||
|
|
||||||
<padding
|
|
||||||
android:left="@dimen/unread_bubble_padding_horizontal"
|
|
||||||
android:right="@dimen/unread_bubble_padding_horizontal"/>
|
|
||||||
|
|
||||||
<solid
|
|
||||||
android:color="@color/briar_gold"/>
|
|
||||||
|
|
||||||
<stroke
|
|
||||||
android:color="@color/briar_primary"
|
|
||||||
android:width="@dimen/avatar_border_width"/>
|
|
||||||
|
|
||||||
</shape>
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user