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
data class SimpleDemoState(val listing: Async<Listing> = Uninitialized) | |
class SimpleDemoViewModel(override val initialState: SimpleDemoState) : MvRxViewModel<SimpleDemoState>() { | |
init { | |
fetchListing() | |
} | |
private fun fetchListing() { | |
// This automatically fires off a request and maps its response to Async<Listing> | |
// which is a sealed class and can be: Unitialized, Loading, Success, and Fail. |
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 kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.Job | |
import kotlinx.coroutines.ObsoleteCoroutinesApi | |
import kotlinx.coroutines.channels.actor | |
import kotlinx.coroutines.isActive | |
import kotlinx.coroutines.sync.Mutex | |
import kotlinx.coroutines.sync.withLock | |
import kotlin.coroutines.CoroutineContext | |
interface ActorState<T : Any> : CoroutineScope { |
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
package com.estate.mrnx.tb.custom.refresharticle; | |
import android.support.v7.widget.GridLayoutManager; | |
import android.support.v7.widget.LinearLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
import android.support.v7.widget.StaggeredGridLayoutManager; | |
public abstract class EndlessRecyclerScrollListener extends RecyclerView.OnScrollListener { | |
// The minimum amount of items to have below your current scroll position | |
// before loading more. |
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
/* Copyright 2019 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 */ | |
fun animateVisibility(view: View, visible: Boolean) { | |
val targetAlpha = if (visible) 1f else 0f | |
if (view.alpha == targetAlpha) return | |
view.visibility = View.VISIBLE | |
val spring = view.spring(SpringAnimation.ALPHA) | |
(view.getTag(R.id.tag_pending_end_listener) as? | |
DynamicAnimation.OnAnimationEndListener)?.let { |
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
[merge] | |
keepBackup = false | |
tool = custom | |
[mergetool "custom"] | |
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge "$PWD/$BASE" "$PWD/$REMOTE" "$PWD/$LOCAL" "$PWD/$MERGED" | |
keepTemporaries = false | |
trustExitCode = false | |
keepBackup = false |
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
class TestingClass { | |
fun testingFunction() { | |
for (everyday in this year 2017) { | |
// Do something with everyday | |
println(everyday.toString()) | |
} | |
} | |
private infix fun year(year: Int): DateRange { | |
return Date(year, 1, 1)..Date(year, 12, 31) |
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
/* | |
* Copyright (C) 2013 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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 rx.Observable; | |
import rx.subjects.PublishSubject; | |
import rx.subjects.SerializedSubject; | |
import rx.subjects.Subject; | |
/** | |
* Simple pass-thru event bus with error handling and reconnect. | |
*/ | |
public class EventBus { |
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
@Preview(showBackground = true, showSystemUi = true) | |
@Composable | |
fun App() { | |
Column { | |
MarxistRow { | |
Text("Left Text", Modifier.background(Color.Red)) | |
Text("Right Text", Modifier.background(Color.Blue)) | |
} | |
MarxistRow { |
OlderNewer