From dee18bce003f0be2726db68b39205dd0b3261f3b Mon Sep 17 00:00:00 2001 From: Javier Santos Date: Wed, 15 Mar 2017 14:45:51 +0100 Subject: [PATCH] Possible fix #33 #38 Use AppCompatImageView instead of ImageView --- .../materialstyleddialogs/MaterialStyledDialog.java | 11 ++++++----- .../src/main/res/layout/style_dialog_header_icon.xml | 4 ++-- .../src/main/res/layout/style_dialog_header_title.xml | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/library/src/main/java/com/github/javiersantos/materialstyleddialogs/MaterialStyledDialog.java b/library/src/main/java/com/github/javiersantos/materialstyleddialogs/MaterialStyledDialog.java index 590fc65..7ad0000 100644 --- a/library/src/main/java/com/github/javiersantos/materialstyleddialogs/MaterialStyledDialog.java +++ b/library/src/main/java/com/github/javiersantos/materialstyleddialogs/MaterialStyledDialog.java @@ -12,6 +12,7 @@ import android.support.annotation.StringRes; import android.support.annotation.UiThread; import android.support.v4.content.res.ResourcesCompat; +import android.support.v7.widget.AppCompatImageView; import android.text.method.ScrollingMovementMethod; import android.util.Log; import android.view.LayoutInflater; @@ -119,8 +120,8 @@ private View initStyle(final Builder builder) { // Init Views RelativeLayout dialogHeaderColor = (RelativeLayout) contentView.findViewById(R.id.md_styled_header_color); - ImageView dialogHeader = (ImageView) contentView.findViewById(R.id.md_styled_header); - ImageView dialogPic = (ImageView) contentView.findViewById(R.id.md_styled_header_pic); + AppCompatImageView dialogHeader = (AppCompatImageView) contentView.findViewById(R.id.md_styled_header); + AppCompatImageView dialogPic = (AppCompatImageView) contentView.findViewById(R.id.md_styled_header_pic); TextView dialogTitle = (TextView) contentView.findViewById(R.id.md_styled_dialog_title); TextView dialogDescription = (TextView) contentView.findViewById(R.id.md_styled_dialog_description); FrameLayout dialogCustomViewGroup = (FrameLayout) contentView.findViewById(R.id.md_styled_dialog_custom_view); @@ -204,7 +205,7 @@ public static class Builder implements IBuilder { protected CharSequence title, description; // setTitle(), setDescription() protected View customView; // setCustomView() protected int customViewPaddingLeft, customViewPaddingTop, customViewPaddingRight, customViewPaddingBottom; - protected ImageView.ScaleType headerScaleType; + protected AppCompatImageView.ScaleType headerScaleType; // .setPositive(), setNegative() and setNeutral() protected CharSequence positive, negative, neutral; @@ -223,7 +224,7 @@ public Builder(Context context) { this.isScrollable = false; this.maxLines = 5; this.isAutoDismiss = true; - this.headerScaleType = ImageView.ScaleType.CENTER_CROP; + this.headerScaleType = AppCompatImageView.ScaleType.CENTER_CROP; } @Override @@ -422,7 +423,7 @@ public Builder onNeutral(@NonNull MaterialDialog.SingleButtonCallback callback) } @Override - public Builder setHeaderScaleType(ImageView.ScaleType scaleType) { + public Builder setHeaderScaleType(AppCompatImageView.ScaleType scaleType) { this.headerScaleType = scaleType; return this; } diff --git a/library/src/main/res/layout/style_dialog_header_icon.xml b/library/src/main/res/layout/style_dialog_header_icon.xml index 618a339..444e773 100644 --- a/library/src/main/res/layout/style_dialog_header_icon.xml +++ b/library/src/main/res/layout/style_dialog_header_icon.xml @@ -11,12 +11,12 @@ android:layout_width="match_parent" android:layout_height="@dimen/md_styled_dialog_header"> - - -