Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ This repository contains multiple libraries in SystemUI used by Lawnchair.
A brief explanation of what each library does:
* `animationlib`: Handling playback and interpolator of the animations
* `contextualeducationlib`: Store "education" type
* `displaylib`: Handling presumably desktop displays
* `iconloaderlib`: Handling all of Launcher3 and Lawnchair icons
* `mechanics`: Complement the `animationlib`
* `msdllib`: Multi-Sensory-Design-Language, handling all new vibrations in Launcher3 Android 16
* `searchuilib`: Store search-related layout type
* See [AOSP Commit][searchuilib-url] instead because it's gone private after U
* `viewcapturelib`: Capture views... yep that's really that it

[searchuilib-url]: https://cs.android.com/android/_/android/platform/frameworks/libs/systemui/+/main:searchuilib/src/com/android/app/search/;drc=ace90b2ec32d3730141387c56e8abc761c380550;bpv=1;bpt=0
6 changes: 5 additions & 1 deletion animationlib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ android {
manifest.srcFile 'AndroidManifest.xml'
}
androidTest {
java.srcDirs = ["tests/src"]
java.srcDirs = ["tests/src", "tests/robolectric/src"]
manifest.srcFile 'tests/AndroidManifest.xml'
}
}

lintOptions {
abortOnError false
}
Expand All @@ -34,4 +35,7 @@ dependencies {
implementation libs.kotlin.stdlib.jdk7
implementation libs.androidx.core.animation
implementation libs.androidx.core.ktx
// androidTestImplementation libs.robolectric
// androidTestImplementation "androidx.test.ext:junit:1.1.3"
// androidTestImplementation "androidx.test:rules:1.4.0"
}
1 change: 0 additions & 1 deletion animationlib/src/com/android/app/animation/Animations.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package com.android.app.animation

import android.animation.Animator
import android.view.View
import com.android.app.animation.Animations.Companion.setOngoingAnimation

/** A static class for general animation-related utilities. */
class Animations {
Expand Down
46 changes: 23 additions & 23 deletions animationlib/src/com/android/app/animation/Interpolators.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ public class Interpolators {
* is disappearing e.g. when moving off screen.
*/
public static final Interpolator EMPHASIZED_ACCELERATE = new PathInterpolator(
0.3f, 0f, 0.8f, 0.15f);
0.3f, 0f, 0.8f, 0.15f);

/**
* The decelerating emphasized interpolator. Used for hero / emphasized movement of content that
* is appearing e.g. when coming from off screen
*/
public static final Interpolator EMPHASIZED_DECELERATE = new PathInterpolator(
0.05f, 0.7f, 0.1f, 1f);
0.05f, 0.7f, 0.1f, 1f);


public static final Interpolator EXAGGERATED_EASE;
Expand Down Expand Up @@ -98,21 +98,21 @@ public class Interpolators {
* The standard interpolator that should be used on every normal animation
*/
public static final Interpolator STANDARD = new PathInterpolator(
0.2f, 0f, 0f, 1f);
0.2f, 0f, 0f, 1f);

/**
* The standard accelerating interpolator that should be used on every regular movement of
* content that is disappearing e.g. when moving off screen.
*/
public static final Interpolator STANDARD_ACCELERATE = new PathInterpolator(
0.3f, 0f, 1f, 1f);
0.3f, 0f, 1f, 1f);

/**
* The standard decelerating interpolator that should be used on every regular movement of
* content that is appearing e.g. when coming from off screen.
*/
public static final Interpolator STANDARD_DECELERATE = new PathInterpolator(
0f, 0f, 0f, 1f);
0f, 0f, 0f, 1f);

