Layout tweaks for ConversationActivity.

This commit is contained in:
akwizgran
2015-12-15 17:08:23 +00:00
parent bab9a41981
commit b6c9544373
2 changed files with 12 additions and 7 deletions

View File

@@ -10,10 +10,10 @@
<ProgressBar
android:id="@+id/listLoadingProgressBar"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_gravity="center"
android:gravity="center"
android:layout_weight="1"
android:indeterminate="true"/>
@@ -23,6 +23,7 @@
android:layout_height="0dp"
android:layout_weight="1"
android:layout_gravity="center"
android:gravity="center"
android:padding="@dimen/margin_large"
android:textSize="@dimen/text_size_large"
android:text="@string/no_private_messages"/>

View File

@@ -65,6 +65,7 @@ import java.util.logging.Logger;
import javax.inject.Inject;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import static java.util.logging.Level.INFO;
import static java.util.logging.Level.WARNING;
import static org.briarproject.android.contact.ReadPrivateMessageActivity.RESULT_PREV_NEXT;
@@ -82,9 +83,9 @@ implements EventListener, OnClickListener, OnItemClickListener {
@Inject @CryptoExecutor private Executor cryptoExecutor;
private Map<MessageId, byte[]> bodyCache = new HashMap<MessageId, byte[]>();
private TextView empty = null;
private ProgressBar loading = null;
private ConversationAdapter adapter = null;
private ListView list = null;
private ProgressBar loading = null;
private EditText content = null;
private ImageButton sendButton = null;
@@ -115,6 +116,10 @@ implements EventListener, OnClickListener, OnItemClickListener {
setContentView(R.layout.activity_conversation);
ViewGroup layout = (ViewGroup) findViewById(R.id.layout);
empty = (TextView) findViewById(R.id.emptyView);
empty.setVisibility(GONE);
// Show a progress bar while the list is loading
loading = (ProgressBar) findViewById(R.id.listLoadingProgressBar);
loading.setVisibility(VISIBLE);
adapter = new ConversationAdapter(this);
list = new ListView(this) {
@@ -136,12 +141,9 @@ implements EventListener, OnClickListener, OnItemClickListener {
list.setDividerHeight(pad);
list.setAdapter(adapter);
list.setOnItemClickListener(this);
list.setEmptyView(empty);
list.setEmptyView(loading);
layout.addView(list, 0);
// Show a progress bar while the list is loading
loading = (ProgressBar) findViewById(R.id.listLoadingProgressBar);
content = (EditText) findViewById(R.id.contentView);
sendButton = (ImageButton) findViewById(R.id.sendButton);
sendButton.setEnabled(false); // Enabled after loading the group
@@ -226,6 +228,8 @@ implements EventListener, OnClickListener, OnItemClickListener {
runOnUiThread(new Runnable() {
public void run() {
loading.setVisibility(GONE);
empty.setVisibility(VISIBLE);
list.setEmptyView(empty);
displayContactDetails();
sendButton.setEnabled(true);
adapter.clear();