Replaced list selection icon by trash icon + disable icon if list is empty
This commit is contained in:
parent
3dc3bf509e
commit
21b1659d2e
6 changed files with 18 additions and 28 deletions
|
@ -54,7 +54,7 @@
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/edit"
|
android:id="@+id/edit"
|
||||||
android:src="@drawable/edit_list"
|
android:src="@drawable/delete"
|
||||||
android:background="@drawable/toolbar_button"
|
android:background="@drawable/toolbar_button"
|
||||||
android:contentDescription="@string/content_description_edit_list"
|
android:contentDescription="@string/content_description_edit_list"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/edit"
|
android:id="@+id/edit"
|
||||||
android:src="@drawable/edit_list"
|
android:src="@drawable/delete"
|
||||||
android:background="@drawable/toolbar_button"
|
android:background="@drawable/toolbar_button"
|
||||||
android:contentDescription="@string/content_description_edit_list"
|
android:contentDescription="@string/content_description_edit_list"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/edit"
|
android:id="@+id/edit"
|
||||||
android:src="@drawable/edit_list"
|
android:src="@drawable/delete"
|
||||||
android:background="@drawable/toolbar_button"
|
android:background="@drawable/toolbar_button"
|
||||||
android:contentDescription="@string/content_description_edit_list"
|
android:contentDescription="@string/content_description_edit_list"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
|
@ -50,7 +50,7 @@ import java.util.List;
|
||||||
public class ContactsListFragment extends Fragment implements OnItemClickListener, ContactsUpdatedListener, ContactsListAdapter.ViewHolder.ClickListener, SelectableHelper.DeleteListener {
|
public class ContactsListFragment extends Fragment implements OnItemClickListener, ContactsUpdatedListener, ContactsListAdapter.ViewHolder.ClickListener, SelectableHelper.DeleteListener {
|
||||||
private RecyclerView contactsList;
|
private RecyclerView contactsList;
|
||||||
private TextView noSipContact, noContact;
|
private TextView noSipContact, noContact;
|
||||||
private ImageView allContacts, linphoneContacts, newContact, edit;
|
private ImageView allContacts, linphoneContacts, newContact;
|
||||||
private boolean onlyDisplayLinphoneContacts;
|
private boolean onlyDisplayLinphoneContacts;
|
||||||
private View allContactsSelected, linphoneContactsSelected;
|
private View allContactsSelected, linphoneContactsSelected;
|
||||||
private int lastKnownPosition;
|
private int lastKnownPosition;
|
||||||
|
@ -85,7 +85,6 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
|
||||||
linphoneContacts = view.findViewById(R.id.linphone_contacts);
|
linphoneContacts = view.findViewById(R.id.linphone_contacts);
|
||||||
allContactsSelected = view.findViewById(R.id.all_contacts_select);
|
allContactsSelected = view.findViewById(R.id.all_contacts_select);
|
||||||
linphoneContactsSelected = view.findViewById(R.id.linphone_contacts_select);
|
linphoneContactsSelected = view.findViewById(R.id.linphone_contacts_select);
|
||||||
edit = view.findViewById(R.id.edit);
|
|
||||||
contactsFetchInProgress = view.findViewById(R.id.contactsFetchInProgress);
|
contactsFetchInProgress = view.findViewById(R.id.contactsFetchInProgress);
|
||||||
newContact = view.findViewById(R.id.newContact);
|
newContact = view.findViewById(R.id.newContact);
|
||||||
|
|
||||||
|
@ -247,7 +246,6 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
|
||||||
mSelectionHelper.enterEditionMode();
|
mSelectionHelper.enterEditionMode();
|
||||||
}
|
}
|
||||||
contactsList.setAdapter(mContactAdapter);
|
contactsList.setAdapter(mContactAdapter);
|
||||||
edit.setEnabled(true);
|
|
||||||
|
|
||||||
mContactAdapter.notifyDataSetChanged();
|
mContactAdapter.notifyDataSetChanged();
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ import java.util.List;
|
||||||
public class HistoryListFragment extends Fragment implements OnClickListener, OnItemClickListener, CallHistoryAdapter.ViewHolder.ClickListener, ContactsUpdatedListener, SelectableHelper.DeleteListener {
|
public class HistoryListFragment extends Fragment implements OnClickListener, OnItemClickListener, CallHistoryAdapter.ViewHolder.ClickListener, ContactsUpdatedListener, SelectableHelper.DeleteListener {
|
||||||
private RecyclerView historyList;
|
private RecyclerView historyList;
|
||||||
private TextView noCallHistory, noMissedCallHistory;
|
private TextView noCallHistory, noMissedCallHistory;
|
||||||
private ImageView missedCalls, allCalls, edit;
|
private ImageView missedCalls, allCalls;
|
||||||
private View allCallsSelected, missedCallsSelected;
|
private View allCallsSelected, missedCallsSelected;
|
||||||
private boolean mOnlyDisplayMissedCalls;
|
private boolean mOnlyDisplayMissedCalls;
|
||||||
private List<CallLog> mLogs;
|
private List<CallLog> mLogs;
|
||||||
|
@ -94,8 +94,6 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
||||||
allCalls.setEnabled(false);
|
allCalls.setEnabled(false);
|
||||||
mOnlyDisplayMissedCalls = false;
|
mOnlyDisplayMissedCalls = false;
|
||||||
|
|
||||||
edit = view.findViewById(R.id.edit);
|
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +128,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hideHistoryListAndDisplayMessageIfEmpty() {
|
private void hideHistoryListAndDisplayMessageIfEmpty() {
|
||||||
removeNotMissedCallsFromLogs();
|
removeNotMissedCallsFromLogs();
|
||||||
if (mLogs.isEmpty()) {
|
if (mLogs.isEmpty()) {
|
||||||
if (mOnlyDisplayMissedCalls) {
|
if (mOnlyDisplayMissedCalls) {
|
||||||
|
@ -139,14 +137,10 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
||||||
noCallHistory.setVisibility(View.VISIBLE);
|
noCallHistory.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
historyList.setVisibility(View.GONE);
|
historyList.setVisibility(View.GONE);
|
||||||
edit.setEnabled(false);
|
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
noCallHistory.setVisibility(View.GONE);
|
noCallHistory.setVisibility(View.GONE);
|
||||||
noMissedCallHistory.setVisibility(View.GONE);
|
noMissedCallHistory.setVisibility(View.GONE);
|
||||||
historyList.setVisibility(View.VISIBLE);
|
historyList.setVisibility(View.VISIBLE);
|
||||||
edit.setEnabled(true);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,12 +156,11 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
||||||
}
|
}
|
||||||
|
|
||||||
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
|
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
|
||||||
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
|
hideHistoryListAndDisplayMessageIfEmpty();
|
||||||
mHistoryAdapter = new CallHistoryAdapter(getActivity().getApplicationContext(), mLogs, this, mSelectionHelper);
|
mHistoryAdapter = new CallHistoryAdapter(getActivity().getApplicationContext(), mLogs, this, mSelectionHelper);
|
||||||
historyList.setAdapter(mHistoryAdapter);
|
historyList.setAdapter(mHistoryAdapter);
|
||||||
mSelectionHelper.setAdapter(mHistoryAdapter);
|
mSelectionHelper.setAdapter(mHistoryAdapter);
|
||||||
mSelectionHelper.setDialogMessage(R.string.chat_room_delete_dialog);
|
mSelectionHelper.setDialogMessage(R.string.chat_room_delete_dialog);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -205,14 +198,11 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
||||||
missedCalls.setEnabled(false);
|
missedCalls.setEnabled(false);
|
||||||
mOnlyDisplayMissedCalls = true;
|
mOnlyDisplayMissedCalls = true;
|
||||||
}
|
}
|
||||||
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
|
hideHistoryListAndDisplayMessageIfEmpty();
|
||||||
// historyList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
mHistoryAdapter = new CallHistoryAdapter(mContext, mLogs, this, mSelectionHelper);
|
||||||
mHistoryAdapter = new CallHistoryAdapter(mContext, mLogs, this, mSelectionHelper);
|
historyList.setAdapter(mHistoryAdapter);
|
||||||
historyList.setAdapter(mHistoryAdapter);
|
mSelectionHelper.setAdapter(mHistoryAdapter);
|
||||||
mSelectionHelper.setAdapter(mHistoryAdapter);
|
mSelectionHelper.setDialogMessage(R.string.chat_room_delete_dialog);
|
||||||
mSelectionHelper.setDialogMessage(R.string.chat_room_delete_dialog);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -62,6 +62,7 @@ public class SelectableHelper {
|
||||||
});
|
});
|
||||||
|
|
||||||
mEditButton = view.findViewById(R.id.edit);
|
mEditButton = view.findViewById(R.id.edit);
|
||||||
|
mEditButton.setEnabled(false);
|
||||||
|
|
||||||
mEditButton.setOnClickListener(new View.OnClickListener() {
|
mEditButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -125,6 +126,7 @@ public class SelectableHelper {
|
||||||
|
|
||||||
public void setAdapter(SelectableAdapter adapter) {
|
public void setAdapter(SelectableAdapter adapter) {
|
||||||
mAdapter = adapter;
|
mAdapter = adapter;
|
||||||
|
mEditButton.setEnabled(mAdapter.getItemCount() != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateSelectionButtons(boolean isSelectionEmpty, boolean isSelectionFull) {
|
public void updateSelectionButtons(boolean isSelectionEmpty, boolean isSelectionFull) {
|
||||||
|
|
Loading…
Reference in a new issue