Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7712aef2 authored by Jay Shrauner's avatar Jay Shrauner
Browse files

Use TransactionSafeActivity

Remove custom visibility tracking.

Bug:24294419
Change-Id: I554a1277aa3fa9575c93191b99b7e6b484596379
parent 3daa9a34
Loading
Loading
Loading
Loading
+1 −23
Original line number Original line Diff line number Diff line
@@ -84,8 +84,6 @@ public class ContactSelectionActivity extends ContactsActivity
    private ContactsIntentResolver mIntentResolver;
    private ContactsIntentResolver mIntentResolver;
    protected ContactEntryListFragment<?> mListFragment;
    protected ContactEntryListFragment<?> mListFragment;


    private boolean mIsVisible;

    private int mActionCode = -1;
    private int mActionCode = -1;
    private boolean mIsSearchMode;
    private boolean mIsSearchMode;
    private boolean mIsSearchSupported;
    private boolean mIsSearchSupported;
@@ -139,25 +137,6 @@ public class ContactSelectionActivity extends ContactsActivity
        prepareSearchViewAndActionBar();
        prepareSearchViewAndActionBar();
    }
    }


    @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;
    }

    private void prepareSearchViewAndActionBar() {
    private void prepareSearchViewAndActionBar() {
        final ActionBar actionBar = getActionBar();
        final ActionBar actionBar = getActionBar();
        mSearchViewContainer = LayoutInflater.from(actionBar.getThemedContext())
        mSearchViewContainer = LayoutInflater.from(actionBar.getThemedContext())
@@ -233,7 +212,6 @@ public class ContactSelectionActivity extends ContactsActivity


    @Override
    @Override
    protected void onSaveInstanceState(Bundle outState) {
    protected void onSaveInstanceState(Bundle outState) {
        mIsVisible = false;
        super.onSaveInstanceState(outState);
        super.onSaveInstanceState(outState);
        outState.putInt(KEY_ACTION_CODE, mActionCode);
        outState.putInt(KEY_ACTION_CODE, mActionCode);
        outState.putBoolean(KEY_SEARCH_MODE, mIsSearchMode);
        outState.putBoolean(KEY_SEARCH_MODE, mIsSearchMode);
@@ -690,7 +668,7 @@ public class ContactSelectionActivity extends ContactsActivity


    @Override
    @Override
    public void onBackPressed() {
    public void onBackPressed() {
        if (!isVisible()) {
        if (!isSafeToCommitTransactions()) {
            return;
            return;
        }
        }


+1 −20
Original line number Original line Diff line number Diff line
@@ -142,8 +142,6 @@ public class PeopleActivity extends ContactsActivity implements
    private MultiSelectContactsListFragment mAllFragment;
    private MultiSelectContactsListFragment mAllFragment;
    private ContactTileListFragment mFavoritesFragment;
    private ContactTileListFragment mFavoritesFragment;


    private boolean mIsVisible;

    /** ViewPager for swipe */
    /** ViewPager for swipe */
    private ViewPager mTabPager;
    private ViewPager mTabPager;
    private ViewPagerTabs mViewPagerTabs;
    private ViewPagerTabs mViewPagerTabs;
@@ -412,14 +410,6 @@ public class PeopleActivity extends ContactsActivity implements
            configureFragments(!mIsRecreatedInstance);
            configureFragments(!mIsRecreatedInstance);
        }
        }
        super.onStart();
        super.onStart();

        mIsVisible = true;
    }

    @Override
    protected void onStop() {
        mIsVisible = false;
        super.onStop();
    }
    }


    @Override
    @Override
@@ -464,13 +454,6 @@ public class PeopleActivity extends ContactsActivity implements
        super.onDestroy();
        super.onDestroy();
    }
    }


    /**
     * Returns true when the Activity is currently visible (between onStart and onStop).
     */
    /* package */ boolean isVisible() {
        return mIsVisible;
    }

    private void configureFragments(boolean fromRequest) {
    private void configureFragments(boolean fromRequest) {
        if (fromRequest) {
        if (fromRequest) {
            ContactListFilter filter = null;
            ContactListFilter filter = null;
@@ -1355,7 +1338,7 @@ public class PeopleActivity extends ContactsActivity implements


    @Override
    @Override
    public void onBackPressed() {
    public void onBackPressed() {
        if (!isVisible()) {
        if (!isSafeToCommitTransactions()) {
            return;
            return;
        }
        }


@@ -1371,8 +1354,6 @@ public class PeopleActivity extends ContactsActivity implements


    @Override
    @Override
    protected void onSaveInstanceState(Bundle outState) {
    protected void onSaveInstanceState(Bundle outState) {
        mIsVisible = false;

        super.onSaveInstanceState(outState);
        super.onSaveInstanceState(outState);
        mActionBarAdapter.onSaveInstanceState(outState);
        mActionBarAdapter.onSaveInstanceState(outState);