diff options
author | Charles Lombardo <clombardo169@gmail.com> | 2023-03-08 03:15:14 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2023-06-03 09:05:38 +0200 |
commit | a29c615f8d2ca9b05cee1305495f58410b56d593 (patch) | |
tree | bc32e65f7101e4b9547d4ed4d9634bf488356446 /src/android | |
parent | android: Convert SettingsFragmentView to Kotlin (diff) | |
download | yuzu-a29c615f8d2ca9b05cee1305495f58410b56d593.tar yuzu-a29c615f8d2ca9b05cee1305495f58410b56d593.tar.gz yuzu-a29c615f8d2ca9b05cee1305495f58410b56d593.tar.bz2 yuzu-a29c615f8d2ca9b05cee1305495f58410b56d593.tar.lz yuzu-a29c615f8d2ca9b05cee1305495f58410b56d593.tar.xz yuzu-a29c615f8d2ca9b05cee1305495f58410b56d593.tar.zst yuzu-a29c615f8d2ca9b05cee1305495f58410b56d593.zip |
Diffstat (limited to 'src/android')
2 files changed, 43 insertions, 48 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFrameLayout.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFrameLayout.java deleted file mode 100644 index f753368a8..000000000 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFrameLayout.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.yuzu.yuzu_emu.features.settings.ui; - -import android.content.Context; -import android.util.AttributeSet; -import android.widget.FrameLayout; - -/** - * FrameLayout subclass with few Properties added to simplify animations. - * Don't remove the methods appearing as unused, in order not to break the menu animations - */ -public final class SettingsFrameLayout extends FrameLayout { - private float mVisibleness = 1.0f; - - public SettingsFrameLayout(Context context) { - super(context); - } - - public SettingsFrameLayout(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public SettingsFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - public SettingsFrameLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - } - - public float getYFraction() { - return getY() / getHeight(); - } - - public void setYFraction(float yFraction) { - final int height = getHeight(); - setY((height > 0) ? (yFraction * height) : -9999); - } - - public float getVisibleness() { - return mVisibleness; - } - - public void setVisibleness(float visibleness) { - setScaleX(visibleness); - setScaleY(visibleness); - setAlpha(visibleness); - } -} 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 new file mode 100644 index 000000000..a5370af20 --- /dev/null +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFrameLayout.kt @@ -0,0 +1,43 @@ +package org.yuzu.yuzu_emu.features.settings.ui + +import android.content.Context +import android.util.AttributeSet +import android.widget.FrameLayout + +/** + * FrameLayout subclass with few Properties added to simplify animations. + * Don't remove the methods appearing as unused, in order not to break the menu animations + */ +class SettingsFrameLayout : FrameLayout { + private val mVisibleness = 1.0f + + constructor(context: Context?) : super(context!!) + constructor(context: Context?, attrs: AttributeSet?) : super(context!!, attrs) + + constructor( + context: Context?, + attrs: AttributeSet?, + defStyleAttr: Int + ) : super(context!!, attrs, defStyleAttr) + + constructor( + context: Context?, + attrs: AttributeSet?, + defStyleAttr: Int, + defStyleRes: Int + ) : super(context!!, attrs, defStyleAttr, defStyleRes) + + var yFraction: Float + get() = y / height + set(yFraction) { + val height = height + y = (if (height > 0) yFraction * height else -9999) as Float + } + var visibleness: Float + get() = mVisibleness + set(visibleness) { + scaleX = visibleness + scaleY = visibleness + alpha = visibleness + } +} |