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
| apply plugin: 'com.android.application' | |
| android { | |
| dataBinding { | |
| enabled = true | |
| } | |
| compileSdkVersion 23 | |
| ... | |
| } |
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 extends BaseObservable { | |
| private String email; |
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
| <layout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:tools="http://schemas.android.com/tools"> | |
| <data> | |
| <variable name="loginViewModel" type="dev.kevinle.exploremvvm.viewmodel.LoginViewModel"/> | |
| <variable name="handler" type="dev.kevinle.exploremvvm.viewmodel.LoginViewModel" /> | |
| </data> | |
| ... | |
| </layout> |
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
| <EditText | |
| android:id="@+id/email" | |
| ... | |
| android:text="@={loginViewModel.email}"/> | |
| <EditText | |
| android:id="@+id/password" | |
| ... | |
| android:text="@={loginViewModel.password}"/> | |
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
| package dev.kevinle.exploremvvm; | |
| import android.databinding.DataBindingUtil; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.os.Bundle; | |
| import dev.kevinle.exploremvvm.databinding.ActivityMainBinding; | |
| import dev.kevinle.exploremvvm.viewmodel.LoginViewModel; | |
| public class MainActivity extends AppCompatActivity { |
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
| <layout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:tools="http://schemas.android.com/tools"> | |
| <data> | |
| ... | |
| <variable name="handler" type="specify class to be the handler" /> | |
| </data> | |
| ... | |
| </layout> |
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
| func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { | |
| // Override point for customization after application launch. | |
| self.window = UIWindow(frame: UIScreen.mainScreen().bounds) | |
| var nav1 = UINavigationController() | |
| var first = FirstViewController(nibName: nil, bundle: nil) | |
| nav1.viewControllers = [first] | |
| var second = SecondViewController(nibName: nil, bundle: nil) | |
| var nav2 = UINavigationController() |
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
| { | |
| "token_type": "Bearer", | |
| "scope": "user_impersonation", | |
| "expires_in": "3599", | |
| "ext_expires_in": "0", | |
| "expires_on": "1472912660", | |
| "not_before": "1472908760", | |
| "resource": "http://yourapp.azurewebsites.net", | |
| "access_token": "eyJ0eXAiOiJK...", | |
| "refresh_token": "AQABAAAAAAB...", |
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
| curl --header "authorization: bearer eyJ0eXAiOiJK..." https://yourapp.azurewebsites.net/secured-resource |
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
| public class SessionToken { | |
| public long expires_on; | |
| public String access_token; | |
| public String refresh_token; | |
| } |