/*
* ============================================================================================
Expand Down Expand Up @@ -158,7 +158,7 @@ public class Interpolators {
* goes from 1 to 0 instead of 0 to 1).
*/
public static final Interpolator FAST_OUT_SLOW_IN_REVERSE =
new PathInterpolator(0.8f, 0f, 0.6f, 1f);
new PathInterpolator(0.8f, 0f, 0.6f, 1f);
public static final Interpolator SLOW_OUT_LINEAR_IN = new PathInterpolator(0.8f, 0f, 1f, 1f);
public static final Interpolator AGGRESSIVE_EASE = new PathInterpolator(0.2f, 0f, 0f, 1f);
public static final Interpolator AGGRESSIVE_EASE_IN_OUT = new PathInterpolator(0.6f,0, 0.4f, 1);
Expand All @@ -182,31 +182,31 @@ public class Interpolators {
public static final Interpolator CUSTOM_40_40 = new PathInterpolator(0.4f, 0f, 0.6f, 1f);
public static final Interpolator ICON_OVERSHOT = new PathInterpolator(0.4f, 0f, 0.2f, 1.4f);
public static final Interpolator ICON_OVERSHOT_LESS = new PathInterpolator(0.4f, 0f, 0.2f,
1.1f);
1.1f);
public static final Interpolator PANEL_CLOSE_ACCELERATED = new PathInterpolator(0.3f, 0, 0.5f,
1);
1);
public static final Interpolator BOUNCE = new BounceInterpolator();
/**
* For state transitions on the control panel that lives in GlobalActions.
*/
public static final Interpolator CONTROL_STATE = new PathInterpolator(0.4f, 0f, 0.2f,
1.0f);
1.0f);

/**
* Interpolator to be used when animating a move based on a click. Pair with enough duration.
*/
public static final Interpolator TOUCH_RESPONSE =
new PathInterpolator(0.3f, 0f, 0.1f, 1f);
new PathInterpolator(0.3f, 0f, 0.1f, 1f);

/**
* Like {@link #TOUCH_RESPONSE}, but used in case the animation is played in reverse (i.e. t
* goes from 1 to 0 instead of 0 to 1).
*/
public static final Interpolator TOUCH_RESPONSE_REVERSE =
new PathInterpolator(0.9f, 0f, 0.7f, 1f);
new PathInterpolator(0.9f, 0f, 0.7f, 1f);

public static final Interpolator TOUCH_RESPONSE_ACCEL_DEACCEL =
v -> ACCELERATE_DECELERATE.getInterpolation(TOUCH_RESPONSE.getInterpolation(v));
v -> ACCELERATE_DECELERATE.getInterpolation(TOUCH_RESPONSE.getInterpolation(v));


/**
Expand Down Expand Up @@ -236,7 +236,7 @@ public float getInterpolation(float v) {
*/
private float zInterpolate(float input) {
return (1.0f - FOCAL_LENGTH / (FOCAL_LENGTH + input)) /
(1.0f - FOCAL_LENGTH / (FOCAL_LENGTH + 1.0f));
(1.0f - FOCAL_LENGTH / (FOCAL_LENGTH + 1.0f));
}
};

Expand Down Expand Up @@ -297,13 +297,13 @@ public static Interpolator overshootInterpolatorForVelocity(float velocity) {
* @return the interpolated overshoot
*/
public static float getOvershootInterpolation(float progress, float overshootAmount,
float overshootStart) {
float overshootStart) {
if (overshootAmount == 0.0f || overshootStart == 0.0f) {
throw new IllegalArgumentException("Invalid values for overshoot");
}
float b = MathUtils.log((overshootAmount + 1) / (overshootAmount)) / overshootStart;
return MathUtils.max(0.0f,
(float) (1.0f - Math.exp(-b * progress)) * (overshootAmount + 1.0f));
(float) (1.0f - Math.exp(-b * progress)) * (overshootAmount + 1.0f));
}

