blob: 8f188003985772afcc7896e2d115cc5ca89c25c7 [file] [log] [blame]
Jason Monk162011e2016-02-19 08:11:55 -05001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
5 * except in compliance with the License. You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software distributed under the
10 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
11 * KIND, either express or implied. See the License for the specific language governing
12 * permissions and limitations under the License.
13 */
14
15package com.android.systemui.qs;
16
17import android.util.Log;
18import android.view.View;
Jason Monk8fb77872016-03-03 16:39:42 -050019import android.view.View.OnAttachStateChangeListener;
Jason Monk162011e2016-02-19 08:11:55 -050020import android.view.View.OnLayoutChangeListener;
Jason Monk9ffd9f62016-06-07 16:06:59 -040021
Jason Monkde850bb2017-02-01 19:26:30 -050022import com.android.systemui.Dependency;
Jason Monk702e2eb2017-03-03 16:53:44 -050023import com.android.systemui.plugins.qs.*;
24import com.android.systemui.plugins.qs.QSTileView;
Jason Monk162011e2016-02-19 08:11:55 -050025import com.android.systemui.qs.PagedTileLayout.PageListener;
26import com.android.systemui.qs.QSPanel.QSTileLayout;
Jason Monk702e2eb2017-03-03 16:53:44 -050027import com.android.systemui.qs.QSHost.Callback;
Jason Monk162011e2016-02-19 08:11:55 -050028import com.android.systemui.qs.TouchAnimator.Builder;
29import com.android.systemui.qs.TouchAnimator.Listener;
Jason Monk8fb77872016-03-03 16:39:42 -050030import com.android.systemui.tuner.TunerService;
31import com.android.systemui.tuner.TunerService.Tunable;
Jason Monk162011e2016-02-19 08:11:55 -050032
33import java.util.ArrayList;
34import java.util.Collection;
35
Jason Monk8fb77872016-03-03 16:39:42 -050036public class QSAnimator implements Callback, PageListener, Listener, OnLayoutChangeListener,
37 OnAttachStateChangeListener, Tunable {
Jason Monk162011e2016-02-19 08:11:55 -050038
39 private static final String TAG = "QSAnimator";
40
Jason Monk8fb77872016-03-03 16:39:42 -050041 private static final String ALLOW_FANCY_ANIMATION = "sysui_qs_fancy_anim";
42 private static final String MOVE_FULL_ROWS = "sysui_qs_move_whole_rows";
43
Jason Monkb46059a2016-06-30 14:22:42 -040044 public static final float EXPANDED_TILE_DELAY = .86f;
Jason Monk162011e2016-02-19 08:11:55 -050045
46 private final ArrayList<View> mAllViews = new ArrayList<>();
Jason Monke80654b2016-02-24 14:53:57 -050047 private final ArrayList<View> mTopFiveQs = new ArrayList<>();
Jason Monk162011e2016-02-19 08:11:55 -050048 private final QuickQSPanel mQuickQsPanel;
49 private final QSPanel mQsPanel;
Jason Monk0ceef212016-11-02 14:05:23 -040050 private final QS mQs;
Jason Monk162011e2016-02-19 08:11:55 -050051
Jason Monk8fb77872016-03-03 16:39:42 -050052 private PagedTileLayout mPagedLayout;
53
Jason Monk162011e2016-02-19 08:11:55 -050054 private boolean mOnFirstPage = true;
55 private TouchAnimator mFirstPageAnimator;
56 private TouchAnimator mFirstPageDelayedAnimator;
Jason Monka97776a2016-03-09 15:13:02 -050057 private TouchAnimator mTranslationXAnimator;
58 private TouchAnimator mTranslationYAnimator;
Jason Monk162011e2016-02-19 08:11:55 -050059 private TouchAnimator mNonfirstPageAnimator;
Jason Monkb46059a2016-06-30 14:22:42 -040060 private TouchAnimator mBrightnessAnimator;
Jason Monk162011e2016-02-19 08:11:55 -050061
Jason Monk8fb77872016-03-03 16:39:42 -050062 private boolean mOnKeyguard;
63
64 private boolean mAllowFancy;
65 private boolean mFullRows;
66 private int mNumQuickTiles;
Jason Monkbe8612d2016-03-30 16:19:06 -040067 private float mLastPosition;
Jason Monk9ffd9f62016-06-07 16:06:59 -040068 private QSTileHost mHost;
Jason Monk8fb77872016-03-03 16:39:42 -050069
Jason Monk0ceef212016-11-02 14:05:23 -040070 public QSAnimator(QS qs, QuickQSPanel quickPanel, QSPanel panel) {
71 mQs = qs;
Jason Monk162011e2016-02-19 08:11:55 -050072 mQuickQsPanel = quickPanel;
73 mQsPanel = panel;
Jason Monk8fb77872016-03-03 16:39:42 -050074 mQsPanel.addOnAttachStateChangeListener(this);
Jason Monk0ceef212016-11-02 14:05:23 -040075 qs.getView().addOnLayoutChangeListener(this);
76 if (mQsPanel.isAttachedToWindow()) {
77 onViewAttachedToWindow(null);
78 }
Jason Monk162011e2016-02-19 08:11:55 -050079 QSTileLayout tileLayout = mQsPanel.getTileLayout();
80 if (tileLayout instanceof PagedTileLayout) {
Jason Monk8fb77872016-03-03 16:39:42 -050081 mPagedLayout = ((PagedTileLayout) tileLayout);
82 mPagedLayout.setPageListener(this);
Jason Monk162011e2016-02-19 08:11:55 -050083 } else {
84 Log.w(TAG, "QS Not using page layout");
85 }
86 }
87
Jason Monk51fb85a2016-03-28 14:06:04 -040088 public void onRtlChanged() {
89 updateAnimators();
90 }
91
Jason Monk8fb77872016-03-03 16:39:42 -050092 public void setOnKeyguard(boolean onKeyguard) {
93 mOnKeyguard = onKeyguard;
Jason Monk5737ef32016-04-12 14:35:13 -040094 mQuickQsPanel.setVisibility(mOnKeyguard ? View.INVISIBLE : View.VISIBLE);
Jason Monk8fb77872016-03-03 16:39:42 -050095 if (mOnKeyguard) {
96 clearAnimationState();
97 }
98 }
99
Jason Monk162011e2016-02-19 08:11:55 -0500100 public void setHost(QSTileHost qsh) {
Jason Monk9ffd9f62016-06-07 16:06:59 -0400101 mHost = qsh;
Jason Monk162011e2016-02-19 08:11:55 -0500102 qsh.addCallback(this);
Jason Monka9df9992016-03-15 12:41:13 -0400103 updateAnimators();
Jason Monk162011e2016-02-19 08:11:55 -0500104 }
105
106 @Override
Jason Monk8fb77872016-03-03 16:39:42 -0500107 public void onViewAttachedToWindow(View v) {
Jason Monkde850bb2017-02-01 19:26:30 -0500108 Dependency.get(TunerService.class).addTunable(this, ALLOW_FANCY_ANIMATION,
Jason Monk8fb77872016-03-03 16:39:42 -0500109 MOVE_FULL_ROWS, QuickQSPanel.NUM_QUICK_TILES);
110 }
111
112 @Override
113 public void onViewDetachedFromWindow(View v) {
Jason Monk9ffd9f62016-06-07 16:06:59 -0400114 if (mHost != null) {
115 mHost.removeCallback(this);
116 }
Jason Monkde850bb2017-02-01 19:26:30 -0500117 Dependency.get(TunerService.class).removeTunable(this);
Jason Monk8fb77872016-03-03 16:39:42 -0500118 }
119
120 @Override
121 public void onTuningChanged(String key, String newValue) {
122 if (ALLOW_FANCY_ANIMATION.equals(key)) {
123 mAllowFancy = newValue == null || Integer.parseInt(newValue) != 0;
124 if (!mAllowFancy) {
125 clearAnimationState();
126 }
127 } else if (MOVE_FULL_ROWS.equals(key)) {
Jason Monk39a2e702016-03-08 16:41:23 -0500128 mFullRows = newValue == null || Integer.parseInt(newValue) != 0;
Jason Monk8fb77872016-03-03 16:39:42 -0500129 } else if (QuickQSPanel.NUM_QUICK_TILES.equals(key)) {
Jason Monk0ceef212016-11-02 14:05:23 -0400130 mNumQuickTiles = mQuickQsPanel.getNumQuickTiles(mQs.getContext());
Jason Monk8fb77872016-03-03 16:39:42 -0500131 clearAnimationState();
132 }
133 updateAnimators();
134 }
135
136 @Override
Jason Monk66eaf312016-02-25 12:29:29 -0500137 public void onPageChanged(boolean isFirst) {
138 if (mOnFirstPage == isFirst) return;
139 if (!isFirst) {
Jason Monk162011e2016-02-19 08:11:55 -0500140 clearAnimationState();
141 }
Jason Monk66eaf312016-02-25 12:29:29 -0500142 mOnFirstPage = isFirst;
Jason Monk162011e2016-02-19 08:11:55 -0500143 }
144
145 private void updateAnimators() {
146 TouchAnimator.Builder firstPageBuilder = new Builder();
Jason Monkfa0f47a2016-03-08 09:17:56 -0500147 TouchAnimator.Builder translationXBuilder = new Builder();
Jason Monk162011e2016-02-19 08:11:55 -0500148 TouchAnimator.Builder translationYBuilder = new Builder();
Jason Monk98196b02016-03-14 10:33:02 -0400149
Jason Monka9df9992016-03-15 12:41:13 -0400150 if (mQsPanel.getHost() == null) return;
Jason Monk702e2eb2017-03-03 16:53:44 -0500151 Collection<QSTile> tiles = mQsPanel.getHost().getTiles();
Jason Monk162011e2016-02-19 08:11:55 -0500152 int count = 0;
153 int[] loc1 = new int[2];
154 int[] loc2 = new int[2];
Jason Monk789e9c02016-03-28 16:00:09 -0400155 int lastXDiff = 0;
Jason Monk789e9c02016-03-28 16:00:09 -0400156 int lastX = 0;
Jason Monk98196b02016-03-14 10:33:02 -0400157
Jason Monkbc8ffc22016-03-09 10:58:49 -0500158 clearAnimationState();
Jason Monk162011e2016-02-19 08:11:55 -0500159 mAllViews.clear();
Jason Monke80654b2016-02-24 14:53:57 -0500160 mTopFiveQs.clear();
Jason Monk98196b02016-03-14 10:33:02 -0400161
Jason Monkf13413e2017-02-15 15:49:32 -0500162 QSTileLayout tileLayout = mQsPanel.getTileLayout();
163 mAllViews.add((View) tileLayout);
Jason Monkbdefffd2017-06-26 11:22:21 -0400164 int height = mQs.getView() != null ? mQs.getView().getMeasuredHeight() : 0;
165 int heightDiff = height - mQs.getHeader().getBottom()
Jason Monke5b770e2017-03-03 21:49:29 -0500166 + mQs.getHeader().getPaddingBottom();
167 firstPageBuilder.addFloat(tileLayout, "translationY", heightDiff, 0);
Jason Monk98196b02016-03-14 10:33:02 -0400168
Jason Monk702e2eb2017-03-03 16:53:44 -0500169 for (QSTile tile : tiles) {
170 QSTileView tileView = mQsPanel.getTileView(tile);
Jason Monk6e6af2c2016-09-20 14:34:26 -0400171 if (tileView == null) {
172 Log.e(TAG, "tileView is null " + tile.getTileSpec());
173 continue;
174 }
Xiaohui Chen2f3551b2016-04-07 10:37:25 -0700175 final View tileIcon = tileView.getIcon().getIconView();
Jason Monk0ceef212016-11-02 14:05:23 -0400176 View view = mQs.getView();
Jason Monk8fb77872016-03-03 16:39:42 -0500177 if (count < mNumQuickTiles && mAllowFancy) {
Jason Monk162011e2016-02-19 08:11:55 -0500178 // Quick tiles.
Jason Monk9f1422d2017-03-08 09:11:51 -0500179 QSTileView quickTileView = mQuickQsPanel.getTileView(tile);
180 if (quickTileView == null) continue;
Jason Monk162011e2016-02-19 08:11:55 -0500181
Jason Monk789e9c02016-03-28 16:00:09 -0400182 lastX = loc1[0];
Jason Monk0ceef212016-11-02 14:05:23 -0400183 getRelativePosition(loc1, quickTileView.getIcon().getIconView(), view);
184 getRelativePosition(loc2, tileIcon, view);
Jason Monk162011e2016-02-19 08:11:55 -0500185 final int xDiff = loc2[0] - loc1[0];
186 final int yDiff = loc2[1] - loc1[1];
Jason Monk789e9c02016-03-28 16:00:09 -0400187 lastXDiff = loc1[0] - lastX;
Jason Monk162011e2016-02-19 08:11:55 -0500188 // Move the quick tile right from its location to the new one.
Jason Monkfa0f47a2016-03-08 09:17:56 -0500189 translationXBuilder.addFloat(quickTileView, "translationX", 0, xDiff);
Jason Monk162011e2016-02-19 08:11:55 -0500190 translationYBuilder.addFloat(quickTileView, "translationY", 0, yDiff);
191
192 // Counteract the parent translation on the tile. So we have a static base to
Jason Monke80654b2016-02-24 14:53:57 -0500193 // animate the label position off from.
Jason Monkf13413e2017-02-15 15:49:32 -0500194 //firstPageBuilder.addFloat(tileView, "translationY", mQsPanel.getHeight(), 0);
Jason Monk162011e2016-02-19 08:11:55 -0500195
Jason Monkf13413e2017-02-15 15:49:32 -0500196 // Move the real tile from the quick tile position to its final
Jason Monk162011e2016-02-19 08:11:55 -0500197 // location.
Jason Monkf13413e2017-02-15 15:49:32 -0500198 translationXBuilder.addFloat(tileView, "translationX", -xDiff, 0);
199 translationYBuilder.addFloat(tileView, "translationY", -yDiff, 0);
Jason Monk162011e2016-02-19 08:11:55 -0500200
Jason Monk0f0de132016-12-19 15:36:13 -0500201 mTopFiveQs.add(tileView.getIcon());
Jason Monk0f0de132016-12-19 15:36:13 -0500202 mAllViews.add(tileView.getIcon());
Jason Monk162011e2016-02-19 08:11:55 -0500203 mAllViews.add(quickTileView);
Jason Monk8fb77872016-03-03 16:39:42 -0500204 } else if (mFullRows && isIconInAnimatedRow(count)) {
Jason Monk789e9c02016-03-28 16:00:09 -0400205 // TODO: Refactor some of this, it shares a lot with the above block.
206 // Move the last tile position over by the last difference between quick tiles.
207 // This makes the extra icons seems as if they are coming from positions in the
208 // quick panel.
209 loc1[0] += lastXDiff;
Jason Monk0ceef212016-11-02 14:05:23 -0400210 getRelativePosition(loc2, tileIcon, view);
Jason Monk789e9c02016-03-28 16:00:09 -0400211 final int xDiff = loc2[0] - loc1[0];
212 final int yDiff = loc2[1] - loc1[1];
213
Jason Monke5b770e2017-03-03 21:49:29 -0500214 firstPageBuilder.addFloat(tileView, "translationY", heightDiff, 0);
Jason Monk789e9c02016-03-28 16:00:09 -0400215 translationXBuilder.addFloat(tileView, "translationX", -xDiff, 0);
Jason Monkf13413e2017-02-15 15:49:32 -0500216 translationYBuilder.addFloat(tileView, "translationY", -yDiff, 0);
Jason Monk789e9c02016-03-28 16:00:09 -0400217 translationYBuilder.addFloat(tileIcon, "translationY", -yDiff, 0);
218
Jason Monk8fb77872016-03-03 16:39:42 -0500219 mAllViews.add(tileIcon);
Jason Monk98196b02016-03-14 10:33:02 -0400220 } else {
Jason Monkb46059a2016-06-30 14:22:42 -0400221 firstPageBuilder.addFloat(tileView, "alpha", 0, 1);
Jason Monke5b770e2017-03-03 21:49:29 -0500222 firstPageBuilder.addFloat(tileView, "translationY", -heightDiff, 0);
Jason Monk162011e2016-02-19 08:11:55 -0500223 }
224 mAllViews.add(tileView);
Jason Monk8fb77872016-03-03 16:39:42 -0500225 count++;
Jason Monk162011e2016-02-19 08:11:55 -0500226 }
Jason Monk8fb77872016-03-03 16:39:42 -0500227 if (mAllowFancy) {
Jason Monkb46059a2016-06-30 14:22:42 -0400228 // Make brightness appear static position and alpha in through second half.
229 View brightness = mQsPanel.getBrightnessView();
230 if (brightness != null) {
Jason Monke5b770e2017-03-03 21:49:29 -0500231 firstPageBuilder.addFloat(brightness, "translationY", heightDiff, 0);
Jason Monkb46059a2016-06-30 14:22:42 -0400232 mBrightnessAnimator = new TouchAnimator.Builder()
233 .addFloat(brightness, "alpha", 0, 1)
234 .setStartDelay(.5f)
235 .build();
236 mAllViews.add(brightness);
237 } else {
238 mBrightnessAnimator = null;
239 }
Jason Monk98196b02016-03-14 10:33:02 -0400240 mFirstPageAnimator = firstPageBuilder
241 .setListener(this)
242 .build();
243 // Fade in the tiles/labels as we reach the final position.
244 mFirstPageDelayedAnimator = new TouchAnimator.Builder()
245 .setStartDelay(EXPANDED_TILE_DELAY)
Jason Monkf13413e2017-02-15 15:49:32 -0500246 .addFloat(tileLayout, "alpha", 0, 1)
Jason Monkce4be852017-03-27 17:09:30 -0400247 .addFloat(mQsPanel.getPageIndicator(), "alpha", 0, 1)
248 .addFloat(mQsPanel.getDivider(), "alpha", 0, 1)
Jason Monkdf36aed2016-07-25 11:21:56 -0400249 .addFloat(mQsPanel.getFooter().getView(), "alpha", 0, 1).build();
Jason Monkce4be852017-03-27 17:09:30 -0400250 mAllViews.add(mQsPanel.getPageIndicator());
251 mAllViews.add(mQsPanel.getDivider());
Jason Monkdf36aed2016-07-25 11:21:56 -0400252 mAllViews.add(mQsPanel.getFooter().getView());
Jason Monk08a79192016-08-02 13:36:52 -0400253 float px = 0;
254 float py = 1;
255 if (tiles.size() <= 3) {
256 px = 1;
257 } else if (tiles.size() <= 6) {
258 px = .4f;
259 }
260 PathInterpolatorBuilder interpolatorBuilder = new PathInterpolatorBuilder(0, 0, px, py);
Jason Monka97776a2016-03-09 15:13:02 -0500261 translationXBuilder.setInterpolator(interpolatorBuilder.getXInterpolator());
262 translationYBuilder.setInterpolator(interpolatorBuilder.getYInterpolator());
263 mTranslationXAnimator = translationXBuilder.build();
264 mTranslationYAnimator = translationYBuilder.build();
Jason Monk8fb77872016-03-03 16:39:42 -0500265 }
Jason Monk162011e2016-02-19 08:11:55 -0500266 mNonfirstPageAnimator = new TouchAnimator.Builder()
267 .addFloat(mQuickQsPanel, "alpha", 1, 0)
Jason Monkce4be852017-03-27 17:09:30 -0400268 .addFloat(mQsPanel.getPageIndicator(), "alpha", 0, 1)
269 .addFloat(mQsPanel.getDivider(), "alpha", 0, 1)
Jason Monk79a9f2f2016-03-10 14:55:22 -0500270 .setListener(mNonFirstPageListener)
Jason Monk162011e2016-02-19 08:11:55 -0500271 .setEndDelay(.5f)
272 .build();
273 }
274
Jason Monk8fb77872016-03-03 16:39:42 -0500275 private boolean isIconInAnimatedRow(int count) {
276 if (mPagedLayout == null) {
277 return false;
278 }
279 final int columnCount = mPagedLayout.getColumnCount();
280 return count < ((mNumQuickTiles + columnCount - 1) / columnCount) * columnCount;
281 }
282
Jason Monk162011e2016-02-19 08:11:55 -0500283 private void getRelativePosition(int[] loc1, View view, View parent) {
284 loc1[0] = 0 + view.getWidth() / 2;
285 loc1[1] = 0;
286 getRelativePositionInt(loc1, view, parent);
287 }
288
289 private void getRelativePositionInt(int[] loc1, View view, View parent) {
290 if(view == parent || view == null) return;
Jason Monk61d118d2016-05-20 14:44:16 -0400291 // Ignore tile pages as they can have some offset we don't want to take into account in
292 // RTL.
293 if (!(view instanceof PagedTileLayout.TilePage)) {
294 loc1[0] += view.getLeft();
295 loc1[1] += view.getTop();
296 }
Jason Monk162011e2016-02-19 08:11:55 -0500297 getRelativePositionInt(loc1, (View) view.getParent(), parent);
298 }
299
300 public void setPosition(float position) {
301 if (mFirstPageAnimator == null) return;
Jason Monk8fb77872016-03-03 16:39:42 -0500302 if (mOnKeyguard) {
303 return;
304 }
Jason Monkbe8612d2016-03-30 16:19:06 -0400305 mLastPosition = position;
Jason Monk8fb77872016-03-03 16:39:42 -0500306 if (mOnFirstPage && mAllowFancy) {
Jason Monk162011e2016-02-19 08:11:55 -0500307 mQuickQsPanel.setAlpha(1);
308 mFirstPageAnimator.setPosition(position);
309 mFirstPageDelayedAnimator.setPosition(position);
Jason Monka97776a2016-03-09 15:13:02 -0500310 mTranslationXAnimator.setPosition(position);
311 mTranslationYAnimator.setPosition(position);
Jason Monkb46059a2016-06-30 14:22:42 -0400312 if (mBrightnessAnimator != null) {
313 mBrightnessAnimator.setPosition(position);
314 }
Jason Monk162011e2016-02-19 08:11:55 -0500315 } else {
316 mNonfirstPageAnimator.setPosition(position);
317 }
318 }
319
320 @Override
321 public void onAnimationAtStart() {
Jason Monkdf5459d2016-02-29 10:47:35 -0500322 mQuickQsPanel.setVisibility(View.VISIBLE);
Jason Monk162011e2016-02-19 08:11:55 -0500323 }
324
325 @Override
326 public void onAnimationAtEnd() {
327 mQuickQsPanel.setVisibility(View.INVISIBLE);
Jason Monke80654b2016-02-24 14:53:57 -0500328 final int N = mTopFiveQs.size();
329 for (int i = 0; i < N; i++) {
330 mTopFiveQs.get(i).setVisibility(View.VISIBLE);
331 }
Jason Monk162011e2016-02-19 08:11:55 -0500332 }
333
334 @Override
335 public void onAnimationStarted() {
Jason Monk5737ef32016-04-12 14:35:13 -0400336 mQuickQsPanel.setVisibility(mOnKeyguard ? View.INVISIBLE : View.VISIBLE);
Jason Monke80654b2016-02-24 14:53:57 -0500337 if (mOnFirstPage) {
338 final int N = mTopFiveQs.size();
339 for (int i = 0; i < N; i++) {
340 mTopFiveQs.get(i).setVisibility(View.INVISIBLE);
341 }
342 }
Jason Monk162011e2016-02-19 08:11:55 -0500343 }
344
345 private void clearAnimationState() {
346 final int N = mAllViews.size();
347 mQuickQsPanel.setAlpha(0);
348 for (int i = 0; i < N; i++) {
349 View v = mAllViews.get(i);
350 v.setAlpha(1);
Jason Monka2bd0462016-04-12 13:55:16 -0400351 v.setTranslationX(0);
352 v.setTranslationY(0);
Jason Monk162011e2016-02-19 08:11:55 -0500353 }
Jason Monk8fb77872016-03-03 16:39:42 -0500354 final int N2 = mTopFiveQs.size();
355 for (int i = 0; i < N2; i++) {
356 mTopFiveQs.get(i).setVisibility(View.VISIBLE);
357 }
Jason Monk162011e2016-02-19 08:11:55 -0500358 }
359
360 @Override
361 public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft,
362 int oldTop, int oldRight, int oldBottom) {
Jason Monk51fb85a2016-03-28 14:06:04 -0400363 mQsPanel.post(mUpdateAnimators);
Jason Monk162011e2016-02-19 08:11:55 -0500364 }
365
366 @Override
367 public void onTilesChanged() {
368 // Give the QS panels a moment to generate their new tiles, then create all new animators
369 // hooked up to the new views.
370 mQsPanel.post(mUpdateAnimators);
371 }
372
Jason Monk79a9f2f2016-03-10 14:55:22 -0500373 private final TouchAnimator.Listener mNonFirstPageListener =
374 new TouchAnimator.ListenerAdapter() {
375 @Override
dongwan0605.kim03c9afa2017-01-03 15:40:07 +0900376 public void onAnimationAtEnd() {
377 mQuickQsPanel.setVisibility(View.INVISIBLE);
378 }
379
380 @Override
Jason Monk79a9f2f2016-03-10 14:55:22 -0500381 public void onAnimationStarted() {
382 mQuickQsPanel.setVisibility(View.VISIBLE);
383 }
384 };
385
Jason Monk162011e2016-02-19 08:11:55 -0500386 private Runnable mUpdateAnimators = new Runnable() {
387 @Override
388 public void run() {
389 updateAnimators();
Jason Monkbe8612d2016-03-30 16:19:06 -0400390 setPosition(mLastPosition);
Jason Monk162011e2016-02-19 08:11:55 -0500391 }
392 };
393}