/** * called when the presenter and view are ready. getView() will not be null * * @param savedInstanceState This bundle is only passed on rotation not passed on navigating * back */ @Override protected void onLoad(Bundle savedInstanceState) { Timber.v("onLoad"); ButterKnife.bind(this, getView()); userRepo .getMe() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe( new Action1<User>() { @Override public void call(User user) { String firstName = user.getData().attributes().getFirstName(); String lastName = user.getData().attributes().getLastName(); // String email = user.getData().attributes().getEmail(); firstNameEditText.setText(firstName); lastNameEditText.setText(lastName); // emailEditText.setText(email); photoEditView.load(user.getData().attributes(), userPhoto); } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { Timber.e(throwable, "Unable to retrieve profile"); Crashlytics.logException(throwable); ProfileEditView view = getView(); if (view != null) { ToastService.get(view) .bern(view.getContext().getString(R.string.error_retrieving_profile)); } else { Timber.w("getView() null, can not notify user of failed profile retrieval."); } } }); photoEditView.setPhotoChangeListener( new PhotoEditView.PhotoChangeListener() { @Override public void onPhotoChanged(Bitmap bitmap, String base64PhotoData) { userPhoto = bitmap; Presenter.this.base64PhotoData = base64PhotoData; } }); getView() .postDelayed( new Runnable() { @Override public void run() { photoEditView.toggleAvatarWidget(true); } }, 300); }