Compare commits

...

15 Commits

Author SHA1 Message Date
Oleg d08b7df5f0
UnusedImports fix (#112) 2018-11-28 17:17:14 +03:00
Oleg 333cb3fa64
TaskDescription fix (#111) 2018-11-28 16:54:29 +03:00
Denis Karmyshakov 098db7d2e3 Enum serialization (#103) 2018-02-09 15:03:30 +03:00
Anton Domnikov e1eed0c37f fixed parsing when date is empty (#101) 2018-02-02 17:13:42 +03:00
Denis Karmyshakov de538e14ba Gradle update (#97)
* Gradle update

* Excluding apache.httpcomponents
2017-11-20 19:19:53 +03:00
Denis Karmyshakov 054b62424c Merge pull request #93 from TouchInstinct/versions_in_constants
Versions in constants
2017-10-04 13:12:12 +03:00
Denis Karmyshakov a863285016 Versions in constants 2017-10-04 13:05:39 +03:00
nbnbbs 8383a41bca upd google-http-client-jackson2 (#91) 2017-10-03 03:32:28 -07:00
Ilia Kurtov b6d90da359 Merge pull request #86 from TouchInstinct/lib_update
rxjava version
2017-09-15 16:18:40 +03:00
gorodeckii f66d85c9c6 rxjava version 2017-09-15 15:18:45 +03:00
Gavriil 4049f4e458 RxJava version update (#85) 2017-09-11 18:51:10 +03:00
Arseniy Borisov dc2b9ef3ff idea formatter (#84) 2017-09-04 17:36:34 +03:00
Ilia Kurtov 20a9597c35 Feature/chat merge (#80) 2017-08-11 12:14:13 +03:00
Ilia Kurtov f7f98f0106 fresco update (#79) 2017-08-10 18:39:05 +03:00
nbnbbs 2dbe8a45e3 update libs (#73) 2017-08-09 16:24:20 +03:00
16 changed files with 108 additions and 42 deletions

View File

@ -1,9 +1,7 @@
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
apply plugin: 'me.tatarka.retrolambda'
android { android {
compileSdkVersion 25 compileSdkVersion compileSdk
buildToolsVersion "25.0.3"
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
@ -17,37 +15,40 @@ android {
repositories { repositories {
maven { url 'https://maven.fabric.io/public' } maven { url 'https://maven.fabric.io/public' }
maven { url "http://dl.bintray.com/touchin/touchin-tools" }
} }
dependencies { dependencies {
compile project(path: ':libraries:components') api project(path: ':libraries:components')
compile 'net.danlew:android.joda:2.9.9' api 'net.danlew:android.joda:2.9.9'
compile 'com.android.support:multidex:1.0.1' api 'com.android.support:multidex:1.0.2'
compile 'io.reactivex:rxandroid:1.2.1' api "io.reactivex:rxandroid:$rxAndroidVersion"
compile 'io.reactivex:rxjava:1.3.0' api "io.reactivex:rxjava:$rxJavaVersion"
provided 'com.android.support:appcompat-v7:25.3.1' compileOnly "com.android.support:appcompat-v7:$supportLibraryVersion"
provided 'com.android.support:recyclerview-v7:25.3.1' compileOnly "com.android.support:recyclerview-v7:$supportLibraryVersion"
provided 'com.squareup.retrofit2:retrofit:2.3.0' compileOnly 'com.squareup.retrofit2:retrofit:2.3.0'
provided('com.google.http-client:google-http-client-jackson2:1.22.0') { compileOnly('com.google.http-client:google-http-client-jackson2:1.23.0') {
exclude(group: 'org.apache.httpcomponents', module: 'httpclient') exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
} }
provided 'com.facebook.fresco:fresco:1.3.0' compileOnly 'com.facebook.fresco:fresco:1.5.0'
provided 'com.bluelinelabs:logansquare:1.3.7' compileOnly 'ru.touchin:logansquare:1.4.1'
provided 'com.scottyab:aes-crypto:0.0.4' compileOnly 'com.scottyab:aes-crypto:0.0.4'
provided('io.socket:socket.io-client:0.9.0') { // don't use latest(1.0 and above) because they don't support Socket.IO server 1.x version
//noinspection NewerVersionAvailable
compileOnly('io.socket:socket.io-client:0.9.0') {
exclude group: 'org.json', module: 'json' exclude group: 'org.json', module: 'json'
} }
provided('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') { compileOnly('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true; transitive = true
} }
provided 'com.facebook.stetho:stetho:1.5.0' compileOnly 'com.facebook.stetho:stetho:1.5.0'
} }

View File

@ -21,7 +21,7 @@ package ru.touchin.templates;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.content.Intent; import android.content.Intent;
import android.graphics.drawable.BitmapDrawable; import android.graphics.BitmapFactory;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.ColorRes; import android.support.annotation.ColorRes;
@ -62,9 +62,14 @@ public abstract class TouchinActivity<TLogic extends Logic> extends ViewControll
* @param primaryColorRes Color of application to show in task bar. * @param primaryColorRes Color of application to show in task bar.
*/ */
protected void setupTaskDescriptor(@NonNull final String label, @DrawableRes final int iconRes, @ColorRes final int primaryColorRes) { protected void setupTaskDescriptor(@NonNull final String label, @DrawableRes final int iconRes, @ColorRes final int primaryColorRes) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
final ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription(label, final ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription(label,
((BitmapDrawable) ContextCompat.getDrawable(this, iconRes)).getBitmap(), iconRes,
ContextCompat.getColor(this, primaryColorRes));
setTaskDescription(taskDescription);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
final ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription(label,
BitmapFactory.decodeResource(getResources(), iconRes),
ContextCompat.getColor(this, primaryColorRes)); ContextCompat.getColor(this, primaryColorRes));
setTaskDescription(taskDescription); setTaskDescription(taskDescription);
} }

View File

@ -59,7 +59,7 @@ public final class CalendarUtils {
* @param calendarItems List of {@link CalendarItem} where need to find specific element; * @param calendarItems List of {@link CalendarItem} where need to find specific element;
* @param position Position of adapter; * @param position Position of adapter;
* @return Position of Header that respond to requested position. * @return Position of Header that respond to requested position.
* Returns null if Header or related CalendarItem was not found for specified position. * Returns null if Header or related CalendarItem was not found for specified position.
*/ */
@Nullable @Nullable
public static Integer findPositionOfSelectedMonth(@NonNull final List<CalendarItem> calendarItems, final long position) { public static Integer findPositionOfSelectedMonth(@NonNull final List<CalendarItem> calendarItems, final long position) {
@ -76,7 +76,7 @@ public final class CalendarUtils {
* @param calendarItems List of {@link CalendarItem} where need to find specific element; * @param calendarItems List of {@link CalendarItem} where need to find specific element;
* @param date Requested date in milliseconds. * @param date Requested date in milliseconds.
* @return Position of Calendar cell that that has specific date. * @return Position of Calendar cell that that has specific date.
* Returns null if CalendarItem was not found for specified position. * Returns null if CalendarItem was not found for specified position.
*/ */
@Nullable @Nullable
public static Integer findPositionByDate(@NonNull final List<CalendarItem> calendarItems, final long date) { public static Integer findPositionByDate(@NonNull final List<CalendarItem> calendarItems, final long date) {

View File

@ -168,6 +168,14 @@ public abstract class Chat<TOutgoingMessage> {
retrySendingRequest.onNext(null); retrySendingRequest.onNext(null);
} }
/**
* Method to cancel sending current message.
*/
@NonNull
public Observable<?> observeCancelEvent(@NonNull final TOutgoingMessage message) {
return Observable.never();
}
/** /**
* Deactivates chat so it will stop sending messages. * Deactivates chat so it will stop sending messages.
*/ */
@ -194,6 +202,7 @@ public abstract class Chat<TOutgoingMessage> {
.first() .first()
.switchMap(shouldSendMessage -> shouldSendMessage .switchMap(shouldSendMessage -> shouldSendMessage
? createSendMessageObservable(message).ignoreElements() : Observable.empty()) ? createSendMessageObservable(message).ignoreElements() : Observable.empty())
.takeUntil(observeCancelEvent(message))
.retryWhen(attempts -> attempts.switchMap(ignored -> { .retryWhen(attempts -> attempts.switchMap(ignored -> {
isSendingInError.onNext(true); isSendingInError.onNext(true);
return Observable return Observable

View File

@ -42,7 +42,7 @@ public class LoganSquareJodaTimeConverter implements TypeConverter<DateTime> {
@Override @Override
public DateTime parse(@NonNull final JsonParser jsonParser) throws IOException { public DateTime parse(@NonNull final JsonParser jsonParser) throws IOException {
final String dateString = jsonParser.getValueAsString(); final String dateString = jsonParser.getValueAsString();
if (dateString == null) { if (dateString == null || dateString.isEmpty()) {
return null; return null;
} }
try { try {
@ -60,9 +60,9 @@ public class LoganSquareJodaTimeConverter implements TypeConverter<DateTime> {
@NonNull final JsonGenerator jsonGenerator) @NonNull final JsonGenerator jsonGenerator)
throws IOException { throws IOException {
if (fieldName != null) { if (fieldName != null) {
jsonGenerator.writeStringField(fieldName, object != null ? object.toString() : null); jsonGenerator.writeStringField(fieldName, object != null && !object.toString().isEmpty() ? object.toString() : null);
} else { } else {
jsonGenerator.writeString(object != null ? object.toString() : null); jsonGenerator.writeString(object != null && !object.toString().isEmpty() ? object.toString() : null);
} }
} }

View File

@ -20,13 +20,15 @@
package ru.touchin.templates.logansquare; package ru.touchin.templates.logansquare;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.bluelinelabs.logansquare.ConverterUtils; import com.bluelinelabs.logansquare.ConverterUtils;
import com.bluelinelabs.logansquare.LoganSquare; import com.bluelinelabs.logansquare.LoganSquare;
import com.google.api.client.json.jackson2.JacksonFactory; import com.fasterxml.jackson.core.JsonGenerator;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.StringWriter;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType; import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type; import java.lang.reflect.Type;
@ -42,7 +44,7 @@ import ru.touchin.templates.retrofit.JsonResponseBodyConverter;
/** /**
* Created by Gavriil Sitnikov on 2/06/2016. * Created by Gavriil Sitnikov on 2/06/2016.
* LoganSquareConverter class to use with {@link Retrofit} to parse and generate models based on Google Jackson library {@link JacksonFactory}. * LoganSquareConverter class to use with {@link Retrofit} to parse and generate models based on Logan Square library.
*/ */
public class LoganSquareJsonFactory extends Converter.Factory { public class LoganSquareJsonFactory extends Converter.Factory {
@ -63,6 +65,16 @@ public class LoganSquareJsonFactory extends Converter.Factory {
return new LoganSquareRequestBodyConverter<>(); return new LoganSquareRequestBodyConverter<>();
} }
@Nullable
@Override
public Converter<?, String> stringConverter(@NonNull final Type type, @NonNull final Annotation[] annotations, @NonNull final Retrofit retrofit) {
if (type instanceof Class && ((Class) type).getSuperclass() == Enum.class) {
return new LoganSquareStringEnumConverter<>();
} else {
return super.stringConverter(type, annotations, retrofit);
}
}
public static class LoganSquareJsonResponseBodyConverter<T> extends JsonResponseBodyConverter<T> { public static class LoganSquareJsonResponseBodyConverter<T> extends JsonResponseBodyConverter<T> {
@NonNull @NonNull
@ -101,11 +113,29 @@ public class LoganSquareJsonFactory extends Converter.Factory {
public static class LoganSquareRequestBodyConverter<T> extends JsonRequestBodyConverter<T> { public static class LoganSquareRequestBodyConverter<T> extends JsonRequestBodyConverter<T> {
@Override @Override
protected void writeValueToByteArray(@NonNull final T value, @NonNull final ByteArrayOutputStream byteArrayOutputStream) protected void writeValueToByteArray(@NonNull final T value, @NonNull final ByteArrayOutputStream byteArrayOutputStream) throws IOException {
throws IOException {
LoganSquare.serialize(value, byteArrayOutputStream); LoganSquare.serialize(value, byteArrayOutputStream);
} }
} }
} public static class LoganSquareStringEnumConverter<T> implements Converter<T, String> {
@Nullable
@SuppressWarnings({"unchecked", "TryFinallyCanBeTryWithResources"})
@Override
public String convert(@NonNull final T value) throws IOException {
final StringWriter writer = new StringWriter();
try {
final JsonGenerator generator = LoganSquare.JSON_FACTORY.createGenerator(writer);
LoganSquare.typeConverterFor((Class<T>) value.getClass()).serialize(value, null, false, generator);
generator.close();
return writer.toString().replaceAll("\"", "");
} finally {
writer.close();
}
}
}
}

View File

@ -70,7 +70,7 @@ public abstract class JsonResponseBodyConverter<T> implements Converter<Response
validateCollection((Collection) result); validateCollection((Collection) result);
} }
if (result instanceof Map) { if (result instanceof Map) {
validateCollection(((Map)result).values()); validateCollection(((Map) result).values());
} }
return result; return result;

View File

@ -59,6 +59,7 @@ public class ValidationState implements Serializable {
/** /**
* Returns unique code of the {@link ValidationState}. * Returns unique code of the {@link ValidationState}.
*
* @return code or the ValidationState. * @return code or the ValidationState.
*/ */
public int getCode() { public int getCode() {
@ -67,6 +68,7 @@ public class ValidationState implements Serializable {
/** /**
* Don't forget to override this method! * Don't forget to override this method!
*
* @param object that you want to compare. * @param object that you want to compare.
* @return true if objects equals and false otherwise. * @return true if objects equals and false otherwise.
*/ */

View File

@ -38,6 +38,7 @@ public interface ViewWithError {
* Shows error * Shows error
* Pass here error state. * Pass here error state.
* It is not correct to pass here {@link ValidationState#VALID} or {@link ValidationState#INITIAL} * It is not correct to pass here {@link ValidationState#VALID} or {@link ValidationState#INITIAL}
*
* @param validationState error state. Can be other than {@link ValidationState} if you have successor of base {@link ValidationState}. * @param validationState error state. Can be other than {@link ValidationState} if you have successor of base {@link ValidationState}.
*/ */
void showError(@NonNull final ValidationState validationState); void showError(@NonNull final ValidationState validationState);

View File

@ -37,6 +37,7 @@ public class BooleanValidationController extends ValidationController<Boolean, B
/** /**
* This method validates bounded view. * This method validates bounded view.
*
* @param activatedObservable emits true when we need to show error on empty fields. Eg when user clicks on Done button but he missed some * @param activatedObservable emits true when we need to show error on empty fields. Eg when user clicks on Done button but he missed some
* necessary fields to fill. * necessary fields to fill.
* @return observable without any concrete type. Simply subscribe to this method to make it works. * @return observable without any concrete type. Simply subscribe to this method to make it works.

View File

@ -98,8 +98,7 @@ public class EditTextValidationController<TModel extends Serializable>
/** /**
* If we don't want to show error when focus is lost. * If we don't want to show error when focus is lost.
* *
* @param showErrorOnFocusOut show an error or don't show an error. * @param showErrorOnFocusOut show an error or don't show an error.
*
*/ */
public void setShowErrorOnFocusOut(final boolean showErrorOnFocusOut) { public void setShowErrorOnFocusOut(final boolean showErrorOnFocusOut) {
this.showErrorOnFocusOut = showErrorOnFocusOut; this.showErrorOnFocusOut = showErrorOnFocusOut;

View File

@ -12,7 +12,8 @@ import rx.Observable;
* Created by Ilia Kurtov on 24/01/2017. * Created by Ilia Kurtov on 24/01/2017.
* {@link ValidationController} for models that have the same modal as wrapper model. You can use it when you simply need to be sure * {@link ValidationController} for models that have the same modal as wrapper model. You can use it when you simply need to be sure
* that user have selected some item and it is not null. * that user have selected some item and it is not null.
* @param <TModel> type of the model. *
* @param <TModel> type of the model.
* @param <TValidator> corresponding {@link Validator} * @param <TValidator> corresponding {@link Validator}
*/ */
public class SimpleValidationController<TModel extends Serializable, TValidator extends Validator<TModel, TModel>> public class SimpleValidationController<TModel extends Serializable, TValidator extends Validator<TModel, TModel>>
@ -24,6 +25,7 @@ public class SimpleValidationController<TModel extends Serializable, TValidator
/** /**
* This method validates bounded view. * This method validates bounded view.
*
* @param activatedObservable emits true when we need to show error on empty fields. Eg when user clicks on Done button but he missed some * @param activatedObservable emits true when we need to show error on empty fields. Eg when user clicks on Done button but he missed some
* necessary fields to fill. * necessary fields to fill.
* @return observable without any concrete type. Simply subscribe to this method to make it works. * @return observable without any concrete type. Simply subscribe to this method to make it works.

View File

@ -53,10 +53,11 @@ public class ValidationController
/** /**
* Bind to this observable to connect view and model. If you provide first argument (viewStateObservable) - the connection would be two-way. * Bind to this observable to connect view and model. If you provide first argument (viewStateObservable) - the connection would be two-way.
* If not - one-way. This method changes updates view with current {@link ValidationState}. * If not - one-way. This method changes updates view with current {@link ValidationState}.
*
* @param viewStateObservable input view state {@link Observable}. * @param viewStateObservable input view state {@link Observable}.
* Eg it can be observable with input text from the {@link android.widget.EditText} * Eg it can be observable with input text from the {@link android.widget.EditText}
* @param updateViewAction action that updates current state of the bounded view. * @param updateViewAction action that updates current state of the bounded view.
* @param viewWithError view that implements {@link ViewWithError} interface and could reacts to the validation errors. * @param viewWithError view that implements {@link ViewWithError} interface and could reacts to the validation errors.
* @return observable without any concrete type. Simply subscribe to this method to make it works. * @return observable without any concrete type. Simply subscribe to this method to make it works.
*/ */
@NonNull @NonNull
@ -68,7 +69,7 @@ public class ValidationController
: Observable.empty(); : Observable.empty();
return Observable return Observable
.merge(getValidator().getWrapperModel().observe() .merge(getValidator().getWrapperModel().observe()
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doOnNext(updateViewAction), .doOnNext(updateViewAction),
getValidator().getValidationState().observe() getValidator().getValidationState().observe()
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
@ -84,6 +85,7 @@ public class ValidationController
/** /**
* Helper function to check if validation state in error state ot not * Helper function to check if validation state in error state ot not
*
* @param validationState the state you want to check for the errors. * @param validationState the state you want to check for the errors.
* @return true if validation state is in error and false otherwise. * @return true if validation state is in error and false otherwise.
*/ */

View File

@ -51,6 +51,7 @@ public abstract class EditTextValidator<TModel extends Serializable> extends Val
* This flag needed to force showing errors. You don't want to show final error when you start to enter data in some field at first time. * This flag needed to force showing errors. You don't want to show final error when you start to enter data in some field at first time.
* But if user leaves this view and final check not passed - you need to force to show an error till user not enters correct data and leaves * But if user leaves this view and final check not passed - you need to force to show an error till user not enters correct data and leaves
* the view. * the view.
*
* @return {@link NonNullChangeable} with current state of the flag - do we need to show errors from final checks while user types. * @return {@link NonNullChangeable} with current state of the flag - do we need to show errors from final checks while user types.
*/ */
@NonNull @NonNull
@ -60,6 +61,7 @@ public abstract class EditTextValidator<TModel extends Serializable> extends Val
/** /**
* Use this method to get or set final check. * Use this method to get or set final check.
*
* @return final check. * @return final check.
*/ */
@NonNull @NonNull
@ -69,6 +71,7 @@ public abstract class EditTextValidator<TModel extends Serializable> extends Val
/** /**
* Use this method to get or set primary check. * Use this method to get or set primary check.
*
* @return primary check. * @return primary check.
*/ */
@NonNull @NonNull
@ -119,6 +122,7 @@ public abstract class EditTextValidator<TModel extends Serializable> extends Val
/** /**
* Validates text with primary check. * Validates text with primary check.
*
* @param text - input text. * @param text - input text.
* @return {@link Observable} with the result of the primary check. * @return {@link Observable} with the result of the primary check.
*/ */
@ -129,6 +133,7 @@ public abstract class EditTextValidator<TModel extends Serializable> extends Val
/** /**
* Validates text with final check. * Validates text with final check.
*
* @param text - input text. * @param text - input text.
* @return {@link Observable} with the result of the final check. * @return {@link Observable} with the result of the final check.
*/ */
@ -140,9 +145,10 @@ public abstract class EditTextValidator<TModel extends Serializable> extends Val
/** /**
* Validates text with primary and final check consequentially and returns {@link Observable} with {@link HalfNullablePair} of final state * Validates text with primary and final check consequentially and returns {@link Observable} with {@link HalfNullablePair} of final state
* and resulting model. * and resulting model.
*
* @param text - input text. * @param text - input text.
* @return pair with final {@link ValidationState} that is always not null and a model that we get after converting the text. * @return pair with final {@link ValidationState} that is always not null and a model that we get after converting the text.
* Model can be null if validation fails on primary or final checks. * Model can be null if validation fails on primary or final checks.
*/ */
@NonNull @NonNull
@Override @Override

View File

@ -12,12 +12,14 @@ import rx.Observable;
/** /**
* Created by Ilia Kurtov on 24/01/2017. * Created by Ilia Kurtov on 24/01/2017.
* Class that simplifies work with {@link Validator}'s that have the same wrapper model and model type. * Class that simplifies work with {@link Validator}'s that have the same wrapper model and model type.
*
* @param <TModel> model that should be bounded with a view. * @param <TModel> model that should be bounded with a view.
*/ */
public class SameTypeValidator<TModel extends Serializable> extends Validator<TModel, TModel> { public class SameTypeValidator<TModel extends Serializable> extends Validator<TModel, TModel> {
/** /**
* Simply returns the same model without any converting. * Simply returns the same model without any converting.
*
* @param wrapperModel input model. * @param wrapperModel input model.
* @return the same model as input parameter. * @return the same model as input parameter.
* @throws Throwable - in this case no throwable would be thrown. * @throws Throwable - in this case no throwable would be thrown.
@ -31,9 +33,10 @@ public class SameTypeValidator<TModel extends Serializable> extends Validator<TM
/** /**
* Validates {@link TModel} and returns {@link Observable} with {@link HalfNullablePair} of final state and resulting model. * Validates {@link TModel} and returns {@link Observable} with {@link HalfNullablePair} of final state and resulting model.
*
* @param wrapperModel - not null value that should be validated. * @param wrapperModel - not null value that should be validated.
* @return pair with final {@link ValidationState} that is always not null and a model that we get after converting the {@link TModel}. * @return pair with final {@link ValidationState} that is always not null and a model that we get after converting the {@link TModel}.
* Model can be null if validation fails. * Model can be null if validation fails.
*/ */
@NonNull @NonNull
@Override @Override

View File

@ -54,6 +54,7 @@ public abstract class Validator<TWrapperModel extends Serializable, TModel exten
/** /**
* This method converts {@link TWrapperModel} into a {@link TModel}. * This method converts {@link TWrapperModel} into a {@link TModel}.
*
* @param wrapperModel - not null value that should be converted into a {@link TModel} object. * @param wrapperModel - not null value that should be converted into a {@link TModel} object.
* @return converted wrapperModel into a {@link TModel}. * @return converted wrapperModel into a {@link TModel}.
* @throws Throwable for the cases when converting cannot be processed. * @throws Throwable for the cases when converting cannot be processed.
@ -63,6 +64,7 @@ public abstract class Validator<TWrapperModel extends Serializable, TModel exten
/** /**
* Call this method to get {@link Changeable} with {@link TWrapperModel} inside it that should be connected to its bounded view. * Call this method to get {@link Changeable} with {@link TWrapperModel} inside it that should be connected to its bounded view.
*
* @return {@link Changeable} with {@link TWrapperModel}. * @return {@link Changeable} with {@link TWrapperModel}.
*/ */
@NonNull @NonNull
@ -72,6 +74,7 @@ public abstract class Validator<TWrapperModel extends Serializable, TModel exten
/** /**
* Returns current {@link ValidationState} or its successor. Needed to connect with bounded view and react to this state changes. * Returns current {@link ValidationState} or its successor. Needed to connect with bounded view and react to this state changes.
*
* @return current validation state. * @return current validation state.
*/ */
@NonNull @NonNull
@ -82,6 +85,7 @@ public abstract class Validator<TWrapperModel extends Serializable, TModel exten
/** /**
* This method needed to get {@link ValidationState} that needed to be shown when bounded view is empty and you need to show to user reminder, * This method needed to get {@link ValidationState} that needed to be shown when bounded view is empty and you need to show to user reminder,
* that he or she needs to fill this view. * that he or she needs to fill this view.
*
* @return {@link ValidationState} that should be shown for an empty field. * @return {@link ValidationState} that should be shown for an empty field.
*/ */
@NonNull @NonNull
@ -91,9 +95,10 @@ public abstract class Validator<TWrapperModel extends Serializable, TModel exten
/** /**
* Validates {@link TWrapperModel} and returns {@link Observable} with {@link HalfNullablePair} of final state and resulting model. * Validates {@link TWrapperModel} and returns {@link Observable} with {@link HalfNullablePair} of final state and resulting model.
*
* @param wrapperModel - not null value that should be validated. * @param wrapperModel - not null value that should be validated.
* @return pair with final {@link ValidationState} that is always not null and a model that we get after converting the {@link TWrapperModel}. * @return pair with final {@link ValidationState} that is always not null and a model that we get after converting the {@link TWrapperModel}.
* Model can be null if validation fails. * Model can be null if validation fails.
*/ */
@NonNull @NonNull
public abstract Observable<HalfNullablePair<ValidationState, TModel>> fullValidateAndGetModel(@NonNull final TWrapperModel wrapperModel); public abstract Observable<HalfNullablePair<ValidationState, TModel>> fullValidateAndGetModel(@NonNull final TWrapperModel wrapperModel);