Skip to content

Instantly share code, notes, and snippets.

View ekursakov's full-sized avatar

Evgeny Kursakov ekursakov

View GitHub Profile

Multiple modules

In order to add support for multiple modules:

  1. Add moxy-compiler dependency to each module that uses Moxy.
  2. In each library/subproject that uses a Moxy, you must add an annotation processor argument moxyReflectorPackage.
    For built-in annotationProcessor from gradle android plugin 2.2+:
    android {
        ...
        defaultConfig {
import com.arellomobile.mvp.MvpView
import com.arellomobile.mvp.viewstate.ViewCommand
import com.arellomobile.mvp.viewstate.strategy.StateStrategy
class AddToEndSingleWithTagStrategy : StateStrategy {
override fun <View : MvpView> beforeApply(currentState: MutableList<ViewCommand<View>>,
incomingCommand: ViewCommand<View>) {
val iterator = currentState.iterator()
import android.content.SharedPreferences
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
fun SharedPreferences.boolProperty(key: String, defaultValue: Boolean)
= preferenceProperty(this, { getBoolean(key, defaultValue) }, { putBoolean(key, it) })
fun SharedPreferences.floatProperty(key: String, defaultValue: Float)
= preferenceProperty(this, { getFloat(key, defaultValue) }, { putFloat(key, it) })
@ekursakov
ekursakov / PhoneEditText.java
Last active April 29, 2016 18:35
EditText with masked input for russian (+7) phone numbers
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.View;
import android.widget.EditText;
public class PhoneEditText extends EditText implements TextWatcher, View.OnFocusChangeListener {
private static final String PATTERN_NOT_NUMBERS = "[^0-9]*";
@ekursakov
ekursakov / .travis.yml
Last active May 19, 2016 12:32
Config with Coveralls
sudo: required
notifications:
email: false
language: cpp
os:
- linux