Put code for call history in the same place
This commit is contained in:
parent
a9035665d4
commit
c913577f93
4 changed files with 18 additions and 17 deletions
|
@ -101,8 +101,8 @@ import org.linphone.settings.AccountPreferencesFragment;
|
|||
import org.linphone.fragments.DialerFragment;
|
||||
import org.linphone.fragments.EmptyFragment;
|
||||
import org.linphone.fragments.FragmentsAvailable;
|
||||
import org.linphone.fragments.HistoryDetailFragment;
|
||||
import org.linphone.fragments.HistoryListFragment;
|
||||
import org.linphone.history.HistoryDetailFragment;
|
||||
import org.linphone.history.HistoryListFragment;
|
||||
import org.linphone.settings.SettingsFragment;
|
||||
import org.linphone.fragments.StatusFragment;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone.call;
|
||||
package org.linphone.history;
|
||||
|
||||
/*
|
||||
CallHistoryAdapter.java
|
||||
HistoryAdapter.java
|
||||
Copyright (C) 2018 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
|
@ -48,7 +48,7 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
public class CallHistoryAdapter extends SelectableAdapter<CallHistoryAdapter.ViewHolder> {
|
||||
public class HistoryAdapter extends SelectableAdapter<HistoryAdapter.ViewHolder> {
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener,
|
||||
View.OnLongClickListener {
|
||||
public TextView contact;
|
||||
|
@ -59,9 +59,9 @@ public class CallHistoryAdapter extends SelectableAdapter<CallHistoryAdapter.Vie
|
|||
public RelativeLayout CallContact;
|
||||
public LinearLayout separator;
|
||||
public TextView separatorText;
|
||||
private CallHistoryAdapter.ViewHolder.ClickListener mListener;
|
||||
private HistoryAdapter.ViewHolder.ClickListener mListener;
|
||||
|
||||
public ViewHolder(View view, CallHistoryAdapter.ViewHolder.ClickListener listener) {
|
||||
public ViewHolder(View view, HistoryAdapter.ViewHolder.ClickListener listener) {
|
||||
super(view);
|
||||
contact = view.findViewById(R.id.sip_uri);
|
||||
detail = view.findViewById(R.id.detail);
|
||||
|
@ -100,9 +100,9 @@ public class CallHistoryAdapter extends SelectableAdapter<CallHistoryAdapter.Vie
|
|||
|
||||
private List<CallLog> mLogs;
|
||||
private Context mContext;
|
||||
private CallHistoryAdapter.ViewHolder.ClickListener clickListener;
|
||||
private HistoryAdapter.ViewHolder.ClickListener clickListener;
|
||||
|
||||
public CallHistoryAdapter(Context aContext, List<CallLog> logs, CallHistoryAdapter.ViewHolder.ClickListener listener, SelectableHelper helper) {
|
||||
public HistoryAdapter(Context aContext, List<CallLog> logs, HistoryAdapter.ViewHolder.ClickListener listener, SelectableHelper helper) {
|
||||
super(helper);
|
||||
this.mLogs = logs;
|
||||
this.mContext = aContext;
|
|
@ -1,4 +1,4 @@
|
|||
package org.linphone.fragments;
|
||||
package org.linphone.history;
|
||||
|
||||
/*
|
||||
HistoryDetailFragment.java
|
||||
|
@ -31,6 +31,7 @@ import android.widget.RelativeLayout;
|
|||
import android.widget.TextView;
|
||||
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.fragments.FragmentsAvailable;
|
||||
import org.linphone.settings.LinphonePreferences;
|
||||
import org.linphone.utils.ImageUtils;
|
||||
import org.linphone.utils.LinphoneUtils;
|
|
@ -1,4 +1,4 @@
|
|||
package org.linphone.fragments;
|
||||
package org.linphone.history;
|
||||
|
||||
/*
|
||||
HistoryListFragment.java
|
||||
|
@ -37,7 +37,7 @@ import android.widget.TextView;
|
|||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.R;
|
||||
import org.linphone.LinphoneActivity;
|
||||
import org.linphone.call.CallHistoryAdapter;
|
||||
import org.linphone.fragments.FragmentsAvailable;
|
||||
import org.linphone.contacts.ContactsManager;
|
||||
import org.linphone.contacts.ContactsUpdatedListener;
|
||||
import org.linphone.core.Address;
|
||||
|
@ -49,14 +49,14 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
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, HistoryAdapter.ViewHolder.ClickListener, ContactsUpdatedListener, SelectableHelper.DeleteListener {
|
||||
private RecyclerView historyList;
|
||||
private TextView noCallHistory, noMissedCallHistory;
|
||||
private ImageView missedCalls, allCalls;
|
||||
private View allCallsSelected, missedCallsSelected;
|
||||
private boolean mOnlyDisplayMissedCalls;
|
||||
private List<CallLog> mLogs;
|
||||
private CallHistoryAdapter mHistoryAdapter;
|
||||
private HistoryAdapter mHistoryAdapter;
|
||||
private LinearLayoutManager mLayoutManager;
|
||||
private Context mContext;
|
||||
private SelectableHelper mSelectionHelper;
|
||||
|
@ -156,7 +156,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
|
||||
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
|
||||
hideHistoryListAndDisplayMessageIfEmpty();
|
||||
mHistoryAdapter = new CallHistoryAdapter(getActivity().getApplicationContext(), mLogs, this, mSelectionHelper);
|
||||
mHistoryAdapter = new HistoryAdapter(getActivity().getApplicationContext(), mLogs, this, mSelectionHelper);
|
||||
historyList.setAdapter(mHistoryAdapter);
|
||||
mSelectionHelper.setAdapter(mHistoryAdapter);
|
||||
mSelectionHelper.setDialogMessage(R.string.chat_room_delete_dialog);
|
||||
|
@ -172,7 +172,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
public void onContactsUpdated() {
|
||||
if (!LinphoneActivity.isInstanciated() || LinphoneActivity.instance().getCurrentFragment() != FragmentsAvailable.HISTORY_LIST)
|
||||
return;
|
||||
CallHistoryAdapter adapter = (CallHistoryAdapter) historyList.getAdapter();
|
||||
HistoryAdapter adapter = (HistoryAdapter) historyList.getAdapter();
|
||||
if (adapter != null) {
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
mOnlyDisplayMissedCalls = true;
|
||||
}
|
||||
hideHistoryListAndDisplayMessageIfEmpty();
|
||||
mHistoryAdapter = new CallHistoryAdapter(mContext, mLogs, this, mSelectionHelper);
|
||||
mHistoryAdapter = new HistoryAdapter(mContext, mLogs, this, mSelectionHelper);
|
||||
historyList.setAdapter(mHistoryAdapter);
|
||||
mSelectionHelper.setAdapter(mHistoryAdapter);
|
||||
mSelectionHelper.setDialogMessage(R.string.chat_room_delete_dialog);
|
Loading…
Reference in a new issue