Skip to content

Commit 60e0f71

Browse files
programminghoch10binarynoise
authored andcommitted
Implement AnimationScaleMod
1 parent 634fa52 commit 60e0f71

File tree

13 files changed

+115
-0
lines changed

13 files changed

+115
-0
lines changed

AnimationScaleMod/Readme.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# AnimationScaleMod
2+
3+
This XPosed module adds more animation scale multipliers
4+
to the animation scale configuration in the development options.
5+
6+
Before/Later Comparison: \
7+
<img src="../metadata/com.programminghoch10.AnimationScaleMod/en-US/images/phoneScreenshots/1-before.png" style="width: 50%;" /><img src="../metadata/com.programminghoch10.AnimationScaleMod/en-US/images/phoneScreenshots/2-after.png" style="width: 50%;" />

AnimationScaleMod/build.gradle.kts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
plugins {
2+
alias(libs.plugins.buildlogic.android.application)
3+
}
4+
5+
android {
6+
namespace = "com.programminghoch10.AnimationScaleMod"
7+
8+
defaultConfig {
9+
minSdk = 24
10+
targetSdk = 35
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest
3+
xmlns:android="http://schemas.android.com/apk/res/android">
4+
5+
<application android:label="AnimationScaleMod">
6+
<meta-data
7+
android:name="xposedmodule"
8+
android:value="true"
9+
/>
10+
<meta-data
11+
android:name="xposeddescription"
12+
android:value="Add more animation scale multipliers"
13+
/>
14+
<meta-data
15+
android:name="xposedminversion"
16+
android:value="53"
17+
/>
18+
<meta-data
19+
android:name="xposedscope"
20+
android:resource="@array/scope"
21+
/>
22+
</application>
23+
24+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
com.programminghoch10.AnimationScaleMod.ScaleHook
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
package com.programminghoch10.AnimationScaleMod;
3+
4+
import android.content.res.XModuleResources;
5+
import android.content.res.XResources;
6+
7+
import java.util.Arrays;
8+
9+
import de.robv.android.xposed.IXposedHookInitPackageResources;
10+
import de.robv.android.xposed.IXposedHookZygoteInit;
11+
import de.robv.android.xposed.callbacks.XC_InitPackageResources;
12+
13+
public class ScaleHook implements IXposedHookInitPackageResources, IXposedHookZygoteInit {
14+
private static final String PACKAGE_SETTINGS = "com.android.settings";
15+
private final static String[] arrayResourceNames = {
16+
"window_animation",
17+
"transition_animation",
18+
"animator_duration",
19+
};
20+
private static String modulePath = null;
21+
22+
@Override
23+
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resparam) throws Throwable {
24+
if (!resparam.packageName.equals(PACKAGE_SETTINGS)) return;
25+
XResources resources = resparam.res;
26+
XModuleResources moduleResources = XModuleResources.createInstance(modulePath, resources);
27+
for (String arrayResourceName : arrayResourceNames) {
28+
arrayResourceName += "_scale";
29+
resources.setReplacement(PACKAGE_SETTINGS, "array", arrayResourceName + "_values", moduleResources.fwd(R.array.animation_scale_values));
30+
String animationOff = resources.getStringArray(resources.getIdentifier(arrayResourceName + "_entries", "array", PACKAGE_SETTINGS))[0];
31+
String[] entries = resources.getStringArray(resources.getIdentifier(arrayResourceName + "_values", "array", PACKAGE_SETTINGS));
32+
entries = Arrays.stream(entries).map(entry -> Float.parseFloat(entry) + "x").toArray(String[]::new);
33+
entries[0] = animationOff;
34+
resources.setReplacement(PACKAGE_SETTINGS, "array", arrayResourceName + "_entries", entries);
35+
}
36+
}
37+
38+
@Override
39+
public void initZygote(StartupParam startupParam) throws Throwable {
40+
modulePath = startupParam.modulePath;
41+
}
42+
43+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string-array name="scope">
4+
<item>com.android.settings</item>
5+
</string-array>
6+
7+
<string-array name="animation_scale_values" translatable="false">
8+
<item>0</item> <!-- zero has to be the first item and the only appearance in this list -->
9+
<item>.25</item>
10+
<item>.5</item>
11+
<item>.75</item>
12+
<item>1</item>
13+
<item>1.5</item>
14+
<item>2</item>
15+
<item>2.5</item>
16+
<item>3</item>
17+
<item>4</item>
18+
<item>5</item>
19+
<item>7.5</item>
20+
<item>10</item>
21+
</string-array>
22+
</resources>

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ A collection of small Xposed Modules.
44

55
| Module | Author | Description | Releases |
66
|--------------------------------------------------------------------------------------|------------------------------------------------------------|-------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
7+
| [AnimationScaleMod](AnimationScaleMod) | [@programminghoch10](https://github.com/programminghoch10) | Add more animation scale multipliers | [GitHub](https://github.com/binarynoise/XposedModulets/releases?q=AnimationScaleMod) |
78
| [AntiBrightnessChange](AntiBrightnessChange) | [@programminghoch10](https://github.com/programminghoch10) | Prevent apps from changing display brightness | [GitHub](https://github.com/binarynoise/XposedModulets/releases?q=AntiBrightnessChange) [IzzyOnDroid](https://apt.izzysoft.de/fdroid/index/apk/com.programminghoch10.AntiBrightnessChange) |
89
| [AutomaticAdvancedSettingsExpander](AutomaticAdvancedSettingsExpander) | [@binarynoise](https://github.com/binarynoise) | Automatically expands the advanced settings in the Settings app | [GitHub](https://github.com/binarynoise/XposedModulets/releases?q=AutomaticAdvancedSettingsExpander) [IzzyOnDroid](https://apt.izzysoft.de/fdroid/index/apk/de.binarynoise.AutomaticAdvancedSettingsExpander) |
910
| [BetterBluetoothDeviceSort](BetterBluetoothDeviceSort) | [@binarynoise](https://github.com/binarynoise) | Sorts Bluetooth devices by name | [GitHub](https://github.com/binarynoise/XposedModulets/releases?q=betterBluetoothDeviceSort) [IzzyOnDroid](https://apt.izzysoft.de/fdroid/index/apk/de.binarynoise.betterBluetoothDeviceSort) |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This XPosed module adds more animation scale multipliers
2+
to the animation scale configuration in the development options.
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add more animation scale multipliers.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AnimationScaleMod

settings.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ dependencyResolutionManagement {
3939
rootProject.name = "XposedModulets"
4040

4141
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
42+
include(":AnimationScaleMod")
4243
include(":AntiBrightnessChange")
4344
include(":AutomaticAdvancedSettingsExpander")
4445
include(":BetterAnimationScaling")

0 commit comments

Comments
 (0)