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
|
||||
android:id="@+id/edit"
|
||||
android:src="@drawable/edit_list"
|
||||
android:src="@drawable/delete"
|
||||
android:background="@drawable/toolbar_button"
|
||||
android:contentDescription="@string/content_description_edit_list"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/edit"
|
||||
android:src="@drawable/edit_list"
|
||||
android:src="@drawable/delete"
|
||||
android:background="@drawable/toolbar_button"
|
||||
android:contentDescription="@string/content_description_edit_list"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/edit"
|
||||
android:src="@drawable/edit_list"
|
||||
android:src="@drawable/delete"
|
||||
android:background="@drawable/toolbar_button"
|
||||
android:contentDescription="@string/content_description_edit_list"
|
||||
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 {
|
||||
private RecyclerView contactsList;
|
||||
private TextView noSipContact, noContact;
|
||||
private ImageView allContacts, linphoneContacts, newContact, edit;
|
||||
private ImageView allContacts, linphoneContacts, newContact;
|
||||
private boolean onlyDisplayLinphoneContacts;
|
||||
private View allContactsSelected, linphoneContactsSelected;
|
||||
private int lastKnownPosition;
|
||||
|
@ -85,7 +85,6 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
|
|||
linphoneContacts = view.findViewById(R.id.linphone_contacts);
|
||||
allContactsSelected = view.findViewById(R.id.all_contacts_select);
|
||||
linphoneContactsSelected = view.findViewById(R.id.linphone_contacts_select);
|
||||
edit = view.findViewById(R.id.edit);
|
||||
contactsFetchInProgress = view.findViewById(R.id.contactsFetchInProgress);
|
||||
newContact = view.findViewById(R.id.newContact);
|
||||
|
||||
|
@ -247,7 +246,6 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
|
|||
mSelectionHelper.enterEditionMode();
|
||||
}
|
||||
contactsList.setAdapter(mContactAdapter);
|
||||
edit.setEnabled(true);
|
||||
|
||||
mContactAdapter.notifyDataSetChanged();
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ import java.util.List;
|
|||
public class HistoryListFragment extends Fragment implements OnClickListener, OnItemClickListener, CallHistoryAdapter.ViewHolder.ClickListener, ContactsUpdatedListener, SelectableHelper.DeleteListener {
|
||||
private RecyclerView historyList;
|
||||
private TextView noCallHistory, noMissedCallHistory;
|
||||
private ImageView missedCalls, allCalls, edit;
|
||||
private ImageView missedCalls, allCalls;
|
||||
private View allCallsSelected, missedCallsSelected;
|
||||
private boolean mOnlyDisplayMissedCalls;
|
||||
private List<CallLog> mLogs;
|
||||
|
@ -94,8 +94,6 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
allCalls.setEnabled(false);
|
||||
mOnlyDisplayMissedCalls = false;
|
||||
|
||||
edit = view.findViewById(R.id.edit);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -130,7 +128,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
}
|
||||
}
|
||||
|
||||
private boolean hideHistoryListAndDisplayMessageIfEmpty() {
|
||||
private void hideHistoryListAndDisplayMessageIfEmpty() {
|
||||
removeNotMissedCallsFromLogs();
|
||||
if (mLogs.isEmpty()) {
|
||||
if (mOnlyDisplayMissedCalls) {
|
||||
|
@ -139,14 +137,10 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
noCallHistory.setVisibility(View.VISIBLE);
|
||||
}
|
||||
historyList.setVisibility(View.GONE);
|
||||
edit.setEnabled(false);
|
||||
return true;
|
||||
} else {
|
||||
noCallHistory.setVisibility(View.GONE);
|
||||
noMissedCallHistory.setVisibility(View.GONE);
|
||||
historyList.setVisibility(View.VISIBLE);
|
||||
edit.setEnabled(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,13 +156,12 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
}
|
||||
|
||||
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
|
||||
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
|
||||
hideHistoryListAndDisplayMessageIfEmpty();
|
||||
mHistoryAdapter = new CallHistoryAdapter(getActivity().getApplicationContext(), mLogs, this, mSelectionHelper);
|
||||
historyList.setAdapter(mHistoryAdapter);
|
||||
mSelectionHelper.setAdapter(mHistoryAdapter);
|
||||
mSelectionHelper.setDialogMessage(R.string.chat_room_delete_dialog);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
|
@ -205,16 +198,13 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
missedCalls.setEnabled(false);
|
||||
mOnlyDisplayMissedCalls = true;
|
||||
}
|
||||
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
|
||||
// historyList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
hideHistoryListAndDisplayMessageIfEmpty();
|
||||
mHistoryAdapter = new CallHistoryAdapter(mContext, mLogs, this, mSelectionHelper);
|
||||
historyList.setAdapter(mHistoryAdapter);
|
||||
mSelectionHelper.setAdapter(mHistoryAdapter);
|
||||
mSelectionHelper.setDialogMessage(R.string.chat_room_delete_dialog);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
|
||||
if (mHistoryAdapter.isEditionEnabled()) {
|
||||
|
|
|
@ -62,6 +62,7 @@ public class SelectableHelper {
|
|||
});
|
||||
|
||||
mEditButton = view.findViewById(R.id.edit);
|
||||
mEditButton.setEnabled(false);
|
||||
|
||||
mEditButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -125,6 +126,7 @@ public class SelectableHelper {
|
|||
|
||||
public void setAdapter(SelectableAdapter adapter) {
|
||||
mAdapter = adapter;
|
||||
mEditButton.setEnabled(mAdapter.getItemCount() != 0);
|
||||
}
|
||||
|
||||
public void updateSelectionButtons(boolean isSelectionEmpty, boolean isSelectionFull) {
|
||||
|
|
Loading…
Reference in a new issue