private void updateIdentityImage( String fanExternalName, String fanPassword, ExternalPlatform externalPlatform) throws CantUpdateFanIdentityException { moduleManager.updateFanIdentity( fanExternalName, fanPassword, identitySelected.getId(), identitySelected.getPublicKey(), fanImageByteArray, externalPlatform); }
private void loadIdentity() { if (identitySelected.getProfileImage() != null) { Bitmap bitmap = null; if (identitySelected.getProfileImage().length > 0) { bitmap = BitmapFactory.decodeByteArray( identitySelected.getProfileImage(), 0, identitySelected.getProfileImage().length); // bitmap = Bitmap.createScaledBitmap(bitmap, fanImage.getWidth(), // fanImage.getHeight(), true); } else { bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_profile_male); // Picasso.with(getActivity()).load(R.drawable.profile_image).into(fanImage); } bitmap = Bitmap.createScaledBitmap(bitmap, 100, 100, true); fanImageByteArray = toByteArray(bitmap); fanImage.setImageDrawable(ImagesUtils.getRoundedBitmap(getResources(), bitmap)); } mFanExternalUserName.setText(identitySelected.getUsername()); // mFanExternalPassword.setText(identitySelected.getApiToken()); List<String> arraySpinner = ExternalPlatform.getArrayItems(); ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, arraySpinner); mFanExternalPlatform.setAdapter(adapter); ExternalPlatform[] externalPlatforms = ExternalPlatform.values(); for (int i = 0; i < externalPlatforms.length; i++) { if (externalPlatforms[i] == identitySelected.getExternalPlatform()) { mFanExternalPlatform.setSelection(i); break; } } }