diff --git a/Habitica/res/layout/dialog_faint.xml b/Habitica/res/layout/dialog_faint.xml
index 86c1b6507..04fa5ae14 100644
--- a/Habitica/res/layout/dialog_faint.xml
+++ b/Habitica/res/layout/dialog_faint.xml
@@ -1,5 +1,6 @@
-
+ android:layout_gravity="center_horizontal"
+ app:showBackground="false"
+ app:showMount="false"
+ app:showPet="false" />
-
+ android:layout_gravity="center_horizontal"
+ app:showBackground="false"
+ app:showMount="false"
+ app:showPet="false" />
, Ha
private APIHelper apiHelper;
private AlertDialog faintDialog;
- private UserPicture sideUserPicture;
- private UserPicture dialogUserPicture;
+ private AvatarView mSideAvatarView;
+ private AvatarView mDialogAvatarView;
private Date lastSync;
@@ -199,8 +199,7 @@ public class MainActivity extends BaseActivity implements Action1, Ha
drawer = MainDrawerBuilder.CreateDefaultBuilderSettings(this, toolbar, accountHeader)
.build();
drawer.setSelectionAtPosition(1, false);
- this.sideUserPicture = new UserPicture(this, true, false);
- this.dialogUserPicture = new UserPicture(this, false, false);
+ mSideAvatarView = new AvatarView(this, true, false, false);
if (this.filterDrawer == null) {
filterDrawer = new DrawerBuilder()
@@ -579,9 +578,9 @@ public class MainActivity extends BaseActivity implements Action1, Ha
}
}
profile.withName(user.getProfile().getName());
- sideUserPicture.setUser(this.user);
- sideUserPicture.setPictureWithRunnable(avatar -> {
- profile.withIcon(avatar);
+ mSideAvatarView.setUser(user);
+ mSideAvatarView.onAvatarImageReady(avatarImage -> {
+ profile.withIcon(avatarImage);
accountHeader.updateProfile(profile);
});
accountHeader.updateProfile(profile);
@@ -993,9 +992,8 @@ public class MainActivity extends BaseActivity implements Action1, Ha
hpBar.setPartyMembers(true);
AvatarWithBarsViewModel.setHpBarData(hpBar, user.getStats(), this);
- ImageView avatarView = (ImageView) customView.findViewById(R.id.avatarView);
- this.dialogUserPicture.setUser(this.user);
- this.dialogUserPicture.setPictureOn(avatarView);
+ mDialogAvatarView = (AvatarView) customView.findViewById(R.id.avatarView);
+ mDialogAvatarView.setUser(user);
}
this.faintDialog = new AlertDialog.Builder(this)
@@ -1027,11 +1025,16 @@ public class MainActivity extends BaseActivity implements Action1, Ha
if (customView != null) {
TextView detailView = (TextView) customView.findViewById(R.id.levelupDetail);
detailView.setText(this.getString(R.string.levelup_detail, level));
- ImageView avatarView = (ImageView) customView.findViewById(R.id.avatarView);
- this.dialogUserPicture.setUser(this.user);
- this.dialogUserPicture.setPictureOn(avatarView);
+ mDialogAvatarView = (AvatarView) customView.findViewById(R.id.avatarView);
+ mDialogAvatarView.setUser(user);
}
+ final ShareEvent event = new ShareEvent();
+ event.sharedMessage = getString(R.string.share_levelup, level) + " https://habitica.com/social/level-up";
+ AvatarView avatarView = new AvatarView(this, true, true, true);
+ avatarView.setUser(user);
+ avatarView.onAvatarImageReady(avatarImage -> event.shareImage = avatarImage);
+
AlertDialog alert = new AlertDialog.Builder(this)
.setTitle(R.string.levelup_header)
.setView(customView)
@@ -1039,15 +1042,8 @@ public class MainActivity extends BaseActivity implements Action1, Ha
checkClassSelection();
})
.setNeutralButton(R.string.share, (dialog, which) -> {
- ShareEvent event = new ShareEvent();
- event.sharedMessage = getString(R.string.share_levelup, level) + " https://habitica.com/social/level-up";
- UserPicture picture = new UserPicture(this, true, true);
- picture.setUser(this.user);
- picture.setPictureWithRunnable(avatarBitmap -> {
- event.shareImage = avatarBitmap;
- EventBus.getDefault().post(event);
- dialog.dismiss();
- });
+ EventBus.getDefault().post(event);
+ dialog.dismiss();
})
.create();