ExpandableNotificationRow.java revision cd35def3c35f04d7fd056590d4668b5ebbc80490
1f5da3ec5ee5d31f2b243667c714ec9317e891ebbEzio Melotti/* 2f5da3ec5ee5d31f2b243667c714ec9317e891ebbEzio Melotti * Copyright (C) 2013 The Android Open Source Project 3f5da3ec5ee5d31f2b243667c714ec9317e891ebbEzio Melotti * 455c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake * Licensed under the Apache License, Version 2.0 (the "License"); 59e1fe1ec675386a4be12471a8b785a385d326316Guido van Rossum * you may not use this file except in compliance with the License. 6623511b7df11994469b83e7ea4ed77230703fce8Paul Prescod * You may obtain a copy of the License at 79e1fe1ec675386a4be12471a8b785a385d326316Guido van Rossum * 8623511b7df11994469b83e7ea4ed77230703fce8Paul Prescod * http://www.apache.org/licenses/LICENSE-2.0 955c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake * 1055c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake * Unless required by applicable law or agreed to in writing, software 1155c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake * distributed under the License is distributed on an "AS IS" BASIS, 1255c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1355c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake * See the License for the specific language governing permissions and 1455c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake * limitations under the License. 1555c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake */ 1655c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake 1755c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drakepackage com.android.systemui.statusbar; 18fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake 1955c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drakeimport android.animation.Animator; 20fbdeaad06910a50d6f05da177949b9a451a1132aFred Drakeimport android.animation.AnimatorListenerAdapter; 21fbdeaad06910a50d6f05da177949b9a451a1132aFred Drakeimport android.animation.AnimatorSet; 22fbdeaad06910a50d6f05da177949b9a451a1132aFred Drakeimport android.animation.ObjectAnimator; 233ac6a09eed70b5ebff9200a22e0ff7f010b36d0dFred Drakeimport android.animation.ValueAnimator; 24787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwisimport android.animation.ValueAnimator.AnimatorUpdateListener; 25787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwisimport android.app.Notification; 26787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwisimport android.content.Context; 27787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwisimport android.graphics.drawable.AnimatedVectorDrawable; 28787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwisimport android.graphics.drawable.AnimationDrawable; 29fbdeaad06910a50d6f05da177949b9a451a1132aFred Drakeimport android.graphics.drawable.ColorDrawable; 30fbdeaad06910a50d6f05da177949b9a451a1132aFred Drakeimport android.graphics.drawable.Drawable; 3195700f7cde5c0efa1ae7bc956f4ba54ec8508b51Martin v. Löwisimport android.os.Build; 323ac6a09eed70b5ebff9200a22e0ff7f010b36d0dFred Drakeimport android.service.notification.StatusBarNotification; 33fbdeaad06910a50d6f05da177949b9a451a1132aFred Drakeimport android.util.AttributeSet; 34126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwisimport android.view.LayoutInflater; 35575712eaca34cc8f9d712f690aec5442fe33031eFred Drakeimport android.view.MotionEvent; 36575712eaca34cc8f9d712f690aec5442fe33031eFred Drakeimport android.view.NotificationHeaderView; 37787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwisimport android.view.View; 38787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwisimport android.view.ViewStub; 3952ce0d08374a7d0c14a8cca46a85d0b53c359fccMartin v. Löwisimport android.view.accessibility.AccessibilityEvent; 40787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwisimport android.widget.Chronometer; 4155c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drakeimport android.widget.ImageView; 421f54902e05de94848fe728a24baf14dd605a65deFred Drakeimport android.widget.RemoteViews; 43787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 4455c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drakeimport com.android.internal.util.NotificationColorUtil; 457d650ca83bfdc42e852a4a6af00b80d230ecc54aMartin v. Löwisimport com.android.systemui.R; 467d650ca83bfdc42e852a4a6af00b80d230ecc54aMartin v. Löwisimport com.android.systemui.classifier.FalsingManager; 4755c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drakeimport com.android.systemui.statusbar.notification.HybridNotificationView; 487d650ca83bfdc42e852a4a6af00b80d230ecc54aMartin v. Löwisimport com.android.systemui.statusbar.notification.NotificationViewWrapper; 49cb67ea1d6e2dfb2680bba29144ef33fd2cc9a21aMartin v. Löwisimport com.android.systemui.statusbar.phone.NotificationGroupManager; 50cb67ea1d6e2dfb2680bba29144ef33fd2cc9a21aMartin v. Löwisimport com.android.systemui.statusbar.policy.HeadsUpManager; 51cb67ea1d6e2dfb2680bba29144ef33fd2cc9a21aMartin v. Löwisimport com.android.systemui.statusbar.stack.NotificationChildrenContainer; 527d650ca83bfdc42e852a4a6af00b80d230ecc54aMartin v. Löwisimport com.android.systemui.statusbar.stack.StackScrollState; 537d650ca83bfdc42e852a4a6af00b80d230ecc54aMartin v. Löwisimport com.android.systemui.statusbar.stack.StackStateAnimator; 547d650ca83bfdc42e852a4a6af00b80d230ecc54aMartin v. Löwisimport com.android.systemui.statusbar.stack.StackViewState; 557d650ca83bfdc42e852a4a6af00b80d230ecc54aMartin v. Löwis 567d650ca83bfdc42e852a4a6af00b80d230ecc54aMartin v. Löwisimport java.util.ArrayList; 577d650ca83bfdc42e852a4a6af00b80d230ecc54aMartin v. Löwisimport java.util.List; 587d650ca83bfdc42e852a4a6af00b80d230ecc54aMartin v. Löwis 597d650ca83bfdc42e852a4a6af00b80d230ecc54aMartin v. Löwispublic class ExpandableNotificationRow extends ActivatableNotificationView { 607d650ca83bfdc42e852a4a6af00b80d230ecc54aMartin v. Löwis 61cb67ea1d6e2dfb2680bba29144ef33fd2cc9a21aMartin v. Löwis private static final int DEFAULT_DIVIDER_ALPHA = 0x29; 6246fa39ab1d1e2f14c1b44c5e81c34c5f6cfb9a58Martin v. Löwis private static final int COLORED_DIVIDER_ALPHA = 0x7B; 631f54902e05de94848fe728a24baf14dd605a65deFred Drake private int mNotificationMinHeightLegacy; 641f54902e05de94848fe728a24baf14dd605a65deFred Drake private int mMaxHeadsUpHeightLegacy; 65787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private int mMaxHeadsUpHeight; 661f54902e05de94848fe728a24baf14dd605a65deFred Drake private int mNotificationMinHeight; 67787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private int mNotificationMaxHeight; 68787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 69787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis /** Does this row contain layouts that can adapt to row expansion */ 70787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private boolean mExpandable; 7155c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake /** Has the user actively changed the expansion state of this row */ 721f54902e05de94848fe728a24baf14dd605a65deFred Drake private boolean mHasUserChangedExpansion; 734ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake /** If {@link #mHasUserChangedExpansion}, has the user expanded this row */ 744ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake private boolean mUserExpanded; 7573678dac48e5858e40cba6d526970cba7e7c769cPaul Prescod 761f54902e05de94848fe728a24baf14dd605a65deFred Drake /** 774ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake * Has this notification been expanded while it was pinned 784ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake */ 7973678dac48e5858e40cba6d526970cba7e7c769cPaul Prescod private boolean mExpandedWhenPinned; 801f54902e05de94848fe728a24baf14dd605a65deFred Drake /** Is the user touching this row */ 81126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis private boolean mUserLocked; 82e50959a58ef4f365295f0393cb980de890c0024aFred Drake /** Are we showing the "public" version */ 83126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis private boolean mShowingPublic; 84126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis private boolean mSensitive; 85126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis private boolean mSensitiveHiddenInGeneral; 86787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private boolean mShowingPublicInitialized; 87fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake private boolean mHideSensitiveForIntrinsicHeight; 88787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 8904a45e9bb159f348ba722d0b49f9837f91cceaeaAndrew M. Kuchling /** 9004a45e9bb159f348ba722d0b49f9837f91cceaeaAndrew M. Kuchling * Is this notification expanded by the system. The expansion state can be overridden by the 914ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake * user expansion. 924ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake */ 934ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake private boolean mIsSystemExpanded; 94787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 95787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis /** 96787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * Whether the notification is on the keyguard and the expansion is disabled. 97fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake */ 98787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private boolean mOnKeyguard; 99787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1004ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake private AnimatorSet mTranslateAnim; 1014ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake private ArrayList<View> mTranslateableViews; 1024ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake private NotificationContentView mPublicLayout; 1034ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake private NotificationContentView mPrivateLayout; 1044ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake private int mMaxExpandHeight; 1054ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake private int mHeadsUpHeight; 1064ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake private View mVetoButton; 1074ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake private int mNotificationColor; 1084ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake private boolean mClearable; 109787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private ExpansionLogger mLogger; 1104ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake private String mLoggingKey; 11155c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake private NotificationSettingsIconRow mSettingsIconRow; 1121f54902e05de94848fe728a24baf14dd605a65deFred Drake private NotificationGuts mGuts; 113126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis private NotificationData.Entry mEntry; 114e50959a58ef4f365295f0393cb980de890c0024aFred Drake private StatusBarNotification mStatusBarNotification; 115126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis private String mAppName; 116126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis private boolean mIsHeadsUp; 117126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis private boolean mLastChronometerRunning = true; 118787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private NotificationHeaderView mNotificationHeader; 119fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake private NotificationViewWrapper mNotificationHeaderWrapper; 120787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private ViewStub mChildrenContainerStub; 121787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private NotificationGroupManager mGroupManager; 122787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private boolean mChildrenExpanded; 12304a45e9bb159f348ba722d0b49f9837f91cceaeaAndrew M. Kuchling private boolean mIsSummaryWithChildren; 12404a45e9bb159f348ba722d0b49f9837f91cceaeaAndrew M. Kuchling private NotificationChildrenContainer mChildrenContainer; 125787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private ViewStub mSettingsIconRowStub; 12613a3069c2b77df9874d68b5afef97a81525b4cebFred Drake private ViewStub mGutsStub; 12773678dac48e5858e40cba6d526970cba7e7c769cPaul Prescod private boolean mIsSystemChildExpanded; 12873678dac48e5858e40cba6d526970cba7e7c769cPaul Prescod private boolean mIsPinned; 1291f54902e05de94848fe728a24baf14dd605a65deFred Drake private FalsingManager mFalsingManager; 130126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis private HeadsUpManager mHeadsUpManager; 131126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis private NotificationHeaderUtil mHeaderUtil = new NotificationHeaderUtil(this); 132126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis 133126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis private boolean mJustClicked; 134787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private boolean mIconAnimationRunning; 135fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake private boolean mShowNoBackground; 136787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private ExpandableNotificationRow mNotificationParent; 1374ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake private OnExpandClickListener mOnExpandClickListener; 1384ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake private OnClickListener mExpandClickListener = new OnClickListener() { 139841d25ee664d7e77caa6169401f9dff696c738daAndrew M. Kuchling @Override 140841d25ee664d7e77caa6169401f9dff696c738daAndrew M. Kuchling public void onClick(View v) { 141787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (!mShowingPublic && mGroupManager.isSummaryOfGroup(mStatusBarNotification)) { 142787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mGroupManager.toggleGroupExpansion(mStatusBarNotification); 143787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mOnExpandClickListener.onExpandClicked(mEntry, 144fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake mGroupManager.isGroupExpanded(mStatusBarNotification)); 1454ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake } else { 146787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis boolean nowExpanded; 147787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (isPinned()) { 148787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis nowExpanded = !mExpandedWhenPinned; 149787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mExpandedWhenPinned = nowExpanded; 150787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } else { 1514ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake nowExpanded = !isExpanded(); 1524ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake setUserExpanded(nowExpanded); 153156c337f665a713767fa63b6c16ee6e9dea16250Martin v. Löwis } 1544ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake notifyHeightChanged(true); 155156c337f665a713767fa63b6c16ee6e9dea16250Martin v. Löwis mOnExpandClickListener.onExpandClicked(mEntry, nowExpanded); 156156c337f665a713767fa63b6c16ee6e9dea16250Martin v. Löwis } 157156c337f665a713767fa63b6c16ee6e9dea16250Martin v. Löwis } 158156c337f665a713767fa63b6c16ee6e9dea16250Martin v. Löwis }; 1594ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake 16073678dac48e5858e40cba6d526970cba7e7c769cPaul Prescod public NotificationContentView getPrivateLayout() { 1611f54902e05de94848fe728a24baf14dd605a65deFred Drake return mPrivateLayout; 162787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 163787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 164787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public NotificationContentView getPublicLayout() { 165fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake return mPublicLayout; 16604a45e9bb159f348ba722d0b49f9837f91cceaeaAndrew M. Kuchling } 16704a45e9bb159f348ba722d0b49f9837f91cceaeaAndrew M. Kuchling 16804a45e9bb159f348ba722d0b49f9837f91cceaeaAndrew M. Kuchling public void setIconAnimationRunning(boolean running) { 16952ce0d08374a7d0c14a8cca46a85d0b53c359fccMartin v. Löwis setIconAnimationRunning(running, mPublicLayout); 17004a45e9bb159f348ba722d0b49f9837f91cceaeaAndrew M. Kuchling setIconAnimationRunning(running, mPrivateLayout); 171787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis setIconAnimationRunningForChild(running, mNotificationHeader); 172787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mIsSummaryWithChildren) { 17352ce0d08374a7d0c14a8cca46a85d0b53c359fccMartin v. Löwis List<ExpandableNotificationRow> notificationChildren = 174787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainer.getNotificationChildren(); 1754ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake for (int i = 0; i < notificationChildren.size(); i++) { 1764ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake ExpandableNotificationRow child = notificationChildren.get(i); 1774ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake child.setIconAnimationRunning(running); 178f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake } 179f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake } 180f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake mIconAnimationRunning = running; 1810374a82f75b6929eb334d64e974926402e36c6a8R. David Murray } 1820374a82f75b6929eb334d64e974926402e36c6a8R. David Murray 1830374a82f75b6929eb334d64e974926402e36c6a8R. David Murray private void setIconAnimationRunning(boolean running, NotificationContentView layout) { 1840374a82f75b6929eb334d64e974926402e36c6a8R. David Murray if (layout != null) { 1850374a82f75b6929eb334d64e974926402e36c6a8R. David Murray View contractedChild = layout.getContractedChild(); 1860374a82f75b6929eb334d64e974926402e36c6a8R. David Murray View expandedChild = layout.getExpandedChild(); 1870374a82f75b6929eb334d64e974926402e36c6a8R. David Murray View headsUpChild = layout.getHeadsUpChild(); 1880374a82f75b6929eb334d64e974926402e36c6a8R. David Murray setIconAnimationRunningForChild(running, contractedChild); 1894ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake setIconAnimationRunningForChild(running, expandedChild); 1904ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake setIconAnimationRunningForChild(running, headsUpChild); 191787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1924ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake } 1930374a82f75b6929eb334d64e974926402e36c6a8R. David Murray 1940374a82f75b6929eb334d64e974926402e36c6a8R. David Murray private void setIconAnimationRunningForChild(boolean running, View child) { 1954ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake if (child != null) { 1964ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake ImageView icon = (ImageView) child.findViewById(com.android.internal.R.id.icon); 1970374a82f75b6929eb334d64e974926402e36c6a8R. David Murray setIconRunning(icon, running); 198f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake ImageView rightIcon = (ImageView) child.findViewById( 199f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake com.android.internal.R.id.right_icon); 200f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake setIconRunning(rightIcon, running); 2014ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake } 202f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake } 20373678dac48e5858e40cba6d526970cba7e7c769cPaul Prescod 2041f54902e05de94848fe728a24baf14dd605a65deFred Drake private void setIconRunning(ImageView imageView, boolean running) { 205787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (imageView != null) { 206787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis Drawable drawable = imageView.getDrawable(); 207787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (drawable instanceof AnimationDrawable) { 208787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis AnimationDrawable animationDrawable = (AnimationDrawable) drawable; 20955c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake if (running) { 210787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis animationDrawable.start(); 211787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } else { 212787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis animationDrawable.stop(); 213787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 214787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } else if (drawable instanceof AnimatedVectorDrawable) { 2152523977fb214c48284aacb5e774908b0629d7bb5Fred Drake AnimatedVectorDrawable animationDrawable = (AnimatedVectorDrawable) drawable; 2162523977fb214c48284aacb5e774908b0629d7bb5Fred Drake if (running) { 2172523977fb214c48284aacb5e774908b0629d7bb5Fred Drake animationDrawable.start(); 2182523977fb214c48284aacb5e774908b0629d7bb5Fred Drake } else { 219787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis animationDrawable.stop(); 220787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 221787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 222787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 223787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 224787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 225787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void onNotificationUpdated(NotificationData.Entry entry) { 226787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mEntry = entry; 227787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mStatusBarNotification = entry.notification; 228787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPrivateLayout.onNotificationUpdated(entry); 229787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPublicLayout.onNotificationUpdated(entry); 230787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mShowingPublicInitialized = false; 231787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis updateNotificationColor(); 232787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis updateClearability(); 233787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mIsSummaryWithChildren) { 234787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis recreateNotificationHeader(); 235787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainer.onNotificationUpdated(); 236787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 237787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mIconAnimationRunning) { 238787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis setIconAnimationRunning(true); 239787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 240787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mNotificationParent != null) { 241787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mNotificationParent.updateChildrenHeaderAppearance(); 2425dd504df289fba6990ab1ee3a3554cd960850c26Brett Cannon } 243787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis onChildrenCountChanged(); 244787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis // The public layouts expand button is always visible 245787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPublicLayout.updateExpandButtons(true); 246787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis updateLimits(); 247787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 248787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 249787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private void updateLimits() { 250787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis updateLimitsForView(mPrivateLayout); 251787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis updateLimitsForView(mPublicLayout); 252787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 253787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 254787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private void updateLimitsForView(NotificationContentView layout) { 255787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis boolean customView = layout.getContractedChild().getId() 256787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis != com.android.internal.R.id.status_bar_latest_event_content; 257787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis boolean beforeN = mEntry.targetSdk < Build.VERSION_CODES.N; 258787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis int minHeight = customView && beforeN && !mIsSummaryWithChildren ? 2592523977fb214c48284aacb5e774908b0629d7bb5Fred Drake mNotificationMinHeightLegacy : mNotificationMinHeight; 2602523977fb214c48284aacb5e774908b0629d7bb5Fred Drake boolean headsUpCustom = layout.getHeadsUpChild() != null && 2611f54902e05de94848fe728a24baf14dd605a65deFred Drake layout.getHeadsUpChild().getId() 262126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis != com.android.internal.R.id.status_bar_latest_event_content; 263787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis int headsUpheight = headsUpCustom && beforeN ? mMaxHeadsUpHeightLegacy 264787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis : mMaxHeadsUpHeight; 265787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis layout.setHeights(minHeight, headsUpheight, mNotificationMaxHeight); 266787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 2674221ff0ee1c6af843e11f8bb143850102b64e0c7Paul Prescod 2684221ff0ee1c6af843e11f8bb143850102b64e0c7Paul Prescod public StatusBarNotification getStatusBarNotification() { 269787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mStatusBarNotification; 270787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 271787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 272787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public boolean isHeadsUp() { 273787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mIsHeadsUp; 274787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 275787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 276787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void setHeadsUp(boolean isHeadsUp) { 277787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis int intrinsicBefore = getIntrinsicHeight(); 278787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mIsHeadsUp = isHeadsUp; 279787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPrivateLayout.setHeadsUp(isHeadsUp); 280787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mIsSummaryWithChildren) { 281787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis // The overflow might change since we allow more lines as HUN. 282787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainer.updateGroupOverflow(); 283787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 284787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (intrinsicBefore != getIntrinsicHeight()) { 285787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis notifyHeightChanged(false /* needsAnimation */); 286787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 287787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 288787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 289787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void setGroupManager(NotificationGroupManager groupManager) { 290787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mGroupManager = groupManager; 291787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPrivateLayout.setGroupManager(groupManager); 29255c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake } 2931f54902e05de94848fe728a24baf14dd605a65deFred Drake 29455c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake public void setRemoteInputController(RemoteInputController r) { 2955ded791e835b7aea76b8a23e5e4113ef91556e77Georg Brandl mPrivateLayout.setRemoteInputController(r); 2965ded791e835b7aea76b8a23e5e4113ef91556e77Georg Brandl } 2975ded791e835b7aea76b8a23e5e4113ef91556e77Georg Brandl 2985ded791e835b7aea76b8a23e5e4113ef91556e77Georg Brandl public void setAppName(String appName) { 29955c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake mAppName = appName; 300787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mSettingsIconRow != null) { 30155c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake mSettingsIconRow.setAppName(mAppName); 3021f54902e05de94848fe728a24baf14dd605a65deFred Drake } 3031f54902e05de94848fe728a24baf14dd605a65deFred Drake } 3041f54902e05de94848fe728a24baf14dd605a65deFred Drake 305787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void addChildNotification(ExpandableNotificationRow row) { 30655c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake addChildNotification(row, -1); 30755c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake } 308787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 30955c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake /** 3101f54902e05de94848fe728a24baf14dd605a65deFred Drake * Add a child notification to this view. 311ed525fb0dfa45595e8e93cbde3d5b05838bf993aMartin v. Löwis * 3121f54902e05de94848fe728a24baf14dd605a65deFred Drake * @param row the row to add 3131f54902e05de94848fe728a24baf14dd605a65deFred Drake * @param childIndex the index to add it at, if -1 it will be added at the end 314787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis */ 315f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake public void addChildNotification(ExpandableNotificationRow row, int childIndex) { 31655c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake if (mChildrenContainer == null) { 317126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis mChildrenContainerStub.inflate(); 318126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis } 319126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis mChildrenContainer.addNotification(row, childIndex); 320126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis onChildrenCountChanged(); 321126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis row.setIsChildInGroup(true, this); 322126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis } 323787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 324787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void removeChildNotification(ExpandableNotificationRow row) { 325787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mChildrenContainer != null) { 326787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainer.removeNotification(row); 327787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 328787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mHeaderUtil.restoreNotificationHeader(row); 329787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis onChildrenCountChanged(); 330787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis row.setIsChildInGroup(false, null); 331787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 332787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 333126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis public boolean isChildInGroup() { 334126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis return mNotificationParent != null; 33555c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake } 3361f54902e05de94848fe728a24baf14dd605a65deFred Drake 3374ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake public ExpandableNotificationRow getNotificationParent() { 3384ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake return mNotificationParent; 339787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 340787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 341787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis /** 342787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * @param isChildInGroup Is this notification now in a group 34352ce0d08374a7d0c14a8cca46a85d0b53c359fccMartin v. Löwis * @param parent the new parent notification 344787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis */ 345787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void setIsChildInGroup(boolean isChildInGroup, ExpandableNotificationRow parent) {; 34655c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake boolean childInGroup = BaseStatusBar.ENABLE_CHILD_NOTIFICATIONS && isChildInGroup; 3474ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake mNotificationParent = childInGroup ? parent : null; 3484ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake mPrivateLayout.setIsChildInGroup(childInGroup); 3494ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake updateNoBackgroundState(); 3504ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake } 351787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 352787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 353787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public boolean onTouchEvent(MotionEvent event) { 354787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (event.getActionMasked() != MotionEvent.ACTION_DOWN 355787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis || !isChildInGroup() || isGroupExpanded()) { 35673678dac48e5858e40cba6d526970cba7e7c769cPaul Prescod return super.onTouchEvent(event); 35755c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake } else { 358787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return false; 359787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 360787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 361787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 362787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 363787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis protected boolean handleSlideBack() { 3641f54902e05de94848fe728a24baf14dd605a65deFred Drake if (mSettingsIconRow != null && mSettingsIconRow.isVisible()) { 365f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake animateTranslateNotification(0 /* targetLeft */); 3661f54902e05de94848fe728a24baf14dd605a65deFred Drake return true; 367f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake } 368787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return false; 369787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 370787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 371787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 372f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake protected boolean shouldHideBackground() { 373f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake return super.shouldHideBackground() || mShowNoBackground; 374787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 375787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 37655c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake @Override 377f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake public boolean isSummaryWithChildren() { 37855c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake return mIsSummaryWithChildren; 379995359cbe86cc16cbf82039dc0fc4c2917735182Martin v. Löwis } 380787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 381995359cbe86cc16cbf82039dc0fc4c2917735182Martin v. Löwis @Override 382995359cbe86cc16cbf82039dc0fc4c2917735182Martin v. Löwis public boolean areChildrenExpanded() { 383fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake return mChildrenExpanded; 384787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 385787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 386787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public List<ExpandableNotificationRow> getNotificationChildren() { 387787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mChildrenContainer == null ? null : mChildrenContainer.getNotificationChildren(); 388787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 389787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 390995359cbe86cc16cbf82039dc0fc4c2917735182Martin v. Löwis public int getNumberOfNotificationChildren() { 391787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mChildrenContainer == null) { 392787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return 0; 393787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 394787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mChildrenContainer.getNotificationChildren().size(); 395787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 396787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 397787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis /** 398787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * Apply the order given in the list to the children. 399787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * 400787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * @param childOrder the new list order 401787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * @return whether the list order has changed 402787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis */ 403787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public boolean applyChildOrder(List<ExpandableNotificationRow> childOrder) { 404787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mChildrenContainer != null && mChildrenContainer.applyChildOrder(childOrder); 405787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 406787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 407787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void getChildrenStates(StackScrollState resultState) { 408787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mIsSummaryWithChildren) { 409787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis StackViewState parentState = resultState.getViewStateForView(this); 410787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainer.getState(resultState, parentState); 411787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 412787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 413787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 414787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void applyChildrenState(StackScrollState state) { 415787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mIsSummaryWithChildren) { 416787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainer.applyState(state); 417787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 418787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 419787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 420787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void prepareExpansionChanged(StackScrollState state) { 421787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mIsSummaryWithChildren) { 422787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainer.prepareExpansionChanged(state); 423787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 424787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 425787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 426787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void startChildAnimation(StackScrollState finalState, 427787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis StackStateAnimator stateAnimator, long delay, long duration) { 428787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mIsSummaryWithChildren) { 429787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainer.startAnimationToState(finalState, stateAnimator, delay, 430787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis duration); 431787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 432787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 433787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 434787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public ExpandableNotificationRow getViewAtPosition(float y) { 435787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (!mIsSummaryWithChildren || !mChildrenExpanded) { 436787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return this; 437787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } else { 438787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis ExpandableNotificationRow view = mChildrenContainer.getViewAtPosition(y); 439787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return view == null ? this : view; 440787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 441787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 442787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 443787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public NotificationGuts getGuts() { 444787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mGuts; 445787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 446787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 447787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis /** 448787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * Set this notification to be pinned to the top if {@link #isHeadsUp()} is true. By doing this 449787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * the notification will be rendered on top of the screen. 450787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * 451787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * @param pinned whether it is pinned 4524ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake */ 453f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake public void setPinned(boolean pinned) { 4549ea179fa7da13aa68c42a86cb9b315b0d9ea7aafFred Drake mIsPinned = pinned; 4554ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake if (pinned) { 4564ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake setIconAnimationRunning(true); 457f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake mExpandedWhenPinned = false; 458f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake } else if (mExpandedWhenPinned) { 459f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake setUserExpanded(true); 460f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake } 461f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake setChronometerRunning(mLastChronometerRunning); 4624ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake } 463787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 464787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public boolean isPinned() { 4652998a55f2dd658d15d033272ac88aebfc0dda957Fred Drake return mIsPinned; 4661f54902e05de94848fe728a24baf14dd605a65deFred Drake } 4671f54902e05de94848fe728a24baf14dd605a65deFred Drake 4682998a55f2dd658d15d033272ac88aebfc0dda957Fred Drake /** 469f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake * @param atLeastMinHeight should the value returned be at least the minimum height. 470787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * Used to avoid cyclic calls 471787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * @return the height of the heads up notification when pinned 4721f54902e05de94848fe728a24baf14dd605a65deFred Drake */ 4731f54902e05de94848fe728a24baf14dd605a65deFred Drake public int getPinnedHeadsUpHeight(boolean atLeastMinHeight) { 47455c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake if (mIsSummaryWithChildren) { 475f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake return mChildrenContainer.getIntrinsicHeight(); 47655c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake } 47755c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake if(mExpandedWhenPinned) { 47855c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake return Math.max(getMaxExpandHeight(), mHeadsUpHeight); 4791f54902e05de94848fe728a24baf14dd605a65deFred Drake } else if (atLeastMinHeight) { 4804ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake return Math.max(getCollapsedHeight(), mHeadsUpHeight); 4814ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake } else { 482d5fb58f1e34d85533dd7075541843cb6acf0f3cfMartin v. Löwis return mHeadsUpHeight; 4834ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake } 4841f54902e05de94848fe728a24baf14dd605a65deFred Drake } 4851f54902e05de94848fe728a24baf14dd605a65deFred Drake 4864ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake /** 4874ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake * Mark whether this notification was just clicked, i.e. the user has just clicked this 48849a5d03ab4b0ec9397fa7f449cb28d07edd8860fFred Drake * notification in this frame. 4894ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake */ 49016f6329e6153c4b92f2175a5560e372a762befe6Fred Drake public void setJustClicked(boolean justClicked) { 491787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mJustClicked = justClicked; 492787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 4936e3dbbdf39f3b4eb6f18c0165e446df17218b7dcBenjamin Peterson 494787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis /** 4956e3dbbdf39f3b4eb6f18c0165e446df17218b7dcBenjamin Peterson * @return true if this notification has been clicked in this frame, false otherwise 496787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis */ 4971f54902e05de94848fe728a24baf14dd605a65deFred Drake public boolean wasJustClicked() { 49873678dac48e5858e40cba6d526970cba7e7c769cPaul Prescod return mJustClicked; 49955c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake } 5001f54902e05de94848fe728a24baf14dd605a65deFred Drake 50173678dac48e5858e40cba6d526970cba7e7c769cPaul Prescod public void setChronometerRunning(boolean running) { 50255c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake mLastChronometerRunning = running; 5031f54902e05de94848fe728a24baf14dd605a65deFred Drake setChronometerRunning(running, mPrivateLayout); 50473678dac48e5858e40cba6d526970cba7e7c769cPaul Prescod setChronometerRunning(running, mPublicLayout); 50555c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake if (mChildrenContainer != null) { 506787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis List<ExpandableNotificationRow> notificationChildren = 507d5fb58f1e34d85533dd7075541843cb6acf0f3cfMartin v. Löwis mChildrenContainer.getNotificationChildren(); 508d5fb58f1e34d85533dd7075541843cb6acf0f3cfMartin v. Löwis for (int i = 0; i < notificationChildren.size(); i++) { 509787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis ExpandableNotificationRow child = notificationChildren.get(i); 51055c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake child.setChronometerRunning(running); 51148361f5cbf419cce361fd1aa0389d6304ad167dbNick Coghlan } 5121f54902e05de94848fe728a24baf14dd605a65deFred Drake } 5131f54902e05de94848fe728a24baf14dd605a65deFred Drake } 51455c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake 51516f6329e6153c4b92f2175a5560e372a762befe6Fred Drake private void setChronometerRunning(boolean running, NotificationContentView layout) { 5161f54902e05de94848fe728a24baf14dd605a65deFred Drake if (layout != null) { 51755c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake running = running || isPinned(); 5181f54902e05de94848fe728a24baf14dd605a65deFred Drake View contractedChild = layout.getContractedChild(); 51970d044ba67500ca8051b81269a50a9fb65676101Fred Drake View expandedChild = layout.getExpandedChild(); 52073678dac48e5858e40cba6d526970cba7e7c769cPaul Prescod View headsUpChild = layout.getHeadsUpChild(); 52155c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake setChronometerRunningForChild(running, contractedChild); 52273678dac48e5858e40cba6d526970cba7e7c769cPaul Prescod setChronometerRunningForChild(running, expandedChild); 52355c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake setChronometerRunningForChild(running, headsUpChild); 5241e68827c8fa95d10df3c805e5dd8383b19048b18Paul Prescod } 5251f54902e05de94848fe728a24baf14dd605a65deFred Drake } 526787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 527787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private void setChronometerRunningForChild(boolean running, View child) { 528787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (child != null) { 529787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis View chronometer = child.findViewById(com.android.internal.R.id.chronometer); 530787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (chronometer instanceof Chronometer) { 531787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis ((Chronometer) chronometer).setStarted(running); 532995359cbe86cc16cbf82039dc0fc4c2917735182Martin v. Löwis } 5334ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake } 5341e68827c8fa95d10df3c805e5dd8383b19048b18Paul Prescod } 5354ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake 5364ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake public NotificationHeaderView getNotificationHeader() { 5371f54902e05de94848fe728a24baf14dd605a65deFred Drake if (mNotificationHeader != null) { 538787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mNotificationHeader; 539787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 540787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mPrivateLayout.getNotificationHeader(); 541787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 542787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 543787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private NotificationHeaderView getVisibleNotificationHeader() { 544787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mNotificationHeader != null) { 545787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mNotificationHeader; 546787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 547787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return getShowingLayout().getVisibleNotificationHeader(); 548787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 549787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 550787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void setOnExpandClickListener(OnExpandClickListener onExpandClickListener) { 551787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mOnExpandClickListener = onExpandClickListener; 552787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 553787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 554787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void setHeadsUpManager(HeadsUpManager headsUpManager) { 555787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mHeadsUpManager = headsUpManager; 556787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 557787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 5585dd504df289fba6990ab1ee3a3554cd960850c26Brett Cannon public void reInflateViews() { 559787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis initDimens(); 560787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mIsSummaryWithChildren) { 561787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis removeView(mNotificationHeader); 562fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake mNotificationHeader = null; 563787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis recreateNotificationHeader(); 564787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mChildrenContainer != null) { 565787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainer.reInflateViews(); 566787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 567787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 568787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mGuts != null) { 569787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis View oldGuts = mGuts; 5705dd504df289fba6990ab1ee3a3554cd960850c26Brett Cannon int index = indexOfChild(oldGuts); 571787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis removeView(oldGuts); 572787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mGuts = (NotificationGuts) LayoutInflater.from(mContext).inflate( 573787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis R.layout.notification_guts, this, false); 574fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake mGuts.setVisibility(oldGuts.getVisibility()); 575f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake addView(mGuts, index); 576f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake } 577bc8f72ccccb1acd697d5cdb3ff0711bfa98af00dAndrew M. Kuchling if (mSettingsIconRow != null) { 578fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake View oldSettings = mSettingsIconRow; 579787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis int settingsIndex = indexOfChild(oldSettings); 580f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake removeView(oldSettings); 5811e68827c8fa95d10df3c805e5dd8383b19048b18Paul Prescod mSettingsIconRow = (NotificationSettingsIconRow) LayoutInflater.from(mContext).inflate( 5821e68827c8fa95d10df3c805e5dd8383b19048b18Paul Prescod R.layout.notification_settings_icon_row, this, false); 5831f54902e05de94848fe728a24baf14dd605a65deFred Drake mSettingsIconRow.setNotificationRowParent(ExpandableNotificationRow.this); 5841f54902e05de94848fe728a24baf14dd605a65deFred Drake mSettingsIconRow.setAppName(mAppName); 5852998a55f2dd658d15d033272ac88aebfc0dda957Fred Drake mSettingsIconRow.setVisibility(oldSettings.getVisibility()); 586787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis addView(mSettingsIconRow, settingsIndex); 587f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake 588f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake } 589f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake mPrivateLayout.reInflateViews(); 590f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake mPublicLayout.reInflateViews(); 59173678dac48e5858e40cba6d526970cba7e7c769cPaul Prescod } 5921f54902e05de94848fe728a24baf14dd605a65deFred Drake 5931f54902e05de94848fe728a24baf14dd605a65deFred Drake public void setContentBackground(int customBackgroundColor, boolean animate, 594787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis NotificationContentView notificationContentView) { 59573678dac48e5858e40cba6d526970cba7e7c769cPaul Prescod if (getShowingLayout() == notificationContentView) { 596787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis setTintColor(customBackgroundColor, animate); 597787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 598787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 599787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 600787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void closeRemoteInput() { 601787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPrivateLayout.closeRemoteInput(); 602787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPublicLayout.closeRemoteInput(); 603787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 604787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 605f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake /** 606f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake * Set by how much the single line view should be indented. 607f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake */ 6081f54902e05de94848fe728a24baf14dd605a65deFred Drake public void setSingleLineWidthIndention(int indention) { 6099ea179fa7da13aa68c42a86cb9b315b0d9ea7aafFred Drake mPrivateLayout.setSingleLineWidthIndention(indention); 610787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 611787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 612787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public int getNotificationColor() { 613787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mNotificationColor; 614787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 615787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 616787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private void updateNotificationColor() { 617787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mNotificationColor = NotificationColorUtil.resolveContrastColor(mContext, 61870a6b49821a3226f55e9716f32d802d06640cb89Walter Dörwald getStatusBarNotification().getNotification().color); 619787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 62070a6b49821a3226f55e9716f32d802d06640cb89Walter Dörwald 621787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public HybridNotificationView getSingleLineView() { 622787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mPrivateLayout.getSingleLineView(); 623787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 624787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 625787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public boolean isOnKeyguard() { 626787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mOnKeyguard; 627787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 628787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 629787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void removeAllChildren() { 630a2fda0dfaba89162e11b969622663ae4c00fa7c1Martin v. Löwis List<ExpandableNotificationRow> notificationChildren 6311f54902e05de94848fe728a24baf14dd605a65deFred Drake = mChildrenContainer.getNotificationChildren(); 632787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis ArrayList<ExpandableNotificationRow> clonedList = new ArrayList<>(notificationChildren); 633787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis for (int i = 0; i < clonedList.size(); i++) { 634787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis ExpandableNotificationRow row = clonedList.get(i); 635787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainer.removeNotification(row); 636787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mHeaderUtil.restoreNotificationHeader(row); 637787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis row.setIsChildInGroup(false, null); 638787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 639787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis onChildrenCountChanged(); 640787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 641787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 642787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public interface ExpansionLogger { 64352ce0d08374a7d0c14a8cca46a85d0b53c359fccMartin v. Löwis public void logNotificationExpansion(String key, boolean userAction, boolean expanded); 64449a5d03ab4b0ec9397fa7f449cb28d07edd8860fFred Drake } 6451f54902e05de94848fe728a24baf14dd605a65deFred Drake 64655c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake public ExpandableNotificationRow(Context context, AttributeSet attrs) { 6471f54902e05de94848fe728a24baf14dd605a65deFred Drake super(context, attrs); 6481f54902e05de94848fe728a24baf14dd605a65deFred Drake mFalsingManager = FalsingManager.getInstance(context); 649787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis initDimens(); 65055c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake } 6514ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake 6524ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake private void initDimens() { 6534ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake mNotificationMinHeightLegacy = getFontScaledHeight(R.dimen.notification_min_height_legacy); 6544ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake mNotificationMinHeight = getFontScaledHeight(R.dimen.notification_min_height); 6554ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake mNotificationMaxHeight = getFontScaledHeight(R.dimen.notification_max_height); 6564ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake mMaxHeadsUpHeightLegacy = getFontScaledHeight( 6574ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake R.dimen.notification_max_heads_up_height_legacy); 6584ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake mMaxHeadsUpHeight = getFontScaledHeight(R.dimen.notification_max_heads_up_height); 659787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 660787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 661787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis /** 662787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * @param dimenId the dimen to look up 663787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * @return the font scaled dimen as if it were in sp but doesn't shrink sizes below dp 6644ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake */ 6654ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake private int getFontScaledHeight(int dimenId) { 6664ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake int dimensionPixelSize = getResources().getDimensionPixelSize(dimenId); 6674ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake float factor = Math.max(1.0f, getResources().getDisplayMetrics().scaledDensity / 6684ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake getResources().getDisplayMetrics().density); 6694ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake return (int) (dimensionPixelSize * factor); 6704ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake } 67155c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake 6721f54902e05de94848fe728a24baf14dd605a65deFred Drake /** 6739e1fe1ec675386a4be12471a8b785a385d326316Guido van Rossum * Resets this view so it can be re-used for an updated notification. 6749e1fe1ec675386a4be12471a8b785a385d326316Guido van Rossum */ 6759e1fe1ec675386a4be12471a8b785a385d326316Guido van Rossum @Override 6769e1fe1ec675386a4be12471a8b785a385d326316Guido van Rossum public void reset() { 67755c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake super.reset(); 6781f54902e05de94848fe728a24baf14dd605a65deFred Drake final boolean wasExpanded = isExpanded(); 6799e1fe1ec675386a4be12471a8b785a385d326316Guido van Rossum mExpandable = false; 6809e1fe1ec675386a4be12471a8b785a385d326316Guido van Rossum mHasUserChangedExpansion = false; 6819e1fe1ec675386a4be12471a8b785a385d326316Guido van Rossum mUserLocked = false; 6829e1fe1ec675386a4be12471a8b785a385d326316Guido van Rossum mShowingPublic = false; 6831f54902e05de94848fe728a24baf14dd605a65deFred Drake mSensitive = false; 6841f54902e05de94848fe728a24baf14dd605a65deFred Drake mShowingPublicInitialized = false; 685787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mIsSystemExpanded = false; 686787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mOnKeyguard = false; 687787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPublicLayout.reset(); 688787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPrivateLayout.reset(); 689787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis resetHeight(); 690787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis resetTranslation(); 691787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis logExpansionEvent(false, wasExpanded); 692787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 693787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 694787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void resetHeight() { 695787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mMaxExpandHeight = 0; 696787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mHeadsUpHeight = 0; 697787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis onHeightReset(); 69855c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake requestLayout(); 6991f54902e05de94848fe728a24baf14dd605a65deFred Drake } 7001f54902e05de94848fe728a24baf14dd605a65deFred Drake 701787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 702787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis protected void onFinishInflate() { 703787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis super.onFinishInflate(); 704787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPublicLayout = (NotificationContentView) findViewById(R.id.expandedPublic); 705787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPublicLayout.setContainingNotification(this); 706787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPrivateLayout = (NotificationContentView) findViewById(R.id.expanded); 707787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPrivateLayout.setExpandClickListener(mExpandClickListener); 708787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPrivateLayout.setContainingNotification(this); 709787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPublicLayout.setExpandClickListener(mExpandClickListener); 710787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mSettingsIconRowStub = (ViewStub) findViewById(R.id.settings_icon_row_stub); 711787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mSettingsIconRowStub.setOnInflateListener(new ViewStub.OnInflateListener() { 712787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 713787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void onInflate(ViewStub stub, View inflated) { 714787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mSettingsIconRow = (NotificationSettingsIconRow) inflated; 715787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mSettingsIconRow.setNotificationRowParent(ExpandableNotificationRow.this); 716787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mSettingsIconRow.setAppName(mAppName); 717787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 718787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis }); 719787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mGutsStub = (ViewStub) findViewById(R.id.notification_guts_stub); 72055c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake mGutsStub.setOnInflateListener(new ViewStub.OnInflateListener() { 7211f54902e05de94848fe728a24baf14dd605a65deFred Drake @Override 7221f54902e05de94848fe728a24baf14dd605a65deFred Drake public void onInflate(ViewStub stub, View inflated) { 72373678dac48e5858e40cba6d526970cba7e7c769cPaul Prescod mGuts = (NotificationGuts) inflated; 7241f54902e05de94848fe728a24baf14dd605a65deFred Drake mGuts.setClipTopAmount(getClipTopAmount()); 7259e1fe1ec675386a4be12471a8b785a385d326316Guido van Rossum mGuts.setActualHeight(getActualHeight()); 72673678dac48e5858e40cba6d526970cba7e7c769cPaul Prescod mGutsStub = null; 7271f54902e05de94848fe728a24baf14dd605a65deFred Drake } 7284ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake }); 729fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake mChildrenContainerStub = (ViewStub) findViewById(R.id.child_container_stub); 730787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainerStub.setOnInflateListener(new ViewStub.OnInflateListener() { 731787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 732787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 733787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void onInflate(ViewStub stub, View inflated) { 734787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainer = (NotificationChildrenContainer) inflated; 735787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainer.setNotificationParent(ExpandableNotificationRow.this); 736787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainer.onNotificationUpdated(); 737787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mTranslateableViews.add(mChildrenContainer); 738787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 7394ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake }); 7404ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake mVetoButton = findViewById(R.id.veto); 741787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 742787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis // Add the views that we translate to reveal the gear 743787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mTranslateableViews = new ArrayList<View>(); 74455c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake for (int i = 0; i < getChildCount(); i++) { 745126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis mTranslateableViews.add(getChildAt(i)); 746126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis } 7471f54902e05de94848fe728a24baf14dd605a65deFred Drake // Remove views that don't translate 748787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mTranslateableViews.remove(mVetoButton); 749787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mTranslateableViews.remove(mSettingsIconRowStub); 750787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mTranslateableViews.remove(mChildrenContainerStub); 751fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake mTranslateableViews.remove(mGutsStub); 7521f54902e05de94848fe728a24baf14dd605a65deFred Drake } 75355c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake 7541f54902e05de94848fe728a24baf14dd605a65deFred Drake private void setTranslationForOutline(float translationX) { 755787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis setOutlineRect(false, translationX, getTop(), getRight() + translationX, getBottom()); 756787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 757787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 758fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake public void resetTranslation() { 7591f54902e05de94848fe728a24baf14dd605a65deFred Drake if (mTranslateableViews != null) { 76055c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake for (int i = 0; i < mTranslateableViews.size(); i++) { 7611f54902e05de94848fe728a24baf14dd605a65deFred Drake mTranslateableViews.get(i).setTranslationX(0); 762787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 763fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake setTranslationForOutline(0); 764787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 765787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mSettingsIconRow != null) { 766787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mSettingsIconRow.resetState(); 767fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake } 768787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 76973678dac48e5858e40cba6d526970cba7e7c769cPaul Prescod 770787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void animateTranslateNotification(final float leftTarget) { 771787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mTranslateAnim != null) { 772787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mTranslateAnim.cancel(); 77316f6329e6153c4b92f2175a5560e372a762befe6Fred Drake } 774126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis mTranslateAnim = (AnimatorSet) getTranslateViewAnimator(leftTarget, 775126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis null /* updateListener */); 776156c337f665a713767fa63b6c16ee6e9dea16250Martin v. Löwis if (mTranslateAnim != null) { 7776e3dbbdf39f3b4eb6f18c0165e446df17218b7dcBenjamin Peterson mTranslateAnim.start(); 77852ce0d08374a7d0c14a8cca46a85d0b53c359fccMartin v. Löwis } 779156c337f665a713767fa63b6c16ee6e9dea16250Martin v. Löwis } 7806e3dbbdf39f3b4eb6f18c0165e446df17218b7dcBenjamin Peterson 78152ce0d08374a7d0c14a8cca46a85d0b53c359fccMartin v. Löwis @Override 7821f54902e05de94848fe728a24baf14dd605a65deFred Drake public void setTranslation(float translationX) { 783787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (areGutsExposed()) { 78455c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake // Don't translate if guts are showing. 7851f54902e05de94848fe728a24baf14dd605a65deFred Drake return; 786787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 787787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis // Translate the group of views 78855c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake for (int i = 0; i < mTranslateableViews.size(); i++) { 7891f54902e05de94848fe728a24baf14dd605a65deFred Drake if (mTranslateableViews.get(i) != null) { 790787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mTranslateableViews.get(i).setTranslationX(translationX); 79155c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake } 79246fa39ab1d1e2f14c1b44c5e81c34c5f6cfb9a58Martin v. Löwis } 79346fa39ab1d1e2f14c1b44c5e81c34c5f6cfb9a58Martin v. Löwis setTranslationForOutline(translationX); 79446fa39ab1d1e2f14c1b44c5e81c34c5f6cfb9a58Martin v. Löwis if (mSettingsIconRow != null) { 79546fa39ab1d1e2f14c1b44c5e81c34c5f6cfb9a58Martin v. Löwis mSettingsIconRow.updateSettingsIcons(translationX, getMeasuredWidth()); 79646fa39ab1d1e2f14c1b44c5e81c34c5f6cfb9a58Martin v. Löwis } 79716f6329e6153c4b92f2175a5560e372a762befe6Fred Drake } 7984ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake 7994ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake @Override 80055c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake public float getTranslation() { 80155c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake if (mTranslateableViews != null && mTranslateableViews.size() > 0) { 80255c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake // All of the views in the list should have same translation, just use first one. 8031f54902e05de94848fe728a24baf14dd605a65deFred Drake return mTranslateableViews.get(0).getTranslationX(); 8044ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake } 80555c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake return 0; 80655c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake } 807c8faf9bb0cdd5faa957fbd3aa38b637c68cdee34R David Murray 80893bbb6a9a641d54c242651e97948c15be911c9bbEzio Melotti public Animator getTranslateViewAnimator(final float leftTarget, 80993bbb6a9a641d54c242651e97948c15be911c9bbEzio Melotti AnimatorUpdateListener listener) { 81093bbb6a9a641d54c242651e97948c15be911c9bbEzio Melotti if (mTranslateAnim != null) { 81193bbb6a9a641d54c242651e97948c15be911c9bbEzio Melotti mTranslateAnim.cancel(); 812c8faf9bb0cdd5faa957fbd3aa38b637c68cdee34R David Murray } 81393bbb6a9a641d54c242651e97948c15be911c9bbEzio Melotti if (areGutsExposed()) { 81493bbb6a9a641d54c242651e97948c15be911c9bbEzio Melotti // No translation if guts are exposed. 81593bbb6a9a641d54c242651e97948c15be911c9bbEzio Melotti return null; 81693bbb6a9a641d54c242651e97948c15be911c9bbEzio Melotti } 81755c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake AnimatorSet set = new AnimatorSet(); 81846fa39ab1d1e2f14c1b44c5e81c34c5f6cfb9a58Martin v. Löwis if (mTranslateableViews != null) { 81955c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake for (int i = 0; i < mTranslateableViews.size(); i++) { 8201f54902e05de94848fe728a24baf14dd605a65deFred Drake final View animView = mTranslateableViews.get(i); 8212998a55f2dd658d15d033272ac88aebfc0dda957Fred Drake final ObjectAnimator translateAnim = ObjectAnimator.ofFloat( 8221f54902e05de94848fe728a24baf14dd605a65deFred Drake animView, "translationX", leftTarget); 8239e1fe1ec675386a4be12471a8b785a385d326316Guido van Rossum if (i == 0) { 824787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis translateAnim.addUpdateListener(new AnimatorUpdateListener() { 825787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 8269e1fe1ec675386a4be12471a8b785a385d326316Guido van Rossum public void onAnimationUpdate(ValueAnimator animation) { 827787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis setTranslationForOutline((float) animation.getAnimatedValue()); 828787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mSettingsIconRow != null) { 829787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mSettingsIconRow.updateSettingsIcons( 830787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis (float) animation.getAnimatedValue(), getMeasuredWidth()); 831787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 832787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 833787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis }); 834787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (listener != null) { 835787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis translateAnim.addUpdateListener(listener); 836787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 837787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis translateAnim.addListener(new AnimatorListenerAdapter() { 838787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis boolean cancelled = false; 839787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 840787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 841fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake public void onAnimationCancel(Animator anim) { 842787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis cancelled = true; 843fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake } 844787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 845787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 846787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void onAnimationEnd(Animator anim) { 847787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (!cancelled && mSettingsIconRow != null && leftTarget == 0) { 848787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mSettingsIconRow.resetState(); 849787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mTranslateAnim = null; 850787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 851787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 852787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis }); 853787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 854787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis set.play(translateAnim); 855787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 856787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 857787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mTranslateAnim = set; 858787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return set; 859787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 860787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 861787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public float getSpaceForGear() { 862787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mSettingsIconRow != null) { 863787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mSettingsIconRow.getSpaceForGear(); 864787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 865787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return 0; 866787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 867787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 868787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public NotificationSettingsIconRow getSettingsRow() { 869787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mSettingsIconRow == null) { 870787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mSettingsIconRowStub.inflate(); 8719e1fe1ec675386a4be12471a8b785a385d326316Guido van Rossum } 8724ccf4a1e8a3141e34fba73f08d678b47b3ddb81dFred Drake return mSettingsIconRow; 873787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 874787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 875787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void inflateGuts() { 87652ce0d08374a7d0c14a8cca46a85d0b53c359fccMartin v. Löwis if (mGuts == null) { 877787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mGutsStub.inflate(); 878787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 87955c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake } 880787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 881787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private void updateChildrenVisibility() { 882787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPrivateLayout.setVisibility(!mShowingPublic && !mIsSummaryWithChildren ? VISIBLE 883787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis : INVISIBLE); 884fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake if (mChildrenContainer != null) { 885787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainer.setVisibility(!mShowingPublic && mIsSummaryWithChildren ? VISIBLE 88655c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake : INVISIBLE); 887787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 888787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mNotificationHeader != null) { 889787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mNotificationHeader.setVisibility(!mShowingPublic && mIsSummaryWithChildren ? VISIBLE 890787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis : INVISIBLE); 891fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake } 892787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis // The limits might have changed if the view suddenly became a group or vice versa 893787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis updateLimits(); 894787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 895fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake 896787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 897787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public boolean onRequestSendAccessibilityEventInternal(View child, AccessibilityEvent event) { 89853f94d07532024b49075ca03acda3e170e74859aAndrew M. Kuchling if (super.onRequestSendAccessibilityEventInternal(child, event)) { 89953f94d07532024b49075ca03acda3e170e74859aAndrew M. Kuchling // Add a record for the entire layout since its content is somehow small. 90053f94d07532024b49075ca03acda3e170e74859aAndrew M. Kuchling // The event comes from a leaf view that is interacted with. 90153f94d07532024b49075ca03acda3e170e74859aAndrew M. Kuchling AccessibilityEvent record = AccessibilityEvent.obtain(); 902787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis onInitializeAccessibilityEvent(record); 903fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake dispatchPopulateAccessibilityEvent(record); 904787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis event.appendRecord(record); 905787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return true; 906787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 907787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return false; 9081f54902e05de94848fe728a24baf14dd605a65deFred Drake } 90952ce0d08374a7d0c14a8cca46a85d0b53c359fccMartin v. Löwis 9101f54902e05de94848fe728a24baf14dd605a65deFred Drake @Override 91155c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake public void setDark(boolean dark, boolean fade, long delay) { 91255c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake super.setDark(dark, fade, delay); 9131f54902e05de94848fe728a24baf14dd605a65deFred Drake final NotificationContentView showing = getShowingLayout(); 914787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (showing != null) { 915787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis showing.setDark(dark, fade, delay); 916787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 917787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mIsSummaryWithChildren) { 918787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainer.setDark(dark, fade, delay); 919787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mNotificationHeaderWrapper.setDark(dark, fade, delay); 920787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 921787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 922787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 923787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public boolean isExpandable() { 924787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mIsSummaryWithChildren && !mShowingPublic) { 925787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return !mChildrenExpanded; 926787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 927787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mExpandable; 928787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 929787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 930787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void setExpandable(boolean expandable) { 931787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mExpandable = expandable; 932787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPrivateLayout.updateExpandButtons(isExpandable()); 933787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 93446fa39ab1d1e2f14c1b44c5e81c34c5f6cfb9a58Martin v. Löwis 93546fa39ab1d1e2f14c1b44c5e81c34c5f6cfb9a58Martin v. Löwis @Override 93655c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake public void setClipToActualHeight(boolean clipToActualHeight) { 937787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis super.setClipToActualHeight(clipToActualHeight || isUserLocked()); 938787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis getShowingLayout().setClipToActualHeight(clipToActualHeight || isUserLocked()); 939787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 940787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 941787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis /** 942787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * @return whether the user has changed the expansion state 943787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis */ 944787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public boolean hasUserChangedExpansion() { 945787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mHasUserChangedExpansion; 946787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 947787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 948787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public boolean isUserExpanded() { 949787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mUserExpanded; 950787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 951787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 952787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis /** 953787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * Set this notification to be expanded by the user 954787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * 955787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * @param userExpanded whether the user wants this notification to be expanded 956787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis */ 95787432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake public void setUserExpanded(boolean userExpanded) { 95855c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake setUserExpanded(userExpanded, false /* allowChildExpansion */); 959787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 960787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 9611f54902e05de94848fe728a24baf14dd605a65deFred Drake /** 96255c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake * Set this notification to be expanded by the user 9631f54902e05de94848fe728a24baf14dd605a65deFred Drake * 964f5ade63e91268dbc3dbfb0ca3244c61e2fc386b7Facundo Batista * @param userExpanded whether the user wants this notification to be expanded 965787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * @param allowChildExpansion whether a call to this method allows expanding children 96687432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake */ 96787432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake public void setUserExpanded(boolean userExpanded, boolean allowChildExpansion) { 96887432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake mFalsingManager.setNotificationExpanded(); 969fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake if (mIsSummaryWithChildren && !mShowingPublic && allowChildExpansion) { 97087432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake mGroupManager.setGroupExpanded(mStatusBarNotification, userExpanded); 971fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake return; 97287432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake } 973fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake if (userExpanded && !mExpandable) return; 97487432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake final boolean wasExpanded = isExpanded(); 97587432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake mHasUserChangedExpansion = true; 97687432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake mUserExpanded = userExpanded; 97787432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake logExpansionEvent(true, wasExpanded); 97887432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake } 97987432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake 98087432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake public void resetUserExpansion() { 981fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake mHasUserChangedExpansion = false; 98287432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake mUserExpanded = false; 983fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake } 98487432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake 98587432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake public boolean isUserLocked() { 98687432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake return mUserLocked; 98787432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake } 98887432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake 98987432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake public void setUserLocked(boolean userLocked) { 990fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake mUserLocked = userLocked; 99187432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake mPrivateLayout.setUserExpanding(userLocked); 992fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake if (mIsSummaryWithChildren) { 99387432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake mChildrenContainer.setUserLocked(userLocked); 994fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake } 99587432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake } 99687432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake 99787432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake /** 99887432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake * @return has the system set this notification to be expanded 99987432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake */ 1000fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake public boolean isSystemExpanded() { 100187432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake return mIsSystemExpanded; 1002fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake } 100387432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake 1004fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake /** 100587432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake * Set this notification to be expanded by the system. 100687432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake * 100787432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake * @param expand whether the system wants this notification to be expanded. 1008787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis */ 1009787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void setSystemExpanded(boolean expand) { 1010787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (expand != mIsSystemExpanded) { 101187432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake final boolean wasExpanded = isExpanded(); 101287432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake mIsSystemExpanded = expand; 1013787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis notifyHeightChanged(false /* needsAnimation */); 1014787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis logExpansionEvent(false, wasExpanded); 1015995359cbe86cc16cbf82039dc0fc4c2917735182Martin v. Löwis if (mChildrenContainer != null) { 1016995359cbe86cc16cbf82039dc0fc4c2917735182Martin v. Löwis mChildrenContainer.updateGroupOverflow(); 1017787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 101887432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake } 101987432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake } 102087432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake 102155c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake /** 1022f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake * @param onKeyguard whether to prevent notification expansion 1023f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake */ 1024fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake public void setOnKeyguard(boolean onKeyguard) { 1025787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (onKeyguard != mOnKeyguard) { 1026787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis final boolean wasExpanded = isExpanded(); 1027787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mOnKeyguard = onKeyguard; 1028f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake logExpansionEvent(false, wasExpanded); 1029f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake if (wasExpanded != isExpanded()) { 1030f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake if (mIsSummaryWithChildren) { 1031f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake mChildrenContainer.updateGroupOverflow(); 1032f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake } 1033f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake notifyHeightChanged(false /* needsAnimation */); 1034f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake } 1035f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake } 1036f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake } 103746fa39ab1d1e2f14c1b44c5e81c34c5f6cfb9a58Martin v. Löwis 103893bbb6a9a641d54c242651e97948c15be911c9bbEzio Melotti /** 103955c3819e6a055264f1fd9853ab2ed022a84ef626Fred Drake * @return Can the underlying notification be cleared? 1040787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis */ 1041787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public boolean isClearable() { 1042787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mStatusBarNotification != null && mStatusBarNotification.isClearable(); 1043787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1044787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1045787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 1046787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public int getIntrinsicHeight() { 1047787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (isUserLocked()) { 1048787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return getActualHeight(); 1049787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1050787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mGuts != null && mGuts.areGutsExposed()) { 1051787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mGuts.getHeight(); 1052787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } else if ((isChildInGroup() && !isGroupExpanded())) { 1053787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mPrivateLayout.getMinHeight(); 1054787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } else if (mSensitive && mHideSensitiveForIntrinsicHeight) { 1055787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return getMinHeight(); 1056787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } else if (mIsSummaryWithChildren && !mOnKeyguard) { 1057787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mChildrenContainer.getIntrinsicHeight(); 1058787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } else if (mIsHeadsUp) { 1059787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (isPinned()) { 1060787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return getPinnedHeadsUpHeight(true /* atLeastMinHeight */); 1061787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } else if (isExpanded()) { 1062787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return Math.max(getMaxExpandHeight(), mHeadsUpHeight); 1063787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } else { 1064787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return Math.max(getCollapsedHeight(), mHeadsUpHeight); 1065787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1066787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } else if (isExpanded()) { 1067787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return getMaxExpandHeight(); 1068787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } else { 1069787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return getCollapsedHeight(); 1070787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1071787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1072787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1073787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private boolean isGroupExpanded() { 1074787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mGroupManager.isGroupExpanded(mStatusBarNotification); 1075787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1076787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1077787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis /** 1078787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * @return whether this view has a header on the top of the content 1079787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis */ 1080787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private boolean hasNotificationHeader() { 1081787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mIsSummaryWithChildren; 1082787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1083787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1084787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private void onChildrenCountChanged() { 1085787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mIsSummaryWithChildren = BaseStatusBar.ENABLE_CHILD_NOTIFICATIONS 1086787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis && mChildrenContainer != null && mChildrenContainer.getChildCount() > 0; 1087787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mIsSummaryWithChildren) { 1088787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mNotificationHeader == null) { 1089787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis recreateNotificationHeader(); 1090787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1091787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1092787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPrivateLayout.updateExpandButtons(isExpandable()); 1093787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis updateChildrenHeaderAppearance(); 1094787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis updateChildrenVisibility(); 1095787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1096787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1097787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis /** 1098787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * Check whether the view state is currently expanded. This is given by the system in {@link 1099787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * #setSystemExpanded(boolean)} and can be overridden by user expansion or 1100787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * collapsing in {@link #setUserExpanded(boolean)}. Note that the visual appearance of this 1101787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * view can differ from this state, if layout params are modified from outside. 1102787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * 1103787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis * @return whether the view state is currently expanded. 1104787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis */ 1105787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public boolean isExpanded() { 1106787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return isExpanded(false /* allowOnKeyguard */); 1107787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1108787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1109787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public boolean isExpanded(boolean allowOnKeyguard) { 1110787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return (!mOnKeyguard || allowOnKeyguard) 1111787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis && (!hasUserChangedExpansion() && (isSystemExpanded() || isSystemChildExpanded()) 1112787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis || isUserExpanded()); 1113787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1114787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1115787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private boolean isSystemChildExpanded() { 1116787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mIsSystemChildExpanded; 1117787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1118787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1119787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void setSystemChildExpanded(boolean expanded) { 1120787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mIsSystemChildExpanded = expanded; 1121787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1122787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1123787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 1124787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis protected void onLayout(boolean changed, int left, int top, int right, int bottom) { 1125787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis super.onLayout(changed, left, top, right, bottom); 1126787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis updateMaxHeights(); 1127787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mSettingsIconRow != null) { 1128787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mSettingsIconRow.updateVerticalLocation(); 1129787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1130787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1131787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1132787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private void updateMaxHeights() { 1133787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis int intrinsicBefore = getIntrinsicHeight(); 113427e4a179f277b568f04d482765ab773068ae6ab6Martin v. Löwis View expandedChild = mPrivateLayout.getExpandedChild(); 113527e4a179f277b568f04d482765ab773068ae6ab6Martin v. Löwis if (expandedChild == null) { 1136787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis expandedChild = mPrivateLayout.getContractedChild(); 1137787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 113887432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake mMaxExpandHeight = expandedChild.getHeight(); 113987432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake View headsUpChild = mPrivateLayout.getHeadsUpChild(); 1140787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (headsUpChild == null) { 1141787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis headsUpChild = mPrivateLayout.getContractedChild(); 1142995359cbe86cc16cbf82039dc0fc4c2917735182Martin v. Löwis } 1143995359cbe86cc16cbf82039dc0fc4c2917735182Martin v. Löwis mHeadsUpHeight = headsUpChild.getHeight(); 1144787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (intrinsicBefore != getIntrinsicHeight()) { 114587432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake notifyHeightChanged(false /* needsAnimation */); 114687432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake } 114787432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake } 114887432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake 1149787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 1150787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void notifyHeightChanged(boolean needsAnimation) { 11515b5e0b9bf9951ebcafcf09354d770905293a32d5Guido van Rossum super.notifyHeightChanged(needsAnimation); 115287432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake getShowingLayout().requestSelectLayout(needsAnimation || isUserLocked()); 115387432f42f953920912b9780f0ae0d7c41cb349f2Fred Drake } 11549ea179fa7da13aa68c42a86cb9b315b0d9ea7aafFred Drake 1155787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void setSensitive(boolean sensitive, boolean hideSensitive) { 1156787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mSensitive = sensitive; 1157787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mSensitiveHiddenInGeneral = hideSensitive; 1158787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1159787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1160787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void setHideSensitiveForIntrinsicHeight(boolean hideSensitive) { 1161787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mHideSensitiveForIntrinsicHeight = hideSensitive; 1162787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mIsSummaryWithChildren) { 1163787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis List<ExpandableNotificationRow> notificationChildren = 1164787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainer.getNotificationChildren(); 1165787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis for (int i = 0; i < notificationChildren.size(); i++) { 1166787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis ExpandableNotificationRow child = notificationChildren.get(i); 1167787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis child.setHideSensitiveForIntrinsicHeight(hideSensitive); 1168787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1169787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1170787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1171787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1172787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void setHideSensitive(boolean hideSensitive, boolean animated, long delay, 1173787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis long duration) { 1174787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis boolean oldShowingPublic = mShowingPublic; 1175787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mShowingPublic = mSensitive && hideSensitive; 1176787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mShowingPublicInitialized && mShowingPublic == oldShowingPublic) { 1177787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return; 117870d044ba67500ca8051b81269a50a9fb65676101Fred Drake } 1179787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1180787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis // bail out if no public version 1181787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mPublicLayout.getChildCount() == 0) return; 1182787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1183787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (!animated) { 1184787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPublicLayout.animate().cancel(); 1185787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPrivateLayout.animate().cancel(); 1186787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPublicLayout.setAlpha(1f); 1187787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPrivateLayout.setAlpha(1f); 1188787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPublicLayout.setVisibility(mShowingPublic ? View.VISIBLE : View.INVISIBLE); 1189787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis updateChildrenVisibility(); 1190787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } else { 1191787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis animateShowingPublic(delay, duration); 1192787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1193787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis NotificationContentView showingLayout = getShowingLayout(); 1194787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis showingLayout.updateBackgroundColor(animated); 1195fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake mPrivateLayout.updateExpandButtons(isExpandable()); 1196787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis updateClearability(); 1197787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mShowingPublicInitialized = true; 1198787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1199fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake 1200787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private void animateShowingPublic(long delay, long duration) { 1201787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis View[] privateViews = mIsSummaryWithChildren ? 1202787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis new View[] {mChildrenContainer, mNotificationHeader} 1203fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake : new View[] {mPrivateLayout}; 1204787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis View[] publicViews = new View[] {mPublicLayout}; 1205787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis View[] hiddenChildren = mShowingPublic ? privateViews : publicViews; 1206787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis View[] shownChildren = mShowingPublic ? publicViews : privateViews; 1207fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake for (final View hiddenView : hiddenChildren) { 1208787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis hiddenView.setVisibility(View.VISIBLE); 1209787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis hiddenView.animate().cancel(); 1210787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis hiddenView.animate() 1211787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis .alpha(0f) 1212787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis .setStartDelay(delay) 1213787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis .setDuration(duration) 1214787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis .withEndAction(new Runnable() { 1215787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 1216787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void run() { 1217787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis hiddenView.setVisibility(View.INVISIBLE); 1218787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1219787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis }); 1220787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1221787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis for (View showView : shownChildren) { 1222787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis showView.setVisibility(View.VISIBLE); 1223995359cbe86cc16cbf82039dc0fc4c2917735182Martin v. Löwis showView.setAlpha(0f); 1224995359cbe86cc16cbf82039dc0fc4c2917735182Martin v. Löwis showView.animate().cancel(); 1225787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis showView.animate() 1226787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis .alpha(1f) 1227787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis .setStartDelay(delay) 1228787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis .setDuration(duration); 1229787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1230787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1231787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 12321f54902e05de94848fe728a24baf14dd605a65deFred Drake public boolean mustStayOnScreen() { 1233787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mIsHeadsUp; 1234787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1235f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake 1236787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private void updateClearability() { 1237f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake // public versions cannot be dismissed 1238f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake mVetoButton.setVisibility(isClearable() && (!mShowingPublic 1239f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake || !mSensitiveHiddenInGeneral) ? View.VISIBLE : View.GONE); 1240f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake } 1241f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake 1242dc806704b5093061ac60299493bef9e0798dee9aFred Drake public void makeActionsVisibile() { 1243f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake setUserExpanded(true, true); 1244f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake if (isChildInGroup()) { 1245787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mGroupManager.setGroupExpanded(mStatusBarNotification, true); 1246787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1247f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake notifyHeightChanged(false); 1248f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake } 1249f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake 1250787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void setChildrenExpanded(boolean expanded, boolean animate) { 1251787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenExpanded = expanded; 1252787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mNotificationHeader != null) { 1253787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mNotificationHeader.setExpanded(expanded); 1254787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1255787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mChildrenContainer != null) { 1256787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainer.setChildrenExpanded(expanded); 1257787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1258787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1259787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1260787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public static void applyTint(View v, int color) { 1261fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake int alpha; 1262787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (color != 0) { 1263787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis alpha = COLORED_DIVIDER_ALPHA; 1264787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } else { 1265787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis color = 0xff000000; 1266787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis alpha = DEFAULT_DIVIDER_ALPHA; 1267787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1268787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (v.getBackground() instanceof ColorDrawable) { 1269787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis ColorDrawable background = (ColorDrawable) v.getBackground(); 1270787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis background.mutate(); 1271787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis background.setColor(color); 1272787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis background.setAlpha(alpha); 1273787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1274787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1275787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1276787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public int getMaxExpandHeight() { 1277787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mMaxExpandHeight; 1278787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1279787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1280787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public boolean areGutsExposed() { 1281787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return (mGuts != null && mGuts.areGutsExposed()); 1282787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1283787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1284787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 1285787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public boolean isContentExpandable() { 1286175a7dcf6588f41df1ea99f9180a930d37224598Georg Brandl NotificationContentView showingLayout = getShowingLayout(); 1287175a7dcf6588f41df1ea99f9180a930d37224598Georg Brandl return showingLayout.isContentExpandable(); 1288787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1289175a7dcf6588f41df1ea99f9180a930d37224598Georg Brandl 1290787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 1291787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis protected View getContentView() { 1292787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return getShowingLayout(); 1293787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1294175a7dcf6588f41df1ea99f9180a930d37224598Georg Brandl 1295787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 1296787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void setActualHeight(int height, boolean notifyListeners) { 1297787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis super.setActualHeight(height, notifyListeners); 1298787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mGuts != null && mGuts.areGutsExposed()) { 1299787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mGuts.setActualHeight(height); 1300787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return; 1301787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1302787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis int contentHeight = Math.max(getMinHeight(), height); 1303787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPrivateLayout.setContentHeight(contentHeight); 1304f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake mPublicLayout.setContentHeight(contentHeight); 1305787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mIsSummaryWithChildren) { 1306787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainer.setActualHeight(height); 1307787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1308787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mGuts != null) { 1309787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mGuts.setActualHeight(height); 1310787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1311787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1312787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1313787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 1314787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public int getMaxContentHeight() { 1315787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mIsSummaryWithChildren && !mShowingPublic) { 1316787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mChildrenContainer.getMaxContentHeight(); 1317787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1318787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis NotificationContentView showingLayout = getShowingLayout(); 1319787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return showingLayout.getMaxHeight(); 1320787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1321fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake 1322787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 1323787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public int getMinHeight() { 1324787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mIsHeadsUp && mHeadsUpManager.isTrackingHeadsUp()) { 1325fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake return getPinnedHeadsUpHeight(false /* atLeastMinHeight */); 1326787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } else if (mIsSummaryWithChildren && !isGroupExpanded() && !mShowingPublic) { 1327787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mChildrenContainer.getMinHeight(); 1328787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } else if (mIsHeadsUp) { 1329fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake return mHeadsUpHeight; 1330787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1331787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis NotificationContentView showingLayout = getShowingLayout(); 1332787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return showingLayout.getMinHeight(); 1333fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake } 1334787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1335787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 1336787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public int getCollapsedHeight() { 1337787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mIsSummaryWithChildren && !mShowingPublic) { 1338787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mChildrenContainer.getCollapsedHeight(); 1339787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1340787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return getMinHeight(); 1341787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1342787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1343787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 1344787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void setClipTopAmount(int clipTopAmount) { 1345787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis super.setClipTopAmount(clipTopAmount); 1346787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPrivateLayout.setClipTopAmount(clipTopAmount); 1347787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPublicLayout.setClipTopAmount(clipTopAmount); 1348787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mGuts != null) { 1349787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mGuts.setClipTopAmount(clipTopAmount); 1350787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1351787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1352787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1353787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private void recreateNotificationHeader() { 1354787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis final Notification.Builder builder = Notification.Builder.recoverBuilder(getContext(), 1355f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake getStatusBarNotification().getNotification()); 1356f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake final RemoteViews header = builder.makeNotificationHeader(); 1357787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mNotificationHeader == null) { 1358787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mNotificationHeader = (NotificationHeaderView) header.apply(getContext(), this); 1359787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis final View expandButton = mNotificationHeader.findViewById( 1360f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake com.android.internal.R.id.expand_button); 1361f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake expandButton.setVisibility(VISIBLE); 1362f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake mNotificationHeader.setOnClickListener(mExpandClickListener); 1363fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake mNotificationHeaderWrapper = NotificationViewWrapper.wrap(getContext(), 13649e1fe1ec675386a4be12471a8b785a385d326316Guido van Rossum mNotificationHeader, this); 1365787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis addView(mNotificationHeader, indexOfChild(mChildrenContainer) + 1); 1366787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mTranslateableViews.add(mNotificationHeader); 1367787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } else { 1368787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis header.reapply(getContext(), mNotificationHeader); 1369787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mNotificationHeaderWrapper.notifyContentUpdated(mEntry.notification); 1370787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1371787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis updateChildrenHeaderAppearance(); 1372b417be2ad9c4d4d7ab9d682f71c771de37a48dccMartin v. Löwis } 1373b417be2ad9c4d4d7ab9d682f71c771de37a48dccMartin v. Löwis 1374b417be2ad9c4d4d7ab9d682f71c771de37a48dccMartin v. Löwis public void updateChildrenHeaderAppearance() { 1375b417be2ad9c4d4d7ab9d682f71c771de37a48dccMartin v. Löwis if (mIsSummaryWithChildren) { 1376b417be2ad9c4d4d7ab9d682f71c771de37a48dccMartin v. Löwis mHeaderUtil.updateChildrenHeaderAppearance(); 1377b417be2ad9c4d4d7ab9d682f71c771de37a48dccMartin v. Löwis } 1378787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1379787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1380787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public boolean isMaxExpandHeightInitialized() { 1381787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mMaxExpandHeight != 0; 1382787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1383787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1384fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake public NotificationContentView getShowingLayout() { 1385787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mShowingPublic ? mPublicLayout : mPrivateLayout; 1386787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1387787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1388787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 1389787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void setShowingLegacyBackground(boolean showing) { 1390fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake super.setShowingLegacyBackground(showing); 1391787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mPrivateLayout.setShowingLegacyBackground(showing); 1392fbdeaad06910a50d6f05da177949b9a451a1132aFred Drake mPublicLayout.setShowingLegacyBackground(showing); 1393787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1394787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1395787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 1396787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis protected void updateBackgroundTint() { 1397787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis super.updateBackgroundTint(); 1398787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis updateNoBackgroundState(); 1399787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mIsSummaryWithChildren) { 1400787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis List<ExpandableNotificationRow> notificationChildren = 1401787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mChildrenContainer.getNotificationChildren(); 1402f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake for (int i = 0; i < notificationChildren.size(); i++) { 1403f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake ExpandableNotificationRow child = notificationChildren.get(i); 1404f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake child.updateNoBackgroundState(); 1405f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake } 1406f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake } 1407f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake } 1408f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake 1409f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake private void updateNoBackgroundState() { 1410f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake mShowNoBackground = isChildInGroup() && hasSameBgColor(mNotificationParent); 1411f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake updateBackground(); 1412787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1413787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1414787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public void setExpansionLogger(ExpansionLogger logger, String key) { 1415787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mLogger = logger; 1416787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mLoggingKey = key; 1417787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1418787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1419787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 1420126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis public float getIncreasedPaddingAmount() { 1421787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (mIsSummaryWithChildren) { 1422126f2f62db541565bebc83859ac329836d7d3f00Martin v. Löwis if (isGroupExpanded()) { 1423f7cf40d3319ef3f2f649781214c2511467ffd70eFred Drake return 1.0f; 14249ea179fa7da13aa68c42a86cb9b315b0d9ea7aafFred Drake } else if (isUserLocked()) { 1425787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return mChildrenContainer.getGroupExpandFraction(); 1426787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1427787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1428787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return 0.0f; 1429787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1430787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1431787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis @Override 1432787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis protected boolean disallowSingleClick(MotionEvent event) { 1433787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis float x = event.getX(); 1434787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis float y = event.getY(); 1435787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis NotificationHeaderView header = getVisibleNotificationHeader(); 1436787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (header != null) { 1437787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return header.isInTouchRect(x - getTranslation(), y); 1438787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1439787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis return super.disallowSingleClick(event); 1440787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1441787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1442787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis private void logExpansionEvent(boolean userAction, boolean wasExpanded) { 1443787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis final boolean nowExpanded = isExpanded(); 1444787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis if (wasExpanded != nowExpanded && mLogger != null) { 1445787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis mLogger.logNotificationExpansion(mLoggingKey, userAction, nowExpanded) ; 1446787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1447787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1448787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis 1449787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis public interface OnExpandClickListener { 1450787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis void onExpandClicked(NotificationData.Entry clickedEntry, boolean nowExpanded); 1451787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis } 1452787354c3b99c9a0c5fdbdd33d29f58ef26df379fMartin v. Löwis} 145324b07bcba350bb86c4d6ca446e1564647a199868Ezio Melotti