// 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;
/*
 * Copyright (c) 2017 SamuelGjk <samuel.alva@outlook.com>
 *
 * This file is part of DiyCode
 *
 * DiyCode is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * DiyCode is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with DiyCode. If not, see <http://www.gnu.org/licenses/>.
 */

package moe.yukinoneko.diycode.module.login;






/**
 * MVPPlugin
 * 邮箱 784787081@qq.com
 */

public class LoginActivity extends MVPBaseActivity<LoginContract.View, LoginPresenter> implements LoginContract.View {

    @BindView(R.id.username_hint) TextInputLayout usernameHint;
    @BindView(R.id.edit_username) TextInputEditText editUsername;
    @BindView(R.id.password_hint) TextInputLayout passwordHint;
    @BindView(R.id.edit_password) TextInputEditText editPassword;

    private ProgressDialog progressDialog;

    public static void launch(Context context) {
        context.startActivity(new Intent(context, LoginActivity.class));
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_sign_in;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        progressDialog = new ProgressDialog(this);
        progressDialog.setCancelable(false);
        progressDialog.setMessage("请稍后...");

        editUsername.addTextChangedListener(new TextWatcher() {
            @Override
// 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;

/*
 * Copyright (c) 2017 SamuelGjk <samuel.alva@outlook.com>
 *
 * This file is part of DiyCode
 *
 * DiyCode is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * DiyCode is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with DiyCode. If not, see <http://www.gnu.org/licenses/>.
 */

package moe.yukinoneko.diycode.module.login;






/**
 * MVPPlugin
 * 邮箱 784787081@qq.com
 */

public class LoginActivity extends MVPBaseActivity<LoginContract.View, LoginPresenter> implements LoginContract.View {

    @BindView(R.id.username_hint) TextInputLayout usernameHint;
    @BindView(R.id.edit_username) TextInputEditText editUsername;
    @BindView(R.id.password_hint) TextInputLayout passwordHint;
    @BindView(R.id.edit_password) TextInputEditText editPassword;

    private ProgressDialog progressDialog;

    public static void launch(Context context) {
        context.startActivity(new Intent(context, LoginActivity.class));
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_sign_in;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        progressDialog = new ProgressDialog(this);
        progressDialog.setCancelable(false);
        progressDialog.setMessage("请稍后...");

        editUsername.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {