This file contains hidden or 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
typealias YourController = ListEditorController | |
//do not forget to rename component and module | |
//do not forget to add module to parent component | |
//do not forget to add HasControllerInjector to parent entity [Application, Activity, Controller] if not present | |
@Subcomponent(modules = [ComponentModule::class]) | |
interface RenameMeComponent : AndroidInjector<YourController> { | |
@Subcomponent.Builder | |
abstract class Builder : AndroidInjector.Builder<YourController>() |
This file contains hidden or 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
package com.tagakov.avdplayground | |
import android.animation.Animator | |
import android.animation.AnimatorSet | |
import android.animation.ValueAnimator | |
import android.os.Bundle | |
import android.os.Handler | |
import android.support.graphics.drawable.AnimatedVectorDrawableCompat | |
import android.support.v7.app.AppCompatActivity | |
import android.widget.ImageView |
This file contains hidden or 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
class StupidIterator(val source: Iterator<*>): Iterator<String> { | |
private var nextElement: Any? = null | |
init { | |
acquireNextElement() | |
} | |
private fun acquireNextElement() { | |
nextElement = if (source.hasNext()) source.next().let { if (it is Iterator<*>) StupidIterator(it) else it } else null | |
} |
This file contains hidden or 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
interface ComponentDependencies | |
inline fun <reified T : ComponentDependencies> Controller.findComponentDependencies(): T { | |
var currentController: Controller? = parentController | |
while (currentController !is HasComponentDependencies?) { | |
currentController = currentController?.parentController | |
} | |
val hasDaggerProviders = currentController ?: when { |
This file contains hidden or 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
@Reusable | |
class RxKeyboardManager(private val activity: Activity, private val mainThread: Scheduler, private val imm: InputMethodManager) { | |
val keyboardStates = Observable.create<Boolean>({ | |
val globalLayoutListener = ViewTreeObserver.OnGlobalLayoutListener { it.onNext(isKeyboardShown()) } | |
it.setCancellation { activity.window.decorView.viewTreeObserver.removeOnGlobalLayoutListener(globalLayoutListener) } | |
activity.window.decorView.viewTreeObserver.addOnGlobalLayoutListener(globalLayoutListener) | |
}, Emitter.BackpressureMode.LATEST) | |
.distinctUntilChanged() | |
.subscribeOn(mainThread) | |
.share() |
This file contains hidden or 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 android.app.Activity | |
import androidx.fragment.app.Fragment | |
import android.app.Application | |
import android.app.Service | |
import android.view.View | |
import android.view.ViewParent | |
import com.bluelinelabs.conductor.Controller | |
import dagger.MapKey | |
import dagger.Module | |
import dagger.multibindings.Multibinds |
OlderNewer