Browse Source

Material background on all Android versions, MD widgets deleted and methods moved into MDTintHelper;
More specifically, now extends Dialog instead of AlertDialog (for theming purposes)

plusCubed 10 năm trước cách đây
mục cha
commit
a9ba7525cd
30 tập tin đã thay đổi với 490 bổ sung341 xóa
  1. 2 2
      library/src/main/AndroidManifest.xml
  2. 5 58
      library/src/main/java/com/afollestad/materialdialogs/DialogBase.java
  3. 14 25
      library/src/main/java/com/afollestad/materialdialogs/DialogInit.java
  4. 5 5
      library/src/main/java/com/afollestad/materialdialogs/DialogWrapper.java
  5. 24 37
      library/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java
  6. 7 6
      library/src/main/java/com/afollestad/materialdialogs/MaterialDialogAdapter.java
  7. 243 0
      library/src/main/java/com/afollestad/materialdialogs/internal/DrawableWrapper.java
  8. 0 46
      library/src/main/java/com/afollestad/materialdialogs/internal/MDCheckBox.java
  9. 0 40
      library/src/main/java/com/afollestad/materialdialogs/internal/MDEditText.java
  10. 0 46
      library/src/main/java/com/afollestad/materialdialogs/internal/MDProgressBar.java
  11. 0 46
      library/src/main/java/com/afollestad/materialdialogs/internal/MDRadioButton.java
  12. 78 0
      library/src/main/java/com/afollestad/materialdialogs/internal/MDTintHelper.java
  13. 3 0
      library/src/main/res/anim/decelerate_cubic.xml
  14. 9 0
      library/src/main/res/anim/popup_enter.xml
  15. 9 0
      library/src/main/res/anim/popup_exit.xml
  16. 3 2
      library/src/main/res/drawable-v21/md_btn_selector_ripple.xml
  17. 3 2
      library/src/main/res/drawable-v21/md_btn_selector_ripple_dark.xml
  18. 25 0
      library/src/main/res/drawable/md_dialog_background.xml
  19. 25 0
      library/src/main/res/drawable/md_dialog_background_dark.xml
  20. 1 1
      library/src/main/res/layout-ldrtl/md_listitem_multichoice.xml
  21. 1 1
      library/src/main/res/layout-ldrtl/md_listitem_singlechoice.xml
  22. 1 1
      library/src/main/res/layout/md_dialog_input.xml
  23. 1 1
      library/src/main/res/layout/md_listitem_multichoice.xml
  24. 1 1
      library/src/main/res/layout/md_listitem_singlechoice.xml
  25. 3 6
      library/src/main/res/layout/md_stub_actionbuttons.xml
  26. 1 1
      library/src/main/res/layout/md_stub_progress.xml
  27. 1 1
      library/src/main/res/layout/md_stub_progress_indeterminate.xml
  28. 10 2
      library/src/main/res/values-v11/styles.xml
  29. 6 0
      library/src/main/res/values-v21/styles.xml
  30. 9 11
      library/src/main/res/values/styles.xml

+ 2 - 2
library/src/main/AndroidManifest.xml

@@ -1,5 +1,5 @@
 <manifest package="com.afollestad.materialdialogs">
- 
-    <application />
+
+<application />
 
 </manifest>

+ 5 - 58
library/src/main/java/com/afollestad/materialdialogs/DialogBase.java

@@ -1,72 +1,19 @@
 package com.afollestad.materialdialogs;
 
-import android.app.AlertDialog;
+import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
-import android.os.Message;
-import android.view.ContextThemeWrapper;
 import android.view.View;
 
 /**
  * @author Aidan Follestad (afollestad)
  */
