content: /*
   * Copyright (C) 2017 MINDORKS NEXTGEN PRIVATE LIMITED
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     https://mindorks.com/license/apache-v2
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License
   */
  
  package <%= appPackage %>.ui.login;
  
  import android.content.Context;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.EditText;
  
  import <%= appPackage %>.R;
  import <%= appPackage %>.ui.base.BaseActivity;
  import <%= appPackage %>.ui.main.MainActivity;
  
  import javax.inject.Inject;
  
  import butterknife.BindView;
  import butterknife.ButterKnife;
  import butterknife.OnClick;
  
  
  /**
   * Created by janisharali on 27/01/17.
   */
  
  public class LoginActivity extends BaseActivity implements LoginMvpView {
  
      @Inject
      LoginMvpPresenter<LoginMvpView> mPresenter;
  
      @BindView(R.id.et_email)
      EditText mEmailEditText;
  
      @BindView(R.id.et_password)
      EditText mPasswordEditText;
  
      public static Intent getStartIntent(Context context) {
          Intent intent = new Intent(context, LoginActivity.class);
          return intent;
      }
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_login);
  
          getActivityComponent().inject(this);
  
          setUnBinder(ButterKnife.bind(this));
  
          mPresenter.onAttach(LoginActivity.this);
      }
  
      @OnClick(R.id.btn_server_login)
      void onServerLoginClick(View v) {
          mPresenter.onServerLoginClick(mEmailEditText.getText().toString(),
                  mPasswordEditText.getText().toString());
      }
  
      @OnClick(R.id.ib_google_login)
      void onGoogleLoginClick(View v) {
          mPresenter.onGoogleLoginClick();
      }
  
      @OnClick(R.id.ib_fb_login)
      void onFbLoginClick(View v) {
          mPresenter.onFacebookLoginClick();
      }
  
      @Override
      public void openMainActivity() {
          Intent intent = MainActivity.getStartIntent(LoginActivity.this);
          startActivity(intent);
          finish();
      }
  
      @Override
      protected void onDestroy() {
          mPresenter.onDetach();
          super.onDestroy();
      }
  
      @Override
      protected void setUp() {
  
      }
  }
  