Mark missed calls as read on swipe.
When swiping to a new tab, if the previous tab that the user was in was
the call history tab, all missed calls are marked as read and the tab
count is updated. Also fixes b/27153608 and clearing of missed calls on
orientation change.
BUG=27136093
BUG=27153608
BUG=27154514
Change-Id: I5be31b1a3978784b941fb8e1af22f93fb6ca944a
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index d507483..d12cf24 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -240,6 +240,7 @@
private FloatingActionButtonController mFloatingActionButtonController;
private int mActionBarHeight;
+ private int mPreviouslySelectedTabIndex;
/**
* The text returned from a voice search query. Set in {@link #onActivityResult} and used in
@@ -423,7 +424,7 @@
mIsLandscape = getResources().getConfiguration().orientation
== Configuration.ORIENTATION_LANDSCAPE;
-
+ mPreviouslySelectedTabIndex = ListsFragment.TAB_INDEX_SPEED_DIAL;
final View floatingActionButtonContainer = findViewById(
R.id.floating_action_button_container);
ImageButton floatingActionButton = (ImageButton) findViewById(R.id.floating_action_button);
@@ -567,6 +568,11 @@
@Override
protected void onPause() {
+ // Only clear missed calls if the pause was not triggered by an orientation change
+ // (or any other confirguration change)
+ if (!isChangingConfigurations()) {
+ updateMissedCalls();
+ }
if (mClearSearchOnPause) {
hideDialpadAndSearchUi();
mClearSearchOnPause = false;
@@ -1328,7 +1334,9 @@
@Override
public void onPageSelected(int position) {
+ updateMissedCalls();
int tabIndex = mListsFragment.getCurrentTabIndex();
+ mPreviouslySelectedTabIndex = tabIndex;
if (tabIndex == ListsFragment.TAB_INDEX_ALL_CONTACTS) {
mFloatingActionButtonController.changeIcon(
getResources().getDrawable(R.drawable.ic_person_add_24dp),
@@ -1389,4 +1397,10 @@
}
return FloatingActionButtonController.ALIGN_END;
}
+
+ private void updateMissedCalls() {
+ if (mPreviouslySelectedTabIndex == ListsFragment.TAB_INDEX_HISTORY) {
+ mListsFragment.markMissedCallsAsReadAndRemoveNotifications();
+ }
+ }
}