/**
Expand Down Expand Up @@ -344,11 +344,11 @@ private static PathInterpolator createEmphasizedComplement() {
* 1 by upperBound.
*/
public static Interpolator clampToProgress(Interpolator interpolator, float lowerBound,
float upperBound) {
float upperBound) {
if (upperBound < lowerBound) {
throw new IllegalArgumentException(
String.format("upperBound (%f) must be greater than lowerBound (%f)",
upperBound, lowerBound));
String.format("upperBound (%f) must be greater than lowerBound (%f)",
upperBound, lowerBound));
}
return t -> clampToProgress(interpolator, t, lowerBound, upperBound);
}
Expand All @@ -361,11 +361,11 @@ public static Interpolator clampToProgress(Interpolator interpolator, float lowe
* interpolator.
*/
public static float clampToProgress(
Interpolator interpolator, float progress, float lowerBound, float upperBound) {
Interpolator interpolator, float progress, float lowerBound, float upperBound) {
if (upperBound < lowerBound) {
throw new IllegalArgumentException(
String.format("upperBound (%f) must be greater than lowerBound (%f)",
upperBound, lowerBound));
String.format("upperBound (%f) must be greater than lowerBound (%f)",
upperBound, lowerBound));
}

if (progress == lowerBound && progress == upperBound) {
Expand Down Expand Up @@ -398,7 +398,7 @@ private static float mapRange(float value, float min, float max) {
* such as to take over a user-controlled animation when they let go.
*/
public static Interpolator mapToProgress(Interpolator interpolator, float lowerBound,
float upperBound) {
float upperBound) {
return t -> mapRange(interpolator.getInterpolation(t), lowerBound, upperBound);
}

Expand All @@ -411,4 +411,4 @@ public static Interpolator mapToProgress(Interpolator interpolator, float lowerB
public static Interpolator reverse(Interpolator interpolator) {
return t -> 1 - interpolator.getInterpolation(1 - t);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ public class InterpolatorsAndroidX {
* is disappearing e.g. when moving off screen.
*/
public static final Interpolator EMPHASIZED_ACCELERATE = new PathInterpolator(
0.3f, 0f, 0.8f, 0.15f);
0.3f, 0f, 0.8f, 0.15f);

/**
* The decelerating emphasized interpolator. Used for hero / emphasized movement of content that
* is appearing e.g. when coming from off screen
*/
public static final Interpolator EMPHASIZED_DECELERATE = new PathInterpolator(
0.05f, 0.7f, 0.1f, 1f);
0.05f, 0.7f, 0.1f, 1f);

public static final Interpolator EXAGGERATED_EASE;
static {
Expand Down Expand Up @@ -104,21 +104,21 @@ public class InterpolatorsAndroidX {
* The standard interpolator that should be used on every normal animation
*/
public static final Interpolator STANDARD = new PathInterpolator(
0.2f, 0f, 0f, 1f);
0.2f, 0f, 0f, 1f);

/**
* The standard accelerating interpolator that should be used on every regular movement of
* content that is disappearing e.g. when moving off screen.
*/
public static final Interpolator STANDARD_ACCELERATE = new PathInterpolator(
0.3f, 0f, 1f, 1f);
0.3f, 0f, 1f, 1f);

/**
* The standard decelerating interpolator that should be used on every regular movement of
* content that is appearing e.g. when coming from off screen.
*/
public static final Interpolator STANDARD_DECELERATE = new PathInterpolator(
0f, 0f, 0f, 1f);
0f, 0f, 0f, 1f);

/*
* ============================================================================================
Expand Down Expand Up @@ -164,7 +164,7 @@ public class InterpolatorsAndroidX {
* goes from 1 to 0 instead of 0 to 1).
*/
public static final Interpolator FAST_OUT_SLOW_IN_REVERSE =
new PathInterpolator(0.8f, 0f, 0.6f, 1f);
new PathInterpolator(0.8f, 0f, 0.6f, 1f);
public static final Interpolator SLOW_OUT_LINEAR_IN = new PathInterpolator(0.8f, 0f, 1f, 1f);
public static final Interpolator AGGRESSIVE_EASE = new PathInterpolator(0.2f, 0f, 0f, 1f);
public static final Interpolator AGGRESSIVE_EASE_IN_OUT = new PathInterpolator(0.6f,0, 0.4f, 1);
Expand All @@ -188,31 +188,31 @@ public class InterpolatorsAndroidX {
public static final Interpolator CUSTOM_40_40 = new PathInterpolator(0.4f, 0f, 0.6f, 1f);
public static final Interpolator ICON_OVERSHOT = new PathInterpolator(0.4f, 0f, 0.2f, 1.4f);
public static final Interpolator ICON_OVERSHOT_LESS = new PathInterpolator(0.4f, 0f, 0.2f,
1.1f);
1.1f);
public static final Interpolator PANEL_CLOSE_ACCELERATED = new PathInterpolator(0.3f, 0, 0.5f,
1);
1);
public static final Interpolator BOUNCE = new BounceInterpolator();
/**
* For state transitions on the control panel that lives in GlobalActions.
*/
public static final Interpolator CONTROL_STATE = new PathInterpolator(0.4f, 0f, 0.2f,
1.0f);
1.0f);

/**
* Interpolator to be used when animating a move based on a click. Pair with enough duration.
*/
public static final Interpolator TOUCH_RESPONSE =
new PathInterpolator(0.3f, 0f, 0.1f, 1f);
new PathInterpolator(0.3f, 0f, 0.1f, 1f);

/**
* Like {@link #TOUCH_RESPONSE}, but used in case the animation is played in reverse (i.e. t
* goes from 1 to 0 instead of 0 to 1).
*/
public static final Interpolator TOUCH_RESPONSE_REVERSE =
new PathInterpolator(0.9f, 0f, 0.7f, 1f);
new PathInterpolator(0.9f, 0f, 0.7f, 1f);

public static final Interpolator TOUCH_RESPONSE_ACCEL_DEACCEL =
v -> ACCELERATE_DECELERATE.getInterpolation(TOUCH_RESPONSE.getInterpolation(v));
v -> ACCELERATE_DECELERATE.getInterpolation(TOUCH_RESPONSE.getInterpolation(v));


/**
Expand Down Expand Up @@ -242,7 +242,7 @@ public float getInterpolation(float v) {
*/
private float zInterpolate(float input) {
return (1.0f - FOCAL_LENGTH / (FOCAL_LENGTH + input)) /
(1.0f - FOCAL_LENGTH / (FOCAL_LENGTH + 1.0f));
(1.0f - FOCAL_LENGTH / (FOCAL_LENGTH + 1.0f));
}
};

