mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
address issues found so far in code review
This commit is contained in:
@@ -3,6 +3,7 @@ package org.briarproject.android.contact;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
@@ -133,21 +134,24 @@ public class ConversationActivity extends BriarActivity
|
||||
list.setAdapter(adapter);
|
||||
list.setVisibility(GONE);
|
||||
// scroll down when opening keyboard
|
||||
list.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
|
||||
@Override
|
||||
public void onLayoutChange(View v,
|
||||
int left, int top, int right, int bottom,
|
||||
int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
||||
if (bottom < oldBottom) {
|
||||
list.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
list.scrollToPosition(adapter.getItemCount() - 1);
|
||||
}
|
||||
}, 100);
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
list.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
|
||||
@Override
|
||||
public void onLayoutChange(View v,
|
||||
int left, int top, int right, int bottom,
|
||||
int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
||||
if (bottom < oldBottom) {
|
||||
list.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
list.scrollToPosition(
|
||||
adapter.getItemCount() - 1);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
content = (EditText) findViewById(R.id.contentView);
|
||||
sendButton = (ImageButton) findViewById(R.id.sendButton);
|
||||
|
||||
@@ -121,8 +121,17 @@ class ConversationAdapter extends
|
||||
ui.status.setImageResource(R.drawable.message_stored);
|
||||
}
|
||||
} else if (!header.isRead()) {
|
||||
int bottom = ui.layout.getPaddingBottom();
|
||||
int top = ui.layout.getPaddingTop();
|
||||
int right = ui.layout.getPaddingRight();
|
||||
int left = ui.layout.getPaddingLeft();
|
||||
|
||||
// show unread messages in different color to not miss them
|
||||
ui.layout.setBackgroundResource(R.drawable.msg_in_unread);
|
||||
|
||||
// re-apply the previous padding due to bug in some Android versions
|
||||
// see: https://code.google.com/p/android/issues/detail?id=17885
|
||||
ui.layout.setPadding(left, top, right, bottom);
|
||||
}
|
||||
|
||||
if (item.getBody() == null) {
|
||||
@@ -150,12 +159,12 @@ class ConversationAdapter extends
|
||||
return messages.get(position);
|
||||
}
|
||||
|
||||
public void add(final ConversationItem contact) {
|
||||
this.messages.add(contact);
|
||||
public void add(final ConversationItem message) {
|
||||
this.messages.add(message);
|
||||
}
|
||||
|
||||
public void remove(final ConversationItem contact) {
|
||||
this.messages.remove(contact);
|
||||
public void remove(final ConversationItem message) {
|
||||
this.messages.remove(message);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
|
||||
Reference in New Issue
Block a user