|
|
@ -110,21 +110,21 @@ public class ProfileActivity extends AppCompatActivity implements UserProfileCon |
|
|
|
finish(); |
|
|
|
break; |
|
|
|
case R.id.iv_uploadImage: |
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { |
|
|
|
int writePermission = ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE); |
|
|
|
int cameraPermission = ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CAMERA); |
|
|
|
if (Settings.System.canWrite(this) && cameraPermission == PackageManager.PERMISSION_GRANTED) { |
|
|
|
cameraorGalleryChooser(PROFILE_IMAGE_CAMERA, PROFILE_IMAGE_GALLERY); |
|
|
|
} else { |
|
|
|
|
|
|
|
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, |
|
|
|
Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.CAMERA}, REQUEST_PERMISSION); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
cameraorGalleryChooser(PROFILE_IMAGE_CAMERA, PROFILE_IMAGE_GALLERY); |
|
|
|
} |
|
|
|
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { |
|
|
|
// int writePermission = ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE); |
|
|
|
// int cameraPermission = ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CAMERA); |
|
|
|
// if (Settings.System.canWrite(this) && cameraPermission == PackageManager.PERMISSION_GRANTED) { |
|
|
|
// cameraorGalleryChooser(PROFILE_IMAGE_CAMERA, PROFILE_IMAGE_GALLERY); |
|
|
|
// } else { |
|
|
|
// |
|
|
|
// requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, |
|
|
|
// Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.CAMERA}, REQUEST_PERMISSION); |
|
|
|
// |
|
|
|
// } |
|
|
|
// |
|
|
|
// } else { |
|
|
|
// cameraorGalleryChooser(PROFILE_IMAGE_CAMERA, PROFILE_IMAGE_GALLERY); |
|
|
|
// } |
|
|
|
break; |
|
|
|
case R.id.iv_edit_profile: |
|
|
|
startActivity(new Intent(ProfileActivity.this, EditProfileDetailActivity.class)); |
|
|
@ -252,39 +252,44 @@ public class ProfileActivity extends AppCompatActivity implements UserProfileCon |
|
|
|
tvEmail.setText(body.email); |
|
|
|
tvBalance.setText(Utils.amountFormat(Double.parseDouble(body.availableBalance))); |
|
|
|
setWalletNo(body.walletNumber, body.primaryBankName); |
|
|
|
if (body.dpUrl != null && body.dpUrl.length() > 1) { |
|
|
|
// Glide.with(ProfileActivity.this).load(body.dpUrl).diskCacheStrategy(DiskCacheStrategy.ALL).into(profileImage); |
|
|
|
// Utility.showImageFromServer(this, profileImage, body.dpUrl); |
|
|
|
// String image = body.dpUrl; |
|
|
|
Target target = new Target() { |
|
|
|
@Override |
|
|
|
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { |
|
|
|
profileImage.setImageBitmap(bitmap); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onBitmapFailed(Exception e, Drawable errorDrawable) { |
|
|
|
profileImage.setImageDrawable(errorDrawable); |
|
|
|
} |
|
|
|
// if (body.dpUrl != null && body.dpUrl.length() > 1) { |
|
|
|
//// Glide.with(ProfileActivity.this).load(body.dpUrl).diskCacheStrategy(DiskCacheStrategy.ALL).into(profileImage); |
|
|
|
//// Utility.showImageFromServer(this, profileImage, body.dpUrl); |
|
|
|
//// String image = body.dpUrl; |
|
|
|
// Target target = new Target() { |
|
|
|
// @Override |
|
|
|
// public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { |
|
|
|
// profileImage.setImageBitmap(bitmap); |
|
|
|
// } |
|
|
|
// |
|
|
|
// @Override |
|
|
|
// public void onBitmapFailed(Exception e, Drawable errorDrawable) { |
|
|
|
// profileImage.setImageDrawable(errorDrawable); |
|
|
|
// } |
|
|
|
// |
|
|
|
// @Override |
|
|
|
// public void onPrepareLoad(Drawable placeHolderDrawable) { |
|
|
|
// profileImage.setImageDrawable(placeHolderDrawable); |
|
|
|
// } |
|
|
|
// }; |
|
|
|
//// Picasso.get().load(body.dpUrl).memoryPolicy(MemoryPolicy.NO_CACHE,MemoryPolicy.NO_STORE).into(target); |
|
|
|
// Picasso.get().load(body.dpUrl).memoryPolicy(MemoryPolicy.NO_CACHE,MemoryPolicy.NO_STORE).into(profileImage); |
|
|
|
//// Glide.with(this).load(body.dpUrl).into(profileImage); |
|
|
|
// textProfileImage.setVisibility(View.GONE); |
|
|
|
// } else { |
|
|
|
// if (body.firstName != null && body.firstName.length() > 0) { |
|
|
|
// TextDrawable drawable = TextDrawable.builder().buildRound(String.valueOf(body.firstName.toUpperCase().charAt(0)), getResources().getColor(R.color.blue)); |
|
|
|
// textProfileImage.setImageDrawable(drawable); |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onPrepareLoad(Drawable placeHolderDrawable) { |
|
|
|
profileImage.setImageDrawable(placeHolderDrawable); |
|
|
|
} |
|
|
|
}; |
|
|
|
// Picasso.get().load(body.dpUrl).memoryPolicy(MemoryPolicy.NO_CACHE,MemoryPolicy.NO_STORE).into(target); |
|
|
|
Picasso.get().load(body.dpUrl).memoryPolicy(MemoryPolicy.NO_CACHE,MemoryPolicy.NO_STORE).into(profileImage); |
|
|
|
// Glide.with(this).load(body.dpUrl).into(profileImage); |
|
|
|
textProfileImage.setVisibility(View.GONE); |
|
|
|
} else { |
|
|
|
if (body.firstName != null && body.firstName.length() > 0) { |
|
|
|
TextDrawable drawable = TextDrawable.builder().buildRound(String.valueOf(body.firstName.toUpperCase().charAt(0)), getResources().getColor(R.color.blue)); |
|
|
|
textProfileImage.setImageDrawable(drawable); |
|
|
|
} |
|
|
|
} |
|
|
|
if (body.verified) { |
|
|
|
ivEditProfile.setVisibility(View.VISIBLE); |
|
|
|
} |
|
|
|
// if (body.verified) { |
|
|
|
// ivEditProfile.setVisibility(View.VISIBLE); |
|
|
|
// } |
|
|
|
// ivEditProfile.setVisibility(View.VISIBLE); |
|
|
|
|
|
|
|
} |
|
|
|