// Path: app/src/main/java/hr/foi/rsc/lifeline/mvp/presenters/RegisterPresenter.java
// public interface RegisterPresenter extends BasePresenter {
// 
//     public void register(String username, String password);
// }
// 
// Path: app/src/main/java/hr/foi/rsc/lifeline/mvp/presenters/impl/RegisterPresenterImpl.java
// public class RegisterPresenterImpl implements RegisterPresenter {
// 
//     private boolean canceled;
// 
//     private RegisterView registerView;
// 
//     public RegisterPresenterImpl(RegisterView registerView) {
//         this.registerView = registerView;
//     }
// 
//     @Override
//     public void register(String username, String password) {
//         canceled = false;
//         registerView.showProgress();
// 
//         ParseUser user = new ParseUser();
//         user.setUsername(username);
//         user.setPassword(password);
//         user.setEmail(username);
//         user.put(User.TYPE, User.DONOR);
// 
//         user.signUpInBackground(signUpCallback);
//     }
// 
//     private SignUpCallback signUpCallback = new SignUpCallback() {
//         @Override
//         public void done(ParseException e) {
//             registerView.hideProgress();
// 
//             if (canceled) {
//                 return;
//             }
// 
//             if (e == null) {
//                 registerView.onSuccess();
//             } else {
//                 registerView.showError(e.getMessage());
//             }
//         }
//     };
// 
//     @Override
//     public void cancel() {
//         canceled = true;
//     }
// }
// 
// Path: app/src/main/java/hr/foi/rsc/lifeline/mvp/views/RegisterView.java
// public interface RegisterView extends BaseView {
// 
//     public void onSuccess();
// }


import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.widget.EditText;
import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import hr.foi.rsc.lifeline.R;
import hr.foi.rsc.lifeline.mvp.presenters.RegisterPresenter;
import hr.foi.rsc.lifeline.mvp.presenters.impl.RegisterPresenterImpl;
import hr.foi.rsc.lifeline.mvp.views.RegisterView;
package hr.foi.rsc.lifeline.activities;



public class RegisterActivity extends BaseActivity implements RegisterView {

    @InjectView(R.id.my_awesome_toolbar)
    protected Toolbar toolbar;

    @InjectView(R.id.input_username)
    protected EditText usernameText;

    @InjectView(R.id.input_password)
    protected EditText passwordText;

    @InjectView(R.id.input_password_confirm)
    protected EditText passwordConfirmText;

    private RegisterPresenter registerPresenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        ButterKnife.inject(this);

        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

// Path: app/src/main/java/hr/foi/rsc/lifeline/mvp/presenters/RegisterPresenter.java
// public interface RegisterPresenter extends BasePresenter {
// 
//     public void register(String username, String password);
// }
// 
// Path: app/src/main/java/hr/foi/rsc/lifeline/mvp/presenters/impl/RegisterPresenterImpl.java
// public class RegisterPresenterImpl implements RegisterPresenter {
// 
//     private boolean canceled;
// 
//     private RegisterView registerView;
// 
//     public RegisterPresenterImpl(RegisterView registerView) {
//         this.registerView = registerView;
//     }
// 
//     @Override
//     public void register(String username, String password) {
//         canceled = false;
//         registerView.showProgress();
// 
//         ParseUser user = new ParseUser();
//         user.setUsername(username);
//         user.setPassword(password);
//         user.setEmail(username);
//         user.put(User.TYPE, User.DONOR);
// 
//         user.signUpInBackground(signUpCallback);
//     }
// 
//     private SignUpCallback signUpCallback = new SignUpCallback() {
//         @Override
//         public void done(ParseException e) {
//             registerView.hideProgress();
// 
//             if (canceled) {
//                 return;
//             }
// 
//             if (e == null) {
//                 registerView.onSuccess();
//             } else {
//                 registerView.showError(e.getMessage());
//             }
//         }
//     };
// 
//     @Override
//     public void cancel() {
//         canceled = true;
//     }
// }
// 
// Path: app/src/main/java/hr/foi/rsc/lifeline/mvp/views/RegisterView.java
// public interface RegisterView extends BaseView {
// 
//     public void onSuccess();
// }


// Path: app/src/main/java/hr/foi/rsc/lifeline/activities/RegisterActivity.java
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.widget.EditText;
import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import hr.foi.rsc.lifeline.R;
import hr.foi.rsc.lifeline.mvp.presenters.RegisterPresenter;
import hr.foi.rsc.lifeline.mvp.presenters.impl.RegisterPresenterImpl;
import hr.foi.rsc.lifeline.mvp.views.RegisterView;

package hr.foi.rsc.lifeline.activities;



public class RegisterActivity extends BaseActivity implements RegisterView {

    @InjectView(R.id.my_awesome_toolbar)
    protected Toolbar toolbar;

    @InjectView(R.id.input_username)
    protected EditText usernameText;

    @InjectView(R.id.input_password)
    protected EditText passwordText;

    @InjectView(R.id.input_password_confirm)
    protected EditText passwordConfirmText;

    private RegisterPresenter registerPresenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        ButterKnife.inject(this);

        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        registerPresenter = new RegisterPresenterImpl(this);