summaryrefslogtreecommitdiff
path: root/src/com/android/dialer/calllog
diff options
context:
space:
mode:
authorSarmad Hashmi <mhashmi@google.com>2016-02-25 18:29:24 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-02-25 18:29:24 +0000
commitcb2ec83944a9ad4d88d8c544c6197d1c2c100d98 (patch)
tree378cc9e0236ebf548ddcfd75ef5d832aa398821b /src/com/android/dialer/calllog
parent741e1063155ea25d099469e80c7f199cce086ab3 (diff)
parent55b9d729f5a80621449756eced19faf8dde9420c (diff)
Mark missed calls as read on swipe. am: cb55981252
am: 55b9d729f5 * commit '55b9d729f5a80621449756eced19faf8dde9420c': Mark missed calls as read on swipe.
Diffstat (limited to 'src/com/android/dialer/calllog')
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java4
-rw-r--r--src/com/android/dialer/calllog/CallLogFragment.java28
2 files changed, 18 insertions, 14 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index 7c2e80df1..6f96ee529 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -16,6 +16,7 @@
package com.android.dialer.calllog;
+import com.android.dialer.DialtactsActivity;
import com.google.common.annotations.VisibleForTesting;
import android.content.Context;
@@ -171,6 +172,9 @@ public class CallLogAdapter extends GroupingListAdapter
} else {
if (viewHolder.callType == CallLog.Calls.MISSED_TYPE) {
CallLogAsyncTaskUtil.markCallAsRead(mContext, viewHolder.callIds);
+ if (!mIsCallLogActivity) {
+ ((DialtactsActivity) v.getContext()).updateTabUnreadCounts();
+ }
}
expandViewHolderActions(viewHolder);
}
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java
index ac8dfdabe..9cd1359c7 100644
--- a/src/com/android/dialer/calllog/CallLogFragment.java
+++ b/src/com/android/dialer/calllog/CallLogFragment.java
@@ -67,6 +67,7 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis
private static final String KEY_FILTER_TYPE = "filter_type";
private static final String KEY_LOG_LIMIT = "log_limit";
private static final String KEY_DATE_LIMIT = "date_limit";
+ private static final String KEY_IS_CALL_LOG_ACTIVITY = "is_call_log_activity";
// No limit specified for the number of logs to show; use the CallLogQueryHandler's default.
private static final int NO_LOG_LIMIT = -1;
@@ -194,6 +195,7 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis
mCallTypeFilter = state.getInt(KEY_FILTER_TYPE, mCallTypeFilter);
mLogLimit = state.getInt(KEY_LOG_LIMIT, mLogLimit);
mDateLimit = state.getLong(KEY_DATE_LIMIT, mDateLimit);
+ mIsCallLogActivity = state.getBoolean(KEY_IS_CALL_LOG_ACTIVITY, mIsCallLogActivity);
}
final Activity activity = getActivity();
@@ -355,7 +357,7 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis
@Override
public void onStop() {
- updateOnTransition(false /* onEntry */);
+ updateOnTransition();
super.onStop();
}
@@ -375,6 +377,7 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis
outState.putInt(KEY_FILTER_TYPE, mCallTypeFilter);
outState.putInt(KEY_LOG_LIMIT, mLogLimit);
outState.putLong(KEY_DATE_LIMIT, mDateLimit);
+ outState.putBoolean(KEY_IS_CALL_LOG_ACTIVITY, mIsCallLogActivity);
mAdapter.onSaveInstanceState(outState);
}
@@ -382,6 +385,9 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis
@Override
public void fetchCalls() {
mCallLogQueryHandler.fetchCalls(mCallTypeFilter, mDateLimit);
+ if (!mIsCallLogActivity) {
+ ((ListsFragment) getParentFragment()).updateTabUnreadCounts();
+ }
}
private void updateEmptyMessage(int filterType) {
@@ -429,7 +435,7 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis
if (mMenuVisible != menuVisible) {
mMenuVisible = menuVisible;
if (!menuVisible) {
- updateOnTransition(false /* onEntry */);
+ updateOnTransition();
} else if (isResumed()) {
refreshData();
}
@@ -448,7 +454,7 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis
fetchCalls();
mCallLogQueryHandler.fetchVoicemailStatus();
mCallLogQueryHandler.fetchMissedCallsUnreadCount();
- updateOnTransition(true /* onEntry */);
+ updateOnTransition();
mRefreshDataRequired = false;
} else {
// Refresh the display of the existing data to update the timestamp text descriptions.
@@ -457,23 +463,17 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis
}
/**
- * Updates the call data and notification state on entering or leaving the call log tab.
- *
- * If we are leaving the call log tab, mark all the missed calls as read.
+ * Updates the voicemail notification state.
*
* TODO: Move to CallLogActivity
*/
- private void updateOnTransition(boolean onEntry) {
+ private void updateOnTransition() {
// We don't want to update any call data when keyguard is on because the user has likely not
// seen the new calls yet.
// This might be called before onCreate() and thus we need to check null explicitly.
- if (mKeyguardManager != null && !mKeyguardManager.inKeyguardRestrictedInputMode()) {
- // On either of the transitions we update the missed call and voicemail notifications.
- // While exiting we additionally consume all missed calls (by marking them as read).
- mCallLogQueryHandler.markNewCallsAsOld();
- if (mCallTypeFilter == Calls.VOICEMAIL_TYPE) {
- CallLogNotificationsHelper.updateVoicemailNotifications(getActivity());
- }
+ if (mKeyguardManager != null && !mKeyguardManager.inKeyguardRestrictedInputMode()
+ && mCallTypeFilter == Calls.VOICEMAIL_TYPE) {
+ CallLogNotificationsHelper.updateVoicemailNotifications(getActivity());
}
}