// Path: AuthProject/app/src/main/java/com/zhy/authproject/AuthApplication.java
// public class AuthApplication extends Application{
//     private AppComponent appComponent;
// 
//     public static AuthApplication get(Context context){
//         return (AuthApplication) context.getApplicationContext();
//     }
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         appComponent = DaggerAppComponent.builder().appModule(new AppModule(this)).build();
//     }
// 
// 
//     public AppComponent getAppComponent(){
//         return appComponent;
//     }
// 
// }
// 
// Path: AuthProject/app/src/main/java/com/zhy/authproject/module/base/BaseActivity.java
// public abstract class BaseActivity extends AppCompatActivity{
//     @Override
//     protected void onCreate(@Nullable Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setupActivityComponent();
//     }
//     public abstract void setupActivityComponent();
// 
// }


import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.app.LoaderManager.LoaderCallbacks;
import android.content.CursorLoader;
import android.content.Loader;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.EditorInfo;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.zhy.authproject.AuthApplication;
import com.zhy.authproject.R;
import com.zhy.authproject.module.base.BaseActivity;
import java.util.ArrayList;
import java.util.List;
import static android.Manifest.permission.READ_CONTACTS;
    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
                                           @NonNull int[] grantResults) {
        if (requestCode == REQUEST_READ_CONTACTS) {
            if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                populateAutoComplete();
            }
        }
    }


    /**
     * Attempts to sign in or register the account specified by the login form.
     * If there are form errors (invalid email, missing fields, etc.), the
     * errors are presented and no actual login attempt is made.
     */
    private void attemptLogin() {
        if (mAuthTask != null) {
            return;
        }

        // Reset errors.
        mEmailView.setError(null);
        mPasswordView.setError(null);

        // Store values at the time of the login attempt.
        String email = mEmailView.getText().toString();
        String password = mPasswordView.getText().toString();

        boolean cancel = false;
// Path: AuthProject/app/src/main/java/com/zhy/authproject/AuthApplication.java
// public class AuthApplication extends Application{
//     private AppComponent appComponent;
// 
//     public static AuthApplication get(Context context){
//         return (AuthApplication) context.getApplicationContext();
//     }
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         appComponent = DaggerAppComponent.builder().appModule(new AppModule(this)).build();
//     }
// 
// 
//     public AppComponent getAppComponent(){
//         return appComponent;
//     }
// 
// }
// 
// Path: AuthProject/app/src/main/java/com/zhy/authproject/module/base/BaseActivity.java
// public abstract class BaseActivity extends AppCompatActivity{
//     @Override
//     protected void onCreate(@Nullable Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setupActivityComponent();
//     }
//     public abstract void setupActivityComponent();
// 
// }


// Path: AuthProject/app/src/main/java/com/zhy/authproject/module/login/LoginActivity.java
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.app.LoaderManager.LoaderCallbacks;
import android.content.CursorLoader;
import android.content.Loader;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.EditorInfo;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.zhy.authproject.AuthApplication;
import com.zhy.authproject.R;
import com.zhy.authproject.module.base.BaseActivity;
import java.util.ArrayList;
import java.util.List;
import static android.Manifest.permission.READ_CONTACTS;

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
                                           @NonNull int[] grantResults) {
        if (requestCode == REQUEST_READ_CONTACTS) {
            if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                populateAutoComplete();
            }
        }
    }


    /**
     * Attempts to sign in or register the account specified by the login form.
     * If there are form errors (invalid email, missing fields, etc.), the
     * errors are presented and no actual login attempt is made.
     */
    private void attemptLogin() {
        if (mAuthTask != null) {
            return;
        }

        // Reset errors.
        mEmailView.setError(null);
        mPasswordView.setError(null);

        // Store values at the time of the login attempt.
        String email = mEmailView.getText().toString();
        String password = mPasswordView.getText().toString();

        boolean cancel = false;
        View focusView = null;