Improved labels when lists are empty

This commit is contained in:
Sylvain Berfini 2018-11-25 20:47:44 +01:00
parent 94f792c6e5
commit 93b26bfdaf
4 changed files with 98 additions and 84 deletions

View file

@ -30,6 +30,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import org.linphone.LinphoneManager;
import org.linphone.R;
@ -63,8 +64,9 @@ public class ChatRoomsFragment extends Fragment implements ContactsUpdatedListen
private int mChatRoomDeletionPendingCount;
private ChatRoomListenerStub mChatRoomListener;
private Context mContext;
public List<ChatRoom> mRooms;
private List<ChatRoom> mRooms;
private SelectableHelper mSelectionHelper;
private TextView mNoChatHistory;
@Override
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -80,6 +82,7 @@ public class ChatRoomsFragment extends Fragment implements ContactsUpdatedListen
mNewDiscussionButton = view.findViewById(R.id.new_discussion);
mNewGroupDiscussionButton = view.findViewById(R.id.new_group_discussion);
mBackToCallButton = view.findViewById(R.id.back_in_call);
mNoChatHistory = view.findViewById(R.id.noChatHistory);
mSelectionHelper = new SelectableHelper(view, this);
mChatRoomsAdapter = new ChatRoomsAdapter(mContext, R.layout.chatlist_cell, mRooms, this, mSelectionHelper);
@ -175,7 +178,7 @@ public class ChatRoomsFragment extends Fragment implements ContactsUpdatedListen
private void refreshChatRoomsList() {
mChatRoomsAdapter.refresh();
//mNoChatHistory.setVisibility(mChatRoomsAdapter.getItemCount() == 0 ? View.VISIBLE : View.GONE);
mNoChatHistory.setVisibility(mChatRoomsAdapter.getItemCount() == 0 ? View.VISIBLE : View.GONE);
}
public void displayFirstChat() {

View file

@ -130,6 +130,9 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
private void hideHistoryListAndDisplayMessageIfEmpty() {
removeNotMissedCallsFromLogs();
noCallHistory.setVisibility(View.GONE);
noMissedCallHistory.setVisibility(View.GONE);
if (mLogs.isEmpty()) {
if (mOnlyDisplayMissedCalls) {
noMissedCallHistory.setVisibility(View.VISIBLE);

View file

@ -7,7 +7,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorH"
android:orientation="vertical" >
android:orientation="vertical">
<LinearLayout
android:id="@+id/top_bar"
@ -80,9 +80,9 @@
android:text="@string/no_chat_history"
style="@style/font6"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
<include layout="@layout/wait_layout" android:id="@+id/waitScreen"/>

View file

@ -1,105 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorH"
android:orientation="vertical" >
android:background="@color/colorH">
<LinearLayout
android:id="@+id/top_bar"
android:orientation="horizontal"
android:background="@color/colorF"
android:layout_width="match_parent"
android:layout_height="60dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorH"
android:orientation="vertical">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2">
<LinearLayout
android:id="@+id/top_bar"
android:orientation="horizontal"
android:background="@color/colorF"
android:layout_width="match_parent"
android:layout_height="60dp">
<ImageView
android:id="@+id/all_calls"
android:src="@drawable/history_all"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_all_contacts"
android:padding="15dp"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2">
<View
android:id="@+id/all_calls_select"
android:background="@color/colorA"
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
<ImageView
android:id="@+id/all_calls"
android:src="@drawable/history_all"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_all_contacts"
android:padding="15dp"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2">
<View
android:id="@+id/all_calls_select"
android:background="@color/colorA"
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
<ImageView
android:id="@+id/missed_calls"
android:src="@drawable/history_missed"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_linphone_contacts"
android:gravity="center"
android:padding="15dp"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2">
<View
android:id="@+id/missed_calls_select"
android:background="@color/colorA"
android:layout_width="match_parent"
android:layout_height="5dp"
android:visibility="gone"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
<ImageView
android:id="@+id/missed_calls"
android:src="@drawable/history_missed"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_linphone_contacts"
android:gravity="center"
android:padding="15dp"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.4"/>
<View
android:id="@+id/missed_calls_select"
android:background="@color/colorA"
android:layout_width="match_parent"
android:layout_height="5dp"
android:visibility="gone"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
<ImageView
android:id="@+id/edit"
android:src="@drawable/delete"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_edit_list"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:padding="15dp"/>
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.4"/>
<include layout="@layout/edit_list"/>
<ImageView
android:id="@+id/edit"
android:src="@drawable/delete"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_edit_list"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:padding="15dp"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/history_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@color/colorE"
android:cacheColorHint="@color/transparent"
android:dividerHeight="1dp" />
</LinearLayout>
<include layout="@layout/edit_list"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/history_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@color/colorE"
android:cacheColorHint="@color/transparent"
android:dividerHeight="1dp" />
</LinearLayout>
<TextView
android:id="@+id/no_call_history"
android:text="@string/no_call_history"
style="@style/font6"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
<TextView
android:id="@+id/no_missed_call_history"
android:text="@string/no_missed_call_history"
style="@style/font6"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
</LinearLayout>
</RelativeLayout>