Skip to content

Instantly share code, notes, and snippets.

Nikita Belokopytov n-belokopytov

  • Berlin
Block or report user

Report or block n-belokopytov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@n-belokopytov
n-belokopytov / copyDeps.gradle
Last active May 22, 2019
Gradle script that generates a task to copy all build variant's dependencies to a certain directory for use with Nexus IQ Server. It copies exploded AARs too, renaming the classes.jar file into "<aar_dependency_name>.jar".
View copyDeps.gradle
apply plugin: 'com.android.application'
android.applicationVariants.all { variant ->
task "copyDependencies${variant.name.capitalize()}"() {
outputs.upToDateWhen { false }
doLast {
println "Executing copyDependencies${variant.name.capitalize()}"
variant.getCompileClasspath().each { fileDependency ->
def sourcePath = fileDependency.absolutePath
def destinationPath = project.projectDir.path + "/build/dependencies/${variant.name}/"
@n-belokopytov
n-belokopytov / TabbedListState.kt
Created Apr 16, 2018
A state object implemented with Kotlin's sealed classes
View TabbedListState.kt
sealed class TabbedListState
class InProgressState : TabbedListState()
class FinishedState : TabbedListState()
data class ErrorState(val errorMessage: String,
val errorColor: Int) : TabbedListState()
data class ListState(val listElements: List<Element>,
val totalItems: Int,
val currentTabId: Int,
val tabs: List<TabElement>) : TabbedListState()
data class OfflineState(val listElements: List<Element>) : TabbedListState()
@n-belokopytov
n-belokopytov / TabbedListActivity.kt
Created Apr 16, 2018
State Machine in View with a Sealed Class from Kotlin
View TabbedListActivity.kt
override fun onStart() {
viewModel.tabbedListLiveData.observe(this, Observer {
when (it) {
is ErrorState -> {
showProgress(false)
showErrorView(it.errorMessage, it.errorColor)
}
is InProgressState -> showProgress(true)
is OfflineState -> {
You can’t perform that action at this time.