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
| /** | |
| * Applies the latest result of `scan` to each item received in order to emit a new result (which is then provided to the next `scan` item). | |
| * | |
| * So, given an initial seed of 10 and the function `{ previous, input -> previous + input }`, we will get the following outputs for the specified inputs: | |
| * In -> Out | |
| * 1 -> 11 | |
| * 6 -> 17 | |
| * 1 -> 18 | |
| * 2 -> 20 | |
| * |
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.view.View | |
| import androidx.annotation.CallSuper | |
| import androidx.annotation.LayoutRes | |
| import com.airbnb.epoxy.EpoxyModel | |
| /** | |
| * Represents a `EpoxyRecyclerView` item model. | |
| * This class allows us to use epoxy models with Kotlin without needing annotation processing or code generation. | |
| */ | |
| abstract class KotlinEpoxyModel( |
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 java.util.concurrent.atomic.AtomicBoolean | |
| /** | |
| * Wraps some data that should track when it has been viewed and allow future viewers to avoid a second showing. | |
| * Useful for showing messages in the app that auto-hide because this class can exist in the app's state. | |
| */ | |
| data class ViewOnceData<T>(private val data: T) { | |
| val wasViewed = AtomicBoolean(false) | |
| /** |
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.content.Context; | |
| import android.content.Intent; | |
| import android.os.Bundle; | |
| import android.support.annotation.NonNull; | |
| import android.support.annotation.Nullable; | |
| import android.support.v7.app.AppCompatActivity; | |
| import com.mywebgrocer.util.ActivityResultData; | |
| import java.util.Random; |
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 Barker : NoiseMaker { | |
| override fun makeSound() { | |
| println("Bark!") | |
| } | |
| } |
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.content.Context | |
| import android.content.SharedPreferences | |
| import kotlin.reflect.KProperty | |
| /** | |
| * Represents a single [SharedPreferences] file. | |
| * | |
| * Usage: | |
| * | |
| * ```kotlin |
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.databinding.ObservableArrayList; | |
| import android.databinding.ObservableList; | |
| import com.jakewharton.rxrelay.PublishRelay; | |
| import java.util.List; | |
| import rx.Observable; | |
| /** |
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
| public void onCreate() { | |
| // Http client | |
| OkHttpClient client = new OkHttpClient(); | |
| // Content type | |
| MediaType JSON = MediaType.parse("application/json; charset=utf-8"); | |
| // Whatever you want to send, here it's json | |
| RequestBody body = RequestBody.create(JSON, yourJsonString); |
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.thunderclouddev.changelogs.ui | |
| import android.content.Context | |
| import android.os.Bundle | |
| import android.support.annotation.LayoutRes | |
| import android.support.annotation.StyleRes | |
| import android.support.v7.app.AppCompatActivity | |
| import com.thunderclouddev.changelogs.BaseApplication | |
| import com.thunderclouddev.changelogs.R | |
| import com.thunderclouddev.changelogs.configuration.LanguagePreference |