Quellcode durchsuchen

Lots of code formatting. Fixed a minor layout issue with progress dialogs that have no content.

Aidan Follestad vor 8 Jahren
Ursprung
Commit
1607520e4d
97 geänderte Dateien mit 2406 neuen und 2084 gelöschten Zeilen
  1. 1 3
      commons/src/main/AndroidManifest.xml
  2. 10 6
      commons/src/main/java/com/afollestad/materialdialogs/color/CircleView.java
  3. 88 41
      commons/src/main/java/com/afollestad/materialdialogs/color/ColorChooserDialog.java
  4. 27 14
      commons/src/main/java/com/afollestad/materialdialogs/folderselector/FileChooserDialog.java
  5. 20 12
      commons/src/main/java/com/afollestad/materialdialogs/folderselector/FolderChooserDialog.java
  6. 6 4
      commons/src/main/java/com/afollestad/materialdialogs/prefs/MaterialDialogPreference.java
  7. 19 10
      commons/src/main/java/com/afollestad/materialdialogs/prefs/MaterialEditTextPreference.java
  8. 17 10
      commons/src/main/java/com/afollestad/materialdialogs/prefs/MaterialListPreference.java
  9. 35 25
      commons/src/main/java/com/afollestad/materialdialogs/prefs/MaterialMultiSelectListPreference.java
  10. 8 6
      commons/src/main/java/com/afollestad/materialdialogs/prefs/PrefUtil.java
  11. 4 3
      commons/src/main/java/com/afollestad/materialdialogs/simplelist/MaterialSimpleListAdapter.java
  12. 4 3
      commons/src/main/java/com/afollestad/materialdialogs/simplelist/MaterialSimpleListItem.java
  13. 5 5
      commons/src/main/res/drawable/gray_circle.xml
  14. 11 11
      commons/src/main/res/layout/md_dialog_colorchooser.xml
  15. 64 64
      commons/src/main/res/layout/md_preference_custom.xml
  16. 31 32
      commons/src/main/res/layout/md_simplelist_item.xml
  17. 230 231
      commons/src/main/res/layout/md_stub_colorchooser_custom.xml
  18. 13 14
      commons/src/main/res/layout/md_stub_colorchooser_grid.xml
  19. 24 25
      commons/src/main/res/layout/md_stub_inputpref.xml
  20. 1 1
      commons/src/main/res/values-large/dimens.xml
  21. 3 3
      commons/src/main/res/values/attrs.xml
  22. 6 6
      commons/src/main/res/values/dimens.xml
  23. 9 9
      commons/src/main/res/values/strings.xml
  24. 4 7
      core/src/main/AndroidManifest.xml
  25. 22 12
      core/src/main/java/com/afollestad/materialdialogs/DefaultRvAdapter.java
  26. 10 6
      core/src/main/java/com/afollestad/materialdialogs/DialogBase.java
  27. 103 52
      core/src/main/java/com/afollestad/materialdialogs/DialogInit.java
  28. 2 1
      core/src/main/java/com/afollestad/materialdialogs/GravityEnum.java
  29. 187 135
      core/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java
  30. 9 6
      core/src/main/java/com/afollestad/materialdialogs/internal/MDButton.java
  31. 59 30
      core/src/main/java/com/afollestad/materialdialogs/internal/MDRootLayout.java
  32. 18 14
      core/src/main/java/com/afollestad/materialdialogs/internal/MDTintHelper.java
  33. 4 3
      core/src/main/java/com/afollestad/materialdialogs/internal/ThemeSingleton.java
  34. 44 27
      core/src/main/java/com/afollestad/materialdialogs/util/DialogUtils.java
  35. 2 1
      core/src/main/java/com/afollestad/materialdialogs/util/RippleHelper.java
  36. 1 1
      core/src/main/res/anim/decelerate_cubic.xml
  37. 6 6
      core/src/main/res/anim/popup_enter.xml
  38. 6 6
      core/src/main/res/anim/popup_exit.xml
  39. 4 4
      core/src/main/res/drawable-v21/md_btn_selector_ripple.xml
  40. 4 4
      core/src/main/res/drawable-v21/md_btn_selector_ripple_dark.xml
  41. 13 13
      core/src/main/res/drawable-v21/md_btn_shape.xml
  42. 14 14
      core/src/main/res/drawable/md_btn_selected.xml
  43. 14 14
      core/src/main/res/drawable/md_btn_selected_dark.xml
  44. 3 3
      core/src/main/res/drawable/md_btn_selector.xml
  45. 3 3
      core/src/main/res/drawable/md_btn_selector_dark.xml
  46. 2 2
      core/src/main/res/drawable/md_item_selected.xml
  47. 2 2
      core/src/main/res/drawable/md_item_selected_dark.xml
  48. 7 7
      core/src/main/res/drawable/md_nav_back.xml
  49. 3 3
      core/src/main/res/drawable/md_selector.xml
  50. 3 3
      core/src/main/res/drawable/md_selector_dark.xml
  51. 2 2
      core/src/main/res/drawable/md_transparent.xml
  52. 34 35
      core/src/main/res/layout-ldrtl/md_listitem_multichoice.xml
  53. 33 33
      core/src/main/res/layout-ldrtl/md_listitem_singlechoice.xml
  54. 46 46
      core/src/main/res/layout-v14/md_stub_progress.xml
  55. 27 27
      core/src/main/res/layout-v14/md_stub_progress_indeterminate.xml
  56. 18 18
      core/src/main/res/layout-v14/md_stub_progress_indeterminate_horizontal.xml
  57. 25 26
      core/src/main/res/layout/md_dialog_basic.xml
  58. 43 44
      core/src/main/res/layout/md_dialog_basic_check.xml
  59. 11 12
      core/src/main/res/layout/md_dialog_custom.xml
  60. 60 61
      core/src/main/res/layout/md_dialog_input.xml
  61. 69 70
      core/src/main/res/layout/md_dialog_input_check.xml
  62. 47 48
      core/src/main/res/layout/md_dialog_list.xml
  63. 56 57
      core/src/main/res/layout/md_dialog_list_check.xml
  64. 18 19
      core/src/main/res/layout/md_dialog_progress.xml
  65. 9 10
      core/src/main/res/layout/md_dialog_progress_indeterminate.xml
  66. 18 19
      core/src/main/res/layout/md_dialog_progress_indeterminate_horizontal.xml
  67. 23 24
      core/src/main/res/layout/md_listitem.xml
  68. 35 36
      core/src/main/res/layout/md_listitem_multichoice.xml
  69. 35 36
      core/src/main/res/layout/md_listitem_singlechoice.xml
  70. 17 17
      core/src/main/res/layout/md_stub_actionbuttons.xml
  71. 48 49
      core/src/main/res/layout/md_stub_progress.xml
  72. 27 28
      core/src/main/res/layout/md_stub_progress_indeterminate.xml
  73. 19 20
      core/src/main/res/layout/md_stub_progress_indeterminate_horizontal.xml
  74. 25 26
      core/src/main/res/layout/md_stub_titleframe.xml
  75. 25 26
      core/src/main/res/layout/md_stub_titleframe_lesspadding.xml
  76. 1 1
      core/src/main/res/values-sw600dp/bool.xml
  77. 1 1
      core/src/main/res/values-sw600dp/dimens.xml
  78. 1 1
      core/src/main/res/values-sw720dp-land/dimens.xml
  79. 1 1
      core/src/main/res/values-sw720dp/bool.xml
  80. 1 1
      core/src/main/res/values-sw720dp/dimens.xml
  81. 35 35
      core/src/main/res/values-v11/styles.xml
  82. 50 50
      core/src/main/res/values-v14/styles.xml
  83. 20 20
      core/src/main/res/values-v21/styles.xml
  84. 67 67
      core/src/main/res/values/attrs.xml
  85. 1 1
      core/src/main/res/values/bool.xml
  86. 13 13
      core/src/main/res/values/colors.xml
  87. 67 67
      core/src/main/res/values/dimens.xml
  88. 1 1
      core/src/main/res/values/public.xml
  89. 56 56
      core/src/main/res/values/styles.xml
  90. 2 0
      sample/build.gradle
  91. 27 26
      sample/src/main/AndroidManifest.xml
  92. 0 1
      sample/src/main/java/com/afollestad/materialdialogssample/AboutDialog.java
  93. 16 0
      sample/src/main/java/com/afollestad/materialdialogssample/App.java
  94. 4 1
      sample/src/main/java/com/afollestad/materialdialogssample/ButtonItemAdapter.java
  95. 4 4
      sample/src/main/java/com/afollestad/materialdialogssample/ChangelogDialog.java
  96. 80 30
      sample/src/main/java/com/afollestad/materialdialogssample/MainActivity.java
  97. 3 1
      sample/src/main/java/com/afollestad/materialdialogssample/PreferenceActivity.java

+ 1 - 3
commons/src/main/AndroidManifest.xml

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

+ 10 - 6
commons/src/main/java/com/afollestad/materialdialogs/color/CircleView.java

@@ -23,7 +23,6 @@ import android.util.TypedValue;
 import android.view.Gravity;
 import android.widget.FrameLayout;
 import android.widget.Toast;
-
 import com.afollestad.materialdialogs.util.DialogUtils;
 
 public class CircleView extends FrameLayout {
@@ -47,8 +46,10 @@ public class CircleView extends FrameLayout {
   public CircleView(Context context, AttributeSet attrs, int defStyleAttr) {
     super(context, attrs, defStyleAttr);
     final Resources r = getResources();
-    borderWidthSmall = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 3, r.getDisplayMetrics());
-    borderWidthLarge = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, r.getDisplayMetrics());
+    borderWidthSmall = (int) TypedValue
+        .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 3, r.getDisplayMetrics());
+    borderWidthLarge = (int) TypedValue
+        .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, r.getDisplayMetrics());
 
     whitePaint = new Paint();
     whitePaint.setAntiAlias(true);
@@ -74,8 +75,10 @@ public class CircleView extends FrameLayout {
 
   @ColorInt
   public static int shiftColor(@ColorInt int color,
-                               @FloatRange(from = 0.0f, to = 2.0f) float by) {
-    if (by == 1f) return color;
+      @FloatRange(from = 0.0f, to = 2.0f) float by) {
+    if (by == 1f) {
+      return color;
+    }
     float[] hsv = new float[3];
     Color.colorToHSV(color, hsv);
     hsv[2] *= by; // value component
@@ -211,7 +214,8 @@ public class CircleView extends FrameLayout {
       final int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
       referenceX = screenWidth - referenceX; // mirror
     }
-    Toast cheatSheet = Toast.makeText(context, String.format("#%06X", 0xFFFFFF & color), Toast.LENGTH_SHORT);
+    Toast cheatSheet = Toast
+        .makeText(context, String.format("#%06X", 0xFFFFFF & color), Toast.LENGTH_SHORT);
     if (midy < displayFrame.height()) {
       // Show along the top; follow action buttons
       cheatSheet.setGravity(Gravity.TOP | GravityCompat.END, referenceX,

+ 88 - 41
commons/src/main/java/com/afollestad/materialdialogs/color/ColorChooserDialog.java

@@ -27,14 +27,12 @@ import android.widget.EditText;
 import android.widget.GridView;
 import android.widget.SeekBar;
 import android.widget.TextView;
-
 import com.afollestad.materialdialogs.DialogAction;
 import com.afollestad.materialdialogs.MaterialDialog;
 import com.afollestad.materialdialogs.Theme;
 import com.afollestad.materialdialogs.commons.R;
 import com.afollestad.materialdialogs.internal.MDTintHelper;
 import com.afollestad.materialdialogs.util.DialogUtils;
-
 import java.io.Serializable;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -44,7 +42,8 @@ import java.util.Locale;
  * @author Aidan Follestad (afollestad)
  */
 @SuppressWarnings({"FieldCanBeLocal", "ConstantConditions"})
-public class ColorChooserDialog extends DialogFragment implements View.OnClickListener, View.OnLongClickListener {
+public class ColorChooserDialog extends DialogFragment implements View.OnClickListener,
+    View.OnLongClickListener {
 
   public final static String TAG_PRIMARY = "[MD_COLOR_CHOOSER]";
   public final static String TAG_ACCENT = "[MD_COLOR_CHOOSER]";
@@ -69,6 +68,7 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
   private TextView customSeekBValue;
   private SeekBar.OnSeekBarChangeListener customColorRgbListener;
   private int selectedCustomColor;
+
   public ColorChooserDialog() {
   }
 
@@ -76,8 +76,9 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
   public static ColorChooserDialog findVisible(
       @NonNull AppCompatActivity context, @ColorChooserTag String tag) {
     Fragment frag = context.getSupportFragmentManager().findFragmentByTag(tag);
-    if (frag != null && frag instanceof ColorChooserDialog)
+    if (frag != null && frag instanceof ColorChooserDialog) {
       return (ColorChooserDialog) frag;
+    }
     return null;
   }
 
@@ -111,8 +112,10 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
   @Override
   public void onAttach(Activity activity) {
     super.onAttach(activity);
-    if (!(activity instanceof ColorCallback))
-      throw new IllegalStateException("ColorChooserDialog needs to be shown from an Activity implementing ColorCallback.");
+    if (!(activity instanceof ColorCallback)) {
+      throw new IllegalStateException(
+          "ColorChooserDialog needs to be shown from an Activity implementing ColorCallback.");
+    }
     callback = (ColorCallback) activity;
   }
 
@@ -129,18 +132,23 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
   }
 
   private void topIndex(int value) {
-    if (value > -1)
+    if (value > -1) {
       findSubIndexForColor(value, colorsTop[value]);
+    }
     getArguments().putInt("top_index", value);
   }
 
   private int subIndex() {
-    if (colorsSub == null) return -1;
+    if (colorsSub == null) {
+      return -1;
+    }
     return getArguments().getInt("sub_index", -1);
   }
 
   private void subIndex(int value) {
-    if (colorsSub == null) return;
+    if (colorsSub == null) {
+      return;
+    }
     getArguments().putInt("sub_index", value);
   }
 
@@ -148,17 +156,24 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
   public int getTitle() {
     Builder builder = getBuilder();
     int title;
-    if (isInSub()) title = builder.titleSub;
-    else title = builder.title;
-    if (title == 0) title = builder.title;
+    if (isInSub()) {
+      title = builder.titleSub;
+    } else {
+      title = builder.title;
+    }
+    if (title == 0) {
+      title = builder.title;
+    }
     return title;
   }
 
   public String tag() {
     Builder builder = getBuilder();
-    if (builder.tag != null)
+    if (builder.tag != null) {
       return builder.tag;
-    else return super.getTag();
+    } else {
+      return super.getTag();
+    }
   }
 
   public boolean isAccentMode() {
@@ -183,8 +198,9 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
         }
       }
 
-      if (builder.allowUserCustom)
+      if (builder.allowUserCustom) {
         selectedCustomColor = getSelectedColor();
+      }
       invalidateDynamicButtonColors();
       invalidate();
     }
@@ -203,7 +219,9 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
 
   private void invalidateDynamicButtonColors() {
     final MaterialDialog dialog = (MaterialDialog) getDialog();
-    if (dialog == null) return;
+    if (dialog == null) {
+      return;
+    }
     final Builder builder = getBuilder();
     if (builder.dynamicButtonColor) {
       int selectedColor = getSelectedColor();
@@ -223,8 +241,9 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
       }
 
       if (customSeekR != null) {
-        if (customSeekA.getVisibility() == View.VISIBLE)
+        if (customSeekA.getVisibility() == View.VISIBLE) {
           MDTintHelper.setTint(customSeekA, selectedColor);
+        }
         MDTintHelper.setTint(customSeekR, selectedColor);
         MDTintHelper.setTint(customSeekG, selectedColor);
         MDTintHelper.setTint(customSeekB, selectedColor);
@@ -240,22 +259,25 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
     }
 
     int color = 0;
-    if (subIndex() > -1)
+    if (subIndex() > -1) {
       color = colorsSub[topIndex()][subIndex()];
-    else if (topIndex() > -1)
+    } else if (topIndex() > -1) {
       color = colorsTop[topIndex()];
+    }
     if (color == 0) {
       int fallback = 0;
-      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
+      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
         fallback = DialogUtils.resolveColor(getActivity(), android.R.attr.colorAccent);
+      }
       color = DialogUtils.resolveColor(getActivity(), R.attr.colorAccent, fallback);
     }
     return color;
   }
 
   private void findSubIndexForColor(int topIndex, int color) {
-    if (colorsSub == null || colorsSub.length - 1 < topIndex)
+    if (colorsSub == null || colorsSub.length - 1 < topIndex) {
       return;
+    }
     int[] subColors = colorsSub[topIndex];
     for (int subIndex = 0; subIndex < subColors.length; subIndex++) {
       if (subColors[subIndex] == color) {
@@ -268,8 +290,10 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
   @NonNull
   @Override
   public Dialog onCreateDialog(Bundle savedInstanceState) {
-    if (getArguments() == null || !getArguments().containsKey("builder"))
-      throw new IllegalStateException("ColorChooserDialog should be created using its Builder interface.");
+    if (getArguments() == null || !getArguments().containsKey("builder")) {
+      throw new IllegalStateException(
+          "ColorChooserDialog should be created using its Builder interface.");
+    }
     generateColors();
 
     int preselectColor;
@@ -305,7 +329,9 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
                   break;
                 }
               }
-              if (foundPreselectColor) break;
+              if (foundPreselectColor) {
+                break;
+              }
             }
           }
         }
@@ -358,8 +384,9 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
           }
         });
 
-    if (builder.theme != null)
+    if (builder.theme != null) {
       bd.theme(builder.theme);
+    }
 
     final MaterialDialog dialog = bd.build();
     final View v = dialog.getCustomView();
@@ -409,8 +436,9 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
   }
 
   private void toggleCustom(MaterialDialog dialog) {
-    if (dialog == null)
+    if (dialog == null) {
       dialog = (MaterialDialog) getDialog();
+    }
     if (grid.getVisibility() == View.VISIBLE) {
       dialog.setTitle(getBuilder().customBtn);
       dialog.setActionButton(DialogAction.NEUTRAL, getBuilder().presetsBtn);
@@ -504,9 +532,11 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
     } else {
       dialog.setTitle(getBuilder().title);
       dialog.setActionButton(DialogAction.NEUTRAL, getBuilder().customBtn);
-      if (isInSub())
+      if (isInSub()) {
         dialog.setActionButton(DialogAction.NEGATIVE, getBuilder().backBtn);
-      else dialog.setActionButton(DialogAction.NEGATIVE, getBuilder().cancelBtn);
+      } else {
+        dialog.setActionButton(DialogAction.NEGATIVE, getBuilder().cancelBtn);
+      }
       grid.setVisibility(View.VISIBLE);
       colorChooserCustomFrame.setVisibility(View.GONE);
       customColorHex.removeTextChangedListener(customColorTextWatcher);
@@ -521,14 +551,20 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
   private void invalidate() {
     if (grid.getAdapter() == null) {
       grid.setAdapter(new ColorGridAdapter());
-      grid.setSelector(ResourcesCompat.getDrawable(getResources(), R.drawable.md_transparent, null));
-    } else ((BaseAdapter) grid.getAdapter()).notifyDataSetChanged();
-    if (getDialog() != null)
+      grid.setSelector(
+          ResourcesCompat.getDrawable(getResources(), R.drawable.md_transparent, null));
+    } else {
+      ((BaseAdapter) grid.getAdapter()).notifyDataSetChanged();
+    }
+    if (getDialog() != null) {
       getDialog().setTitle(getTitle());
+    }
   }
 
   private Builder getBuilder() {
-    if (getArguments() == null || !getArguments().containsKey("builder")) return null;
+    if (getArguments() == null || !getArguments().containsKey("builder")) {
+      return null;
+    }
     return (Builder) getArguments().getSerializable("builder");
   }
 
@@ -545,11 +581,13 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
   public ColorChooserDialog show(AppCompatActivity context) {
     String tag;
     Builder builder = getBuilder();
-    if (builder.colorsTop != null)
+    if (builder.colorsTop != null) {
       tag = TAG_CUSTOM;
-    else if (builder.accentMode)
+    } else if (builder.accentMode) {
       tag = TAG_ACCENT;
-    else tag = TAG_PRIMARY;
+    } else {
+      tag = TAG_PRIMARY;
+    }
     dismissIfNecessary(context, tag);
     show(context.getSupportFragmentManager(), tag);
     return this;
@@ -562,6 +600,7 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
       TAG_CUSTOM
   })
   public @interface ColorChooserTag {
+
   }
 
   public interface ColorCallback {
@@ -729,14 +768,20 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
 
     @Override
     public int getCount() {
-      if (isInSub()) return colorsSub[topIndex()].length;
-      else return colorsTop.length;
+      if (isInSub()) {
+        return colorsSub[topIndex()].length;
+      } else {
+        return colorsTop.length;
+      }
     }
 
     @Override
     public Object getItem(int position) {
-      if (isInSub()) return colorsSub[topIndex()][position];
-      else return colorsTop[position];
+      if (isInSub()) {
+        return colorsSub[topIndex()][position];
+      } else {
+        return colorsTop[position];
+      }
     }
 
     @Override
@@ -755,9 +800,11 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
       @ColorInt
       final int color = isInSub() ? colorsSub[topIndex()][position] : colorsTop[position];
       child.setBackgroundColor(color);
-      if (isInSub())
+      if (isInSub()) {
         child.setSelected(subIndex() == position);
-      else child.setSelected(topIndex() == position);
+      } else {
+        child.setSelected(topIndex() == position);
+      }
       child.setTag(String.format("%d:%d", position, color));
       child.setOnClickListener(ColorChooserDialog.this);
       child.setOnLongClickListener(ColorChooserDialog.this);

+ 27 - 14
commons/src/main/java/com/afollestad/materialdialogs/folderselector/FileChooserDialog.java

@@ -18,11 +18,9 @@ import android.support.v4.app.FragmentActivity;
 import android.support.v7.app.AppCompatActivity;
 import android.view.View;
 import android.webkit.MimeTypeMap;
-
 import com.afollestad.materialdialogs.DialogAction;
 import com.afollestad.materialdialogs.MaterialDialog;
 import com.afollestad.materialdialogs.commons.R;
-
 import java.io.File;
 import java.io.Serializable;
 import java.util.ArrayList;
@@ -44,14 +42,18 @@ public class FileChooserDialog extends DialogFragment implements MaterialDialog.
 
   CharSequence[] getContentsArray() {
     if (parentContents == null) {
-      if (canGoUp)
+      if (canGoUp) {
         return new String[]{getBuilder().goUpLabel};
+      }
       return new String[]{};
     }
     String[] results = new String[parentContents.length + (canGoUp ? 1 : 0)];
-    if (canGoUp) results[0] = getBuilder().goUpLabel;
-    for (int i = 0; i < parentContents.length; i++)
+    if (canGoUp) {
+      results[0] = getBuilder().goUpLabel;
+    }
+    for (int i = 0; i < parentContents.length; i++) {
       results[canGoUp ? i + 1 : i] = parentContents[i].getName();
+    }
     return results;
   }
 
@@ -72,7 +74,9 @@ public class FileChooserDialog extends DialogFragment implements MaterialDialog.
                 break;
               }
             }
