mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Added an icon to indicate that a pseudonym is unrated.
This commit is contained in:
BIN
briar-android/res/drawable-hdpi/rating_unrated.png
Normal file
BIN
briar-android/res/drawable-hdpi/rating_unrated.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 297 B |
BIN
briar-android/res/drawable-mdpi/rating_unrated.png
Normal file
BIN
briar-android/res/drawable-mdpi/rating_unrated.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 150 B |
BIN
briar-android/res/drawable-xhdpi/rating_unrated.png
Normal file
BIN
briar-android/res/drawable-xhdpi/rating_unrated.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 211 B |
@@ -4,7 +4,7 @@
|
||||
<color name="content_background">#FFFFFF</color>
|
||||
<color name="unread_background">#FFFFFF</color>
|
||||
<color name="horizontal_border">#CCCCCC</color>
|
||||
<color name="anonymous_author">#999999</color>
|
||||
<color name="no_posts">#999999</color>
|
||||
<color name="no_messages">#999999</color>
|
||||
<color name="anonymous_author">#AAAAAA</color>
|
||||
<color name="no_posts">#AAAAAA</color>
|
||||
<color name="no_messages">#AAAAAA</color>
|
||||
</resources>
|
||||
@@ -46,7 +46,7 @@
|
||||
<string name="compose_message_title">New Message</string>
|
||||
<string name="from">From:</string>
|
||||
<string name="to">To:</string>
|
||||
<string name="anonymous">(Anonymous)</string>
|
||||
<string name="anonymous">Anonymous</string>
|
||||
<string name="new_contact_item">New contact\u2026</string>
|
||||
<string name="groups_title">Groups</string>
|
||||
<string name="no_posts">(No posts)</string>
|
||||
|
||||
@@ -2,13 +2,12 @@ package net.sf.briar.android.blogs;
|
||||
|
||||
import static android.graphics.Typeface.BOLD;
|
||||
import static android.view.Gravity.CENTER_VERTICAL;
|
||||
import static android.view.View.INVISIBLE;
|
||||
import static android.widget.LinearLayout.HORIZONTAL;
|
||||
import static android.widget.LinearLayout.VERTICAL;
|
||||
import static java.text.DateFormat.SHORT;
|
||||
import static net.sf.briar.android.widgets.CommonLayoutParams.WRAP_WRAP_1;
|
||||
import static net.sf.briar.api.messaging.Rating.BAD;
|
||||
import static net.sf.briar.api.messaging.Rating.GOOD;
|
||||
import static net.sf.briar.api.messaging.Rating.UNRATED;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -38,14 +37,12 @@ class BlogAdapter extends ArrayAdapter<GroupMessageHeader> {
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
GroupMessageHeader item = getItem(position);
|
||||
Context ctx = getContext();
|
||||
Resources res = ctx.getResources();
|
||||
|
||||
// FIXME: Use a RelativeLayout
|
||||
LinearLayout layout = new LinearLayout(ctx);
|
||||
layout.setOrientation(HORIZONTAL);
|
||||
if(!item.isRead()) {
|
||||
Resources res = ctx.getResources();
|
||||
if(!item.isRead())
|
||||
layout.setBackgroundColor(res.getColor(R.color.unread_background));
|
||||
}
|
||||
|
||||
LinearLayout innerLayout = new LinearLayout(ctx);
|
||||
// Give me all the unused width
|
||||
@@ -60,8 +57,8 @@ class BlogAdapter extends ArrayAdapter<GroupMessageHeader> {
|
||||
thumb.setPadding(10, 10, 10, 10);
|
||||
Rating rating = item.getRating();
|
||||
if(rating == GOOD) thumb.setImageResource(R.drawable.rating_good);
|
||||
else thumb.setImageResource(R.drawable.rating_bad);
|
||||
if(rating == UNRATED) thumb.setVisibility(INVISIBLE);
|
||||
else if(rating == BAD) thumb.setImageResource(R.drawable.rating_bad);
|
||||
else thumb.setImageResource(R.drawable.rating_unrated);
|
||||
authorLayout.addView(thumb);
|
||||
|
||||
TextView name = new TextView(ctx);
|
||||
@@ -71,7 +68,6 @@ class BlogAdapter extends ArrayAdapter<GroupMessageHeader> {
|
||||
name.setMaxLines(1);
|
||||
name.setPadding(0, 10, 10, 10);
|
||||
Author author = item.getAuthor();
|
||||
Resources res = ctx.getResources();
|
||||
if(author == null) {
|
||||
name.setTextColor(res.getColor(R.color.anonymous_author));
|
||||
name.setText(R.string.anonymous);
|
||||
|
||||
@@ -215,7 +215,7 @@ implements OnClickListener, DatabaseListener, NoBlogsDialog.Listener {
|
||||
if(countPostableGroups() == 0) {
|
||||
NoBlogsDialog dialog = new NoBlogsDialog();
|
||||
dialog.setListener(this);
|
||||
dialog.show(getSupportFragmentManager(), "NoGroupsDialog");
|
||||
dialog.show(getSupportFragmentManager(), "NoBlogsDialog");
|
||||
} else {
|
||||
startActivity(new Intent(this, WriteBlogPostActivity.class));
|
||||
}
|
||||
@@ -283,6 +283,7 @@ implements OnClickListener, DatabaseListener, NoBlogsDialog.Listener {
|
||||
BlogListItem item = findGroup(g);
|
||||
if(item != null) {
|
||||
adapter.remove(item);
|
||||
adapter.notifyDataSetChanged();
|
||||
selectFirstUnread();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ package net.sf.briar.android.blogs;
|
||||
|
||||
import static android.view.Gravity.CENTER;
|
||||
import static android.view.Gravity.CENTER_VERTICAL;
|
||||
import static android.view.View.INVISIBLE;
|
||||
import static android.view.View.VISIBLE;
|
||||
import static android.widget.LinearLayout.HORIZONTAL;
|
||||
import static android.widget.LinearLayout.VERTICAL;
|
||||
import static java.text.DateFormat.SHORT;
|
||||
@@ -136,8 +134,8 @@ implements OnClickListener {
|
||||
thumb = new ImageView(this);
|
||||
thumb.setPadding(0, 10, 10, 10);
|
||||
if(rating == GOOD) thumb.setImageResource(R.drawable.rating_good);
|
||||
else thumb.setImageResource(R.drawable.rating_bad);
|
||||
if(rating == UNRATED) thumb.setVisibility(INVISIBLE);
|
||||
else if(rating == BAD) thumb.setImageResource(R.drawable.rating_bad);
|
||||
else thumb.setImageResource(R.drawable.rating_unrated);
|
||||
header.addView(thumb);
|
||||
|
||||
TextView author = new TextView(this);
|
||||
@@ -367,15 +365,9 @@ implements OnClickListener {
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
rating = r;
|
||||
if(r == GOOD) {
|
||||
thumb.setImageResource(R.drawable.rating_good);
|
||||
thumb.setVisibility(VISIBLE);
|
||||
} else if(r == BAD) {
|
||||
thumb.setImageResource(R.drawable.rating_bad);
|
||||
thumb.setVisibility(VISIBLE);
|
||||
} else {
|
||||
thumb.setVisibility(INVISIBLE);
|
||||
}
|
||||
if(r == GOOD) thumb.setImageResource(R.drawable.rating_good);
|
||||
else if(r == BAD) thumb.setImageResource(R.drawable.rating_bad);
|
||||
else thumb.setImageResource(R.drawable.rating_unrated);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@ package net.sf.briar.android.contact;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
public class ContactNameComparator implements Comparator<ContactItem> {
|
||||
public class ContactItemComparator implements Comparator<ContactItem> {
|
||||
|
||||
public static final ContactNameComparator INSTANCE =
|
||||
new ContactNameComparator();
|
||||
public static final ContactItemComparator INSTANCE =
|
||||
new ContactItemComparator();
|
||||
|
||||
public int compare(ContactItem a, ContactItem b) {
|
||||
if(a == b) return 0;
|
||||
@@ -2,13 +2,12 @@ package net.sf.briar.android.groups;
|
||||
|
||||
import static android.graphics.Typeface.BOLD;
|
||||
import static android.view.Gravity.CENTER_VERTICAL;
|
||||
import static android.view.View.INVISIBLE;
|
||||
import static android.widget.LinearLayout.HORIZONTAL;
|
||||
import static android.widget.LinearLayout.VERTICAL;
|
||||
import static java.text.DateFormat.SHORT;
|
||||
import static net.sf.briar.android.widgets.CommonLayoutParams.WRAP_WRAP_1;
|
||||
import static net.sf.briar.api.messaging.Rating.BAD;
|
||||
import static net.sf.briar.api.messaging.Rating.GOOD;
|
||||
import static net.sf.briar.api.messaging.Rating.UNRATED;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -38,14 +37,12 @@ class GroupAdapter extends ArrayAdapter<GroupMessageHeader> {
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
GroupMessageHeader item = getItem(position);
|
||||
Context ctx = getContext();
|
||||
Resources res = ctx.getResources();
|
||||
|
||||
// FIXME: Use a RelativeLayout
|
||||
LinearLayout layout = new LinearLayout(ctx);
|
||||
layout.setOrientation(HORIZONTAL);
|
||||
if(!item.isRead()) {
|
||||
Resources res = ctx.getResources();
|
||||
if(!item.isRead())
|
||||
layout.setBackgroundColor(res.getColor(R.color.unread_background));
|
||||
}
|
||||
|
||||
LinearLayout innerLayout = new LinearLayout(ctx);
|
||||
// Give me all the unused width
|
||||
@@ -60,8 +57,8 @@ class GroupAdapter extends ArrayAdapter<GroupMessageHeader> {
|
||||
thumb.setPadding(10, 10, 10, 10);
|
||||
Rating rating = item.getRating();
|
||||
if(rating == GOOD) thumb.setImageResource(R.drawable.rating_good);
|
||||
else thumb.setImageResource(R.drawable.rating_bad);
|
||||
if(rating == UNRATED) thumb.setVisibility(INVISIBLE);
|
||||
else if(rating == BAD) thumb.setImageResource(R.drawable.rating_bad);
|
||||
else thumb.setImageResource(R.drawable.rating_unrated);
|
||||
authorLayout.addView(thumb);
|
||||
|
||||
TextView name = new TextView(ctx);
|
||||
@@ -71,7 +68,6 @@ class GroupAdapter extends ArrayAdapter<GroupMessageHeader> {
|
||||
name.setMaxLines(1);
|
||||
name.setPadding(0, 10, 10, 10);
|
||||
Author author = item.getAuthor();
|
||||
Resources res = ctx.getResources();
|
||||
if(author == null) {
|
||||
name.setTextColor(res.getColor(R.color.anonymous_author));
|
||||
name.setText(R.string.anonymous);
|
||||
|
||||
@@ -270,6 +270,7 @@ implements OnClickListener, DatabaseListener, NoGroupsDialog.Listener {
|
||||
GroupListItem item = findGroup(g);
|
||||
if(item != null) {
|
||||
adapter.remove(item);
|
||||
adapter.notifyDataSetChanged();
|
||||
selectFirstUnread();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ package net.sf.briar.android.groups;
|
||||
|
||||
import static android.view.Gravity.CENTER;
|
||||
import static android.view.Gravity.CENTER_VERTICAL;
|
||||
import static android.view.View.INVISIBLE;
|
||||
import static android.view.View.VISIBLE;
|
||||
import static android.widget.LinearLayout.HORIZONTAL;
|
||||
import static android.widget.LinearLayout.VERTICAL;
|
||||
import static java.text.DateFormat.SHORT;
|
||||
@@ -134,8 +132,8 @@ implements OnClickListener {
|
||||
thumb = new ImageView(this);
|
||||
thumb.setPadding(0, 10, 10, 10);
|
||||
if(rating == GOOD) thumb.setImageResource(R.drawable.rating_good);
|
||||
else thumb.setImageResource(R.drawable.rating_bad);
|
||||
if(rating == UNRATED) thumb.setVisibility(INVISIBLE);
|
||||
else if(rating == BAD) thumb.setImageResource(R.drawable.rating_bad);
|
||||
else thumb.setImageResource(R.drawable.rating_unrated);
|
||||
header.addView(thumb);
|
||||
|
||||
TextView author = new TextView(this);
|
||||
@@ -360,15 +358,9 @@ implements OnClickListener {
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
rating = r;
|
||||
if(r == GOOD) {
|
||||
thumb.setImageResource(R.drawable.rating_good);
|
||||
thumb.setVisibility(VISIBLE);
|
||||
} else if(r == BAD) {
|
||||
thumb.setImageResource(R.drawable.rating_bad);
|
||||
thumb.setVisibility(VISIBLE);
|
||||
} else {
|
||||
thumb.setVisibility(INVISIBLE);
|
||||
}
|
||||
if(r == GOOD) thumb.setImageResource(R.drawable.rating_good);
|
||||
else if(r == BAD) thumb.setImageResource(R.drawable.rating_bad);
|
||||
else thumb.setImageResource(R.drawable.rating_unrated);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import net.sf.briar.android.BriarActivity;
|
||||
import net.sf.briar.android.BriarService;
|
||||
import net.sf.briar.android.BriarService.BriarServiceConnection;
|
||||
import net.sf.briar.android.contact.ContactItem;
|
||||
import net.sf.briar.android.contact.ContactNameComparator;
|
||||
import net.sf.briar.android.contact.ContactItemComparator;
|
||||
import net.sf.briar.android.contact.ContactSpinnerAdapter;
|
||||
import net.sf.briar.android.invitation.AddContactActivity;
|
||||
import net.sf.briar.android.widgets.HorizontalSpace;
|
||||
@@ -180,7 +180,7 @@ implements OnItemSelectedListener, OnClickListener {
|
||||
if(contacts.isEmpty()) finish();
|
||||
adapter.clear();
|
||||
for(Contact c : contacts) adapter.add(new ContactItem(c));
|
||||
adapter.sort(ContactNameComparator.INSTANCE);
|
||||
adapter.sort(ContactItemComparator.INSTANCE);
|
||||
adapter.notifyDataSetChanged();
|
||||
int count = adapter.getCount();
|
||||
for(int i = 0; i < count; i++) {
|
||||
|
||||
Reference in New Issue
Block a user