1 package com.moiseum.wolnelektury.view.login;
3 import android.app.ProgressDialog;
4 import android.content.Context;
5 import android.net.Uri;
6 import android.os.Bundle;
7 import android.widget.Toast;
9 import com.moiseum.wolnelektury.R;
10 import com.moiseum.wolnelektury.base.AbstractActivity;
11 import com.moiseum.wolnelektury.base.AbstractIntent;
12 import com.moiseum.wolnelektury.base.mvp.PresenterActivity;
14 import butterknife.OnClick;
17 * Created by Piotr Ostrowski on 11.09.2018.
19 public class LoginActivity extends PresenterActivity<LoginPresenter> implements LoginView {
21 public static class LoginIntent extends AbstractIntent {
23 public LoginIntent(Context context) {
24 super(context, LoginActivity.class);
28 private ProgressDialog progressDialog;
31 public int getLayoutResourceId() {
32 return R.layout.activity_login;
36 public void prepareView(Bundle savedInstanceState) {
41 protected LoginPresenter createPresenter() {
42 return new LoginPresenter(this);
46 public void setProgressDialogVisibility(boolean visible) {
47 if (visible && progressDialog == null) {
48 String dialogMessage = getString(R.string.main_view_progress);
49 progressDialog = ProgressDialog.show(this, null, dialogMessage, true, false);
50 } else if (!visible && progressDialog != null) {
51 progressDialog.hide();
52 progressDialog = null;
57 public void showToastMessage(int messageResId) {
58 Toast.makeText(this, messageResId, Toast.LENGTH_LONG).show();
62 public void showCustomTabsAuthentication(Uri authorizationUrl) {
63 showBrowserView(authorizationUrl);
68 public void onBackClicked() {
72 @OnClick(R.id.btnLogin)
73 public void onLoginClicked() {
74 getPresenter().onLoginClicked();