Expand Down Expand Up @@ -303,13 +303,13 @@ public static Interpolator overshootInterpolatorForVelocity(float velocity) {
* @return the interpolated overshoot
*/
public static float getOvershootInterpolation(float progress, float overshootAmount,
float overshootStart) {
float overshootStart) {
if (overshootAmount == 0.0f || overshootStart == 0.0f) {
throw new IllegalArgumentException("Invalid values for overshoot");
}
float b = MathUtils.log((overshootAmount + 1) / (overshootAmount)) / overshootStart;
return MathUtils.max(0.0f,
(float) (1.0f - Math.exp(-b * progress)) * (overshootAmount + 1.0f));
(float) (1.0f - Math.exp(-b * progress)) * (overshootAmount + 1.0f));
}

/**
Expand Down Expand Up @@ -350,11 +350,11 @@ private static PathInterpolator createEmphasizedComplement() {
* 1 by upperBound.
*/
public static Interpolator clampToProgress(Interpolator interpolator, float lowerBound,
float upperBound) {
float upperBound) {
if (upperBound < lowerBound) {
throw new IllegalArgumentException(
String.format("upperBound (%f) must be greater than lowerBound (%f)",
upperBound, lowerBound));
String.format("upperBound (%f) must be greater than lowerBound (%f)",
upperBound, lowerBound));
}
return t -> clampToProgress(interpolator, t, lowerBound, upperBound);
}
Expand All @@ -367,11 +367,11 @@ public static Interpolator clampToProgress(Interpolator interpolator, float lowe
* interpolator.
*/
public static float clampToProgress(
Interpolator interpolator, float progress, float lowerBound, float upperBound) {
Interpolator interpolator, float progress, float lowerBound, float upperBound) {
if (upperBound < lowerBound) {
throw new IllegalArgumentException(
String.format("upperBound (%f) must be greater than lowerBound (%f)",
upperBound, lowerBound));
String.format("upperBound (%f) must be greater than lowerBound (%f)",
upperBound, lowerBound));
}

if (progress == lowerBound && progress == upperBound) {
Expand Down Expand Up @@ -404,7 +404,7 @@ private static float mapRange(float value, float min, float max) {
* such as to take over a user-controlled animation when they let go.
*/
public static Interpolator mapToProgress(Interpolator interpolator, float lowerBound,
float upperBound) {
float upperBound) {
return t -> mapRange(interpolator.getInterpolation(t), lowerBound, upperBound);
}

Expand All @@ -417,4 +417,4 @@ public static Interpolator mapToProgress(Interpolator interpolator, float lowerB
public static Interpolator reverse(Interpolator interpolator) {
return t -> 1 - interpolator.getInterpolation(1 - t);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
sdk=NEWEST_SDK
shadows=com.android.app.animation.robolectric.ShadowAnimationUtils2
Loading