Skip to content
Snippets Groups Projects
Commit 3e310925 authored by akwizgran's avatar akwizgran
Browse files

Merge branch 'conversation-layout-tweaks' into 'master'

Layout tweaks for ConversationActivity.

Centre the progress wheel and empty list message, hide the empty list message until the list has loaded.

See merge request !26
parents 6dd64ed0 b6c95443
No related branches found
No related tags found
No related merge requests found
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
<ProgressBar <ProgressBar
android:id="@+id/listLoadingProgressBar" android:id="@+id/listLoadingProgressBar"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center"
android:gravity="center"
android:layout_weight="1" android:layout_weight="1"
android:indeterminate="true"/> android:indeterminate="true"/>
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center"
android:padding="@dimen/margin_large" android:padding="@dimen/margin_large"
android:textSize="@dimen/text_size_large" android:textSize="@dimen/text_size_large"
android:text="@string/no_private_messages"/> android:text="@string/no_private_messages"/>
......
...@@ -64,6 +64,7 @@ import java.util.logging.Logger; ...@@ -64,6 +64,7 @@ import java.util.logging.Logger;
import javax.inject.Inject; import javax.inject.Inject;
import static android.view.View.GONE; 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.INFO;
import static java.util.logging.Level.WARNING; import static java.util.logging.Level.WARNING;
import static org.briarproject.android.contact.ReadPrivateMessageActivity.RESULT_PREV_NEXT; import static org.briarproject.android.contact.ReadPrivateMessageActivity.RESULT_PREV_NEXT;
...@@ -81,9 +82,9 @@ implements EventListener, OnClickListener, OnItemClickListener { ...@@ -81,9 +82,9 @@ implements EventListener, OnClickListener, OnItemClickListener {
@Inject @CryptoExecutor private Executor cryptoExecutor; @Inject @CryptoExecutor private Executor cryptoExecutor;
private Map<MessageId, byte[]> bodyCache = new HashMap<MessageId, byte[]>(); private Map<MessageId, byte[]> bodyCache = new HashMap<MessageId, byte[]>();
private TextView empty = null; private TextView empty = null;
private ProgressBar loading = null;
private ConversationAdapter adapter = null; private ConversationAdapter adapter = null;
private ListView list = null; private ListView list = null;
private ProgressBar loading = null;
private EditText content = null; private EditText content = null;
private ImageButton sendButton = null; private ImageButton sendButton = null;
...@@ -114,6 +115,10 @@ implements EventListener, OnClickListener, OnItemClickListener { ...@@ -114,6 +115,10 @@ implements EventListener, OnClickListener, OnItemClickListener {
setContentView(R.layout.activity_conversation); setContentView(R.layout.activity_conversation);
ViewGroup layout = (ViewGroup) findViewById(R.id.layout); ViewGroup layout = (ViewGroup) findViewById(R.id.layout);
empty = (TextView) findViewById(R.id.emptyView); 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); adapter = new ConversationAdapter(this);
list = new ListView(this) { list = new ListView(this) {
...@@ -135,12 +140,9 @@ implements EventListener, OnClickListener, OnItemClickListener { ...@@ -135,12 +140,9 @@ implements EventListener, OnClickListener, OnItemClickListener {
list.setDividerHeight(pad); list.setDividerHeight(pad);
list.setAdapter(adapter); list.setAdapter(adapter);
list.setOnItemClickListener(this); list.setOnItemClickListener(this);
list.setEmptyView(empty); list.setEmptyView(loading);
layout.addView(list, 0); 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); content = (EditText) findViewById(R.id.contentView);
sendButton = (ImageButton) findViewById(R.id.sendButton); sendButton = (ImageButton) findViewById(R.id.sendButton);
sendButton.setEnabled(false); // Enabled after loading the group sendButton.setEnabled(false); // Enabled after loading the group
...@@ -225,6 +227,8 @@ implements EventListener, OnClickListener, OnItemClickListener { ...@@ -225,6 +227,8 @@ implements EventListener, OnClickListener, OnItemClickListener {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
public void run() { public void run() {
loading.setVisibility(GONE); loading.setVisibility(GONE);
empty.setVisibility(VISIBLE);
list.setEmptyView(empty);
displayContactDetails(); displayContactDetails();
sendButton.setEnabled(true); sendButton.setEnabled(true);
adapter.clear(); adapter.clear();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment