mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-27 15:59:29 +00:00
Display a notice if the user does not have any conversation
This commit is contained in:
parent
a77254d098
commit
226404a2c4
@ -17,6 +17,7 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.communiquons.android.comunic.client.ui.activities.MainActivity;
|
import org.communiquons.android.comunic.client.ui.activities.MainActivity;
|
||||||
@ -64,6 +65,11 @@ public class ConversationsListFragment extends Fragment implements AdapterView.O
|
|||||||
*/
|
*/
|
||||||
private ConversationsListHelper conversationsListHelper;
|
private ConversationsListHelper conversationsListHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* No conversation notice
|
||||||
|
*/
|
||||||
|
private TextView mNoConversationNotice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Conversations ListView
|
* Conversations ListView
|
||||||
*/
|
*/
|
||||||
@ -114,6 +120,10 @@ public class ConversationsListFragment extends Fragment implements AdapterView.O
|
|||||||
//Get progress bar wheel
|
//Get progress bar wheel
|
||||||
progressBar = view.findViewById(R.id.fragment_conversationslist_progressbar);
|
progressBar = view.findViewById(R.id.fragment_conversationslist_progressbar);
|
||||||
|
|
||||||
|
//Get no conversation notice
|
||||||
|
mNoConversationNotice = view.findViewById(R.id.no_conversation_notice);
|
||||||
|
mNoConversationNotice.setVisibility(View.GONE);
|
||||||
|
|
||||||
//Refresh conversations list
|
//Refresh conversations list
|
||||||
refresh_conversations_list();
|
refresh_conversations_list();
|
||||||
|
|
||||||
@ -307,6 +317,9 @@ public class ConversationsListFragment extends Fragment implements AdapterView.O
|
|||||||
|
|
||||||
//Remove progress bar
|
//Remove progress bar
|
||||||
display_progress_bar(false);
|
display_progress_bar(false);
|
||||||
|
|
||||||
|
//Update the visibility of the no conversation notice
|
||||||
|
updateNoConversationNotice();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -329,7 +342,7 @@ public class ConversationsListFragment extends Fragment implements AdapterView.O
|
|||||||
confirmDeleteConversation(convID);
|
confirmDeleteConversation(convID);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//To udpate the conversation
|
//To update the conversation
|
||||||
case R.id.menu_fragment_conversationslist_item_update:
|
case R.id.menu_fragment_conversationslist_item_update:
|
||||||
updateConversationListener.updateConversation(convID);
|
updateConversationListener.updateConversation(convID);
|
||||||
return true;
|
return true;
|
||||||
@ -403,6 +416,11 @@ public class ConversationsListFragment extends Fragment implements AdapterView.O
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Boolean result) {
|
protected void onPostExecute(Boolean result) {
|
||||||
|
|
||||||
|
//Check if the activity has been destroyed
|
||||||
|
if(getActivity() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
refresh_conversations_list();
|
refresh_conversations_list();
|
||||||
|
|
||||||
//Display a toast if an error occurred
|
//Display a toast if an error occurred
|
||||||
@ -413,4 +431,12 @@ public class ConversationsListFragment extends Fragment implements AdapterView.O
|
|||||||
}
|
}
|
||||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the visibility of the "no conversation" notice message
|
||||||
|
*/
|
||||||
|
private void updateNoConversationNotice(){
|
||||||
|
if(convList != null)
|
||||||
|
mNoConversationNotice.setVisibility(convList.size() == 0 ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,17 +15,17 @@ import android.widget.TextView;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.communiquons.android.comunic.client.R;
|
import org.communiquons.android.comunic.client.R;
|
||||||
import org.communiquons.android.comunic.client.data.helpers.DatabaseHelper;
|
|
||||||
import org.communiquons.android.comunic.client.data.helpers.ImageLoadHelper;
|
|
||||||
import org.communiquons.android.comunic.client.data.models.AdvancedUserInfo;
|
|
||||||
import org.communiquons.android.comunic.client.data.helpers.GetUsersHelper;
|
|
||||||
import org.communiquons.android.comunic.client.data.models.UserInfo;
|
|
||||||
import org.communiquons.android.comunic.client.data.models.Post;
|
|
||||||
import org.communiquons.android.comunic.client.data.helpers.PostsHelper;
|
|
||||||
import org.communiquons.android.comunic.client.data.arrays.PostsList;
|
import org.communiquons.android.comunic.client.data.arrays.PostsList;
|
||||||
|
import org.communiquons.android.comunic.client.data.helpers.DatabaseHelper;
|
||||||
|
import org.communiquons.android.comunic.client.data.helpers.GetUsersHelper;
|
||||||
|
import org.communiquons.android.comunic.client.data.helpers.ImageLoadHelper;
|
||||||
|
import org.communiquons.android.comunic.client.data.helpers.PostsHelper;
|
||||||
|
import org.communiquons.android.comunic.client.data.models.AdvancedUserInfo;
|
||||||
|
import org.communiquons.android.comunic.client.data.models.Post;
|
||||||
|
import org.communiquons.android.comunic.client.data.models.UserInfo;
|
||||||
|
import org.communiquons.android.comunic.client.ui.activities.MainActivity;
|
||||||
import org.communiquons.android.comunic.client.ui.listeners.onOpenUsersPageListener;
|
import org.communiquons.android.comunic.client.ui.listeners.onOpenUsersPageListener;
|
||||||
import org.communiquons.android.comunic.client.ui.utils.UiUtils;
|
import org.communiquons.android.comunic.client.ui.utils.UiUtils;
|
||||||
import org.communiquons.android.comunic.client.ui.activities.MainActivity;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User page fragment
|
* User page fragment
|
||||||
|
@ -11,6 +11,16 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"/>
|
android:layout_gravity="center"/>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- No conversation notice -->
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/no_conversation_notice"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/notice_no_conversation"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="10dp"/>
|
||||||
|
|
||||||
<!-- List of the conversations -->
|
<!-- List of the conversations -->
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@+id/fragment_conversationslist_list"
|
android:id="@+id/fragment_conversationslist_list"
|
||||||
|
@ -175,4 +175,5 @@
|
|||||||
<string name="err_get_post_info">An error occurred while trying to get post information!</string>
|
<string name="err_get_post_info">An error occurred while trying to get post information!</string>
|
||||||
<string name="notice_no_notification">You do not have any notification yet.</string>
|
<string name="notice_no_notification">You do not have any notification yet.</string>
|
||||||
<string name="notice_no_post_user_page">There is not any post on this page yet.</string>
|
<string name="notice_no_post_user_page">There is not any post on this page yet.</string>
|
||||||
|
<string name="notice_no_conversation">You do not have any conversation yet.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user