From fc9d09fcd440d612b6573bd1342a72964ef1e4e0 Mon Sep 17 00:00:00 2001 From: Pierre Date: Sun, 31 Dec 2017 17:31:20 +0100 Subject: [PATCH] Added no message notcie --- .../fragments/ConversationFragment.java | 29 ++++++++++++++++--- .../main/res/layout/fragment_conversation.xml | 9 ++++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/communiquons/android/comunic/client/fragments/ConversationFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/fragments/ConversationFragment.java index f610926..1404947 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/fragments/ConversationFragment.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/fragments/ConversationFragment.java @@ -19,6 +19,7 @@ import android.widget.EditText; import android.widget.ImageButton; import android.widget.ListView; import android.widget.ProgressBar; +import android.widget.TextView; import android.widget.Toast; import org.communiquons.android.comunic.client.MainActivity; @@ -34,6 +35,7 @@ import org.communiquons.android.comunic.client.data.conversations.ConversationRe import org.communiquons.android.comunic.client.data.conversations.ConversationsInfo; import org.communiquons.android.comunic.client.data.conversations.ConversationsListHelper; import org.communiquons.android.comunic.client.data.utils.BitmapUtils; +import org.w3c.dom.Text; import java.io.FileNotFoundException; import java.io.InputStream; @@ -103,6 +105,11 @@ public class ConversationFragment extends Fragment */ private ProgressBar main_progress_bar; + /** + * No message yet notice + */ + private TextView no_msg_notice; + /** * Converstion message listView */ @@ -176,9 +183,6 @@ public class ConversationFragment extends Fragment throw new RuntimeException(TAG + " requires a valid conversation ID when created !"); } - //Get information about the conversation - - } @Override @@ -209,6 +213,10 @@ public class ConversationFragment extends Fragment main_progress_bar = view.findViewById(R.id.fragment_conversation_progressbar); display_main_progress_bar(true); + //No message notice + no_msg_notice = view.findViewById(R.id.fragment_conversation_noMsgYet); + display_not_msg_notice(false); + //Conversation messages listView convMessListView = view.findViewById(R.id.fragment_conversation_messageslist); @@ -308,13 +316,17 @@ public class ConversationFragment extends Fragment //Hide main progress bar display_main_progress_bar(false); + //Display no message notice + display_not_msg_notice(true); + } @Override public void onAddMessage(int lastID, @NonNull ArrayList newMessages) { - //Remove main progress bar + //Remove main progress bar and no message notice display_main_progress_bar(false); + display_not_msg_notice(false); final ArrayList usersToFetch = new ArrayList<>(); @@ -549,4 +561,13 @@ public class ConversationFragment extends Fragment private void display_main_progress_bar(boolean visible){ main_progress_bar.setVisibility(visible ? View.VISIBLE : View.GONE); } + + /** + * Update the visibility status of the "no message notice" + * + * @param visible True to make the progress bar visible + */ + private void display_not_msg_notice(boolean visible){ + no_msg_notice.setVisibility(visible ? View.VISIBLE : View.GONE); + } } diff --git a/app/src/main/res/layout/fragment_conversation.xml b/app/src/main/res/layout/fragment_conversation.xml index e222e45..a83d675 100644 --- a/app/src/main/res/layout/fragment_conversation.xml +++ b/app/src/main/res/layout/fragment_conversation.xml @@ -11,6 +11,15 @@ android:layout_gravity="center" android:layout_marginTop="10dp"/> + + + Delete Cancel Could not delete conversation ! + No message yet.