summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Shrauner <shrauner@google.com>2015-09-18 22:33:24 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-09-18 22:33:24 +0000
commit8239d56d7976ff492b326c449e35805bace40a01 (patch)
treee1b70339f092c70d57b6dbeb802529663d353e1f
parent252a3bb5ca9c5615e7f6e8e0ebc2f9beabe8af53 (diff)
parentf499a09cdbbd8efb4d97b9981fe1a0141e8a930d (diff)
Merge "Fix IllegalStateException in onOptionsItemSelected" into ub-contactsdialer-a-dev
-rw-r--r--src/com/android/dialer/calllog/CallLogActivity.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/com/android/dialer/calllog/CallLogActivity.java b/src/com/android/dialer/calllog/CallLogActivity.java
index ff0726df7..ad795f9bd 100644
--- a/src/com/android/dialer/calllog/CallLogActivity.java
+++ b/src/com/android/dialer/calllog/CallLogActivity.java
@@ -48,6 +48,8 @@ public class CallLogActivity extends AppCompatActivity implements ViewPager.OnPa
private CallLogFragment mAllCallsFragment;
private CallLogFragment mMissedCallsFragment;
+ private boolean mIsVisible;
+
private String[] mTabTitles;
private static final int TAB_INDEX_ALL = 0;
@@ -161,6 +163,31 @@ public class CallLogActivity extends AppCompatActivity implements ViewPager.OnPa
}
@Override
+ protected void onStart() {
+ super.onStart();
+ mIsVisible = false;
+ }
+
+ @Override
+ protected void onStop() {
+ mIsVisible = false;
+ super.onStop();
+ }
+
+ @Override
+ protected void onSaveInstanceState(Bundle outState) {
+ mIsVisible = false;
+ super.onSaveInstanceState(outState);
+ }
+
+ /**
+ * Returns true when the Activity is currently visible (between onStart and onStop).
+ */
+ /* package */ boolean isVisible() {
+ return mIsVisible;
+ }
+
+ @Override
public boolean onCreateOptionsMenu(Menu menu) {
final MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.call_log_options, menu);
@@ -180,6 +207,10 @@ public class CallLogActivity extends AppCompatActivity implements ViewPager.OnPa
@Override
public boolean onOptionsItemSelected(MenuItem item) {
+ if (!isVisible()) {
+ return true;
+ }
+
switch (item.getItemId()) {
case android.R.id.home:
final Intent intent = new Intent(this, DialtactsActivity.class);