ActionBarContextView.java revision 9ca705e323cb737a07a667c1e86bac702f11a29c
189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell/*
289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * Copyright (C) 2010 The Android Open Source Project
389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell *
489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * Licensed under the Apache License, Version 2.0 (the "License");
589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * you may not use this file except in compliance with the License.
689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * You may obtain a copy of the License at
789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell *
889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell *      http://www.apache.org/licenses/LICENSE-2.0
989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell *
1089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * Unless required by applicable law or agreed to in writing, software
1189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * distributed under the License is distributed on an "AS IS" BASIS,
1289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * See the License for the specific language governing permissions and
1489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * limitations under the License.
1589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell */
1689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powellpackage com.android.internal.widget;
1789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
189ca705e323cb737a07a667c1e86bac702f11a29cAdam Powellimport com.android.internal.R;
199ca705e323cb737a07a667c1e86bac702f11a29cAdam Powellimport com.android.internal.view.menu.ActionMenuPresenter;
209ca705e323cb737a07a667c1e86bac702f11a29cAdam Powellimport com.android.internal.view.menu.ActionMenuView;
219ca705e323cb737a07a667c1e86bac702f11a29cAdam Powellimport com.android.internal.view.menu.MenuBuilder;
229ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell
23d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powellimport android.animation.Animator;
24d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powellimport android.animation.Animator.AnimatorListener;
25d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powellimport android.animation.AnimatorSet;
26d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powellimport android.animation.ObjectAnimator;
2789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powellimport android.content.Context;
2889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powellimport android.content.res.TypedArray;
299ca705e323cb737a07a667c1e86bac702f11a29cAdam Powellimport android.graphics.drawable.Drawable;
30c619e74cc62678cef09b5f92e87e762a1f02aab7Gilles Debunneimport android.text.TextUtils;
3189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powellimport android.util.AttributeSet;
326e34636749217654f43221885afb7a29bb5ca96aAdam Powellimport android.view.ActionMode;
3389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powellimport android.view.LayoutInflater;
3489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powellimport android.view.View;
35d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powellimport android.view.animation.DecelerateInterpolator;
360e94b5151d817e600a888448a662208b29b5ef46Adam Powellimport android.widget.LinearLayout;
3789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powellimport android.widget.TextView;
3889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
3989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell/**
4089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @hide
4189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell */
42640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powellpublic class ActionBarContextView extends AbsActionBarView implements AnimatorListener {
4377769c7a9130afa48e46dbd79da8271c271ab1e9Adam Powell    private static final String TAG = "ActionBarContextView";
4477769c7a9130afa48e46dbd79da8271c271ab1e9Adam Powell
4589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    private int mContentHeight;
4689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
4789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    private CharSequence mTitle;
4889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    private CharSequence mSubtitle;
49f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell
50f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell    private View mClose;
5189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    private View mCustomView;
520e94b5151d817e600a888448a662208b29b5ef46Adam Powell    private LinearLayout mTitleLayout;
5389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    private TextView mTitleView;
540e94b5151d817e600a888448a662208b29b5ef46Adam Powell    private TextView mSubtitleView;
55bc234a19f4c74116454e2c77f4739290e761995aAdam Powell    private int mTitleStyleRes;
56bc234a19f4c74116454e2c77f4739290e761995aAdam Powell    private int mSubtitleStyleRes;
579ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell    private Drawable mSplitBackground;
58d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
59d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    private Animator mCurrentAnimation;
60d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    private boolean mAnimateInOnLayout;
61d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    private int mAnimationMode;
62d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
63d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    private static final int ANIMATE_IDLE = 0;
64d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    private static final int ANIMATE_IN = 1;
65d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    private static final int ANIMATE_OUT = 2;
6689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
6789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    public ActionBarContextView(Context context) {
68bc234a19f4c74116454e2c77f4739290e761995aAdam Powell        this(context, null);
6989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
7089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
7189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    public ActionBarContextView(Context context, AttributeSet attrs) {
72bc234a19f4c74116454e2c77f4739290e761995aAdam Powell        this(context, attrs, com.android.internal.R.attr.actionModeStyle);
7389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
7489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
7589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    public ActionBarContextView(Context context, AttributeSet attrs, int defStyle) {
7689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        super(context, attrs, defStyle);
7789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
78bc234a19f4c74116454e2c77f4739290e761995aAdam Powell        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ActionMode, defStyle, 0);
7989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        setBackgroundDrawable(a.getDrawable(
80bc234a19f4c74116454e2c77f4739290e761995aAdam Powell                com.android.internal.R.styleable.ActionMode_background));
81bc234a19f4c74116454e2c77f4739290e761995aAdam Powell        mTitleStyleRes = a.getResourceId(
82bc234a19f4c74116454e2c77f4739290e761995aAdam Powell                com.android.internal.R.styleable.ActionMode_titleTextStyle, 0);
83bc234a19f4c74116454e2c77f4739290e761995aAdam Powell        mSubtitleStyleRes = a.getResourceId(
84bc234a19f4c74116454e2c77f4739290e761995aAdam Powell                com.android.internal.R.styleable.ActionMode_subtitleTextStyle, 0);
85dcdefbbff2bfecbfeb7b6459de130f376595c590Adam Powell
86e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell        mContentHeight = a.getLayoutDimension(
87bc234a19f4c74116454e2c77f4739290e761995aAdam Powell                com.android.internal.R.styleable.ActionMode_height, 0);
889ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell
899ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell        mSplitBackground = a.getDrawable(
909ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell                com.android.internal.R.styleable.ActionMode_backgroundSplit);
919ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell
9289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        a.recycle();
9389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
949146ac706265cd8cce66907e617bc8572152eb97Adam Powell
95e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell    public void setHeight(int height) {
96e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell        mContentHeight = height;
97e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell    }
98e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell
9989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    public void setCustomView(View view) {
10089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        if (mCustomView != null) {
10189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell            removeView(mCustomView);
10289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
10389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        mCustomView = view;
1040e94b5151d817e600a888448a662208b29b5ef46Adam Powell        if (mTitleLayout != null) {
1050e94b5151d817e600a888448a662208b29b5ef46Adam Powell            removeView(mTitleLayout);
1060e94b5151d817e600a888448a662208b29b5ef46Adam Powell            mTitleLayout = null;
10789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
10889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        if (view != null) {
10989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell            addView(view);
11089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
11189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        requestLayout();
11289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
1130e94b5151d817e600a888448a662208b29b5ef46Adam Powell
11489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    public void setTitle(CharSequence title) {
11589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        mTitle = title;
1160e94b5151d817e600a888448a662208b29b5ef46Adam Powell        initTitle();
1170e94b5151d817e600a888448a662208b29b5ef46Adam Powell    }
1180e94b5151d817e600a888448a662208b29b5ef46Adam Powell
1190e94b5151d817e600a888448a662208b29b5ef46Adam Powell    public void setSubtitle(CharSequence subtitle) {
1200e94b5151d817e600a888448a662208b29b5ef46Adam Powell        mSubtitle = subtitle;
1210e94b5151d817e600a888448a662208b29b5ef46Adam Powell        initTitle();
1220e94b5151d817e600a888448a662208b29b5ef46Adam Powell    }
1230e94b5151d817e600a888448a662208b29b5ef46Adam Powell
12429ed7575c2129974a57ad77b3531bc5995940c6cAdam Powell    public CharSequence getTitle() {
12529ed7575c2129974a57ad77b3531bc5995940c6cAdam Powell        return mTitle;
12629ed7575c2129974a57ad77b3531bc5995940c6cAdam Powell    }
12729ed7575c2129974a57ad77b3531bc5995940c6cAdam Powell
12829ed7575c2129974a57ad77b3531bc5995940c6cAdam Powell    public CharSequence getSubtitle() {
12929ed7575c2129974a57ad77b3531bc5995940c6cAdam Powell        return mSubtitle;
13029ed7575c2129974a57ad77b3531bc5995940c6cAdam Powell    }
13129ed7575c2129974a57ad77b3531bc5995940c6cAdam Powell
1320e94b5151d817e600a888448a662208b29b5ef46Adam Powell    private void initTitle() {
1330e94b5151d817e600a888448a662208b29b5ef46Adam Powell        if (mTitleLayout == null) {
13489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell            LayoutInflater inflater = LayoutInflater.from(getContext());
135f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell            inflater.inflate(R.layout.action_bar_title_item, this);
136f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell            mTitleLayout = (LinearLayout) getChildAt(getChildCount() - 1);
1370e94b5151d817e600a888448a662208b29b5ef46Adam Powell            mTitleView = (TextView) mTitleLayout.findViewById(R.id.action_bar_title);
1380e94b5151d817e600a888448a662208b29b5ef46Adam Powell            mSubtitleView = (TextView) mTitleLayout.findViewById(R.id.action_bar_subtitle);
139c619e74cc62678cef09b5f92e87e762a1f02aab7Gilles Debunne            if (mTitleStyleRes != 0) {
140c619e74cc62678cef09b5f92e87e762a1f02aab7Gilles Debunne                mTitleView.setTextAppearance(mContext, mTitleStyleRes);
14189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell            }
142c619e74cc62678cef09b5f92e87e762a1f02aab7Gilles Debunne            if (mSubtitleStyleRes != 0) {
143c619e74cc62678cef09b5f92e87e762a1f02aab7Gilles Debunne                mSubtitleView.setTextAppearance(mContext, mSubtitleStyleRes);
14489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell            }
14589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
146c619e74cc62678cef09b5f92e87e762a1f02aab7Gilles Debunne
147c619e74cc62678cef09b5f92e87e762a1f02aab7Gilles Debunne        mTitleView.setText(mTitle);
148c619e74cc62678cef09b5f92e87e762a1f02aab7Gilles Debunne        mSubtitleView.setText(mSubtitle);
149c619e74cc62678cef09b5f92e87e762a1f02aab7Gilles Debunne
150c619e74cc62678cef09b5f92e87e762a1f02aab7Gilles Debunne        final boolean hasTitle = !TextUtils.isEmpty(mTitle);
151c619e74cc62678cef09b5f92e87e762a1f02aab7Gilles Debunne        final boolean hasSubtitle = !TextUtils.isEmpty(mSubtitle);
152c619e74cc62678cef09b5f92e87e762a1f02aab7Gilles Debunne        mSubtitleView.setVisibility(hasSubtitle ? VISIBLE : GONE);
153c619e74cc62678cef09b5f92e87e762a1f02aab7Gilles Debunne        mTitleLayout.setVisibility(hasTitle || hasSubtitle ? VISIBLE : GONE);
154c619e74cc62678cef09b5f92e87e762a1f02aab7Gilles Debunne        if (mTitleLayout.getParent() == null) {
155c619e74cc62678cef09b5f92e87e762a1f02aab7Gilles Debunne            addView(mTitleLayout);
156c619e74cc62678cef09b5f92e87e762a1f02aab7Gilles Debunne        }
15789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
1580e94b5151d817e600a888448a662208b29b5ef46Adam Powell
1596e34636749217654f43221885afb7a29bb5ca96aAdam Powell    public void initForMode(final ActionMode mode) {
160f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell        if (mClose == null) {
161f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell            LayoutInflater inflater = LayoutInflater.from(mContext);
162d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            mClose = inflater.inflate(R.layout.action_mode_close_item, this, false);
163d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            addView(mClose);
16445f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell        } else if (mClose.getParent() == null) {
165f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell            addView(mClose);
16689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
167f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell
168f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell        View closeButton = mClose.findViewById(R.id.action_mode_close_button);
169f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell        closeButton.setOnClickListener(new OnClickListener() {
170269b8bb0cbd78969450ea9ab255232d047580210Adam Powell            public void onClick(View v) {
171269b8bb0cbd78969450ea9ab255232d047580210Adam Powell                mode.finish();
172269b8bb0cbd78969450ea9ab255232d047580210Adam Powell            }
173269b8bb0cbd78969450ea9ab255232d047580210Adam Powell        });
17489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
1752c9c9fe806e51f29276e66b8ba40cb4b7a80c3f4Adam Powell        final MenuBuilder menu = (MenuBuilder) mode.getMenu();
1768d02deabac62c4a68a335a7b3141795466362b89Adam Powell        mActionMenuPresenter = new ActionMenuPresenter();
1771ab418a222e1834c4b1312fde355e41a1947af0dAdam Powell        mActionMenuPresenter.setReserveOverflow(true);
178640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell
179640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell        final LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT,
180640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell                LayoutParams.MATCH_PARENT);
181640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell        if (mSplitView == null) {
1821ab418a222e1834c4b1312fde355e41a1947af0dAdam Powell            menu.addMenuPresenter(mActionMenuPresenter);
1831ab418a222e1834c4b1312fde355e41a1947af0dAdam Powell            mMenuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this);
1849ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell            mMenuView.setBackgroundDrawable(null);
1851ab418a222e1834c4b1312fde355e41a1947af0dAdam Powell            addView(mMenuView, layoutParams);
186640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell        } else {
187640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell            // Allow full screen width in split mode.
1888d02deabac62c4a68a335a7b3141795466362b89Adam Powell            mActionMenuPresenter.setWidthLimit(
189640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell                    getContext().getResources().getDisplayMetrics().widthPixels, true);
190640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell            // No limit to the item count; use whatever will fit.
1918d02deabac62c4a68a335a7b3141795466362b89Adam Powell            mActionMenuPresenter.setItemLimit(Integer.MAX_VALUE);
192640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell            // Span the whole width
193640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell            layoutParams.width = LayoutParams.MATCH_PARENT;
1941ab418a222e1834c4b1312fde355e41a1947af0dAdam Powell            layoutParams.height = mContentHeight;
1951ab418a222e1834c4b1312fde355e41a1947af0dAdam Powell            menu.addMenuPresenter(mActionMenuPresenter);
1961ab418a222e1834c4b1312fde355e41a1947af0dAdam Powell            mMenuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this);
1979ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell            mMenuView.setBackgroundDrawable(mSplitBackground);
1981ab418a222e1834c4b1312fde355e41a1947af0dAdam Powell            mSplitView.addView(mMenuView, layoutParams);
199640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell        }
200d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
201d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        mAnimateInOnLayout = true;
20289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
2030e94b5151d817e600a888448a662208b29b5ef46Adam Powell
20489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    public void closeMode() {
20545f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell        if (mAnimationMode == ANIMATE_OUT) {
20645f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell            // Called again during close; just finish what we were doing.
20745f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell            return;
20845f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell        }
209d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        if (mClose == null) {
210d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            killMode();
211d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            return;
212d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        }
213d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
214d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        finishAnimation();
215a1e6358a4c62c8b6de1f2428901e45b688bd9e9fAdam Powell        mAnimationMode = ANIMATE_OUT;
216d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        mCurrentAnimation = makeOutAnimation();
217d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        mCurrentAnimation.start();
218d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    }
219d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
220d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    private void finishAnimation() {
22145f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell        final Animator a = mCurrentAnimation;
222a1e6358a4c62c8b6de1f2428901e45b688bd9e9fAdam Powell        if (a != null) {
22345f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell            mCurrentAnimation = null;
22445f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell            a.end();
225d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        }
226d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    }
227d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
228d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    public void killMode() {
229d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        finishAnimation();
23089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        removeAllViews();
231640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell        if (mSplitView != null) {
232640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell            mSplitView.removeView(mMenuView);
233640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell        }
23489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        mCustomView = null;
2352c9c9fe806e51f29276e66b8ba40cb4b7a80c3f4Adam Powell        mMenuView = null;
23600bba682efedbe121f31c98697f91101b1c22b82Adam Powell        mAnimateInOnLayout = false;
23789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
2380e94b5151d817e600a888448a662208b29b5ef46Adam Powell
239c619e74cc62678cef09b5f92e87e762a1f02aab7Gilles Debunne    @Override
240f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell    public boolean showOverflowMenu() {
2418d02deabac62c4a68a335a7b3141795466362b89Adam Powell        if (mActionMenuPresenter != null) {
2428d02deabac62c4a68a335a7b3141795466362b89Adam Powell            return mActionMenuPresenter.showOverflowMenu();
243f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell        }
244f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell        return false;
245f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell    }
246f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell
247c619e74cc62678cef09b5f92e87e762a1f02aab7Gilles Debunne    @Override
248f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell    public boolean hideOverflowMenu() {
2498d02deabac62c4a68a335a7b3141795466362b89Adam Powell        if (mActionMenuPresenter != null) {
2508d02deabac62c4a68a335a7b3141795466362b89Adam Powell            return mActionMenuPresenter.hideOverflowMenu();
251f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell        }
252f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell        return false;
253f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell    }
254f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell
255c619e74cc62678cef09b5f92e87e762a1f02aab7Gilles Debunne    @Override
256f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell    public boolean isOverflowMenuShowing() {
2578d02deabac62c4a68a335a7b3141795466362b89Adam Powell        if (mActionMenuPresenter != null) {
2588d02deabac62c4a68a335a7b3141795466362b89Adam Powell            return mActionMenuPresenter.isOverflowMenuShowing();
259f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell        }
260f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell        return false;
261f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell    }
262f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell
26389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    @Override
264a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell    protected LayoutParams generateDefaultLayoutParams() {
265a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell        // Used by custom views if they don't supply layout params. Everything else
266a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell        // added to an ActionBarContextView should have them already.
2679ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell        return new MarginLayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
2689ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell    }
2699ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell
2709ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell    @Override
2719ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell    public LayoutParams generateLayoutParams(AttributeSet attrs) {
2729ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell        return new MarginLayoutParams(getContext(), attrs);
273a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell    }
274a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell
275a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell    @Override
27689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
27789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
27889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        if (widthMode != MeasureSpec.EXACTLY) {
27989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell            throw new IllegalStateException(getClass().getSimpleName() + " can only be used " +
28089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell                    "with android:layout_width=\"match_parent\" (or fill_parent)");
28189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
28289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
28389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
28485446e95afa480cee2247bb96795fccc8cf812afAdam Powell        if (heightMode == MeasureSpec.UNSPECIFIED) {
28589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell            throw new IllegalStateException(getClass().getSimpleName() + " can only be used " +
28689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell                    "with android:layout_height=\"wrap_content\"");
28789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
28889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
28989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        final int contentWidth = MeasureSpec.getSize(widthMeasureSpec);
29089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
291e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell        int maxHeight = mContentHeight > 0 ?
292e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell                mContentHeight : MeasureSpec.getSize(heightMeasureSpec);
293e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell
294e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell        final int verticalPadding = getPaddingTop() + getPaddingBottom();
29589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        int availableWidth = contentWidth - getPaddingLeft() - getPaddingRight();
296e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell        final int height = maxHeight - verticalPadding;
29789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        final int childSpecHeight = MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST);
29889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
299f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell        if (mClose != null) {
300f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell            availableWidth = measureChildView(mClose, availableWidth, childSpecHeight, 0);
3019ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell            MarginLayoutParams lp = (MarginLayoutParams) mClose.getLayoutParams();
3029ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell            availableWidth -= lp.leftMargin + lp.rightMargin;
30389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
30489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
305f6ce6a9bacbb220c6ea7b552c481237f23e64ae7Adam Powell        if (mMenuView != null && mMenuView.getParent() == this) {
306b0ff6f995553a5deb1f22e43e44715b316d33a88Adam Powell            availableWidth = measureChildView(mMenuView, availableWidth,
307b0ff6f995553a5deb1f22e43e44715b316d33a88Adam Powell                    childSpecHeight, 0);
30889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
30989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
310b0ff6f995553a5deb1f22e43e44715b316d33a88Adam Powell        if (mTitleLayout != null && mCustomView == null) {
311b0ff6f995553a5deb1f22e43e44715b316d33a88Adam Powell            availableWidth = measureChildView(mTitleLayout, availableWidth, childSpecHeight, 0);
31289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
31389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
31489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        if (mCustomView != null) {
315a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell            LayoutParams lp = mCustomView.getLayoutParams();
316a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell            final int customWidthMode = lp.width != LayoutParams.WRAP_CONTENT ?
317a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell                    MeasureSpec.EXACTLY : MeasureSpec.AT_MOST;
318a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell            final int customWidth = lp.width >= 0 ?
319a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell                    Math.min(lp.width, availableWidth) : availableWidth;
320a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell            final int customHeightMode = lp.height != LayoutParams.WRAP_CONTENT ?
321a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell                    MeasureSpec.EXACTLY : MeasureSpec.AT_MOST;
322a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell            final int customHeight = lp.height >= 0 ?
323a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell                    Math.min(lp.height, height) : height;
324a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell            mCustomView.measure(MeasureSpec.makeMeasureSpec(customWidth, customWidthMode),
325a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell                    MeasureSpec.makeMeasureSpec(customHeight, customHeightMode));
32689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
32789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
328e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell        if (mContentHeight <= 0) {
329e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell            int measuredHeight = 0;
330e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell            final int count = getChildCount();
331e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell            for (int i = 0; i < count; i++) {
332e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell                View v = getChildAt(i);
333e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell                int paddedViewHeight = v.getMeasuredHeight() + verticalPadding;
334e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell                if (paddedViewHeight > measuredHeight) {
335e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell                    measuredHeight = paddedViewHeight;
336e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell                }
337e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell            }
338e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell            setMeasuredDimension(contentWidth, measuredHeight);
339e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell        } else {
340e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell            setMeasuredDimension(contentWidth, maxHeight);
341e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell        }
34289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
34389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
344d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    private Animator makeInAnimation() {
3459ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell        mClose.setTranslationX(-mClose.getWidth() -
3469ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell                ((MarginLayoutParams) mClose.getLayoutParams()).leftMargin);
347d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        ObjectAnimator buttonAnimator = ObjectAnimator.ofFloat(mClose, "translationX", 0);
348d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        buttonAnimator.setDuration(200);
349d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        buttonAnimator.addListener(this);
350d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        buttonAnimator.setInterpolator(new DecelerateInterpolator());
351d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
352d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        AnimatorSet set = new AnimatorSet();
353d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        AnimatorSet.Builder b = set.play(buttonAnimator);
354d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
355d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        if (mMenuView != null) {
356d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            final int count = mMenuView.getChildCount();
357d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            if (count > 0) {
358d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                for (int i = count - 1, j = 0; i >= 0; i--, j++) {
359d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    View child = mMenuView.getChildAt(i);
360d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    child.setScaleY(0);
361d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    ObjectAnimator a = ObjectAnimator.ofFloat(child, "scaleY", 0, 1);
362d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    a.setDuration(100);
363d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    a.setStartDelay(j * 70);
364d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    b.with(a);
365d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                }
366d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            }
367d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        }
368d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
369d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        return set;
370d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    }
371d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
372d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    private Animator makeOutAnimation() {
373d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        ObjectAnimator buttonAnimator = ObjectAnimator.ofFloat(mClose, "translationX",
3749ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell                -mClose.getWidth() - ((MarginLayoutParams) mClose.getLayoutParams()).leftMargin);
375d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        buttonAnimator.setDuration(200);
376d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        buttonAnimator.addListener(this);
377d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        buttonAnimator.setInterpolator(new DecelerateInterpolator());
378d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
379d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        AnimatorSet set = new AnimatorSet();
380d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        AnimatorSet.Builder b = set.play(buttonAnimator);
381d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
382d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        if (mMenuView != null) {
383d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            final int count = mMenuView.getChildCount();
384d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            if (count > 0) {
385d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                for (int i = 0; i < 0; i++) {
386d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    View child = mMenuView.getChildAt(i);
387d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    child.setScaleY(0);
388640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell                    ObjectAnimator a = ObjectAnimator.ofFloat(child, "scaleY", 0);
389d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    a.setDuration(100);
390d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    a.setStartDelay(i * 70);
391d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    b.with(a);
392d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                }
393d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            }
394d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        }
395d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
396d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        return set;
397d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    }
398d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
39989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    @Override
40089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    protected void onLayout(boolean changed, int l, int t, int r, int b) {
40189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        int x = getPaddingLeft();
40289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        final int y = getPaddingTop();
40389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        final int contentHeight = b - t - getPaddingTop() - getPaddingBottom();
40489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
405f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell        if (mClose != null && mClose.getVisibility() != GONE) {
4069ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell            MarginLayoutParams lp = (MarginLayoutParams) mClose.getLayoutParams();
4079ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell            x += lp.leftMargin;
408f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell            x += positionChild(mClose, x, y, contentHeight);
4099ca705e323cb737a07a667c1e86bac702f11a29cAdam Powell            x += lp.rightMargin;
410d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
411d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            if (mAnimateInOnLayout) {
412d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                mAnimationMode = ANIMATE_IN;
413d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                mCurrentAnimation = makeInAnimation();
414d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                mCurrentAnimation.start();
415d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                mAnimateInOnLayout = false;
416d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            }
41789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
418640a66eac612b850b5dabd3b93bd94f83ed2d567Adam Powell
4190e94b5151d817e600a888448a662208b29b5ef46Adam Powell        if (mTitleLayout != null && mCustomView == null) {
420be4d68e7b238b8ee879de0481e39c40d3f1683b6Adam Powell            x += positionChild(mTitleLayout, x, y, contentHeight);
42189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
42289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
42389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        if (mCustomView != null) {
424be4d68e7b238b8ee879de0481e39c40d3f1683b6Adam Powell            x += positionChild(mCustomView, x, y, contentHeight);
42589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
42689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
42789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        x = r - l - getPaddingRight();
42889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
4292c9c9fe806e51f29276e66b8ba40cb4b7a80c3f4Adam Powell        if (mMenuView != null) {
430be4d68e7b238b8ee879de0481e39c40d3f1683b6Adam Powell            x -= positionChildInverse(mMenuView, x, y, contentHeight);
43189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
43289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
43389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
434d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    @Override
435d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    public void onAnimationStart(Animator animation) {
436d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    }
437d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
438d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    @Override
439d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    public void onAnimationEnd(Animator animation) {
440a1e6358a4c62c8b6de1f2428901e45b688bd9e9fAdam Powell        if (mAnimationMode == ANIMATE_OUT) {
441d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            killMode();
442d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        }
443d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        mAnimationMode = ANIMATE_IDLE;
444d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    }
445d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
446d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    @Override
447d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    public void onAnimationCancel(Animator animation) {
448d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    }
449d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
450d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    @Override
451d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    public void onAnimationRepeat(Animator animation) {
452d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    }
453e0a799a2ac1ca78e30fbac9e4e12a063425c08d3Patrick Dubroy
454e0a799a2ac1ca78e30fbac9e4e12a063425c08d3Patrick Dubroy    @Override
455e0a799a2ac1ca78e30fbac9e4e12a063425c08d3Patrick Dubroy    public boolean shouldDelayChildPressedState() {
456e0a799a2ac1ca78e30fbac9e4e12a063425c08d3Patrick Dubroy        return false;
457e0a799a2ac1ca78e30fbac9e4e12a063425c08d3Patrick Dubroy    }
45889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell}
459