The fuck are you?!
This commit is contained in:
parent
7270f6027e
commit
5c51926062
1
transition/.gitignore
vendored
1
transition/.gitignore
vendored
@ -1 +0,0 @@
|
||||
/build
|
||||
@ -1,44 +0,0 @@
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
id("kotlin-android")
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk = sdk.versions.compileSdk.get().toInt()
|
||||
|
||||
defaultConfig {
|
||||
minSdk = sdk.versions.minSdk.get().toInt()
|
||||
targetSdk = sdk.versions.targetSdk.get().toInt()
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles("consumer-rules.pro")
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
namespace = "de.mm20.launcher2.transition"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.bundles.kotlin)
|
||||
implementation(libs.androidx.core)
|
||||
implementation(libs.androidx.appcompat)
|
||||
implementation(libs.androidx.cardview)
|
||||
implementation(libs.androidx.transition)
|
||||
|
||||
}
|
||||
21
transition/proguard-rules.pro
vendored
21
transition/proguard-rules.pro
vendored
@ -1,21 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.kts.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@ -1,4 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
@ -1,36 +0,0 @@
|
||||
package de.mm20.launcher2.transition
|
||||
|
||||
import android.animation.Animator
|
||||
import android.animation.ObjectAnimator
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.view.ViewGroup
|
||||
import androidx.cardview.widget.CardView
|
||||
import androidx.core.graphics.alpha
|
||||
import androidx.transition.Transition
|
||||
import androidx.transition.TransitionValues
|
||||
|
||||
class BackgroundColor : Transition() {
|
||||
override fun captureStartValues(transitionValues: TransitionValues) {
|
||||
if(transitionValues.view is CardView) return
|
||||
transitionValues.values[PROP_BG_COLOR] = (transitionValues.view.background as? ColorDrawable)?.color ?: 0
|
||||
}
|
||||
|
||||
override fun captureEndValues(transitionValues: TransitionValues) {
|
||||
if(transitionValues.view is CardView) return
|
||||
transitionValues.values[PROP_BG_COLOR] = (transitionValues.view.background as? ColorDrawable)?.color ?: 0
|
||||
}
|
||||
|
||||
override fun createAnimator(sceneRoot: ViewGroup, startValues: TransitionValues?, endValues: TransitionValues?): Animator? {
|
||||
if (startValues == null || endValues == null || endValues.view == null) return null
|
||||
var startColor = startValues.values[PROP_BG_COLOR] as? Int ?: return null
|
||||
var endColor = endValues.values[PROP_BG_COLOR] as? Int ?: return null
|
||||
//If end color is transparent, match it with stat color so it doesn't fade to black
|
||||
if(startColor.alpha == 0) startColor = endColor and 0x00FFFFFF
|
||||
if(endColor.alpha == 0) endColor = startColor and 0x00FFFFFF
|
||||
return ObjectAnimator.ofArgb(endValues.view, "backgroundColor", startColor, endColor)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val PROP_BG_COLOR = "mm20:app:backgroundColor"
|
||||
}
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
package de.mm20.launcher2.transition
|
||||
|
||||
import android.animation.Animator
|
||||
import android.animation.ObjectAnimator
|
||||
import androidx.transition.Transition
|
||||
import androidx.transition.TransitionValues
|
||||
import android.view.ViewGroup
|
||||
import androidx.cardview.widget.CardView
|
||||
|
||||
class CardCorners : Transition() {
|
||||
override fun captureStartValues(transitionValues: TransitionValues) {
|
||||
if (transitionValues.view is CardView) {
|
||||
transitionValues.values[PROP_CARD_RADIUS] = (transitionValues.view as CardView).radius
|
||||
}
|
||||
}
|
||||
|
||||
override fun captureEndValues(transitionValues: TransitionValues) {
|
||||
if (transitionValues.view is CardView) {
|
||||
transitionValues.values[PROP_CARD_RADIUS] = (transitionValues.view as CardView).radius
|
||||
}
|
||||
}
|
||||
|
||||
override fun createAnimator(sceneRoot: ViewGroup, startValues: TransitionValues?, endValues: TransitionValues?): Animator? {
|
||||
if (startValues == null || endValues == null) return null
|
||||
val startRadius = startValues.values[PROP_CARD_RADIUS] as? Float ?: return null
|
||||
val endRadius = endValues.values[PROP_CARD_RADIUS] as? Float ?: return null
|
||||
return ObjectAnimator.ofFloat(endValues.view as CardView, "radius", startRadius, endRadius)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val PROP_CARD_RADIUS = "mm20:app:cardCornerRadius"
|
||||
}
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
package de.mm20.launcher2.transition
|
||||
|
||||
import android.animation.LayoutTransition
|
||||
|
||||
class ChangingLayoutTransition: LayoutTransition() {
|
||||
init {
|
||||
enableTransitionType(CHANGING)
|
||||
}
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
package de.mm20.launcher2.transition
|
||||
|
||||
import android.animation.Animator
|
||||
import android.animation.ObjectAnimator
|
||||
import android.view.ViewGroup
|
||||
import androidx.transition.Transition
|
||||
import androidx.transition.TransitionValues
|
||||
|
||||
class Elevation : Transition() {
|
||||
override fun captureStartValues(transitionValues: TransitionValues) {
|
||||
transitionValues.values[PROP_ELEVATION] = transitionValues.view.elevation
|
||||
}
|
||||
|
||||
override fun captureEndValues(transitionValues: TransitionValues) {
|
||||
transitionValues.values[PROP_ELEVATION] = transitionValues.view.elevation
|
||||
}
|
||||
|
||||
override fun createAnimator(sceneRoot: ViewGroup, startValues: TransitionValues?, endValues: TransitionValues?): Animator? {
|
||||
if (startValues == null || endValues == null) return null
|
||||
val startElevation = startValues.values[PROP_ELEVATION] as Float
|
||||
val endElevation = endValues.values[PROP_ELEVATION] as Float
|
||||
return ObjectAnimator.ofFloat(endValues.view, "elevation", startElevation, endElevation)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val PROP_ELEVATION = "mm20:app:elevation"
|
||||
}
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
package de.mm20.launcher2.transition
|
||||
|
||||
import android.animation.LayoutTransition
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
||||
class OneShotLayoutTransition(view: ViewGroup) : LayoutTransition() {
|
||||
init {
|
||||
enableTransitionType(CHANGING)
|
||||
addTransitionListener(object: TransitionListener{
|
||||
override fun startTransition(p0: LayoutTransition?, p1: ViewGroup?, p2: View?, p3: Int) {
|
||||
}
|
||||
|
||||
override fun endTransition(p0: LayoutTransition?, p1: ViewGroup?, p2: View?, p3: Int) {
|
||||
removeTransitionListener(this)
|
||||
view.layoutTransition = null
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
companion object {
|
||||
fun run(view: ViewGroup) {
|
||||
view.layoutTransition = OneShotLayoutTransition(view)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user