@Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { switch (requestCode) { case CATEGORY_REQUEST: if (resultCode == RESULT_OK) { loggedUser.setMajorJobCategory(intent.getStringExtra("major")); loggedUser.setMinorJobCategory(intent.getStringExtra("minor")); displayCategory(); } break; case SKILL_REQUEST: if (resultCode == RESULT_OK) { loggedUser.setSkills(intent.getStringExtra("strongestSkillsList")); displaySkill(); } break; case PROFILE_PIC_REQUEST: if (resultCode == RESULT_OK) { Uri selectedImage = imageUri; if (selectedImage != null) { getContentResolver().notifyChange(selectedImage, null); try { OutputStream fOut = null; Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), selectedImage); Bitmap resizedImage = GraphicUtils.resizeProfileImage(bitmap); File file = new File(new URI(selectedImage.toString())); fOut = new FileOutputStream(file); // Set picture compression resizedImage.compress(CompressFormat.JPEG, 70, fOut); fOut.flush(); fOut.close(); } catch (IOException e) { } catch (URISyntaxException e) { } // Upload user Photo exe.uploadUserProfilePhoto(); } else { new CustomDialog( ActivitySettings.this, "Info", "Unable to save picture! We are working on that...") .show(); } } break; } }
public void onClickCancel(View v) { hideKeyboard(); textNickName.setText(loggedUser.getNickName()); textEmail.setText(loggedUser.getUsername()); cancelButton.requestFocus(); RelativeLayout myLayout = (RelativeLayout) findViewById(R.id.activity_user_profile_root); myLayout.requestFocus(); cancelButton.setVisibility(View.GONE); }
/** Use user data in GUI */ private void useUserData() { String photo = loggedUser.getPhotoLarge(); if (photo == null) { photo = loggedUser.getPhoto(); } if (photo != null) { // Set views if (loggedUser != null) { imageLoader.DisplayImage(photo, imageProfilePhoto, R.drawable.default_avatar25, 400); class LoadPhotoThread implements Runnable { public Activity activity; public RelativeLayout layout; public String url; @Override public void run() { Bitmap b = imageLoader.getBitmap(url); if (b != null) { final Bitmap background = ImageLoader.FastBlur(b, 4); b.recycle(); activity.runOnUiThread( new Runnable() { @Override public void run() { if (background != null) { layout.setBackgroundDrawable(new BitmapDrawable(background)); } } }); } } } } title.setText(getResources().getString(R.string.settings)); textNickName.setText(loggedUser.getNickName()); textEmail.setText(loggedUser.getUsername()); displayCategory(); displaySkill(); } }
public void displayCategory() { String jobCategories = ""; if (loggedUser.getMajorJobCategory().compareTo("") != 0) { jobCategories = loggedUser.getMajorJobCategory(); } if (loggedUser.getMinorJobCategory().compareTo("") != 0) { if (jobCategories.compareTo("") != 0) { jobCategories = jobCategories + ", "; } jobCategories = jobCategories + loggedUser.getMinorJobCategory(); } if (jobCategories.compareTo("") != 0) { jobCategory.setText(jobCategories); } }
public void displaySkill() { String userSkills = loggedUser.getSkills(); if (userSkills != null) { if (userSkills.compareTo("") != 0) { strongestSkill.setText(userSkills); } CustomFontView lib = (CustomFontView) findViewById(R.id.strongSkillLbl); if (lib != null) { if (userSkills.contains(", ")) { lib.setText(getResources().getString(R.string.activity_settings_strongest_skill_lbl_p)); } else { lib.setText(getResources().getString(R.string.activity_settings_strongest_skill_lbl)); } } } }