Update SettingsTransitionHelper

Add version control for the helper.

Bug: 177480673
Test: rebuild and test Settings
Change-Id: I0a61b29fa7b8460206b1fdfef128f902d74ffd0a
This commit is contained in:
Yi-Ling Chuang
2021-03-31 16:23:48 +08:00
parent f7923a9cc2
commit 7466cdeec1
2 changed files with 28 additions and 2 deletions

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2021 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
android:pathData="M 0,0 C 0.05, 0, 0.133333, 0.06, 0.166666, 0.4 C 0.208333, 0.82, 0.25, 1, 1, 1"/>

View File

@@ -23,6 +23,8 @@ import android.view.Window;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import androidx.core.os.BuildCompat;
import com.google.android.material.transition.platform.MaterialSharedAxis;
import com.google.android.material.transition.platform.SlideDistanceProvider;
@@ -47,8 +49,7 @@ public class SettingsTransitionHelper {
transition.setDuration(DURATION);
final Interpolator interpolator =
AnimationUtils.loadInterpolator(context,
android.R.interpolator.fast_out_extra_slow_in);
AnimationUtils.loadInterpolator(context, R.interpolator.fast_out_extra_slow_in);
transition.setInterpolator(interpolator);
// TODO(b/177480673): Update fade through threshold once (cl/362065364) is released
@@ -64,6 +65,9 @@ public class SettingsTransitionHelper {
* triggered when the page is launched/entering.
*/
public static void applyForwardTransition(Activity activity) {
if (!BuildCompat.isAtLeastS()) {
return;
}
if (activity == null) {
Log.w(TAG, "applyForwardTransition: Invalid activity!");
return;
@@ -87,6 +91,9 @@ public class SettingsTransitionHelper {
* previously-started Activity.
*/
public static void applyBackwardTransition(Activity activity) {
if (!BuildCompat.isAtLeastS()) {
return;
}
if (activity == null) {
Log.w(TAG, "applyBackwardTransition: Invalid activity!");
return;