Fix avatar size in dialogs

This commit is contained in:
Phillip Thelen 2016-01-20 15:44:40 +01:00
parent 5dbdd212ac
commit 48336c96ac
3 changed files with 15 additions and 14 deletions

View file

@ -12,8 +12,8 @@
android:layout_margin="8dp" /> android:layout_margin="8dp" />
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="@dimen/avatar_small_width"
android:layout_height="wrap_content" android:layout_height="@dimen/avatar_small_height"
android:id="@+id/avatarView" android:id="@+id/avatarView"
android:layout_gravity="center_horizontal" /> android:layout_gravity="center_horizontal" />
@ -23,7 +23,7 @@
android:id="@+id/textView4" android:id="@+id/textView4"
android:text="@string/faint_subtitle" android:text="@string/faint_subtitle"
android:textStyle="bold" android:textStyle="bold"
android:textSize="16dp" /> android:textSize="16sp" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -3,8 +3,8 @@
android:orientation="vertical" android:layout_width="match_parent" android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="@dimen/avatar_small_width"
android:layout_height="wrap_content" android:layout_height="@dimen/avatar_small_height"
android:id="@+id/avatarView" android:id="@+id/avatarView"
android:layout_gravity="center_horizontal" /> android:layout_gravity="center_horizontal" />

View file

@ -112,6 +112,7 @@ public class MainActivity extends BaseActivity implements HabitRPGUserCallback.O
private MaterialDialog faintDialog; private MaterialDialog faintDialog;
private UserPicture sideUserPicture; private UserPicture sideUserPicture;
private UserPicture dialogUserPicture;
@Override @Override
protected int getLayoutResId() { protected int getLayoutResId() {
@ -151,7 +152,9 @@ public class MainActivity extends BaseActivity implements HabitRPGUserCallback.O
drawer = MainDrawerBuilder.CreateDefaultBuilderSettings(this, toolbar, accountHeader) drawer = MainDrawerBuilder.CreateDefaultBuilderSettings(this, toolbar, accountHeader)
.build(); .build();
drawer.setSelectionAtPosition(1); drawer.setSelectionAtPosition(1);
this.sideUserPicture = new UserPicture(this, true, false); this.sideUserPicture = new UserPicture(this, true, false);
this.dialogUserPicture = new UserPicture(this, false, false);
setupCheckout(); setupCheckout();
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
@ -656,7 +659,7 @@ public class MainActivity extends BaseActivity implements HabitRPGUserCallback.O
if (this.faintDialog == null) { if (this.faintDialog == null) {
this.faintDialog = new MaterialDialog.Builder(this) this.faintDialog = new MaterialDialog.Builder(this)
.title(R.string.faint_header) .title(R.string.faint_header)
.customView(R.layout.faint_dialog, true) .customView(R.layout.dialog_faint, true)
.positiveText(R.string.faint_button) .positiveText(R.string.faint_button)
.positiveColorRes(R.color.worse_100) .positiveColorRes(R.color.worse_100)
.dismissListener(new DialogInterface.OnDismissListener() { .dismissListener(new DialogInterface.OnDismissListener() {
@ -683,9 +686,8 @@ public class MainActivity extends BaseActivity implements HabitRPGUserCallback.O
AvatarWithBarsViewModel.setHpBarData(hpBar, user.getStats(), this); AvatarWithBarsViewModel.setHpBarData(hpBar, user.getStats(), this);
ImageView avatarView = (ImageView) customView.findViewById(R.id.avatarView); ImageView avatarView = (ImageView) customView.findViewById(R.id.avatarView);
UserPicture userPicture = new UserPicture(this, false, false); this.dialogUserPicture.setUser(this.user);
userPicture.setUser(this.user); this.dialogUserPicture.setPictureOn(avatarView);
userPicture.setPictureOn(avatarView);
} }
this.faintDialog.show(); this.faintDialog.show();
@ -702,7 +704,7 @@ public class MainActivity extends BaseActivity implements HabitRPGUserCallback.O
MaterialDialog dialog = new MaterialDialog.Builder(this) MaterialDialog dialog = new MaterialDialog.Builder(this)
.title(R.string.levelup_header) .title(R.string.levelup_header)
.customView(R.layout.levelup_dialog, true) .customView(R.layout.dialog_levelup, true)
.positiveText(R.string.levelup_button) .positiveText(R.string.levelup_button)
.positiveColorRes(R.color.brand_100) .positiveColorRes(R.color.brand_100)
.build(); .build();
@ -712,9 +714,8 @@ public class MainActivity extends BaseActivity implements HabitRPGUserCallback.O
TextView detailView = (TextView) customView.findViewById(R.id.levelupDetail); TextView detailView = (TextView) customView.findViewById(R.id.levelupDetail);
detailView.setText(this.getString(R.string.levelup_detail, level)); detailView.setText(this.getString(R.string.levelup_detail, level));
ImageView avatarView = (ImageView) customView.findViewById(R.id.avatarView); ImageView avatarView = (ImageView) customView.findViewById(R.id.avatarView);
UserPicture userPicture = new UserPicture(this, false, false); this.dialogUserPicture.setUser(this.user);
userPicture.setUser(this.user); this.dialogUserPicture.setPictureOn(avatarView);
userPicture.setPictureOn(avatarView);
} }
dialog.show(); dialog.show();