summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yi-Ling Chuang <emilychuang@google.com> 2021-03-31 16:23:48 +0800
committer Yi-Ling Chuang <emilychuang@google.com> 2021-04-06 21:44:57 +0800
commit7466cdeec17c4bceea098aae1de08a080ea4555f (patch)
tree3621c12e199dc33a98edc2dee59287e592bc273f
parentf7923a9cc21746895ac459241e724b0da0339380 (diff)
Update SettingsTransitionHelper
Add version control for the helper. Bug: 177480673 Test: rebuild and test Settings Change-Id: I0a61b29fa7b8460206b1fdfef128f902d74ffd0a
-rw-r--r--packages/SettingsLib/SettingsTransition/res/interpolator/fast_out_extra_slow_in.xml19
-rw-r--r--packages/SettingsLib/SettingsTransition/src/com/android/settingslib/transition/SettingsTransitionHelper.java11
2 files changed, 28 insertions, 2 deletions
diff --git a/packages/SettingsLib/SettingsTransition/res/interpolator/fast_out_extra_slow_in.xml b/packages/SettingsLib/SettingsTransition/res/interpolator/fast_out_extra_slow_in.xml
new file mode 100644
index 000000000000..a2bbd2be777d
--- /dev/null
+++ b/packages/SettingsLib/SettingsTransition/res/interpolator/fast_out_extra_slow_in.xml
@@ -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"/>
diff --git a/packages/SettingsLib/SettingsTransition/src/com/android/settingslib/transition/SettingsTransitionHelper.java b/packages/SettingsLib/SettingsTransition/src/com/android/settingslib/transition/SettingsTransitionHelper.java
index f99fda05c3c9..6560a181d352 100644
--- a/packages/SettingsLib/SettingsTransition/src/com/android/settingslib/transition/SettingsTransitionHelper.java
+++ b/packages/SettingsLib/SettingsTransition/src/com/android/settingslib/transition/SettingsTransitionHelper.java
@@ -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;