@Override public void onResume() { super.onResume(); SharedPreferences profile = getSharedPreferences(Constants.PROFILE_PREFS, MODE_PRIVATE); if (profile.contains(Constants.EMAIL)) { mEmailView.setText(profile.getString(Constants.EMAIL, "")); if (profile.contains(Constants.INTERNAL_USER_ID)) { OWUser user = OWUser.objects(getApplicationContext(), OWUser.class) .get(profile.getInt(Constants.INTERNAL_USER_ID, 0)); model_id = user.getId(); if (user != null) { OWUtils.loadProfilePicture( getApplicationContext(), user, ((ImageView) findViewById(R.id.user_thumbnail))); } } if (profile.getBoolean(Constants.AUTHENTICATED, false)) { setViewsAsAuthenticated(); return; } } Bundle extras = getIntent().getExtras(); if (extras != null && extras.containsKey("message")) { setViewsAsNotAuthenticatedWithMessage(extras.getString("message")); } else if (!profile.contains(Constants.EMAIL) && !profile.getBoolean(Constants.AUTHENTICATED, false)) { // The user has never provided an email: setViewsAsNotAuthenticatedWithMessage(getString(R.string.create_account_prompt)); } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) { super.onActivityResult(requestCode, resultCode, imageReturnedIntent); if (cameraPhotoLocation != null) { OWUtils.handleSetUserAvatarResult( requestCode, resultCode, imageReturnedIntent, ((ImageView) this.findViewById(R.id.user_thumbnail)), this, OWUser.objects(getApplicationContext(), OWUser.class).get(model_id), cameraPhotoLocation.getAbsolutePath()); cameraPhotoLocation = null; } }