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

@ -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,5 +1,10 @@
<?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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorH"
@ -72,6 +77,7 @@
android:layout_height="match_parent"
android:layout_weight="0.2"
android:padding="15dp"/>
</LinearLayout>
<include layout="@layout/edit_list"/>
@ -84,22 +90,24 @@
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>