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
import com.google.common.graph.Graphs | |
import com.google.common.graph.MutableValueGraph | |
import com.google.common.graph.ValueGraphBuilder | |
import org.gradle.api.DefaultTask | |
import org.gradle.api.Project | |
import org.gradle.api.artifacts.Configuration | |
import org.gradle.api.artifacts.ProjectDependency | |
import org.gradle.api.tasks.Input | |
import org.gradle.api.tasks.TaskAction | |
import org.gradle.api.tasks.options.Option |
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
tasks.register("dependencyGraph") { | |
description = "Generate dependency graph json" | |
doLast { | |
def dependencyGraph = subprojects | |
.collect { project -> | |
[ | |
"project" : project.path, | |
"dependencies": project.configurations | |
.collectMany { config -> | |
config |
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
tasks.register("collectClasses") { | |
subprojects { | |
dependsOn tasks.withType(JavaCompile) | |
dependsOn tasks.withType(KotlinJvmCompile) | |
} | |
doLast { | |
subprojects { | |
(tasks.withType(JavaCompile) + tasks.withType(KotlinJvmCompile)).forEach { compile -> | |
compile.destinationDirectory | |
.getAsFileTree() |
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
subprojects { | |
afterEvaluate { | |
def hasKotlinAndroidSourceSet = extensions.findByType(org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension) | |
?.sourceSets?.findByName("test")?.kotlin?.files?.size() != 0 | |
def hasKotlinSourceSet = extensions.findByType(org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension) | |
?.sourceSets?.findByName("test")?.kotlin?.files?.size() != 0 | |
if (!hasKotlinAndroidSourceSet && !hasKotlinSourceSet) { | |
tasks.configureEach { | |
if (name.contains("Test")) { |
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
def validateIdeBuilds = tasks.register("validateIdeBuilds") { | |
doLast { | |
if (project.hasProperty("android.injected.invoked.from.ide")) { | |
def buildCommand = "./gradlew " + gradle.startParameter.taskNames.join(" ") | |
exec { | |
commandLine("sh", "-c", "echo \"$buildCommand\" | pbcopy") | |
} | |
throw new RuntimeException( | |
"Please avoid building from IDE and use commandLine instead." + | |
"The command has been copied to your clipboard" |
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
val AppCompatActivity.hasSourceBounds: Boolean get() = intent?.sourceBounds != null | |
fun AppCompatActivity.sourceBounds(boundsAction: (Rect) -> Unit) { | |
intent?.sourceBounds?.let(boundsAction) | |
} | |
/** | |
* Disables upcoming transition when [hasSourceBounds] is true. Should be called before [AppCompatActivity.onCreate] | |
*/ | |
fun AppCompatActivity.preAnimationSetup() { |
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
@file:Suppress("NOTHING_TO_INLINE") | |
import android.content.Context | |
import androidx.annotation.StringRes | |
import androidx.fragment.app.Fragment | |
import androidx.preference.* | |
/** | |
* DSL marker for restricting access scope when [PreferencesBuilder.preference] is nested. | |
*/ |
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
rootLayout.prepareTransition { | |
moveResize { | |
+image1 // Using + operator to add targets | |
} | |
fade { | |
+text | |
} | |
} | |
text.isGone = true // Layout changes |
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
constraintLayout.prepareTransition { | |
customTransition<ChangeCardColor> { | |
+colorChangeCardView | |
} | |
} |
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
rootCoordinatorLayout.prepareTransition { | |
onStart { | |
// Started! | |
} | |
moveResize { | |
+image1 | |
} | |
onEnd { | |
// I am done :) | |
} |
NewerOlder