ExpandableNotificationRow.java revision 7d447726e2cb9fae80db417012039828daab8fe7
151c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren/*
251c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren * Copyright (C) 2013 The Android Open Source Project
351c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren *
451c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren * Licensed under the Apache License, Version 2.0 (the "License");
551c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren * you may not use this file except in compliance with the License.
651c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren * You may obtain a copy of the License at
751c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren *
851c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren *      http://www.apache.org/licenses/LICENSE-2.0
951c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren *
1051c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren * Unless required by applicable law or agreed to in writing, software
1151c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren * distributed under the License is distributed on an "AS IS" BASIS,
1251c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1351c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren * See the License for the specific language governing permissions and
1451c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren * limitations under the License.
1551c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren */
1651c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren
1751c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wrenpackage com.android.systemui.statusbar;
1851c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren
1951c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wrenimport android.content.Context;
2051c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wrenimport android.util.AttributeSet;
21a5e0f415d351ad1a9c0ffde8d93df91a2384591fDan Sandlerimport android.view.View;
22fe40f7d13bfc1faa35c9a131ce4be5104cb8f6b9Jorim Jaggiimport android.view.accessibility.AccessibilityEvent;
2351c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren
24a5e0f415d351ad1a9c0ffde8d93df91a2384591fDan Sandlerimport com.android.systemui.R;
25a5e0f415d351ad1a9c0ffde8d93df91a2384591fDan Sandler
264222d9a7fb87d73e1443ec1a2de9782b05741af6Jorim Jaggipublic class ExpandableNotificationRow extends ActivatableNotificationView {
271685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    private int mRowMinHeight;
281685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    private int mRowMaxHeight;
2951c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren
301685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    /** Does this row contain layouts that can adapt to row expansion */
3151c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren    private boolean mExpandable;
321685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    /** Has the user actively changed the expansion state of this row */
331685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    private boolean mHasUserChangedExpansion;
341685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    /** If {@link #mHasUserChangedExpansion}, has the user expanded this row */
3551c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren    private boolean mUserExpanded;
361685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    /** Is the user touching this row */
3751c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren    private boolean mUserLocked;
381685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    /** Are we showing the "public" version */
39a5e0f415d351ad1a9c0ffde8d93df91a2384591fDan Sandler    private boolean mShowingPublic;
4051c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren
411685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    /**
421685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     * Is this notification expanded by the system. The expansion state can be overridden by the
431685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     * user expansion.
441685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     */
451685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    private boolean mIsSystemExpanded;
46dce3c4cca5d4df4cc49c1a9f0537e2fecdbc45d2Jorim Jaggi
47dce3c4cca5d4df4cc49c1a9f0537e2fecdbc45d2Jorim Jaggi    /**
48dce3c4cca5d4df4cc49c1a9f0537e2fecdbc45d2Jorim Jaggi     * Whether the notification expansion is disabled. This is the case on Keyguard.
49dce3c4cca5d4df4cc49c1a9f0537e2fecdbc45d2Jorim Jaggi     */
50dce3c4cca5d4df4cc49c1a9f0537e2fecdbc45d2Jorim Jaggi    private boolean mExpansionDisabled;
51dce3c4cca5d4df4cc49c1a9f0537e2fecdbc45d2Jorim Jaggi
52be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi    private NotificationContentView mPublicLayout;
53be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi    private NotificationContentView mPrivateLayout;
541685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    private int mMaxExpandHeight;
55c27437b7fd04e682ae2abdf0727a99bf5c6e409dSelim Cinek    private boolean mIsBelowSpeedBump;
56863834bd96bdebcf21f4c4a7d8285d4858c061e4Selim Cinek    private View mVetoButton;
571685e634fb0b14033bd436af8d7174436699ffecSelim Cinek
5851c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren    public ExpandableNotificationRow(Context context, AttributeSet attrs) {
5951c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren        super(context, attrs);
6051c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren    }
6151c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren
62251957d76e57eb6e5f8068b37346144e10e586a4Jorim Jaggi    @Override
63251957d76e57eb6e5f8068b37346144e10e586a4Jorim Jaggi    protected void onFinishInflate() {
64251957d76e57eb6e5f8068b37346144e10e586a4Jorim Jaggi        super.onFinishInflate();
65be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi        mPublicLayout = (NotificationContentView) findViewById(R.id.expandedPublic);
66be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi        mPrivateLayout = (NotificationContentView) findViewById(R.id.expanded);
67863834bd96bdebcf21f4c4a7d8285d4858c061e4Selim Cinek        mVetoButton = findViewById(R.id.veto);
68fe40f7d13bfc1faa35c9a131ce4be5104cb8f6b9Jorim Jaggi    }
69fe40f7d13bfc1faa35c9a131ce4be5104cb8f6b9Jorim Jaggi
70fe40f7d13bfc1faa35c9a131ce4be5104cb8f6b9Jorim Jaggi    @Override
71fe40f7d13bfc1faa35c9a131ce4be5104cb8f6b9Jorim Jaggi    public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) {
72fe40f7d13bfc1faa35c9a131ce4be5104cb8f6b9Jorim Jaggi        if (super.onRequestSendAccessibilityEvent(child, event)) {
73fe40f7d13bfc1faa35c9a131ce4be5104cb8f6b9Jorim Jaggi            // Add a record for the entire layout since its content is somehow small.
74fe40f7d13bfc1faa35c9a131ce4be5104cb8f6b9Jorim Jaggi            // The event comes from a leaf view that is interacted with.
75fe40f7d13bfc1faa35c9a131ce4be5104cb8f6b9Jorim Jaggi            AccessibilityEvent record = AccessibilityEvent.obtain();
76fe40f7d13bfc1faa35c9a131ce4be5104cb8f6b9Jorim Jaggi            onInitializeAccessibilityEvent(record);
77fe40f7d13bfc1faa35c9a131ce4be5104cb8f6b9Jorim Jaggi            dispatchPopulateAccessibilityEvent(record);
78fe40f7d13bfc1faa35c9a131ce4be5104cb8f6b9Jorim Jaggi            event.appendRecord(record);
79fe40f7d13bfc1faa35c9a131ce4be5104cb8f6b9Jorim Jaggi            return true;
80fe40f7d13bfc1faa35c9a131ce4be5104cb8f6b9Jorim Jaggi        }
81fe40f7d13bfc1faa35c9a131ce4be5104cb8f6b9Jorim Jaggi        return false;
82c5dc0d0cce373fbf292e13633c114a431d747167Jorim Jaggi    }
8351c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren
841685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    public void setHeightRange(int rowMinHeight, int rowMaxHeight) {
851685e634fb0b14033bd436af8d7174436699ffecSelim Cinek        mRowMinHeight = rowMinHeight;
861685e634fb0b14033bd436af8d7174436699ffecSelim Cinek        mRowMaxHeight = rowMaxHeight;
8751c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren    }
8851c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren
8951c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren    public boolean isExpandable() {
9051c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren        return mExpandable;
9151c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren    }
9251c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren
9351c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren    public void setExpandable(boolean expandable) {
9451c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren        mExpandable = expandable;
9551c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren    }
9651c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren
971685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    /**
981685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     * @return whether the user has changed the expansion state
991685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     */
1001685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    public boolean hasUserChangedExpansion() {
1011685e634fb0b14033bd436af8d7174436699ffecSelim Cinek        return mHasUserChangedExpansion;
1021685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    }
1031685e634fb0b14033bd436af8d7174436699ffecSelim Cinek
10451c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren    public boolean isUserExpanded() {
10551c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren        return mUserExpanded;
10651c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren    }
10751c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren
1081685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    /**
1091685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     * Set this notification to be expanded by the user
1101685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     *
1111685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     * @param userExpanded whether the user wants this notification to be expanded
1121685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     */
11351c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren    public void setUserExpanded(boolean userExpanded) {
1141685e634fb0b14033bd436af8d7174436699ffecSelim Cinek        mHasUserChangedExpansion = true;
11551c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren        mUserExpanded = userExpanded;
11651c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren    }
11751c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren
11851c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren    public boolean isUserLocked() {
11951c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren        return mUserLocked;
12051c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren    }
12151c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren
12251c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren    public void setUserLocked(boolean userLocked) {
12351c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren        mUserLocked = userLocked;
12451c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren    }
12551c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren
1261685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    /**
1271685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     * @return has the system set this notification to be expanded
1281685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     */
1291685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    public boolean isSystemExpanded() {
1301685e634fb0b14033bd436af8d7174436699ffecSelim Cinek        return mIsSystemExpanded;
1311685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    }
1321685e634fb0b14033bd436af8d7174436699ffecSelim Cinek
1331685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    /**
1341685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     * Set this notification to be expanded by the system.
1351685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     *
1361685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     * @param expand whether the system wants this notification to be expanded.
1371685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     */
1381685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    public void setSystemExpanded(boolean expand) {
1391685e634fb0b14033bd436af8d7174436699ffecSelim Cinek        mIsSystemExpanded = expand;
1409cbadd3c08a7d7dd3412743dd04aecb16c5a1595Jorim Jaggi        notifyHeightChanged();
141dce3c4cca5d4df4cc49c1a9f0537e2fecdbc45d2Jorim Jaggi    }
142dce3c4cca5d4df4cc49c1a9f0537e2fecdbc45d2Jorim Jaggi
143dce3c4cca5d4df4cc49c1a9f0537e2fecdbc45d2Jorim Jaggi    /**
144dce3c4cca5d4df4cc49c1a9f0537e2fecdbc45d2Jorim Jaggi     * @param expansionDisabled whether to prevent notification expansion
145dce3c4cca5d4df4cc49c1a9f0537e2fecdbc45d2Jorim Jaggi     */
146dce3c4cca5d4df4cc49c1a9f0537e2fecdbc45d2Jorim Jaggi    public void setExpansionDisabled(boolean expansionDisabled) {
147dce3c4cca5d4df4cc49c1a9f0537e2fecdbc45d2Jorim Jaggi        mExpansionDisabled = expansionDisabled;
1489cbadd3c08a7d7dd3412743dd04aecb16c5a1595Jorim Jaggi        notifyHeightChanged();
1491685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    }
1501685e634fb0b14033bd436af8d7174436699ffecSelim Cinek
1511685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    /**
1521685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     * Apply an expansion state to the layout.
1531685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     */
154dce3c4cca5d4df4cc49c1a9f0537e2fecdbc45d2Jorim Jaggi    public void applyExpansionToLayout() {
155dce3c4cca5d4df4cc49c1a9f0537e2fecdbc45d2Jorim Jaggi        boolean expand = isExpanded();
15651c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren        if (expand && mExpandable) {
157be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi            setActualHeight(mMaxExpandHeight);
15851c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren        } else {
159be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi            setActualHeight(mRowMinHeight);
16051c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren        }
16151c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren    }
162a5e0f415d351ad1a9c0ffde8d93df91a2384591fDan Sandler
1639cbadd3c08a7d7dd3412743dd04aecb16c5a1595Jorim Jaggi    @Override
1649cbadd3c08a7d7dd3412743dd04aecb16c5a1595Jorim Jaggi    public int getIntrinsicHeight() {
165be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi        if (isUserLocked()) {
166be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi            return getActualHeight();
167be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi        }
1681685e634fb0b14033bd436af8d7174436699ffecSelim Cinek        boolean inExpansionState = isExpanded();
1691685e634fb0b14033bd436af8d7174436699ffecSelim Cinek        if (!inExpansionState) {
1701685e634fb0b14033bd436af8d7174436699ffecSelim Cinek            // not expanded, so we return the collapsed size
1711685e634fb0b14033bd436af8d7174436699ffecSelim Cinek            return mRowMinHeight;
1721685e634fb0b14033bd436af8d7174436699ffecSelim Cinek        }
1731685e634fb0b14033bd436af8d7174436699ffecSelim Cinek
1741685e634fb0b14033bd436af8d7174436699ffecSelim Cinek        return mShowingPublic ? mRowMinHeight : getMaxExpandHeight();
1751685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    }
1761685e634fb0b14033bd436af8d7174436699ffecSelim Cinek
1771685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    /**
1781685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     * Check whether the view state is currently expanded. This is given by the system in {@link
1791685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     * #setSystemExpanded(boolean)} and can be overridden by user expansion or
1801685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     * collapsing in {@link #setUserExpanded(boolean)}. Note that the visual appearance of this
1811685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     * view can differ from this state, if layout params are modified from outside.
1821685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     *
1831685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     * @return whether the view state is currently expanded.
1841685e634fb0b14033bd436af8d7174436699ffecSelim Cinek     */
1851685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    private boolean isExpanded() {
186dce3c4cca5d4df4cc49c1a9f0537e2fecdbc45d2Jorim Jaggi        return !mExpansionDisabled
187dce3c4cca5d4df4cc49c1a9f0537e2fecdbc45d2Jorim Jaggi                && (!hasUserChangedExpansion() && isSystemExpanded() || isUserExpanded());
1881685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    }
1891685e634fb0b14033bd436af8d7174436699ffecSelim Cinek
1901685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    @Override
1911685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
1921685e634fb0b14033bd436af8d7174436699ffecSelim Cinek        super.onLayout(changed, left, top, right, bottom);
193be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi        boolean updateExpandHeight = mMaxExpandHeight == 0;
194be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi        mMaxExpandHeight = mPrivateLayout.getMaxHeight();
195be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi        if (updateExpandHeight) {
196dce3c4cca5d4df4cc49c1a9f0537e2fecdbc45d2Jorim Jaggi            applyExpansionToLayout();
197be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi        }
1981685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    }
1991685e634fb0b14033bd436af8d7174436699ffecSelim Cinek
200a5e0f415d351ad1a9c0ffde8d93df91a2384591fDan Sandler    public void setShowingPublic(boolean show) {
201a5e0f415d351ad1a9c0ffde8d93df91a2384591fDan Sandler        mShowingPublic = show;
202a5e0f415d351ad1a9c0ffde8d93df91a2384591fDan Sandler
203a5e0f415d351ad1a9c0ffde8d93df91a2384591fDan Sandler        // bail out if no public version
2041685e634fb0b14033bd436af8d7174436699ffecSelim Cinek        if (mPublicLayout.getChildCount() == 0) return;
205a5e0f415d351ad1a9c0ffde8d93df91a2384591fDan Sandler
206a5e0f415d351ad1a9c0ffde8d93df91a2384591fDan Sandler        // TODO: animation?
2071685e634fb0b14033bd436af8d7174436699ffecSelim Cinek        mPublicLayout.setVisibility(show ? View.VISIBLE : View.GONE);
2081685e634fb0b14033bd436af8d7174436699ffecSelim Cinek        mPrivateLayout.setVisibility(show ? View.GONE : View.VISIBLE);
209a5e0f415d351ad1a9c0ffde8d93df91a2384591fDan Sandler    }
210251957d76e57eb6e5f8068b37346144e10e586a4Jorim Jaggi
2111685e634fb0b14033bd436af8d7174436699ffecSelim Cinek    public int getMaxExpandHeight() {
2121685e634fb0b14033bd436af8d7174436699ffecSelim Cinek        return mMaxExpandHeight;
213a5e0f415d351ad1a9c0ffde8d93df91a2384591fDan Sandler    }
214584a7aa62c54bcbd654a6696d4fbb56e124874e7Jorim Jaggi
215343e6e258ab6a9f647eabebaed05ce3acafd2ff1Selim Cinek    /**
216343e6e258ab6a9f647eabebaed05ce3acafd2ff1Selim Cinek     * @return the potential height this view could expand in addition.
217343e6e258ab6a9f647eabebaed05ce3acafd2ff1Selim Cinek     */
218343e6e258ab6a9f647eabebaed05ce3acafd2ff1Selim Cinek    public int getExpandPotential() {
2199cbadd3c08a7d7dd3412743dd04aecb16c5a1595Jorim Jaggi        return getIntrinsicHeight() - getActualHeight();
220be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi    }
221be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi
222be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi    @Override
2234222d9a7fb87d73e1443ec1a2de9782b05741af6Jorim Jaggi    public boolean isContentExpandable() {
2244222d9a7fb87d73e1443ec1a2de9782b05741af6Jorim Jaggi        return mPrivateLayout.isContentExpandable();
2254222d9a7fb87d73e1443ec1a2de9782b05741af6Jorim Jaggi    }
2264222d9a7fb87d73e1443ec1a2de9782b05741af6Jorim Jaggi
2274222d9a7fb87d73e1443ec1a2de9782b05741af6Jorim Jaggi    @Override
228d552d9d8e964c102e6832610be46cf2c041e8829Jorim Jaggi    public void setActualHeight(int height, boolean notifyListeners) {
229c9c00ae2fa5fb787e9f12705f8cd8de445ecde4bSelim Cinek        mPrivateLayout.setActualHeight(height);
230be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi        invalidate();
231d552d9d8e964c102e6832610be46cf2c041e8829Jorim Jaggi        super.setActualHeight(height, notifyListeners);
232be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi    }
233be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi
234be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi    @Override
235be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi    public int getMaxHeight() {
236be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi        return mPrivateLayout.getMaxHeight();
237be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi    }
238be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi
239be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi    @Override
2404222d9a7fb87d73e1443ec1a2de9782b05741af6Jorim Jaggi    public int getMinHeight() {
2414222d9a7fb87d73e1443ec1a2de9782b05741af6Jorim Jaggi        return mPrivateLayout.getMinHeight();
2424222d9a7fb87d73e1443ec1a2de9782b05741af6Jorim Jaggi    }
2434222d9a7fb87d73e1443ec1a2de9782b05741af6Jorim Jaggi
2444222d9a7fb87d73e1443ec1a2de9782b05741af6Jorim Jaggi    @Override
245be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi    public void setClipTopAmount(int clipTopAmount) {
246be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi        super.setClipTopAmount(clipTopAmount);
247be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi        mPrivateLayout.setClipTopAmount(clipTopAmount);
248be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi    }
249be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi
250c27437b7fd04e682ae2abdf0727a99bf5c6e409dSelim Cinek    public boolean isBelowSpeedBump() {
251c27437b7fd04e682ae2abdf0727a99bf5c6e409dSelim Cinek        return mIsBelowSpeedBump;
252c27437b7fd04e682ae2abdf0727a99bf5c6e409dSelim Cinek    }
253c27437b7fd04e682ae2abdf0727a99bf5c6e409dSelim Cinek
254c27437b7fd04e682ae2abdf0727a99bf5c6e409dSelim Cinek    public void setIsBelowSpeedBump(boolean isBelow) {
255c27437b7fd04e682ae2abdf0727a99bf5c6e409dSelim Cinek        this.mIsBelowSpeedBump = isBelow;
256c27437b7fd04e682ae2abdf0727a99bf5c6e409dSelim Cinek    }
257c27437b7fd04e682ae2abdf0727a99bf5c6e409dSelim Cinek
258be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi    public void notifyContentUpdated() {
259be565dfc1c17b7ddafa9753851b8f82849fd3f42Jorim Jaggi        mPrivateLayout.notifyContentUpdated();
260343e6e258ab6a9f647eabebaed05ce3acafd2ff1Selim Cinek    }
2617d447726e2cb9fae80db417012039828daab8fe7Selim Cinek
2627d447726e2cb9fae80db417012039828daab8fe7Selim Cinek    public boolean isShowingLayoutLayouted() {
2637d447726e2cb9fae80db417012039828daab8fe7Selim Cinek        View showingLayout = mShowingPublic ? mPublicLayout : mPrivateLayout;
2647d447726e2cb9fae80db417012039828daab8fe7Selim Cinek        return showingLayout.getWidth() != 0;
2657d447726e2cb9fae80db417012039828daab8fe7Selim Cinek    }
26651c7510e493680b4aca1ed7695b35c52d2cd63ffChris Wren}
267