Skip to content
This repository was archived by the owner on Dec 27, 2024. It is now read-only.

Commit b4288f7

Browse files
committed
resolve comments
1 parent 53a1ce2 commit b4288f7

File tree

1 file changed

+16
-16
lines changed
  • constraintlayout/core/src/main/java/androidx/constraintlayout/core/state

1 file changed

+16
-16
lines changed

constraintlayout/core/src/main/java/androidx/constraintlayout/core/state/Transition.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,12 @@ float getDestinationPosition(float currentPosition, float velocity, float durati
279279
return Float.NaN;
280280
case ON_UP_DECELERATE:
281281
return Math.max(0, Math.min(1, rest));
282-
case ON_UP_DECELERATE_AND_COMPLETE:
283-
if (rest > 0.2f && rest < 0.8f){
284-
return rest;
285-
} else {
286-
return rest > .5 ? 1 : 0;
287-
}
282+
case ON_UP_DECELERATE_AND_COMPLETE: // complete if within 20% of edge #todo improve
283+
if (rest > 0.2f && rest < 0.8f) {
284+
return rest;
285+
} else {
286+
return rest > .5f ? 1 : 0;
287+
}
288288
case ON_UP_AUTOCOMPLETE:
289289
}
290290

@@ -300,19 +300,19 @@ float getDestinationPosition(float currentPosition, float velocity, float durati
300300
void config(float position, float velocity, long start, float duration) {
301301
mStart = start;
302302
mDestination = getDestinationPosition(position, velocity, duration);
303-
if (mOnTouchUp == ON_UP_DECELERATE) {
304-
if (mAutoCompleteMode == MODE_CONTINUOUS_VELOCITY) {
305-
StopLogicEngine.Decelerate sld;
306-
if (mEngine instanceof StopLogicEngine.Decelerate) {
307-
sld = (StopLogicEngine.Decelerate) mEngine;
308-
} else {
309-
mEngine = sld = new StopLogicEngine.Decelerate();
310-
}
311-
sld.config(position, mDestination, velocity);
312-
return;
303+
if ((mOnTouchUp == ON_UP_DECELERATE)
304+
&& (mAutoCompleteMode == MODE_CONTINUOUS_VELOCITY)) {
305+
StopLogicEngine.Decelerate sld;
306+
if (mEngine instanceof StopLogicEngine.Decelerate) {
307+
sld = (StopLogicEngine.Decelerate) mEngine;
308+
} else {
309+
mEngine = sld = new StopLogicEngine.Decelerate();
313310
}
311+
sld.config(position, mDestination, velocity);
312+
return;
314313
}
315314

315+
316316
if (mAutoCompleteMode == MODE_CONTINUOUS_VELOCITY) {
317317
StopLogicEngine sl;
318318
if (mEngine instanceof StopLogicEngine) {

0 commit comments

Comments
 (0)