-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Zhirkevich Alexander Y
authored and
Zhirkevich Alexander Y
committed
Jul 26, 2024
1 parent
aeff2bf
commit e5214d5
Showing
33 changed files
with
349 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...alexzhirkevich/compottie/internal/animation/expressions/operations/LazyConstExpression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.github.alexzhirkevich.compottie.internal.animation.expressions.operations | ||
|
||
import io.github.alexzhirkevich.compottie.internal.AnimationState | ||
import io.github.alexzhirkevich.compottie.internal.animation.RawProperty | ||
import io.github.alexzhirkevich.compottie.internal.animation.expressions.EvaluationContext | ||
import io.github.alexzhirkevich.compottie.internal.animation.expressions.Expression | ||
|
||
internal class LazyConstExpression( | ||
val init: Expression | ||
) : Expression { | ||
|
||
private var value : Any? = null | ||
private var initialized : Boolean = false | ||
|
||
override fun invoke( | ||
property: RawProperty<Any>, | ||
context: EvaluationContext, | ||
state: AnimationState | ||
): Any { | ||
if (initialized){ | ||
return value!! | ||
} | ||
|
||
value = init(property, context, state) | ||
initialized = true | ||
return value!! | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...in/io/github/alexzhirkevich/compottie/internal/animation/expressions/operations/Object.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//package io.github.alexzhirkevich.compottie.internal.animation.expressions.operations | ||
// | ||
//import io.github.alexzhirkevich.compottie.internal.AnimationState | ||
//import io.github.alexzhirkevich.compottie.internal.animation.RawProperty | ||
//import io.github.alexzhirkevich.compottie.internal.animation.expressions.EvaluationContext | ||
//import io.github.alexzhirkevich.compottie.internal.animation.expressions.Expression | ||
//import io.github.alexzhirkevich.compottie.internal.animation.expressions.ExpressionContext | ||
//import io.github.alexzhirkevich.compottie.internal.animation.expressions.Undefined | ||
// | ||
//internal class Object( | ||
// private val properties : Map<String, LazyConstExpression> | ||
//) : ExpressionContext<Any> { | ||
// | ||
// private val obj = mutableMapOf<String, Any?>() | ||
// | ||
// override fun interpret(callable: String?, args: List<Expression>?): Expression? { | ||
// return when { | ||
// callable == null -> null | ||
// args == null -> field(callable) | ||
// else -> func(callable, args) | ||
// } | ||
// } | ||
// | ||
// override fun invoke( | ||
// property: RawProperty<Any>, | ||
// context: EvaluationContext, | ||
// state: AnimationState | ||
// ): Any = this | ||
// | ||
// private fun field(name: String): Expression { | ||
// return Expression { _, _, _ -> obj[name] ?: Undefined } | ||
// } | ||
// | ||
// private fun func(name: String, args: List<Expression>): Expression { | ||
// return Expression { property, context, state -> | ||
// obj[name] | ||
// } | ||
// } | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.