Skip to content

Commit

Permalink
Possible fix #33 #38 Use AppCompatImageView instead of ImageView
Browse files Browse the repository at this point in the history
  • Loading branch information
javiersantos committed Mar 15, 2017
1 parent bc41e7a commit dee18bc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions library/src/main/res/layout/style_dialog_header_icon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
android:layout_width="match_parent"
android:layout_height="@dimen/md_styled_dialog_header">

<ImageView
<android.support.v7.widget.AppCompatImageView
android:id="@+id/md_styled_header"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<ImageView
<android.support.v7.widget.AppCompatImageView
android:id="@+id/md_styled_header_pic"
android:layout_width="@dimen/md_styled_pic_size"
android:layout_height="@dimen/md_styled_pic_size"
Expand Down
2 changes: 1 addition & 1 deletion library/src/main/res/layout/style_dialog_header_title.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
android:layout_width="match_parent"
android:layout_height="@dimen/md_styled_dialog_header">

<ImageView
<android.support.v7.widget.AppCompatImageView
android:id="@+id/md_styled_header"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down

0 comments on commit dee18bc

Please sign in to comment.