-class DialogBase extends AlertDialog implements DialogInterface.OnShowListener {
+class DialogBase extends Dialog implements DialogInterface.OnShowListener {
 
     private OnShowListener mShowListener;
-    protected ContextThemeWrapper mThemedContext;
 
-    protected DialogBase(ContextThemeWrapper context) {
-        super(context);
-        mThemedContext = context;
-    }
-
-    public final Context getThemedContext() {
-        return mThemedContext;
-    }
-
-    /**
-     * @deprecated Not supported by the Material dialog.
-     */
-    @Deprecated
-    @Override
-    public void setView(View view) {
-        throw new RuntimeException("This method is not supported by the MaterialDialog.");
-    }
-
-    /**
-     * @deprecated Not supported by the Material dialog.
-     */
-    @Deprecated
-    @Override
-    public void setView(View view, int viewSpacingLeft, int viewSpacingTop, int viewSpacingRight, int viewSpacingBottom) {
-        throw new RuntimeException("This method is not supported by the MaterialDialog.");
-    }
-
-    /**
-     * @deprecated Not supported by the Material dialog.
-     */
-    @Deprecated
-    @Override
-    public void setCustomTitle(View customTitleView) {
-        throw new RuntimeException("This method is not supported by the MaterialDialog.");
-    }
-
-    /**
-     * @deprecated Not supported by the Material dialog.
-     */
-    @Deprecated
-    @Override
-    public void setButton(int whichButton, CharSequence text, Message msg) {
-        throw new RuntimeException("Use setActionButton(MaterialDialog.Button, CharSequence) instead.");
-    }
-
-    /**
-     * @deprecated Not supported by the Material dialog.
-     */
-    @Deprecated
-    @Override
-    public void setButton(int whichButton, CharSequence text, OnClickListener listener) {
-        throw new RuntimeException("Use setActionButton(MaterialDialog.Button, CharSequence) instead.");
+    protected DialogBase(Context context, int theme) {
+        super(context, theme);
     }
 
     @Override
@@ -79,7 +26,7 @@ class DialogBase extends AlertDialog implements DialogInterface.OnShowListener {
     }
 
     protected final void setViewInternal(View view) {
-        super.setView(view);
+        setContentView(view);
     }
 
     @Override

+ 14 - 25
library/src/main/java/com/afollestad/materialdialogs/DialogInit.java

@@ -3,23 +3,21 @@ package com.afollestad.materialdialogs;
 import android.content.Context;
 import android.content.res.ColorStateList;
 import android.content.res.Resources;
-import android.graphics.Color;
 import android.graphics.drawable.Drawable;
 import android.os.Build;
 import android.text.method.LinkMovementMethod;
-import android.view.ContextThemeWrapper;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.EditText;
 import android.widget.FrameLayout;
 import android.widget.ImageView;
 import android.widget.ListView;
+import android.widget.ProgressBar;
 import android.widget.ScrollView;
 import android.widget.TextView;
 
 import com.afollestad.materialdialogs.internal.MDButton;
-import com.afollestad.materialdialogs.internal.MDEditText;
-import com.afollestad.materialdialogs.internal.MDProgressBar;
+import com.afollestad.materialdialogs.internal.MDTintHelper;
 import com.afollestad.materialdialogs.util.DialogUtils;
 import com.afollestad.materialdialogs.util.TypefaceHelper;
 
@@ -34,13 +32,13 @@ import java.util.Arrays;
  */
 class DialogInit {
 
-    public static ContextThemeWrapper getTheme(MaterialDialog.Builder builder) {
+    public static int getTheme(MaterialDialog.Builder builder) {
         boolean darkTheme = builder.theme == Theme.DARK;
         if (!darkTheme) {
             darkTheme = DialogUtils.resolveBoolean(builder.context, R.attr.md_dark_theme, false);
             builder.theme = darkTheme ? Theme.DARK : Theme.LIGHT;
         }
-        return new ContextThemeWrapper(builder.context, darkTheme ? R.style.MD_Dark : R.style.MD_Light);
+        return darkTheme ? R.style.MD_Dark : R.style.MD_Light;
     }
 
     public static int getInflateLayout(MaterialDialog.Builder builder) {
@@ -65,9 +63,9 @@ class DialogInit {
         // Check if default library fonts should be used
         if (!builder.useCustomFonts) {
             if (builder.mediumFont == null)
-                builder.mediumFont = TypefaceHelper.get(dialog.getThemedContext(), "Roboto-Medium");
+                builder.mediumFont = TypefaceHelper.get(dialog.getContext(), "Roboto-Medium");
             if (builder.regularFont == null)
-                builder.regularFont = TypefaceHelper.get(dialog.getThemedContext(), "Roboto-Regular");
+                builder.regularFont = TypefaceHelper.get(dialog.getContext(), "Roboto-Regular");
         }
 
         // Set cancelable flag and dialog background color
@@ -159,7 +157,7 @@ class DialogInit {
         }
 
         // Setup divider color in case content scrolls
-        final int dividerFallback = DialogUtils.resolveColor(dialog.getThemedContext(), R.attr.md_divider);
+        final int dividerFallback = DialogUtils.resolveColor(dialog.getContext(), R.attr.md_divider);
         builder.dividerColor = DialogUtils.resolveColor(builder.context, R.attr.md_divider_color, dividerFallback);
         dialog.view.setDividerColor(builder.dividerColor);
 
@@ -184,7 +182,7 @@ class DialogInit {
             dialog.setTypeface(dialog.content, builder.regularFont);
             dialog.content.setLineSpacing(0f, builder.contentLineSpacingMultiplier);
             if (builder.positiveColor == 0) {
-                dialog.content.setLinkTextColor(DialogUtils.resolveColor(dialog.getThemedContext(), android.R.attr.textColorPrimary));
+                dialog.content.setLinkTextColor(DialogUtils.resolveColor(dialog.getContext(), android.R.attr.textColorPrimary));
             } else {
                 dialog.content.setLinkTextColor(builder.positiveColor);
             }
@@ -289,9 +287,9 @@ class DialogInit {
             if (builder.wrapCustomViewInScroll) {
                 /* Apply the frame padding to the content, this allows the ScrollView to draw it's
                    over scroll glow without clipping */
-                final Resources r = dialog.getThemedContext().getResources();
+                final Resources r = dialog.getContext().getResources();
                 final int framePadding = r.getDimensionPixelSize(R.dimen.md_dialog_frame_margin);
-                final ScrollView sv = new ScrollView(dialog.getThemedContext());
+                final ScrollView sv = new ScrollView(dialog.getContext());
                 int paddingTop = r.getDimensionPixelSize(R.dimen.md_content_padding_top);
                 int paddingBottom = r.getDimensionPixelSize(R.dimen.md_content_padding_bottom);
                 sv.setClipToPadding(false);
@@ -329,23 +327,14 @@ class DialogInit {
         dialog.invalidateList();
         dialog.setViewInternal(dialog.view);
         dialog.checkIfListInitScroll();
-
-        // API 10 compatibility stuff
-        if (builder.theme == Theme.LIGHT && Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
-            dialog.setInverseBackgroundForced(true);
-//            if (!builder.titleColorSet)
-//                title.setTextColor(Color.BLACK);
-//            if (!builder.contentColorSet)
-//                content.setTextColor(Color.BLACK);
-        }
     }
 
     private static void setupProgressDialog(final MaterialDialog dialog) {
         final MaterialDialog.Builder builder = dialog.mBuilder;
         if (builder.indeterminateProgress || builder.progress > -2) {
-            dialog.mProgress = (MDProgressBar) dialog.view.findViewById(android.R.id.progress);
+            dialog.mProgress = (ProgressBar) dialog.view.findViewById(android.R.id.progress);
             if (dialog.mProgress == null) return;
-            dialog.mProgress.setColorFilter(builder.widgetColor);
+            MDTintHelper.setProgressBarTint(dialog.mProgress, builder.widgetColor);
 
             if (!builder.indeterminateProgress) {
                 dialog.mProgress.setProgress(0);
@@ -368,13 +357,13 @@ class DialogInit {
 
     private static void setupInputDialog(final MaterialDialog dialog) {
         final MaterialDialog.Builder builder = dialog.mBuilder;
-        dialog.input = (MDEditText) dialog.view.findViewById(android.R.id.input);
+        dialog.input = (EditText) dialog.view.findViewById(android.R.id.input);
         if (dialog.input == null) return;
         if (builder.inputPrefill != null)
             dialog.input.append(builder.inputPrefill);
         dialog.input.setHint(builder.inputHint);
         dialog.input.setSingleLine();
-        dialog.input.setColorFilter(dialog.mBuilder.widgetColor);
+        MDTintHelper.setEditTextTint(dialog.input, dialog.mBuilder.widgetColor);
     }
 
     private static ColorStateList getActionTextStateList(Context context, int newPrimaryColor) {

+ 5 - 5
library/src/main/java/com/afollestad/materialdialogs/AlertDialogWrapper.java → library/src/main/java/com/afollestad/materialdialogs/DialogWrapper.java

@@ -1,6 +1,6 @@
 package com.afollestad.materialdialogs;
 
-import android.app.AlertDialog;
+import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.graphics.drawable.Drawable;
@@ -20,7 +20,7 @@ import java.util.List;
 /**
  * Convenience class for migrating old dialogs code. Not all methods are implemented yet. Using MaterialDialog.Builder directly is recommended.
  */
-public class AlertDialogWrapper {
+public class DialogWrapper {
 
     public static class Builder {
 
@@ -160,14 +160,14 @@ public class AlertDialogWrapper {
             return this;
         }
 
-        public AlertDialog create() {
+        public Dialog create() {
             addButtonsCallback();
             addListCallbacks();
             return builder.build();
         }
 
-        public AlertDialog show() {
-            AlertDialog dialog = create();
+        public Dialog show() {
+            Dialog dialog = create();
             dialog.show();
             return dialog;
         }

+ 24 - 37
library/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java

@@ -1,7 +1,6 @@
 package com.afollestad.materialdialogs;
 
 import android.annotation.SuppressLint;
-import android.app.AlertDialog;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.graphics.Paint;
@@ -20,13 +19,11 @@ import android.support.annotation.Nullable;
 import android.support.annotation.StringRes;
 import android.support.v4.content.res.ResourcesCompat;
 import android.text.TextUtils;
-import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewTreeObserver;
 import android.view.WindowManager;
 import android.widget.AdapterView;
-import android.widget.Button;
 import android.widget.CheckBox;
 import android.widget.EditText;
 import android.widget.FrameLayout;
@@ -34,11 +31,10 @@ import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.ListAdapter;
 import android.widget.ListView;
+import android.widget.ProgressBar;
 import android.widget.TextView;
 
 import com.afollestad.materialdialogs.internal.MDButton;
-import com.afollestad.materialdialogs.internal.MDEditText;
-import com.afollestad.materialdialogs.internal.MDProgressBar;
 import com.afollestad.materialdialogs.internal.MDRootLayout;
 import com.afollestad.materialdialogs.util.DialogUtils;
 import com.afollestad.materialdialogs.util.TypefaceHelper;
@@ -61,11 +57,11 @@ public class MaterialDialog extends DialogBase implements
     protected TextView title;
     protected View titleFrame;
     protected FrameLayout customViewFrame;
-    protected MDProgressBar mProgress;
+    protected ProgressBar mProgress;
     protected TextView mProgressLabel;
     protected TextView mProgressMinMax;
     protected TextView content;
-    protected MDEditText input;
+    protected EditText input;
 
     protected MDButton positiveButton;
     protected MDButton neutralButton;
@@ -75,9 +71,9 @@ public class MaterialDialog extends DialogBase implements
 
     @SuppressLint("InflateParams")
     protected MaterialDialog(Builder builder) {
-        super(DialogInit.getTheme(builder));
+        super(builder.context, DialogInit.getTheme(builder));
         mBuilder = builder;
-        final LayoutInflater inflater = LayoutInflater.from(getThemedContext());
+        final LayoutInflater inflater = LayoutInflater.from(getContext());
         view = (MDRootLayout) inflater.inflate(DialogInit.getInflateLayout(builder), null);
         DialogInit.init(this);
     }
@@ -234,7 +230,7 @@ public class MaterialDialog extends DialogBase implements
             return ResourcesCompat.getDrawable(mBuilder.context.getResources(), mBuilder.listSelector, null);
         final Drawable d = DialogUtils.resolveDrawable(mBuilder.context, R.attr.md_list_selector);
         if (d != null) return d;
-        return DialogUtils.resolveDrawable(getThemedContext(), R.attr.md_list_selector);
+        return DialogUtils.resolveDrawable(getContext(), R.attr.md_list_selector);
     }
 
     /* package */ Drawable getButtonSelector(DialogAction which, boolean isStacked) {
@@ -243,7 +239,7 @@ public class MaterialDialog extends DialogBase implements
                 return ResourcesCompat.getDrawable(mBuilder.context.getResources(), mBuilder.btnSelectorStacked, null);
             final Drawable d = DialogUtils.resolveDrawable(mBuilder.context, R.attr.md_btn_stacked_selector);
             if (d != null) return d;
-            return DialogUtils.resolveDrawable(getThemedContext(), R.attr.md_btn_stacked_selector);
+            return DialogUtils.resolveDrawable(getContext(), R.attr.md_btn_stacked_selector);
         } else {
             switch (which) {
                 default: {
@@ -251,21 +247,21 @@ public class MaterialDialog extends DialogBase implements
                         return ResourcesCompat.getDrawable(mBuilder.context.getResources(), mBuilder.btnSelectorPositive, null);
                     final Drawable d = DialogUtils.resolveDrawable(mBuilder.context, R.attr.md_btn_positive_selector);
                     if (d != null) return d;
-                    return DialogUtils.resolveDrawable(getThemedContext(), R.attr.md_btn_positive_selector);
+                    return DialogUtils.resolveDrawable(getContext(), R.attr.md_btn_positive_selector);
                 }
                 case NEUTRAL: {
                     if (mBuilder.btnSelectorNeutral != 0)
                         return ResourcesCompat.getDrawable(mBuilder.context.getResources(), mBuilder.btnSelectorNeutral, null);
                     final Drawable d = DialogUtils.resolveDrawable(mBuilder.context, R.attr.md_btn_neutral_selector);
                     if (d != null) return d;
-                    return DialogUtils.resolveDrawable(getThemedContext(), R.attr.md_btn_neutral_selector);
+                    return DialogUtils.resolveDrawable(getContext(), R.attr.md_btn_neutral_selector);
                 }
                 case NEGATIVE: {
                     if (mBuilder.btnSelectorNegative != 0)
                         return ResourcesCompat.getDrawable(mBuilder.context.getResources(), mBuilder.btnSelectorNegative, null);
                     final Drawable d = DialogUtils.resolveDrawable(mBuilder.context, R.attr.md_btn_negative_selector);
                     if (d != null) return d;
-                    return DialogUtils.resolveDrawable(getThemedContext(), R.attr.md_btn_negative_selector);
+                    return DialogUtils.resolveDrawable(getContext(), R.attr.md_btn_negative_selector);
                 }
             }
         }
@@ -406,19 +402,15 @@ public class MaterialDialog extends DialogBase implements
             final int materialBlue = context.getResources().getColor(R.color.md_material_blue_600);
 
             // Retrieve default accent colors, which are used on the action buttons and progress bars
+            this.widgetColor = DialogUtils.resolveColor(context, R.attr.colorAccent, materialBlue);
             if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
-                final int fallback = DialogUtils.resolveColor(context, R.attr.colorAccent, materialBlue);
-                this.widgetColor = DialogUtils.resolveColor(context, android.R.attr.colorAccent, fallback);
-                this.positiveColor = this.widgetColor;
-                this.negativeColor = this.widgetColor;
-                this.neutralColor = this.widgetColor;
-            } else {
-                this.widgetColor = DialogUtils.resolveColor(context, R.attr.colorAccent, materialBlue);
-                this.positiveColor = this.widgetColor;
-                this.negativeColor = this.widgetColor;
-                this.neutralColor = this.widgetColor;
+                this.widgetColor = DialogUtils.resolveColor(context, android.R.attr.colorAccent, this.widgetColor);
             }
 
+            this.positiveColor = this.widgetColor;
+            this.negativeColor = this.widgetColor;
+            this.neutralColor = this.widgetColor;
+
             // Set the default theme based on the Activity theme's primary color darkness (more white or more black)
             final int primaryTextColor = DialogUtils.resolveColor(context, android.R.attr.textColorPrimary);
             this.theme = DialogUtils.isColorDark(primaryTextColor) ? Theme.LIGHT : Theme.DARK;
@@ -1029,26 +1021,26 @@ public class MaterialDialog extends DialogBase implements
                 return view.findViewById(R.id.buttonDefaultNegative);
         }
     }
-
-    /**
+/*
+    *//**
      * This will not return buttons that are actually in the layout itself, since the layout doesn't
      * contain buttons. This is only implemented to avoid crashing issues on Huawei devices. Huawei's
      * stock OS requires this method in order to detect visible buttons.
      *
      * @deprecated Use getActionButton(com.afollestad.materialdialogs.DialogAction)} instead.
-     */
+     *//*
     @Deprecated
     @Override
     public Button getButton(int whichButton) {
         Log.w("MaterialDialog", "Warning: getButton() is a deprecated method that does not return valid references to action buttons.");
         if (whichButton == AlertDialog.BUTTON_POSITIVE) {
-            return mBuilder.positiveText != null ? new Button(getThemedContext()) : null;
+            return mBuilder.positiveText != null ? new Button(getContext()) : null;
         } else if (whichButton == AlertDialog.BUTTON_NEUTRAL) {
-            return mBuilder.neutralText != null ? new Button(getThemedContext()) : null;
+            return mBuilder.neutralText != null ? new Button(getContext()) : null;
         } else {
-            return mBuilder.negativeText != null ? new Button(getThemedContext()) : null;
+            return mBuilder.negativeText != null ? new Button(getContext()) : null;
         }
-    }
+    }*/
 
     /**
      * Retrieves the view representing the dialog as a whole. Be careful with this.
@@ -1058,7 +1050,6 @@ public class MaterialDialog extends DialogBase implements
     }
 
     @Nullable
-    @Override
     public final ListView getListView() {
         return listView;
     }
@@ -1129,7 +1120,7 @@ public class MaterialDialog extends DialogBase implements
      * @param titleRes The string resource of the new title of the action button.
      */
     public final void setActionButton(DialogAction which, @StringRes int titleRes) {
-        setActionButton(which, getThemedContext().getString(titleRes));
+        setActionButton(which, getContext().getString(titleRes));
     }
 
     /**
@@ -1164,19 +1155,16 @@ public class MaterialDialog extends DialogBase implements
         this.title.setText(title);
     }
 
-    @Override
     public void setIcon(@DrawableRes int resId) {
         icon.setImageResource(resId);
         icon.setVisibility(resId != 0 ? View.VISIBLE : View.GONE);
     }
 
-    @Override
     public void setIcon(Drawable d) {
         icon.setImageDrawable(d);
         icon.setVisibility(d != null ? View.VISIBLE : View.GONE);
     }
 
-    @Override
     public void setIconAttribute(@AttrRes int attrId) {
         Drawable d = DialogUtils.resolveDrawable(mBuilder.context, attrId);
         icon.setImageDrawable(d);
@@ -1192,7 +1180,6 @@ public class MaterialDialog extends DialogBase implements
      * @deprecated Use setContent() instead.
      */
     @Deprecated
-    @Override
     public void setMessage(CharSequence message) {
         setContent(message);
     }

+ 7 - 6
library/src/main/java/com/afollestad/materialdialogs/MaterialDialogAdapter.java

@@ -8,12 +8,13 @@ import android.view.Gravity;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ArrayAdapter;
+import android.widget.CheckBox;
 import android.widget.CompoundButton;
 import android.widget.LinearLayout;
+import android.widget.RadioButton;
 import android.widget.TextView;
 
-import com.afollestad.materialdialogs.internal.MDCheckBox;
-import com.afollestad.materialdialogs.internal.MDRadioButton;
+import com.afollestad.materialdialogs.internal.MDTintHelper;
 
 class MaterialDialogAdapter extends ArrayAdapter<CharSequence> {
 
@@ -44,17 +45,17 @@ class MaterialDialogAdapter extends ArrayAdapter<CharSequence> {
         switch (dialog.listType) {
             case SINGLE: {
                 @SuppressLint("CutPasteId")
-                MDRadioButton radio = (MDRadioButton) view.findViewById(R.id.control);
+                RadioButton radio = (RadioButton) view.findViewById(R.id.control);
                 boolean selected = dialog.mBuilder.selectedIndex == index;
-                radio.setColorFilter(dialog.mBuilder.widgetColor);
+                MDTintHelper.setRadioButtonTint(radio, dialog.mBuilder.widgetColor);
                 radio.setChecked(selected);
                 break;
             }
             case MULTI: {
                 @SuppressLint("CutPasteId")
-                MDCheckBox checkbox = (MDCheckBox) view.findViewById(R.id.control);
+                CheckBox checkbox = (CheckBox) view.findViewById(R.id.control);
                 boolean selected = dialog.selectedIndicesList.contains(index);
-                checkbox.setColorFilter(dialog.mBuilder.widgetColor);
+                MDTintHelper.setCheckBoxTint(checkbox, dialog.mBuilder.widgetColor);
                 checkbox.setChecked(selected);
                 break;
             }

+ 243 - 0
library/src/main/java/com/afollestad/materialdialogs/internal/DrawableWrapper.java

@@ -0,0 +1,243 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.afollestad.materialdialogs.internal;
+
+import android.content.res.ColorStateList;
+import android.graphics.Canvas;
+import android.graphics.ColorFilter;
+import android.graphics.PorterDuff;
+import android.graphics.Rect;
+import android.graphics.Region;
+import android.graphics.drawable.Drawable;
+
+/**
+ * Drawable which delegates all calls to it's wrapped {@link Drawable}.
+ * <p/>
+ * Also allows backward compatible tinting via a color or {@link ColorStateList}.
+ * This functionality is accessed via static methods in {@code DrawableCompat}.
+ * <p/>
+ * Taken from the support-v4 22 sources, originally DrawableWrapperDonut.java.
+ */
+class DrawableWrapper extends Drawable implements Drawable.Callback {
+
+    static final PorterDuff.Mode DEFAULT_MODE = PorterDuff.Mode.SRC_IN;
+
+    private ColorStateList mTintList;
+    private PorterDuff.Mode mTintMode = DEFAULT_MODE;
+
+    private int mCurrentColor = Integer.MIN_VALUE;
+
+    Drawable mDrawable;
+
+    DrawableWrapper(Drawable drawable) {
+        setWrappedDrawable(drawable);
+    }
+
+    @Override
+    public void draw(Canvas canvas) {
+        mDrawable.draw(canvas);
+    }
+
+    @Override
+    protected void onBoundsChange(Rect bounds) {
+        mDrawable.setBounds(bounds);
+    }
+
+    @Override
+    public void setChangingConfigurations(int configs) {
+        mDrawable.setChangingConfigurations(configs);
+    }
+
+    @Override
+    public int getChangingConfigurations() {
+        return mDrawable.getChangingConfigurations();
+    }
+
+    @Override
+    public void setDither(boolean dither) {
+        mDrawable.setDither(dither);
+    }
+
+    @Override
+    public void setFilterBitmap(boolean filter) {
+        mDrawable.setFilterBitmap(filter);
+    }
+
+    @Override
+    public void setAlpha(int alpha) {
+        mDrawable.setAlpha(alpha);
+    }
+
+    @Override
+    public void setColorFilter(ColorFilter cf) {
+        mDrawable.setColorFilter(cf);
+    }
+
+    @Override
+    public boolean isStateful() {
+        return (mTintList != null && mTintList.isStateful()) || mDrawable.isStateful();
+    }
+
+    @Override
+    public boolean setState(final int[] stateSet) {
+        boolean handled = mDrawable.setState(stateSet);
+        handled = updateTint(stateSet) || handled;
+        return handled;
+    }
+
+    @Override
+    public int[] getState() {
+        return mDrawable.getState();
+    }
+
+    @Override
+    public Drawable getCurrent() {
+        return mDrawable.getCurrent();
+    }
+
+    @Override
+    public boolean setVisible(boolean visible, boolean restart) {
+        return super.setVisible(visible, restart) || mDrawable.setVisible(visible, restart);
+    }
+
+    @Override
+    public int getOpacity() {
+        return mDrawable.getOpacity();
+    }
+
+    @Override
+    public Region getTransparentRegion() {
+        return mDrawable.getTransparentRegion();
+    }
+
+    @Override
+    public int getIntrinsicWidth() {
+        return mDrawable.getIntrinsicWidth();
+    }
+
+    @Override
+    public int getIntrinsicHeight() {
+        return mDrawable.getIntrinsicHeight();
+    }
+
+    @Override
+    public int getMinimumWidth() {
+        return mDrawable.getMinimumWidth();
+    }
+
+    @Override
+    public int getMinimumHeight() {
+        return mDrawable.getMinimumHeight();
+    }
+
+    @Override
+    public boolean getPadding(Rect padding) {
+        return mDrawable.getPadding(padding);
+    }
+
+    @Override
+    public Drawable mutate() {
+        Drawable wrapped = mDrawable;
+        Drawable mutated = wrapped.mutate();
+        if (mutated != wrapped) {
+            // If mutate() returned a new instance, update our reference
+            setWrappedDrawable(mutated);
+        }
+        // We return ourselves, since only the wrapped drawable needs to mutate
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void invalidateDrawable(Drawable who) {
+        invalidateSelf();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void scheduleDrawable(Drawable who, Runnable what, long when) {
+        scheduleSelf(what, when);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void unscheduleDrawable(Drawable who, Runnable what) {
+        unscheduleSelf(what);
+    }
+
+    @Override
+    protected boolean onLevelChange(int level) {
+        return mDrawable.setLevel(level);
+    }
+
+    @Override
+    public void setTint(int tint) {
+        setTintList(ColorStateList.valueOf(tint));
+    }
+
+    @Override
+    public void setTintList(ColorStateList tint) {
+        mTintList = tint;
+        updateTint(getState());
+    }
+
+    @Override
+    public void setTintMode(PorterDuff.Mode tintMode) {
+        mTintMode = tintMode;
+        updateTint(getState());
+    }
+
+    private boolean updateTint(int[] state) {
+        if (mTintList != null && mTintMode != null) {
+            final int color = mTintList.getColorForState(state, mTintList.getDefaultColor());
+            if (color != mCurrentColor) {
+                setColorFilter(color, mTintMode);
+                mCurrentColor = color;
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Returns the wrapped {@link Drawable}
+     */
+    public Drawable getWrappedDrawable() {
+        return mDrawable;
+    }
+
+    /**
+     * Sets the current wrapped {@link Drawable}
+     */
+    public void setWrappedDrawable(Drawable drawable) {
+        if (mDrawable != null) {
+            mDrawable.setCallback(null);
+        }
+
+        mDrawable = drawable;
+
+        if (drawable != null) {
+            drawable.setCallback(this);
+        }
+        // Invalidate ourselves
+        invalidateSelf();
+    }
+}

+ 0 - 46
library/src/main/java/com/afollestad/materialdialogs/internal/MDCheckBox.java

@@ -1,46 +0,0 @@
-package com.afollestad.materialdialogs.internal;
-
-import android.annotation.TargetApi;
-import android.content.Context;
-import android.content.res.ColorStateList;
-import android.os.Build;
-import android.util.AttributeSet;
-import android.widget.CheckBox;
-
-import com.afollestad.materialdialogs.util.DialogUtils;
-
-/**
- * @author Aidan Follestad (afollestad)
- */
-public class MDCheckBox extends CheckBox {
-
-    public MDCheckBox(Context context) {
-        super(context);
-    }
-
-    public MDCheckBox(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public MDCheckBox(Context context, AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-    }
-
-    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
-    public MDCheckBox(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
-        super(context, attrs, defStyleAttr, defStyleRes);
-    }
-
-    public void setColorFilter(int color) {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
-            ColorStateList sl = new ColorStateList(new int[][]{
-                    new int[]{-android.R.attr.state_checked},
-                    new int[]{android.R.attr.state_checked}
-            }, new int[]{
-                    DialogUtils.resolveColor(getContext(), android.R.attr.textColorSecondary),
-                    color
-            });
-            setButtonTintList(sl);
-        }
-    }
-}

+ 0 - 40
library/src/main/java/com/afollestad/materialdialogs/internal/MDEditText.java

@@ -1,40 +0,0 @@
-package com.afollestad.materialdialogs.internal;
-
-import android.annotation.TargetApi;
-import android.content.Context;
-import android.content.res.ColorStateList;
-import android.graphics.PorterDuff;
-import android.os.Build;
-import android.util.AttributeSet;
-import android.widget.EditText;
-
-/**
- * @author Aidan Follestad (afollestad)
- */
-public class MDEditText extends EditText {
-
-    public MDEditText(Context context) {
-        super(context);
-    }
-
-    public MDEditText(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public MDEditText(Context context, AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-    }
-
-    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
-    public MDEditText(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
-        super(context, attrs, defStyleAttr, defStyleRes);
-    }
-
-    public void setColorFilter(int color) {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
-            setBackgroundTintList(ColorStateList.valueOf(color));
-        } else {
-            getBackground().setColorFilter(color, PorterDuff.Mode.SRC_IN);
-        }
-    }
-}

+ 0 - 46
library/src/main/java/com/afollestad/materialdialogs/internal/MDProgressBar.java

@@ -1,46 +0,0 @@
-package com.afollestad.materialdialogs.internal;
-
-import android.annotation.TargetApi;
-import android.content.Context;
-import android.content.res.ColorStateList;
-import android.graphics.PorterDuff;
-import android.os.Build;
-import android.util.AttributeSet;
-import android.widget.ProgressBar;
-
-/**
- * @author Aidan Follestad (afollestad)
- */
-public class MDProgressBar extends ProgressBar {
-
-    public MDProgressBar(Context context) {
-        super(context);
-    }
-
-    public MDProgressBar(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public MDProgressBar(Context context, AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-    }
-
-    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
-    public MDProgressBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
-        super(context, attrs, defStyleAttr, defStyleRes);
-    }
-
-    public void setColorFilter(int color) {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
-            ColorStateList stateList = ColorStateList.valueOf(color);
-            setProgressTintList(stateList);
-            setSecondaryProgressTintList(stateList);
-            setIndeterminateTintList(stateList);
-        } else {
-            if (getIndeterminateDrawable() != null)
-                getIndeterminateDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
-            if (getProgressDrawable() != null)
-                getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
-        }
-    }
-}

+ 0 - 46
library/src/main/java/com/afollestad/materialdialogs/internal/MDRadioButton.java

@@ -1,46 +0,0 @@
-package com.afollestad.materialdialogs.internal;
-
-import android.annotation.TargetApi;
-import android.content.Context;
-import android.content.res.ColorStateList;
-import android.os.Build;
-import android.util.AttributeSet;
-import android.widget.RadioButton;
-
-import com.afollestad.materialdialogs.util.DialogUtils;
-
-/**
- * @author Aidan Follestad (afollestad)
- */
-public class MDRadioButton extends RadioButton {
-
-    public MDRadioButton(Context context) {
-        super(context);
-    }
-
-    public MDRadioButton(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public MDRadioButton(Context context, AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-    }
-
-    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
-    public MDRadioButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
-        super(context, attrs, defStyleAttr, defStyleRes);
-    }
-
-    public void setColorFilter(int color) {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
-            ColorStateList sl = new ColorStateList(new int[][]{
-                    new int[]{-android.R.attr.state_checked},
-                    new int[]{android.R.attr.state_checked}
-            }, new int[]{
-                    DialogUtils.resolveColor(getContext(), android.R.attr.textColorSecondary),
-                    color
-            });
-            setButtonTintList(sl);
-        }
-    }
-}

+ 78 - 0
library/src/main/java/com/afollestad/materialdialogs/internal/MDTintHelper.java

@@ -0,0 +1,78 @@
+package com.afollestad.materialdialogs.internal;
+
+import android.content.res.ColorStateList;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.Build;
+import android.support.v4.content.ContextCompat;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.ProgressBar;
+import android.widget.RadioButton;
+
+import com.afollestad.materialdialogs.R;
+import com.afollestad.materialdialogs.util.DialogUtils;
+
+/**
+ * Tints widgets
+ */
+public class MDTintHelper {
+
+    public static void setRadioButtonTint(RadioButton radioButton, int color) {
+        ColorStateList sl = new ColorStateList(new int[][]{
+                new int[]{-android.R.attr.state_checked},
+                new int[]{android.R.attr.state_checked}
+        }, new int[]{
+                DialogUtils.resolveColor(radioButton.getContext(), android.R.attr.textColorSecondary),
+                color
+        });
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+            radioButton.setButtonTintList(sl);
+        } else {
+            Drawable drawable = ContextCompat.getDrawable(radioButton.getContext(), R.drawable.abc_btn_radio_material);
+            DrawableWrapper d = new DrawableWrapper(drawable);
+            d.setTintList(sl);
+            radioButton.setButtonDrawable(d);
+        }
+    }
+
+    public static void setProgressBarTint(ProgressBar progressBar, int color) {
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+            ColorStateList stateList = ColorStateList.valueOf(color);
+            progressBar.setProgressTintList(stateList);
+            progressBar.setSecondaryProgressTintList(stateList);
+            progressBar.setIndeterminateTintList(stateList);
+        } else {
+            if (progressBar.getIndeterminateDrawable() != null)
+                progressBar.getIndeterminateDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
+            if (progressBar.getProgressDrawable() != null)
+                progressBar.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
+        }
+    }
+
+    public static void setEditTextTint(EditText editText, int color) {
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+            editText.setBackgroundTintList(ColorStateList.valueOf(color));
+        } else {
+            editText.getBackground().setColorFilter(color, PorterDuff.Mode.SRC_IN);
+        }
+    }
+
+    public static void setCheckBoxTint(CheckBox box, int color) {
+        ColorStateList sl = new ColorStateList(new int[][]{
+                new int[]{-android.R.attr.state_checked},
+                new int[]{android.R.attr.state_checked}
+        }, new int[]{
+                DialogUtils.resolveColor(box.getContext(), android.R.attr.textColorSecondary),
+                color
+        });
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+            box.setButtonTintList(sl);
+        } else {
+            Drawable drawable = ContextCompat.getDrawable(box.getContext(), R.drawable.abc_btn_check_material);
+            DrawableWrapper d = new DrawableWrapper(drawable);
+            d.setTintList(sl);
+            box.setButtonDrawable(d);
+        }
+    }
+}

+ 3 - 0
library/src/main/res/anim/decelerate_cubic.xml

@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<decelerateInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
+    android:factor="1.5" />

+ 9 - 0
library/src/main/res/anim/popup_enter.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shareInterpolator="false">
+    <alpha
+        android:fromAlpha="0.0"
+        android:toAlpha="1.0"
+        android:interpolator="@anim/decelerate_cubic"
+        android:duration="150" />
+</set>

+ 9 - 0
library/src/main/res/anim/popup_exit.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shareInterpolator="false">
+    <alpha
+        android:fromAlpha="1.0"
+        android:toAlpha="0.0"
+        android:interpolator="@anim/decelerate_cubic"
+        android:duration="150" />
+</set>

+ 3 - 2
library/src/main/res/drawable-v21/md_btn_selector_ripple.xml

@@ -1,7 +1,8 @@
 <ripple xmlns:android="http://schemas.android.com/apk/res/android"
     android:color="?android:colorControlHighlight">
 
-    <item android:id="@android:id/mask"
-        android:drawable="@drawable/md_btn_shape"/>
+    <item
+        android:id="@android:id/mask"
+        android:drawable="@drawable/md_btn_shape" />
 
 </ripple>

+ 3 - 2
library/src/main/res/drawable-v21/md_btn_selector_ripple_dark.xml

@@ -1,7 +1,8 @@
 <ripple xmlns:android="http://schemas.android.com/apk/res/android"
     android:color="?android:colorControlHighlight">
 
-    <item android:id="@android:id/mask"
-        android:drawable="@drawable/md_btn_shape"/>
+    <item
+        android:id="@android:id/mask"
+        android:drawable="@drawable/md_btn_shape" />
 
 </ripple>

+ 25 - 0
library/src/main/res/drawable/md_dialog_background.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2014 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<inset xmlns:android="http://schemas.android.com/apk/res/android"
+    android:insetTop="16dp"
+    android:insetBottom="16dp"
+    android:insetLeft="16dp"
+    android:insetRight="16dp">
+    <shape android:shape="rectangle">
+        <corners android:radius="2dp" />
+        <solid android:color="@color/background_floating_material_light" />
+    </shape>
+</inset>

+ 25 - 0
library/src/main/res/drawable/md_dialog_background_dark.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2014 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<inset xmlns:android="http://schemas.android.com/apk/res/android"
+    android:insetTop="16dp"
+    android:insetBottom="16dp"
+    android:insetLeft="16dp"
+    android:insetRight="16dp">
+    <shape android:shape="rectangle">
+        <corners android:radius="2dp" />
+        <solid android:color="@color/background_floating_material_dark" />
+    </shape>
+</inset>

+ 1 - 1
library/src/main/res/layout-ldrtl/md_listitem_multichoice.xml

@@ -22,7 +22,7 @@
         android:paddingEnd="@dimen/md_listitem_control_margin"
         tools:ignore="RtlSymmetry" />
 
-    <com.afollestad.materialdialogs.internal.MDCheckBox
+    <CheckBox
         android:id="@+id/control"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"

+ 1 - 1
library/src/main/res/layout-ldrtl/md_listitem_singlechoice.xml

@@ -22,7 +22,7 @@
         android:paddingEnd="@dimen/md_listitem_control_margin"
         tools:ignore="RtlSymmetry" />
 
-    <com.afollestad.materialdialogs.internal.MDRadioButton
+    <RadioButton
         android:id="@+id/control"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"

+ 1 - 1
library/src/main/res/layout/md_dialog_input.xml

@@ -32,7 +32,7 @@
             android:layout_gravity="center_horizontal"
             tools:ignore="UnusedAttribute" />
 
-        <com.afollestad.materialdialogs.internal.MDEditText
+        <EditText
             android:id="@android:id/input"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"

+ 1 - 1
library/src/main/res/layout/md_listitem_multichoice.xml

@@ -10,7 +10,7 @@
     android:paddingRight="@dimen/md_dialog_frame_margin"
     android:paddingEnd="@dimen/md_dialog_frame_margin">
 
-    <com.afollestad.materialdialogs.internal.MDCheckBox
+    <CheckBox
         android:id="@+id/control"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"

+ 1 - 1
library/src/main/res/layout/md_listitem_singlechoice.xml

@@ -10,7 +10,7 @@
     android:paddingRight="@dimen/md_dialog_frame_margin"
     android:paddingEnd="@dimen/md_dialog_frame_margin">
 
-    <com.afollestad.materialdialogs.internal.MDRadioButton
+    <RadioButton
         android:id="@+id/control"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"

+ 3 - 6
library/src/main/res/layout/md_stub_actionbuttons.xml

@@ -5,23 +5,20 @@
     <com.afollestad.materialdialogs.internal.MDButton
         android:id="@+id/buttonDefaultNeutral"
         style="@style/MD_ActionButton.Text"
-        tools:text="Neutral"
-        />
+        tools:text="Neutral" />
 
     <com.afollestad.materialdialogs.internal.MDButton
         android:id="@+id/buttonDefaultNegative"
         style="@style/MD_ActionButton.Text"
         tools:layout_alignParentLeft="true"
         tools:layout_alignParentStart="true"
-        tools:text="Negative"
-        />
+        tools:text="Negative" />
 
     <com.afollestad.materialdialogs.internal.MDButton
         android:id="@+id/buttonDefaultPositive"
         style="@style/MD_ActionButton.Text"
         tools:layout_alignParentLeft="true"
         tools:layout_alignParentStart="true"
-        tools:text="Positive"
-        />
+        tools:text="Positive" />
 
 </merge>

+ 1 - 1
library/src/main/res/layout/md_stub_progress.xml

@@ -34,7 +34,7 @@
             android:layout_alignParentStart="true"
             android:layout_centerVertical="true" />
 
-        <com.afollestad.materialdialogs.internal.MDProgressBar
+        <ProgressBar
             android:id="@android:id/progress"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"

+ 1 - 1
library/src/main/res/layout/md_stub_progress_indeterminate.xml

@@ -10,7 +10,7 @@
     android:paddingBottom="@dimen/md_content_padding_top"
     android:gravity="end|center_vertical">
 
-    <com.afollestad.materialdialogs.internal.MDProgressBar
+    <ProgressBar
         android:id="@android:id/progress"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content" />

+ 10 - 2
library/src/main/res/values-v11/styles.xml

@@ -2,6 +2,9 @@
 <resources>
 
     <style name="MD_Light" parent="Theme.AppCompat.Light.Dialog">
+        <item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
+        <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item>
+
         <item name="md_divider">@color/md_divider_black</item>
         <item name="md_list_selector">@drawable/md_selector</item>
         <item name="md_btn_stacked_selector">@drawable/md_selector</item>
@@ -10,10 +13,14 @@
         <item name="md_btn_negative_selector">@drawable/md_btn_selector</item>
         <item name="colorAccent">#000</item>
 
-        <item name="android:windowBackground">@android:color/transparent</item>
+        <item name="android:windowBackground">@drawable/md_dialog_background</item>
+        <item name="android:windowAnimationStyle">@style/MD_WindowAnimation</item>
     </style>
 
     <style name="MD_Dark" parent="Theme.AppCompat.Dialog">
+        <item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
+        <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item>
+
         <item name="md_divider">@color/md_divider_white</item>
         <item name="md_list_selector">@drawable/md_selector_dark</item>
         <item name="md_btn_stacked_selector">@drawable/md_selector_dark</item>
@@ -22,7 +29,8 @@
         <item name="md_btn_negative_selector">@drawable/md_btn_selector_dark</item>
         <item name="colorAccent">#fff</item>
 
-        <item name="android:windowBackground">@android:color/transparent</item>
+        <item name="android:windowBackground">@drawable/md_dialog_background_dark</item>
+        <item name="android:windowAnimationStyle">@style/MD_WindowAnimation</item>
     </style>
 
 </resources>

+ 6 - 0
library/src/main/res/values-v21/styles.xml

@@ -2,6 +2,9 @@
 <resources>
 
     <style name="MD_Light" parent="Theme.AppCompat.Light.Dialog">
+        <item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
+        <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item>
+
         <item name="md_divider">@color/md_divider_black</item>
         <item name="md_list_selector">?android:selectableItemBackground</item>
         <item name="md_btn_stacked_selector">?android:selectableItemBackground</item>
@@ -12,6 +15,9 @@
     </style>
 
     <style name="MD_Dark" parent="Theme.AppCompat.Dialog">
+        <item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
+        <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item>
+
         <item name="md_divider">@color/md_divider_white</item>
         <item name="md_list_selector">?android:selectableItemBackground</item>
         <item name="md_btn_stacked_selector">?android:selectableItemBackground</item>

+ 9 - 11
library/src/main/res/values/styles.xml

@@ -1,6 +1,6 @@
 <resources xmlns:tools="http://schemas.android.com/tools">
 
-    <style name="MD_Light" parent="Theme_Light_Dialog">
+    <style name="MD_Light" parent="Theme.AppCompat.Light.Dialog">
         <item name="md_divider">@color/md_divider_black</item>
         <item name="md_list_selector">@drawable/md_selector</item>
         <item name="md_btn_stacked_selector">@drawable/md_selector</item>
@@ -8,6 +8,9 @@
         <item name="md_btn_neutral_selector">@drawable/md_btn_selector</item>
         <item name="md_btn_negative_selector">@drawable/md_btn_selector</item>
         <item name="colorAccent">#000</item>
+
+        <item name="android:windowBackground">@drawable/md_dialog_background</item>
+        <item name="android:windowAnimationStyle">@style/MD_WindowAnimation</item>
     </style>
 
     <style name="MD_Dark" parent="Theme.AppCompat.Dialog">
@@ -19,9 +22,8 @@
         <item name="md_btn_negative_selector">@drawable/md_btn_selector_dark</item>
         <item name="colorAccent">#fff</item>
 
-        <item name="android:windowFrame">@null</item>
-        <item name="android:windowBackground">@android:color/transparent</item>
-        <item name="android:windowContentOverlay">@null</item>
+        <item name="android:windowBackground">@drawable/md_dialog_background_dark</item>
+        <item name="android:windowAnimationStyle">@style/MD_WindowAnimation</item>
     </style>
 
     <style name="MD_ActionButtonStacked" parent="@style/MD_ActionButton" tools:ignore="NewApi">
@@ -53,13 +55,9 @@
         <item name="android:paddingRight">@dimen/md_button_textpadding_horizontal</item>
     </style>
 
-    <!-- Light dialog theme for devices prior Honeycomb -->
-    <style name="Theme_Light_Dialog" parent="Theme.AppCompat.Light.Dialog">
-        <item name="android:windowFrame">@null</item>
-        <item name="android:windowBackground">@android:color/transparent</item>
-        <item name="android:windowIsFloating">true</item>
-        <item name="android:windowContentOverlay">@null</item>
-        <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
+    <style name="MD_WindowAnimation">
+        <item name="android:windowEnterAnimation">@anim/popup_enter</item>
+        <item name="android:windowExitAnimation">@anim/popup_exit</item>
     </style>
 
 </resources>