ActionBarContextView.java revision 00bba682efedbe121f31c98697f91101b1c22b82
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
1889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powellimport com.android.internal.R;
192c9c9fe806e51f29276e66b8ba40cb4b7a80c3f4Adam Powellimport com.android.internal.view.menu.ActionMenuView;
202c9c9fe806e51f29276e66b8ba40cb4b7a80c3f4Adam Powellimport com.android.internal.view.menu.MenuBuilder;
2189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
22d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powellimport android.animation.Animator;
23d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powellimport android.animation.Animator.AnimatorListener;
24d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powellimport android.animation.AnimatorSet;
25d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powellimport android.animation.ObjectAnimator;
2689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powellimport android.content.Context;
2789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powellimport android.content.res.TypedArray;
2889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powellimport android.util.AttributeSet;
29d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powellimport android.util.Log;
306e34636749217654f43221885afb7a29bb5ca96aAdam Powellimport android.view.ActionMode;
3189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powellimport android.view.LayoutInflater;
3289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powellimport android.view.View;
3389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powellimport android.view.ViewGroup;
34d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powellimport android.view.animation.DecelerateInterpolator;
350e94b5151d817e600a888448a662208b29b5ef46Adam Powellimport android.widget.LinearLayout;
3689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powellimport android.widget.TextView;
3789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
3889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell/**
3989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @hide
4089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell */
41d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powellpublic class ActionBarContextView extends ViewGroup implements AnimatorListener {
4289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    private int mContentHeight;
4389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
4489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    private CharSequence mTitle;
4589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    private CharSequence mSubtitle;
46f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell
47f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell    private View mClose;
4889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    private View mCustomView;
490e94b5151d817e600a888448a662208b29b5ef46Adam Powell    private LinearLayout mTitleLayout;
5089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    private TextView mTitleView;
510e94b5151d817e600a888448a662208b29b5ef46Adam Powell    private TextView mSubtitleView;
52bc234a19f4c74116454e2c77f4739290e761995aAdam Powell    private int mTitleStyleRes;
53bc234a19f4c74116454e2c77f4739290e761995aAdam Powell    private int mSubtitleStyleRes;
54b366bbae2b5a3009893ef64246e3430cea4b7736Adam Powell    private ActionMenuView mMenuView;
55d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
56d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    private Animator mCurrentAnimation;
57d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    private boolean mAnimateInOnLayout;
58d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    private int mAnimationMode;
59d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
60d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    private static final int ANIMATE_IDLE = 0;
61d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    private static final int ANIMATE_IN = 1;
62d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    private static final int ANIMATE_OUT = 2;
6389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
6489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    public ActionBarContextView(Context context) {
65bc234a19f4c74116454e2c77f4739290e761995aAdam Powell        this(context, null);
6689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
6789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
6889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    public ActionBarContextView(Context context, AttributeSet attrs) {
69bc234a19f4c74116454e2c77f4739290e761995aAdam Powell        this(context, attrs, com.android.internal.R.attr.actionModeStyle);
7089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
7189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
7289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    public ActionBarContextView(Context context, AttributeSet attrs, int defStyle) {
7389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        super(context, attrs, defStyle);
7489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
75bc234a19f4c74116454e2c77f4739290e761995aAdam Powell        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ActionMode, defStyle, 0);
7689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        setBackgroundDrawable(a.getDrawable(
77bc234a19f4c74116454e2c77f4739290e761995aAdam Powell                com.android.internal.R.styleable.ActionMode_background));
78bc234a19f4c74116454e2c77f4739290e761995aAdam Powell        mTitleStyleRes = a.getResourceId(
79bc234a19f4c74116454e2c77f4739290e761995aAdam Powell                com.android.internal.R.styleable.ActionMode_titleTextStyle, 0);
80bc234a19f4c74116454e2c77f4739290e761995aAdam Powell        mSubtitleStyleRes = a.getResourceId(
81bc234a19f4c74116454e2c77f4739290e761995aAdam Powell                com.android.internal.R.styleable.ActionMode_subtitleTextStyle, 0);
82dcdefbbff2bfecbfeb7b6459de130f376595c590Adam Powell
83e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell        mContentHeight = a.getLayoutDimension(
84bc234a19f4c74116454e2c77f4739290e761995aAdam Powell                com.android.internal.R.styleable.ActionMode_height, 0);
8589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        a.recycle();
8689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
8789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
889146ac706265cd8cce66907e617bc8572152eb97Adam Powell    @Override
899146ac706265cd8cce66907e617bc8572152eb97Adam Powell    public ActionMode startActionModeForChild(View child, ActionMode.Callback callback) {
909146ac706265cd8cce66907e617bc8572152eb97Adam Powell        // No starting an action mode for an existing action mode UI child! (Where would it go?)
919146ac706265cd8cce66907e617bc8572152eb97Adam Powell        return null;
929146ac706265cd8cce66907e617bc8572152eb97Adam Powell    }
939146ac706265cd8cce66907e617bc8572152eb97Adam Powell
94e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell    public void setHeight(int height) {
95e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell        mContentHeight = height;
96e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell    }
97e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell
9889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    public void setCustomView(View view) {
9989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        if (mCustomView != null) {
10089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell            removeView(mCustomView);
10189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
10289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        mCustomView = view;
1030e94b5151d817e600a888448a662208b29b5ef46Adam Powell        if (mTitleLayout != null) {
1040e94b5151d817e600a888448a662208b29b5ef46Adam Powell            removeView(mTitleLayout);
1050e94b5151d817e600a888448a662208b29b5ef46Adam Powell            mTitleLayout = null;
10689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
10789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        if (view != null) {
10889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell            addView(view);
10989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
11089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        requestLayout();
11189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
1120e94b5151d817e600a888448a662208b29b5ef46Adam Powell
11389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    public void setTitle(CharSequence title) {
11489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        mTitle = title;
1150e94b5151d817e600a888448a662208b29b5ef46Adam Powell        initTitle();
1160e94b5151d817e600a888448a662208b29b5ef46Adam Powell    }
1170e94b5151d817e600a888448a662208b29b5ef46Adam Powell
1180e94b5151d817e600a888448a662208b29b5ef46Adam Powell    public void setSubtitle(CharSequence subtitle) {
1190e94b5151d817e600a888448a662208b29b5ef46Adam Powell        mSubtitle = subtitle;
1200e94b5151d817e600a888448a662208b29b5ef46Adam Powell        initTitle();
1210e94b5151d817e600a888448a662208b29b5ef46Adam Powell    }
1220e94b5151d817e600a888448a662208b29b5ef46Adam Powell
12329ed7575c2129974a57ad77b3531bc5995940c6cAdam Powell    public CharSequence getTitle() {
12429ed7575c2129974a57ad77b3531bc5995940c6cAdam Powell        return mTitle;
12529ed7575c2129974a57ad77b3531bc5995940c6cAdam Powell    }
12629ed7575c2129974a57ad77b3531bc5995940c6cAdam Powell
12729ed7575c2129974a57ad77b3531bc5995940c6cAdam Powell    public CharSequence getSubtitle() {
12829ed7575c2129974a57ad77b3531bc5995940c6cAdam Powell        return mSubtitle;
12929ed7575c2129974a57ad77b3531bc5995940c6cAdam Powell    }
13029ed7575c2129974a57ad77b3531bc5995940c6cAdam Powell
1310e94b5151d817e600a888448a662208b29b5ef46Adam Powell    private void initTitle() {
1320e94b5151d817e600a888448a662208b29b5ef46Adam Powell        if (mTitleLayout == null) {
13389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell            LayoutInflater inflater = LayoutInflater.from(getContext());
134f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell            inflater.inflate(R.layout.action_bar_title_item, this);
135f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell            mTitleLayout = (LinearLayout) getChildAt(getChildCount() - 1);
1360e94b5151d817e600a888448a662208b29b5ef46Adam Powell            mTitleView = (TextView) mTitleLayout.findViewById(R.id.action_bar_title);
1370e94b5151d817e600a888448a662208b29b5ef46Adam Powell            mSubtitleView = (TextView) mTitleLayout.findViewById(R.id.action_bar_subtitle);
1380e94b5151d817e600a888448a662208b29b5ef46Adam Powell            if (mTitle != null) {
1390e94b5151d817e600a888448a662208b29b5ef46Adam Powell                mTitleView.setText(mTitle);
140bc234a19f4c74116454e2c77f4739290e761995aAdam Powell                if (mTitleStyleRes != 0) {
141bc234a19f4c74116454e2c77f4739290e761995aAdam Powell                    mTitleView.setTextAppearance(mContext, mTitleStyleRes);
142bc234a19f4c74116454e2c77f4739290e761995aAdam Powell                }
1430e94b5151d817e600a888448a662208b29b5ef46Adam Powell            }
1440e94b5151d817e600a888448a662208b29b5ef46Adam Powell            if (mSubtitle != null) {
1450e94b5151d817e600a888448a662208b29b5ef46Adam Powell                mSubtitleView.setText(mSubtitle);
146bc234a19f4c74116454e2c77f4739290e761995aAdam Powell                if (mSubtitleStyleRes != 0) {
147bc234a19f4c74116454e2c77f4739290e761995aAdam Powell                    mSubtitleView.setTextAppearance(mContext, mSubtitleStyleRes);
148bc234a19f4c74116454e2c77f4739290e761995aAdam Powell                }
1498350f7dbc3a62211b2891f35911e4073d24c4cc5Adam Powell                mSubtitleView.setVisibility(VISIBLE);
15089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell            }
15189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        } else {
1520e94b5151d817e600a888448a662208b29b5ef46Adam Powell            mTitleView.setText(mTitle);
1530e94b5151d817e600a888448a662208b29b5ef46Adam Powell            mSubtitleView.setText(mSubtitle);
1548350f7dbc3a62211b2891f35911e4073d24c4cc5Adam Powell            mSubtitleView.setVisibility(mSubtitle != null ? VISIBLE : GONE);
1550e94b5151d817e600a888448a662208b29b5ef46Adam Powell            if (mTitleLayout.getParent() == null) {
1560e94b5151d817e600a888448a662208b29b5ef46Adam Powell                addView(mTitleLayout);
15789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell            }
15889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
15989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
1600e94b5151d817e600a888448a662208b29b5ef46Adam Powell
1616e34636749217654f43221885afb7a29bb5ca96aAdam Powell    public void initForMode(final ActionMode mode) {
162dd10b66601ed0b288dc93b43e14cd9fd71355728Adam Powell        if (mAnimationMode != ANIMATE_IDLE || mAnimateInOnLayout) {
163128b6ba93d0549fd2beff4482678e1229dc1cf3dAdam Powell            killMode();
164128b6ba93d0549fd2beff4482678e1229dc1cf3dAdam Powell        }
16545f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell
166f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell        if (mClose == null) {
167f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell            LayoutInflater inflater = LayoutInflater.from(mContext);
168d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            mClose = inflater.inflate(R.layout.action_mode_close_item, this, false);
169d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            addView(mClose);
17045f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell        } else if (mClose.getParent() == null) {
171f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell            addView(mClose);
17289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
173f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell
174f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell        View closeButton = mClose.findViewById(R.id.action_mode_close_button);
175f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell        closeButton.setOnClickListener(new OnClickListener() {
176269b8bb0cbd78969450ea9ab255232d047580210Adam Powell            public void onClick(View v) {
177269b8bb0cbd78969450ea9ab255232d047580210Adam Powell                mode.finish();
178269b8bb0cbd78969450ea9ab255232d047580210Adam Powell            }
179269b8bb0cbd78969450ea9ab255232d047580210Adam Powell        });
18089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
1812c9c9fe806e51f29276e66b8ba40cb4b7a80c3f4Adam Powell        final MenuBuilder menu = (MenuBuilder) mode.getMenu();
182b366bbae2b5a3009893ef64246e3430cea4b7736Adam Powell        mMenuView = (ActionMenuView) menu.getMenuView(MenuBuilder.TYPE_ACTION_BUTTON, this);
183b366bbae2b5a3009893ef64246e3430cea4b7736Adam Powell        mMenuView.setOverflowReserved(true);
184b366bbae2b5a3009893ef64246e3430cea4b7736Adam Powell        mMenuView.updateChildren(false);
1852c9c9fe806e51f29276e66b8ba40cb4b7a80c3f4Adam Powell        addView(mMenuView);
186d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
187d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        mAnimateInOnLayout = true;
18889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
1890e94b5151d817e600a888448a662208b29b5ef46Adam Powell
19089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    public void closeMode() {
19145f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell        if (mAnimationMode == ANIMATE_OUT) {
19245f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell            // Called again during close; just finish what we were doing.
19345f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell            return;
19445f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell        }
195d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        if (mClose == null) {
196d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            killMode();
197d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            return;
198d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        }
199d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
200d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        mAnimationMode = ANIMATE_OUT;
201d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        finishAnimation();
202d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        mCurrentAnimation = makeOutAnimation();
203d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        mCurrentAnimation.start();
204d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    }
205d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
206d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    private void finishAnimation() {
20745f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell        final Animator a = mCurrentAnimation;
20845f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell        if (a != null && a.isRunning()) {
20945f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell            mCurrentAnimation = null;
21045f1e08c348ccb129bcc25e438c05421f7123f41Adam Powell            a.end();
211d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        }
212d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    }
213d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
214d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    public void killMode() {
215d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        finishAnimation();
21689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        removeAllViews();
21789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        mCustomView = null;
2182c9c9fe806e51f29276e66b8ba40cb4b7a80c3f4Adam Powell        mMenuView = null;
21900bba682efedbe121f31c98697f91101b1c22b82Adam Powell        mAnimateInOnLayout = false;
22089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
2210e94b5151d817e600a888448a662208b29b5ef46Adam Powell
222f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell    public boolean showOverflowMenu() {
223f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell        if (mMenuView != null) {
224f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell            return mMenuView.showOverflowMenu();
225f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell        }
226f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell        return false;
227f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell    }
228f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell
2298515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell    public void openOverflowMenu() {
2308515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell        if (mMenuView != null) {
2318515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell            mMenuView.openOverflowMenu();
2328515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell        }
2338515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell    }
2348515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell
235f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell    public boolean hideOverflowMenu() {
236f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell        if (mMenuView != null) {
237f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell            return mMenuView.hideOverflowMenu();
238f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell        }
239f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell        return false;
240f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell    }
241f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell
242f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell    public boolean isOverflowMenuShowing() {
243f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell        if (mMenuView != null) {
244f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell            return mMenuView.isOverflowMenuShowing();
245f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell        }
246f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell        return false;
247f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell    }
248f6148c53f93978af678cc0559a4417b608a33ae1Adam Powell
24989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    @Override
250a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell    protected LayoutParams generateDefaultLayoutParams() {
251a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell        // Used by custom views if they don't supply layout params. Everything else
252a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell        // added to an ActionBarContextView should have them already.
253a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell        return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
254a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell    }
255a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell
256a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell    @Override
25789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
25889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
25989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        if (widthMode != MeasureSpec.EXACTLY) {
26089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell            throw new IllegalStateException(getClass().getSimpleName() + " can only be used " +
26189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell                    "with android:layout_width=\"match_parent\" (or fill_parent)");
26289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
26389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
26489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
26585446e95afa480cee2247bb96795fccc8cf812afAdam Powell        if (heightMode == MeasureSpec.UNSPECIFIED) {
26689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell            throw new IllegalStateException(getClass().getSimpleName() + " can only be used " +
26789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell                    "with android:layout_height=\"wrap_content\"");
26889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
26989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
27089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        final int contentWidth = MeasureSpec.getSize(widthMeasureSpec);
27189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
272e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell        int maxHeight = mContentHeight > 0 ?
273e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell                mContentHeight : MeasureSpec.getSize(heightMeasureSpec);
274e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell
275e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell        final int verticalPadding = getPaddingTop() + getPaddingBottom();
27689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        int availableWidth = contentWidth - getPaddingLeft() - getPaddingRight();
277e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell        final int height = maxHeight - verticalPadding;
27889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        final int childSpecHeight = MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST);
27989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
280f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell        if (mClose != null) {
281f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell            availableWidth = measureChildView(mClose, availableWidth, childSpecHeight, 0);
28289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
28389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
2840e94b5151d817e600a888448a662208b29b5ef46Adam Powell        if (mTitleLayout != null && mCustomView == null) {
285be4d68e7b238b8ee879de0481e39c40d3f1683b6Adam Powell            availableWidth = measureChildView(mTitleLayout, availableWidth, childSpecHeight, 0);
28689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
28789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
28889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        final int childCount = getChildCount();
28989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        for (int i = 0; i < childCount; i++) {
29089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell            final View child = getChildAt(i);
291f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell            if (child == mClose || child == mTitleLayout || child == mCustomView) {
29289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell                continue;
29389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell            }
29489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
295be4d68e7b238b8ee879de0481e39c40d3f1683b6Adam Powell            availableWidth = measureChildView(child, availableWidth, childSpecHeight, 0);
29689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
29789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
29889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        if (mCustomView != null) {
299a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell            LayoutParams lp = mCustomView.getLayoutParams();
300a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell            final int customWidthMode = lp.width != LayoutParams.WRAP_CONTENT ?
301a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell                    MeasureSpec.EXACTLY : MeasureSpec.AT_MOST;
302a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell            final int customWidth = lp.width >= 0 ?
303a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell                    Math.min(lp.width, availableWidth) : availableWidth;
304a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell            final int customHeightMode = lp.height != LayoutParams.WRAP_CONTENT ?
305a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell                    MeasureSpec.EXACTLY : MeasureSpec.AT_MOST;
306a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell            final int customHeight = lp.height >= 0 ?
307a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell                    Math.min(lp.height, height) : height;
308a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell            mCustomView.measure(MeasureSpec.makeMeasureSpec(customWidth, customWidthMode),
309a7db03705f53c59e63e63c2e67e2db78f8226dccAdam Powell                    MeasureSpec.makeMeasureSpec(customHeight, customHeightMode));
31089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
31189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
312e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell        if (mContentHeight <= 0) {
313e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell            int measuredHeight = 0;
314e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell            final int count = getChildCount();
315e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell            for (int i = 0; i < count; i++) {
316e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell                View v = getChildAt(i);
317e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell                int paddedViewHeight = v.getMeasuredHeight() + verticalPadding;
318e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell                if (paddedViewHeight > measuredHeight) {
319e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell                    measuredHeight = paddedViewHeight;
320e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell                }
321e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell            }
322e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell            setMeasuredDimension(contentWidth, measuredHeight);
323e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell        } else {
324e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell            setMeasuredDimension(contentWidth, maxHeight);
325e2194445b078932733a2d1a02fc084ea2f3c7360Adam Powell        }
32689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
32789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
328d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    private Animator makeInAnimation() {
329d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        mClose.setTranslationX(-mClose.getWidth());
330d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        ObjectAnimator buttonAnimator = ObjectAnimator.ofFloat(mClose, "translationX", 0);
331d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        buttonAnimator.setDuration(200);
332d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        buttonAnimator.addListener(this);
333d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        buttonAnimator.setInterpolator(new DecelerateInterpolator());
334d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
335d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        AnimatorSet set = new AnimatorSet();
336d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        AnimatorSet.Builder b = set.play(buttonAnimator);
337d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
338d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        if (mMenuView != null) {
339d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            final int count = mMenuView.getChildCount();
340d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            if (count > 0) {
341d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                for (int i = count - 1, j = 0; i >= 0; i--, j++) {
342d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    View child = mMenuView.getChildAt(i);
343d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    child.setScaleY(0);
344d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    ObjectAnimator a = ObjectAnimator.ofFloat(child, "scaleY", 0, 1);
345d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    a.setDuration(100);
346d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    a.setStartDelay(j * 70);
347d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    b.with(a);
348d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                }
349d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            }
350d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        }
351d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
352d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        return set;
353d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    }
354d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
355d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    private Animator makeOutAnimation() {
356d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        ObjectAnimator buttonAnimator = ObjectAnimator.ofFloat(mClose, "translationX",
357d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                0, -mClose.getWidth());
358d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        buttonAnimator.setDuration(200);
359d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        buttonAnimator.addListener(this);
360d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        buttonAnimator.setInterpolator(new DecelerateInterpolator());
361d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
362d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        AnimatorSet set = new AnimatorSet();
363d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        AnimatorSet.Builder b = set.play(buttonAnimator);
364d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
365d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        if (mMenuView != null) {
366d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            final int count = mMenuView.getChildCount();
367d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            if (count > 0) {
368d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                for (int i = 0; i < 0; i++) {
369d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    View child = mMenuView.getChildAt(i);
370d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    child.setScaleY(0);
371d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    ObjectAnimator a = ObjectAnimator.ofFloat(child, "scaleY", 1, 0);
372d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    a.setDuration(100);
373d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    a.setStartDelay(i * 70);
374d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                    b.with(a);
375d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                }
376d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            }
377d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        }
378d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
379d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        return set;
380d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    }
381d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
38289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    @Override
38389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    protected void onLayout(boolean changed, int l, int t, int r, int b) {
38489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        int x = getPaddingLeft();
38589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        final int y = getPaddingTop();
38689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        final int contentHeight = b - t - getPaddingTop() - getPaddingBottom();
38789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
388f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell        if (mClose != null && mClose.getVisibility() != GONE) {
389f16888f1e849b0bc0b9c17e5f833c4e2cd54c382Adam Powell            x += positionChild(mClose, x, y, contentHeight);
390d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
391d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            if (mAnimateInOnLayout) {
392d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                mAnimationMode = ANIMATE_IN;
393d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                mCurrentAnimation = makeInAnimation();
394d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                mCurrentAnimation.start();
395d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell                mAnimateInOnLayout = false;
396d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            }
39789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
39889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
3990e94b5151d817e600a888448a662208b29b5ef46Adam Powell        if (mTitleLayout != null && mCustomView == null) {
400be4d68e7b238b8ee879de0481e39c40d3f1683b6Adam Powell            x += positionChild(mTitleLayout, x, y, contentHeight);
40189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
40289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
40389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        if (mCustomView != null) {
404be4d68e7b238b8ee879de0481e39c40d3f1683b6Adam Powell            x += positionChild(mCustomView, x, y, contentHeight);
40589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
40689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
40789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        x = r - l - getPaddingRight();
40889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
4092c9c9fe806e51f29276e66b8ba40cb4b7a80c3f4Adam Powell        if (mMenuView != null) {
410be4d68e7b238b8ee879de0481e39c40d3f1683b6Adam Powell            x -= positionChildInverse(mMenuView, x, y, contentHeight);
41189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        }
41289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
41389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
41489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    private int measureChildView(View child, int availableWidth, int childSpecHeight, int spacing) {
41589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        child.measure(MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST),
41689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell                childSpecHeight);
41789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
41889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        availableWidth -= child.getMeasuredWidth();
41989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        availableWidth -= spacing;
42089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
42189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        return availableWidth;
42289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
42389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
42489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    private int positionChild(View child, int x, int y, int contentHeight) {
42589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        int childWidth = child.getMeasuredWidth();
42689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        int childHeight = child.getMeasuredHeight();
42789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        int childTop = y + (contentHeight - childHeight) / 2;
42889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
42989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        child.layout(x, childTop, x + childWidth, childTop + childHeight);
43089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
43189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        return childWidth;
43289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
43389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
43489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    private int positionChildInverse(View child, int x, int y, int contentHeight) {
43589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        int childWidth = child.getMeasuredWidth();
43689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        int childHeight = child.getMeasuredHeight();
43789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        int childTop = y + (contentHeight - childHeight) / 2;
43889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
43989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        child.layout(x - childWidth, childTop, x, childTop + childHeight);
44089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
44189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        return childWidth;
44289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    }
443d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
444d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    @Override
445d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    public void onAnimationStart(Animator animation) {
446d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    }
447d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
448d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    @Override
449d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    public void onAnimationEnd(Animator animation) {
450d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        if (mAnimationMode == ANIMATE_OUT) {
451d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell            killMode();
452d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        }
453d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell        mAnimationMode = ANIMATE_IDLE;
454d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    }
455d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
456d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    @Override
457d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    public void onAnimationCancel(Animator animation) {
458d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    }
459d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell
460d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    @Override
461d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    public void onAnimationRepeat(Animator animation) {
462d8b3f2e8eee5f24de6653a918613674e9495f751Adam Powell    }
46389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell}
464