Merge branch 'master' into new_storable
This commit is contained in:
commit
3848be4035
|
|
@ -158,11 +158,15 @@ public class BaseLifecycleBindable implements LifecycleBindable {
|
|||
@NonNull final Action1<T> onNextAction,
|
||||
@NonNull final Action1<Throwable> onErrorAction,
|
||||
@NonNull final Action0 onCompletedAction) {
|
||||
final Observable<T> actualObservable;
|
||||
if (onNextAction == Actions.empty() && onErrorAction == (Action1) Actions.empty() && onCompletedAction == Actions.empty()) {
|
||||
actualObservable = observable.doOnCompleted(onCompletedAction);
|
||||
} else {
|
||||
actualObservable = observable.observeOn(AndroidSchedulers.mainThread()).doOnCompleted(onCompletedAction);
|
||||
}
|
||||
|
||||
return isCreatedSubject.first()
|
||||
.switchMap(created -> created
|
||||
? observable.observeOn(AndroidSchedulers.mainThread()).doOnCompleted(onCompletedAction)
|
||||
: Observable.empty())
|
||||
//TODO: basically takeUntil is calling completed so investigate observable = ***.first() behavior and doOnCompleted also
|
||||
.switchMap(created -> created ? actualObservable : Observable.empty())
|
||||
.takeUntil(conditionSubject.filter(condition -> condition))
|
||||
.subscribe(onNextAction, throwable -> {
|
||||
final boolean isRxError = throwable instanceof OnErrorThrowable;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import android.support.annotation.NonNull;
|
|||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.AppCompatEditText;
|
||||
import android.text.Editable;
|
||||
import android.text.InputType;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.method.SingleLineTransformationMethod;
|
||||
|
|
@ -160,6 +161,12 @@ public class TypefacedEditText extends AppCompatEditText {
|
|||
"textSize required parameter. If it's dynamic then use '0sp'");
|
||||
AttributesUtils.checkAttribute(typedArray, errors, AttributesUtils.getField(androidRes, "TextView_inputType"), true,
|
||||
"inputType required parameter");
|
||||
|
||||
final int inputType = typedArray.getInt(AttributesUtils.getField(androidRes, "TextView_inputType"), -1);
|
||||
if (AttributesUtils.isNumberInputType(inputType)) {
|
||||
errors.add("use inputType phone instead of number");
|
||||
}
|
||||
|
||||
AttributesUtils.checkAttribute(typedArray, errors, AttributesUtils.getField(androidRes, "TextView_imeOptions"), true,
|
||||
"imeOptions required parameter");
|
||||
}
|
||||
|
|
@ -299,6 +306,17 @@ public class TypefacedEditText extends AppCompatEditText {
|
|||
Lc.assertion(new IllegalStateException(AttributesUtils.viewError(this, "Do not specify ellipsize for EditText")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInputType(final int type) {
|
||||
if (AttributesUtils.isNumberInputType(type)) {
|
||||
Lc.assertion(new IllegalStateException(AttributesUtils.viewError(this,
|
||||
"Do not specify number InputType for EditText, use phone instead")));
|
||||
super.setInputType(InputType.TYPE_CLASS_PHONE);
|
||||
return;
|
||||
}
|
||||
super.setInputType(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets typeface from 'assets/fonts' folder by name.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import android.content.Context;
|
|||
import android.content.res.TypedArray;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.StyleableRes;
|
||||
import android.text.InputType;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
|
@ -149,6 +150,16 @@ public final class AttributesUtils {
|
|||
return "Errors for view id=" + UiUtils.OfViews.getViewIdString(view) + ":\n" + errorText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if input type equals number input type.
|
||||
*
|
||||
* @param inputType Input type to check;
|
||||
* @return true if input type equals number input type.
|
||||
*/
|
||||
public static boolean isNumberInputType(final int inputType) {
|
||||
return inputType == InputType.TYPE_CLASS_NUMBER || inputType == InputType.TYPE_DATETIME_VARIATION_NORMAL;
|
||||
}
|
||||
|
||||
private AttributesUtils() {
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue