15253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Leepackage com.android.dialer.widget;
25253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
35253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Leeimport com.google.common.annotations.VisibleForTesting;
45253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
55253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Leeimport android.animation.ValueAnimator;
65253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Leeimport android.animation.ValueAnimator.AnimatorUpdateListener;
7a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Leeimport android.app.ActionBar;
85253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Leeimport android.os.Bundle;
95253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Leeimport android.util.Log;
105253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
115253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Leeimport com.android.dialer.DialtactsActivity;
12fd723cae1dc2de0f83ec14639d4431674dd3b82eSai Cheemalapatiimport com.android.phone.common.animation.AnimUtils;
13fd723cae1dc2de0f83ec14639d4431674dd3b82eSai Cheemalapatiimport com.android.phone.common.animation.AnimUtils.AnimationCallback;
145253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
155253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee/**
165253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee * Controls the various animated properties of the actionBar: showing/hiding, fading/revealing,
175253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee * and collapsing/expanding, and assigns suitable properties to the actionBar based on the
185253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee * current state of the UI.
195253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee */
205253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Leepublic class ActionBarController {
215253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    public static final boolean DEBUG = DialtactsActivity.DEBUG;
225253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    public static final String TAG = "ActionBarController";
235253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    private static final String KEY_IS_SLID_UP = "key_actionbar_is_slid_up";
245253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    private static final String KEY_IS_FADED_OUT = "key_actionbar_is_faded_out";
255253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    private static final String KEY_IS_EXPANDED = "key_actionbar_is_expanded";
265253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
275253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    private ActivityUi mActivityUi;
285253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    private SearchEditTextLayout mSearchBox;
295253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
305253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    private boolean mIsActionBarSlidUp;
315253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
32710709da8389d401d3089bbf9836dfca527f15c3Yorke Lee    private final AnimationCallback mFadeOutCallback = new AnimationCallback() {
33710709da8389d401d3089bbf9836dfca527f15c3Yorke Lee        @Override
34710709da8389d401d3089bbf9836dfca527f15c3Yorke Lee        public void onAnimationEnd() {
35a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee            slideActionBar(true /* slideUp */, false /* animate */);
36710709da8389d401d3089bbf9836dfca527f15c3Yorke Lee        }
37710709da8389d401d3089bbf9836dfca527f15c3Yorke Lee
38710709da8389d401d3089bbf9836dfca527f15c3Yorke Lee        @Override
39710709da8389d401d3089bbf9836dfca527f15c3Yorke Lee        public void onAnimationCancel() {
40a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee            slideActionBar(true /* slideUp */, false /* animate */);
41710709da8389d401d3089bbf9836dfca527f15c3Yorke Lee        }
42710709da8389d401d3089bbf9836dfca527f15c3Yorke Lee    };
43710709da8389d401d3089bbf9836dfca527f15c3Yorke Lee
445253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    public interface ActivityUi {
455253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        public boolean isInSearchUi();
465253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        public boolean hasSearchQuery();
475253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        public boolean shouldShowActionBar();
485253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        public int getActionBarHeight();
49a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee        public ActionBar getActionBar();
505253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    }
515253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
525253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    public ActionBarController(ActivityUi activityUi, SearchEditTextLayout searchBox) {
535253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        mActivityUi = activityUi;
545253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        mSearchBox = searchBox;
555253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    }
565253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
575253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    /**
585253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee     * @return Whether or not the action bar is currently showing (both slid down and visible)
595253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee     */
605253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    public boolean isActionBarShowing() {
615253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        return !mIsActionBarSlidUp && !mSearchBox.isFadedOut();
625253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    }
635253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
645253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    /**
655253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee     * Called when the user has tapped on the collapsed search box, to start a new search query.
665253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee     */
675253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    public void onSearchBoxTapped() {
685253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        if (DEBUG) {
695253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee            Log.d(TAG, "OnSearchBoxTapped: isInSearchUi " + mActivityUi.isInSearchUi());
705253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        }
715253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        if (!mActivityUi.isInSearchUi()) {
725253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee            mSearchBox.expand(true /* animate */, true /* requestFocus */);
735253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        }
745253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    }
755253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
765253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    /**
775253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee     * Called when search UI has been exited for some reason.
785253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee     */
795253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    public void onSearchUiExited() {
805253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        if (DEBUG) {
815253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee            Log.d(TAG, "OnSearchUIExited: isExpanded " + mSearchBox.isExpanded()
825253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                    + " isFadedOut: " + mSearchBox.isFadedOut()
835253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                    + " shouldShowActionBar: " + mActivityUi.shouldShowActionBar());
845253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        }
855253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        if (mSearchBox.isExpanded()) {
865253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee            mSearchBox.collapse(true /* animate */);
875253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        }
885253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        if (mSearchBox.isFadedOut()) {
895253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee            mSearchBox.fadeIn();
905253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        }
915253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
925253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        if (mActivityUi.shouldShowActionBar()) {
93a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee            slideActionBar(false /* slideUp */, false /* animate */);
945253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        } else {
95a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee            slideActionBar(true /* slideUp */, false /* animate */);
965253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        }
975253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    }
985253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
995253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    /**
1005253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee     * Called to indicate that the user is trying to hide the dialpad. Should be called before
1015253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee     * any state changes have actually occurred.
1025253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee     */
1035253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    public void onDialpadDown() {
1045253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        if (DEBUG) {
1055253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee            Log.d(TAG, "OnDialpadDown: isInSearchUi " + mActivityUi.isInSearchUi()
1065253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                    + " hasSearchQuery: " + mActivityUi.hasSearchQuery()
1075253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                    + " isFadedOut: " + mSearchBox.isFadedOut()
1085253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                    + " isExpanded: " + mSearchBox.isExpanded());
1095253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        }
1105253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        if (mActivityUi.isInSearchUi()) {
1115253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee            if (mActivityUi.hasSearchQuery()) {
1125253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                if (mSearchBox.isFadedOut()) {
1135253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                    mSearchBox.setVisible(true);
1145253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                }
1155253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                if (!mSearchBox.isExpanded()) {
1165253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                    mSearchBox.expand(false /* animate */, false /* requestFocus */);
1175253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                }
118a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee                slideActionBar(false /* slideUp */, true /* animate */);
1195253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee            } else {
1205253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                mSearchBox.fadeIn();
1215253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee            }
1225253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        }
1235253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    }
1245253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
1255253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    /**
1265253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee     * Called to indicate that the user is trying to show the dialpad. Should be called before
1275253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee     * any state changes have actually occurred.
1285253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee     */
1295253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    public void onDialpadUp() {
1305253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        if (DEBUG) {
1315253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee            Log.d(TAG, "OnDialpadUp: isInSearchUi " + mActivityUi.isInSearchUi());
1325253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        }
1335253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        if (mActivityUi.isInSearchUi()) {
134a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee            slideActionBar(true /* slideUp */, true /* animate */);
1355253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        } else {
1365253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee            // From the lists fragment
137710709da8389d401d3089bbf9836dfca527f15c3Yorke Lee            mSearchBox.fadeOut(mFadeOutCallback);
1385253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        }
1395253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    }
1405253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
141a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee    public void slideActionBar(boolean slideUp, boolean animate) {
1425253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        if (DEBUG) {
143a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee            Log.d(TAG, "Sliding actionBar - up: " + slideUp + " animate: " + animate);
1445253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        }
1455253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        if (animate) {
146a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee            ValueAnimator animator =
147a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee                    slideUp ? ValueAnimator.ofFloat(0, 1) : ValueAnimator.ofFloat(1, 0);
1485253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee            animator.addUpdateListener(new AnimatorUpdateListener() {
1495253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                @Override
1505253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                public void onAnimationUpdate(ValueAnimator animation) {
1515253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                    final float value = (float) animation.getAnimatedValue();
152a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee                    setHideOffset(
1535253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                            (int) (mActivityUi.getActionBarHeight() * value));
1545253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                }
1555253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee            });
1565253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee            animator.start();
1575253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        } else {
158a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee           setHideOffset(slideUp ? mActivityUi.getActionBarHeight() : 0);
1595253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        }
160a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee        mIsActionBarSlidUp = slideUp;
1615253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    }
1625253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
1631896344b53ddf6cdaf17dc02a05c45f587879d99Andrew Lee    public void setAlpha(float alphaValue) {
1641896344b53ddf6cdaf17dc02a05c45f587879d99Andrew Lee        mSearchBox.animate().alpha(alphaValue).start();
1651896344b53ddf6cdaf17dc02a05c45f587879d99Andrew Lee    }
1661896344b53ddf6cdaf17dc02a05c45f587879d99Andrew Lee
167a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee    public void setHideOffset(int offset) {
168a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee        mIsActionBarSlidUp = offset >= mActivityUi.getActionBarHeight();
169a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee        mActivityUi.getActionBar().setHideOffset(offset);
170a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee    }
171a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee
172a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee    /**
173a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee     * @return The offset the action bar is being translated upwards by
174a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee     */
175a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee    public int getHideOffset() {
176a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee        return mActivityUi.getActionBar().getHideOffset();
177a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee    }
178a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee
1795253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    /**
1805253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee     * Saves the current state of the action bar into a provided {@link Bundle}
1815253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee     */
1825253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    public void saveInstanceState(Bundle outState) {
1835253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        outState.putBoolean(KEY_IS_SLID_UP, mIsActionBarSlidUp);
1845253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        outState.putBoolean(KEY_IS_FADED_OUT, mSearchBox.isFadedOut());
1855253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        outState.putBoolean(KEY_IS_EXPANDED, mSearchBox.isExpanded());
1865253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    }
1875253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
1885253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    /**
189a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee     * Restores the action bar state from a provided {@link Bundle}.
1905253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee     */
1915253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    public void restoreInstanceState(Bundle inState) {
1925253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        mIsActionBarSlidUp = inState.getBoolean(KEY_IS_SLID_UP);
1935253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
1945253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        final boolean isSearchBoxFadedOut = inState.getBoolean(KEY_IS_FADED_OUT);
1955253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        if (isSearchBoxFadedOut) {
1965253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee            if (!mSearchBox.isFadedOut()) {
1975253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                mSearchBox.setVisible(false);
1985253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee            }
1995253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        } else if (mSearchBox.isFadedOut()) {
2005253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                mSearchBox.setVisible(true);
2015253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        }
2025253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
2035253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        final boolean isSearchBoxExpanded = inState.getBoolean(KEY_IS_EXPANDED);
2045253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        if (isSearchBoxExpanded) {
2055253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee            if (!mSearchBox.isExpanded()) {
2065253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                mSearchBox.expand(false, false);
2075253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee            }
2085253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        } else if (mSearchBox.isExpanded()) {
2095253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee                mSearchBox.collapse(false);
2105253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        }
2115253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    }
2125253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee
213a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee    /**
214a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee     * This should be called after onCreateOptionsMenu has been called, when the actionbar has
215a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee     * been laid out and actually has a height.
216a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee     */
217a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee    public void restoreActionBarOffset() {
218a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee        slideActionBar(mIsActionBarSlidUp /* slideUp */, false /* animate */);
219a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee    }
220a524ae57ec8fce9532ed998c63a5577fce738fd5Yorke Lee
2215253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    @VisibleForTesting
2225253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    public boolean getIsActionBarSlidUp() {
2235253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee        return mIsActionBarSlidUp;
2245253be0d57edd4cdf5fbc0a980188e13e009c083Yorke Lee    }
225fd723cae1dc2de0f83ec14639d4431674dd3b82eSai Cheemalapati}
226