blob: 5b9b1c613be572a1b7686530244a921ec006a48e [file] [log] [blame]
Annie Chind0f87d22016-10-24 09:04:12 -07001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.calculator2;
18
Annie Chin0e88baa2016-11-28 15:23:07 -080019import android.animation.ArgbEvaluator;
Aurimas Liutikas8c43f062018-03-28 08:10:28 -070020import androidx.recyclerview.widget.RecyclerView;
Annie Chind0f87d22016-10-24 09:04:12 -070021import android.view.View;
22import android.widget.TextView;
23
24/**
25 * Contains the logic for animating the recyclerview elements on drag.
26 */
27public final class DragController {
28
Annie Chinbc001882016-11-09 19:41:21 -080029 private static final String TAG = "DragController";
30
Annie Chin0e88baa2016-11-28 15:23:07 -080031 private static final ArgbEvaluator mColorEvaluator = new ArgbEvaluator();
32
Annie Chind0f87d22016-10-24 09:04:12 -070033 // References to views from the Calculator Display.
34 private CalculatorFormula mDisplayFormula;
35 private CalculatorResult mDisplayResult;
36 private View mToolbar;
37
38 private int mFormulaTranslationY;
39 private int mFormulaTranslationX;
40 private float mFormulaScale;
Annie Chinbc001882016-11-09 19:41:21 -080041 private float mResultScale;
Annie Chind0f87d22016-10-24 09:04:12 -070042
Annie Chinfe7a4102016-12-02 16:21:04 -080043 private float mResultTranslationY;
Annie Chind0f87d22016-10-24 09:04:12 -070044 private int mResultTranslationX;
45
Annie Chinbc001882016-11-09 19:41:21 -080046 private int mDisplayHeight;
47
Annie Chin0e88baa2016-11-28 15:23:07 -080048 private int mFormulaStartColor;
49 private int mFormulaEndColor;
50
51 private int mResultStartColor;
52 private int mResultEndColor;
53
Annie Chin36147982016-12-01 15:07:34 -080054 // The padding at the bottom of the RecyclerView itself.
55 private int mBottomPaddingHeight;
56
Annie Chind0f87d22016-10-24 09:04:12 -070057 private boolean mAnimationInitialized;
58
Annie Chin88613232017-01-04 12:21:52 -080059 private boolean mOneLine;
Annie Chinbfffafd2017-01-25 15:51:11 -080060 private boolean mIsDisplayEmpty;
Annie Chin88613232017-01-04 12:21:52 -080061
Annie Chinbc001882016-11-09 19:41:21 -080062 private AnimationController mAnimationController;
63
64 private Evaluator mEvaluator;
65
66 public void setEvaluator(Evaluator evaluator) {
67 mEvaluator = evaluator;
Annie Chinbc001882016-11-09 19:41:21 -080068 }
69
Annie Chinbfffafd2017-01-25 15:51:11 -080070 public void initializeController(boolean isResult, boolean oneLine, boolean isDisplayEmpty) {
Annie Chin88613232017-01-04 12:21:52 -080071 mOneLine = oneLine;
Annie Chinbfffafd2017-01-25 15:51:11 -080072 mIsDisplayEmpty = isDisplayEmpty;
73 if (mIsDisplayEmpty) {
Annie Chin94c1bd92016-11-23 13:39:56 -080074 // Empty display
75 mAnimationController = new EmptyAnimationController();
76 } else if (isResult) {
77 // Result
78 mAnimationController = new ResultAnimationController();
79 } else {
80 // There is something in the formula field. There may or may not be
81 // a quick result.
82 mAnimationController = new AnimationController();
83 }
Annie Chinbc001882016-11-09 19:41:21 -080084 }
85
Annie Chind0f87d22016-10-24 09:04:12 -070086 public void setDisplayFormula(CalculatorFormula formula) {
87 mDisplayFormula = formula;
88 }
89
90 public void setDisplayResult(CalculatorResult result) {
91 mDisplayResult = result;
92 }
93
94 public void setToolbar(View toolbar) {
95 mToolbar = toolbar;
96 }
97
Annie Chin0e88baa2016-11-28 15:23:07 -080098 public void animateViews(float yFraction, RecyclerView recyclerView) {
Justin Klaassen39297782016-12-19 09:11:38 -080099 if (mDisplayFormula == null
100 || mDisplayResult == null
101 || mToolbar == null
102 || mEvaluator == null) {
103 // Bail if we aren't yet initialized.
104 return;
105 }
106
107 final HistoryAdapter.ViewHolder vh =
108 (HistoryAdapter.ViewHolder) recyclerView.findViewHolderForAdapterPosition(0);
109 if (yFraction > 0 && vh != null) {
Annie Chinefa259a2016-11-23 14:15:15 -0800110 recyclerView.setVisibility(View.VISIBLE);
111 }
Annie Chinbfffafd2017-01-25 15:51:11 -0800112 if (vh != null && !mIsDisplayEmpty
113 && vh.getItemViewType() == HistoryAdapter.HISTORY_VIEW_TYPE) {
Annie Chin8149c8c2016-11-28 13:44:09 -0800114 final AlignedTextView formula = vh.getFormula();
Annie Chind0f87d22016-10-24 09:04:12 -0700115 final CalculatorResult result = vh.getResult();
116 final TextView date = vh.getDate();
Annie Chin36147982016-12-01 15:07:34 -0800117 final View divider = vh.getDivider();
Annie Chind0f87d22016-10-24 09:04:12 -0700118
119 if (!mAnimationInitialized) {
Annie Chin36147982016-12-01 15:07:34 -0800120 mBottomPaddingHeight = recyclerView.getPaddingBottom();
121
Annie Chinbc001882016-11-09 19:41:21 -0800122 mAnimationController.initializeScales(formula, result);
Annie Chind0f87d22016-10-24 09:04:12 -0700123
Annie Chin0e88baa2016-11-28 15:23:07 -0800124 mAnimationController.initializeColorAnimators(formula, result);
125
Annie Chinbc001882016-11-09 19:41:21 -0800126 mAnimationController.initializeFormulaTranslationX(formula);
Annie Chind0f87d22016-10-24 09:04:12 -0700127
Annie Chinbc001882016-11-09 19:41:21 -0800128 mAnimationController.initializeFormulaTranslationY(formula, result);
Annie Chind0f87d22016-10-24 09:04:12 -0700129
Annie Chinbc001882016-11-09 19:41:21 -0800130 mAnimationController.initializeResultTranslationX(result);
Annie Chind0f87d22016-10-24 09:04:12 -0700131
Annie Chinbc001882016-11-09 19:41:21 -0800132 mAnimationController.initializeResultTranslationY(result);
Annie Chind0f87d22016-10-24 09:04:12 -0700133
134 mAnimationInitialized = true;
135 }
136
Justin Klaassen39297782016-12-19 09:11:38 -0800137 result.setScaleX(mAnimationController.getResultScale(yFraction));
138 result.setScaleY(mAnimationController.getResultScale(yFraction));
Annie Chinbc001882016-11-09 19:41:21 -0800139
Justin Klaassen39297782016-12-19 09:11:38 -0800140 formula.setScaleX(mAnimationController.getFormulaScale(yFraction));
141 formula.setScaleY(mAnimationController.getFormulaScale(yFraction));
Annie Chinbc001882016-11-09 19:41:21 -0800142
Justin Klaassen39297782016-12-19 09:11:38 -0800143 formula.setPivotX(formula.getWidth() - formula.getPaddingEnd());
144 formula.setPivotY(formula.getHeight() - formula.getPaddingBottom());
Annie Chind0f87d22016-10-24 09:04:12 -0700145
Justin Klaassen39297782016-12-19 09:11:38 -0800146 result.setPivotX(result.getWidth() - result.getPaddingEnd());
147 result.setPivotY(result.getHeight() - result.getPaddingBottom());
Annie Chind0f87d22016-10-24 09:04:12 -0700148
Justin Klaassen39297782016-12-19 09:11:38 -0800149 formula.setTranslationX(mAnimationController.getFormulaTranslationX(yFraction));
150 formula.setTranslationY(mAnimationController.getFormulaTranslationY(yFraction));
Annie Chind0f87d22016-10-24 09:04:12 -0700151
Justin Klaassen39297782016-12-19 09:11:38 -0800152 result.setTranslationX(mAnimationController.getResultTranslationX(yFraction));
153 result.setTranslationY(mAnimationController.getResultTranslationY(yFraction));
Annie Chind0f87d22016-10-24 09:04:12 -0700154
Justin Klaassen39297782016-12-19 09:11:38 -0800155 formula.setTextColor((int) mColorEvaluator.evaluate(yFraction, mFormulaStartColor,
156 mFormulaEndColor));
Annie Chin0e88baa2016-11-28 15:23:07 -0800157
Justin Klaassen39297782016-12-19 09:11:38 -0800158 result.setTextColor((int) mColorEvaluator.evaluate(yFraction, mResultStartColor,
159 mResultEndColor));
Annie Chin0e88baa2016-11-28 15:23:07 -0800160
Justin Klaassen39297782016-12-19 09:11:38 -0800161 date.setTranslationY(mAnimationController.getDateTranslationY(yFraction));
162 divider.setTranslationY(mAnimationController.getDateTranslationY(yFraction));
Annie Chinbfffafd2017-01-25 15:51:11 -0800163 } else if (mIsDisplayEmpty) {
Annie Chinbc001882016-11-09 19:41:21 -0800164 // There is no current expression but we still need to collect information
165 // to translate the other viewholders.
166 if (!mAnimationInitialized) {
167 mAnimationController.initializeDisplayHeight();
Annie Chinbc001882016-11-09 19:41:21 -0800168 mAnimationInitialized = true;
169 }
170 }
Annie Chind0f87d22016-10-24 09:04:12 -0700171
Annie Chinbc001882016-11-09 19:41:21 -0800172 // Move up all ViewHolders above the current expression; if there is no current expression,
173 // we're translating all the viewholders.
174 for (int i = recyclerView.getChildCount() - 1;
175 i >= mAnimationController.getFirstTranslatedViewHolderIndex();
176 --i) {
177 final RecyclerView.ViewHolder vh2 =
178 recyclerView.getChildViewHolder(recyclerView.getChildAt(i));
179 if (vh2 != null) {
180 final View view = vh2.itemView;
181 if (view != null) {
182 view.setTranslationY(
183 mAnimationController.getHistoryElementTranslationY(yFraction));
Annie Chind0f87d22016-10-24 09:04:12 -0700184 }
185 }
186 }
187 }
Annie Chinbc001882016-11-09 19:41:21 -0800188
189 /**
Annie Chinb2e96182016-11-28 13:14:54 -0800190 * Reset all initialized values.
Annie Chinbc001882016-11-09 19:41:21 -0800191 */
Annie Chinbfffafd2017-01-25 15:51:11 -0800192 public void initializeAnimation(boolean isResult, boolean oneLine, boolean isDisplayEmpty) {
Annie Chinbc001882016-11-09 19:41:21 -0800193 mAnimationInitialized = false;
Annie Chinbfffafd2017-01-25 15:51:11 -0800194 initializeController(isResult, oneLine, isDisplayEmpty);
Annie Chinbc001882016-11-09 19:41:21 -0800195 }
196
197 public interface AnimateTextInterface {
198
199 void initializeDisplayHeight();
200
Annie Chin0e88baa2016-11-28 15:23:07 -0800201 void initializeColorAnimators(AlignedTextView formula, CalculatorResult result);
202
Annie Chin8149c8c2016-11-28 13:44:09 -0800203 void initializeScales(AlignedTextView formula, CalculatorResult result);
Annie Chinbc001882016-11-09 19:41:21 -0800204
Annie Chin8149c8c2016-11-28 13:44:09 -0800205 void initializeFormulaTranslationX(AlignedTextView formula);
Annie Chinbc001882016-11-09 19:41:21 -0800206
Annie Chin8149c8c2016-11-28 13:44:09 -0800207 void initializeFormulaTranslationY(AlignedTextView formula, CalculatorResult result);
Annie Chinbc001882016-11-09 19:41:21 -0800208
209 void initializeResultTranslationX(CalculatorResult result);
210
211 void initializeResultTranslationY(CalculatorResult result);
212
213 float getResultTranslationX(float yFraction);
214
215 float getResultTranslationY(float yFraction);
216
217 float getResultScale(float yFraction);
218
219 float getFormulaScale(float yFraction);
220
221 float getFormulaTranslationX(float yFraction);
222
223 float getFormulaTranslationY(float yFraction);
224
225 float getDateTranslationY(float yFraction);
226
227 float getHistoryElementTranslationY(float yFraction);
228
229 // Return the lowest index of the first Viewholder to be translated upwards.
230 // If there is no current expression, we translate all the viewholders; otherwise,
231 // we start at index 1.
232 int getFirstTranslatedViewHolderIndex();
233 }
234
235 // The default AnimationController when Display is in INPUT state and DisplayFormula is not
236 // empty. There may or may not be a quick result.
237 public class AnimationController implements DragController.AnimateTextInterface {
238
239 public void initializeDisplayHeight() {
240 // no-op
241 }
242
Annie Chin0e88baa2016-11-28 15:23:07 -0800243 public void initializeColorAnimators(AlignedTextView formula, CalculatorResult result) {
244 mFormulaStartColor = mDisplayFormula.getCurrentTextColor();
245 mFormulaEndColor = formula.getCurrentTextColor();
246
247 mResultStartColor = mDisplayResult.getCurrentTextColor();
248 mResultEndColor = result.getCurrentTextColor();
249 }
250
Annie Chin8149c8c2016-11-28 13:44:09 -0800251 public void initializeScales(AlignedTextView formula, CalculatorResult result) {
Annie Chinbc001882016-11-09 19:41:21 -0800252 // Calculate the scale for the text
Justin Klaassen39297782016-12-19 09:11:38 -0800253 mFormulaScale = mDisplayFormula.getTextSize() / formula.getTextSize();
Annie Chinbc001882016-11-09 19:41:21 -0800254 }
255
Annie Chin8149c8c2016-11-28 13:44:09 -0800256 public void initializeFormulaTranslationY(AlignedTextView formula,
Annie Chinbc001882016-11-09 19:41:21 -0800257 CalculatorResult result) {
Annie Chin88613232017-01-04 12:21:52 -0800258 if (mOneLine) {
259 // Disregard result since we set it to GONE in the one-line case.
260 mFormulaTranslationY =
261 mDisplayFormula.getPaddingBottom() - formula.getPaddingBottom()
262 - mBottomPaddingHeight;
263 } else {
264 // Baseline of formula moves by the difference in formula bottom padding and the
265 // difference in result height.
266 mFormulaTranslationY =
267 mDisplayFormula.getPaddingBottom() - formula.getPaddingBottom()
268 + mDisplayResult.getHeight() - result.getHeight()
269 - mBottomPaddingHeight;
270 }
Annie Chinbc001882016-11-09 19:41:21 -0800271 }
272
Annie Chin8149c8c2016-11-28 13:44:09 -0800273 public void initializeFormulaTranslationX(AlignedTextView formula) {
Annie Chinbc001882016-11-09 19:41:21 -0800274 // Right border of formula moves by the difference in formula end padding.
275 mFormulaTranslationX = mDisplayFormula.getPaddingEnd() - formula.getPaddingEnd();
276 }
277
278 public void initializeResultTranslationY(CalculatorResult result) {
279 // Baseline of result moves by the difference in result bottom padding.
Annie Chin36147982016-12-01 15:07:34 -0800280 mResultTranslationY = mDisplayResult.getPaddingBottom() - result.getPaddingBottom()
281 - mBottomPaddingHeight;
Annie Chinbc001882016-11-09 19:41:21 -0800282 }
283
284 public void initializeResultTranslationX(CalculatorResult result) {
285 mResultTranslationX = mDisplayResult.getPaddingEnd() - result.getPaddingEnd();
286 }
287
288 public float getResultTranslationX(float yFraction) {
Justin Klaassen39297782016-12-19 09:11:38 -0800289 return mResultTranslationX * (yFraction - 1f);
Annie Chinbc001882016-11-09 19:41:21 -0800290 }
291
292 public float getResultTranslationY(float yFraction) {
Justin Klaassen39297782016-12-19 09:11:38 -0800293 return mResultTranslationY * (yFraction - 1f);
Annie Chinbc001882016-11-09 19:41:21 -0800294 }
295
296 public float getResultScale(float yFraction) {
Justin Klaassen39297782016-12-19 09:11:38 -0800297 return 1f;
Annie Chinbc001882016-11-09 19:41:21 -0800298 }
299
300 public float getFormulaScale(float yFraction) {
Justin Klaassen39297782016-12-19 09:11:38 -0800301 return mFormulaScale + (1f - mFormulaScale) * yFraction;
Annie Chinbc001882016-11-09 19:41:21 -0800302 }
303
304 public float getFormulaTranslationX(float yFraction) {
Justin Klaassen39297782016-12-19 09:11:38 -0800305 return mFormulaTranslationX * (yFraction - 1f);
Annie Chinbc001882016-11-09 19:41:21 -0800306 }
307
308 public float getFormulaTranslationY(float yFraction) {
309 // Scale linearly between -FormulaTranslationY and 0.
Justin Klaassen39297782016-12-19 09:11:38 -0800310 return mFormulaTranslationY * (yFraction - 1f);
Annie Chinbc001882016-11-09 19:41:21 -0800311 }
312
313 public float getDateTranslationY(float yFraction) {
314 // We also want the date to start out above the visible screen with
315 // this distance decreasing as it's pulled down.
Annie Chin5a2bebb2016-12-06 14:38:49 -0800316 // Account for the scaled formula height.
Justin Klaassen39297782016-12-19 09:11:38 -0800317 return -mToolbar.getHeight() * (1f - yFraction)
Annie Chin5a2bebb2016-12-06 14:38:49 -0800318 + getFormulaTranslationY(yFraction)
Justin Klaassen39297782016-12-19 09:11:38 -0800319 - mDisplayFormula.getHeight() /getFormulaScale(yFraction) * (1f - yFraction);
Annie Chinbc001882016-11-09 19:41:21 -0800320 }
321
322 public float getHistoryElementTranslationY(float yFraction) {
323 return getDateTranslationY(yFraction);
324 }
325
326 public int getFirstTranslatedViewHolderIndex() {
327 return 1;
328 }
329 }
330
331 // The default AnimationController when Display is in RESULT state.
332 public class ResultAnimationController extends AnimationController
333 implements DragController.AnimateTextInterface {
334 @Override
Annie Chin8149c8c2016-11-28 13:44:09 -0800335 public void initializeScales(AlignedTextView formula, CalculatorResult result) {
Annie Chinbc001882016-11-09 19:41:21 -0800336 final float textSize = mDisplayResult.getTextSize() * mDisplayResult.getScaleX();
337 mResultScale = textSize / result.getTextSize();
Justin Klaassen39297782016-12-19 09:11:38 -0800338 mFormulaScale = 1f;
Annie Chinbc001882016-11-09 19:41:21 -0800339 }
340
341 @Override
Annie Chin8149c8c2016-11-28 13:44:09 -0800342 public void initializeFormulaTranslationY(AlignedTextView formula,
Annie Chinbc001882016-11-09 19:41:21 -0800343 CalculatorResult result) {
344 // Baseline of formula moves by the difference in formula bottom padding and the
345 // difference in the result height.
346 mFormulaTranslationY = mDisplayFormula.getPaddingBottom() - formula.getPaddingBottom()
Annie Chin36147982016-12-01 15:07:34 -0800347 + mDisplayResult.getHeight() - result.getHeight()
348 - mBottomPaddingHeight;
Annie Chinbc001882016-11-09 19:41:21 -0800349 }
350
351 @Override
Annie Chin8149c8c2016-11-28 13:44:09 -0800352 public void initializeFormulaTranslationX(AlignedTextView formula) {
Annie Chinbc001882016-11-09 19:41:21 -0800353 // Right border of formula moves by the difference in formula end padding.
354 mFormulaTranslationX = mDisplayFormula.getPaddingEnd() - formula.getPaddingEnd();
355 }
356
357 @Override
358 public void initializeResultTranslationY(CalculatorResult result) {
359 // Baseline of result moves by the difference in result bottom padding.
Annie Chinfe7a4102016-12-02 16:21:04 -0800360 mResultTranslationY = mDisplayResult.getPaddingBottom() - result.getPaddingBottom()
361 - mDisplayResult.getTranslationY()
362 - mBottomPaddingHeight;
Annie Chinbc001882016-11-09 19:41:21 -0800363 }
364
365 @Override
366 public void initializeResultTranslationX(CalculatorResult result) {
367 mResultTranslationX = mDisplayResult.getPaddingEnd() - result.getPaddingEnd();
368 }
369
370 @Override
371 public float getResultTranslationX(float yFraction) {
372 return (mResultTranslationX * yFraction) - mResultTranslationX;
373 }
374
375 @Override
376 public float getResultTranslationY(float yFraction) {
377 return (mResultTranslationY * yFraction) - mResultTranslationY;
378 }
379
380 @Override
381 public float getFormulaTranslationX(float yFraction) {
382 return (mFormulaTranslationX * yFraction) -
383 mFormulaTranslationX;
384 }
385
386 @Override
387 public float getFormulaTranslationY(float yFraction) {
388 return getDateTranslationY(yFraction);
389 }
390
391 @Override
392 public float getResultScale(float yFraction) {
393 return mResultScale - (mResultScale * yFraction) + yFraction;
394 }
395
396 @Override
397 public float getFormulaScale(float yFraction) {
Justin Klaassen39297782016-12-19 09:11:38 -0800398 return 1f;
Annie Chinbc001882016-11-09 19:41:21 -0800399 }
400
401 @Override
402 public float getDateTranslationY(float yFraction) {
403 // We also want the date to start out above the visible screen with
404 // this distance decreasing as it's pulled down.
Justin Klaassen39297782016-12-19 09:11:38 -0800405 return -mToolbar.getHeight() * (1f - yFraction)
Annie Chinbc001882016-11-09 19:41:21 -0800406 + (mResultTranslationY * yFraction) - mResultTranslationY
407 - mDisplayFormula.getPaddingTop() +
408 (mDisplayFormula.getPaddingTop() * yFraction);
409 }
410
411 @Override
412 public int getFirstTranslatedViewHolderIndex() {
413 return 1;
414 }
415 }
416
417 // The default AnimationController when Display is completely empty.
418 public class EmptyAnimationController extends AnimationController
419 implements DragController.AnimateTextInterface {
420 @Override
421 public void initializeDisplayHeight() {
422 mDisplayHeight = mToolbar.getHeight() + mDisplayResult.getHeight()
423 + mDisplayFormula.getHeight();
424 }
425
426 @Override
Annie Chin8149c8c2016-11-28 13:44:09 -0800427 public void initializeScales(AlignedTextView formula, CalculatorResult result) {
Annie Chinbc001882016-11-09 19:41:21 -0800428 // no-op
429 }
430
431 @Override
Annie Chin8149c8c2016-11-28 13:44:09 -0800432 public void initializeFormulaTranslationY(AlignedTextView formula,
Annie Chinbc001882016-11-09 19:41:21 -0800433 CalculatorResult result) {
434 // no-op
435 }
436
437 @Override
Annie Chin8149c8c2016-11-28 13:44:09 -0800438 public void initializeFormulaTranslationX(AlignedTextView formula) {
Annie Chinbc001882016-11-09 19:41:21 -0800439 // no-op
440 }
441
442 @Override
443 public void initializeResultTranslationY(CalculatorResult result) {
444 // no-op
445 }
446
447 @Override
448 public void initializeResultTranslationX(CalculatorResult result) {
449 // no-op
450 }
451
452 @Override
453 public float getResultTranslationX(float yFraction) {
Justin Klaassen39297782016-12-19 09:11:38 -0800454 return 0f;
Annie Chinbc001882016-11-09 19:41:21 -0800455 }
456
457 @Override
458 public float getResultTranslationY(float yFraction) {
Justin Klaassen39297782016-12-19 09:11:38 -0800459 return 0f;
Annie Chinbc001882016-11-09 19:41:21 -0800460 }
461
462 @Override
463 public float getFormulaScale(float yFraction) {
Justin Klaassen39297782016-12-19 09:11:38 -0800464 return 1f;
Annie Chinbc001882016-11-09 19:41:21 -0800465 }
466
467 @Override
468 public float getDateTranslationY(float yFraction) {
Justin Klaassen39297782016-12-19 09:11:38 -0800469 return 0f;
Annie Chinbc001882016-11-09 19:41:21 -0800470 }
471
472 @Override
473 public float getHistoryElementTranslationY(float yFraction) {
Justin Klaassen39297782016-12-19 09:11:38 -0800474 return -mDisplayHeight * (1f - yFraction) - mBottomPaddingHeight;
Annie Chinbc001882016-11-09 19:41:21 -0800475 }
476
477 @Override
478 public int getFirstTranslatedViewHolderIndex() {
479 return 0;
480 }
481 }
Annie Chind0f87d22016-10-24 09:04:12 -0700482}