diff options
| author | 2023-03-14 00:01:05 -0400 | |
|---|---|---|
| committer | 2023-06-03 00:05:43 -0700 | |
| commit | 352559b83dc04d88e3efa6a6c6489467893f8600 (patch) | |
| tree | 48c263b1f91858e778d9c9e2af0ded3d26904ca3 /src/android | |
| parent | android: Use edge to edge (diff) | |
| download | yuzu-352559b83dc04d88e3efa6a6c6489467893f8600.tar.gz yuzu-352559b83dc04d88e3efa6a6c6489467893f8600.tar.xz yuzu-352559b83dc04d88e3efa6a6c6489467893f8600.zip | |
android: New settings fragment animations
Diffstat (limited to 'src/android')
12 files changed, 80 insertions, 163 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivity.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivity.kt index e403aa6d7..1fa7b2e0b 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivity.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivity.kt | |||
| @@ -97,10 +97,10 @@ class SettingsActivity : AppCompatActivity(), SettingsActivityView { | |||
| 97 | if (addToStack) { | 97 | if (addToStack) { |
| 98 | if (areSystemAnimationsEnabled()) { | 98 | if (areSystemAnimationsEnabled()) { |
| 99 | transaction.setCustomAnimations( | 99 | transaction.setCustomAnimations( |
| 100 | R.animator.settings_enter, | 100 | R.anim.anim_settings_fragment_in, |
| 101 | R.animator.settings_exit, | 101 | R.anim.anim_settings_fragment_out, |
| 102 | R.animator.settings_pop_enter, | 102 | 0, |
| 103 | R.animator.setttings_pop_exit | 103 | R.anim.anim_pop_settings_fragment_out |
| 104 | ) | 104 | ) |
| 105 | } | 105 | } |
| 106 | transaction.addToBackStack(null) | 106 | transaction.addToBackStack(null) |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFrameLayout.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFrameLayout.kt deleted file mode 100644 index c9918d608..000000000 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFrameLayout.kt +++ /dev/null | |||
| @@ -1,46 +0,0 @@ | |||
| 1 | // SPDX-FileCopyrightText: 2023 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | package org.yuzu.yuzu_emu.features.settings.ui | ||
| 5 | |||
| 6 | import android.content.Context | ||
| 7 | import android.util.AttributeSet | ||
| 8 | import android.widget.FrameLayout | ||
| 9 | |||
| 10 | /** | ||
| 11 | * FrameLayout subclass with few Properties added to simplify animations. | ||
| 12 | * Don't remove the methods appearing as unused, in order not to break the menu animations | ||
| 13 | */ | ||
| 14 | class SettingsFrameLayout : FrameLayout { | ||
| 15 | private val mVisibleness = 1.0f | ||
| 16 | |||
| 17 | constructor(context: Context?) : super(context!!) | ||
| 18 | constructor(context: Context?, attrs: AttributeSet?) : super(context!!, attrs) | ||
| 19 | |||
| 20 | constructor( | ||
| 21 | context: Context?, | ||
| 22 | attrs: AttributeSet?, | ||
| 23 | defStyleAttr: Int | ||
| 24 | ) : super(context!!, attrs, defStyleAttr) | ||
| 25 | |||
| 26 | constructor( | ||
| 27 | context: Context?, | ||
| 28 | attrs: AttributeSet?, | ||
| 29 | defStyleAttr: Int, | ||
| 30 | defStyleRes: Int | ||
| 31 | ) : super(context!!, attrs, defStyleAttr, defStyleRes) | ||
| 32 | |||
| 33 | var yFraction: Float | ||
| 34 | get() = y / height | ||
| 35 | set(yFraction) { | ||
| 36 | val height = height | ||
| 37 | y = (if (height > 0) yFraction * height else -9999) as Float | ||
| 38 | } | ||
| 39 | var visibleness: Float | ||
| 40 | get() = mVisibleness | ||
| 41 | set(visibleness) { | ||
| 42 | scaleX = visibleness | ||
| 43 | scaleY = visibleness | ||
| 44 | alpha = visibleness | ||
| 45 | } | ||
| 46 | } | ||
diff --git a/src/android/app/src/main/res/anim-ldrtl/anim_pop_settings_fragment_out.xml b/src/android/app/src/main/res/anim-ldrtl/anim_pop_settings_fragment_out.xml new file mode 100644 index 000000000..9f49c133a --- /dev/null +++ b/src/android/app/src/main/res/anim-ldrtl/anim_pop_settings_fragment_out.xml | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <set xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | |||
| 4 | <alpha | ||
| 5 | android:duration="125" | ||
| 6 | android:interpolator="@android:anim/decelerate_interpolator" | ||
| 7 | android:fromAlpha="1" | ||
| 8 | android:toAlpha="0" /> | ||
| 9 | |||
| 10 | <translate | ||
| 11 | android:duration="125" | ||
| 12 | android:interpolator="@android:anim/decelerate_interpolator" | ||
| 13 | android:fromXDelta="0" | ||
| 14 | android:toXDelta="-75" /> | ||
| 15 | |||
| 16 | </set> | ||
diff --git a/src/android/app/src/main/res/anim-ldrtl/anim_settings_fragment_in.xml b/src/android/app/src/main/res/anim-ldrtl/anim_settings_fragment_in.xml new file mode 100644 index 000000000..82fd719db --- /dev/null +++ b/src/android/app/src/main/res/anim-ldrtl/anim_settings_fragment_in.xml | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <set xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | |||
| 4 | <alpha | ||
| 5 | android:duration="@android:integer/config_shortAnimTime" | ||
| 6 | android:interpolator="@android:anim/decelerate_interpolator" | ||
| 7 | android:fromAlpha="0" | ||
| 8 | android:toAlpha="1" /> | ||
| 9 | |||
| 10 | <translate | ||
| 11 | android:duration="@android:integer/config_shortAnimTime" | ||
| 12 | android:interpolator="@android:anim/decelerate_interpolator" | ||
| 13 | android:fromXDelta="-200" | ||
| 14 | android:toXDelta="0" /> | ||
| 15 | |||
| 16 | </set> | ||
diff --git a/src/android/app/src/main/res/anim/anim_pop_settings_fragment_out.xml b/src/android/app/src/main/res/anim/anim_pop_settings_fragment_out.xml new file mode 100644 index 000000000..5892128f1 --- /dev/null +++ b/src/android/app/src/main/res/anim/anim_pop_settings_fragment_out.xml | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <set xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | |||
| 4 | <alpha | ||
| 5 | android:duration="125" | ||
| 6 | android:interpolator="@android:anim/decelerate_interpolator" | ||
| 7 | android:fromAlpha="1" | ||
| 8 | android:toAlpha="0" /> | ||
| 9 | |||
| 10 | <translate | ||
| 11 | android:duration="125" | ||
| 12 | android:interpolator="@android:anim/decelerate_interpolator" | ||
| 13 | android:fromXDelta="0" | ||
| 14 | android:toXDelta="75" /> | ||
| 15 | |||
| 16 | </set> | ||
diff --git a/src/android/app/src/main/res/anim/anim_settings_fragment_in.xml b/src/android/app/src/main/res/anim/anim_settings_fragment_in.xml new file mode 100644 index 000000000..98e0cf8bd --- /dev/null +++ b/src/android/app/src/main/res/anim/anim_settings_fragment_in.xml | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <set xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | |||
| 4 | <alpha | ||
| 5 | android:duration="@android:integer/config_shortAnimTime" | ||
| 6 | android:interpolator="@android:anim/decelerate_interpolator" | ||
| 7 | android:fromAlpha="0" | ||
| 8 | android:toAlpha="1" /> | ||
| 9 | |||
| 10 | <translate | ||
| 11 | android:duration="@android:integer/config_shortAnimTime" | ||
| 12 | android:interpolator="@android:anim/decelerate_interpolator" | ||
| 13 | android:fromXDelta="200" | ||
| 14 | android:toXDelta="0" /> | ||
| 15 | |||
| 16 | </set> | ||
diff --git a/src/android/app/src/main/res/anim/anim_settings_fragment_out.xml b/src/android/app/src/main/res/anim/anim_settings_fragment_out.xml new file mode 100644 index 000000000..77a40a4d1 --- /dev/null +++ b/src/android/app/src/main/res/anim/anim_settings_fragment_out.xml | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <set xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | |||
| 4 | <alpha | ||
| 5 | android:duration="@android:integer/config_shortAnimTime" | ||
| 6 | android:interpolator="@android:anim/decelerate_interpolator" | ||
| 7 | android:fromAlpha="1" | ||
| 8 | android:toAlpha="0" /> | ||
| 9 | |||
| 10 | </set> | ||
diff --git a/src/android/app/src/main/res/animator/settings_enter.xml b/src/android/app/src/main/res/animator/settings_enter.xml deleted file mode 100644 index 3c216a054..000000000 --- a/src/android/app/src/main/res/animator/settings_enter.xml +++ /dev/null | |||
| @@ -1,28 +0,0 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <set xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | |||
| 4 | <objectAnimator | ||
| 5 | android:duration="@android:integer/config_mediumAnimTime" | ||
| 6 | android:interpolator="@android:interpolator/decelerate_cubic" | ||
| 7 | android:propertyName="yFraction" | ||
| 8 | android:startOffset="@android:integer/config_shortAnimTime" | ||
| 9 | android:valueFrom="1.0" | ||
| 10 | android:valueTo="0" /> | ||
| 11 | |||
| 12 | <objectAnimator | ||
| 13 | android:duration="@android:integer/config_mediumAnimTime" | ||
| 14 | android:interpolator="@android:interpolator/decelerate_cubic" | ||
| 15 | android:propertyName="translationZ" | ||
| 16 | android:startOffset="@android:integer/config_shortAnimTime" | ||
| 17 | android:valueFrom="100.0" | ||
| 18 | android:valueTo="0" /> | ||
| 19 | |||
| 20 | <objectAnimator | ||
| 21 | android:duration="@android:integer/config_mediumAnimTime" | ||
| 22 | android:interpolator="@android:interpolator/decelerate_cubic" | ||
| 23 | android:propertyName="elevation" | ||
| 24 | android:startOffset="@android:integer/config_shortAnimTime" | ||
| 25 | android:valueFrom="100.0" | ||
| 26 | android:valueTo="0" /> | ||
| 27 | |||
| 28 | </set> \ No newline at end of file | ||
diff --git a/src/android/app/src/main/res/animator/settings_exit.xml b/src/android/app/src/main/res/animator/settings_exit.xml deleted file mode 100644 index a233b6757..000000000 --- a/src/android/app/src/main/res/animator/settings_exit.xml +++ /dev/null | |||
| @@ -1,28 +0,0 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <set xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | |||
| 4 | <objectAnimator | ||
| 5 | android:duration="@android:integer/config_mediumAnimTime" | ||
| 6 | android:interpolator="@android:interpolator/accelerate_cubic" | ||
| 7 | android:propertyName="visibleness" | ||
| 8 | android:valueFrom="1.0f" | ||
| 9 | android:valueTo="0.6f" | ||
| 10 | android:valueType="floatType" /> | ||
| 11 | |||
| 12 | <objectAnimator | ||
| 13 | android:duration="@android:integer/config_mediumAnimTime" | ||
| 14 | android:interpolator="@android:interpolator/decelerate_cubic" | ||
| 15 | android:propertyName="translationZ" | ||
| 16 | android:startOffset="@android:integer/config_shortAnimTime" | ||
| 17 | android:valueFrom="0" | ||
| 18 | android:valueTo="-100.0" /> | ||
| 19 | |||
| 20 | <objectAnimator | ||
| 21 | android:duration="@android:integer/config_mediumAnimTime" | ||
| 22 | android:interpolator="@android:interpolator/decelerate_cubic" | ||
| 23 | android:propertyName="elevation" | ||
| 24 | android:startOffset="@android:integer/config_shortAnimTime" | ||
| 25 | android:valueFrom="0" | ||
| 26 | android:valueTo="-100.0" /> | ||
| 27 | |||
| 28 | </set> \ No newline at end of file | ||
diff --git a/src/android/app/src/main/res/animator/settings_pop_enter.xml b/src/android/app/src/main/res/animator/settings_pop_enter.xml deleted file mode 100644 index 080bc27c4..000000000 --- a/src/android/app/src/main/res/animator/settings_pop_enter.xml +++ /dev/null | |||
| @@ -1,28 +0,0 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <set xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | |||
| 4 | <objectAnimator | ||
| 5 | android:duration="@android:integer/config_mediumAnimTime" | ||
| 6 | android:interpolator="@android:interpolator/decelerate_cubic" | ||
| 7 | android:propertyName="visibleness" | ||
| 8 | android:valueFrom="0.6f" | ||
| 9 | android:valueTo="1.0f" | ||
| 10 | android:valueType="floatType" /> | ||
| 11 | |||
| 12 | <objectAnimator | ||
| 13 | android:duration="@android:integer/config_mediumAnimTime" | ||
| 14 | android:interpolator="@android:interpolator/decelerate_cubic" | ||
| 15 | android:propertyName="translationZ" | ||
| 16 | android:startOffset="@android:integer/config_shortAnimTime" | ||
| 17 | android:valueFrom="-100.0" | ||
| 18 | android:valueTo="0" /> | ||
| 19 | |||
| 20 | <objectAnimator | ||
| 21 | android:duration="@android:integer/config_mediumAnimTime" | ||
| 22 | android:interpolator="@android:interpolator/decelerate_cubic" | ||
| 23 | android:propertyName="elevation" | ||
| 24 | android:startOffset="@android:integer/config_shortAnimTime" | ||
| 25 | android:valueFrom="-100.0" | ||
| 26 | android:valueTo="0" /> | ||
| 27 | |||
| 28 | </set> \ No newline at end of file | ||
diff --git a/src/android/app/src/main/res/animator/setttings_pop_exit.xml b/src/android/app/src/main/res/animator/setttings_pop_exit.xml deleted file mode 100644 index 4fccbcca2..000000000 --- a/src/android/app/src/main/res/animator/setttings_pop_exit.xml +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <set xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | |||
| 4 | <objectAnimator | ||
| 5 | android:duration="@android:integer/config_mediumAnimTime" | ||
| 6 | android:interpolator="@android:interpolator/accelerate_cubic" | ||
| 7 | android:propertyName="yFraction" | ||
| 8 | android:valueFrom="0" | ||
| 9 | android:valueTo="1.0" /> | ||
| 10 | |||
| 11 | <objectAnimator | ||
| 12 | android:duration="@android:integer/config_mediumAnimTime" | ||
| 13 | android:interpolator="@android:interpolator/decelerate_cubic" | ||
| 14 | android:propertyName="translationZ" | ||
| 15 | android:startOffset="@android:integer/config_shortAnimTime" | ||
| 16 | android:valueFrom="0.0" | ||
| 17 | android:valueTo="100" /> | ||
| 18 | |||
| 19 | <objectAnimator | ||
| 20 | android:duration="@android:integer/config_mediumAnimTime" | ||
| 21 | android:interpolator="@android:interpolator/decelerate_cubic" | ||
| 22 | android:propertyName="elevation" | ||
| 23 | android:startOffset="@android:integer/config_shortAnimTime" | ||
| 24 | android:valueFrom="0.0" | ||
| 25 | android:valueTo="100" /> | ||
| 26 | |||
| 27 | </set> \ No newline at end of file | ||
diff --git a/src/android/app/src/main/res/layout/fragment_settings.xml b/src/android/app/src/main/res/layout/fragment_settings.xml index 6feb092ff..167720347 100644 --- a/src/android/app/src/main/res/layout/fragment_settings.xml +++ b/src/android/app/src/main/res/layout/fragment_settings.xml | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <org.yuzu.yuzu_emu.features.settings.ui.SettingsFrameLayout | 2 | <FrameLayout |
| 3 | xmlns:android="http://schemas.android.com/apk/res/android" | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
| 4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
| 5 | android:layout_height="match_parent"> | 5 | android:layout_height="match_parent"> |
| @@ -11,4 +11,4 @@ | |||
| 11 | android:background="?attr/colorSurface" | 11 | android:background="?attr/colorSurface" |
| 12 | android:clipToPadding="false" /> | 12 | android:clipToPadding="false" /> |
| 13 | 13 | ||
| 14 | </org.yuzu.yuzu_emu.features.settings.ui.SettingsFrameLayout> | 14 | </FrameLayout> |