Added no message notcie

This commit is contained in:
Pierre 2017-12-31 17:31:20 +01:00
parent 4d71757a92
commit fc9d09fcd4
3 changed files with 35 additions and 4 deletions

View File

@ -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<ConversationMessage> 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<Integer> 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);
}
}

View File

@ -11,6 +11,15 @@
android:layout_gravity="center"
android:layout_marginTop="10dp"/>
<!-- No message notice -->
<TextView
android:id="@+id/fragment_conversation_noMsgYet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/fragment_conversation_no_msg"
android:textAlignment="center"
android:layout_marginTop="10dp"/>
<!-- Messages -->
<ListView
android:id="@+id/fragment_conversation_messageslist"

View File

@ -73,4 +73,5 @@
<string name="popup_deleteconversation_confirm">Delete</string>
<string name="popup_deleteconversation_cancel">Cancel</string>
<string name="fragment_conversationslist_err_del_conversation">Could not delete conversation !</string>
<string name="fragment_conversation_no_msg">No message yet.</string>
</resources>