aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-11-11 12:37:28 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-11-11 12:37:28 +0000
commitd6d6ed5407bf8479957290d1e7cf79279dd4c427 (patch)
tree87590918151abffe3bce14f9cb1809cfef23fd67 /app/src/main/java/ml
parent4bd6ae0c4cdbca81282e51bb6b43460ef85093f6 (diff)
downloadinfinity-for-reddit-d6d6ed5407bf8479957290d1e7cf79279dd4c427.tar
infinity-for-reddit-d6d6ed5407bf8479957290d1e7cf79279dd4c427.tar.gz
infinity-for-reddit-d6d6ed5407bf8479957290d1e7cf79279dd4c427.tar.bz2
infinity-for-reddit-d6d6ed5407bf8479957290d1e7cf79279dd4c427.tar.lz
infinity-for-reddit-d6d6ed5407bf8479957290d1e7cf79279dd4c427.tar.xz
infinity-for-reddit-d6d6ed5407bf8479957290d1e7cf79279dd4c427.tar.zst
infinity-for-reddit-d6d6ed5407bf8479957290d1e7cf79279dd4c427.zip
UI changes in EditProfileActivity.
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java24
1 files changed, 13 insertions, 11 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java
index 27086981..d9248652 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java
@@ -143,22 +143,26 @@ public class EditProfileActivity extends BaseActivity {
new ViewModelProvider(this, userViewModelFactory).get(UserViewModel.class);
userViewModel.getUserLiveData().observe(this, userData -> {
- if (userData == null) return;//
+ if (userData == null) {
+ return;
+ }
// BANNER
final String userBanner = userData.getBanner();
LayoutParams cBannerLp = (LayoutParams) changeBanner.getLayoutParams();
if (userBanner == null || userBanner.isEmpty()) {
changeBanner.setLongClickable(false);
- changeBanner.setImageResource(R.drawable.ic_add_day_night_24dp);
- changeBanner.setLayoutParams(new LayoutParams(cBannerLp.width, cBannerLp.height, Gravity.CENTER));
+ cBannerLp.gravity = Gravity.CENTER;
+ changeBanner.setLayoutParams(cBannerLp);
changeBanner.setOnLongClickListener(v -> false);
} else {
changeBanner.setLongClickable(true);
- changeBanner.setImageResource(R.drawable.ic_outline_add_a_photo_day_night_24dp);
- changeBanner.setLayoutParams(new LayoutParams(cBannerLp.width, cBannerLp.height, Gravity.END | Gravity.BOTTOM));
+ cBannerLp.gravity = Gravity.END | Gravity.BOTTOM;
+ changeBanner.setLayoutParams(cBannerLp);
glide.load(userBanner).into(bannerImageView);
changeBanner.setOnLongClickListener(view -> {
- if (mAccessToken == null) return false;
+ if (mAccessToken == null) {
+ return false;
+ }
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.remove_banner)
.setMessage(R.string.are_you_sure)
@@ -195,15 +199,13 @@ public class EditProfileActivity extends BaseActivity {
LayoutParams cAvatarLp = (LayoutParams) changeAvatar.getLayoutParams();
if (userAvatar.contains("avatar_default_")) {
changeAvatar.setLongClickable(false);
- changeAvatar.setImageResource(R.drawable.ic_add_day_night_24dp);
- changeAvatar.setLayoutParams(new LayoutParams(cAvatarLp.width, cAvatarLp.height, Gravity.CENTER));
changeAvatar.setOnLongClickListener(v -> false);
} else {
changeAvatar.setLongClickable(true);
- changeAvatar.setImageResource(R.drawable.ic_outline_add_a_photo_day_night_24dp);
- changeAvatar.setLayoutParams(new LayoutParams(cAvatarLp.width, cAvatarLp.height, Gravity.END | Gravity.BOTTOM));
changeAvatar.setOnLongClickListener(view -> {
- if (mAccessToken == null) return false;
+ if (mAccessToken == null) {
+ return false;
+ }
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.remove_avatar)
.setMessage(R.string.are_you_sure)