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