// Path: app/src/main/java/moe/yukinoneko/diycode/event/LoginEvent.java
// public class LoginEvent {
// }
// 
// Path: app/src/main/java/moe/yukinoneko/diycode/mvp/MVPBaseActivity.java
// public abstract class MVPBaseActivity<V extends BaseView, T extends BasePresenterImpl<V>> extends BaseActivity implements BaseView {
//     protected T presenter;
// 
//     @SuppressWarnings("unchecked")
//     @Override
//     protected void onCreate(@Nullable Bundle savedInstanceState) {
//         presenter = getInstance(this, 1);
//         presenter.attachView((V) this);
// 
//         super.onCreate(savedInstanceState);
//     }
// 
//     @Override
//     protected void onDestroy() {
//         if (presenter != null) {
//             presenter.detachView();
//         }
//         super.onDestroy();
//     }
// 
//     @Override
//     public Context getContext() {
//         return this;
//     }
// 
//     @Override
//     public <T> LifecycleTransformer<T> bindToLife() {
//         return this.<T>bindToLifecycle();
//     }
// 
//     @SuppressWarnings("unchecked")
//     public <T> T getInstance(Object o, int i) {
//         try {
//             return ((Class<T>) ((ParameterizedType) (o.getClass().getGenericSuperclass())).getActualTypeArguments()[i]).newInstance();
//         } catch (InstantiationException | IllegalAccessException | ClassCastException e) {
//             e.printStackTrace();
//         }
//         return null;
//     }
// }
// 
// Path: app/src/main/java/moe/yukinoneko/diycode/tool/StringHelper.java
// public static String trim(CharSequence input) {
//     return input.toString().trim();
// }


import org.greenrobot.eventbus.EventBus;
import butterknife.BindView;
import butterknife.OnClick;
import moe.yukinoneko.diycode.R;
import moe.yukinoneko.diycode.event.LoginEvent;
import moe.yukinoneko.diycode.mvp.MVPBaseActivity;
import static android.text.TextUtils.isEmpty;
import static moe.yukinoneko.diycode.tool.StringHelper.trim;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.TextInputEditText;
import android.support.design.widget.TextInputLayout;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
                finish();
                break;
            case R.id.button_sign_in:
                presenter.login();
                break;
        }
    }

    @Override
    public String getUsername() {
        return trim(editUsername.getText());
    }

    @Override
    public String getPassword() {
        return trim(editPassword.getText());
    }

    @Override
    public void nameError() {
        usernameHint.setError(getString(R.string.username_non_null));
    }

    @Override
    public void passwordError() {
        passwordHint.setError(getString(R.string.password_non_null));
    }

    @Override
    public void LoginSuccessful() {
// Path: app/src/main/java/moe/yukinoneko/diycode/event/LoginEvent.java
// public class LoginEvent {
// }
// 
// Path: app/src/main/java/moe/yukinoneko/diycode/mvp/MVPBaseActivity.java
// public abstract class MVPBaseActivity<V extends BaseView, T extends BasePresenterImpl<V>> extends BaseActivity implements BaseView {
//     protected T presenter;
// 
//     @SuppressWarnings("unchecked")
//     @Override
//     protected void onCreate(@Nullable Bundle savedInstanceState) {
//         presenter = getInstance(this, 1);
//         presenter.attachView((V) this);
// 
//         super.onCreate(savedInstanceState);
//     }
// 
//     @Override
//     protected void onDestroy() {
//         if (presenter != null) {
//             presenter.detachView();
//         }
//         super.onDestroy();
//     }
// 
//     @Override
//     public Context getContext() {
//         return this;
//     }
// 
//     @Override
//     public <T> LifecycleTransformer<T> bindToLife() {
//         return this.<T>bindToLifecycle();
//     }
// 
//     @SuppressWarnings("unchecked")
//     public <T> T getInstance(Object o, int i) {
//         try {
//             return ((Class<T>) ((ParameterizedType) (o.getClass().getGenericSuperclass())).getActualTypeArguments()[i]).newInstance();
//         } catch (InstantiationException | IllegalAccessException | ClassCastException e) {
//             e.printStackTrace();
//         }
//         return null;
//     }
// }
// 
// Path: app/src/main/java/moe/yukinoneko/diycode/tool/StringHelper.java
// public static String trim(CharSequence input) {
//     return input.toString().trim();
// }


// Path: app/src/main/java/moe/yukinoneko/diycode/module/login/LoginActivity.java
import org.greenrobot.eventbus.EventBus;
import butterknife.BindView;
import butterknife.OnClick;
import moe.yukinoneko.diycode.R;
import moe.yukinoneko.diycode.event.LoginEvent;
import moe.yukinoneko.diycode.mvp.MVPBaseActivity;
import static android.text.TextUtils.isEmpty;
import static moe.yukinoneko.diycode.tool.StringHelper.trim;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.TextInputEditText;
import android.support.design.widget.TextInputLayout;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;

                finish();
                break;
            case R.id.button_sign_in:
                presenter.login();
                break;
        }
    }

    @Override
    public String getUsername() {
        return trim(editUsername.getText());
    }

    @Override
    public String getPassword() {
        return trim(editPassword.getText());
    }

    @Override
    public void nameError() {
        usernameHint.setError(getString(R.string.username_non_null));
    }

    @Override
    public void passwordError() {
        passwordHint.setError(getString(R.string.password_non_null));
    }

    @Override
    public void LoginSuccessful() {
        EventBus.getDefault().post(new LoginEvent());