mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
Launch appropriate activity when replying to a group/blog post.
This commit is contained in:
@@ -4,6 +4,8 @@ import static android.view.Gravity.CENTER_HORIZONTAL;
|
||||
import static android.widget.LinearLayout.VERTICAL;
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
import static net.sf.briar.android.groups.ReadGroupMessageActivity.RESULT_NEXT;
|
||||
import static net.sf.briar.android.groups.ReadGroupMessageActivity.RESULT_PREV;
|
||||
import static net.sf.briar.android.widgets.CommonLayoutParams.MATCH_MATCH;
|
||||
import static net.sf.briar.android.widgets.CommonLayoutParams.MATCH_WRAP_1;
|
||||
|
||||
@@ -162,11 +164,11 @@ OnClickListener, OnItemClickListener {
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int request, int result, Intent data) {
|
||||
if(result == ReadGroupMessageActivity.RESULT_PREV) {
|
||||
if(result == RESULT_PREV) {
|
||||
int position = request - 1;
|
||||
if(position >= 0 && position < adapter.getCount())
|
||||
displayMessage(position);
|
||||
} else if(result == ReadGroupMessageActivity.RESULT_NEXT) {
|
||||
} else if(result == RESULT_NEXT) {
|
||||
int position = request + 1;
|
||||
if(position >= 0 && position < adapter.getCount())
|
||||
displayMessage(position);
|
||||
@@ -227,6 +229,7 @@ OnClickListener, OnItemClickListener {
|
||||
private void displayMessage(int position) {
|
||||
GroupMessageHeader item = adapter.getItem(position);
|
||||
Intent i = new Intent(this, ReadGroupMessageActivity.class);
|
||||
i.putExtra("net.sf.briar.RESTRICTED", restricted);
|
||||
i.putExtra("net.sf.briar.GROUP_ID", groupId.getBytes());
|
||||
i.putExtra("net.sf.briar.GROUP_NAME", groupName);
|
||||
i.putExtra("net.sf.briar.MESSAGE_ID", item.getId().getBytes());
|
||||
|
||||
@@ -63,6 +63,7 @@ implements OnClickListener {
|
||||
new BriarServiceConnection();
|
||||
|
||||
@Inject private BundleEncrypter bundleEncrypter;
|
||||
private boolean restricted = false;
|
||||
private GroupId groupId = null;
|
||||
private Rating rating = UNRATED;
|
||||
private boolean read;
|
||||
@@ -83,6 +84,7 @@ implements OnClickListener {
|
||||
super.onCreate(null);
|
||||
|
||||
Intent i = getIntent();
|
||||
restricted = i.getBooleanExtra("net.sf.briar.RESTRICTED", false);
|
||||
byte[] b = i.getByteArrayExtra("net.sf.briar.GROUP_ID");
|
||||
if(b == null) throw new IllegalStateException();
|
||||
groupId = new GroupId(b);
|
||||
@@ -325,11 +327,17 @@ implements OnClickListener {
|
||||
setResult(RESULT_NEXT);
|
||||
finish();
|
||||
} else if(view == replyButton) {
|
||||
// FIXME: Restricted/unrestricted
|
||||
Intent i = new Intent(this, WriteGroupPostActivity.class);
|
||||
i.putExtra("net.sf.briar.GROUP_ID", groupId.getBytes());
|
||||
i.putExtra("net.sf.briar.PARENT_ID", messageId.getBytes());
|
||||
startActivity(i);
|
||||
if(restricted) {
|
||||
Intent i = new Intent(this, WriteBlogPostActivity.class);
|
||||
i.putExtra("net.sf.briar.GROUP_ID", groupId.getBytes());
|
||||
i.putExtra("net.sf.briar.PARENT_ID", messageId.getBytes());
|
||||
startActivity(i);
|
||||
} else {
|
||||
Intent i = new Intent(this, WriteGroupPostActivity.class);
|
||||
i.putExtra("net.sf.briar.GROUP_ID", groupId.getBytes());
|
||||
i.putExtra("net.sf.briar.PARENT_ID", messageId.getBytes());
|
||||
startActivity(i);
|
||||
}
|
||||
setResult(RESULT_REPLY);
|
||||
finish();
|
||||
}
|
||||
@@ -361,7 +369,7 @@ implements OnClickListener {
|
||||
private void setRatingInUi(final Rating r) {
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
ReadGroupMessageActivity.this.rating = r;
|
||||
rating = r;
|
||||
if(r == GOOD) {
|
||||
thumb.setImageResource(R.drawable.rating_good);
|
||||
thumb.setVisibility(VISIBLE);
|
||||
|
||||
Reference in New Issue
Block a user