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
private class BetterApi { | |
fun login(credentials: Credentials): LoginResponse { | |
//login... | |
TODO() | |
} | |
class LoginResponse private constructor( | |
val user: User?, |
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.rxrelay.PublishRelay; | |
import com.jakewharton.rxrelay.Relay; | |
import rx.Observable; | |
public class RxBus { | |
private static final RxBus INSTANCE = new RxBus(); | |
private final Relay<Object, Object> busSubject = PublishRelay.create().toSerialized(); |
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
/** | |
* Created with Android Studio | |
* User: electrolobzik electrolobzik@gmail.com | |
* Date: 27/03/2017 | |
* Time: 22:05 | |
* | |
* Event bus implementation with RxJava and RxRelay (https://github.com/JakeWharton/RxRelay) with API similar to https://github.com/greenrobot/EventBus | |
*/ | |
class RxBus<T> { | |
var stickyEvent: T? = null |
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
public class BaseFragment extends Fragment { | |
private boolean fragmentResume=false; | |
private boolean fragmentVisible=false; | |
private boolean fragmentOnCreated=false; | |
@Override | |
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | |
super.onViewCreated(view, savedInstanceState); |
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
// Add the following to your build.gradle file | |
// implementation "android.arch.lifecycle:reactivestreams:1.0.0-beta1" | |
import android.arch.lifecycle.LifecycleOwner | |
import android.arch.lifecycle.LiveData | |
import android.arch.lifecycle.LiveDataReactiveStreams | |
import io.reactivex.Flowable | |
/** |
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.github.arekolek.diffutil | |
import android.arch.lifecycle.* | |
import android.os.Bundle | |
import android.support.v7.app.AppCompatActivity | |
import android.support.v7.util.DiffUtil | |
import android.support.v7.widget.RecyclerView | |
import android.util.Log | |
import android.view.LayoutInflater | |
import android.view.View |
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 android.content.Context | |
import android.graphics.Canvas | |
import android.graphics.Paint | |
import android.graphics.Path | |
import android.util.AttributeSet | |
import android.view.View | |
import kotlin.math.atan2 | |
import kotlin.math.cos | |
import kotlin.math.sin | |
import kotlin.math.sqrt |
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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<!-- Dark Text Color for Light Background --> | |
<color name="textDarkPrimary">#DE000000</color> <!--DE for %87 opacity--> | |
<color name="textDarkSecondary">#8A000000</color> <!--8A for %54 opacity--> | |
<color name="textDarkDisabled">#61000000</color> <!--61 for %38 opacity--> | |
<!-- White Text Color for Dark Background --> | |
<color name="textLightPrimary">#FFFFFF</color> <!--%100 opacity--> |
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
# Example of using callbacks with Python | |
# | |
# To run this code | |
# 1. Copy the content into a file called `callback.py` | |
# 2. Open Terminal and type: `python /path/to/callback.py` | |
# 3. Enter | |
def add(numbers, callback): | |
results = [] | |
for i in numbers: |
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 android.content.Context; | |
import android.graphics.Bitmap; | |
import android.graphics.BlurMaskFilter; | |
import android.graphics.BlurMaskFilter.Blur; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.Paint; | |
import android.graphics.Paint.Style; | |
import android.graphics.Rect; | |
import android.graphics.RectF; |