Created
August 9, 2016 22:18
-
-
Save khle/7b0be5c80c88713ef2a45defb423c54d to your computer and use it in GitHub Desktop.
This file contains hidden or 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.databinding.BaseObservable; | |
| import android.databinding.Bindable; | |
| import android.databinding.ObservableField; | |
| import android.os.Handler; | |
| import android.support.design.widget.Snackbar; | |
| import android.transition.Visibility; | |
| import android.view.View; | |
| public class LoginViewModel { | |
| public final ObservableField<String> email = | |
| new ObservableField<>(); | |
| public final ObservableField<String> password = | |
| new ObservableField<>(); | |
| public final ObservableField<Integer> busy = | |
| new ObservableField<>(); | |
| public LoginViewModel(String email, String password) { | |
| this.email.set(email); | |
| this.password.set(password); | |
| this.busy.set(View.GONE); | |
| } | |
| public void onClick(final View view) { | |
| final String email = this.email.get(); | |
| final String password = this.password.get(); | |
| busy.set(View.VISIBLE); | |
| new Handler().postDelayed(new Runnable() { | |
| @Override public void run() { | |
| busy.set(View.GONE); | |
| Snackbar.make(view, email + ", " + password, Snackbar.LENGTH_SHORT).show(); | |
| } | |
| }, 500); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment