summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2014-04-16 15:29:17 -0700
committerTyler Gunn <tgunn@google.com>2014-04-16 15:29:17 -0700
commit2f02c8a8d840df38a09b55525a784dc666f622eb (patch)
tree502cf637b93ff51ad69be96024c137f146c441e7
parente00c9fe163d19ee380b922e3fcbe736216d78ccc (diff)
Adding support in the CallLogFragment for filtering calls based on call
date/time. Bug: 13964654 Change-Id: Ia9db8b35469b5cea9d5ae1a5ce6fba16ab1e825c
-rw-r--r--src/com/android/dialer/calllog/CallLogFragment.java38
1 files changed, 31 insertions, 7 deletions
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java
index 9526f392b..5e41bd377 100644
--- a/src/com/android/dialer/calllog/CallLogFragment.java
+++ b/src/com/android/dialer/calllog/CallLogFragment.java
@@ -30,7 +30,6 @@ import android.provider.CallLog;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract;
import android.provider.VoicemailContract.Status;
-import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;
import android.view.LayoutInflater;
import android.view.View;
@@ -48,7 +47,6 @@ import com.android.dialer.voicemail.VoicemailStatusHelper;
import com.android.dialer.voicemail.VoicemailStatusHelper.StatusMessage;
import com.android.dialer.voicemail.VoicemailStatusHelperImpl;
import com.android.dialerbind.ObjectFactory;
-import com.android.internal.telephony.ITelephony;
import java.util.List;
@@ -112,6 +110,10 @@ public class CallLogFragment extends ListFragment
// will be used.
private int mLogLimit = -1;
+ // Date limit (in millis since epoch) - when non-zero, only calls which occurred on or after
+ // the date filter are included. If zero, no date-based filtering occurs.
+ private long mDateLimit = 0;
+
public CallLogFragment() {
this(CallLogQueryHandler.CALL_TYPE_ALL, -1);
}
@@ -126,6 +128,28 @@ public class CallLogFragment extends ListFragment
mLogLimit = logLimit;
}
+ /**
+ * Creates a call log fragment, filtering to include only calls of the desired type, occurring
+ * after the specified date.
+ * @param filterType type of calls to include.
+ * @param dateLimit limits results to calls occurring on or after the specified date.
+ */
+ public CallLogFragment(int filterType, long dateLimit) {
+ this(filterType, -1, dateLimit);
+ }
+
+ /**
+ * Creates a call log fragment, filtering to include only calls of the desired type, occurring
+ * after the specified date. Also provides a means to limit the number of results returned.
+ * @param filterType type of calls to include.
+ * @param logLimit limits the number of results to return.
+ * @param dateLimit limits results to calls occurring on or after the specified date.
+ */
+ public CallLogFragment(int filterType, int logLimit, long dateLimit) {
+ this(filterType, logLimit);
+ mDateLimit = dateLimit;
+ }
+
@Override
public void onCreate(Bundle state) {
super.onCreate(state);
@@ -141,7 +165,7 @@ public class CallLogFragment extends ListFragment
getActivity().getContentResolver().registerContentObserver(
Status.CONTENT_URI, true, mVoicemailStatusObserver);
setHasOptionsMenu(true);
- updateCallList(mCallTypeFilter);
+ updateCallList(mCallTypeFilter, mDateLimit);
}
/** Called by the CallLogQueryHandler when the list of calls has been fetched or updated. */
@@ -324,20 +348,20 @@ public class CallLogFragment extends ListFragment
@Override
public void fetchCalls() {
- mCallLogQueryHandler.fetchCalls(mCallTypeFilter);
+ mCallLogQueryHandler.fetchCalls(mCallTypeFilter, mDateLimit);
}
public void startCallsQuery() {
mAdapter.setLoading(true);
- mCallLogQueryHandler.fetchCalls(mCallTypeFilter);
+ mCallLogQueryHandler.fetchCalls(mCallTypeFilter, mDateLimit);
}
private void startVoicemailStatusQuery() {
mCallLogQueryHandler.fetchVoicemailStatus();
}
- private void updateCallList(int filterType) {
- mCallLogQueryHandler.fetchCalls(filterType);
+ private void updateCallList(int filterType, long dateLimit) {
+ mCallLogQueryHandler.fetchCalls(filterType, dateLimit);
}
private void updateEmptyMessage(int filterType) {