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
@JsonTypeInfo( | |
use = JsonTypeInfo.Id.NAME, | |
include = JsonTypeInfo.As.EXISTING_PROPERTY, | |
property = "type" // Field where type information is stored | |
) | |
@JsonSubTypes( | |
JsonSubTypes.Type(TextItem::class, name = Item.TYPE_TEXT), | |
JsonSubTypes.Type(PhotoItem::class, name = Item.TYPE_PHOTO), | |
JsonSubTypes.Type(VideoItem::class, name = Item.TYPE_VIDEO) | |
) |
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
# TLP with newer kernel (4.16+) tends to autosuspend USB bluetooth devices. | |
# To work this around, teak tlp settings (set USB_BLACKLIST_BTUSB=1) | |
$ nano /etc/default/tlp | |
(...) | |
# Bluetooth devices are excluded from USB autosuspend: | |
# 0=do not exclude, 1=exclude. | |
USB_BLACKLIST_BTUSB=1 | |
(...) |
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 de.jskierbi.commons.ui | |
import android.content.Context | |
import android.util.AttributeSet | |
import android.view.ViewGroup | |
import de.neofonie.meinwerder.R | |
/** | |
* Created by jakub on 10.10.17. | |
*/ |
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
// For Jackson polymorphism see: | |
// https://stackoverflow.com/questions/30362446/deserialize-json-with-jackson-into-polymorphic-types-a-complete-example-is-giv | |
@JsonTypeInfo( | |
use = JsonTypeInfo.Id.NAME, | |
include = JsonTypeInfo.As.EXISTING_PROPERTY, | |
property = "type" // Field where type information is stored | |
) | |
@JsonSubTypes( | |
JsonSubTypes.Type(TextItem::class, name = Item.TYPE_TEXT), | |
JsonSubTypes.Type(PhotoItem::class, name = Item.TYPE_PHOTO), |
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.jskierbi.autodisposable | |
import android.arch.lifecycle.Lifecycle | |
import android.arch.lifecycle.Lifecycle.Event.* | |
import android.arch.lifecycle.LifecycleObserver | |
import android.arch.lifecycle.LifecycleOwner | |
import android.arch.lifecycle.OnLifecycleEvent | |
import io.reactivex.disposables.Disposable | |
import io.reactivex.disposables.Disposables | |
import kotlin.properties.ReadWriteProperty |
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 com.jakewharton.rxrelay2.PublishRelay | |
import io.reactivex.Observable | |
/** | |
* EventBus implementation (pub-sub pattern). Enables posting and subscribing to any events. | |
* http://blog.kaush.co/2014/12/24/implementing-an-event-bus-with-rxjava-rxbus/ | |
* | |
* [post] method is shorthand for posting events to a bus | |
* [subscribe] method is shorthand for listening for specific type of events on main thread | |
* [observable] property exposes raw observable with events to enable custom operator usage |
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
// https://kotlinlang.org/docs/reference/generics.html | |
// The Existential Transformation: Consumer in, Producer out! :-) | |
// Covariance (producer) | |
val covariantList: List<out Animal> = listOf<Lion>() // In Java: List<? extends Animal> | |
val animal: Animal = covariantList.get(0) // Ok | |
covariantList.put(Animal()) // Compilation error - compiler doesn't know exact | |
// type of covariantList and is not sure if | |
// it can store Animal (not all animals are lions) |
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.jskierbi.simplerx; | |
import android.app.Dialog; | |
import android.os.Bundle; | |
import android.support.v7.app.AlertDialog; | |
import android.support.v7.app.AppCompatActivity; | |
import android.util.Log; | |
import android.view.View; | |
import android.widget.TextView; | |
import android.widget.Toast; |
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 net.slideshare.mobile.test.util; | |
import android.app.Activity; | |
import android.content.pm.ActivityInfo; | |
import android.support.test.espresso.UiController; | |
import android.support.test.espresso.ViewAction; | |
import android.support.test.internal.runner.lifecycle.ActivityLifecycleMonitorRegistry; | |
import android.support.test.runner.lifecycle.Stage; | |
import android.view.View; |
NewerOlder