summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Shrauner <shrauner@google.com>2015-09-17 21:58:05 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-09-17 21:58:05 +0000
commitf9c43ceef39a9174db7f78dc86f43380e1c5eb27 (patch)
tree958eb3d90faa0e93ddb8a4cda82f2aeba4ed3bd6
parent9d6e3b2700f8011645bc3e76b118d4c615b630d6 (diff)
parent119b06565c54f3bbe70555d8c5aba6065e6c9ad2 (diff)
Merge "Fix IllegalStateException in onMenuItemClick" into ub-contactsdialer-a-dev
-rw-r--r--src/com/android/dialer/DialtactsActivity.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index dbff276e5..3ca04df01 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -158,6 +158,8 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
*/
private SmartDialSearchFragment mSmartDialSearchFragment;
+ private boolean mIsVisible;
+
/**
* Animation that slides in.
*/
@@ -563,6 +565,25 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
}
@Override
+ protected void onStart() {
+ super.onStart();
+ mIsVisible = true;
+ }
+
+ @Override
+ protected void onStop() {
+ mIsVisible = false;
+ super.onStop();
+ }
+
+ /**
+ * Returns true when the Activity is currently visible (between onStart and onStop).
+ */
+ /* package */ boolean isVisible() {
+ return mIsVisible;
+ }
+
+ @Override
protected void onPause() {
if (mClearSearchOnPause) {
hideDialpadAndSearchUi();
@@ -576,6 +597,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
@Override
protected void onSaveInstanceState(Bundle outState) {
+ mIsVisible = false;
super.onSaveInstanceState(outState);
outState.putString(KEY_SEARCH_QUERY, mSearchQuery);
outState.putBoolean(KEY_IN_REGULAR_SEARCH_UI, mInRegularSearch);
@@ -648,6 +670,10 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
@Override
public boolean onMenuItemClick(MenuItem item) {
+ if (!isVisible()) {
+ return true;
+ }
+
switch (item.getItemId()) {
case R.id.menu_history:
// Use explicit CallLogActivity intent instead of ACTION_VIEW +