-            if (found) results.add(fi);
+            if (found) {
+              results.add(fi);
+            }
           } else if (mimeType != null) {
             if (fileIsMimeType(fi, mimeType, mimeTypeMap)) {
               results.add(fi);
@@ -97,8 +101,9 @@ public class FileChooserDialog extends DialogFragment implements MaterialDialog.
         return false;
       }
       String fileExtension = filename.substring(dotPos + 1);
-      if (fileExtension.endsWith("json"))
+      if (fileExtension.endsWith("json")) {
         return mimeType.startsWith("application/json");
+      }
       String fileType = mimeTypeMap.getMimeTypeFromExtension(fileExtension);
       if (fileType == null) {
         return false;
@@ -144,10 +149,12 @@ public class FileChooserDialog extends DialogFragment implements MaterialDialog.
           .build();
     }
 
-    if (getArguments() == null || !getArguments().containsKey("builder"))
+    if (getArguments() == null || !getArguments().containsKey("builder")) {
       throw new IllegalStateException("You must create a FileChooserDialog using the Builder.");
-    if (!getArguments().containsKey("current_path"))
+    }
+    if (!getArguments().containsKey("current_path")) {
       getArguments().putString("current_path", getBuilder().initialPath);
+    }
     parentFolder = new File(getArguments().getString("current_path"));
     checkIfCanGoUp();
     parentContents = listFiles(getBuilder().mimeType, getBuilder().extensions);
@@ -158,7 +165,7 @@ public class FileChooserDialog extends DialogFragment implements MaterialDialog.
         .onNegative(new MaterialDialog.SingleButtonCallback() {
           @Override
           public void onClick(@NonNull MaterialDialog dialog,
-                              @NonNull DialogAction which) {
+              @NonNull DialogAction which) {
             dialog.dismiss();
           }
         })
@@ -180,14 +187,16 @@ public class FileChooserDialog extends DialogFragment implements MaterialDialog.
       (MaterialDialog materialDialog, View view, int i, CharSequence s) {
     if (canGoUp && i == 0) {
       parentFolder = parentFolder.getParentFile();
-      if (parentFolder.getAbsolutePath().equals("/storage/emulated"))
+      if (parentFolder.getAbsolutePath().equals("/storage/emulated")) {
         parentFolder = parentFolder.getParentFile();
+      }
       canGoUp = parentFolder.getParent() != null;
     } else {
       parentFolder = parentContents[canGoUp ? i - 1 : i];
       canGoUp = true;
-      if (parentFolder.getAbsolutePath().equals("/storage/emulated"))
+      if (parentFolder.getAbsolutePath().equals("/storage/emulated")) {
         parentFolder = Environment.getExternalStorageDirectory();
+      }
     }
     if (parentFolder.isFile()) {
       callback.onFileSelection(this, parentFolder);
@@ -238,6 +247,7 @@ public class FileChooserDialog extends DialogFragment implements MaterialDialog.
   }
 
   public interface FileCallback {
+
     void onFileSelection(@NonNull FileChooserDialog dialog, @NonNull File file);
 
     void onFileChooserDismissed(@NonNull FileChooserDialog dialog);
@@ -272,8 +282,9 @@ public class FileChooserDialog extends DialogFragment implements MaterialDialog.
 
     @NonNull
     public Builder initialPath(@Nullable String initialPath) {
-      if (initialPath == null)
+      if (initialPath == null) {
         initialPath = File.separator;
+      }
       this.initialPath = initialPath;
       return this;
     }
@@ -292,8 +303,9 @@ public class FileChooserDialog extends DialogFragment implements MaterialDialog.
 
     @NonNull
     public Builder tag(@Nullable String tag) {
-      if (tag == null)
+      if (tag == null) {
         tag = DEFAULT_TAG;
+      }
       this.tag = tag;
       return this;
     }
@@ -322,6 +334,7 @@ public class FileChooserDialog extends DialogFragment implements MaterialDialog.
   }
 
   private static class FileSorter implements Comparator<File> {
+
     @Override
     public int compare(File lhs, File rhs) {
       if (lhs.isDirectory() && !rhs.isDirectory()) {

+ 20 - 12
commons/src/main/java/com/afollestad/materialdialogs/folderselector/FolderChooserDialog.java

@@ -18,11 +18,9 @@ import android.support.v4.app.FragmentActivity;
 import android.support.v7.app.AppCompatActivity;
 import android.view.View;
 import android.widget.Toast;
-
 import com.afollestad.materialdialogs.DialogAction;
 import com.afollestad.materialdialogs.MaterialDialog;
 import com.afollestad.materialdialogs.commons.R;
-
 import java.io.File;
 import java.io.Serializable;
 import java.util.ArrayList;
@@ -67,7 +65,9 @@ public class FolderChooserDialog extends DialogFragment implements MaterialDialo
     List<File> results = new ArrayList<>();
     if (contents != null) {
       for (File fi : contents) {
-        if (fi.isDirectory()) results.add(fi);
+        if (fi.isDirectory()) {
+          results.add(fi);
+        }
       }
       Collections.sort(results, new FolderSorter());
       return results.toArray(new File[results.size()]);
@@ -89,10 +89,12 @@ public class FolderChooserDialog extends DialogFragment implements MaterialDialo
           .positiveText(android.R.string.ok)
           .build();
     }
-    if (getArguments() == null || !getArguments().containsKey("builder"))
+    if (getArguments() == null || !getArguments().containsKey("builder")) {
       throw new IllegalStateException("You must create a FolderChooserDialog using the Builder.");
-    if (!getArguments().containsKey("current_path"))
+    }
+    if (!getArguments().containsKey("current_path")) {
       getArguments().putString("current_path", getBuilder().initialPath);
+    }
     parentFolder = new File(getArguments().getString("current_path"));
     checkIfCanGoUp();
     parentContents = listFiles();
@@ -110,7 +112,7 @@ public class FolderChooserDialog extends DialogFragment implements MaterialDialo
         .onNegative(new MaterialDialog.SingleButtonCallback() {
           @Override
           public void onClick(@NonNull MaterialDialog dialog,
-                              @NonNull DialogAction which) {
+              @NonNull DialogAction which) {
             dialog.dismiss();
           }
         })
@@ -164,14 +166,16 @@ public class FolderChooserDialog extends DialogFragment implements MaterialDialo
       MaterialDialog materialDialog, View view, int i, CharSequence s) {
     if (canGoUp && i == 0) {
       parentFolder = parentFolder.getParentFile();
-      if (parentFolder.getAbsolutePath().equals("/storage/emulated"))
+      if (parentFolder.getAbsolutePath().equals("/storage/emulated")) {
         parentFolder = parentFolder.getParentFile();
+      }
       canGoUp = parentFolder.getParent() != null;
     } else {
       parentFolder = parentContents[canGoUp ? i - 1 : i];
       canGoUp = true;
-      if (parentFolder.getAbsolutePath().equals("/storage/emulated"))
+      if (parentFolder.getAbsolutePath().equals("/storage/emulated")) {
         parentFolder = Environment.getExternalStorageDirectory();
+      }
     }
     reload();
   }
@@ -237,7 +241,8 @@ public class FolderChooserDialog extends DialogFragment implements MaterialDialo
     int newFolderButton;
     String goUpLabel;
 
-    public <ActivityType extends AppCompatActivity & FolderCallback> Builder(@NonNull ActivityType context) {
+    public <ActivityType extends AppCompatActivity & FolderCallback> Builder(
+        @NonNull ActivityType context) {
       this.context = context;
       chooseButton = R.string.md_choose_label;
       cancelButton = android.R.string.cancel;
@@ -266,24 +271,27 @@ public class FolderChooserDialog extends DialogFragment implements MaterialDialo
     @NonNull
     public Builder allowNewFolder(boolean allow, @StringRes int buttonLabel) {
       allowNewFolder = allow;
-      if (buttonLabel == 0)
+      if (buttonLabel == 0) {
         buttonLabel = R.string.new_folder;
+      }
       newFolderButton = buttonLabel;
       return this;
     }
 
     @NonNull
     public Builder initialPath(@Nullable String initialPath) {
-      if (initialPath == null)
+      if (initialPath == null) {
         initialPath = File.separator;
+      }
       this.initialPath = initialPath;
       return this;
     }
 
     @NonNull
     public Builder tag(@Nullable String tag) {
-      if (tag == null)
+      if (tag == null) {
         tag = DEFAULT_TAG;
+      }
       this.tag = tag;
       return this;
     }

+ 6 - 4
commons/src/main/java/com/afollestad/materialdialogs/prefs/MaterialDialogPreference.java

@@ -12,7 +12,6 @@ import android.preference.DialogPreference;
 import android.support.annotation.NonNull;
 import android.util.AttributeSet;
 import android.view.View;
-
 import com.afollestad.materialdialogs.DialogAction;
 import com.afollestad.materialdialogs.MaterialDialog;
 
@@ -42,7 +41,7 @@ public class MaterialDialogPreference extends DialogPreference {
 
   @TargetApi(Build.VERSION_CODES.LOLLIPOP)
   public MaterialDialogPreference(Context context, AttributeSet attrs,
-                                  int defStyleAttr, int defStyleRes) {
+      int defStyleAttr, int defStyleRes) {
     super(context, attrs, defStyleAttr, defStyleRes);
     init(context, attrs);
   }
@@ -95,8 +94,9 @@ public class MaterialDialogPreference extends DialogPreference {
     PrefUtil.registerOnActivityDestroyListener(this, this);
 
     dialog = builder.build();
-    if (state != null)
+    if (state != null) {
       dialog.onRestoreInstanceState(state);
+    }
     dialog.show();
   }
 
@@ -109,8 +109,9 @@ public class MaterialDialogPreference extends DialogPreference {
   @Override
   public void onActivityDestroy() {
     super.onActivityDestroy();
-    if (dialog != null && dialog.isShowing())
+    if (dialog != null && dialog.isShowing()) {
       dialog.dismiss();
+    }
   }
 
   @Override
@@ -144,6 +145,7 @@ public class MaterialDialogPreference extends DialogPreference {
 
   // From DialogPreference
   private static class SavedState extends BaseSavedState {
+
     public static final Creator<SavedState> CREATOR =
         new Creator<SavedState>() {
           public SavedState createFromParcel(Parcel in) {

+ 19 - 10
commons/src/main/java/com/afollestad/materialdialogs/prefs/MaterialEditTextPreference.java

@@ -22,7 +22,6 @@ import android.view.WindowManager;
 import android.widget.EditText;
 import android.widget.LinearLayout;
 import android.widget.TextView;
-
 import com.afollestad.materialdialogs.DialogAction;
 import com.afollestad.materialdialogs.MaterialDialog;
 import com.afollestad.materialdialogs.MaterialDialog.Builder;
@@ -56,7 +55,8 @@ public class MaterialEditTextPreference extends EditTextPreference {
   }
 
   @TargetApi(Build.VERSION_CODES.LOLLIPOP)
-  public MaterialEditTextPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+  public MaterialEditTextPreference(Context context, AttributeSet attrs, int defStyleAttr,
+      int defStyleRes) {
     super(context, attrs, defStyleAttr, defStyleRes);
     init(context, attrs);
   }
@@ -65,9 +65,11 @@ public class MaterialEditTextPreference extends EditTextPreference {
   private void init(Context context, AttributeSet attrs) {
     PrefUtil.setLayoutResource(context, this, attrs);
     int fallback;
-    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
+    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
       fallback = DialogUtils.resolveColor(context, android.R.attr.colorAccent);
-    else fallback = 0;
+    } else {
+      fallback = 0;
+    }
     fallback = DialogUtils.resolveColor(context, R.attr.colorAccent, fallback);
     color = DialogUtils.resolveColor(context, R.attr.md_widget_color, fallback);
 
@@ -89,12 +91,14 @@ public class MaterialEditTextPreference extends EditTextPreference {
     EditText editText = this.editText;
     editText.setText(getText());
     // Initialize cursor to end of text
-    if (editText.getText().length() > 0)
+    if (editText.getText().length() > 0) {
       editText.setSelection(editText.length());
+    }
     ViewParent oldParent = editText.getParent();
     if (oldParent != view) {
-      if (oldParent != null)
+      if (oldParent != null) {
         ((ViewGroup) oldParent).removeView(editText);
+      }
       onAddEditTextToDialogView(view, editText);
     }
   }
@@ -103,8 +107,9 @@ public class MaterialEditTextPreference extends EditTextPreference {
   protected void onDialogClosed(boolean positiveResult) {
     if (positiveResult) {
       String value = editText.getText().toString();
-      if (callChangeListener(value))
+      if (callChangeListener(value)) {
         setText(value);
+      }
     }
   }
 
@@ -162,8 +167,9 @@ public class MaterialEditTextPreference extends EditTextPreference {
     PrefUtil.registerOnActivityDestroyListener(this, this);
 
     dialog = mBuilder.build();
-    if (state != null)
+    if (state != null) {
       dialog.onRestoreInstanceState(state);
+    }
     requestInputMethod(dialog);
 
     dialog.show();
@@ -180,15 +186,18 @@ public class MaterialEditTextPreference extends EditTextPreference {
    */
   private void requestInputMethod(Dialog dialog) {
     Window window = dialog.getWindow();
-    if (window == null) return;
+    if (window == null) {
+      return;
+    }
     window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
   }
 
   @Override
   public void onActivityDestroy() {
     super.onActivityDestroy();
-    if (dialog != null && dialog.isShowing())
+    if (dialog != null && dialog.isShowing()) {
       dialog.dismiss();
+    }
   }
 
   @Override

+ 17 - 10
commons/src/main/java/com/afollestad/materialdialogs/prefs/MaterialListPreference.java

@@ -13,10 +13,8 @@ import android.support.annotation.NonNull;
 import android.support.v7.widget.RecyclerView;
 import android.util.AttributeSet;
 import android.view.View;
-
 import com.afollestad.materialdialogs.DialogAction;
 import com.afollestad.materialdialogs.MaterialDialog;
-
 import java.lang.reflect.Field;
 
 /**
@@ -44,7 +42,8 @@ public class MaterialListPreference extends ListPreference {
   }
 
   @TargetApi(Build.VERSION_CODES.LOLLIPOP)
-  public MaterialListPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+  public MaterialListPreference(Context context, AttributeSet attrs, int defStyleAttr,
+      int defStyleRes) {
     super(context, attrs, defStyleAttr, defStyleRes);
     init(context, attrs);
   }
@@ -52,15 +51,17 @@ public class MaterialListPreference extends ListPreference {
   private void init(Context context, AttributeSet attrs) {
     this.context = context;
     PrefUtil.setLayoutResource(context, this, attrs);
-    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1)
+    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
       setWidgetLayoutResource(0);
+    }
   }
 
   @Override
   public void setEntries(CharSequence[] entries) {
     super.setEntries(entries);
-    if (dialog != null)
+    if (dialog != null) {
       dialog.setItems(entries);
+    }
   }
 
   @Override
@@ -69,7 +70,9 @@ public class MaterialListPreference extends ListPreference {
   }
 
   public RecyclerView getRecyclerView() {
-    if (getDialog() == null) return null;
+    if (getDialog() == null) {
+      return null;
+    }
     return ((MaterialDialog) getDialog()).getRecyclerView();
   }
 
@@ -106,11 +109,13 @@ public class MaterialListPreference extends ListPreference {
         .autoDismiss(true) // immediately close the dialog after selection
         .itemsCallbackSingleChoice(preselect, new MaterialDialog.ListCallbackSingleChoice() {
           @Override
-          public boolean onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) {
+          public boolean onSelection(MaterialDialog dialog, View itemView, int which,
+              CharSequence text) {
             onClick(null, DialogInterface.BUTTON_POSITIVE);
             if (which >= 0 && getEntryValues() != null) {
               try {
-                Field clickedIndex = ListPreference.class.getDeclaredField("mClickedDialogEntryIndex");
+                Field clickedIndex = ListPreference.class
+                    .getDeclaredField("mClickedDialogEntryIndex");
                 clickedIndex.setAccessible(true);
                 clickedIndex.set(MaterialListPreference.this, which);
               } catch (Exception e) {
@@ -132,8 +137,9 @@ public class MaterialListPreference extends ListPreference {
     PrefUtil.registerOnActivityDestroyListener(this, this);
 
     dialog = builder.build();
-    if (state != null)
+    if (state != null) {
       dialog.onRestoreInstanceState(state);
+    }
     onClick(dialog, DialogInterface.BUTTON_NEGATIVE);
     dialog.show();
   }
@@ -147,8 +153,9 @@ public class MaterialListPreference extends ListPreference {
   @Override
   public void onActivityDestroy() {
     super.onActivityDestroy();
-    if (dialog != null && dialog.isShowing())
+    if (dialog != null && dialog.isShowing()) {
       dialog.dismiss();
+    }
   }
 
   @Override

+ 35 - 25
commons/src/main/java/com/afollestad/materialdialogs/prefs/MaterialMultiSelectListPreference.java

@@ -12,10 +12,8 @@ import android.preference.MultiSelectListPreference;
 import android.support.annotation.NonNull;
 import android.util.AttributeSet;
 import android.view.View;
-
 import com.afollestad.materialdialogs.DialogAction;
 import com.afollestad.materialdialogs.MaterialDialog;
-
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -49,7 +47,8 @@ public class MaterialMultiSelectListPreference extends MultiSelectListPreference
   }
 
   @TargetApi(Build.VERSION_CODES.LOLLIPOP)
-  public MaterialMultiSelectListPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+  public MaterialMultiSelectListPreference(Context context, AttributeSet attrs, int defStyleAttr,
+      int defStyleRes) {
     super(context, attrs, defStyleAttr, defStyleRes);
     init(context, attrs);
   }
@@ -57,15 +56,17 @@ public class MaterialMultiSelectListPreference extends MultiSelectListPreference
   @Override
   public void setEntries(CharSequence[] entries) {
     super.setEntries(entries);
-    if (mDialog != null)
+    if (mDialog != null) {
       mDialog.setItems(entries);
+    }
   }
 
   private void init(Context context, AttributeSet attrs) {
     this.context = context;
     PrefUtil.setLayoutResource(context, this, attrs);
-    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1)
+    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
       setWidgetLayoutResource(0);
+    }
   }
 
   @Override
@@ -78,8 +79,9 @@ public class MaterialMultiSelectListPreference extends MultiSelectListPreference
     List<Integer> indices = new ArrayList<>();
     for (String s : getValues()) {
       int index = findIndexOfValue(s);
-      if (index >= 0)
+      if (index >= 0) {
         indices.add(findIndexOfValue(s));
+      }
     }
     MaterialDialog.Builder builder = new MaterialDialog.Builder(context)
         .title(getDialogTitle())
@@ -91,32 +93,38 @@ public class MaterialMultiSelectListPreference extends MultiSelectListPreference
           public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
             switch (which) {
               default:
-                MaterialMultiSelectListPreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE);
+                MaterialMultiSelectListPreference.this
+                    .onClick(dialog, DialogInterface.BUTTON_POSITIVE);
                 break;
               case NEUTRAL:
-                MaterialMultiSelectListPreference.this.onClick(dialog, DialogInterface.BUTTON_NEUTRAL);
+                MaterialMultiSelectListPreference.this
+                    .onClick(dialog, DialogInterface.BUTTON_NEUTRAL);
                 break;
               case NEGATIVE:
-                MaterialMultiSelectListPreference.this.onClick(dialog, DialogInterface.BUTTON_NEGATIVE);
+                MaterialMultiSelectListPreference.this
+                    .onClick(dialog, DialogInterface.BUTTON_NEGATIVE);
                 break;
             }
           }
         })
         .items(getEntries())
-        .itemsCallbackMultiChoice(indices.toArray(new Integer[indices.size()]), new MaterialDialog.ListCallbackMultiChoice() {
-          @Override
-          public boolean onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text) {
-            onClick(null, DialogInterface.BUTTON_POSITIVE);
-            dialog.dismiss();
-            final Set<String> values = new HashSet<>();
-            for (int i : which) {
-              values.add(getEntryValues()[i].toString());
-            }
-            if (callChangeListener(values))
-              setValues(values);
-            return true;
-          }
-        })
+        .itemsCallbackMultiChoice(indices.toArray(new Integer[indices.size()]),
+            new MaterialDialog.ListCallbackMultiChoice() {
+              @Override
+              public boolean onSelection(MaterialDialog dialog, Integer[] which,
+                  CharSequence[] text) {
+                onClick(null, DialogInterface.BUTTON_POSITIVE);
+                dialog.dismiss();
+                final Set<String> values = new HashSet<>();
+                for (int i : which) {
+                  values.add(getEntryValues()[i].toString());
+                }
+                if (callChangeListener(values)) {
+                  setValues(values);
+                }
+                return true;
+              }
+            })
         .dismissListener(this);
 
     final View contentView = onCreateDialogView();
@@ -130,8 +138,9 @@ public class MaterialMultiSelectListPreference extends MultiSelectListPreference
     PrefUtil.registerOnActivityDestroyListener(this, this);
 
     mDialog = builder.build();
-    if (state != null)
+    if (state != null) {
       mDialog.onRestoreInstanceState(state);
+    }
     mDialog.show();
   }
 
@@ -144,8 +153,9 @@ public class MaterialMultiSelectListPreference extends MultiSelectListPreference
   @Override
   public void onActivityDestroy() {
     super.onActivityDestroy();
-    if (mDialog != null && mDialog.isShowing())
+    if (mDialog != null && mDialog.isShowing()) {
       mDialog.dismiss();
+    }
   }
 
   @Override

+ 8 - 6
commons/src/main/java/com/afollestad/materialdialogs/prefs/PrefUtil.java

@@ -8,9 +8,7 @@ import android.preference.PreferenceManager;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 import android.util.AttributeSet;
-
 import com.afollestad.materialdialogs.commons.R;
-
 import java.lang.reflect.Method;
 
 /**
@@ -21,7 +19,8 @@ class PrefUtil {
   private PrefUtil() {
   }
 
-  static void setLayoutResource(@NonNull Context context, @NonNull Preference preference, @Nullable AttributeSet attrs) {
+  static void setLayoutResource(@NonNull Context context, @NonNull Preference preference,
+      @Nullable AttributeSet attrs) {
     boolean foundLayout = false;
     if (attrs != null) {
       for (int i = 0; i < attrs.getAttributeCount(); i++) {
@@ -44,11 +43,13 @@ class PrefUtil {
       }
     }
 
-    if (!foundLayout && !useStockLayout)
+    if (!foundLayout && !useStockLayout) {
       preference.setLayoutResource(R.layout.md_preference_custom);
+    }
   }
 
-  static void registerOnActivityDestroyListener(@NonNull Preference preference, @NonNull PreferenceManager.OnActivityDestroyListener listener) {
+  static void registerOnActivityDestroyListener(@NonNull Preference preference,
+      @NonNull PreferenceManager.OnActivityDestroyListener listener) {
     try {
       PreferenceManager pm = preference.getPreferenceManager();
       Method method = pm.getClass().getDeclaredMethod(
@@ -60,7 +61,8 @@ class PrefUtil {
     }
   }
 
-  static void unregisterOnActivityDestroyListener(@NonNull Preference preference, @NonNull PreferenceManager.OnActivityDestroyListener listener) {
+  static void unregisterOnActivityDestroyListener(@NonNull Preference preference,
+      @NonNull PreferenceManager.OnActivityDestroyListener listener) {
     try {
       PreferenceManager pm = preference.getPreferenceManager();
       Method method = pm.getClass().getDeclaredMethod(

+ 4 - 3
commons/src/main/java/com/afollestad/materialdialogs/simplelist/MaterialSimpleListAdapter.java

@@ -7,11 +7,9 @@ import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ImageView;
 import android.widget.TextView;
-
 import com.afollestad.materialdialogs.MaterialDialog;
 import com.afollestad.materialdialogs.commons.R;
 import com.afollestad.materialdialogs.internal.MDAdapter;
-
 import java.util.ArrayList;
 import java.util.List;
 
@@ -21,11 +19,13 @@ import java.util.List;
  *
  * @author Aidan Follestad (afollestad)
  */
-public class MaterialSimpleListAdapter extends RecyclerView.Adapter<MaterialSimpleListAdapter.SimpleListVH> implements MDAdapter {
+public class MaterialSimpleListAdapter extends
+    RecyclerView.Adapter<MaterialSimpleListAdapter.SimpleListVH> implements MDAdapter {
 
   private MaterialDialog dialog;
   private List<MaterialSimpleListItem> items;
   private Callback callback;
+
   public MaterialSimpleListAdapter(Callback callback) {
     items = new ArrayList<>(4);
     this.callback = callback;
@@ -82,6 +82,7 @@ public class MaterialSimpleListAdapter extends RecyclerView.Adapter<MaterialSimp
   }
 
   public interface Callback {
+
     void onMaterialListItemSelected(MaterialDialog dialog, int index, MaterialSimpleListItem item);
   }
 

+ 4 - 3
commons/src/main/java/com/afollestad/materialdialogs/simplelist/MaterialSimpleListItem.java

@@ -13,7 +13,6 @@ import android.support.annotation.Nullable;
 import android.support.annotation.StringRes;
 import android.support.v4.content.ContextCompat;
 import android.util.TypedValue;
-
 import com.afollestad.materialdialogs.util.DialogUtils;
 
 /**
@@ -55,9 +54,11 @@ public class MaterialSimpleListItem {
 
   @Override
   public String toString() {
-    if (getContent() != null)
+    if (getContent() != null) {
       return getContent().toString();
-    else return "(no content)";
+    } else {
+      return "(no content)";
+    }
   }
 
   public static class Builder {

+ 5 - 5
commons/src/main/res/drawable/gray_circle.xml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
-    android:shape="oval">
-    <solid android:color="#BCBCBC" />
-    <size
-        android:width="@dimen/md_simplelist_icon"
-        android:height="@dimen/md_simplelist_icon" />
+  android:shape="oval">
+  <solid android:color="#BCBCBC" />
+  <size
+    android:width="@dimen/md_simplelist_icon"
+    android:height="@dimen/md_simplelist_icon" />
 </shape>

+ 11 - 11
commons/src/main/res/layout/md_dialog_colorchooser.xml

@@ -1,19 +1,19 @@
 <?xml version="1.0" encoding="utf-8"?>
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent">
+  android:layout_width="match_parent"
+  android:layout_height="match_parent">
 
-    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="vertical">
+  <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical">
 
-        <include layout="@layout/md_stub_colorchooser_grid" />
+    <include layout="@layout/md_stub_colorchooser_grid" />
 
-        <include
-            layout="@layout/md_stub_colorchooser_custom"
-            android:visibility="gone" />
+    <include
+      layout="@layout/md_stub_colorchooser_custom"
+      android:visibility="gone" />
 
-    </FrameLayout>
+  </FrameLayout>
 
 </ScrollView>

+ 64 - 64
commons/src/main/res/layout/md_preference_custom.xml

@@ -1,74 +1,74 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:baselineAligned="false"
-    android:gravity="center_vertical"
-    android:minHeight="?android:attr/listPreferredItemHeight"
-    android:orientation="horizontal"
-    android:paddingEnd="?android:attr/scrollbarSize"
-    android:paddingRight="?android:attr/scrollbarSize"
-    tools:ignore="RtlSymmetry,UnusedAttribute">
+  xmlns:tools="http://schemas.android.com/tools"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:baselineAligned="false"
+  android:gravity="center_vertical"
+  android:minHeight="?android:attr/listPreferredItemHeight"
+  android:orientation="horizontal"
+  android:paddingEnd="?android:attr/scrollbarSize"
+  android:paddingRight="?android:attr/scrollbarSize"
+  tools:ignore="RtlSymmetry,UnusedAttribute">
 
-    <ImageView
-        android:id="@android:id/icon"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center"
-        android:layout_marginLeft="@dimen/md_preference_content_inset"
-        android:layout_marginStart="@dimen/md_preference_content_inset"
-        tools:ignore="ContentDescription" />
+  <ImageView
+    android:id="@android:id/icon"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center"
+    android:layout_marginLeft="@dimen/md_preference_content_inset"
+    android:layout_marginStart="@dimen/md_preference_content_inset"
+    tools:ignore="ContentDescription" />
 
-    <RelativeLayout
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:layout_gravity="left|start|center_vertical"
-        android:layout_marginBottom="12dip"
-        android:layout_marginEnd="6dip"
-        android:layout_marginLeft="@dimen/md_preference_content_inset"
-        android:layout_marginRight="6dip"
-        android:layout_marginStart="@dimen/md_preference_content_inset"
-        android:layout_marginTop="12dip"
-        android:layout_weight="1">
+  <RelativeLayout
+    android:layout_width="0dp"
+    android:layout_height="wrap_content"
+    android:layout_gravity="left|start|center_vertical"
+    android:layout_marginBottom="12dip"
+    android:layout_marginEnd="6dip"
+    android:layout_marginLeft="@dimen/md_preference_content_inset"
+    android:layout_marginRight="6dip"
+    android:layout_marginStart="@dimen/md_preference_content_inset"
+    android:layout_marginTop="12dip"
+    android:layout_weight="1">
 
-        <TextView
-            android:id="@android:id/title"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignParentLeft="true"
-            android:layout_alignParentStart="true"
-            android:ellipsize="marquee"
-            android:fadingEdge="horizontal"
-            android:fontFamily="sans-serif"
-            android:lines="1"
-            android:textColor="?android:textColorPrimary"
-            android:textSize="16sp"
-            tools:text="Title" />
+    <TextView
+      android:id="@android:id/title"
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:layout_alignParentLeft="true"
+      android:layout_alignParentStart="true"
+      android:ellipsize="marquee"
+      android:fadingEdge="horizontal"
+      android:fontFamily="sans-serif"
+      android:lines="1"
+      android:textColor="?android:textColorPrimary"
+      android:textSize="16sp"
+      tools:text="Title" />
 
-        <TextView
-            android:id="@android:id/summary"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignLeft="@android:id/title"
-            android:layout_alignStart="@android:id/title"
-            android:layout_below="@android:id/title"
-            android:layout_marginTop="2dp"
-            android:fontFamily="sans-serif"
-            android:maxLines="4"
-            android:textColor="?android:textColorSecondary"
-            android:textSize="14sp"
-            tools:text="Summary" />
+    <TextView
+      android:id="@android:id/summary"
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:layout_alignLeft="@android:id/title"
+      android:layout_alignStart="@android:id/title"
+      android:layout_below="@android:id/title"
+      android:layout_marginTop="2dp"
+      android:fontFamily="sans-serif"
+      android:maxLines="4"
+      android:textColor="?android:textColorSecondary"
+      android:textSize="14sp"
+      tools:text="Summary" />
 
-    </RelativeLayout>
+  </RelativeLayout>
 
-    <!-- Preference should place its actual preference widget here. -->
-    <LinearLayout
-        android:id="@android:id/widget_frame"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:layout_gravity="end|right|center_vertical"
-        android:gravity="center_vertical"
-        android:orientation="vertical" />
+  <!-- Preference should place its actual preference widget here. -->
+  <LinearLayout
+    android:id="@android:id/widget_frame"
+    android:layout_width="wrap_content"
+    android:layout_height="match_parent"
+    android:layout_gravity="end|right|center_vertical"
+    android:gravity="center_vertical"
+    android:orientation="vertical" />
 
 </LinearLayout>

+ 31 - 32
commons/src/main/res/layout/md_simplelist_item.xml

@@ -1,37 +1,36 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:background="?selectableItemBackground"
-    android:focusable="true"
-    android:gravity="start|center_vertical"
-    android:minHeight="@dimen/md_simpleitem_height"
-    android:orientation="horizontal"
-    android:paddingEnd="@dimen/md_dialog_frame_margin"
-    android:paddingLeft="@dimen/md_dialog_frame_margin"
-    android:paddingRight="@dimen/md_dialog_frame_margin"
-    android:paddingStart="@dimen/md_dialog_frame_margin">
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:tools="http://schemas.android.com/tools"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:background="?selectableItemBackground"
+  android:focusable="true"
+  android:gravity="start|center_vertical"
+  android:minHeight="@dimen/md_simpleitem_height"
+  android:orientation="horizontal"
+  android:paddingEnd="@dimen/md_dialog_frame_margin"
+  android:paddingLeft="@dimen/md_dialog_frame_margin"
+  android:paddingRight="@dimen/md_dialog_frame_margin"
+  android:paddingStart="@dimen/md_dialog_frame_margin">
 
-    <ImageView
-        android:id="@android:id/icon"
-        android:layout_width="@dimen/md_simplelist_icon"
-        android:layout_height="@dimen/md_simplelist_icon"
-        android:layout_gravity="start|center_vertical"
-        android:layout_marginEnd="@dimen/md_simplelist_icon_margin"
-        android:layout_marginRight="@dimen/md_simplelist_icon_margin"
-        android:background="@drawable/gray_circle"
-        android:scaleType="fitXY"
-        tools:background="#f5f5f5"
-        tools:ignore="ContentDescription"/>
+  <ImageView
+    android:id="@android:id/icon"
+    android:layout_width="@dimen/md_simplelist_icon"
+    android:layout_height="@dimen/md_simplelist_icon"
+    android:layout_gravity="start|center_vertical"
+    android:layout_marginEnd="@dimen/md_simplelist_icon_margin"
+    android:layout_marginRight="@dimen/md_simplelist_icon_margin"
+    android:background="@drawable/gray_circle"
+    android:scaleType="fitXY"
+    tools:background="#f5f5f5"
+    tools:ignore="ContentDescription" />
 
-    <TextView
-        android:id="@android:id/title"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center_vertical"
-        android:textSize="@dimen/md_simplelist_textsize"
-        tools:text="Title"/>
+  <TextView
+    android:id="@android:id/title"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center_vertical"
+    android:textSize="@dimen/md_simplelist_textsize"
+    tools:text="Title" />
 
 </LinearLayout>

+ 230 - 231
commons/src/main/res/layout/md_stub_colorchooser_custom.xml

@@ -1,236 +1,235 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:id="@+id/md_colorChooserCustomFrame"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:tools="http://schemas.android.com/tools"
+  android:id="@+id/md_colorChooserCustomFrame"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:orientation="vertical"
+  android:paddingBottom="@dimen/md_title_frame_margin_bottom"
+  android:paddingTop="@dimen/md_title_frame_margin_bottom">
+
+  <View
+    android:id="@+id/md_colorIndicator"
+    android:layout_width="match_parent"
+    android:layout_height="120dp"
+    tools:background="@color/md_material_blue_600" />
+
+  <LinearLayout
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center_horizontal"
+    android:layout_marginTop="@dimen/md_title_frame_margin_bottom"
+    android:gravity="center">
+
+    <TextView
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:layout_marginEnd="2dp"
+      android:layout_marginRight="2dp"
+      android:digits="0123456789abcdefABCDEF"
+      android:text="#"
+      android:textColor="?android:textColorPrimary"
+      android:textColorHint="?android:textColorSecondary"
+      android:textSize="@dimen/md_title_textsize"
+      tools:ignore="HardcodedText,TextViewEdits" />
+
+    <EditText
+      android:id="@+id/md_hexInput"
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:digits="0123456789abcdefABCDEF"
+      android:focusable="true"
+      android:hint="FF0099CC"
+      android:textSize="@dimen/md_title_textsize"
+      tools:ignore="HardcodedText" />
+
+  </LinearLayout>
+
+  <RelativeLayout
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:orientation="vertical"
-    android:paddingBottom="@dimen/md_title_frame_margin_bottom"
-    android:paddingTop="@dimen/md_title_frame_margin_bottom">
-
-    <View
-        android:id="@+id/md_colorIndicator"
-        android:layout_width="match_parent"
-        android:layout_height="120dp"
-        tools:background="@color/md_material_blue_600"/>
-
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center_horizontal"
-        android:layout_marginTop="@dimen/md_title_frame_margin_bottom"
-        android:gravity="center">
-
-        <TextView
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginEnd="2dp"
-            android:layout_marginRight="2dp"
-            android:digits="0123456789abcdefABCDEF"
-            android:text="#"
-            android:textColor="?android:textColorPrimary"
-            android:textColorHint="?android:textColorSecondary"
-            android:textSize="@dimen/md_title_textsize"
-            tools:ignore="HardcodedText,TextViewEdits"/>
-
-        <EditText
-            android:id="@+id/md_hexInput"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:digits="0123456789abcdefABCDEF"
-            android:focusable="true"
-            android:hint="FF0099CC"
-            android:textSize="@dimen/md_title_textsize"
-            tools:ignore="HardcodedText"/>
-
-    </LinearLayout>
-
-    <RelativeLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="@dimen/md_title_frame_margin_bottom"
-        android:paddingLeft="@dimen/md_dialog_frame_margin"
-        android:paddingRight="@dimen/md_dialog_frame_margin">
-
-        <!-- Alpha -->
-
-        <TextView
-            android:id="@+id/md_colorALabel"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignBottom="@+id/md_colorA"
-            android:layout_alignTop="@+id/md_colorA"
-            android:layout_marginEnd="4dp"
-            android:layout_marginRight="4dp"
-            android:text="A"
-            android:textColor="?android:textColorPrimary"
-            android:textSize="@dimen/md_content_textsize"
-            tools:ignore="HardcodedText"/>
-
-        <SeekBar
-            android:id="@+id/md_colorA"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="@dimen/md_title_frame_margin_bottom"
-            android:layout_toEndOf="@+id/md_colorALabel"
-            android:layout_toLeftOf="@+id/md_colorAValue"
-            android:layout_toRightOf="@+id/md_colorALabel"
-            android:layout_toStartOf="@+id/md_colorAValue"
-            android:focusable="true"
-            android:max="255"/>
-
-        <TextView
-            android:id="@+id/md_colorAValue"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignBottom="@+id/md_colorA"
-            android:layout_alignParentEnd="true"
-            android:layout_alignParentRight="true"
-            android:layout_alignTop="@+id/md_colorA"
-            android:layout_marginLeft="4dp"
-            android:layout_marginStart="4dp"
-            android:gravity="center"
-            android:minWidth="24dp"
-            android:text="0"
-            android:textColor="?android:textColorPrimary"
-            android:textSize="@dimen/md_content_textsize"
-            tools:ignore="HardcodedText"/>
-
-        <!-- Red -->
-
-        <TextView
-            android:id="@+id/md_colorRLabel"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignBottom="@+id/md_colorR"
-            android:layout_alignTop="@+id/md_colorR"
-            android:layout_marginEnd="4dp"
-            android:layout_marginRight="4dp"
-            android:text="R"
-            android:textColor="?android:textColorPrimary"
-            android:textSize="@dimen/md_content_textsize"
-            tools:ignore="HardcodedText"/>
-
-        <SeekBar
-            android:id="@+id/md_colorR"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@+id/md_colorA"
-            android:layout_marginTop="@dimen/md_title_frame_margin_bottom"
-            android:layout_toEndOf="@+id/md_colorRLabel"
-            android:layout_toLeftOf="@+id/md_colorRValue"
-            android:layout_toRightOf="@+id/md_colorRLabel"
-            android:layout_toStartOf="@+id/md_colorRValue"
-            android:focusable="true"
-            android:max="255"/>
-
-        <TextView
-            android:id="@+id/md_colorRValue"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignBottom="@+id/md_colorR"
-            android:layout_alignParentEnd="true"
-            android:layout_alignParentRight="true"
-            android:layout_alignTop="@+id/md_colorR"
-            android:layout_marginLeft="4dp"
-            android:layout_marginStart="4dp"
-            android:gravity="center"
-            android:minWidth="24dp"
-            android:text="0"
-            android:textColor="?android:textColorPrimary"
-            android:textSize="@dimen/md_content_textsize"
-            tools:ignore="HardcodedText"/>
-
-        <!-- Green -->
-
-        <TextView
-            android:id="@+id/md_colorGLabel"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignBottom="@+id/md_colorG"
-            android:layout_alignTop="@+id/md_colorG"
-            android:layout_marginEnd="4dp"
-            android:layout_marginRight="4dp"
-            android:text="G"
-            android:textColor="?android:textColorPrimary"
-            android:textSize="@dimen/md_content_textsize"
-            tools:ignore="HardcodedText"/>
-
-        <SeekBar
-            android:id="@+id/md_colorG"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@+id/md_colorR"
-            android:layout_marginTop="@dimen/md_title_frame_margin_bottom"
-            android:layout_toEndOf="@+id/md_colorGLabel"
-            android:layout_toLeftOf="@+id/md_colorGValue"
-            android:layout_toRightOf="@+id/md_colorGLabel"
-            android:layout_toStartOf="@+id/md_colorGValue"
-            android:focusable="true"
-            android:max="255"/>
-
-        <TextView
-            android:id="@+id/md_colorGValue"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignBottom="@+id/md_colorG"
-            android:layout_alignParentEnd="true"
-            android:layout_alignParentRight="true"
-            android:layout_alignTop="@+id/md_colorG"
-            android:layout_marginLeft="4dp"
-            android:layout_marginStart="4dp"
-            android:gravity="center"
-            android:minWidth="24dp"
-            android:text="0"
-            android:textColor="?android:textColorPrimary"
-            android:textSize="@dimen/md_content_textsize"
-            tools:ignore="HardcodedText"/>
-
-        <!-- Blue -->
-
-        <TextView
-            android:id="@+id/md_colorBLabel"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignBottom="@+id/md_colorB"
-            android:layout_alignTop="@+id/md_colorB"
-            android:layout_marginEnd="4dp"
-            android:layout_marginRight="4dp"
-            android:text="B"
-            android:textColor="?android:textColorPrimary"
-            android:textSize="@dimen/md_content_textsize"
-            tools:ignore="HardcodedText"/>
-
-        <SeekBar
-            android:id="@+id/md_colorB"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@+id/md_colorG"
-            android:layout_marginTop="@dimen/md_title_frame_margin_bottom"
-            android:layout_toEndOf="@+id/md_colorBLabel"
-            android:layout_toLeftOf="@+id/md_colorBValue"
-            android:layout_toRightOf="@+id/md_colorBLabel"
-            android:layout_toStartOf="@+id/md_colorBValue"
-            android:max="255"/>
-
-        <TextView
-            android:id="@+id/md_colorBValue"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignBottom="@+id/md_colorB"
-            android:layout_alignParentEnd="true"
-            android:layout_alignParentRight="true"
-            android:layout_alignTop="@+id/md_colorB"
-            android:layout_marginLeft="4dp"
-            android:layout_marginStart="4dp"
-            android:gravity="center"
-            android:minWidth="24dp"
-            android:text="0"
-            android:textColor="?android:textColorPrimary"
-            android:textSize="@dimen/md_content_textsize"
-            tools:ignore="HardcodedText"/>
-
-    </RelativeLayout>
+    android:layout_marginTop="@dimen/md_title_frame_margin_bottom"
+    android:paddingLeft="@dimen/md_dialog_frame_margin"
+    android:paddingRight="@dimen/md_dialog_frame_margin">
+
+    <!-- Alpha -->
+
+    <TextView
+      android:id="@+id/md_colorALabel"
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:layout_alignBottom="@+id/md_colorA"
+      android:layout_alignTop="@+id/md_colorA"
+      android:layout_marginEnd="4dp"
+      android:layout_marginRight="4dp"
+      android:text="A"
+      android:textColor="?android:textColorPrimary"
+      android:textSize="@dimen/md_content_textsize"
+      tools:ignore="HardcodedText" />
+
+    <SeekBar
+      android:id="@+id/md_colorA"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:layout_marginTop="@dimen/md_title_frame_margin_bottom"
+      android:layout_toEndOf="@+id/md_colorALabel"
+      android:layout_toLeftOf="@+id/md_colorAValue"
+      android:layout_toRightOf="@+id/md_colorALabel"
+      android:layout_toStartOf="@+id/md_colorAValue"
+      android:focusable="true"
+      android:max="255" />
+
+    <TextView
+      android:id="@+id/md_colorAValue"
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:layout_alignBottom="@+id/md_colorA"
+      android:layout_alignParentEnd="true"
+      android:layout_alignParentRight="true"
+      android:layout_alignTop="@+id/md_colorA"
+      android:layout_marginLeft="4dp"
+      android:layout_marginStart="4dp"
+      android:gravity="center"
+      android:minWidth="24dp"
+      android:text="0"
+      android:textColor="?android:textColorPrimary"
+      android:textSize="@dimen/md_content_textsize"
+      tools:ignore="HardcodedText" />
+
+    <!-- Red -->
+
+    <TextView
+      android:id="@+id/md_colorRLabel"
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:layout_alignBottom="@+id/md_colorR"
+      android:layout_alignTop="@+id/md_colorR"
+      android:layout_marginEnd="4dp"
+      android:layout_marginRight="4dp"
+      android:text="R"
+      android:textColor="?android:textColorPrimary"
+      android:textSize="@dimen/md_content_textsize"
+      tools:ignore="HardcodedText" />
+
+    <SeekBar
+      android:id="@+id/md_colorR"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:layout_below="@+id/md_colorA"
+      android:layout_marginTop="@dimen/md_title_frame_margin_bottom"
+      android:layout_toEndOf="@+id/md_colorRLabel"
+      android:layout_toLeftOf="@+id/md_colorRValue"
+      android:layout_toRightOf="@+id/md_colorRLabel"
+      android:layout_toStartOf="@+id/md_colorRValue"
+      android:focusable="true"
+      android:max="255" />
+
+    <TextView
+      android:id="@+id/md_colorRValue"
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:layout_alignBottom="@+id/md_colorR"
+      android:layout_alignParentEnd="true"
+      android:layout_alignParentRight="true"
+      android:layout_alignTop="@+id/md_colorR"
+      android:layout_marginLeft="4dp"
+      android:layout_marginStart="4dp"
+      android:gravity="center"
+      android:minWidth="24dp"
+      android:text="0"
+      android:textColor="?android:textColorPrimary"
+      android:textSize="@dimen/md_content_textsize"
+      tools:ignore="HardcodedText" />
+
+    <!-- Green -->
+
+    <TextView
+      android:id="@+id/md_colorGLabel"
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:layout_alignBottom="@+id/md_colorG"
+      android:layout_alignTop="@+id/md_colorG"
+      android:layout_marginEnd="4dp"
+      android:layout_marginRight="4dp"
+      android:text="G"
+      android:textColor="?android:textColorPrimary"
+      android:textSize="@dimen/md_content_textsize"
+      tools:ignore="HardcodedText" />
+
+    <SeekBar
+      android:id="@+id/md_colorG"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:layout_below="@+id/md_colorR"
+      android:layout_marginTop="@dimen/md_title_frame_margin_bottom"
+      android:layout_toEndOf="@+id/md_colorGLabel"
+      android:layout_toLeftOf="@+id/md_colorGValue"
+      android:layout_toRightOf="@+id/md_colorGLabel"
+      android:layout_toStartOf="@+id/md_colorGValue"
+      android:focusable="true"
+      android:max="255" />
+
+    <TextView
+      android:id="@+id/md_colorGValue"
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:layout_alignBottom="@+id/md_colorG"
+      android:layout_alignParentEnd="true"
+      android:layout_alignParentRight="true"
+      android:layout_alignTop="@+id/md_colorG"
+      android:layout_marginLeft="4dp"
+      android:layout_marginStart="4dp"
+      android:gravity="center"
+      android:minWidth="24dp"
+      android:text="0"
+      android:textColor="?android:textColorPrimary"
+      android:textSize="@dimen/md_content_textsize"
+      tools:ignore="HardcodedText" />
+
+    <!-- Blue -->
+
+    <TextView
+      android:id="@+id/md_colorBLabel"
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:layout_alignBottom="@+id/md_colorB"
+      android:layout_alignTop="@+id/md_colorB"
+      android:layout_marginEnd="4dp"
+      android:layout_marginRight="4dp"
+      android:text="B"
+      android:textColor="?android:textColorPrimary"
+      android:textSize="@dimen/md_content_textsize"
+      tools:ignore="HardcodedText" />
+
+    <SeekBar
+      android:id="@+id/md_colorB"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:layout_below="@+id/md_colorG"
+      android:layout_marginTop="@dimen/md_title_frame_margin_bottom"
+      android:layout_toEndOf="@+id/md_colorBLabel"
+      android:layout_toLeftOf="@+id/md_colorBValue"
+      android:layout_toRightOf="@+id/md_colorBLabel"
+      android:layout_toStartOf="@+id/md_colorBValue"
+      android:max="255" />
+
+    <TextView
+      android:id="@+id/md_colorBValue"
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:layout_alignBottom="@+id/md_colorB"
+      android:layout_alignParentEnd="true"
+      android:layout_alignParentRight="true"
+      android:layout_alignTop="@+id/md_colorB"
+      android:layout_marginLeft="4dp"
+      android:layout_marginStart="4dp"
+      android:gravity="center"
+      android:minWidth="24dp"
+      android:text="0"
+      android:textColor="?android:textColorPrimary"
+      android:textSize="@dimen/md_content_textsize"
+      tools:ignore="HardcodedText" />
+
+  </RelativeLayout>
 
 </LinearLayout>

+ 13 - 14
commons/src/main/res/layout/md_stub_colorchooser_grid.xml

@@ -1,15 +1,14 @@
 <?xml version="1.0" encoding="utf-8"?>
-<com.afollestad.materialdialogs.color.FillGridView
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/md_grid"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:clipToPadding="false"
-    android:columnWidth="@dimen/md_colorchooser_circlesize"
-    android:gravity="center"
-    android:horizontalSpacing="8dp"
-    android:numColumns="auto_fit"
-    android:orientation="vertical"
-    android:padding="16dp"
-    android:stretchMode="columnWidth"
-    android:verticalSpacing="8dp"/>
+<com.afollestad.materialdialogs.color.FillGridView xmlns:android="http://schemas.android.com/apk/res/android"
+  android:id="@+id/md_grid"
+  android:layout_width="match_parent"
+  android:layout_height="match_parent"
+  android:clipToPadding="false"
+  android:columnWidth="@dimen/md_colorchooser_circlesize"
+  android:gravity="center"
+  android:horizontalSpacing="8dp"
+  android:numColumns="auto_fit"
+  android:orientation="vertical"
+  android:padding="16dp"
+  android:stretchMode="columnWidth"
+  android:verticalSpacing="8dp" />

+ 24 - 25
commons/src/main/res/layout/md_stub_inputpref.xml

@@ -1,29 +1,28 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:gravity="start"
-    android:orientation="vertical"
-    android:paddingBottom="@dimen/md_content_padding_bottom"
-    android:paddingLeft="@dimen/md_dialog_frame_margin"
-    android:paddingRight="@dimen/md_dialog_frame_margin"
-    android:paddingTop="@dimen/md_content_padding_top">
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:tools="http://schemas.android.com/tools"
+  android:layout_width="match_parent"
+  android:layout_height="match_parent"
+  android:gravity="start"
+  android:orientation="vertical"
+  android:paddingBottom="@dimen/md_content_padding_bottom"
+  android:paddingLeft="@dimen/md_dialog_frame_margin"
+  android:paddingRight="@dimen/md_dialog_frame_margin"
+  android:paddingTop="@dimen/md_content_padding_top">
 
-    <TextView
-        android:id="@android:id/message"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center_horizontal"
-        android:layout_marginBottom="@dimen/md_content_padding_bottom"
-        android:layout_marginTop="4dp"
-        android:focusable="true"
-        android:fontFamily="sans-serif"
-        android:paddingLeft="2dp"
-        android:paddingRight="2dp"
-        android:textSize="@dimen/md_content_textsize"
-        tools:ignore="UnusedAttribute"
-        tools:text="Message"/>
+  <TextView
+    android:id="@android:id/message"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center_horizontal"
+    android:layout_marginBottom="@dimen/md_content_padding_bottom"
+    android:layout_marginTop="4dp"
+    android:focusable="true"
+    android:fontFamily="sans-serif"
+    android:paddingLeft="2dp"
+    android:paddingRight="2dp"
+    android:textSize="@dimen/md_content_textsize"
+    tools:ignore="UnusedAttribute"
+    tools:text="Message" />
 
 </LinearLayout>

+ 1 - 1
commons/src/main/res/values-large/dimens.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
-    <dimen name="md_preference_content_inset">28dp</dimen>
+  <dimen name="md_preference_content_inset">28dp</dimen>
 
 </resources>

+ 3 - 3
commons/src/main/res/values/attrs.xml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
-    <declare-styleable name="Preference">
-        <attr name="useStockLayout" format="boolean" />
-    </declare-styleable>
+  <declare-styleable name="Preference">
+    <attr name="useStockLayout" format="boolean" />
+  </declare-styleable>
 
 </resources>

+ 6 - 6
commons/src/main/res/values/dimens.xml

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
-    <dimen name="md_simpleitem_height">62dp</dimen>
-    <dimen name="md_simplelist_icon">40dp</dimen>
-    <dimen name="md_simplelist_icon_margin">16dp</dimen>
-    <dimen name="md_simplelist_textsize">18sp</dimen>
+  <dimen name="md_simpleitem_height">62dp</dimen>
+  <dimen name="md_simplelist_icon">40dp</dimen>
+  <dimen name="md_simplelist_icon_margin">16dp</dimen>
+  <dimen name="md_simplelist_textsize">18sp</dimen>
 
-    <dimen name="md_preference_content_inset">16dp</dimen>
-    <dimen name="md_colorchooser_circlesize">56dp</dimen>
+  <dimen name="md_preference_content_inset">16dp</dimen>
+  <dimen name="md_colorchooser_circlesize">56dp</dimen>
 
 </resources>

+ 9 - 9
commons/src/main/res/values/strings.xml

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <string name="md_back_label">Back</string>
-    <string name="md_done_label">Done</string>
-    <string name="md_cancel_label">Cancel</string>
-    <string name="md_choose_label">Choose</string>
-    <string name="md_error_label">Error</string>
-    <string name="md_storage_perm_error">Your app has not been granted the READ_EXTERNAL_STORAGE permission.</string>
-    <string name="md_custom_label">Custom</string>
-    <string name="md_presets_label">Presets</string>
-    <string name="new_folder">New Folder</string>
+  <string name="md_back_label">Back</string>
+  <string name="md_done_label">Done</string>
+  <string name="md_cancel_label">Cancel</string>
+  <string name="md_choose_label">Choose</string>
+  <string name="md_error_label">Error</string>
+  <string name="md_storage_perm_error">Your app has not been granted the READ_EXTERNAL_STORAGE permission.</string>
+  <string name="md_custom_label">Custom</string>
+  <string name="md_presets_label">Presets</string>
+  <string name="new_folder">New Folder</string>
 </resources>

+ 4 - 7
core/src/main/AndroidManifest.xml

@@ -1,9 +1,6 @@
-<manifest
-    xmlns:tools="http://schemas.android.com/tools"
-    package="com.afollestad.materialdialogs">
-
-    <uses-sdk tools:overrideLibrary="me.zhanghai.android.materialprogressbar" />
-
-    <application />
+<manifest xmlns:tools="http://schemas.android.com/tools"
+  package="com.afollestad.materialdialogs">
 
+  <uses-sdk tools:overrideLibrary="me.zhanghai.android.materialprogressbar" />
+  <application />
 </manifest>

+ 22 - 12
core/src/main/java/com/afollestad/materialdialogs/DefaultRvAdapter.java

@@ -15,7 +15,6 @@ import android.widget.CompoundButton;
 import android.widget.LinearLayout;
 import android.widget.RadioButton;
 import android.widget.TextView;
-
 import com.afollestad.materialdialogs.internal.MDTintHelper;
 import com.afollestad.materialdialogs.util.DialogUtils;
 
@@ -29,6 +28,7 @@ class DefaultRvAdapter extends RecyclerView.Adapter<DefaultRvAdapter.DefaultVH>
   private final int layout;
   private final GravityEnum itemGravity;
   private InternalListCallback callback;
+
   DefaultRvAdapter(MaterialDialog dialog, @LayoutRes int layout) {
     this.dialog = dialog;
     this.layout = layout;
@@ -85,19 +85,22 @@ class DefaultRvAdapter extends RecyclerView.Adapter<DefaultRvAdapter.DefaultVH>
     setupGravity((ViewGroup) view);
 
     if (dialog.builder.itemIds != null) {
-      if (index < dialog.builder.itemIds.length)
+      if (index < dialog.builder.itemIds.length) {
         view.setId(dialog.builder.itemIds[index]);
-      else view.setId(-1);
+      } else {
+        view.setId(-1);
+      }
     }
 
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
       ViewGroup group = (ViewGroup) view;
       if (group.getChildCount() == 2) {
         // Remove circular selector from check boxes and radio buttons on Lollipop
-        if (group.getChildAt(0) instanceof CompoundButton)
+        if (group.getChildAt(0) instanceof CompoundButton) {
           group.getChildAt(0).setBackground(null);
-        else if (group.getChildAt(1) instanceof CompoundButton)
+        } else if (group.getChildAt(1) instanceof CompoundButton) {
           group.getChildAt(1).setBackground(null);
+        }
       }
     }
   }
@@ -114,7 +117,8 @@ class DefaultRvAdapter extends RecyclerView.Adapter<DefaultRvAdapter.DefaultVH>
     itemRoot.setGravity(gravityInt | Gravity.CENTER_VERTICAL);
 
     if (view.getChildCount() == 2) {
-      if (itemGravity == GravityEnum.END && !isRTL() && view.getChildAt(0) instanceof CompoundButton) {
+      if (itemGravity == GravityEnum.END && !isRTL() && view
+          .getChildAt(0) instanceof CompoundButton) {
         CompoundButton first = (CompoundButton) view.getChildAt(0);
         view.removeView(first);
 
@@ -125,7 +129,8 @@ class DefaultRvAdapter extends RecyclerView.Adapter<DefaultRvAdapter.DefaultVH>
 
         view.addView(second);
         view.addView(first);
-      } else if (itemGravity == GravityEnum.START && isRTL() && view.getChildAt(1) instanceof CompoundButton) {
+      } else if (itemGravity == GravityEnum.START && isRTL() && view
+          .getChildAt(1) instanceof CompoundButton) {
         CompoundButton first = (CompoundButton) view.getChildAt(1);
         view.removeView(first);
 
@@ -142,18 +147,21 @@ class DefaultRvAdapter extends RecyclerView.Adapter<DefaultRvAdapter.DefaultVH>
 
   @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
   private boolean isRTL() {
-    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)
+    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
       return false;
+    }
     Configuration config = dialog.getBuilder().getContext().getResources().getConfiguration();
     return config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
   }
 
   interface InternalListCallback {
 
-    boolean onItemSelected(MaterialDialog dialog, View itemView, int position, CharSequence text, boolean longPress);
+    boolean onItemSelected(MaterialDialog dialog, View itemView, int position, CharSequence text,
+        boolean longPress);
   }
 
-  static class DefaultVH extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
+  static class DefaultVH extends RecyclerView.ViewHolder implements View.OnClickListener,
+      View.OnLongClickListener {
 
     final CompoundButton control;
     final TextView title;
@@ -165,8 +173,9 @@ class DefaultRvAdapter extends RecyclerView.Adapter<DefaultRvAdapter.DefaultVH>
       title = (TextView) itemView.findViewById(R.id.md_title);
       this.adapter = adapter;
       itemView.setOnClickListener(this);
-      if (adapter.dialog.builder.listLongCallback != null)
+      if (adapter.dialog.builder.listLongCallback != null) {
         itemView.setOnLongClickListener(this);
+      }
     }
 
     @Override
@@ -189,7 +198,8 @@ class DefaultRvAdapter extends RecyclerView.Adapter<DefaultRvAdapter.DefaultVH>
             getAdapterPosition() < adapter.dialog.builder.items.size()) {
           text = adapter.dialog.builder.items.get(getAdapterPosition());
         }
-        return adapter.callback.onItemSelected(adapter.dialog, view, getAdapterPosition(), text, true);
+        return adapter.callback
+            .onItemSelected(adapter.dialog, view, getAdapterPosition(), text, true);
       }
       return false;
     }

+ 10 - 6
core/src/main/java/com/afollestad/materialdialogs/DialogBase.java

@@ -6,7 +6,6 @@ import android.content.DialogInterface;
 import android.support.annotation.NonNull;
 import android.view.View;
 import android.view.ViewGroup;
-
 import com.afollestad.materialdialogs.internal.MDRootLayout;
 
 /**
@@ -41,25 +40,30 @@ class DialogBase extends Dialog implements DialogInterface.OnShowListener {
 
   @Override
   public void onShow(DialogInterface dialog) {
-    if (showListener != null)
+    if (showListener != null) {
       showListener.onShow(dialog);
+    }
   }
 
   @Override
   @Deprecated
   public void setContentView(int layoutResID) throws IllegalAccessError {
-    throw new IllegalAccessError("setContentView() is not supported in MaterialDialog. Specify a custom view in the Builder instead.");
+    throw new IllegalAccessError(
+        "setContentView() is not supported in MaterialDialog. Specify a custom view in the Builder instead.");
   }
 
   @Override
   @Deprecated
   public void setContentView(@NonNull View view) throws IllegalAccessError {
-    throw new IllegalAccessError("setContentView() is not supported in MaterialDialog. Specify a custom view in the Builder instead.");
+    throw new IllegalAccessError(
+        "setContentView() is not supported in MaterialDialog. Specify a custom view in the Builder instead.");
   }
 
   @Override
   @Deprecated
-  public void setContentView(@NonNull View view, ViewGroup.LayoutParams params) throws IllegalAccessError {
-    throw new IllegalAccessError("setContentView() is not supported in MaterialDialog. Specify a custom view in the Builder instead.");
+  public void setContentView(@NonNull View view, ViewGroup.LayoutParams params)
+      throws IllegalAccessError {
+    throw new IllegalAccessError(
+        "setContentView() is not supported in MaterialDialog. Specify a custom view in the Builder instead.");
   }
 }

+ 103 - 52
core/src/main/java/com/afollestad/materialdialogs/DialogInit.java

@@ -24,16 +24,13 @@ import android.widget.ImageView;
 import android.widget.ProgressBar;
 import android.widget.ScrollView;
 import android.widget.TextView;
-
 import com.afollestad.materialdialogs.internal.MDAdapter;
 import com.afollestad.materialdialogs.internal.MDButton;
 import com.afollestad.materialdialogs.internal.MDRootLayout;
 import com.afollestad.materialdialogs.internal.MDTintHelper;
 import com.afollestad.materialdialogs.util.DialogUtils;
-
 import java.util.ArrayList;
 import java.util.Arrays;
-
 import me.zhanghai.android.materialprogressbar.HorizontalProgressDrawable;
 import me.zhanghai.android.materialprogressbar.IndeterminateHorizontalProgressDrawable;
 import me.zhanghai.android.materialprogressbar.IndeterminateProgressDrawable;
@@ -48,7 +45,8 @@ class DialogInit {
 
   @StyleRes
   static int getTheme(@NonNull MaterialDialog.Builder builder) {
-    boolean darkTheme = DialogUtils.resolveBoolean(builder.context, R.attr.md_dark_theme, builder.theme == Theme.DARK);
+    boolean darkTheme = DialogUtils
+        .resolveBoolean(builder.context, R.attr.md_dark_theme, builder.theme == Theme.DARK);
     builder.theme = darkTheme ? Theme.DARK : Theme.LIGHT;
     return darkTheme ? R.style.MD_Dark : R.style.MD_Light;
   }
@@ -58,18 +56,21 @@ class DialogInit {
     if (builder.customView != null) {
       return R.layout.md_dialog_custom;
     } else if (builder.items != null || builder.adapter != null) {
-      if (builder.checkBoxPrompt != null)
+      if (builder.checkBoxPrompt != null) {
         return R.layout.md_dialog_list_check;
+      }
       return R.layout.md_dialog_list;
     } else if (builder.progress > -2) {
       return R.layout.md_dialog_progress;
     } else if (builder.indeterminateProgress) {
-      if (builder.indeterminateIsHorizontalProgress)
+      if (builder.indeterminateIsHorizontalProgress) {
         return R.layout.md_dialog_progress_indeterminate_horizontal;
+      }
       return R.layout.md_dialog_progress_indeterminate;
     } else if (builder.inputCallback != null) {
-      if (builder.checkBoxPrompt != null)
+      if (builder.checkBoxPrompt != null) {
         return R.layout.md_dialog_input_check;
+      }
       return R.layout.md_dialog_input;
     } else if (builder.checkBoxPrompt != null) {
       return R.layout.md_dialog_basic_check;
@@ -86,37 +87,57 @@ class DialogInit {
     // Set cancelable flag and dialog background color
     dialog.setCancelable(builder.cancelable);
     dialog.setCanceledOnTouchOutside(builder.canceledOnTouchOutside);
-    if (builder.backgroundColor == 0)
-      builder.backgroundColor = DialogUtils.resolveColor(builder.context, R.attr.md_background_color,
-          DialogUtils.resolveColor(dialog.getContext(), R.attr.colorBackgroundFloating));
+    if (builder.backgroundColor == 0) {
+      builder.backgroundColor = DialogUtils
+          .resolveColor(builder.context, R.attr.md_background_color,
+              DialogUtils.resolveColor(dialog.getContext(), R.attr.colorBackgroundFloating));
+    }
     if (builder.backgroundColor != 0) {
       GradientDrawable drawable = new GradientDrawable();
-      drawable.setCornerRadius(builder.context.getResources().getDimension(R.dimen.md_bg_corner_radius));
+      drawable.setCornerRadius(
+          builder.context.getResources().getDimension(R.dimen.md_bg_corner_radius));
       drawable.setColor(builder.backgroundColor);
       dialog.getWindow().setBackgroundDrawable(drawable);
     }
 
     // Retrieve color theme attributes
-    if (!builder.positiveColorSet)
-      builder.positiveColor = DialogUtils.resolveActionTextColorStateList(builder.context, R.attr.md_positive_color, builder.positiveColor);
-    if (!builder.neutralColorSet)
-      builder.neutralColor = DialogUtils.resolveActionTextColorStateList(builder.context, R.attr.md_neutral_color, builder.neutralColor);
-    if (!builder.negativeColorSet)
-      builder.negativeColor = DialogUtils.resolveActionTextColorStateList(builder.context, R.attr.md_negative_color, builder.negativeColor);
-    if (!builder.widgetColorSet)
-      builder.widgetColor = DialogUtils.resolveColor(builder.context, R.attr.md_widget_color, builder.widgetColor);
+    if (!builder.positiveColorSet) {
+      builder.positiveColor = DialogUtils
+          .resolveActionTextColorStateList(builder.context, R.attr.md_positive_color,
+              builder.positiveColor);
+    }
+    if (!builder.neutralColorSet) {
+      builder.neutralColor = DialogUtils
+          .resolveActionTextColorStateList(builder.context, R.attr.md_neutral_color,
+              builder.neutralColor);
+    }
+    if (!builder.negativeColorSet) {
+      builder.negativeColor = DialogUtils
+          .resolveActionTextColorStateList(builder.context, R.attr.md_negative_color,
+              builder.negativeColor);
+    }
+    if (!builder.widgetColorSet) {
+      builder.widgetColor = DialogUtils
+          .resolveColor(builder.context, R.attr.md_widget_color, builder.widgetColor);
+    }
 
     // Retrieve default title/content colors
     if (!builder.titleColorSet) {
-      final int titleColorFallback = DialogUtils.resolveColor(dialog.getContext(), android.R.attr.textColorPrimary);
-      builder.titleColor = DialogUtils.resolveColor(builder.context, R.attr.md_title_color, titleColorFallback);
+      final int titleColorFallback = DialogUtils
+          .resolveColor(dialog.getContext(), android.R.attr.textColorPrimary);
+      builder.titleColor = DialogUtils
+          .resolveColor(builder.context, R.attr.md_title_color, titleColorFallback);
     }
     if (!builder.contentColorSet) {
-      final int contentColorFallback = DialogUtils.resolveColor(dialog.getContext(), android.R.attr.textColorSecondary);
-      builder.contentColor = DialogUtils.resolveColor(builder.context, R.attr.md_content_color, contentColorFallback);
+      final int contentColorFallback = DialogUtils
+          .resolveColor(dialog.getContext(), android.R.attr.textColorSecondary);
+      builder.contentColor = DialogUtils
+          .resolveColor(builder.context, R.attr.md_content_color, contentColorFallback);
+    }
+    if (!builder.itemColorSet) {
+      builder.itemColor = DialogUtils
+          .resolveColor(builder.context, R.attr.md_item_color, builder.contentColor);
     }
-    if (!builder.itemColorSet)
-      builder.itemColor = DialogUtils.resolveColor(builder.context, R.attr.md_item_color, builder.contentColor);
 
     // Retrieve references to views
     dialog.title = (TextView) dialog.view.findViewById(R.id.md_title);
@@ -132,8 +153,9 @@ class DialogInit {
     dialog.negativeButton = (MDButton) dialog.view.findViewById(R.id.md_buttonDefaultNegative);
 
     // Don't allow the submit button to not be shown for input dialogs
-    if (builder.inputCallback != null && builder.positiveText == null)
+    if (builder.inputCallback != null && builder.positiveText == null) {
       builder.positiveText = builder.context.getText(android.R.string.ok);
+    }
 
     // Set up the initial visibility of action buttons based on whether or not text was set
     dialog.positiveButton.setVisibility(builder.positiveText != null ? View.VISIBLE : View.GONE);
@@ -170,10 +192,13 @@ class DialogInit {
 
     // Setup icon size limiting
     int maxIconSize = builder.maxIconSize;
-    if (maxIconSize == -1)
+    if (maxIconSize == -1) {
       maxIconSize = DialogUtils.resolveDimension(builder.context, R.attr.md_icon_max_size);
-    if (builder.limitIconToDefaultSize || DialogUtils.resolveBoolean(builder.context, R.attr.md_icon_limit_icon_to_default_size))
+    }
+    if (builder.limitIconToDefaultSize || DialogUtils
+        .resolveBoolean(builder.context, R.attr.md_icon_limit_icon_to_default_size)) {
       maxIconSize = builder.context.getResources().getDimensionPixelSize(R.dimen.md_icon_max_size);
+    }
     if (maxIconSize > -1) {
       dialog.icon.setAdjustViewBounds(true);
       dialog.icon.setMaxHeight(maxIconSize);
@@ -184,7 +209,8 @@ class DialogInit {
     // Setup divider color in case content scrolls
     if (!builder.dividerColorSet) {
       final int dividerFallback = DialogUtils.resolveColor(dialog.getContext(), R.attr.md_divider);
-      builder.dividerColor = DialogUtils.resolveColor(builder.context, R.attr.md_divider_color, dividerFallback);
+      builder.dividerColor = DialogUtils
+          .resolveColor(builder.context, R.attr.md_divider_color, dividerFallback);
     }
     dialog.view.setDividerColor(builder.dividerColor);
 
@@ -211,9 +237,12 @@ class DialogInit {
       dialog.content.setMovementMethod(new LinkMovementMethod());
       dialog.setTypeface(dialog.content, builder.regularFont);
       dialog.content.setLineSpacing(0f, builder.contentLineSpacingMultiplier);
-      if (builder.linkColor == null)
-        dialog.content.setLinkTextColor(DialogUtils.resolveColor(dialog.getContext(), android.R.attr.textColorPrimary));
-      else dialog.content.setLinkTextColor(builder.linkColor);
+      if (builder.linkColor == null) {
+        dialog.content.setLinkTextColor(
+            DialogUtils.resolveColor(dialog.getContext(), android.R.attr.textColorPrimary));
+      } else {
+        dialog.content.setLinkTextColor(builder.linkColor);
+      }
       dialog.content.setTextColor(builder.contentColor);
       dialog.content.setGravity(builder.contentGravity.getGravityInt());
       if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
@@ -246,8 +275,9 @@ class DialogInit {
     boolean textAllCaps;
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
       textAllCaps = DialogUtils.resolveBoolean(builder.context, android.R.attr.textAllCaps, true);
-      if (textAllCaps)
+      if (textAllCaps) {
         textAllCaps = DialogUtils.resolveBoolean(builder.context, R.attr.textAllCaps, true);
+      }
     } else {
       textAllCaps = DialogUtils.resolveBoolean(builder.context, R.attr.textAllCaps, true);
     }
@@ -258,7 +288,8 @@ class DialogInit {
     positiveTextView.setText(builder.positiveText);
     positiveTextView.setTextColor(builder.positiveColor);
     dialog.positiveButton.setStackedSelector(dialog.getButtonSelector(DialogAction.POSITIVE, true));
-    dialog.positiveButton.setDefaultSelector(dialog.getButtonSelector(DialogAction.POSITIVE, false));
+    dialog.positiveButton
+        .setDefaultSelector(dialog.getButtonSelector(DialogAction.POSITIVE, false));
     dialog.positiveButton.setTag(DialogAction.POSITIVE);
     dialog.positiveButton.setOnClickListener(dialog);
     dialog.positiveButton.setVisibility(View.VISIBLE);
@@ -269,7 +300,8 @@ class DialogInit {
     negativeTextView.setText(builder.negativeText);
     negativeTextView.setTextColor(builder.negativeColor);
     dialog.negativeButton.setStackedSelector(dialog.getButtonSelector(DialogAction.NEGATIVE, true));
-    dialog.negativeButton.setDefaultSelector(dialog.getButtonSelector(DialogAction.NEGATIVE, false));
+    dialog.negativeButton
+        .setDefaultSelector(dialog.getButtonSelector(DialogAction.NEGATIVE, false));
     dialog.negativeButton.setTag(DialogAction.NEGATIVE);
     dialog.negativeButton.setOnClickListener(dialog);
     dialog.negativeButton.setVisibility(View.VISIBLE);
@@ -286,8 +318,9 @@ class DialogInit {
     dialog.neutralButton.setVisibility(View.VISIBLE);
 
     // Setup list dialog stuff
-    if (builder.listCallbackMultiChoice != null)
+    if (builder.listCallbackMultiChoice != null) {
       dialog.selectedIndicesList = new ArrayList<>();
+    }
     if (dialog.recyclerView != null) {
       if (builder.adapter == null) {
         // Determine list type
@@ -322,8 +355,9 @@ class DialogInit {
       FrameLayout frame = (FrameLayout) dialog.view.findViewById(R.id.md_customViewFrame);
       dialog.customViewFrame = frame;
       View innerView = builder.customView;
-      if (innerView.getParent() != null)
+      if (innerView.getParent() != null) {
         ((ViewGroup) innerView.getParent()).removeView(innerView);
+      }
       if (builder.wrapCustomViewInScroll) {
                 /* Apply the frame padding to the content, this allows the ScrollView to draw it's
                    over scroll glow without clipping */
@@ -351,14 +385,18 @@ class DialogInit {
     }
 
     // Setup user listeners
-    if (builder.showListener != null)
+    if (builder.showListener != null) {
       dialog.setOnShowListener(builder.showListener);
-    if (builder.cancelListener != null)
+    }
+    if (builder.cancelListener != null) {
       dialog.setOnCancelListener(builder.cancelListener);
-    if (builder.dismissListener != null)
+    }
+    if (builder.dismissListener != null) {
       dialog.setOnDismissListener(builder.dismissListener);
-    if (builder.keyListener != null)
+    }
+    if (builder.keyListener != null) {
       dialog.setOnKeyListener(builder.keyListener);
+    }
 
     // Setup internal show listener
     dialog.setOnShowListenerInternal();
@@ -376,9 +414,12 @@ class DialogInit {
     final int windowWidth = size.x;
     final int windowHeight = size.y;
 
-    final int windowVerticalPadding = builder.context.getResources().getDimensionPixelSize(R.dimen.md_dialog_vertical_margin);
-    final int windowHorizontalPadding = builder.context.getResources().getDimensionPixelSize(R.dimen.md_dialog_horizontal_margin);
-    final int maxWidth = builder.context.getResources().getDimensionPixelSize(R.dimen.md_dialog_max_width);
+    final int windowVerticalPadding = builder.context.getResources()
+        .getDimensionPixelSize(R.dimen.md_dialog_vertical_margin);
+    final int windowHorizontalPadding = builder.context.getResources()
+        .getDimensionPixelSize(R.dimen.md_dialog_horizontal_margin);
+    final int maxWidth = builder.context.getResources()
+        .getDimensionPixelSize(R.dimen.md_dialog_max_width);
     final int calculatedWidth = windowWidth - (windowHorizontalPadding * 2);
 
     dialog.view.setMaxHeight(windowHeight - windowVerticalPadding * 2);
@@ -402,17 +443,21 @@ class DialogInit {
     final MaterialDialog.Builder builder = dialog.builder;
     if (builder.indeterminateProgress || builder.progress > -2) {
       dialog.progressBar = (ProgressBar) dialog.view.findViewById(android.R.id.progress);
-      if (dialog.progressBar == null) return;
+      if (dialog.progressBar == null) {
+        return;
+      }
 
       if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
         if (builder.indeterminateProgress) {
           if (builder.indeterminateIsHorizontalProgress) {
-            IndeterminateHorizontalProgressDrawable d = new IndeterminateHorizontalProgressDrawable(builder.getContext());
+            IndeterminateHorizontalProgressDrawable d = new IndeterminateHorizontalProgressDrawable(
+                builder.getContext());
             d.setTint(builder.widgetColor);
             dialog.progressBar.setProgressDrawable(d);
             dialog.progressBar.setIndeterminateDrawable(d);
           } else {
-            IndeterminateProgressDrawable d = new IndeterminateProgressDrawable(builder.getContext());
+            IndeterminateProgressDrawable d = new IndeterminateProgressDrawable(
+                builder.getContext());
             d.setTint(builder.widgetColor);
             dialog.progressBar.setProgressDrawable(d);
             dialog.progressBar.setIndeterminateDrawable(d);
@@ -428,7 +473,8 @@ class DialogInit {
       }
 
       if (!builder.indeterminateProgress || builder.indeterminateIsHorizontalProgress) {
-        dialog.progressBar.setIndeterminate(builder.indeterminateProgress && builder.indeterminateIsHorizontalProgress);
+        dialog.progressBar.setIndeterminate(
+            builder.indeterminateProgress && builder.indeterminateIsHorizontalProgress);
         dialog.progressBar.setProgress(0);
         dialog.progressBar.setMax(builder.progressMax);
         dialog.progressLabel = (TextView) dialog.view.findViewById(R.id.md_label);
@@ -446,7 +492,8 @@ class DialogInit {
             dialog.progressMinMax.setVisibility(View.VISIBLE);
             dialog.progressMinMax.setText(String.format(builder.progressNumberFormat,
                 0, builder.progressMax));
-            ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) dialog.progressBar.getLayoutParams();
+            ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) dialog.progressBar
+                .getLayoutParams();
             lp.leftMargin = 0;
             lp.rightMargin = 0;
           } else {
@@ -466,10 +513,13 @@ class DialogInit {
   private static void setupInputDialog(final MaterialDialog dialog) {
     final MaterialDialog.Builder builder = dialog.builder;
     dialog.input = (EditText) dialog.view.findViewById(android.R.id.input);
-    if (dialog.input == null) return;
+    if (dialog.input == null) {
+      return;
+    }
     dialog.setTypeface(dialog.input, builder.regularFont);
-    if (builder.inputPrefill != null)
+    if (builder.inputPrefill != null) {
       dialog.input.setText(builder.inputPrefill);
+    }
     dialog.setInternalInputCallback();
     dialog.input.setHint(builder.inputHint);
     dialog.input.setSingleLine();
@@ -480,7 +530,8 @@ class DialogInit {
     if (builder.inputType != -1) {
       dialog.input.setInputType(builder.inputType);
       if (builder.inputType != InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD &&
-          (builder.inputType & InputType.TYPE_TEXT_VARIATION_PASSWORD) == InputType.TYPE_TEXT_VARIATION_PASSWORD) {
+          (builder.inputType & InputType.TYPE_TEXT_VARIATION_PASSWORD)
+              == InputType.TYPE_TEXT_VARIATION_PASSWORD) {
         // If the flags contain TYPE_TEXT_VARIATION_PASSWORD, apply the password transformation method automatically
         dialog.input.setTransformationMethod(PasswordTransformationMethod.getInstance());
       }

+ 2 - 1
core/src/main/java/com/afollestad/materialdialogs/GravityEnum.java

@@ -9,7 +9,8 @@ import android.view.View;
 public enum GravityEnum {
   START, CENTER, END;
 
-  private static final boolean HAS_RTL = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1;
+  private static final boolean HAS_RTL =
+      Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1;
 
   @SuppressLint("RtlHardcoded")
   public int getGravityInt() {

+ 187 - 135
core/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java

@@ -42,7 +42,6 @@ import android.widget.ImageView;
 import android.widget.ProgressBar;
 import android.widget.RadioButton;
 import android.widget.TextView;
-
 import com.afollestad.materialdialogs.internal.MDButton;
 import com.afollestad.materialdialogs.internal.MDRootLayout;
 import com.afollestad.materialdialogs.internal.MDTintHelper;
@@ -50,7 +49,6 @@ import com.afollestad.materialdialogs.internal.ThemeSingleton;
 import com.afollestad.materialdialogs.util.DialogUtils;
 import com.afollestad.materialdialogs.util.RippleHelper;
 import com.afollestad.materialdialogs.util.TypefaceHelper;
-
 import java.text.NumberFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -70,7 +68,8 @@ public class MaterialDialog extends DialogBase implements
   protected ImageView icon;
   protected TextView title;
   protected TextView content;
-  protected EditText input;
+
+  EditText input;
   RecyclerView recyclerView;
   View titleFrame;
   FrameLayout customViewFrame;
@@ -100,7 +99,9 @@ public class MaterialDialog extends DialogBase implements
   }
 
   public final void setTypeface(TextView target, Typeface t) {
-    if (t == null) return;
+    if (t == null) {
+      return;
+    }
     int flags = target.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG;
     target.setPaintFlags(flags);
     target.setTypeface(t);
@@ -113,43 +114,47 @@ public class MaterialDialog extends DialogBase implements
   }
 
   final void checkIfListInitScroll() {
-    if (recyclerView == null)
+    if (recyclerView == null) {
       return;
-    recyclerView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
-      @SuppressWarnings("ConstantConditions")
-      @Override
-      public void onGlobalLayout() {
-        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
-          //noinspection deprecation
-          recyclerView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
-        } else {
-          recyclerView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
-        }
-
-        if (listType == ListType.SINGLE || listType == ListType.MULTI) {
-          int selectedIndex;
-          if (listType == ListType.SINGLE) {
-            if (builder.selectedIndex < 0)
-              return;
-            selectedIndex = builder.selectedIndex;
-          } else {
-            if (selectedIndicesList == null || selectedIndicesList.size() == 0)
-              return;
-            Collections.sort(selectedIndicesList);
-            selectedIndex = selectedIndicesList.get(0);
-          }
+    }
+    recyclerView.getViewTreeObserver()
+        .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
+          @SuppressWarnings("ConstantConditions")
+          @Override
+          public void onGlobalLayout() {
+            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
+              //noinspection deprecation
+              recyclerView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
+            } else {
+              recyclerView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
+            }
 
-          final int fSelectedIndex = selectedIndex;
-          recyclerView.post(new Runnable() {
-            @Override
-            public void run() {
-              recyclerView.requestFocus();
-              builder.layoutManager.scrollToPosition(fSelectedIndex);
+            if (listType == ListType.SINGLE || listType == ListType.MULTI) {
+              int selectedIndex;
+              if (listType == ListType.SINGLE) {
+                if (builder.selectedIndex < 0) {
+                  return;
+                }
+                selectedIndex = builder.selectedIndex;
+              } else {
+                if (selectedIndicesList == null || selectedIndicesList.size() == 0) {
+                  return;
+                }
+                Collections.sort(selectedIndicesList);
+                selectedIndex = selectedIndicesList.get(0);
+              }
+
+              final int fSelectedIndex = selectedIndex;
+              recyclerView.post(new Runnable() {
+                @Override
+                public void run() {
+                  recyclerView.requestFocus();
+                  builder.layoutManager.scrollToPosition(fSelectedIndex);
+                }
+              });
             }
-          });
-        }
-      }
-    });
+          }
+        });
   }
 
   /**
@@ -162,8 +167,9 @@ public class MaterialDialog extends DialogBase implements
         builder.items.size() == 0) && builder.adapter == null) {
       return;
     }
-    if (builder.layoutManager == null)
+    if (builder.layoutManager == null) {
       builder.layoutManager = new LinearLayoutManager(getContext());
+    }
     recyclerView.setLayoutManager(builder.layoutManager);
     recyclerView.setAdapter(builder.adapter);
     if (listType != null) {
@@ -173,8 +179,10 @@ public class MaterialDialog extends DialogBase implements
 
   @Override
   public boolean onItemSelected(MaterialDialog dialog, View view,
-                                int position, CharSequence text, boolean longPress) {
-    if (!view.isEnabled()) return false;
+      int position, CharSequence text, boolean longPress) {
+    if (!view.isEnabled()) {
+      return false;
+    }
     if (listType == null || listType == ListType.REGULAR) {
       // Default adapter, non choice mode
       if (builder.autoDismiss) {
@@ -193,7 +201,9 @@ public class MaterialDialog extends DialogBase implements
       // Default adapter, choice mode
       if (listType == ListType.MULTI) {
         final CheckBox cb = (CheckBox) view.findViewById(R.id.md_control);
-        if (!cb.isEnabled()) return false;
+        if (!cb.isEnabled()) {
+          return false;
+        }
         final boolean shouldBeChecked = !selectedIndicesList.contains(position);
         if (shouldBeChecked) {
           // Add the selection to the states first so the callback includes it (when alwaysCallMultiChoiceCallback)
@@ -228,7 +238,9 @@ public class MaterialDialog extends DialogBase implements
         }
       } else if (listType == ListType.SINGLE) {
         final RadioButton radio = (RadioButton) view.findViewById(R.id.md_control);
-        if (!radio.isEnabled()) return false;
+        if (!radio.isEnabled()) {
+          return false;
+        }
         boolean allowSelection = true;
         final int oldSelected = builder.selectedIndex;
 
@@ -283,8 +295,9 @@ public class MaterialDialog extends DialogBase implements
 
   @SuppressWarnings("unused")
   public void setPromptCheckBoxChecked(boolean checked) {
-    if (checkBoxPrompt != null)
+    if (checkBoxPrompt != null) {
       checkBoxPrompt.setChecked(checked);
+    }
   }
 
   /* package */ Drawable getButtonSelector(DialogAction which, boolean isStacked) {
@@ -295,7 +308,9 @@ public class MaterialDialog extends DialogBase implements
       }
       final Drawable d = DialogUtils.resolveDrawable(builder.context,
           R.attr.md_btn_stacked_selector);
-      if (d != null) return d;
+      if (d != null) {
+        return d;
+      }
       return DialogUtils.resolveDrawable(getContext(), R.attr.md_btn_stacked_selector);
     } else {
       switch (which) {
@@ -426,8 +441,9 @@ public class MaterialDialog extends DialogBase implements
           builder.callback.onAny(this);
           builder.callback.onNeutral(this);
         }
-        if (builder.onNeutralCallback != null)
+        if (builder.onNeutralCallback != null) {
           builder.onNeutralCallback.onClick(this, tag);
+        }
         if (builder.autoDismiss) {
           dismiss();
         }
@@ -551,7 +567,7 @@ public class MaterialDialog extends DialogBase implements
    * Updates an action button's title, causing invalidation to check if the action buttons should
    * be stacked.
    *
-   * @param which    The action button to update.
+   * @param which The action button to update.
    * @param titleRes The string resource of the new title of the action button.
    */
   public final void setActionButton(DialogAction which, @StringRes int titleRes) {
@@ -768,8 +784,8 @@ public class MaterialDialog extends DialogBase implements
   /**
    * Convenience method for getting the currently selected index of a single choice list.
    *
-   * @return Currently selected index of a single choice list, or -1 if not showing a single
-   * choice list
+   * @return Currently selected index of a single choice list, or -1 if not showing a single choice
+   * list
    */
   @SuppressWarnings("unused")
   public int getSelectedIndex() {
@@ -803,8 +819,8 @@ public class MaterialDialog extends DialogBase implements
   /**
    * Convenience method for getting the currently selected indices of a multi choice list
    *
-   * @return Currently selected index of a multi choice list, or null if not showing a multi
-   * choice list
+   * @return Currently selected index of a multi choice list, or null if not showing a multi choice
+   * list
    */
   @Nullable
   @SuppressWarnings("unused")
@@ -850,15 +866,18 @@ public class MaterialDialog extends DialogBase implements
    */
   @SuppressWarnings("WeakerAccess")
   public void clearSelectedIndices(boolean sendCallback) {
-    if (listType == null || listType != ListType.MULTI)
+    if (listType == null || listType != ListType.MULTI) {
       throw new IllegalStateException("You can only use clearSelectedIndices() " +
           "with multi choice list dialogs.");
+    }
     if (builder.adapter != null && builder.adapter instanceof DefaultRvAdapter) {
-      if (selectedIndicesList != null)
+      if (selectedIndicesList != null) {
         selectedIndicesList.clear();
+      }
       builder.adapter.notifyDataSetChanged();
-      if (sendCallback && builder.listCallbackMultiChoice != null)
+      if (sendCallback && builder.listCallbackMultiChoice != null) {
         sendMultiChoiceCallback();
+      }
     } else {
       throw new IllegalStateException("You can only use clearSelectedIndices() " +
           "with the default adapter implementation.");
@@ -880,9 +899,10 @@ public class MaterialDialog extends DialogBase implements
    */
   @SuppressWarnings("WeakerAccess")
   public void selectAllIndices(boolean sendCallback) {
-    if (listType == null || listType != ListType.MULTI)
+    if (listType == null || listType != ListType.MULTI) {
       throw new IllegalStateException("You can only use selectAllIndices() with " +
           "multi choice list dialogs.");
+    }
     if (builder.adapter != null && builder.adapter instanceof DefaultRvAdapter) {
       if (selectedIndicesList == null) {
         selectedIndicesList = new ArrayList<>();
@@ -946,7 +966,8 @@ public class MaterialDialog extends DialogBase implements
   void invalidateInputMinMaxIndicator(int currentLength, boolean emptyDisabled) {
     if (inputMinMax != null) {
       if (builder.inputMaxLength > 0) {
-        inputMinMax.setText(String.format(Locale.getDefault(), "%d/%d", currentLength, builder.inputMaxLength));
+        inputMinMax.setText(
+            String.format(Locale.getDefault(), "%d/%d", currentLength, builder.inputMaxLength));
         inputMinMax.setVisibility(View.VISIBLE);
       } else {
         inputMinMax.setVisibility(View.GONE);
@@ -1018,8 +1039,8 @@ public class MaterialDialog extends DialogBase implements
      * option is used.
      *
      * @param dialog The dialog of which a list item was selected.
-     * @param which  The index of the item that was selected.
-     * @param text   The text of the  item that was selected.
+     * @param which The index of the item that was selected.
+     * @param text The text of the  item that was selected.
      * @return True to allow the radio button to be selected.
      */
     boolean onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text);
@@ -1035,8 +1056,8 @@ public class MaterialDialog extends DialogBase implements
      * is used.
      *
      * @param dialog The dialog of which a list item was selected.
-     * @param which  The indices of the items that were selected.
-     * @param text   The text of the items that were selected.
+     * @param which The indices of the items that were selected.
+     * @param text The text of the items that were selected.
      * @return True to allow the checkbox to be selected.
      */
     boolean onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text);
@@ -1191,8 +1212,9 @@ public class MaterialDialog extends DialogBase implements
           DialogUtils.resolveColor(context, R.attr.md_link_color, this.widgetColor));
 
       int fallback = 0;
-      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
+      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
         fallback = DialogUtils.resolveColor(context, android.R.attr.colorControlHighlight);
+      }
       this.buttonRippleColor = DialogUtils.resolveColor(context,
           R.attr.md_btn_ripple_color,
           DialogUtils.resolveColor(context,
@@ -1264,42 +1286,61 @@ public class MaterialDialog extends DialogBase implements
 
     @SuppressWarnings("ConstantConditions")
     private void checkSingleton() {
-      if (ThemeSingleton.get(false) == null) return;
+      if (ThemeSingleton.get(false) == null) {
+        return;
+      }
       ThemeSingleton s = ThemeSingleton.get();
-      if (s.darkTheme)
+      if (s.darkTheme) {
         this.theme = Theme.DARK;
-      if (s.titleColor != 0)
+      }
+      if (s.titleColor != 0) {
         this.titleColor = s.titleColor;
-      if (s.contentColor != 0)
+      }
+      if (s.contentColor != 0) {
         this.contentColor = s.contentColor;
-      if (s.positiveColor != null)
+      }
+      if (s.positiveColor != null) {
         this.positiveColor = s.positiveColor;
-      if (s.neutralColor != null)
+      }
+      if (s.neutralColor != null) {
         this.neutralColor = s.neutralColor;
-      if (s.negativeColor != null)
+      }
+      if (s.negativeColor != null) {
         this.negativeColor = s.negativeColor;
-      if (s.itemColor != 0)
+      }
+      if (s.itemColor != 0) {
         this.itemColor = s.itemColor;
-      if (s.icon != null)
+      }
+      if (s.icon != null) {
         this.icon = s.icon;
-      if (s.backgroundColor != 0)
+      }
+      if (s.backgroundColor != 0) {
         this.backgroundColor = s.backgroundColor;
-      if (s.dividerColor != 0)
+      }
+      if (s.dividerColor != 0) {
         this.dividerColor = s.dividerColor;
-      if (s.btnSelectorStacked != 0)
+      }
+      if (s.btnSelectorStacked != 0) {
         this.btnSelectorStacked = s.btnSelectorStacked;
-      if (s.listSelector != 0)
+      }
+      if (s.listSelector != 0) {
         this.listSelector = s.listSelector;
-      if (s.btnSelectorPositive != 0)
+      }
+      if (s.btnSelectorPositive != 0) {
         this.btnSelectorPositive = s.btnSelectorPositive;
-      if (s.btnSelectorNeutral != 0)
+      }
+      if (s.btnSelectorNeutral != 0) {
         this.btnSelectorNeutral = s.btnSelectorNeutral;
-      if (s.btnSelectorNegative != 0)
+      }
+      if (s.btnSelectorNegative != 0) {
         this.btnSelectorNegative = s.btnSelectorNegative;
-      if (s.widgetColor != 0)
+      }
+      if (s.widgetColor != 0) {
         this.widgetColor = s.widgetColor;
-      if (s.linkColor != null)
+      }
+      if (s.linkColor != null) {
         this.linkColor = s.linkColor;
+      }
       this.titleGravity = s.titleGravity;
       this.contentGravity = s.contentGravity;
       this.btnStackedGravity = s.btnStackedGravity;
@@ -1353,9 +1394,9 @@ public class MaterialDialog extends DialogBase implements
      * Sets the fonts used in the dialog. It's recommended that you use {@link #typeface(String,
      * String)} instead, to avoid duplicate Typeface allocations and high memory usage.
      *
-     * @param medium  The font used on titles and action buttons. Null uses device default.
-     * @param regular The font used everywhere else, like on the content and list items. Null
-     *                uses device default.
+     * @param medium The font used on titles and action buttons. Null uses device default.
+     * @param regular The font used everywhere else, like on the content and list items. Null uses
+     * device default.
      * @return The Builder instance so you can chain calls to it.
      */
     public Builder typeface(@Nullable Typeface medium, @Nullable Typeface regular) {
@@ -1368,22 +1409,24 @@ public class MaterialDialog extends DialogBase implements
      * Sets the fonts used in the dialog, by file names. This also uses TypefaceHelper in order
      * to avoid any un-needed allocations (it recycles typefaces for you).
      *
-     * @param medium  The name of font in assets/fonts used on titles and action buttons (null
-     *                uses device default). E.g. [your-project]/app/main/assets/fonts/[medium]
-     * @param regular The name of font in assets/fonts used everywhere else, like content and
-     *                list items (null uses device default). E.g. [your-project]/app/main/assets/fonts/[regular]
+     * @param medium The name of font in assets/fonts used on titles and action buttons (null uses
+     * device default). E.g. [your-project]/app/main/assets/fonts/[medium]
+     * @param regular The name of font in assets/fonts used everywhere else, like content and list
+     * items (null uses device default). E.g. [your-project]/app/main/assets/fonts/[regular]
      * @return The Builder instance so you can chain calls to it.
      */
     public Builder typeface(@Nullable String medium, @Nullable String regular) {
       if (medium != null) {
         this.mediumFont = TypefaceHelper.get(this.context, medium);
-        if (this.mediumFont == null)
+        if (this.mediumFont == null) {
           throw new IllegalArgumentException("No font asset found for " + medium);
+        }
       }
       if (regular != null) {
         this.regularFont = TypefaceHelper.get(this.context, regular);
-        if (this.regularFont == null)
+        if (this.regularFont == null) {
           throw new IllegalArgumentException("No font asset found for " + regular);
+        }
       }
       return this;
     }
@@ -1539,12 +1582,11 @@ public class MaterialDialog extends DialogBase implements
      * initially. Otherwise pass the index of an item that will be selected initially.
      *
      * @param selectedIndex The checkbox index that will be selected initially.
-     * @param callback      The callback that will be called when the presses the positive
-     *                      button.
+     * @param callback The callback that will be called when the presses the positive button.
      * @return The Builder instance so you can chain calls to it.
      */
     public Builder itemsCallbackSingleChoice(int selectedIndex,
-                                             @NonNull ListCallbackSingleChoice callback) {
+        @NonNull ListCallbackSingleChoice callback) {
       this.selectedIndex = selectedIndex;
       this.listCallback = null;
       this.listCallbackSingleChoice = callback;
@@ -1569,12 +1611,11 @@ public class MaterialDialog extends DialogBase implements
      * pass an array of indices that will be selected initially.
      *
      * @param selectedIndices The radio button indices that will be selected initially.
-     * @param callback        The callback that will be called when the presses the positive
-     *                        button.
+     * @param callback The callback that will be called when the presses the positive button.
      * @return The Builder instance so you can chain calls to it.
      */
     public Builder itemsCallbackMultiChoice(@Nullable Integer[] selectedIndices,
-                                            @NonNull ListCallbackMultiChoice callback) {
+        @NonNull ListCallbackMultiChoice callback) {
       this.selectedIndices = selectedIndices;
       this.listCallback = null;
       this.listCallbackSingleChoice = null;
@@ -1607,7 +1648,9 @@ public class MaterialDialog extends DialogBase implements
     }
 
     public Builder positiveText(@StringRes int positiveRes) {
-      if (positiveRes == 0) return this;
+      if (positiveRes == 0) {
+        return this;
+      }
       positiveText(this.context.getText(positiveRes));
       return this;
     }
@@ -1626,7 +1669,8 @@ public class MaterialDialog extends DialogBase implements
     }
 
     public Builder positiveColorAttr(@AttrRes int colorAttr) {
-      return positiveColor(DialogUtils.resolveActionTextColorStateList(this.context, colorAttr, null));
+      return positiveColor(
+          DialogUtils.resolveActionTextColorStateList(this.context, colorAttr, null));
     }
 
     public Builder positiveColor(@NonNull ColorStateList colorStateList) {
@@ -1641,7 +1685,9 @@ public class MaterialDialog extends DialogBase implements
     }
 
     public Builder neutralText(@StringRes int neutralRes) {
-      if (neutralRes == 0) return this;
+      if (neutralRes == 0) {
+        return this;
+      }
       return neutralText(this.context.getText(neutralRes));
     }
 
@@ -1659,7 +1705,8 @@ public class MaterialDialog extends DialogBase implements
     }
 
     public Builder negativeColorAttr(@AttrRes int colorAttr) {
-      return negativeColor(DialogUtils.resolveActionTextColorStateList(this.context, colorAttr, null));
+      return negativeColor(
+          DialogUtils.resolveActionTextColorStateList(this.context, colorAttr, null));
     }
 
     public Builder negativeColor(@NonNull ColorStateList colorStateList) {
@@ -1669,7 +1716,9 @@ public class MaterialDialog extends DialogBase implements
     }
 
     public Builder negativeText(@StringRes int negativeRes) {
-      if (negativeRes == 0) return this;
+      if (negativeRes == 0) {
+        return this;
+      }
       return negativeText(this.context.getText(negativeRes));
     }
 
@@ -1692,7 +1741,8 @@ public class MaterialDialog extends DialogBase implements
     }
 
     public Builder neutralColorAttr(@AttrRes int colorAttr) {
-      return neutralColor(DialogUtils.resolveActionTextColorStateList(this.context, colorAttr, null));
+      return neutralColor(
+          DialogUtils.resolveActionTextColorStateList(this.context, colorAttr, null));
     }
 
     public Builder neutralColor(@NonNull ColorStateList colorStateList) {
@@ -1768,7 +1818,7 @@ public class MaterialDialog extends DialogBase implements
     }
 
     public Builder checkBoxPrompt(@NonNull CharSequence prompt, boolean initiallyChecked,
-                                  @Nullable CheckBox.OnCheckedChangeListener checkListener) {
+        @Nullable CheckBox.OnCheckedChangeListener checkListener) {
       this.checkBoxPrompt = prompt;
       this.checkBoxPromptInitiallyChecked = initiallyChecked;
       this.checkBoxPromptListener = checkListener;
@@ -1776,7 +1826,7 @@ public class MaterialDialog extends DialogBase implements
     }
 
     public Builder checkBoxPromptRes(@StringRes int prompt, boolean initiallyChecked,
-                                     @Nullable CheckBox.OnCheckedChangeListener checkListener) {
+        @Nullable CheckBox.OnCheckedChangeListener checkListener) {
       return checkBoxPrompt(context.getResources().getText(prompt),
           initiallyChecked, checkListener);
     }
@@ -1787,16 +1837,18 @@ public class MaterialDialog extends DialogBase implements
     }
 
     public Builder customView(@NonNull View view, boolean wrapInScrollView) {
-      if (this.content != null)
+      if (this.content != null) {
         throw new IllegalStateException("You cannot use customView() when you have content set.");
-      else if (this.items != null)
+      } else if (this.items != null) {
         throw new IllegalStateException("You cannot use customView() when you have items set.");
-      else if (this.inputCallback != null)
+      } else if (this.inputCallback != null) {
         throw new IllegalStateException("You cannot use customView() with an input dialog");
-      else if (this.progress > -2 || this.indeterminateProgress)
+      } else if (this.progress > -2 || this.indeterminateProgress) {
         throw new IllegalStateException("You cannot use customView() with a progress dialog");
-      if (view.getParent() != null && view.getParent() instanceof ViewGroup)
+      }
+      if (view.getParent() != null && view.getParent() instanceof ViewGroup) {
         ((ViewGroup) view.getParent()).removeView(view);
+      }
       this.customView = view;
       this.wrapCustomViewInScroll = wrapInScrollView;
       return this;
@@ -1805,16 +1857,17 @@ public class MaterialDialog extends DialogBase implements
     /**
      * Makes this dialog a progress dialog.
      *
-     * @param indeterminate If true, an infinite circular spinner is shown. If false, a
-     *                      horizontal progress bar is shown that is incremented or set via the
-     *                      built MaterialDialog instance.
-     * @param max           When indeterminate is false, the max value the horizontal progress
-     *                      bar can get to.
+     * @param indeterminate If true, an infinite circular spinner is shown. If false, a horizontal
+     * progress bar is shown that is incremented or set via the built MaterialDialog instance.
+     * @param max When indeterminate is false, the max value the horizontal progress bar can get
+     * to.
      * @return An instance of the Builder so calls can be chained.
      */
     public Builder progress(boolean indeterminate, int max) {
-      if (this.customView != null)
-        throw new IllegalStateException("You cannot set progress() when you're using a custom view.");
+      if (this.customView != null) {
+        throw new IllegalStateException(
+            "You cannot set progress() when you're using a custom view.");
+      }
       if (indeterminate) {
         this.indeterminateProgress = true;
         this.progress = -2;
@@ -1830,13 +1883,12 @@ public class MaterialDialog extends DialogBase implements
     /**
      * Makes this dialog a progress dialog.
      *
-     * @param indeterminate If true, an infinite circular spinner is shown. If false, a
-     *                      horizontal progress bar is shown that is incremented or set via the
-     *                      built MaterialDialog instance.
-     * @param max           When indeterminate is false, the max value the horizontal progress
-     *                      bar can get to.
-     * @param showMinMax    For determinate dialogs, the min and max will be displayed to the
-     *                      left (start) of the progress bar, e.g. 50/100.
+     * @param indeterminate If true, an infinite circular spinner is shown. If false, a horizontal
+     * progress bar is shown that is incremented or set via the built MaterialDialog instance.
+     * @param max When indeterminate is false, the max value the horizontal progress bar can get
+     * to.
+     * @param showMinMax For determinate dialogs, the min and max will be displayed to the left
+     * (start) of the progress bar, e.g. 50/100.
      * @return An instance of the Builder so calls can be chained.
      */
     public Builder progress(boolean indeterminate, int max, boolean showMinMax) {
@@ -1975,9 +2027,9 @@ public class MaterialDialog extends DialogBase implements
      * Sets a custom {@link android.support.v7.widget.RecyclerView.Adapter} for the dialog's
      * list
      *
-     * @param adapter       The adapter to set to the list.
+     * @param adapter The adapter to set to the list.
      * @param layoutManager The layout manager to use in the RecyclerView. Pass null to use the
-     *                      default linear manager.
+     * default linear manager.
      * @return This Builder object to allow for chaining of calls to set methods
      */
     @SuppressWarnings("ConstantConditions")
@@ -2047,7 +2099,7 @@ public class MaterialDialog extends DialogBase implements
     }
 
     public Builder input(@Nullable CharSequence hint, @Nullable CharSequence prefill,
-                         boolean allowEmptyInput, @NonNull InputCallback callback) {
+        boolean allowEmptyInput, @NonNull InputCallback callback) {
       if (this.customView != null) {
         throw new IllegalStateException("You cannot set content() when " +
             "you're using a custom view.");
@@ -2060,18 +2112,18 @@ public class MaterialDialog extends DialogBase implements
     }
 
     public Builder input(@Nullable CharSequence hint, @Nullable CharSequence prefill,
-                         @NonNull InputCallback callback) {
+        @NonNull InputCallback callback) {
       return input(hint, prefill, true, callback);
     }
 
     public Builder input(@StringRes int hint, @StringRes int prefill,
-                         boolean allowEmptyInput, @NonNull InputCallback callback) {
+        boolean allowEmptyInput, @NonNull InputCallback callback) {
       return input(hint == 0 ? null : context.getText(hint), prefill == 0 ? null :
           context.getText(prefill), allowEmptyInput, callback);
     }
 
     public Builder input(@StringRes int hint, @StringRes int prefill,
-                         @NonNull InputCallback callback) {
+        @NonNull InputCallback callback) {
       return input(hint, prefill, true, callback);
     }
 
@@ -2081,17 +2133,16 @@ public class MaterialDialog extends DialogBase implements
     }
 
     public Builder inputRange(@IntRange(from = 0, to = Integer.MAX_VALUE) int minLength,
-                              @IntRange(from = -1, to = Integer.MAX_VALUE) int maxLength) {
+        @IntRange(from = -1, to = Integer.MAX_VALUE) int maxLength) {
       return inputRange(minLength, maxLength, 0);
     }
 
     /**
-     * @param errorColor Pass in 0 for the default red error color (as specified in
-     *                   guidelines).
+     * @param errorColor Pass in 0 for the default red error color (as specified in guidelines).
      */
     public Builder inputRange(@IntRange(from = 0, to = Integer.MAX_VALUE) int minLength,
-                              @IntRange(from = -1, to = Integer.MAX_VALUE) int maxLength,
-                              @ColorInt int errorColor) {
+        @IntRange(from = -1, to = Integer.MAX_VALUE) int maxLength,
+        @ColorInt int errorColor) {
       if (minLength < 0) {
         throw new IllegalArgumentException("Min length for input dialogs " +
             "cannot be less than 0.");
@@ -2104,8 +2155,9 @@ public class MaterialDialog extends DialogBase implements
       } else {
         this.inputRangeErrorColor = errorColor;
       }
-      if (this.inputMinLength > 0)
+      if (this.inputMinLength > 0) {
         this.inputAllowEmpty = false;
+      }
       return this;
     }
 
@@ -2114,8 +2166,8 @@ public class MaterialDialog extends DialogBase implements
      * error color.
      */
     public Builder inputRangeRes(@IntRange(from = 0, to = Integer.MAX_VALUE) int minLength,
-                                 @IntRange(from = -1, to = Integer.MAX_VALUE) int maxLength,
-                                 @ColorRes int errorColor) {
+        @IntRange(from = -1, to = Integer.MAX_VALUE) int maxLength,
+        @ColorRes int errorColor) {
       return inputRange(minLength, maxLength,
           DialogUtils.getColor(context, errorColor));
     }

+ 9 - 6
core/src/main/java/com/afollestad/materialdialogs/internal/MDButton.java

@@ -7,7 +7,6 @@ import android.support.v7.text.AllCapsTransformationMethod;
 import android.util.AttributeSet;
 import android.view.Gravity;
 import android.widget.TextView;
-
 import com.afollestad.materialdialogs.GravityEnum;
 import com.afollestad.materialdialogs.R;
 import com.afollestad.materialdialogs.util.DialogUtils;
@@ -48,7 +47,8 @@ public class MDButton extends TextView {
     /* package */ void setStacked(boolean stacked, boolean force) {
     if (this.stacked != stacked || force) {
 
-      setGravity(stacked ? (Gravity.CENTER_VERTICAL | stackedGravity.getGravityInt()) : Gravity.CENTER);
+      setGravity(
+          stacked ? (Gravity.CENTER_VERTICAL | stackedGravity.getGravityInt()) : Gravity.CENTER);
       if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
         //noinspection ResourceType
         setTextAlignment(stacked ? stackedGravity.getTextAlignment() : TEXT_ALIGNMENT_CENTER);
@@ -69,24 +69,27 @@ public class MDButton extends TextView {
 
   public void setStackedSelector(Drawable d) {
     stackedBackground = d;
-    if (stacked)
+    if (stacked) {
       setStacked(true, true);
+    }
   }
 
   public void setDefaultSelector(Drawable d) {
     defaultBackground = d;
-    if (!stacked)
+    if (!stacked) {
       setStacked(false, true);
+    }
   }
 
   public void setAllCapsCompat(boolean allCaps) {
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
       setAllCaps(allCaps);
     } else {
-      if (allCaps)
+      if (allCaps) {
         setTransformationMethod(new AllCapsTransformationMethod(getContext()));
-      else
+      } else {
         setTransformationMethod(null);
+      }
     }
   }
 }

+ 59 - 30
core/src/main/java/com/afollestad/materialdialogs/internal/MDRootLayout.java

@@ -17,7 +17,6 @@ import android.view.ViewTreeObserver;
 import android.webkit.WebView;
 import android.widget.AdapterView;
 import android.widget.ScrollView;
-
 import com.afollestad.materialdialogs.GravityEnum;
 import com.afollestad.materialdialogs.R;
 import com.afollestad.materialdialogs.StackingBehavior;
@@ -84,18 +83,21 @@ public class MDRootLayout extends ViewGroup {
 
   private static boolean isVisible(View v) {
     boolean visible = v != null && v.getVisibility() != View.GONE;
-    if (visible && v instanceof MDButton)
+    if (visible && v instanceof MDButton) {
       visible = ((MDButton) v).getText().toString().trim().length() > 0;
+    }
     return visible;
   }
 
   public static boolean canRecyclerViewScroll(RecyclerView view) {
-    return view != null && view.getLayoutManager() != null && view.getLayoutManager().canScrollVertically();
+    return view != null && view.getLayoutManager() != null && view.getLayoutManager()
+        .canScrollVertically();
   }
 
   private static boolean canScrollViewScroll(ScrollView sv) {
-    if (sv.getChildCount() == 0)
+    if (sv.getChildCount() == 0) {
       return false;
+    }
     final int childHeight = sv.getChildAt(0).getMeasuredHeight();
     return sv.getMeasuredHeight() - sv.getPaddingTop() - sv.getPaddingBottom() < childHeight;
   }
@@ -107,8 +109,9 @@ public class MDRootLayout extends ViewGroup {
 
   private static boolean canAdapterViewScroll(AdapterView lv) {
         /* Force it to layout it's children */
-    if (lv.getLastVisiblePosition() == -1)
+    if (lv.getLastVisiblePosition() == -1) {
       return false;
+    }
 
         /* We can scroll if the first or last item is not visible */
     boolean firstItemVisible = lv.getFirstVisiblePosition() == 0;
@@ -116,8 +119,9 @@ public class MDRootLayout extends ViewGroup {
 
     if (firstItemVisible && lastItemVisible && lv.getChildCount() > 0) {
             /* Or the first item's top is above or own top */
-      if (lv.getChildAt(0).getTop() < lv.getPaddingTop())
+      if (lv.getChildAt(0).getTop() < lv.getPaddingTop()) {
         return true;
+      }
             /* or the last item's bottom is beyond our own bottom */
       return lv.getChildAt(lv.getChildCount() - 1).getBottom() >
           lv.getHeight() - lv.getPaddingBottom();
@@ -135,12 +139,14 @@ public class MDRootLayout extends ViewGroup {
    */
   @Nullable
   private static View getBottomView(ViewGroup viewGroup) {
-    if (viewGroup == null || viewGroup.getChildCount() == 0)
+    if (viewGroup == null || viewGroup.getChildCount() == 0) {
       return null;
+    }
     View bottomView = null;
     for (int i = viewGroup.getChildCount() - 1; i >= 0; i--) {
       View child = viewGroup.getChildAt(i);
-      if (child.getVisibility() == View.VISIBLE && child.getBottom() == viewGroup.getMeasuredHeight()) {
+      if (child.getVisibility() == View.VISIBLE && child.getBottom() == viewGroup
+          .getMeasuredHeight()) {
         bottomView = child;
         break;
       }
@@ -150,8 +156,9 @@ public class MDRootLayout extends ViewGroup {
 
   @Nullable
   private static View getTopView(ViewGroup viewGroup) {
-    if (viewGroup == null || viewGroup.getChildCount() == 0)
+    if (viewGroup == null || viewGroup.getChildCount() == 0) {
       return null;
+    }
     View topView = null;
     for (int i = viewGroup.getChildCount() - 1; i >= 0; i--) {
       View child = viewGroup.getChildAt(i);
@@ -167,7 +174,8 @@ public class MDRootLayout extends ViewGroup {
     Resources r = context.getResources();
 
     TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MDRootLayout, defStyleAttr, 0);
-    reducePaddingNoTitleNoButtons = a.getBoolean(R.styleable.MDRootLayout_md_reduce_padding_no_title_no_buttons, true);
+    reducePaddingNoTitleNoButtons = a
+        .getBoolean(R.styleable.MDRootLayout_md_reduce_padding_no_title_no_buttons, true);
     a.recycle();
 
     noTitlePaddingFull = r.getDimensionPixelSize(R.dimen.md_notitle_vertical_padding);
@@ -331,8 +339,9 @@ public class MDRootLayout extends ViewGroup {
       t += noTitlePaddingFull;
     }
 
-    if (isVisible(content))
+    if (isVisible(content)) {
       content.layout(l, t, r, t + content.getMeasuredHeight());
+    }
 
     if (isStacked) {
       b -= buttonPaddingFull;
@@ -345,8 +354,9 @@ public class MDRootLayout extends ViewGroup {
     } else {
       int barTop;
       int barBottom = b;
-      if (useFullPadding)
+      if (useFullPadding) {
         barBottom -= buttonPaddingFull;
+      }
       barTop = barBottom - buttonBarHeight;
             /* START:
                Neutral   Negative  Positive
@@ -439,7 +449,9 @@ public class MDRootLayout extends ViewGroup {
   }
 
   private void invertGravityIfNecessary() {
-    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) return;
+    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
+      return;
+    }
     Configuration config = getResources().getConfiguration();
     if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
       switch (buttonGravity) {
@@ -455,33 +467,40 @@ public class MDRootLayout extends ViewGroup {
 
   public void setButtonStackedGravity(GravityEnum gravity) {
     for (MDButton mButton : buttons) {
-      if (mButton != null)
+      if (mButton != null) {
         mButton.setStackedGravity(gravity);
+      }
     }
   }
 
-  private void setUpDividersVisibility(final View view, final boolean setForTop, final boolean setForBottom) {
-    if (view == null)
+  private void setUpDividersVisibility(final View view, final boolean setForTop,
+      final boolean setForBottom) {
+    if (view == null) {
       return;
+    }
     if (view instanceof ScrollView) {
       final ScrollView sv = (ScrollView) view;
       if (canScrollViewScroll(sv)) {
         addScrollListener(sv, setForTop, setForBottom);
       } else {
-        if (setForTop)
+        if (setForTop) {
           drawTopDivider = false;
-        if (setForBottom)
+        }
+        if (setForBottom) {
           drawBottomDivider = false;
+        }
       }
     } else if (view instanceof AdapterView) {
       final AdapterView sv = (AdapterView) view;
       if (canAdapterViewScroll(sv)) {
         addScrollListener(sv, setForTop, setForBottom);
       } else {
-        if (setForTop)
+        if (setForTop) {
           drawTopDivider = false;
-        if (setForBottom)
+        }
+        if (setForBottom) {
           drawBottomDivider = false;
+        }
       }
     } else if (view instanceof WebView) {
       view.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@@ -489,10 +508,12 @@ public class MDRootLayout extends ViewGroup {
         public boolean onPreDraw() {
           if (view.getMeasuredHeight() != 0) {
             if (!canWebViewScroll((WebView) view)) {
-              if (setForTop)
+              if (setForTop) {
                 drawTopDivider = false;
-              if (setForBottom)
+              }
+              if (setForBottom) {
                 drawBottomDivider = false;
+              }
             } else {
               addScrollListener((ViewGroup) view, setForTop, setForBottom);
             }
@@ -503,12 +524,15 @@ public class MDRootLayout extends ViewGroup {
       });
     } else if (view instanceof RecyclerView) {
       boolean canScroll = canRecyclerViewScroll((RecyclerView) view);
-      if (setForTop)
+      if (setForTop) {
         drawTopDivider = canScroll;
-      if (setForBottom)
+      }
+      if (setForBottom) {
         drawBottomDivider = canScroll;
-      if (canScroll)
+      }
+      if (canScroll) {
         addScrollListener((ViewGroup) view, setForTop, setForBottom);
+      }
     } else if (view instanceof ViewGroup) {
       View topView = getTopView((ViewGroup) view);
       setUpDividersVisibility(topView, setForTop, setForBottom);
@@ -519,7 +543,8 @@ public class MDRootLayout extends ViewGroup {
     }
   }
 
-  private void addScrollListener(final ViewGroup vg, final boolean setForTop, final boolean setForBottom) {
+  private void addScrollListener(final ViewGroup vg, final boolean setForTop,
+      final boolean setForBottom) {
     if ((!setForBottom && topOnScrollChangedListener == null
         || (setForBottom && bottomOnScrollChangedListener == null))) {
       if (vg instanceof RecyclerView) {
@@ -571,7 +596,8 @@ public class MDRootLayout extends ViewGroup {
     }
   }
 
-  private void invalidateDividersForScrollingView(ViewGroup view, final boolean setForTop, boolean setForBottom, boolean hasButtons) {
+  private void invalidateDividersForScrollingView(ViewGroup view, final boolean setForTop,
+      boolean setForBottom, boolean hasButtons) {
     if (setForTop && view.getChildCount() > 0) {
       drawTopDivider = titleBar != null &&
           titleBar.getVisibility() != View.GONE &&
@@ -581,11 +607,13 @@ public class MDRootLayout extends ViewGroup {
     }
     if (setForBottom && view.getChildCount() > 0) {
       drawBottomDivider = hasButtons &&
-          view.getScrollY() + view.getHeight() - view.getPaddingBottom() < view.getChildAt(view.getChildCount() - 1).getBottom();
+          view.getScrollY() + view.getHeight() - view.getPaddingBottom() < view
+              .getChildAt(view.getChildCount() - 1).getBottom();
     }
   }
 
-  private void invalidateDividersForWebView(WebView view, final boolean setForTop, boolean setForBottom, boolean hasButtons) {
+  private void invalidateDividersForWebView(WebView view, final boolean setForTop,
+      boolean setForBottom, boolean hasButtons) {
     if (setForTop) {
       drawTopDivider = titleBar != null &&
           titleBar.getVisibility() != View.GONE &&
@@ -595,7 +623,8 @@ public class MDRootLayout extends ViewGroup {
     if (setForBottom) {
       //noinspection deprecation
       drawBottomDivider = hasButtons &&
-          view.getScrollY() + view.getMeasuredHeight() - view.getPaddingBottom() < view.getContentHeight() * view.getScale();
+          view.getScrollY() + view.getMeasuredHeight() - view.getPaddingBottom()
+              < view.getContentHeight() * view.getScale();
     }
   }
 }

+ 18 - 14
core/src/main/java/com/afollestad/materialdialogs/internal/MDTintHelper.java

@@ -16,10 +16,8 @@ import android.widget.ProgressBar;
 import android.widget.RadioButton;
 import android.widget.SeekBar;
 import android.widget.TextView;
-
 import com.afollestad.materialdialogs.R;
 import com.afollestad.materialdialogs.util.DialogUtils;
-
 import java.lang.reflect.Field;
 
 /**
@@ -28,7 +26,7 @@ import java.lang.reflect.Field;
 public class MDTintHelper {
 
   public static void setTint(@NonNull RadioButton radioButton,
-                             @NonNull ColorStateList colors) {
+      @NonNull ColorStateList colors) {
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
       radioButton.setButtonTintList(colors);
     } else {
@@ -41,7 +39,7 @@ public class MDTintHelper {
   }
 
   public static void setTint(@NonNull RadioButton radioButton,
-                             @ColorInt int color) {
+      @ColorInt int color) {
     final int disabledColor = DialogUtils.getDisabledColor(radioButton.getContext());
     ColorStateList sl = new ColorStateList(new int[][]{
         new int[]{android.R.attr.state_enabled, -android.R.attr.state_checked},
@@ -58,7 +56,7 @@ public class MDTintHelper {
   }
 
   public static void setTint(@NonNull CheckBox box,
-                             @NonNull ColorStateList colors) {
+      @NonNull ColorStateList colors) {
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
       box.setButtonTintList(colors);
     } else {
@@ -105,36 +103,41 @@ public class MDTintHelper {
       if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
         mode = PorterDuff.Mode.MULTIPLY;
       }
-      if (seekBar.getIndeterminateDrawable() != null)
+      if (seekBar.getIndeterminateDrawable() != null) {
         seekBar.getIndeterminateDrawable().setColorFilter(color, mode);
-      if (seekBar.getProgressDrawable() != null)
+      }
+      if (seekBar.getProgressDrawable() != null) {
         seekBar.getProgressDrawable().setColorFilter(color, mode);
+      }
     }
   }
 
   public static void setTint(@NonNull ProgressBar progressBar,
-                             @ColorInt int color) {
+      @ColorInt int color) {
     setTint(progressBar, color, false);
   }
 
   private static void setTint(@NonNull ProgressBar progressBar,
-                              @ColorInt int color,
-                              boolean skipIndeterminate) {
+      @ColorInt int color,
+      boolean skipIndeterminate) {
     ColorStateList sl = ColorStateList.valueOf(color);
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
       progressBar.setProgressTintList(sl);
       progressBar.setSecondaryProgressTintList(sl);
-      if (!skipIndeterminate)
+      if (!skipIndeterminate) {
         progressBar.setIndeterminateTintList(sl);
+      }
     } else {
       PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN;
       if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
         mode = PorterDuff.Mode.MULTIPLY;
       }
-      if (!skipIndeterminate && progressBar.getIndeterminateDrawable() != null)
+      if (!skipIndeterminate && progressBar.getIndeterminateDrawable() != null) {
         progressBar.getIndeterminateDrawable().setColorFilter(color, mode);
-      if (progressBar.getProgressDrawable() != null)
+      }
+      if (progressBar.getProgressDrawable() != null) {
         progressBar.getProgressDrawable().setColorFilter(color, mode);
+      }
     }
   }
 
@@ -155,7 +158,8 @@ public class MDTintHelper {
   }
 
   public static void setTint(@NonNull EditText editText, @ColorInt int color) {
-    ColorStateList editTextColorStateList = createEditTextColorStateList(editText.getContext(), color);
+    ColorStateList editTextColorStateList = createEditTextColorStateList(editText.getContext(),
+        color);
     if (editText instanceof AppCompatEditText) {
       ((AppCompatEditText) editText).setSupportBackgroundTintList(editTextColorStateList);
     } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

+ 4 - 3
core/src/main/java/com/afollestad/materialdialogs/internal/ThemeSingleton.java

@@ -4,11 +4,11 @@ import android.content.res.ColorStateList;
 import android.graphics.drawable.Drawable;
 import android.support.annotation.ColorInt;
 import android.support.annotation.DrawableRes;
-
 import com.afollestad.materialdialogs.GravityEnum;
 
 /**
- * Use of this is discouraged for now; for internal use only. See the Global Theming section of the README.
+ * Use of this is discouraged for now; for internal use only. See the Global Theming section of the
+ * README.
  */
 public class ThemeSingleton {
 
@@ -48,8 +48,9 @@ public class ThemeSingleton {
   public GravityEnum buttonsGravity = GravityEnum.START;
 
   public static ThemeSingleton get(boolean createIfNull) {
-    if (singleton == null && createIfNull)
+    if (singleton == null && createIfNull) {
       singleton = new ThemeSingleton();
+    }
     return singleton;
   }
 

+ 44 - 27
core/src/main/java/com/afollestad/materialdialogs/util/DialogUtils.java

@@ -18,7 +18,6 @@ import android.support.v4.content.ContextCompat;
 import android.util.TypedValue;
 import android.view.View;
 import android.view.inputmethod.InputMethodManager;
-
 import com.afollestad.materialdialogs.GravityEnum;
 import com.afollestad.materialdialogs.MaterialDialog;
 
@@ -46,7 +45,7 @@ public class DialogUtils {
 
   @ColorInt
   public static int adjustAlpha(@ColorInt int color,
-                                @SuppressWarnings("SameParameterValue") float factor) {
+      @SuppressWarnings("SameParameterValue") float factor) {
     int alpha = Math.round(Color.alpha(color) * factor);
     int red = Color.red(color);
     int green = Color.green(color);
@@ -78,7 +77,8 @@ public class DialogUtils {
       if (value == null) {
         return fallback;
       }
-      if (value.type >= TypedValue.TYPE_FIRST_COLOR_INT && value.type <= TypedValue.TYPE_LAST_COLOR_INT) {
+      if (value.type >= TypedValue.TYPE_FIRST_COLOR_INT
+          && value.type <= TypedValue.TYPE_LAST_COLOR_INT) {
         return getActionTextStateList(context, value.data);
       } else {
         final ColorStateList stateList = a.getColorStateList(0);
@@ -98,7 +98,8 @@ public class DialogUtils {
   public static ColorStateList getActionTextColorStateList(Context context, @ColorRes int colorId) {
     final TypedValue value = new TypedValue();
     context.getResources().getValue(colorId, value, true);
-    if (value.type >= TypedValue.TYPE_FIRST_COLOR_INT && value.type <= TypedValue.TYPE_LAST_COLOR_INT) {
+    if (value.type >= TypedValue.TYPE_FIRST_COLOR_INT
+        && value.type <= TypedValue.TYPE_LAST_COLOR_INT) {
       return getActionTextStateList(context, value.data);
     } else {
 
@@ -117,9 +118,8 @@ public class DialogUtils {
    * Starting in {@link android.os.Build.VERSION_CODES#M}, the returned
    * color will be styled for the specified Context's theme.
    *
-   * @param colorId The desired resource identifier, as generated by the aapt
-   *                tool. This integer encodes the package, type, and resource
-   *                entry. The value 0 is an invalid identifier.
+   * @param colorId The desired resource identifier, as generated by the aapt tool. This integer
+   * encodes the package, type, and resource entry. The value 0 is an invalid identifier.
    * @return A single color value in the form 0xAARRGGBB.
    */
   @ColorInt
@@ -145,8 +145,8 @@ public class DialogUtils {
   }
 
   public static GravityEnum resolveGravityEnum(Context context,
-                                               @AttrRes int attr,
-                                               GravityEnum defaultGravity) {
+      @AttrRes int attr,
+      GravityEnum defaultGravity) {
     TypedArray a = context.getTheme().obtainStyledAttributes(new int[]{attr});
     try {
       switch (a.getInt(0, gravityEnumToAttrInt(defaultGravity))) {
@@ -167,14 +167,15 @@ public class DialogUtils {
   }
 
   private static Drawable resolveDrawable(Context context,
-                                          @AttrRes int attr,
-                                          @SuppressWarnings(
-                                              "SameParameterValue") Drawable fallback) {
+      @AttrRes int attr,
+      @SuppressWarnings(
+          "SameParameterValue") Drawable fallback) {
     TypedArray a = context.getTheme().obtainStyledAttributes(new int[]{attr});
     try {
       Drawable d = a.getDrawable(0);
-      if (d == null && fallback != null)
+      if (d == null && fallback != null) {
         d = fallback;
+      }
       return d;
     } finally {
       a.recycle();
@@ -208,7 +209,8 @@ public class DialogUtils {
   }
 
   public static boolean isColorDark(@ColorInt int color) {
-    double darkness = 1 - (0.299 * Color.red(color) + 0.587 * Color.green(color) + 0.114 * Color.blue(color)) / 255;
+    double darkness = 1
+        - (0.299 * Color.red(color) + 0.587 * Color.green(color) + 0.114 * Color.blue(color)) / 255;
     return darkness >= 0.5;
   }
 
@@ -222,25 +224,32 @@ public class DialogUtils {
   }
 
   public static void showKeyboard(@NonNull final DialogInterface di,
-                                  @NonNull final MaterialDialog.Builder builder) {
+      @NonNull final MaterialDialog.Builder builder) {
     final MaterialDialog dialog = (MaterialDialog) di;
-    if (dialog.getInputEditText() == null) return;
+    if (dialog.getInputEditText() == null) {
+      return;
+    }
     dialog.getInputEditText().post(new Runnable() {
       @Override
       public void run() {
         dialog.getInputEditText().requestFocus();
-        InputMethodManager imm = (InputMethodManager) builder.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
-        if (imm != null)
+        InputMethodManager imm = (InputMethodManager) builder.getContext()
+            .getSystemService(Context.INPUT_METHOD_SERVICE);
+        if (imm != null) {
           imm.showSoftInput(dialog.getInputEditText(), InputMethodManager.SHOW_IMPLICIT);
+        }
       }
     });
   }
 
   public static void hideKeyboard(@NonNull final DialogInterface di,
-                                  @NonNull final MaterialDialog.Builder builder) {
+      @NonNull final MaterialDialog.Builder builder) {
     final MaterialDialog dialog = (MaterialDialog) di;
-    if (dialog.getInputEditText() == null) return;
-    InputMethodManager imm = (InputMethodManager) builder.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
+    if (dialog.getInputEditText() == null) {
+      return;
+    }
+    InputMethodManager imm = (InputMethodManager) builder.getContext()
+        .getSystemService(Context.INPUT_METHOD_SERVICE);
     if (imm != null) {
       final View currentFocus = dialog.getCurrentFocus();
       final IBinder windowToken = currentFocus != null ?
@@ -252,8 +261,11 @@ public class DialogUtils {
   }
 
   public static ColorStateList getActionTextStateList(Context context, int newPrimaryColor) {
-    final int fallBackButtonColor = DialogUtils.resolveColor(context, android.R.attr.textColorPrimary);
-    if (newPrimaryColor == 0) newPrimaryColor = fallBackButtonColor;
+    final int fallBackButtonColor = DialogUtils
+        .resolveColor(context, android.R.attr.textColorPrimary);
+    if (newPrimaryColor == 0) {
+      newPrimaryColor = fallBackButtonColor;
+    }
     int[][] states = new int[][]{
         new int[]{-android.R.attr.state_enabled}, // disabled
         new int[]{} // enabled
@@ -266,21 +278,26 @@ public class DialogUtils {
   }
 
   public static int[] getColorArray(@NonNull Context context, @ArrayRes int array) {
-    if (array == 0) return null;
+    if (array == 0) {
+      return null;
+    }
     TypedArray ta = context.getResources().obtainTypedArray(array);
     int[] colors = new int[ta.length()];
-    for (int i = 0; i < ta.length(); i++)
+    for (int i = 0; i < ta.length(); i++) {
       colors[i] = ta.getColor(i, 0);
+    }
     ta.recycle();
     return colors;
   }
 
   public static <T> boolean isIn(@NonNull T find, @Nullable T[] ary) {
-    if (ary == null || ary.length == 0)
+    if (ary == null || ary.length == 0) {
       return false;
+    }
     for (T item : ary) {
-      if (item.equals(find))
+      if (item.equals(find)) {
         return true;
+      }
     }
     return false;
   }

+ 2 - 1
core/src/main/java/com/afollestad/materialdialogs/util/RippleHelper.java

@@ -14,7 +14,8 @@ import android.support.annotation.ColorInt;
 public class RippleHelper {
 
   public static void applyColor(Drawable d, @ColorInt int color) {
-    if (d instanceof RippleDrawable)
+    if (d instanceof RippleDrawable) {
       ((RippleDrawable) d).setColor(ColorStateList.valueOf(color));
+    }
   }
 }

+ 1 - 1
core/src/main/res/anim/decelerate_cubic.xml

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

+ 6 - 6
core/src/main/res/anim/popup_enter.xml

@@ -1,9 +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" />
+  android:shareInterpolator="false">
+  <alpha
+    android:fromAlpha="0.0"
+    android:toAlpha="1.0"
+    android:interpolator="@anim/decelerate_cubic"
+    android:duration="150" />
 </set>

+ 6 - 6
core/src/main/res/anim/popup_exit.xml

@@ -1,9 +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" />
+  android:shareInterpolator="false">
+  <alpha
+    android:fromAlpha="1.0"
+    android:toAlpha="0.0"
+    android:interpolator="@anim/decelerate_cubic"
+    android:duration="150" />
 </set>

+ 4 - 4
core/src/main/res/drawable-v21/md_btn_selector_ripple.xml

@@ -1,8 +1,8 @@
 <ripple xmlns:android="http://schemas.android.com/apk/res/android"
-    android:color="?android:colorControlHighlight">
+  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>

+ 4 - 4
core/src/main/res/drawable-v21/md_btn_selector_ripple_dark.xml

@@ -1,8 +1,8 @@
 <ripple xmlns:android="http://schemas.android.com/apk/res/android"
-    android:color="?android:colorControlHighlight">
+  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>

+ 13 - 13
core/src/main/res/drawable-v21/md_btn_shape.xml

@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="utf-8"?>
 <inset xmlns:android="http://schemas.android.com/apk/res/android"
-    android:insetBottom="@dimen/md_button_inset_vertical"
-    android:insetLeft="@dimen/md_button_inset_horizontal"
-    android:insetRight="@dimen/md_button_inset_horizontal"
-    android:insetTop="@dimen/md_button_inset_vertical">
-    <shape android:shape="rectangle">
-        <corners android:radius="@dimen/md_action_corner_radius" />
-        <solid android:color="?android:colorButtonNormal" />
-        <padding
-            android:bottom="@dimen/md_button_padding_vertical"
-            android:left="@dimen/md_button_padding_horizontal"
-            android:right="@dimen/md_button_padding_horizontal"
-            android:top="@dimen/md_button_padding_vertical" />
-    </shape>
+  android:insetBottom="@dimen/md_button_inset_vertical"
+  android:insetLeft="@dimen/md_button_inset_horizontal"
+  android:insetRight="@dimen/md_button_inset_horizontal"
+  android:insetTop="@dimen/md_button_inset_vertical">
+  <shape android:shape="rectangle">
+    <corners android:radius="@dimen/md_action_corner_radius" />
+    <solid android:color="?android:colorButtonNormal" />
+    <padding
+      android:bottom="@dimen/md_button_padding_vertical"
+      android:left="@dimen/md_button_padding_horizontal"
+      android:right="@dimen/md_button_padding_horizontal"
+      android:top="@dimen/md_button_padding_vertical" />
+  </shape>
 </inset>

+ 14 - 14
core/src/main/res/drawable/md_btn_selected.xml

@@ -1,17 +1,17 @@
 <?xml version="1.0" encoding="utf-8"?>
 <inset xmlns:android="http://schemas.android.com/apk/res/android"
-    android:insetBottom="@dimen/md_button_inset_vertical"
-    android:insetLeft="@dimen/md_button_inset_horizontal"
-    android:insetRight="@dimen/md_button_inset_horizontal"
-    android:insetTop="@dimen/md_button_inset_vertical">
-    <shape xmlns:android="http://schemas.android.com/apk/res/android"
-        android:shape="rectangle">
-        <corners android:radius="@dimen/md_action_corner_radius" />
-        <solid android:color="@color/md_btn_selected" />
-        <padding
-            android:bottom="@dimen/md_button_padding_vertical"
-            android:left="@dimen/md_button_padding_horizontal"
-            android:right="@dimen/md_button_padding_horizontal"
-            android:top="@dimen/md_button_padding_vertical" />
-    </shape>
+  android:insetBottom="@dimen/md_button_inset_vertical"
+  android:insetLeft="@dimen/md_button_inset_horizontal"
+  android:insetRight="@dimen/md_button_inset_horizontal"
+  android:insetTop="@dimen/md_button_inset_vertical">
+  <shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <corners android:radius="@dimen/md_action_corner_radius" />
+    <solid android:color="@color/md_btn_selected" />
+    <padding
+      android:bottom="@dimen/md_button_padding_vertical"
+      android:left="@dimen/md_button_padding_horizontal"
+      android:right="@dimen/md_button_padding_horizontal"
+      android:top="@dimen/md_button_padding_vertical" />
+  </shape>
 </inset>

+ 14 - 14
core/src/main/res/drawable/md_btn_selected_dark.xml

@@ -1,17 +1,17 @@
 <?xml version="1.0" encoding="utf-8"?>
 <inset xmlns:android="http://schemas.android.com/apk/res/android"
-    android:insetBottom="@dimen/md_button_inset_vertical"
-    android:insetLeft="@dimen/md_button_inset_horizontal"
-    android:insetRight="@dimen/md_button_inset_horizontal"
-    android:insetTop="@dimen/md_button_inset_vertical">
-    <shape xmlns:android="http://schemas.android.com/apk/res/android"
-        android:shape="rectangle">
-        <corners android:radius="@dimen/md_action_corner_radius" />
-        <solid android:color="@color/md_btn_selected_dark" />
-        <padding
-            android:bottom="@dimen/md_button_padding_vertical"
-            android:left="@dimen/md_button_padding_horizontal"
-            android:right="@dimen/md_button_padding_horizontal"
-            android:top="@dimen/md_button_padding_vertical" />
-    </shape>
+  android:insetBottom="@dimen/md_button_inset_vertical"
+  android:insetLeft="@dimen/md_button_inset_horizontal"
+  android:insetRight="@dimen/md_button_inset_horizontal"
+  android:insetTop="@dimen/md_button_inset_vertical">
+  <shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <corners android:radius="@dimen/md_action_corner_radius" />
+    <solid android:color="@color/md_btn_selected_dark" />
+    <padding
+      android:bottom="@dimen/md_button_padding_vertical"
+      android:left="@dimen/md_button_padding_horizontal"
+      android:right="@dimen/md_button_padding_horizontal"
+      android:top="@dimen/md_button_padding_vertical" />
+  </shape>
 </inset>

+ 3 - 3
core/src/main/res/drawable/md_btn_selector.xml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <selector xmlns:android="http://schemas.android.com/apk/res/android" android:exitFadeDuration="@android:integer/config_shortAnimTime">
 
-    <item android:drawable="@drawable/md_btn_selected" android:state_focused="true" />
-    <item android:drawable="@drawable/md_btn_selected" android:state_pressed="true" />
-    <item android:drawable="@drawable/md_transparent" />
+  <item android:drawable="@drawable/md_btn_selected" android:state_focused="true" />
+  <item android:drawable="@drawable/md_btn_selected" android:state_pressed="true" />
+  <item android:drawable="@drawable/md_transparent" />
 
 </selector>

+ 3 - 3
core/src/main/res/drawable/md_btn_selector_dark.xml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <selector xmlns:android="http://schemas.android.com/apk/res/android" android:exitFadeDuration="@android:integer/config_shortAnimTime">
 
-    <item android:drawable="@drawable/md_btn_selected_dark" android:state_focused="true" />
-    <item android:drawable="@drawable/md_btn_selected_dark" android:state_pressed="true" />
-    <item android:drawable="@drawable/md_transparent" />
+  <item android:drawable="@drawable/md_btn_selected_dark" android:state_focused="true" />
+  <item android:drawable="@drawable/md_btn_selected_dark" android:state_pressed="true" />
+  <item android:drawable="@drawable/md_transparent" />
 
 </selector>

+ 2 - 2
core/src/main/res/drawable/md_item_selected.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
-    android:shape="rectangle">
-    <solid android:color="@color/md_btn_selected" />
+  android:shape="rectangle">
+  <solid android:color="@color/md_btn_selected" />
 </shape>

+ 2 - 2
core/src/main/res/drawable/md_item_selected_dark.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
-    android:shape="rectangle">
-    <solid android:color="@color/md_btn_selected_dark" />
+  android:shape="rectangle">
+  <solid android:color="@color/md_btn_selected_dark" />
 </shape>

+ 7 - 7
core/src/main/res/drawable/md_nav_back.xml

@@ -1,9 +1,9 @@
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="24dp"
-        android:height="24dp"
-        android:viewportWidth="24.0"
-        android:viewportHeight="24.0">
-    <path
-        android:fillColor="#ffffff"
-        android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
+  android:width="24dp"
+  android:height="24dp"
+  android:viewportWidth="24.0"
+  android:viewportHeight="24.0">
+  <path
+    android:fillColor="#ffffff"
+    android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z" />
 </vector>

+ 3 - 3
core/src/main/res/drawable/md_selector.xml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <selector xmlns:android="http://schemas.android.com/apk/res/android" android:exitFadeDuration="@android:integer/config_shortAnimTime">
 
-    <item android:drawable="@drawable/md_item_selected" android:state_focused="true" />
-    <item android:drawable="@drawable/md_item_selected" android:state_pressed="true" />
-    <item android:drawable="@drawable/md_transparent" />
+  <item android:drawable="@drawable/md_item_selected" android:state_focused="true" />
+  <item android:drawable="@drawable/md_item_selected" android:state_pressed="true" />
+  <item android:drawable="@drawable/md_transparent" />
 
 </selector>

+ 3 - 3
core/src/main/res/drawable/md_selector_dark.xml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <selector xmlns:android="http://schemas.android.com/apk/res/android" android:exitFadeDuration="@android:integer/config_shortAnimTime">
 
-    <item android:drawable="@drawable/md_item_selected_dark" android:state_focused="true" />
-    <item android:drawable="@drawable/md_item_selected_dark" android:state_pressed="true" />
-    <item android:drawable="@drawable/md_transparent" />
+  <item android:drawable="@drawable/md_item_selected_dark" android:state_focused="true" />
+  <item android:drawable="@drawable/md_item_selected_dark" android:state_pressed="true" />
+  <item android:drawable="@drawable/md_transparent" />
 
 </selector>

+ 2 - 2
core/src/main/res/drawable/md_transparent.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
-    android:shape="rectangle">
-    <solid android:color="@android:color/transparent" />
+  android:shape="rectangle">
+  <solid android:color="@android:color/transparent" />
 </shape>

+ 34 - 35
core/src/main/res/layout-ldrtl/md_listitem_multichoice.xml

@@ -1,39 +1,38 @@
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:background="?selectableItemBackground"
-    android:descendantFocusability="blocksDescendants"
-    android:minHeight="@dimen/md_listitem_height"
-    android:orientation="horizontal"
-    android:paddingEnd="@dimen/md_dialog_frame_margin"
-    android:paddingLeft="@dimen/md_dialog_frame_margin"
-    android:paddingRight="@dimen/md_dialog_frame_margin"
-    android:paddingStart="@dimen/md_dialog_frame_margin"
-    tools:gravity="start|center_vertical">
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:tools="http://schemas.android.com/tools"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:background="?selectableItemBackground"
+  android:descendantFocusability="blocksDescendants"
+  android:minHeight="@dimen/md_listitem_height"
+  android:orientation="horizontal"
+  android:paddingEnd="@dimen/md_dialog_frame_margin"
+  android:paddingLeft="@dimen/md_dialog_frame_margin"
+  android:paddingRight="@dimen/md_dialog_frame_margin"
+  android:paddingStart="@dimen/md_dialog_frame_margin"
+  tools:gravity="start|center_vertical">
 
-    <TextView
-        android:id="@+id/md_title"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:gravity="center_vertical"
-        android:paddingBottom="@dimen/md_listitem_vertical_margin_choice"
-        android:paddingEnd="@dimen/md_listitem_control_margin"
-        android:paddingRight="@dimen/md_listitem_control_margin"
-        android:paddingTop="@dimen/md_listitem_vertical_margin_choice"
-        android:textSize="@dimen/md_listitem_textsize"
-        tools:ignore="RtlSymmetry"
-        tools:text="Item"/>
+  <TextView
+    android:id="@+id/md_title"
+    android:layout_width="wrap_content"
+    android:layout_height="match_parent"
+    android:gravity="center_vertical"
+    android:paddingBottom="@dimen/md_listitem_vertical_margin_choice"
+    android:paddingEnd="@dimen/md_listitem_control_margin"
+    android:paddingRight="@dimen/md_listitem_control_margin"
+    android:paddingTop="@dimen/md_listitem_vertical_margin_choice"
+    android:textSize="@dimen/md_listitem_textsize"
+    tools:ignore="RtlSymmetry"
+    tools:text="Item" />
 
-    <android.support.v7.widget.AppCompatCheckBox
-        android:id="@+id/md_control"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:background="@null"
-        android:clickable="false"
-        android:focusable="false"
-        android:gravity="center_vertical"
-        android:minHeight="@dimen/md_listitem_height"/>
+  <android.support.v7.widget.AppCompatCheckBox
+    android:id="@+id/md_control"
+    android:layout_width="wrap_content"
+    android:layout_height="match_parent"
+    android:background="@null"
+    android:clickable="false"
+    android:focusable="false"
+    android:gravity="center_vertical"
+    android:minHeight="@dimen/md_listitem_height" />
 
 </LinearLayout>

+ 33 - 33
core/src/main/res/layout-ldrtl/md_listitem_singlechoice.xml

@@ -1,38 +1,38 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:background="?selectableItemBackground"
-    android:descendantFocusability="blocksDescendants"
-    android:minHeight="@dimen/md_listitem_height"
-    android:orientation="horizontal"
-    android:paddingEnd="@dimen/md_dialog_frame_margin"
-    android:paddingLeft="@dimen/md_dialog_frame_margin"
-    android:paddingRight="@dimen/md_dialog_frame_margin"
-    android:paddingStart="@dimen/md_dialog_frame_margin"
-    tools:gravity="start|center_vertical">
+  xmlns:tools="http://schemas.android.com/tools"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:background="?selectableItemBackground"
+  android:descendantFocusability="blocksDescendants"
+  android:minHeight="@dimen/md_listitem_height"
+  android:orientation="horizontal"
+  android:paddingEnd="@dimen/md_dialog_frame_margin"
+  android:paddingLeft="@dimen/md_dialog_frame_margin"
+  android:paddingRight="@dimen/md_dialog_frame_margin"
+  android:paddingStart="@dimen/md_dialog_frame_margin"
+  tools:gravity="start|center_vertical">
 
-    <TextView
-        android:id="@+id/md_title"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:gravity="center_vertical"
-        android:paddingBottom="@dimen/md_listitem_vertical_margin_choice"
-        android:paddingEnd="@dimen/md_listitem_control_margin"
-        android:paddingRight="@dimen/md_listitem_control_margin"
-        android:paddingTop="@dimen/md_listitem_vertical_margin_choice"
-        android:textSize="@dimen/md_listitem_textsize"
-        tools:ignore="RtlSymmetry"
-        tools:text="Item" />
+  <TextView
+    android:id="@+id/md_title"
+    android:layout_width="wrap_content"
+    android:layout_height="match_parent"
+    android:gravity="center_vertical"
+    android:paddingBottom="@dimen/md_listitem_vertical_margin_choice"
+    android:paddingEnd="@dimen/md_listitem_control_margin"
+    android:paddingRight="@dimen/md_listitem_control_margin"
+    android:paddingTop="@dimen/md_listitem_vertical_margin_choice"
+    android:textSize="@dimen/md_listitem_textsize"
+    tools:ignore="RtlSymmetry"
+    tools:text="Item" />
 
-    <android.support.v7.widget.AppCompatRadioButton
-        android:id="@+id/md_control"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:background="@null"
-        android:clickable="false"
-        android:focusable="false"
-        android:gravity="center_vertical"
-        android:minHeight="@dimen/md_listitem_height" />
+  <android.support.v7.widget.AppCompatRadioButton
+    android:id="@+id/md_control"
+    android:layout_width="wrap_content"
+    android:layout_height="match_parent"
+    android:background="@null"
+    android:clickable="false"
+    android:focusable="false"
+    android:gravity="center_vertical"
+    android:minHeight="@dimen/md_listitem_height" />
 
 </LinearLayout>

+ 46 - 46
core/src/main/res/layout-v14/md_stub_progress.xml

@@ -1,56 +1,56 @@
 <?xml version="1.0" encoding="utf-8"?>
 <merge xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    tools:ignore="UnusedAttribute">
+  xmlns:tools="http://schemas.android.com/tools"
+  tools:ignore="UnusedAttribute">
 
-    <TextView
-        android:id="@+id/md_content"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center_horizontal"
-        android:layout_marginBottom="20dp"
-        android:layout_marginTop="4dp"
-        android:fontFamily="sans-serif"
-        android:textSize="@dimen/md_content_textsize"
-        tools:text="Message" />
+  <TextView
+    android:id="@+id/md_content"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center_horizontal"
+    android:layout_marginBottom="20dp"
+    android:layout_marginTop="4dp"
+    android:fontFamily="sans-serif"
+    android:textSize="@dimen/md_content_textsize"
+    tools:text="Message" />
 
-    <RelativeLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content">
+  <RelativeLayout
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content">
 
-        <ProgressBar
-            android:id="@android:id/progress"
-            style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+    <ProgressBar
+      android:id="@android:id/progress"
+      style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content" />
 
-        <TextView
-            android:id="@+id/md_label"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignLeft="@android:id/progress"
-            android:layout_alignStart="@android:id/progress"
-            android:layout_below="@android:id/progress"
-            android:gravity="start"
-            android:minWidth="36dp"
-            android:textAlignment="viewStart"
-            android:textSize="@dimen/md_content_textsize"
-            android:textStyle="bold"
-            tools:text="100%" />
+    <TextView
+      android:id="@+id/md_label"
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:layout_alignLeft="@android:id/progress"
+      android:layout_alignStart="@android:id/progress"
+      android:layout_below="@android:id/progress"
+      android:gravity="start"
+      android:minWidth="36dp"
+      android:textAlignment="viewStart"
+      android:textSize="@dimen/md_content_textsize"
+      android:textStyle="bold"
+      tools:text="100%" />
 
-        <TextView
-            android:id="@+id/md_minMax"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignEnd="@android:id/progress"
-            android:layout_alignRight="@android:id/progress"
-            android:layout_below="@android:id/progress"
-            android:gravity="end"
-            android:minWidth="48dp"
-            android:textAlignment="viewEnd"
-            android:textSize="@dimen/md_content_textsize"
-            tools:text="100%" />
+    <TextView
+      android:id="@+id/md_minMax"
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:layout_alignEnd="@android:id/progress"
+      android:layout_alignRight="@android:id/progress"
+      android:layout_below="@android:id/progress"
+      android:gravity="end"
+      android:minWidth="48dp"
+      android:textAlignment="viewEnd"
+      android:textSize="@dimen/md_content_textsize"
+      tools:text="100%" />
 
-    </RelativeLayout>
+  </RelativeLayout>
 
 </merge>

+ 27 - 27
core/src/main/res/layout-v14/md_stub_progress_indeterminate.xml

@@ -1,33 +1,33 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:gravity="end|center_vertical"
-    android:orientation="horizontal"
-    android:paddingBottom="@dimen/md_content_padding_top"
-    android:paddingLeft="@dimen/md_dialog_frame_margin"
-    android:paddingRight="@dimen/md_dialog_frame_margin"
-    android:paddingTop="@dimen/md_content_padding_top">
+  xmlns:tools="http://schemas.android.com/tools"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:paddingTop="@dimen/md_content_padding_top"
+  android:paddingBottom="@dimen/md_content_padding_top"
+  android:paddingLeft="@dimen/md_dialog_frame_margin"
+  android:paddingRight="@dimen/md_dialog_frame_margin"
+  android:gravity="start|center_vertical"
+  android:orientation="horizontal">
 
-    <ProgressBar
-        android:id="@android:id/progress"
-        style="@style/Widget.MaterialProgressBar.ProgressBar"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:indeterminate="true" />
+  <ProgressBar
+    android:id="@android:id/progress"
+    style="@style/Widget.MaterialProgressBar.ProgressBar"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:indeterminate="true" />
 
-    <TextView
-        android:id="@+id/md_content"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:fontFamily="sans-serif"
-        android:gravity="start"
-        android:paddingLeft="16dp"
-        android:paddingStart="16dp"
-        android:textAlignment="viewStart"
-        android:textSize="@dimen/md_content_textsize"
-        tools:ignore="NewApi,RtlSymmetry,UnusedAttribute"
-        tools:text="Message" />
+  <TextView
+    android:id="@+id/md_content"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:paddingStart="16dp"
+    android:paddingLeft="16dp"
+    android:fontFamily="sans-serif"
+    android:gravity="start"
+    android:textAlignment="viewStart"
+    android:textSize="@dimen/md_content_textsize"
+    tools:ignore="NewApi,RtlSymmetry,UnusedAttribute"
+    tools:text="Message" />
 
 </LinearLayout>

+ 18 - 18
core/src/main/res/layout-v14/md_stub_progress_indeterminate_horizontal.xml

@@ -1,24 +1,24 @@
 <?xml version="1.0" encoding="utf-8"?>
 <merge xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    tools:ignore="UnusedAttribute">
+  xmlns:tools="http://schemas.android.com/tools"
+  tools:ignore="UnusedAttribute">
 
-    <TextView
-        android:id="@+id/md_content"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center_horizontal"
-        android:layout_marginBottom="20dp"
-        android:layout_marginTop="4dp"
-        android:fontFamily="sans-serif"
-        android:textSize="@dimen/md_content_textsize"
-        tools:text="Message" />
+  <TextView
+    android:id="@+id/md_content"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center_horizontal"
+    android:layout_marginBottom="20dp"
+    android:layout_marginTop="4dp"
+    android:fontFamily="sans-serif"
+    android:textSize="@dimen/md_content_textsize"
+    tools:text="Message" />
 
-    <ProgressBar
-        android:id="@android:id/progress"
-        style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:indeterminate="true" />
+  <ProgressBar
+    android:id="@android:id/progress"
+    style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:indeterminate="true" />
 
 </merge>

+ 25 - 26
core/src/main/res/layout/md_dialog_basic.xml

@@ -1,33 +1,32 @@
-<com.afollestad.materialdialogs.internal.MDRootLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:orientation="vertical"
-    app:md_reduce_padding_no_title_no_buttons="false">
+<com.afollestad.materialdialogs.internal.MDRootLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:app="http://schemas.android.com/apk/res-auto"
+  xmlns:tools="http://schemas.android.com/tools"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:orientation="vertical"
+  app:md_reduce_padding_no_title_no_buttons="false">
 
-    <include layout="@layout/md_stub_titleframe"/>
+  <include layout="@layout/md_stub_titleframe" />
 
-    <ScrollView
-        android:id="@+id/md_contentScrollView"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:clipToPadding="false"
-        android:paddingBottom="@dimen/md_content_padding_bottom"
-        android:paddingTop="@dimen/md_content_padding_top">
+  <ScrollView
+    android:id="@+id/md_contentScrollView"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:clipToPadding="false"
+    android:paddingBottom="@dimen/md_content_padding_bottom"
+    android:paddingTop="@dimen/md_content_padding_top">
 
-        <TextView
-            android:id="@+id/md_content"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:paddingLeft="@dimen/md_dialog_frame_margin"
-            android:paddingRight="@dimen/md_dialog_frame_margin"
-            android:textSize="@dimen/md_content_textsize"
-            tools:text="Content"/>
+    <TextView
+      android:id="@+id/md_content"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:paddingLeft="@dimen/md_dialog_frame_margin"
+      android:paddingRight="@dimen/md_dialog_frame_margin"
+      android:textSize="@dimen/md_content_textsize"
+      tools:text="Content" />
 
-    </ScrollView>
+  </ScrollView>
 
-    <include layout="@layout/md_stub_actionbuttons"/>
+  <include layout="@layout/md_stub_actionbuttons" />
 
 </com.afollestad.materialdialogs.internal.MDRootLayout>

+ 43 - 44
core/src/main/res/layout/md_dialog_basic_check.xml

@@ -1,50 +1,49 @@
-<com.afollestad.materialdialogs.internal.MDRootLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:orientation="vertical"
-    app:md_reduce_padding_no_title_no_buttons="false">
+<com.afollestad.materialdialogs.internal.MDRootLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:app="http://schemas.android.com/apk/res-auto"
+  xmlns:tools="http://schemas.android.com/tools"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:orientation="vertical"
+  app:md_reduce_padding_no_title_no_buttons="false">
 
-    <include layout="@layout/md_stub_titleframe"/>
+  <include layout="@layout/md_stub_titleframe" />
 
-    <LinearLayout
+  <LinearLayout
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical">
+
+    <ScrollView
+      android:id="@+id/md_contentScrollView"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:clipToPadding="false"
+      android:paddingBottom="@dimen/md_content_padding_bottom"
+      android:paddingTop="@dimen/md_content_padding_top">
+
+      <TextView
+        android:id="@+id/md_content"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:orientation="vertical">
-
-        <ScrollView
-            android:id="@+id/md_contentScrollView"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:clipToPadding="false"
-            android:paddingBottom="@dimen/md_content_padding_bottom"
-            android:paddingTop="@dimen/md_content_padding_top">
-
-            <TextView
-                android:id="@+id/md_content"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginBottom="@dimen/md_content_padding_top"
-                android:paddingLeft="@dimen/md_dialog_frame_margin"
-                android:paddingRight="@dimen/md_dialog_frame_margin"
-                android:textSize="@dimen/md_content_textsize"
-                tools:text="Content"/>
-
-        </ScrollView>
-
-        <CheckBox
-            android:id="@+id/md_promptCheckbox"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginLeft="@dimen/md_notitle_vertical_padding"
-            android:layout_marginRight="@dimen/md_notitle_vertical_padding"
-            android:focusable="true"
-            tools:text="Don't ask again"/>
-
-    </LinearLayout>
-
-    <include layout="@layout/md_stub_actionbuttons"/>
+        android:layout_marginBottom="@dimen/md_content_padding_top"
+        android:paddingLeft="@dimen/md_dialog_frame_margin"
+        android:paddingRight="@dimen/md_dialog_frame_margin"
+        android:textSize="@dimen/md_content_textsize"
+        tools:text="Content" />
+
+    </ScrollView>
+
+    <CheckBox
+      android:id="@+id/md_promptCheckbox"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:layout_marginLeft="@dimen/md_notitle_vertical_padding"
+      android:layout_marginRight="@dimen/md_notitle_vertical_padding"
+      android:focusable="true"
+      tools:text="Don't ask again" />
+
+  </LinearLayout>
+
+  <include layout="@layout/md_stub_actionbuttons" />
 
 </com.afollestad.materialdialogs.internal.MDRootLayout>

+ 11 - 12
core/src/main/res/layout/md_dialog_custom.xml

@@ -1,17 +1,16 @@
-<com.afollestad.materialdialogs.internal.MDRootLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/md_root"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:orientation="vertical">
+<com.afollestad.materialdialogs.internal.MDRootLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  android:id="@+id/md_root"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:orientation="vertical">
 
-    <include layout="@layout/md_stub_titleframe"/>
+  <include layout="@layout/md_stub_titleframe" />
 
-    <FrameLayout
-        android:id="@+id/md_customViewFrame"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"/>
+  <FrameLayout
+    android:id="@+id/md_customViewFrame"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content" />
 
-    <include layout="@layout/md_stub_actionbuttons"/>
+  <include layout="@layout/md_stub_actionbuttons" />
 
 </com.afollestad.materialdialogs.internal.MDRootLayout>

+ 60 - 61
core/src/main/res/layout/md_dialog_input.xml

@@ -1,72 +1,71 @@
-<com.afollestad.materialdialogs.internal.MDRootLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:orientation="vertical"
-    app:md_reduce_padding_no_title_no_buttons="false">
+<com.afollestad.materialdialogs.internal.MDRootLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:app="http://schemas.android.com/apk/res-auto"
+  xmlns:tools="http://schemas.android.com/tools"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:orientation="vertical"
+  app:md_reduce_padding_no_title_no_buttons="false">
 
-    <include layout="@layout/md_stub_titleframe"/>
+  <include layout="@layout/md_stub_titleframe" />
 
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:layout_weight="1"
-        android:orientation="vertical"
-        android:paddingBottom="@dimen/md_content_padding_bottom"
-        android:paddingLeft="@dimen/md_dialog_frame_margin"
-        android:paddingRight="@dimen/md_dialog_frame_margin"
-        android:paddingTop="@dimen/md_content_padding_top">
+  <LinearLayout
+    android:layout_width="match_parent"
+    android:layout_height="0dp"
+    android:layout_weight="1"
+    android:orientation="vertical"
+    android:paddingBottom="@dimen/md_content_padding_bottom"
+    android:paddingLeft="@dimen/md_dialog_frame_margin"
+    android:paddingRight="@dimen/md_dialog_frame_margin"
+    android:paddingTop="@dimen/md_content_padding_top">
 
-        <TextView
-            android:id="@+id/md_content"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center_horizontal"
-            android:layout_marginBottom="@dimen/md_content_padding_bottom"
-            android:layout_marginTop="4dp"
-            android:fontFamily="sans-serif"
-            android:textSize="@dimen/md_content_textsize"
-            tools:ignore="UnusedAttribute"
-            tools:text="Message"/>
+    <TextView
+      android:id="@+id/md_content"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:layout_gravity="center_horizontal"
+      android:layout_marginBottom="@dimen/md_content_padding_bottom"
+      android:layout_marginTop="4dp"
+      android:fontFamily="sans-serif"
+      android:textSize="@dimen/md_content_textsize"
+      tools:ignore="UnusedAttribute"
+      tools:text="Message" />
 
-        <RelativeLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content">
+    <RelativeLayout
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content">
 
-            <EditText
-                android:id="@android:id/input"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginBottom="1dp"
-                android:layout_marginLeft="-2dp"
-                android:layout_marginRight="-2dp"
-                android:focusable="true"
-                android:textSize="@dimen/md_content_textsize"
-                tools:ignore="TextFields"/>
+      <EditText
+        android:id="@android:id/input"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginBottom="1dp"
+        android:layout_marginLeft="-2dp"
+        android:layout_marginRight="-2dp"
+        android:focusable="true"
+        android:textSize="@dimen/md_content_textsize"
+        tools:ignore="TextFields" />
 
-            <TextView
-                android:id="@+id/md_minMax"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignEnd="@android:id/input"
-                android:layout_alignRight="@android:id/input"
-                android:layout_below="@android:id/input"
-                android:fontFamily="sans-serif"
-                android:gravity="end"
-                android:minWidth="48dp"
-                android:paddingEnd="4dp"
-                android:paddingRight="4dp"
-                android:textAlignment="viewEnd"
-                android:textSize="12sp"
-                tools:ignore="RtlSymmetry,UnusedAttribute"
-                tools:text="50/100"/>
+      <TextView
+        android:id="@+id/md_minMax"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignEnd="@android:id/input"
+        android:layout_alignRight="@android:id/input"
+        android:layout_below="@android:id/input"
+        android:fontFamily="sans-serif"
+        android:gravity="end"
+        android:minWidth="48dp"
+        android:paddingEnd="4dp"
+        android:paddingRight="4dp"
+        android:textAlignment="viewEnd"
+        android:textSize="12sp"
+        tools:ignore="RtlSymmetry,UnusedAttribute"
+        tools:text="50/100" />
 
-        </RelativeLayout>
+    </RelativeLayout>
 
-    </LinearLayout>
+  </LinearLayout>
 
-    <include layout="@layout/md_stub_actionbuttons"/>
+  <include layout="@layout/md_stub_actionbuttons" />
 
 </com.afollestad.materialdialogs.internal.MDRootLayout>

+ 69 - 70
core/src/main/res/layout/md_dialog_input_check.xml

@@ -1,82 +1,81 @@
-<com.afollestad.materialdialogs.internal.MDRootLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:orientation="vertical"
-    app:md_reduce_padding_no_title_no_buttons="false">
+<com.afollestad.materialdialogs.internal.MDRootLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:app="http://schemas.android.com/apk/res-auto"
+  xmlns:tools="http://schemas.android.com/tools"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:orientation="vertical"
+  app:md_reduce_padding_no_title_no_buttons="false">
 
-    <include layout="@layout/md_stub_titleframe"/>
+  <include layout="@layout/md_stub_titleframe" />
 
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:layout_weight="1"
-        android:orientation="vertical"
-        android:paddingBottom="@dimen/md_content_padding_bottom"
-        android:paddingTop="@dimen/md_content_padding_top">
+  <LinearLayout
+    android:layout_width="match_parent"
+    android:layout_height="0dp"
+    android:layout_weight="1"
+    android:orientation="vertical"
+    android:paddingBottom="@dimen/md_content_padding_bottom"
+    android:paddingTop="@dimen/md_content_padding_top">
 
-        <TextView
-            android:id="@+id/md_content"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center_horizontal"
-            android:layout_marginBottom="@dimen/md_content_padding_bottom"
-            android:layout_marginLeft="@dimen/md_dialog_frame_margin"
-            android:layout_marginRight="@dimen/md_dialog_frame_margin"
-            android:layout_marginTop="4dp"
-            android:fontFamily="sans-serif"
-            android:textSize="@dimen/md_content_textsize"
-            tools:ignore="UnusedAttribute"
-            tools:text="Message"/>
+    <TextView
+      android:id="@+id/md_content"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:layout_gravity="center_horizontal"
+      android:layout_marginBottom="@dimen/md_content_padding_bottom"
+      android:layout_marginLeft="@dimen/md_dialog_frame_margin"
+      android:layout_marginRight="@dimen/md_dialog_frame_margin"
+      android:layout_marginTop="4dp"
+      android:fontFamily="sans-serif"
+      android:textSize="@dimen/md_content_textsize"
+      tools:ignore="UnusedAttribute"
+      tools:text="Message" />
 
-        <RelativeLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginLeft="@dimen/md_dialog_frame_margin"
-            android:layout_marginRight="@dimen/md_dialog_frame_margin">
+    <RelativeLayout
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:layout_marginLeft="@dimen/md_dialog_frame_margin"
+      android:layout_marginRight="@dimen/md_dialog_frame_margin">
 
-            <EditText
-                android:id="@android:id/input"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginBottom="1dp"
-                android:layout_marginLeft="-2dp"
-                android:layout_marginRight="-2dp"
-                android:textSize="@dimen/md_content_textsize"
-                tools:ignore="TextFields"/>
+      <EditText
+        android:id="@android:id/input"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginBottom="1dp"
+        android:layout_marginLeft="-2dp"
+        android:layout_marginRight="-2dp"
+        android:textSize="@dimen/md_content_textsize"
+        tools:ignore="TextFields" />
 
-            <TextView
-                android:id="@+id/md_minMax"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignEnd="@android:id/input"
-                android:layout_alignRight="@android:id/input"
-                android:layout_below="@android:id/input"
-                android:fontFamily="sans-serif"
-                android:gravity="end"
-                android:minWidth="48dp"
-                android:paddingEnd="4dp"
-                android:paddingRight="4dp"
-                android:textAlignment="viewEnd"
-                android:textSize="12sp"
-                tools:ignore="RtlSymmetry,UnusedAttribute"
-                tools:text="50/100"/>
+      <TextView
+        android:id="@+id/md_minMax"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignEnd="@android:id/input"
+        android:layout_alignRight="@android:id/input"
+        android:layout_below="@android:id/input"
+        android:fontFamily="sans-serif"
+        android:gravity="end"
+        android:minWidth="48dp"
+        android:paddingEnd="4dp"
+        android:paddingRight="4dp"
+        android:textAlignment="viewEnd"
+        android:textSize="12sp"
+        tools:ignore="RtlSymmetry,UnusedAttribute"
+        tools:text="50/100" />
 
-        </RelativeLayout>
+    </RelativeLayout>
 
-        <CheckBox
-            android:id="@+id/md_promptCheckbox"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginLeft="@dimen/md_notitle_vertical_padding_more"
-            android:layout_marginRight="@dimen/md_notitle_vertical_padding_more"
-            android:focusable="true"
-            tools:text="Don't ask again"/>
+    <CheckBox
+      android:id="@+id/md_promptCheckbox"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:layout_marginLeft="@dimen/md_notitle_vertical_padding_more"
+      android:layout_marginRight="@dimen/md_notitle_vertical_padding_more"
+      android:focusable="true"
+      tools:text="Don't ask again" />
 
-    </LinearLayout>
+  </LinearLayout>
 
-    <include layout="@layout/md_stub_actionbuttons"/>
+  <include layout="@layout/md_stub_actionbuttons" />
 
 </com.afollestad.materialdialogs.internal.MDRootLayout>

+ 47 - 48
core/src/main/res/layout/md_dialog_list.xml

@@ -1,55 +1,54 @@
-<com.afollestad.materialdialogs.internal.MDRootLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
+<com.afollestad.materialdialogs.internal.MDRootLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:tools="http://schemas.android.com/tools"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:orientation="vertical">
+
+  <include layout="@layout/md_stub_titleframe_lesspadding" />
+
+  <LinearLayout
     android:layout_width="match_parent"
-    android:layout_height="wrap_content"
+    android:layout_height="match_parent"
     android:orientation="vertical">
 
-    <include layout="@layout/md_stub_titleframe_lesspadding"/>
+    <ScrollView
+      android:id="@+id/md_contentScrollView"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:clipToPadding="false">
 
-    <LinearLayout
+      <TextView
+        android:id="@+id/md_content"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:paddingBottom="@dimen/md_content_padding_bottom"
+        android:paddingLeft="@dimen/md_dialog_frame_margin"
+        android:paddingRight="@dimen/md_dialog_frame_margin"
+        android:paddingTop="@dimen/md_content_padding_top"
+        android:textSize="@dimen/md_content_textsize"
+        tools:text="Content" />
+
+    </ScrollView>
+
+    <FrameLayout
+      android:id="@+id/md_contentListViewFrame"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content">
+
+      <android.support.v7.widget.RecyclerView
+        android:id="@+id/md_contentRecyclerView"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:orientation="vertical">
-
-        <ScrollView
-            android:id="@+id/md_contentScrollView"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:clipToPadding="false">
-
-            <TextView
-                android:id="@+id/md_content"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:paddingBottom="@dimen/md_content_padding_bottom"
-                android:paddingLeft="@dimen/md_dialog_frame_margin"
-                android:paddingRight="@dimen/md_dialog_frame_margin"
-                android:paddingTop="@dimen/md_content_padding_top"
-                android:textSize="@dimen/md_content_textsize"
-                tools:text="Content"/>
-
-        </ScrollView>
-
-        <FrameLayout
-            android:id="@+id/md_contentListViewFrame"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content">
-
-            <android.support.v7.widget.RecyclerView
-                android:id="@+id/md_contentRecyclerView"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:clipToPadding="false"
-                android:paddingBottom="@dimen/md_content_padding_bottom"
-                android:paddingTop="@dimen/md_content_padding_top"
-                android:scrollbarStyle="outsideOverlay"
-                android:scrollbars="vertical"/>
-
-        </FrameLayout>
-
-    </LinearLayout>
-
-    <include layout="@layout/md_stub_actionbuttons"/>
+        android:layout_height="wrap_content"
+        android:clipToPadding="false"
+        android:paddingBottom="@dimen/md_content_padding_bottom"
+        android:paddingTop="@dimen/md_content_padding_top"
+        android:scrollbarStyle="outsideOverlay"
+        android:scrollbars="vertical" />
+
+    </FrameLayout>
+
+  </LinearLayout>
+
+  <include layout="@layout/md_stub_actionbuttons" />
 
 </com.afollestad.materialdialogs.internal.MDRootLayout>

+ 56 - 57
core/src/main/res/layout/md_dialog_list_check.xml

@@ -1,64 +1,63 @@
-<com.afollestad.materialdialogs.internal.MDRootLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
+<com.afollestad.materialdialogs.internal.MDRootLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:tools="http://schemas.android.com/tools"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:orientation="vertical">
+
+  <include layout="@layout/md_stub_titleframe_lesspadding" />
+
+  <LinearLayout
     android:layout_width="match_parent"
-    android:layout_height="wrap_content"
+    android:layout_height="match_parent"
     android:orientation="vertical">
 
-    <include layout="@layout/md_stub_titleframe_lesspadding"/>
+    <ScrollView
+      android:id="@+id/md_contentScrollView"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:clipToPadding="false">
 
-    <LinearLayout
+      <TextView
+        android:id="@+id/md_content"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:orientation="vertical">
-
-        <ScrollView
-            android:id="@+id/md_contentScrollView"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:clipToPadding="false">
-
-            <TextView
-                android:id="@+id/md_content"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:paddingBottom="@dimen/md_content_padding_bottom"
-                android:paddingLeft="@dimen/md_dialog_frame_margin"
-                android:paddingRight="@dimen/md_dialog_frame_margin"
-                android:paddingTop="@dimen/md_content_padding_top"
-                android:textSize="@dimen/md_content_textsize"
-                tools:text="Content"/>
-
-        </ScrollView>
-
-        <FrameLayout
-            android:id="@+id/md_contentListViewFrame"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content">
-
-            <android.support.v7.widget.RecyclerView
-                android:id="@+id/md_contentRecyclerView"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:clipToPadding="false"
-                android:paddingBottom="@dimen/md_content_padding_bottom"
-                android:paddingTop="@dimen/md_content_padding_top"
-                android:scrollbarStyle="outsideOverlay"
-                android:scrollbars="vertical"/>
-
-        </FrameLayout>
-
-        <CheckBox
-            android:id="@+id/md_promptCheckbox"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginLeft="@dimen/md_notitle_vertical_padding"
-            android:layout_marginRight="@dimen/md_notitle_vertical_padding"
-            android:focusable="true"
-            tools:text="Don't ask again"/>
-
-    </LinearLayout>
-
-    <include layout="@layout/md_stub_actionbuttons"/>
+        android:layout_height="wrap_content"
+        android:paddingBottom="@dimen/md_content_padding_bottom"
+        android:paddingLeft="@dimen/md_dialog_frame_margin"
+        android:paddingRight="@dimen/md_dialog_frame_margin"
+        android:paddingTop="@dimen/md_content_padding_top"
+        android:textSize="@dimen/md_content_textsize"
+        tools:text="Content" />
+
+    </ScrollView>
+
+    <FrameLayout
+      android:id="@+id/md_contentListViewFrame"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content">
+
+      <android.support.v7.widget.RecyclerView
+        android:id="@+id/md_contentRecyclerView"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:clipToPadding="false"
+        android:paddingBottom="@dimen/md_content_padding_bottom"
+        android:paddingTop="@dimen/md_content_padding_top"
+        android:scrollbarStyle="outsideOverlay"
+        android:scrollbars="vertical" />
+
+    </FrameLayout>
+
+    <CheckBox
+      android:id="@+id/md_promptCheckbox"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:layout_marginLeft="@dimen/md_notitle_vertical_padding"
+      android:layout_marginRight="@dimen/md_notitle_vertical_padding"
+      android:focusable="true"
+      tools:text="Don't ask again" />
+
+  </LinearLayout>
+
+  <include layout="@layout/md_stub_actionbuttons" />
 
 </com.afollestad.materialdialogs.internal.MDRootLayout>

+ 18 - 19
core/src/main/res/layout/md_dialog_progress.xml

@@ -1,27 +1,26 @@
-<com.afollestad.materialdialogs.internal.MDRootLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
+<com.afollestad.materialdialogs.internal.MDRootLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:app="http://schemas.android.com/apk/res-auto"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:orientation="vertical"
+  app:md_reduce_padding_no_title_no_buttons="false">
+
+  <include layout="@layout/md_stub_titleframe" />
+
+  <LinearLayout
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    android:layout_weight="1"
     android:orientation="vertical"
-    app:md_reduce_padding_no_title_no_buttons="false">
-
-    <include layout="@layout/md_stub_titleframe"/>
-
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1"
-        android:orientation="vertical"
-        android:paddingBottom="@dimen/md_content_padding_bottom"
-        android:paddingLeft="@dimen/md_dialog_frame_margin"
-        android:paddingRight="@dimen/md_dialog_frame_margin"
-        android:paddingTop="@dimen/md_content_padding_top">
+    android:paddingBottom="@dimen/md_content_padding_bottom"
+    android:paddingLeft="@dimen/md_dialog_frame_margin"
+    android:paddingRight="@dimen/md_dialog_frame_margin"
+    android:paddingTop="@dimen/md_content_padding_top">
 
-        <include layout="@layout/md_stub_progress"/>
+    <include layout="@layout/md_stub_progress" />
 
-    </LinearLayout>
+  </LinearLayout>
 
-    <include layout="@layout/md_stub_actionbuttons"/>
+  <include layout="@layout/md_stub_actionbuttons" />
 
 </com.afollestad.materialdialogs.internal.MDRootLayout>

+ 9 - 10
core/src/main/res/layout/md_dialog_progress_indeterminate.xml

@@ -1,15 +1,14 @@
-<com.afollestad.materialdialogs.internal.MDRootLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:orientation="vertical"
-    app:md_reduce_padding_no_title_no_buttons="false">
+<com.afollestad.materialdialogs.internal.MDRootLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:app="http://schemas.android.com/apk/res-auto"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:orientation="vertical"
+  app:md_reduce_padding_no_title_no_buttons="false">
 
-    <include layout="@layout/md_stub_titleframe"/>
+  <include layout="@layout/md_stub_titleframe" />
 
-    <include layout="@layout/md_stub_progress_indeterminate"/>
+  <include layout="@layout/md_stub_progress_indeterminate" />
 
-    <include layout="@layout/md_stub_actionbuttons"/>
+  <include layout="@layout/md_stub_actionbuttons" />
 
 </com.afollestad.materialdialogs.internal.MDRootLayout>

+ 18 - 19
core/src/main/res/layout/md_dialog_progress_indeterminate_horizontal.xml

@@ -1,27 +1,26 @@
-<com.afollestad.materialdialogs.internal.MDRootLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
+<com.afollestad.materialdialogs.internal.MDRootLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:app="http://schemas.android.com/apk/res-auto"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:orientation="vertical"
+  app:md_reduce_padding_no_title_no_buttons="false">
+
+  <include layout="@layout/md_stub_titleframe" />
+
+  <LinearLayout
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    android:layout_weight="1"
     android:orientation="vertical"
-    app:md_reduce_padding_no_title_no_buttons="false">
-
-    <include layout="@layout/md_stub_titleframe"/>
-
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1"
-        android:orientation="vertical"
-        android:paddingBottom="@dimen/md_content_padding_bottom"
-        android:paddingLeft="@dimen/md_dialog_frame_margin"
-        android:paddingRight="@dimen/md_dialog_frame_margin"
-        android:paddingTop="@dimen/md_content_padding_top">
+    android:paddingBottom="@dimen/md_content_padding_bottom"
+    android:paddingLeft="@dimen/md_dialog_frame_margin"
+    android:paddingRight="@dimen/md_dialog_frame_margin"
+    android:paddingTop="@dimen/md_content_padding_top">
 
-        <include layout="@layout/md_stub_progress_indeterminate_horizontal"/>
+    <include layout="@layout/md_stub_progress_indeterminate_horizontal" />
 
-    </LinearLayout>
+  </LinearLayout>
 
-    <include layout="@layout/md_stub_actionbuttons"/>
+  <include layout="@layout/md_stub_actionbuttons" />
 
 </com.afollestad.materialdialogs.internal.MDRootLayout>

+ 23 - 24
core/src/main/res/layout/md_listitem.xml

@@ -1,27 +1,26 @@
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:background="?selectableItemBackground"
-    android:focusable="true"
-    android:gravity="center_vertical|start"
-    android:minHeight="@dimen/md_listitem_height"
-    android:orientation="horizontal">
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:tools="http://schemas.android.com/tools"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:background="?selectableItemBackground"
+  android:focusable="true"
+  android:gravity="center_vertical|start"
+  android:minHeight="@dimen/md_listitem_height"
+  android:orientation="horizontal">
 
-    <TextView
-        android:id="@+id/md_title"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:layout_gravity="start"
-        android:layout_marginEnd="@dimen/md_dialog_frame_margin"
-        android:layout_marginLeft="@dimen/md_listitem_margin_left"
-        android:layout_marginRight="@dimen/md_dialog_frame_margin"
-        android:layout_marginStart="@dimen/md_listitem_margin_left"
-        android:gravity="center_vertical"
-        android:paddingBottom="@dimen/md_listitem_vertical_margin"
-        android:paddingTop="@dimen/md_listitem_vertical_margin"
-        android:textSize="@dimen/md_listitem_textsize"
-        tools:text="Item"/>
+  <TextView
+    android:id="@+id/md_title"
+    android:layout_width="wrap_content"
+    android:layout_height="match_parent"
+    android:layout_gravity="start"
+    android:layout_marginEnd="@dimen/md_dialog_frame_margin"
+    android:layout_marginLeft="@dimen/md_listitem_margin_left"
+    android:layout_marginRight="@dimen/md_dialog_frame_margin"
+    android:layout_marginStart="@dimen/md_listitem_margin_left"
+    android:gravity="center_vertical"
+    android:paddingBottom="@dimen/md_listitem_vertical_margin"
+    android:paddingTop="@dimen/md_listitem_vertical_margin"
+    android:textSize="@dimen/md_listitem_textsize"
+    tools:text="Item" />
 
 </LinearLayout>

+ 35 - 36
core/src/main/res/layout/md_listitem_multichoice.xml

@@ -1,40 +1,39 @@
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:background="?selectableItemBackground"
-    android:descendantFocusability="blocksDescendants"
-    android:focusable="true"
-    android:minHeight="@dimen/md_listitem_height"
-    android:orientation="horizontal"
-    android:paddingEnd="@dimen/md_dialog_frame_margin"
-    android:paddingLeft="@dimen/md_dialog_frame_margin"
-    android:paddingRight="@dimen/md_dialog_frame_margin"
-    android:paddingStart="@dimen/md_dialog_frame_margin"
-    tools:gravity="start|center_vertical">
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:tools="http://schemas.android.com/tools"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:background="?selectableItemBackground"
+  android:descendantFocusability="blocksDescendants"
+  android:focusable="true"
+  android:minHeight="@dimen/md_listitem_height"
+  android:orientation="horizontal"
+  android:paddingEnd="@dimen/md_dialog_frame_margin"
+  android:paddingLeft="@dimen/md_dialog_frame_margin"
+  android:paddingRight="@dimen/md_dialog_frame_margin"
+  android:paddingStart="@dimen/md_dialog_frame_margin"
+  tools:gravity="start|center_vertical">
 
-    <android.support.v7.widget.AppCompatCheckBox
-        android:id="@+id/md_control"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:background="@null"
-        android:clickable="false"
-        android:focusable="false"
-        android:gravity="center_vertical"/>
+  <android.support.v7.widget.AppCompatCheckBox
+    android:id="@+id/md_control"
+    android:layout_width="wrap_content"
+    android:layout_height="match_parent"
+    android:background="@null"
+    android:clickable="false"
+    android:focusable="false"
+    android:gravity="center_vertical" />
 
-    <TextView
-        android:id="@+id/md_title"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:gravity="center_vertical"
-        android:minHeight="@dimen/md_listitem_height"
-        android:paddingBottom="@dimen/md_listitem_vertical_margin_choice"
-        android:paddingLeft="@dimen/md_listitem_control_margin"
-        android:paddingStart="@dimen/md_listitem_control_margin"
-        android:paddingTop="@dimen/md_listitem_vertical_margin_choice"
-        android:textSize="@dimen/md_listitem_textsize"
-        tools:ignore="NewApi,RtlSymmetry"
-        tools:text="Item"/>
+  <TextView
+    android:id="@+id/md_title"
+    android:layout_width="wrap_content"
+    android:layout_height="match_parent"
+    android:gravity="center_vertical"
+    android:minHeight="@dimen/md_listitem_height"
+    android:paddingBottom="@dimen/md_listitem_vertical_margin_choice"
+    android:paddingLeft="@dimen/md_listitem_control_margin"
+    android:paddingStart="@dimen/md_listitem_control_margin"
+    android:paddingTop="@dimen/md_listitem_vertical_margin_choice"
+    android:textSize="@dimen/md_listitem_textsize"
+    tools:ignore="NewApi,RtlSymmetry"
+    tools:text="Item" />
 
 </LinearLayout>

+ 35 - 36
core/src/main/res/layout/md_listitem_singlechoice.xml

@@ -1,40 +1,39 @@
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:background="?selectableItemBackground"
-    android:descendantFocusability="blocksDescendants"
-    android:focusable="true"
-    android:minHeight="@dimen/md_listitem_height"
-    android:orientation="horizontal"
-    android:paddingEnd="@dimen/md_dialog_frame_margin"
-    android:paddingLeft="@dimen/md_dialog_frame_margin"
-    android:paddingRight="@dimen/md_dialog_frame_margin"
-    android:paddingStart="@dimen/md_dialog_frame_margin"
-    tools:gravity="start|center_vertical">
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:tools="http://schemas.android.com/tools"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:background="?selectableItemBackground"
+  android:descendantFocusability="blocksDescendants"
+  android:focusable="true"
+  android:minHeight="@dimen/md_listitem_height"
+  android:orientation="horizontal"
+  android:paddingEnd="@dimen/md_dialog_frame_margin"
+  android:paddingLeft="@dimen/md_dialog_frame_margin"
+  android:paddingRight="@dimen/md_dialog_frame_margin"
+  android:paddingStart="@dimen/md_dialog_frame_margin"
+  tools:gravity="start|center_vertical">
 
-    <android.support.v7.widget.AppCompatRadioButton
-        android:id="@+id/md_control"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:background="@null"
-        android:clickable="false"
-        android:focusable="false"
-        android:gravity="center_vertical"/>
+  <android.support.v7.widget.AppCompatRadioButton
+    android:id="@+id/md_control"
+    android:layout_width="wrap_content"
+    android:layout_height="match_parent"
+    android:background="@null"
+    android:clickable="false"
+    android:focusable="false"
+    android:gravity="center_vertical" />
 
-    <TextView
-        android:id="@+id/md_title"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:gravity="center_vertical"
-        android:minHeight="@dimen/md_listitem_height"
-        android:paddingBottom="@dimen/md_listitem_vertical_margin_choice"
-        android:paddingLeft="@dimen/md_listitem_control_margin"
-        android:paddingStart="@dimen/md_listitem_control_margin"
-        android:paddingTop="@dimen/md_listitem_vertical_margin_choice"
-        android:textSize="@dimen/md_listitem_textsize"
-        tools:ignore="NewApi,RtlSymmetry"
-        tools:text="Item"/>
+  <TextView
+    android:id="@+id/md_title"
+    android:layout_width="wrap_content"
+    android:layout_height="match_parent"
+    android:gravity="center_vertical"
+    android:minHeight="@dimen/md_listitem_height"
+    android:paddingBottom="@dimen/md_listitem_vertical_margin_choice"
+    android:paddingLeft="@dimen/md_listitem_control_margin"
+    android:paddingStart="@dimen/md_listitem_control_margin"
+    android:paddingTop="@dimen/md_listitem_vertical_margin_choice"
+    android:textSize="@dimen/md_listitem_textsize"
+    tools:ignore="NewApi,RtlSymmetry"
+    tools:text="Item" />
 
 </LinearLayout>

+ 17 - 17
core/src/main/res/layout/md_stub_actionbuttons.xml

@@ -1,23 +1,23 @@
 <merge xmlns:android="http://schemas.android.com/apk/res/android"
-       xmlns:tools="http://schemas.android.com/tools">
+  xmlns:tools="http://schemas.android.com/tools">
 
-    <com.afollestad.materialdialogs.internal.MDButton
-        android:id="@+id/md_buttonDefaultNeutral"
-        style="@style/MD_ActionButton.Text"
-        tools:text="Neutral"/>
+  <com.afollestad.materialdialogs.internal.MDButton
+    android:id="@+id/md_buttonDefaultNeutral"
+    style="@style/MD_ActionButton.Text"
+    tools:text="Neutral" />
 
-    <com.afollestad.materialdialogs.internal.MDButton
-        android:id="@+id/md_buttonDefaultNegative"
-        style="@style/MD_ActionButton.Text"
-        tools:layout_alignParentLeft="true"
-        tools:layout_alignParentStart="true"
-        tools:text="Negative"/>
+  <com.afollestad.materialdialogs.internal.MDButton
+    android:id="@+id/md_buttonDefaultNegative"
+    style="@style/MD_ActionButton.Text"
+    tools:layout_alignParentLeft="true"
+    tools:layout_alignParentStart="true"
+    tools:text="Negative" />
 
-    <com.afollestad.materialdialogs.internal.MDButton
-        android:id="@+id/md_buttonDefaultPositive"
-        style="@style/MD_ActionButton.Text"
-        tools:layout_alignParentLeft="true"
-        tools:layout_alignParentStart="true"
-        tools:text="Positive"/>
+  <com.afollestad.materialdialogs.internal.MDButton
+    android:id="@+id/md_buttonDefaultPositive"
+    style="@style/MD_ActionButton.Text"
+    tools:layout_alignParentLeft="true"
+    tools:layout_alignParentStart="true"
+    tools:text="Positive" />
 
 </merge>

+ 48 - 49
core/src/main/res/layout/md_stub_progress.xml

@@ -1,58 +1,57 @@
 <?xml version="1.0" encoding="utf-8"?>
-<merge
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    tools:ignore="UnusedAttribute">
+<merge xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:tools="http://schemas.android.com/tools"
+  tools:ignore="UnusedAttribute">
 
-    <TextView
-        android:id="@+id/md_content"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center_horizontal"
-        android:layout_marginBottom="20dp"
-        android:layout_marginTop="4dp"
-        android:fontFamily="sans-serif"
-        android:textSize="@dimen/md_content_textsize"
-        tools:text="Message"/>
+  <TextView
+    android:id="@+id/md_content"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center_horizontal"
+    android:layout_marginBottom="20dp"
+    android:layout_marginTop="4dp"
+    android:fontFamily="sans-serif"
+    android:textSize="@dimen/md_content_textsize"
+    tools:text="Message" />
 
-    <RelativeLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content">
+  <RelativeLayout
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content">
 
-        <ProgressBar
-            android:id="@android:id/progress"
-            style="?android:progressBarStyleHorizontal"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:paddingBottom="2dp"/>
+    <ProgressBar
+      android:id="@android:id/progress"
+      style="?android:progressBarStyleHorizontal"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:paddingBottom="2dp" />
 
-        <TextView
-            android:id="@+id/md_label"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignLeft="@android:id/progress"
-            android:layout_alignStart="@android:id/progress"
-            android:layout_below="@android:id/progress"
-            android:gravity="start"
-            android:minWidth="36dp"
-            android:textAlignment="viewStart"
-            android:textSize="@dimen/md_content_textsize"
-            android:textStyle="bold"
-            tools:text="100%"/>
+    <TextView
+      android:id="@+id/md_label"
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:layout_alignLeft="@android:id/progress"
+      android:layout_alignStart="@android:id/progress"
+      android:layout_below="@android:id/progress"
+      android:gravity="start"
+      android:minWidth="36dp"
+      android:textAlignment="viewStart"
+      android:textSize="@dimen/md_content_textsize"
+      android:textStyle="bold"
+      tools:text="100%" />
 
-        <TextView
-            android:id="@+id/md_minMax"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignEnd="@android:id/progress"
-            android:layout_alignRight="@android:id/progress"
-            android:layout_below="@android:id/progress"
-            android:gravity="end"
-            android:minWidth="48dp"
-            android:textAlignment="viewEnd"
-            android:textSize="@dimen/md_content_textsize"
-            tools:text="100%"/>
+    <TextView
+      android:id="@+id/md_minMax"
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:layout_alignEnd="@android:id/progress"
+      android:layout_alignRight="@android:id/progress"
+      android:layout_below="@android:id/progress"
+      android:gravity="end"
+      android:minWidth="48dp"
+      android:textAlignment="viewEnd"
+      android:textSize="@dimen/md_content_textsize"
+      tools:text="100%" />
 
-    </RelativeLayout>
+  </RelativeLayout>
 
 </merge>

+ 27 - 28
core/src/main/res/layout/md_stub_progress_indeterminate.xml

@@ -1,33 +1,32 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:gravity="end|center_vertical"
-    android:orientation="horizontal"
-    android:paddingBottom="@dimen/md_content_padding_top"
-    android:paddingLeft="@dimen/md_dialog_frame_margin"
-    android:paddingRight="@dimen/md_dialog_frame_margin"
-    android:paddingTop="@dimen/md_content_padding_top">
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:tools="http://schemas.android.com/tools"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:gravity="start|center_vertical"
+  android:orientation="horizontal"
+  android:paddingBottom="@dimen/md_content_padding_top"
+  android:paddingLeft="@dimen/md_dialog_frame_margin"
+  android:paddingRight="@dimen/md_dialog_frame_margin"
+  android:paddingTop="@dimen/md_content_padding_top">
 
-    <ProgressBar
-        android:id="@android:id/progress"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:indeterminate="true"/>
+  <ProgressBar
+    android:id="@android:id/progress"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:indeterminate="true" />
 
-    <TextView
-        android:id="@+id/md_content"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:fontFamily="sans-serif"
-        android:gravity="start"
-        android:paddingLeft="16dp"
-        android:paddingStart="16dp"
-        android:textAlignment="viewStart"
-        android:textSize="@dimen/md_content_textsize"
-        tools:ignore="NewApi,RtlSymmetry,UnusedAttribute"
-        tools:text="Message"/>
+  <TextView
+    android:id="@+id/md_content"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:fontFamily="sans-serif"
+    android:gravity="start"
+    android:paddingLeft="16dp"
+    android:paddingStart="16dp"
+    android:textAlignment="viewStart"
+    android:textSize="@dimen/md_content_textsize"
+    tools:ignore="NewApi,RtlSymmetry,UnusedAttribute"
+    tools:text="Message" />
 
 </LinearLayout>

+ 19 - 20
core/src/main/res/layout/md_stub_progress_indeterminate_horizontal.xml

@@ -1,25 +1,24 @@
 <?xml version="1.0" encoding="utf-8"?>
-<merge
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    tools:ignore="UnusedAttribute">
+<merge xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:tools="http://schemas.android.com/tools"
+  tools:ignore="UnusedAttribute">
 
-    <TextView
-        android:id="@+id/md_content"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center_horizontal"
-        android:layout_marginBottom="20dp"
-        android:layout_marginTop="4dp"
-        android:fontFamily="sans-serif"
-        android:textSize="@dimen/md_content_textsize"
-        tools:text="Message"/>
+  <TextView
+    android:id="@+id/md_content"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center_horizontal"
+    android:layout_marginBottom="20dp"
+    android:layout_marginTop="4dp"
+    android:fontFamily="sans-serif"
+    android:textSize="@dimen/md_content_textsize"
+    tools:text="Message" />
 
-    <ProgressBar
-        android:id="@android:id/progress"
-        style="?android:progressBarStyleHorizontal"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:paddingBottom="2dp"/>
+  <ProgressBar
+    android:id="@android:id/progress"
+    style="?android:progressBarStyleHorizontal"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:paddingBottom="2dp" />
 
 </merge>

+ 25 - 26
core/src/main/res/layout/md_stub_titleframe.xml

@@ -1,30 +1,29 @@
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:id="@+id/md_titleFrame"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:gravity="center_vertical"
-    android:orientation="horizontal"
-    android:paddingBottom="@dimen/md_title_frame_margin_bottom"
-    android:paddingLeft="@dimen/md_dialog_frame_margin"
-    android:paddingRight="@dimen/md_dialog_frame_margin"
-    android:paddingTop="@dimen/md_dialog_frame_margin">
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:tools="http://schemas.android.com/tools"
+  android:id="@+id/md_titleFrame"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:gravity="center_vertical"
+  android:orientation="horizontal"
+  android:paddingBottom="@dimen/md_title_frame_margin_bottom"
+  android:paddingLeft="@dimen/md_dialog_frame_margin"
+  android:paddingRight="@dimen/md_dialog_frame_margin"
+  android:paddingTop="@dimen/md_dialog_frame_margin">
 
-    <ImageView
-        android:id="@+id/md_icon"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginEnd="@dimen/md_icon_margin"
-        android:layout_marginRight="@dimen/md_icon_margin"
-        android:scaleType="fitXY"
-        tools:ignore="ContentDescription"/>
+  <ImageView
+    android:id="@+id/md_icon"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_marginEnd="@dimen/md_icon_margin"
+    android:layout_marginRight="@dimen/md_icon_margin"
+    android:scaleType="fitXY"
+    tools:ignore="ContentDescription" />
 
-    <TextView
-        android:id="@+id/md_title"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:textSize="@dimen/md_title_textsize"
-        tools:text="Title"/>
+  <TextView
+    android:id="@+id/md_title"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:textSize="@dimen/md_title_textsize"
+    tools:text="Title" />
 
 </LinearLayout>

+ 25 - 26
core/src/main/res/layout/md_stub_titleframe_lesspadding.xml

@@ -1,30 +1,29 @@
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:id="@+id/md_titleFrame"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:gravity="center_vertical"
-    android:orientation="horizontal"
-    android:paddingBottom="@dimen/md_title_frame_margin_bottom_less"
-    android:paddingLeft="@dimen/md_dialog_frame_margin"
-    android:paddingRight="@dimen/md_dialog_frame_margin"
-    android:paddingTop="@dimen/md_dialog_frame_margin">
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:tools="http://schemas.android.com/tools"
+  android:id="@+id/md_titleFrame"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content"
+  android:gravity="center_vertical"
+  android:orientation="horizontal"
+  android:paddingBottom="@dimen/md_title_frame_margin_bottom_less"
+  android:paddingLeft="@dimen/md_dialog_frame_margin"
+  android:paddingRight="@dimen/md_dialog_frame_margin"
+  android:paddingTop="@dimen/md_dialog_frame_margin">
 
-    <ImageView
-        android:id="@+id/md_icon"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginEnd="@dimen/md_icon_margin"
-        android:layout_marginRight="@dimen/md_icon_margin"
-        android:scaleType="fitXY"
-        tools:ignore="ContentDescription"/>
+  <ImageView
+    android:id="@+id/md_icon"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_marginEnd="@dimen/md_icon_margin"
+    android:layout_marginRight="@dimen/md_icon_margin"
+    android:scaleType="fitXY"
+    tools:ignore="ContentDescription" />
 
-    <TextView
-        android:id="@+id/md_title"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:textSize="@dimen/md_title_textsize"
-        tools:text="Title"/>
+  <TextView
+    android:id="@+id/md_title"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:textSize="@dimen/md_title_textsize"
+    tools:text="Title" />
 
 </LinearLayout>

+ 1 - 1
core/src/main/res/values-sw600dp/bool.xml

@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <bool name="md_is_tablet">true</bool>
+  <bool name="md_is_tablet">true</bool>
 </resources>

+ 1 - 1
core/src/main/res/values-sw600dp/dimens.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
-    <dimen name="md_dialog_max_width">446dp</dimen>
+  <dimen name="md_dialog_max_width">446dp</dimen>
 
 </resources>

+ 1 - 1
core/src/main/res/values-sw720dp-land/dimens.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
-    <dimen name="md_dialog_max_width">564dp</dimen>
+  <dimen name="md_dialog_max_width">564dp</dimen>
 
 </resources>

+ 1 - 1
core/src/main/res/values-sw720dp/bool.xml

@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <bool name="md_is_tablet">true</bool>
+  <bool name="md_is_tablet">true</bool>
 </resources>

+ 1 - 1
core/src/main/res/values-sw720dp/dimens.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
-    <dimen name="md_dialog_max_width">496dp</dimen>
+  <dimen name="md_dialog_max_width">496dp</dimen>
 
 </resources>

+ 35 - 35
core/src/main/res/values-v11/styles.xml

@@ -1,40 +1,40 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
-    <style name="MD_Light" parent="Theme.AppCompat.Light.Dialog.Alert">
-        <item name="android:windowMinWidthMajor">@dimen/abc_dialog_min_width_major</item>
-        <item name="android:windowMinWidthMinor">@dimen/abc_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>
-        <item name="md_btn_positive_selector">@drawable/md_btn_selector</item>
-        <item name="md_btn_neutral_selector">@drawable/md_btn_selector</item>
-        <item name="md_btn_negative_selector">@drawable/md_btn_selector</item>
-
-        <item name="android:actionModeBackground">@color/primary_material_dark</item>
-        <item name="android:actionModeCloseDrawable">@drawable/md_nav_back</item>
-
-        <item name="android:windowAnimationStyle">@style/MD_WindowAnimation</item>
-        <item name="android:backgroundDimEnabled">true</item>
-    </style>
-
-    <style name="MD_Dark" parent="Theme.AppCompat.Dialog.Alert">
-        <item name="android:windowMinWidthMajor">@dimen/abc_dialog_min_width_major</item>
-        <item name="android:windowMinWidthMinor">@dimen/abc_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>
-        <item name="md_btn_positive_selector">@drawable/md_btn_selector_dark</item>
-        <item name="md_btn_neutral_selector">@drawable/md_btn_selector_dark</item>
-        <item name="md_btn_negative_selector">@drawable/md_btn_selector_dark</item>
-
-        <item name="android:actionModeBackground">@color/primary_material_dark</item>
-        <item name="android:actionModeCloseDrawable">@drawable/md_nav_back</item>
-
-        <item name="android:windowAnimationStyle">@style/MD_WindowAnimation</item>
-        <item name="android:backgroundDimEnabled">true</item>
-    </style>
+  <style name="MD_Light" parent="Theme.AppCompat.Light.Dialog.Alert">
+    <item name="android:windowMinWidthMajor">@dimen/abc_dialog_min_width_major</item>
+    <item name="android:windowMinWidthMinor">@dimen/abc_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>
+    <item name="md_btn_positive_selector">@drawable/md_btn_selector</item>
+    <item name="md_btn_neutral_selector">@drawable/md_btn_selector</item>
+    <item name="md_btn_negative_selector">@drawable/md_btn_selector</item>
+
+    <item name="android:actionModeBackground">@color/primary_material_dark</item>
+    <item name="android:actionModeCloseDrawable">@drawable/md_nav_back</item>
+
+    <item name="android:windowAnimationStyle">@style/MD_WindowAnimation</item>
+    <item name="android:backgroundDimEnabled">true</item>
+  </style>
+
+  <style name="MD_Dark" parent="Theme.AppCompat.Dialog.Alert">
+    <item name="android:windowMinWidthMajor">@dimen/abc_dialog_min_width_major</item>
+    <item name="android:windowMinWidthMinor">@dimen/abc_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>
+    <item name="md_btn_positive_selector">@drawable/md_btn_selector_dark</item>
+    <item name="md_btn_neutral_selector">@drawable/md_btn_selector_dark</item>
+    <item name="md_btn_negative_selector">@drawable/md_btn_selector_dark</item>
+
+    <item name="android:actionModeBackground">@color/primary_material_dark</item>
+    <item name="android:actionModeCloseDrawable">@drawable/md_nav_back</item>
+
+    <item name="android:windowAnimationStyle">@style/MD_WindowAnimation</item>
+    <item name="android:backgroundDimEnabled">true</item>
+  </style>
 
 </resources>

+ 50 - 50
core/src/main/res/values-v14/styles.xml

@@ -7,62 +7,62 @@
 
 <resources>
 
-    <style name="Widget.MaterialProgressBar.ProgressBar.Horizontal" parent="android:Widget.ProgressBar.Horizontal">
-        <!--
-        Disabled for correct behavior on Android 4.x
-        <item name="android:progressDrawable">@null</item>
-        -->
-        <item name="android:indeterminateDrawable">@null</item>
-        <item name="android:minHeight">16dp</item>
-        <item name="android:maxHeight">16dp</item>
-    </style>
+  <style name="Widget.MaterialProgressBar.ProgressBar.Horizontal" parent="android:Widget.ProgressBar.Horizontal">
+    <!--
+    Disabled for correct behavior on Android 4.x
+    <item name="android:progressDrawable">@null</item>
+    -->
+    <item name="android:indeterminateDrawable">@null</item>
+    <item name="android:minHeight">16dp</item>
+    <item name="android:maxHeight">16dp</item>
+  </style>
 
-    <!--<style name="Widget.MaterialProgressBar.ProgressBar.Horizontal.NoPadding">-->
-        <!--<item name="android:minHeight">3.2dp</item>-->
-        <!--<item name="android:maxHeight">3.2dp</item>-->
-    <!--</style>-->
+  <!--<style name="Widget.MaterialProgressBar.ProgressBar.Horizontal.NoPadding">-->
+  <!--<item name="android:minHeight">3.2dp</item>-->
+  <!--<item name="android:maxHeight">3.2dp</item>-->
+  <!--</style>-->
 
-    <style name="Widget.MaterialProgressBar.ProgressBar" parent="android:Widget.ProgressBar">
-        <item name="android:indeterminateDrawable">@null</item>
-        <item name="android:minWidth">48dp</item>
-        <item name="android:maxWidth">48dp</item>
-        <item name="android:minHeight">48dp</item>
-        <item name="android:maxHeight">48dp</item>
-    </style>
+  <style name="Widget.MaterialProgressBar.ProgressBar" parent="android:Widget.ProgressBar">
+    <item name="android:indeterminateDrawable">@null</item>
+    <item name="android:minWidth">48dp</item>
+    <item name="android:maxWidth">48dp</item>
+    <item name="android:minHeight">48dp</item>
+    <item name="android:maxHeight">48dp</item>
+  </style>
 
-    <!--<style name="Widget.MaterialProgressBar.ProgressBar.NoPadding">-->
-        <!--<item name="android:minWidth">42dp</item>-->
-        <!--<item name="android:maxWidth">42dp</item>-->
-        <!--<item name="android:minHeight">42dp</item>-->
-        <!--<item name="android:maxHeight">42dp</item>-->
-    <!--</style>-->
+  <!--<style name="Widget.MaterialProgressBar.ProgressBar.NoPadding">-->
+  <!--<item name="android:minWidth">42dp</item>-->
+  <!--<item name="android:maxWidth">42dp</item>-->
+  <!--<item name="android:minHeight">42dp</item>-->
+  <!--<item name="android:maxHeight">42dp</item>-->
+  <!--</style>-->
 
-    <!--<style name="Widget.MaterialProgressBar.ProgressBar.Large">-->
-        <!--<item name="android:minWidth">76dp</item>-->
-        <!--<item name="android:maxWidth">76dp</item>-->
-        <!--<item name="android:minHeight">76dp</item>-->
-        <!--<item name="android:maxHeight">76dp</item>-->
-    <!--</style>-->
+  <!--<style name="Widget.MaterialProgressBar.ProgressBar.Large">-->
+  <!--<item name="android:minWidth">76dp</item>-->
+  <!--<item name="android:maxWidth">76dp</item>-->
+  <!--<item name="android:minHeight">76dp</item>-->
+  <!--<item name="android:maxHeight">76dp</item>-->
+  <!--</style>-->
 
-    <!--<style name="Widget.MaterialProgressBar.ProgressBar.Large.NoPadding">-->
-        <!--<item name="android:minWidth">66.5dp</item>-->
-        <!--<item name="android:maxWidth">66.5dp</item>-->
-        <!--<item name="android:minHeight">66.5dp</item>-->
-        <!--<item name="android:maxHeight">66.5dp</item>-->
-    <!--</style>-->
+  <!--<style name="Widget.MaterialProgressBar.ProgressBar.Large.NoPadding">-->
+  <!--<item name="android:minWidth">66.5dp</item>-->
+  <!--<item name="android:maxWidth">66.5dp</item>-->
+  <!--<item name="android:minHeight">66.5dp</item>-->
+  <!--<item name="android:maxHeight">66.5dp</item>-->
+  <!--</style>-->
 
-    <!--<style name="Widget.MaterialProgressBar.ProgressBar.Small">-->
-        <!--<item name="android:minWidth">16dp</item>-->
-        <!--<item name="android:maxWidth">16dp</item>-->
-        <!--<item name="android:minHeight">16dp</item>-->
-        <!--<item name="android:maxHeight">16dp</item>-->
-    <!--</style>-->
+  <!--<style name="Widget.MaterialProgressBar.ProgressBar.Small">-->
+  <!--<item name="android:minWidth">16dp</item>-->
+  <!--<item name="android:maxWidth">16dp</item>-->
+  <!--<item name="android:minHeight">16dp</item>-->
+  <!--<item name="android:maxHeight">16dp</item>-->
+  <!--</style>-->
 
-    <!--<style name="Widget.MaterialProgressBar.ProgressBar.Small.NoPadding">-->
-        <!--<item name="android:minWidth">14dp</item>-->
-        <!--<item name="android:maxWidth">14dp</item>-->
-        <!--<item name="android:minHeight">14dp</item>-->
-        <!--<item name="android:maxHeight">14dp</item>-->
-    <!--</style>-->
+  <!--<style name="Widget.MaterialProgressBar.ProgressBar.Small.NoPadding">-->
+  <!--<item name="android:minWidth">14dp</item>-->
+  <!--<item name="android:maxWidth">14dp</item>-->
+  <!--<item name="android:minHeight">14dp</item>-->
+  <!--<item name="android:maxHeight">14dp</item>-->
+  <!--</style>-->
 
 </resources>

+ 20 - 20
core/src/main/res/values-v21/styles.xml

@@ -1,28 +1,28 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
-    <style name="MD_Light" parent="Theme.AppCompat.Light.Dialog.Alert">
-        <item name="android:windowMinWidthMajor">@dimen/abc_dialog_min_width_major</item>
-        <item name="android:windowMinWidthMinor">@dimen/abc_dialog_min_width_minor</item>
+  <style name="MD_Light" parent="Theme.AppCompat.Light.Dialog.Alert">
+    <item name="android:windowMinWidthMajor">@dimen/abc_dialog_min_width_major</item>
+    <item name="android:windowMinWidthMinor">@dimen/abc_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>
-        <item name="md_btn_positive_selector">@drawable/md_btn_selector_ripple</item>
-        <item name="md_btn_neutral_selector">@drawable/md_btn_selector_ripple</item>
-        <item name="md_btn_negative_selector">@drawable/md_btn_selector_ripple</item>
-    </style>
+    <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>
+    <item name="md_btn_positive_selector">@drawable/md_btn_selector_ripple</item>
+    <item name="md_btn_neutral_selector">@drawable/md_btn_selector_ripple</item>
+    <item name="md_btn_negative_selector">@drawable/md_btn_selector_ripple</item>
+  </style>
 
-    <style name="MD_Dark" parent="Theme.AppCompat.Dialog.Alert">
-        <item name="android:windowMinWidthMajor">@dimen/abc_dialog_min_width_major</item>
-        <item name="android:windowMinWidthMinor">@dimen/abc_dialog_min_width_minor</item>
+  <style name="MD_Dark" parent="Theme.AppCompat.Dialog.Alert">
+    <item name="android:windowMinWidthMajor">@dimen/abc_dialog_min_width_major</item>
+    <item name="android:windowMinWidthMinor">@dimen/abc_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>
-        <item name="md_btn_positive_selector">@drawable/md_btn_selector_ripple_dark</item>
-        <item name="md_btn_neutral_selector">@drawable/md_btn_selector_ripple_dark</item>
-        <item name="md_btn_negative_selector">@drawable/md_btn_selector_ripple_dark</item>
-    </style>
+    <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>
+    <item name="md_btn_positive_selector">@drawable/md_btn_selector_ripple_dark</item>
+    <item name="md_btn_neutral_selector">@drawable/md_btn_selector_ripple_dark</item>
+    <item name="md_btn_negative_selector">@drawable/md_btn_selector_ripple_dark</item>
+  </style>
 
 </resources>

+ 67 - 67
core/src/main/res/values/attrs.xml

@@ -1,72 +1,72 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
-    <!-- These top three attributes are not accessible to library users -->
-    <attr name="md_divider" format="color" />
-
-    <!-- Accessible global theming attributes -->
-    <attr name="md_dark_theme" format="boolean" />
-    <attr name="md_background_color" format="color" />
-
-    <attr name="md_icon" format="reference" />
-    <attr name="md_icon_max_size" format="dimension" />
-    <attr name="md_icon_limit_icon_to_default_size" format="boolean" />
-
-    <attr name="md_title_color" format="color" />
-    <attr name="md_content_color" format="color" />
-    <attr name="md_link_color" format="color" />
-
-    <attr name="md_positive_color" format="color" />
-    <attr name="md_neutral_color" format="color" />
-    <attr name="md_negative_color" format="color" />
-    <attr name="md_widget_color" format="color" />
-
-    <attr name="md_item_color" format="color" />
-    <attr name="md_divider_color" format="color" />
-    <attr name="md_list_selector" format="reference" />
-
-    <attr name="md_btn_stacked_selector" format="reference" />
-    <attr name="md_btn_positive_selector" format="reference" />
-    <attr name="md_btn_neutral_selector" format="reference" />
-    <attr name="md_btn_negative_selector" format="reference" />
-
-    <attr name="md_btn_ripple_color" format="color" />
-
-    <attr name="md_title_gravity" format="enum">
-        <enum name="start" value="0" />
-        <enum name="center" value="1" />
-        <enum name="end" value="2" />
-    </attr>
-
-    <attr name="md_content_gravity" format="enum">
-        <enum name="start" value="0" />
-        <enum name="center" value="1" />
-        <enum name="end" value="2" />
-    </attr>
-
-    <attr name="md_btnstacked_gravity" format="enum">
-        <enum name="start" value="0" />
-        <enum name="center" value="1" />
-        <enum name="end" value="2" />
-    </attr>
-
-    <attr name="md_items_gravity" format="enum">
-        <enum name="start" value="0" />
-        <enum name="center" value="1" />
-        <enum name="end" value="2" />
-    </attr>
-
-    <attr name="md_buttons_gravity" format="enum">
-        <enum name="start" value="0" />
-        <enum name="center" value="1" />
-        <enum name="end" value="2" />
-    </attr>
-
-    <declare-styleable name="MDRootLayout">
-        <attr name="md_reduce_padding_no_title_no_buttons" format="boolean" />
-    </declare-styleable>
-
-    <attr name="md_medium_font" format="string" />
-    <attr name="md_regular_font" format="string" />
+  <!-- These top three attributes are not accessible to library users -->
+  <attr name="md_divider" format="color" />
+
+  <!-- Accessible global theming attributes -->
+  <attr name="md_dark_theme" format="boolean" />
+  <attr name="md_background_color" format="color" />
+
+  <attr name="md_icon" format="reference" />
+  <attr name="md_icon_max_size" format="dimension" />
+  <attr name="md_icon_limit_icon_to_default_size" format="boolean" />
+
+  <attr name="md_title_color" format="color" />
+  <attr name="md_content_color" format="color" />
+  <attr name="md_link_color" format="color" />
+
+  <attr name="md_positive_color" format="color" />
+  <attr name="md_neutral_color" format="color" />
+  <attr name="md_negative_color" format="color" />
+  <attr name="md_widget_color" format="color" />
+
+  <attr name="md_item_color" format="color" />
+  <attr name="md_divider_color" format="color" />
+  <attr name="md_list_selector" format="reference" />
+
+  <attr name="md_btn_stacked_selector" format="reference" />
+  <attr name="md_btn_positive_selector" format="reference" />
+  <attr name="md_btn_neutral_selector" format="reference" />
+  <attr name="md_btn_negative_selector" format="reference" />
+
+  <attr name="md_btn_ripple_color" format="color" />
+
+  <attr name="md_title_gravity" format="enum">
+    <enum name="start" value="0" />
+    <enum name="center" value="1" />
+    <enum name="end" value="2" />
+  </attr>
+
+  <attr name="md_content_gravity" format="enum">
+    <enum name="start" value="0" />
+    <enum name="center" value="1" />
+    <enum name="end" value="2" />
+  </attr>
+
+  <attr name="md_btnstacked_gravity" format="enum">
+    <enum name="start" value="0" />
+    <enum name="center" value="1" />
+    <enum name="end" value="2" />
+  </attr>
+
+  <attr name="md_items_gravity" format="enum">
+    <enum name="start" value="0" />
+    <enum name="center" value="1" />
+    <enum name="end" value="2" />
+  </attr>
+
+  <attr name="md_buttons_gravity" format="enum">
+    <enum name="start" value="0" />
+    <enum name="center" value="1" />
+    <enum name="end" value="2" />
+  </attr>
+
+  <declare-styleable name="MDRootLayout">
+    <attr name="md_reduce_padding_no_title_no_buttons" format="boolean" />
+  </declare-styleable>
+
+  <attr name="md_medium_font" format="string" />
+  <attr name="md_regular_font" format="string" />
 
 </resources>

+ 1 - 1
core/src/main/res/values/bool.xml

@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <bool name="md_is_tablet">false</bool>
+  <bool name="md_is_tablet">false</bool>
 </resources>

+ 13 - 13
core/src/main/res/values/colors.xml

@@ -1,22 +1,22 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
-    <!--<color name="content_light">#5E5E5E</color>-->
-    <!--<color name="content_dark">#EDEDED</color>-->
-    <!--<color name="item_light">#535353</color>-->
-    <!--<color name="item_dark">#EDEDED</color>-->
-    <!--<color name="button_light">#3C3C3D</color>-->
-    <!--<color name="button_dark">#FFFFFF</color>-->
+  <!--<color name="content_light">#5E5E5E</color>-->
+  <!--<color name="content_dark">#EDEDED</color>-->
+  <!--<color name="item_light">#535353</color>-->
+  <!--<color name="item_dark">#EDEDED</color>-->
+  <!--<color name="button_light">#3C3C3D</color>-->
+  <!--<color name="button_dark">#FFFFFF</color>-->
 
-    <color name="md_btn_selected">#33969696</color>
-    <color name="md_btn_selected_dark">#40CBCBCB</color>
+  <color name="md_btn_selected">#33969696</color>
+  <color name="md_btn_selected_dark">#40CBCBCB</color>
 
-    <color name="md_divider_black">#10000000</color>
-    <color name="md_divider_white">#10FFFFFF</color>
+  <color name="md_divider_black">#10000000</color>
+  <color name="md_divider_white">#10FFFFFF</color>
 
-    <color name="md_material_blue_600">#2196F3</color>
-    <color name="md_material_blue_800">#1565C0</color>
+  <color name="md_material_blue_600">#2196F3</color>
+  <color name="md_material_blue_800">#1565C0</color>
 
-    <color name="md_edittext_error">#DD2C00</color>
+  <color name="md_edittext_error">#DD2C00</color>
 
 </resources>

+ 67 - 67
core/src/main/res/values/dimens.xml

@@ -1,83 +1,83 @@
 <resources>
-    <!-- See http://www.google.com/design/spec/components/dialogs.html#dialogs-specs -->
+  <!-- See http://www.google.com/design/spec/components/dialogs.html#dialogs-specs -->
 
-    <!-- Notes:
+  <!-- Notes:
 
-        The specs specify 16dp between the content and the buttons and imply 16dp between
-        the title and the content. Also 24dp above the title and 8dp below the buttons.
+      The specs specify 16dp between the content and the buttons and imply 16dp between
+      the title and the content. Also 24dp above the title and 8dp below the buttons.
 
-        Additionally, we interpret:
-         16dp between title and content
-         24dp above content if there is no title
-         24dp below content if there is no button bar
+      Additionally, we interpret:
+       16dp between title and content
+       24dp above content if there is no title
+       24dp below content if there is no button bar
 
-        When dialog is large enough to scroll, some padding is removed to make space and
-        keep things symmetrical.
-        Reduced paddings are:
-         8dp above content if there is no title (0dp when scrolled)
-         8dp below content if there is no button bar (0dp when scrolled)
-         8dp between content and button bar
-         0dp below button bar
+      When dialog is large enough to scroll, some padding is removed to make space and
+      keep things symmetrical.
+      Reduced paddings are:
+       8dp above content if there is no title (0dp when scrolled)
+       8dp below content if there is no button bar (0dp when scrolled)
+       8dp between content and button bar
+       0dp below button bar
 
-        For implementation:
-         Content view gets 8dp vertical padding
-         Title bar gets 24dp top, 8dp bottom
-         Buttons get 8dp bottom
-         Stacked buttons get 24dp end padding, the spec's 16 plus the spec's 8dp button padding
+      For implementation:
+       Content view gets 8dp vertical padding
+       Title bar gets 24dp top, 8dp bottom
+       Buttons get 8dp bottom
+       Stacked buttons get 24dp end padding, the spec's 16 plus the spec's 8dp button padding
 
-         MDRootLayout takes care of margins when no title or not button bar,
-         and the margin between buttons and content when not scrolling.
-    -->
+       MDRootLayout takes care of margins when no title or not button bar,
+       and the margin between buttons and content when not scrolling.
+  -->
 
-    <!-- Margin around the dialog, excluding the button bar -->
-    <dimen name="md_dialog_frame_margin">24dp</dimen>
-    <!-- Total title margin bottom is 16, but we split this between content and title -->
-    <dimen name="md_title_frame_margin_bottom">12dp</dimen>
-    <dimen name="md_title_frame_margin_bottom_less">6dp</dimen>
-    <!-- The desired padding when no title is visible,
-         This plus md_content_padding_top should equals md_dialog_frame_margin -->
-    <dimen name="md_notitle_vertical_padding">16dp</dimen>
+  <!-- Margin around the dialog, excluding the button bar -->
+  <dimen name="md_dialog_frame_margin">24dp</dimen>
+  <!-- Total title margin bottom is 16, but we split this between content and title -->
+  <dimen name="md_title_frame_margin_bottom">12dp</dimen>
+  <dimen name="md_title_frame_margin_bottom_less">6dp</dimen>
+  <!-- The desired padding when no title is visible,
+       This plus md_content_padding_top should equals md_dialog_frame_margin -->
+  <dimen name="md_notitle_vertical_padding">16dp</dimen>
 
-    <dimen name="md_notitle_vertical_padding_more">20dp</dimen>
+  <dimen name="md_notitle_vertical_padding_more">20dp</dimen>
 
-    <dimen name="md_content_padding_top">8dp</dimen>
-    <dimen name="md_simplelistitem_padding_top">8dp</dimen>
+  <dimen name="md_content_padding_top">8dp</dimen>
+  <dimen name="md_simplelistitem_padding_top">8dp</dimen>
 
-    <dimen name="md_button_min_width">72dp</dimen>
-    <!-- Above and below buttons, 36+6+6=48 for the height of the button frame -->
-    <dimen name="md_button_inset_vertical">6dp</dimen>
-    <dimen name="md_button_inset_horizontal">4dp</dimen>
-    <dimen name="md_button_textpadding_horizontal">1dp</dimen>
-    <dimen name="md_button_padding_horizontal">8dp</dimen>
-    <dimen name="md_button_padding_vertical">4dp</dimen>
-    <dimen name="md_button_padding_horizontal_internalexternal">32dp</dimen>
-    <!-- 16dp - 4dp (inset from background drawable) -->
-    <dimen name="md_button_padding_frame_side">12dp</dimen>
-    <dimen name="md_neutral_button_margin">12dp</dimen>
+  <dimen name="md_button_min_width">72dp</dimen>
+  <!-- Above and below buttons, 36+6+6=48 for the height of the button frame -->
+  <dimen name="md_button_inset_vertical">6dp</dimen>
+  <dimen name="md_button_inset_horizontal">4dp</dimen>
+  <dimen name="md_button_textpadding_horizontal">1dp</dimen>
+  <dimen name="md_button_padding_horizontal">8dp</dimen>
+  <dimen name="md_button_padding_vertical">4dp</dimen>
+  <dimen name="md_button_padding_horizontal_internalexternal">32dp</dimen>
+  <!-- 16dp - 4dp (inset from background drawable) -->
+  <dimen name="md_button_padding_frame_side">12dp</dimen>
+  <dimen name="md_neutral_button_margin">12dp</dimen>
 
-    <!-- actual content padding bottom is 16dp, but we split between button bar and content -->
-    <dimen name="md_content_padding_bottom">8dp</dimen>
-    <dimen name="md_button_frame_vertical_padding">8dp</dimen>
-    <dimen name="md_button_height">48dp</dimen>
-    <dimen name="md_title_textsize">20sp</dimen>
-    <dimen name="md_content_textsize">16sp</dimen>
-    <dimen name="md_button_textsize">14sp</dimen>
-    <dimen name="md_listitem_textsize">16sp</dimen>
-    <dimen name="md_listitem_height">48dp</dimen>
-    <dimen name="md_listitem_control_margin">6dp</dimen>
-    <dimen name="md_icon_margin">16dp</dimen>
-    <dimen name="md_icon_max_size">48dp</dimen>
-    <dimen name="md_listitem_margin_left">24dp</dimen>
-    <dimen name="md_action_corner_radius">2dp</dimen>
-    <dimen name="md_divider_height">1dp</dimen>
+  <!-- actual content padding bottom is 16dp, but we split between button bar and content -->
+  <dimen name="md_content_padding_bottom">8dp</dimen>
+  <dimen name="md_button_frame_vertical_padding">8dp</dimen>
+  <dimen name="md_button_height">48dp</dimen>
+  <dimen name="md_title_textsize">20sp</dimen>
+  <dimen name="md_content_textsize">16sp</dimen>
+  <dimen name="md_button_textsize">14sp</dimen>
+  <dimen name="md_listitem_textsize">16sp</dimen>
+  <dimen name="md_listitem_height">48dp</dimen>
+  <dimen name="md_listitem_control_margin">6dp</dimen>
+  <dimen name="md_icon_margin">16dp</dimen>
+  <dimen name="md_icon_max_size">48dp</dimen>
+  <dimen name="md_listitem_margin_left">24dp</dimen>
+  <dimen name="md_action_corner_radius">2dp</dimen>
+  <dimen name="md_divider_height">1dp</dimen>
 
-    <dimen name="md_bg_corner_radius">2dp</dimen>
-    <dimen name="circular_progress_border">4dp</dimen>
-    <dimen name="md_listitem_vertical_margin">12dp</dimen>
-    <dimen name="md_listitem_vertical_margin_choice">8dp</dimen>
+  <dimen name="md_bg_corner_radius">2dp</dimen>
+  <dimen name="circular_progress_border">4dp</dimen>
+  <dimen name="md_listitem_vertical_margin">12dp</dimen>
+  <dimen name="md_listitem_vertical_margin_choice">8dp</dimen>
 
-    <dimen name="md_dialog_max_width">356dp</dimen>
-    <dimen name="md_dialog_vertical_margin">52dp</dimen>
-    <dimen name="md_dialog_horizontal_margin">28dp</dimen>
+  <dimen name="md_dialog_max_width">356dp</dimen>
+  <dimen name="md_dialog_vertical_margin">52dp</dimen>
+  <dimen name="md_dialog_horizontal_margin">28dp</dimen>
 
 </resources>

+ 1 - 1
core/src/main/res/values/public.xml

@@ -1,3 +1,3 @@
 <resources>
-    <public name="dummy" type="drawable"/>
+  <public name="dummy" type="drawable" />
 </resources>

+ 56 - 56
core/src/main/res/values/styles.xml

@@ -1,60 +1,60 @@
 <resources xmlns:tools="http://schemas.android.com/tools">
 
-    <style name="MD_Light" parent="Theme.AppCompat.Light.Dialog.Alert">
-        <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>
-        <item name="md_btn_positive_selector">@drawable/md_btn_selector</item>
-        <item name="md_btn_neutral_selector">@drawable/md_btn_selector</item>
-        <item name="md_btn_negative_selector">@drawable/md_btn_selector</item>
-
-        <item name="android:windowAnimationStyle">@style/MD_WindowAnimation</item>
-        <item name="android:backgroundDimEnabled">true</item>
-    </style>
-
-    <style name="MD_Dark" parent="Theme.AppCompat.Dialog.Alert">
-        <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>
-        <item name="md_btn_positive_selector">@drawable/md_btn_selector_dark</item>
-        <item name="md_btn_neutral_selector">@drawable/md_btn_selector_dark</item>
-        <item name="md_btn_negative_selector">@drawable/md_btn_selector_dark</item>
-
-        <item name="android:windowAnimationStyle">@style/MD_WindowAnimation</item>
-        <item name="android:backgroundDimEnabled">true</item>
-    </style>
-
-    <style name="MD_ActionButtonStacked" parent="@style/MD_ActionButton" tools:ignore="NewApi">
-        <item name="android:layout_width">match_parent</item>
-        <item name="android:paddingLeft">@dimen/md_button_padding_horizontal_internalexternal</item>
-        <item name="android:paddingStart">@dimen/md_button_padding_horizontal_internalexternal
-        </item>
-        <item name="android:paddingRight">@dimen/md_button_padding_horizontal_internalexternal
-        </item>
-        <item name="android:paddingEnd">@dimen/md_button_padding_horizontal_internalexternal</item>
-    </style>
-
-    <style name="MD_ActionButton">
-        <item name="android:layout_width">wrap_content</item>
-        <item name="android:layout_height">@dimen/md_button_height</item>
-        <item name="android:layout_gravity">center_vertical</item>
-    </style>
-
-    <style name="MD_ActionButton.Text" tools:ignore="NewApi">
-        <item name="android:textSize">@dimen/md_button_textsize</item>
-        <item name="android:singleLine">true</item>
-        <item name="android:layout_gravity">center_vertical</item>
-        <item name="android:gravity">center</item>
-        <item name="android:stateListAnimator">@null</item>
-        <item name="android:background">@null</item>
-        <item name="android:minWidth">@dimen/md_button_min_width</item>
-        <item name="android:paddingLeft">@dimen/md_button_textpadding_horizontal</item>
-        <item name="android:paddingRight">@dimen/md_button_textpadding_horizontal</item>
-    </style>
-
-    <style name="MD_WindowAnimation">
-        <item name="android:windowEnterAnimation">@anim/popup_enter</item>
-        <item name="android:windowExitAnimation">@anim/popup_exit</item>
-    </style>
+  <style name="MD_Light" parent="Theme.AppCompat.Light.Dialog.Alert">
+    <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>
+    <item name="md_btn_positive_selector">@drawable/md_btn_selector</item>
+    <item name="md_btn_neutral_selector">@drawable/md_btn_selector</item>
+    <item name="md_btn_negative_selector">@drawable/md_btn_selector</item>
+
+    <item name="android:windowAnimationStyle">@style/MD_WindowAnimation</item>
+    <item name="android:backgroundDimEnabled">true</item>
+  </style>
+
+  <style name="MD_Dark" parent="Theme.AppCompat.Dialog.Alert">
+    <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>
+    <item name="md_btn_positive_selector">@drawable/md_btn_selector_dark</item>
+    <item name="md_btn_neutral_selector">@drawable/md_btn_selector_dark</item>
+    <item name="md_btn_negative_selector">@drawable/md_btn_selector_dark</item>
+
+    <item name="android:windowAnimationStyle">@style/MD_WindowAnimation</item>
+    <item name="android:backgroundDimEnabled">true</item>
+  </style>
+
+  <style name="MD_ActionButtonStacked" parent="@style/MD_ActionButton" tools:ignore="NewApi">
+    <item name="android:layout_width">match_parent</item>
+    <item name="android:paddingLeft">@dimen/md_button_padding_horizontal_internalexternal</item>
+    <item name="android:paddingStart">@dimen/md_button_padding_horizontal_internalexternal
+    </item>
+    <item name="android:paddingRight">@dimen/md_button_padding_horizontal_internalexternal
+    </item>
+    <item name="android:paddingEnd">@dimen/md_button_padding_horizontal_internalexternal</item>
+  </style>
+
+  <style name="MD_ActionButton">
+    <item name="android:layout_width">wrap_content</item>
+    <item name="android:layout_height">@dimen/md_button_height</item>
+    <item name="android:layout_gravity">center_vertical</item>
+  </style>
+
+  <style name="MD_ActionButton.Text" tools:ignore="NewApi">
+    <item name="android:textSize">@dimen/md_button_textsize</item>
+    <item name="android:singleLine">true</item>
+    <item name="android:layout_gravity">center_vertical</item>
+    <item name="android:gravity">center</item>
+    <item name="android:stateListAnimator">@null</item>
+    <item name="android:background">@null</item>
+    <item name="android:minWidth">@dimen/md_button_min_width</item>
+    <item name="android:paddingLeft">@dimen/md_button_textpadding_horizontal</item>
+    <item name="android:paddingRight">@dimen/md_button_textpadding_horizontal</item>
+  </style>
+
+  <style name="MD_WindowAnimation">
+    <item name="android:windowEnterAnimation">@anim/popup_enter</item>
+    <item name="android:windowExitAnimation">@anim/popup_exit</item>
+  </style>
 
 </resources>

+ 2 - 0
sample/build.gradle

@@ -46,4 +46,6 @@ dependencies {
 
     compile 'com.jakewharton:butterknife:' + versions.butterKnife
     annotationProcessor 'com.jakewharton:butterknife-compiler:' + versions.butterKnife
+
+    compile 'com.facebook.stetho:stetho:1.4.2'
 }

+ 27 - 26
sample/src/main/AndroidManifest.xml

@@ -1,35 +1,36 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    package="com.afollestad.materialdialogssample">
+  xmlns:tools="http://schemas.android.com/tools"
+  package="com.afollestad.materialdialogssample">
 
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
 
-    <application
-        android:allowBackup="false"
-        android:icon="@mipmap/ic_launcher"
-        android:label="@string/app_name"
-        android:supportsRtl="true"
-        android:theme="@style/AppTheme"
-        android:vmSafeMode="true"
-        tools:ignore="UnusedAttribute">
+  <application
+    android:allowBackup="false"
+    android:icon="@mipmap/ic_launcher"
+    android:label="@string/app_name"
+    android:name=".App"
+    android:supportsRtl="true"
+    android:theme="@style/AppTheme"
+    android:vmSafeMode="true"
+    tools:ignore="UnusedAttribute">
 
-        <activity
-            android:name=".MainActivity"
-            android:label="@string/app_name">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
+    <activity
+      android:label="@string/app_name"
+      android:name=".MainActivity">
+      <intent-filter>
+        <action android:name="android.intent.action.MAIN" />
+        <category android:name="android.intent.category.LAUNCHER" />
+      </intent-filter>
+    </activity>
 
-        <activity
-            android:name=".PreferenceActivity"
-            android:label="@string/preference_dialogs" />
+    <activity
+      android:label="@string/preference_dialogs"
+      android:name=".PreferenceActivity" />
 
-        <activity
-            android:name=".PreferenceActivityCompat"
-            android:label="@string/preference_dialogs" />
+    <activity
+      android:label="@string/preference_dialogs"
+      android:name=".PreferenceActivityCompat" />
 
-    </application>
+  </application>
 
 </manifest>

+ 0 - 1
sample/src/main/java/com/afollestad/materialdialogssample/AboutDialog.java

@@ -5,7 +5,6 @@ import android.os.Bundle;
 import android.support.annotation.NonNull;
 import android.support.v4.app.DialogFragment;
 import android.support.v7.app.AppCompatActivity;
-
 import com.afollestad.materialdialogs.MaterialDialog;
 
 /**

+ 16 - 0
sample/src/main/java/com/afollestad/materialdialogssample/App.java

@@ -0,0 +1,16 @@
+package com.afollestad.materialdialogssample;
+
+import android.app.Application;
+import com.facebook.stetho.Stetho;
+
+/**
+ * @author Aidan Follestad (afollestad)
+ */
+public class App extends Application {
+
+  @Override
+  public void onCreate() {
+    super.onCreate();
+    Stetho.initializeWithDefaults(this);
+  }
+}

+ 4 - 1
sample/src/main/java/com/afollestad/materialdialogssample/ButtonItemAdapter.java

@@ -18,9 +18,11 @@ class ButtonItemAdapter extends RecyclerView.Adapter<ButtonItemAdapter.ButtonVH>
   private final CharSequence[] items;
   private ItemCallback itemCallback;
   private ButtonCallback buttonCallback;
+
   ButtonItemAdapter(Context context, @ArrayRes int arrayResId) {
     this(context.getResources().getTextArray(arrayResId));
   }
+
   private ButtonItemAdapter(CharSequence[] items) {
     this.items = items;
   }
@@ -77,8 +79,9 @@ class ButtonItemAdapter extends RecyclerView.Adapter<ButtonItemAdapter.ButtonVH>
 
     @Override
     public void onClick(View view) {
-      if (adapter.itemCallback == null)
+      if (adapter.itemCallback == null) {
         return;
+      }
       if (view instanceof Button) {
         adapter.buttonCallback.onButtonClicked(getAdapterPosition());
       } else {

+ 4 - 4
sample/src/main/java/com/afollestad/materialdialogssample/ChangelogDialog.java

@@ -10,10 +10,8 @@ import android.view.InflateException;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.webkit.WebView;
-
 import com.afollestad.materialdialogs.MaterialDialog;
 import com.afollestad.materialdialogs.Theme;
-
 import java.io.BufferedReader;
 import java.io.InputStream;
 import java.io.InputStreamReader;
@@ -56,8 +54,9 @@ public class ChangelogDialog extends DialogFragment {
       InputStream json = getActivity().getAssets().open("changelog.html");
       BufferedReader in = new BufferedReader(new InputStreamReader(json, "UTF-8"));
       String str;
-      while ((str = in.readLine()) != null)
+      while ((str = in.readLine()) != null) {
         buf.append(str);
+      }
       in.close();
 
       // Inject color values for WebView body background and links
@@ -70,7 +69,8 @@ public class ChangelogDialog extends DialogFragment {
               .replace("{link-color-active}", colorToHex(accentColor))
           , "text/html", "UTF-8");
     } catch (Throwable e) {
-      webView.loadData("<h1>Unable to load</h1><p>" + e.getLocalizedMessage() + "</p>", "text/html", "UTF-8");
+      webView.loadData("<h1>Unable to load</h1><p>" + e.getLocalizedMessage() + "</p>", "text/html",
+          "UTF-8");
     }
     return dialog;
   }

+ 80 - 30
sample/src/main/java/com/afollestad/materialdialogssample/MainActivity.java

@@ -2,6 +2,8 @@ package com.afollestad.materialdialogssample;
 
 import android.Manifest;
 import android.annotation.TargetApi;
+import android.app.Dialog;
+import android.app.DialogFragment;
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.graphics.Color;
@@ -26,7 +28,8 @@ import android.view.View;
 import android.widget.CheckBox;
 import android.widget.EditText;
 import android.widget.Toast;
-
+import butterknife.ButterKnife;
+import butterknife.OnClick;
 import com.afollestad.materialdialogs.DialogAction;
 import com.afollestad.materialdialogs.GravityEnum;
 import com.afollestad.materialdialogs.MaterialDialog;
@@ -41,17 +44,14 @@ import com.afollestad.materialdialogs.internal.ThemeSingleton;
 import com.afollestad.materialdialogs.simplelist.MaterialSimpleListAdapter;
 import com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem;
 import com.afollestad.materialdialogs.util.DialogUtils;
-
 import java.io.File;
 
-import butterknife.ButterKnife;
-import butterknife.OnClick;
-
 /**
  * @author Aidan Follestad (afollestad)
  */
 public class MainActivity extends AppCompatActivity implements
-    FolderChooserDialog.FolderCallback, FileChooserDialog.FileCallback, ColorChooserDialog.ColorCallback {
+    FolderChooserDialog.FolderCallback, FileChooserDialog.FileCallback,
+    ColorChooserDialog.ColorCallback {
 
   private final static int STORAGE_PERMISSION_RC = 69;
   static int index = 0;
@@ -77,8 +77,9 @@ public class MainActivity extends AppCompatActivity implements
   }
 
   private void startThread(Runnable run) {
-    if (thread != null)
+    if (thread != null) {
       thread.interrupt();
+    }
     thread = new Thread(run);
     thread.start();
   }
@@ -98,6 +99,31 @@ public class MainActivity extends AppCompatActivity implements
     handler = new Handler();
     primaryPreselect = DialogUtils.resolveColor(this, R.attr.colorPrimary);
     accentPreselect = DialogUtils.resolveColor(this, R.attr.colorAccent);
+
+    new MyDialog().show(getFragmentManager(), "TEST");
+  }
+
+  public static class MyDialog extends DialogFragment {
+
+    @Override
+    public Dialog onCreateDialog(Bundle savedInstanceState) {
+      return new MaterialDialog.Builder(getActivity())
+          .title("Title")
+          .progress(true, 0)
+          .positiveText("Cancel")
+          .onPositive((dialog, which) -> {
+            //Code
+          })
+          .showListener(dialogInterface -> {
+            //Code
+          })
+          .buttonsGravity(GravityEnum.CENTER)
+          .progress(true, -1)
+          .progressIndeterminateStyle(false)
+          .autoDismiss(true)
+          .cancelable(false)
+          .build();
+    }
   }
 
   @Override
@@ -109,8 +135,9 @@ public class MainActivity extends AppCompatActivity implements
   @Override
   protected void onPause() {
     super.onPause();
-    if (thread != null && !thread.isInterrupted() && thread.isAlive())
+    if (thread != null && !thread.isInterrupted() && thread.isAlive()) {
       thread.interrupt();
+    }
   }
 
   @OnClick(R.id.basicNoTitle)
@@ -175,7 +202,8 @@ public class MainActivity extends AppCompatActivity implements
         .positiveText(R.string.speedBoost)
         .negativeText(R.string.noThanks)
         .btnStackedGravity(GravityEnum.END)
-        .stackingBehavior(StackingBehavior.ALWAYS)  // this generally should not be forced, but is used for demo purposes
+        .stackingBehavior(
+            StackingBehavior.ALWAYS)  // this generally should not be forced, but is used for demo purposes
         .show();
   }
 
@@ -304,7 +332,9 @@ public class MainActivity extends AppCompatActivity implements
         .itemsCallbackMultiChoice(new Integer[]{1, 3}, (dialog, which, text) -> {
           StringBuilder str = new StringBuilder();
           for (int i = 0; i < which.length; i++) {
-            if (i > 0) str.append('\n');
+            if (i > 0) {
+              str.append('\n');
+            }
             str.append(which[i]);
             str.append(": ");
             str.append(text[i]);
@@ -327,7 +357,8 @@ public class MainActivity extends AppCompatActivity implements
         .title(R.string.socialNetworks)
         .items(R.array.socialNetworks)
         .itemsCallbackMultiChoice(new Integer[]{1}, (dialog, which, text) -> {
-          boolean allowSelectionChange = which.length <= 2; // limit selection to 2, the new (un)selection is included in the which array
+          boolean allowSelectionChange = which.length
+              <= 2; // limit selection to 2, the new (un)selection is included in the which array
           if (!allowSelectionChange) {
             showToast(R.string.selection_limit_reached);
           }
@@ -344,7 +375,8 @@ public class MainActivity extends AppCompatActivity implements
         .title(R.string.socialNetworks)
         .items(R.array.socialNetworks)
         .itemsCallbackMultiChoice(new Integer[]{1}, (dialog, which, text) -> {
-          boolean allowSelectionChange = which.length >= 1; // selection count must stay above 1, the new (un)selection is included in the which array
+          boolean allowSelectionChange = which.length
+              >= 1; // selection count must stay above 1, the new (un)selection is included in the which array
           if (!allowSelectionChange) {
             showToast(R.string.selection_min_limit_reached);
           }
@@ -363,7 +395,9 @@ public class MainActivity extends AppCompatActivity implements
         .itemsCallbackMultiChoice(new Integer[]{1, 3}, (dialog, which, text) -> {
           StringBuilder str = new StringBuilder();
           for (int i = 0; i < which.length; i++) {
-            if (i > 0) str.append('\n');
+            if (i > 0) {
+              str.append('\n');
+            }
             str.append(which[i]);
             str.append(": ");
             str.append(text[i]);
@@ -383,7 +417,9 @@ public class MainActivity extends AppCompatActivity implements
         .itemsCallbackMultiChoice(new Integer[]{0, 1, 2}, (dialog, which, text) -> {
           StringBuilder str = new StringBuilder();
           for (int i = 0; i < which.length; i++) {
-            if (i > 0) str.append('\n');
+            if (i > 0) {
+              str.append('\n');
+            }
             str.append(which[i]);
             str.append(": ");
             str.append(text[i]);
@@ -402,7 +438,8 @@ public class MainActivity extends AppCompatActivity implements
 
   @OnClick(R.id.simpleList)
   public void showSimpleList() {
-    final MaterialSimpleListAdapter adapter = new MaterialSimpleListAdapter((dialog, index1, item) -> showToast(item.getContent().toString()));
+    final MaterialSimpleListAdapter adapter = new MaterialSimpleListAdapter(
+        (dialog, index1, item) -> showToast(item.getContent().toString()));
     adapter.add(new MaterialSimpleListItem.Builder(this)
         .content("username@gmail.com")
         .icon(R.drawable.ic_account_circle)
@@ -445,7 +482,9 @@ public class MainActivity extends AppCompatActivity implements
         .customView(R.layout.dialog_customview, true)
         .positiveText(R.string.connect)
         .negativeText(android.R.string.cancel)
-        .onPositive((dialog1, which) -> showToast("Password: " + passwordInput.getText().toString())).build();
+        .onPositive(
+            (dialog1, which) -> showToast("Password: " + passwordInput.getText().toString()))
+        .build();
 
     positiveAction = dialog.getActionButton(DialogAction.POSITIVE);
     //noinspection ConstantConditions
@@ -468,8 +507,10 @@ public class MainActivity extends AppCompatActivity implements
     // Toggling the show password CheckBox will mask or unmask the password input EditText
     CheckBox checkbox = (CheckBox) dialog.getCustomView().findViewById(R.id.showPassword);
     checkbox.setOnCheckedChangeListener((buttonView, isChecked) -> {
-      passwordInput.setInputType(!isChecked ? InputType.TYPE_TEXT_VARIATION_PASSWORD : InputType.TYPE_CLASS_TEXT);
-      passwordInput.setTransformationMethod(!isChecked ? PasswordTransformationMethod.getInstance() : null);
+      passwordInput.setInputType(
+          !isChecked ? InputType.TYPE_TEXT_VARIATION_PASSWORD : InputType.TYPE_CLASS_TEXT);
+      passwordInput
+          .setTransformationMethod(!isChecked ? PasswordTransformationMethod.getInstance() : null);
     });
 
     int widgetColor = ThemeSingleton.get().widgetColor;
@@ -486,8 +527,9 @@ public class MainActivity extends AppCompatActivity implements
   @OnClick(R.id.customView_webView)
   public void showCustomWebView() {
     int accentColor = ThemeSingleton.get().widgetColor;
-    if (accentColor == 0)
+    if (accentColor == 0) {
       accentColor = ContextCompat.getColor(this, R.color.accent);
+    }
     ChangelogDialog.create(false, accentColor)
         .show(getSupportFragmentManager(), "changelog");
   }
@@ -569,8 +611,9 @@ public class MainActivity extends AppCompatActivity implements
       ThemeSingleton.get().widgetColor = color;
     } else {
       primaryPreselect = color;
-      if (getSupportActionBar() != null)
+      if (getSupportActionBar() != null) {
         getSupportActionBar().setBackgroundDrawable(new ColorDrawable(color));
+      }
       if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
         getWindow().setStatusBarColor(CircleView.shiftColorDown(color));
         getWindow().setNavigationBarColor(color);
@@ -622,9 +665,11 @@ public class MainActivity extends AppCompatActivity implements
   @OnClick(R.id.file_chooser)
   public void showFileChooser() {
     chooserDialog = R.id.file_chooser;
-    if (ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
+    if (ActivityCompat
+        .checkSelfPermission(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
         PackageManager.PERMISSION_GRANTED) {
-      ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, STORAGE_PERMISSION_RC);
+      ActivityCompat.requestPermissions(MainActivity.this,
+          new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, STORAGE_PERMISSION_RC);
       return;
     }
     new FileChooserDialog.Builder(this)
@@ -645,9 +690,11 @@ public class MainActivity extends AppCompatActivity implements
   @OnClick(R.id.folder_chooser)
   public void showFolderChooser() {
     chooserDialog = R.id.folder_chooser;
-    if (ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) !=
+    if (ActivityCompat
+        .checkSelfPermission(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) !=
         PackageManager.PERMISSION_GRANTED) {
-      ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, STORAGE_PERMISSION_RC);
+      ActivityCompat.requestPermissions(MainActivity.this,
+          new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, STORAGE_PERMISSION_RC);
       return;
     }
     new FolderChooserDialog.Builder(MainActivity.this)
@@ -725,16 +772,18 @@ public class MainActivity extends AppCompatActivity implements
         .contentGravity(GravityEnum.CENTER)
         .progress(false, 150, true)
         .cancelListener(dialog -> {
-          if (thread != null)
+          if (thread != null) {
             thread.interrupt();
+          }
         })
         .showListener(dialogInterface -> {
           final MaterialDialog dialog = (MaterialDialog) dialogInterface;
           startThread(() -> {
             while (dialog.getCurrentProgress() != dialog.getMaxProgress() &&
                 !Thread.currentThread().isInterrupted()) {
-              if (dialog.isCancelled())
+              if (dialog.isCancelled()) {
                 break;
+              }
               try {
                 Thread.sleep(50);
               } catch (InterruptedException e) {
@@ -772,10 +821,11 @@ public class MainActivity extends AppCompatActivity implements
 
   @OnClick(R.id.preference_dialogs)
   public void showPreferenceDialogs() {
-    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1)
+    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
       startActivity(new Intent(getApplicationContext(), PreferenceActivity.class));
-    else
+    } else {
       startActivity(new Intent(getApplicationContext(), PreferenceActivityCompat.class));
+    }
   }
 
   @Override
@@ -795,8 +845,8 @@ public class MainActivity extends AppCompatActivity implements
 
   @Override
   public void onRequestPermissionsResult(int requestCode,
-                                         @NonNull String[] permissions,
-                                         @NonNull int[] grantResults) {
+      @NonNull String[] permissions,
+      @NonNull int[] grantResults) {
     super.onRequestPermissionsResult(requestCode, permissions, grantResults);
     if (requestCode == STORAGE_PERMISSION_RC) {
       if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {

+ 3 - 1
sample/src/main/java/com/afollestad/materialdialogssample/PreferenceActivity.java

@@ -16,7 +16,8 @@ public class PreferenceActivity extends AppCompatActivity {
     getSupportActionBar().setDisplayHomeAsUpEnabled(true);
 
     if (getFragmentManager().findFragmentById(R.id.content_frame) == null) {
-      getFragmentManager().beginTransaction().replace(R.id.content_frame, new SettingsFragment()).commit();
+      getFragmentManager().beginTransaction().replace(R.id.content_frame, new SettingsFragment())
+          .commit();
     }
   }
 
@@ -30,6 +31,7 @@ public class PreferenceActivity extends AppCompatActivity {
   }
 
   public static class SettingsFragment extends PreferenceFragment {
+
     @Override
     public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);