Results of some experiments to determine which Activity lifecycle methods get called in certain situations.
Launch:
- activity.onCreate()
- activity.onStart()
- activity.onResume()
- activity.onWindowFocusChanged(true)
public void start () | |
Starts the currently pending property animations immediately. Calling start() is optional because all animations start automatically at the next opportunity. However, if the animations are needed to start immediately and synchronously (not at the time when the next event is processed by the hierarchy, which is when the animations would begin otherwise), then this method can be used. | |
Source | |
The only difference is that with start it starts immediately. |
package your.project.view.helper; | |
import android.databinding.BindingAdapter; | |
import android.graphics.drawable.Drawable; | |
import android.support.annotation.ColorInt; | |
import android.support.annotation.DrawableRes; | |
import android.support.annotation.Nullable; | |
import android.support.v4.content.ContextCompat; | |
import android.support.v4.widget.SwipeRefreshLayout; | |
import android.text.TextUtils; |
@Keep | |
internal class LoggingHandler : AbstractCoroutineContextElement(CoroutineExceptionHandler), | |
CoroutineExceptionHandler { | |
override fun handleException(context: CoroutineContext, exception: Throwable) { | |
Crashlytics.logException(exception) | |
// Since we don't want to crash and Coroutines will call the current thread's handler, we | |
// install a noop handler and then reinstall the existing one once coroutines calls the new | |
// handler. | |
Thread.currentThread().apply { |
public suspend inline fun <T : Closeable?, R> T.useCancellably( | |
crossinline block: (T) -> R | |
): R = suspendCancellableCoroutine { cont -> | |
cont.invokeOnCancellation { this?.close() } | |
cont.resume(use(block)) | |
} |
suspend fun <T> Task<T>.await(): T { | |
if (isComplete) return if (isSuccessful) result else throw exception!! | |
return suspendCoroutine { c: Continuation<T> -> | |
addOnSuccessListener { c.resume(it) } | |
addOnFailureListener { c.resumeWithException(it) } | |
} | |
} | |
fun <T> Deferred<T>.asTask(): Task<T> { | |
val source = TaskCompletionSource<T>() |
中央六套1080p版本,有图标(不喜勿下) | |
辽沈战役 | |
magnet:?xt=urn:btih:44B9E52EB7C80F2C86301E37EC3D3D4EC5A6D70E&dn=%E5%A4%A7%E5%86%B3%E6%88%98%20-%20%E8%BE%BD%E6%B2%88%E6%88%98%E5%BD%B9.1990.1080p.mkv | |
平津战役 | |
magnet:?xt=urn:btih:7B7BA58AC94A1172402935266BBF226B4F270769&dn=%E5%A4%A7%E5%86%B3%E6%88%98%EF%BC%8D%E5%B9%B3%E6%B4%A5%E6%88%98%E5%BD%B9.1992.1080p.mkv | |
淮海战役 | |
magnet:?xt=urn:btih:DA1B57C4E3F2ADE990282C813EFF0923AC04EDF7&dn=%E5%A4%A7%E5%86%B3%E6%88%98%EF%BC%8D%E6%B7%AE%E6%B5%B7%E6%88%98%E5%BD%B9.1991.1080p.mkv |
apply from: rootProject.file('gradle/install-git-hooks.gradle') |
sealed class Either<out L, out R> { | |
data class Left<out L>(val l: L) : Either<L, Nothing>() | |
data class Right<out R>(val r: R) : Either<Nothing, R>() | |
} | |
fun asdf() { | |
val p = Promise<Int> { resolve, reject -> | |
resolve(Either.Left(4)) | |
} |
class MenuViewModel { | |
val coffeeList: LiveData<List<Coffee>> = liveData(context = viewModelScope.coroutineContext + Dispatchers.IO) { | |
// if the data needs to be processed before displaying, | |
// this is where I usually do it | |
menuRepo.menu.collect(::emit) | |
} | |
} | |
class MenuRepository { | |
private val menuChannel = BroadcastChannel<List<Coffee>>(CONFLATED) |