浏览代码

More padding fixes, made members protected instead of private for subclass access, README update, etc.

Aidan Follestad 10 年之前
父节点
当前提交
81197a67c6

+ 3 - 3
README.md

@@ -8,9 +8,9 @@ The code you see below is also found in the sample project. You can download a A
 
 
 ###### Version 0.5.0
 ###### Version 0.5.0
 
 
-> 1. The ability to choose whether or not custom views are placed inside of a ScrollView (the second parameter of `customView()` in the `Builder`). This is heavily based off a pull request by [Kevin Barry](https://github.com/teslacoil), thanks for your help!
-> 2. Various padding improvements.
-> 3. Small bug fixes.
+> 1. The ability to choose whether or not custom views are placed inside of a `ScrollView` (the second parameter of `customView()` in the `Builder`). This is heavily based off a pull request by [Kevin Barry](https://github.com/teslacoil), thanks for your help!
+> 2. An enormous amount of fixes for padding and spacing throughout the different types of dialogs.
+> 3. Other bug fixes and improvements throughout.
 
 
 ###### Version 0.4.8 – 0.4.9
 ###### Version 0.4.8 – 0.4.9
 
 

+ 82 - 86
library/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java

@@ -50,21 +50,21 @@ import java.util.List;
  */
  */
 public class MaterialDialog extends DialogBase implements View.OnClickListener {
 public class MaterialDialog extends DialogBase implements View.OnClickListener {
 
 
-    View view;
-    ListView listView;
-    ImageView icon;
-    TextView title;
-    View titleFrame;
-    Builder mBuilder;
-    FrameLayout customViewFrame;
-
-    Button positiveButton;
-    Button neutralButton;
-    Button negativeButton;
-    boolean isStacked;
-    final int defaultItemColor;
-    ListType listType;
-    List<Integer> selectedIndicesList;
+    protected View view;
+    protected ListView listView;
+    protected ImageView icon;
+    protected TextView title;
+    protected View titleFrame;
+    protected Builder mBuilder;
+    protected FrameLayout customViewFrame;
+
+    protected Button positiveButton;
+    protected Button neutralButton;
+    protected Button negativeButton;
+    protected boolean isStacked;
+    protected final int defaultItemColor;
+    protected ListType listType;
+    protected List<Integer> selectedIndicesList;
 
 
     private static ContextThemeWrapper getTheme(Builder builder) {
     private static ContextThemeWrapper getTheme(Builder builder) {
         TypedArray a = builder.context.getTheme().obtainStyledAttributes(new int[]{R.attr.md_dark_theme});
         TypedArray a = builder.context.getTheme().obtainStyledAttributes(new int[]{R.attr.md_dark_theme});
@@ -225,7 +225,7 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
             if (builder.titleAlignment == Alignment.CENTER) {
             if (builder.titleAlignment == Alignment.CENTER) {
                 title.setGravity(Gravity.CENTER_HORIZONTAL);
                 title.setGravity(Gravity.CENTER_HORIZONTAL);
             } else if (builder.titleAlignment == Alignment.END) {
             } else if (builder.titleAlignment == Alignment.END) {
-                title.setGravity(Gravity.RIGHT);
+                title.setGravity(Gravity.END);
             }
             }
         }
         }
 
 
@@ -290,16 +290,12 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
                 contentScrollView.getPaddingRight(), paddingBottom);
                 contentScrollView.getPaddingRight(), paddingBottom);
 
 
         if (listView != null) {
         if (listView != null) {
-            final int titleMarginBottom = (int) mBuilder.context.getResources().getDimension(R.dimen.md_title_frame_margin_bottom_list);
-            setVerticalMargins(titleFrame, -1, titleMarginBottom);
-
-//            final int dialogFramePadding = (int) mBuilder.context.getResources().getDimension(R.dimen.md_dialog_frame_margin);
-//            paddingTop = titleFrame.getVisibility() != View.GONE ? listView.getPaddingTop() :
-//                    dialogFramePadding;
-//            paddingBottom = hasActionButtons() ? listView.getPaddingBottom() :
-//                    dialogFramePadding;
-//            listView.setPadding(listView.getPaddingLeft(), paddingTop,
-//                    listView.getPaddingRight(), paddingBottom);
+            // Padding below title is reduced for divider.
+            final int titlePaddingBottom = (int) mBuilder.context.getResources().getDimension(R.dimen.md_title_frame_margin_bottom_list);
+            titleFrame.setPadding(titleFrame.getPaddingLeft(),
+                    titleFrame.getPaddingTop(),
+                    titleFrame.getPaddingRight(),
+                    titlePaddingBottom);
         }
         }
     }
     }
 
 
@@ -312,7 +308,8 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
         }
         }
         View contentScrollView = view.findViewById(R.id.contentScrollView);
         View contentScrollView = view.findViewById(R.id.contentScrollView);
         TextView content = (TextView) view.findViewById(R.id.content);
         TextView content = (TextView) view.findViewById(R.id.content);
-        final int contentHorizontalPadding = (int) mBuilder.context.getResources().getDimension(R.dimen.md_dialog_frame_margin);
+        final int contentHorizontalPadding = (int) mBuilder.context.getResources()
+                .getDimension(R.dimen.md_dialog_frame_margin);
         content.setPadding(contentHorizontalPadding, 0, contentHorizontalPadding, 0);
         content.setPadding(contentHorizontalPadding, 0, contentHorizontalPadding, 0);
 
 
         if (mBuilder.customView != null) {
         if (mBuilder.customView != null) {
@@ -323,7 +320,7 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
             setDividerVisibility(topScroll, bottomScroll);
             setDividerVisibility(topScroll, bottomScroll);
         } else if ((mBuilder.items != null && mBuilder.items.length > 0) || mBuilder.adapter != null) {
         } else if ((mBuilder.items != null && mBuilder.items.length > 0) || mBuilder.adapter != null) {
             contentScrollView.setVisibility(View.GONE);
             contentScrollView.setVisibility(View.GONE);
-            boolean canScroll = canListViewScroll();
+            boolean canScroll = titleFrame.getVisibility() == View.VISIBLE && canListViewScroll();
             setDividerVisibility(canScroll, canScroll);
             setDividerVisibility(canScroll, canScroll);
         } else {
         } else {
             contentScrollView.setVisibility(View.VISIBLE);
             contentScrollView.setVisibility(View.VISIBLE);
@@ -333,6 +330,13 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
                         .getDimension(R.dimen.md_title_frame_margin_bottom);
                         .getDimension(R.dimen.md_title_frame_margin_bottom);
                 content.setPadding(contentHorizontalPadding, contentVerticalPadding,
                 content.setPadding(contentHorizontalPadding, contentVerticalPadding,
                         contentHorizontalPadding, contentVerticalPadding);
                         contentHorizontalPadding, contentVerticalPadding);
+
+                // Same effect as when there's a ListView. Padding below title is reduced for divider.
+                final int titlePaddingBottom = (int) mBuilder.context.getResources().getDimension(R.dimen.md_title_frame_margin_bottom_list);
+                titleFrame.setPadding(titleFrame.getPaddingLeft(),
+                        titleFrame.getPaddingTop(),
+                        titleFrame.getPaddingRight(),
+                        titlePaddingBottom);
             }
             }
             setDividerVisibility(canScroll, canScroll);
             setDividerVisibility(canScroll, canScroll);
         }
         }
@@ -346,6 +350,9 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
      * above and below the divider.
      * above and below the divider.
      */
      */
     private void setDividerVisibility(boolean topVisible, boolean bottomVisible) {
     private void setDividerVisibility(boolean topVisible, boolean bottomVisible) {
+        topVisible = topVisible && titleFrame.getVisibility() == View.VISIBLE;
+        bottomVisible = bottomVisible && hasActionButtons();
+
         View titleBarDivider = view.findViewById(R.id.titleBarDivider);
         View titleBarDivider = view.findViewById(R.id.titleBarDivider);
         if (topVisible) {
         if (topVisible) {
             titleBarDivider.setVisibility(View.VISIBLE);
             titleBarDivider.setVisibility(View.VISIBLE);
@@ -509,24 +516,6 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
         return scrollView.getMeasuredHeight() < childHeight;
         return scrollView.getMeasuredHeight() < childHeight;
     }
     }
 
 
-    /**
-     * Invalidates the radio buttons in the single choice mode list so that only the radio button that
-     * was previous selected is checked.
-     */
-    private void invalidateSingleChoice(int newSelection) {
-        newSelection++;
-        final LinearLayout list = (LinearLayout) view.findViewById(R.id.customViewFrame);
-        for (int i = 1; i < list.getChildCount(); i++) {
-            View v = list.getChildAt(i);
-            @SuppressLint("WrongViewCast")
-            RadioButton rb = (RadioButton) v.findViewById(R.id.control);
-            if (newSelection != i) {
-                rb.setChecked(false);
-                rb.clearFocus();
-            }
-        }
-    }
-
     private int calculateMaxButtonWidth() {
     private int calculateMaxButtonWidth() {
         /**
         /**
          * Max button width = (DialogWidth - Side margins) / [Number of buttons]
          * Max button width = (DialogWidth - Side margins) / [Number of buttons]
@@ -597,7 +586,8 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
             setTypeface(positiveButton, mBuilder.mediumFont);
             setTypeface(positiveButton, mBuilder.mediumFont);
             positiveButton.setText(mBuilder.positiveText);
             positiveButton.setText(mBuilder.positiveText);
             positiveButton.setTextColor(getActionTextStateList(mBuilder.positiveColor));
             positiveButton.setTextColor(getActionTextStateList(mBuilder.positiveColor));
-            setBackgroundCompat(positiveButton, DialogUtils.resolveDrawable(getContext(), isStacked ? R.attr.md_selector : R.attr.md_btn_selector));
+            setBackgroundCompat(positiveButton, DialogUtils.resolveDrawable(getContext(),
+                    isStacked ? R.attr.md_selector : R.attr.md_btn_selector));
             positiveButton.setTag(POSITIVE);
             positiveButton.setTag(POSITIVE);
             positiveButton.setOnClickListener(this);
             positiveButton.setOnClickListener(this);
         } else {
         } else {
@@ -624,7 +614,8 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
             setTypeface(negativeButton, mBuilder.mediumFont);
             setTypeface(negativeButton, mBuilder.mediumFont);
             negativeButton.setVisibility(View.VISIBLE);
             negativeButton.setVisibility(View.VISIBLE);
             negativeButton.setTextColor(getActionTextStateList(mBuilder.negativeColor));
             negativeButton.setTextColor(getActionTextStateList(mBuilder.negativeColor));
-            setBackgroundCompat(negativeButton, DialogUtils.resolveDrawable(getContext(), isStacked ? R.attr.md_selector : R.attr.md_btn_selector));
+            setBackgroundCompat(negativeButton, DialogUtils.resolveDrawable(getContext(),
+                    isStacked ? R.attr.md_selector : R.attr.md_btn_selector));
             negativeButton.setText(mBuilder.negativeText);
             negativeButton.setText(mBuilder.negativeText);
             negativeButton.setTag(NEGATIVE);
             negativeButton.setTag(NEGATIVE);
             negativeButton.setOnClickListener(this);
             negativeButton.setOnClickListener(this);
@@ -704,7 +695,6 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
                     RadioButton cb = (RadioButton) ((LinearLayout) v).getChildAt(0);
                     RadioButton cb = (RadioButton) ((LinearLayout) v).getChildAt(0);
                     if (!cb.isChecked())
                     if (!cb.isChecked())
                         cb.setChecked(true);
                         cb.setChecked(true);
-                    invalidateSingleChoice(index);
                     if (mBuilder.autoDismiss && mBuilder.positiveText == null) {
                     if (mBuilder.autoDismiss && mBuilder.positiveText == null) {
                         dismiss();
                         dismiss();
                         sendSingleChoiceCallback(v);
                         sendSingleChoiceCallback(v);
@@ -723,40 +713,40 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
      */
      */
     public static class Builder {
     public static class Builder {
 
 
-        Context context;
-        CharSequence title;
-        Alignment titleAlignment = Alignment.START;
-        Alignment contentAlignment = Alignment.START;
-        int titleColor = -1;
-        int contentColor = -1;
-        CharSequence content;
-        CharSequence[] items;
-        CharSequence positiveText;
-        CharSequence neutralText;
-        CharSequence negativeText;
-        View customView;
-        int positiveColor;
-        int negativeColor;
-        int neutralColor;
-        ButtonCallback callback;
-        ListCallback listCallback;
-        ListCallback listCallbackSingle;
-        ListCallbackMulti listCallbackMulti;
-        Theme theme = Theme.LIGHT;
-        boolean cancelable = true;
-        float contentLineSpacingMultiplier = 1.3f;
-        int selectedIndex = -1;
-        Integer[] selectedIndices = null;
-        boolean autoDismiss = true;
-        Typeface regularFont;
-        Typeface mediumFont;
-        Drawable icon;
-        ListAdapter adapter;
-        OnDismissListener dismissListener;
-        OnCancelListener cancelListener;
-        OnShowListener showListener;
-        boolean forceStacking;
-        boolean wrapCustomViewInScroll;
+        protected Context context;
+        protected CharSequence title;
+        protected Alignment titleAlignment = Alignment.START;
+        protected Alignment contentAlignment = Alignment.START;
+        protected int titleColor = -1;
+        protected int contentColor = -1;
+        protected CharSequence content;
+        protected CharSequence[] items;
+        protected CharSequence positiveText;
+        protected CharSequence neutralText;
+        protected CharSequence negativeText;
+        protected View customView;
+        protected int positiveColor;
+        protected int negativeColor;
+        protected int neutralColor;
+        protected ButtonCallback callback;
+        protected ListCallback listCallback;
+        protected ListCallback listCallbackSingle;
+        protected ListCallbackMulti listCallbackMulti;
+        protected Theme theme = Theme.LIGHT;
+        protected boolean cancelable = true;
+        protected float contentLineSpacingMultiplier = 1.3f;
+        protected int selectedIndex = -1;
+        protected Integer[] selectedIndices = null;
+        protected boolean autoDismiss = true;
+        protected Typeface regularFont;
+        protected Typeface mediumFont;
+        protected Drawable icon;
+        protected ListAdapter adapter;
+        protected OnDismissListener dismissListener;
+        protected OnCancelListener cancelListener;
+        protected OnShowListener showListener;
+        protected boolean forceStacking;
+        protected boolean wrapCustomViewInScroll;
 
 
         public Builder(@NonNull Context context) {
         public Builder(@NonNull Context context) {
             this.context = context;
             this.context = context;
@@ -957,17 +947,23 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
             return this;
             return this;
         }
         }
 
 
+        /**
+         * Use {@link #customView(int, boolean)} instead.
+         */
+        @Deprecated
         public Builder customView(@LayoutRes int layoutRes) {
         public Builder customView(@LayoutRes int layoutRes) {
             return customView(layoutRes, true);
             return customView(layoutRes, true);
         }
         }
 
 
         public Builder customView(@LayoutRes int layoutRes, boolean wrapInScrollView) {
         public Builder customView(@LayoutRes int layoutRes, boolean wrapInScrollView) {
             LayoutInflater li = LayoutInflater.from(this.context);
             LayoutInflater li = LayoutInflater.from(this.context);
-            customView(li.inflate(layoutRes, null));
-            this.wrapCustomViewInScroll = wrapInScrollView;
-            return this;
+            return customView(li.inflate(layoutRes, null), wrapInScrollView);
         }
         }
 
 
+        /**
+         * Use {@link #customView(android.view.View, boolean)} instead.
+         */
+        @Deprecated
         public Builder customView(View view) {
         public Builder customView(View view) {
             return customView(view, true);
             return customView(view, true);
         }
         }

+ 14 - 11
library/src/main/res/layout/md_dialog.xml

@@ -9,7 +9,7 @@
         android:id="@+id/mainFrame"
         android:id="@+id/mainFrame"
         android:orientation="vertical"
         android:orientation="vertical"
         android:layout_width="match_parent"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
+        android:layout_height="0dp"
         android:layout_weight="1">
         android:layout_weight="1">
 
 
         <LinearLayout
         <LinearLayout
@@ -18,10 +18,10 @@
             android:layout_width="match_parent"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_height="wrap_content"
             android:gravity="center_vertical"
             android:gravity="center_vertical"
-            android:layout_marginLeft="@dimen/md_dialog_frame_margin"
-            android:layout_marginTop="@dimen/md_dialog_frame_margin"
-            android:layout_marginRight="@dimen/md_dialog_frame_margin"
-            android:layout_marginBottom="@dimen/md_title_frame_margin_bottom">
+            android:paddingLeft="@dimen/md_dialog_frame_margin"
+            android:paddingTop="@dimen/md_dialog_frame_margin"
+            android:paddingRight="@dimen/md_dialog_frame_margin"
+            android:paddingBottom="@dimen/md_title_frame_margin_bottom">
 
 
             <ImageView
             <ImageView
                 android:id="@+id/icon"
                 android:id="@+id/icon"
@@ -42,6 +42,7 @@
             android:id="@+id/titleBarDivider"
             android:id="@+id/titleBarDivider"
             android:layout_width="match_parent"
             android:layout_width="match_parent"
             android:layout_height="1dp"
             android:layout_height="1dp"
+            android:layout_marginTop="@dimen/md_content_vertical_padding"
             android:layout_marginBottom="-1dp"
             android:layout_marginBottom="-1dp"
             android:visibility="gone" />
             android:visibility="gone" />
 
 
@@ -49,7 +50,9 @@
             android:id="@+id/contentScrollView"
             android:id="@+id/contentScrollView"
             android:layout_width="match_parent"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_height="wrap_content"
-            android:visibility="gone">
+            android:visibility="gone"
+            android:clipToPadding="false"
+            android:paddingBottom="@dimen/md_content_vertical_padding">
 
 
             <TextView
             <TextView
                 android:id="@+id/content"
                 android:id="@+id/content"
@@ -69,10 +72,7 @@
                 android:id="@+id/contentListView"
                 android:id="@+id/contentListView"
                 android:layout_width="match_parent"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_height="wrap_content"
-                android:paddingTop="@dimen/md_content_vertical_padding"
-                android:paddingBottom="@dimen/md_content_vertical_padding"
                 android:scrollbarStyle="outsideOverlay"
                 android:scrollbarStyle="outsideOverlay"
-                android:clipToPadding="false"
                 android:divider="@null"
                 android:divider="@null"
                 android:dividerHeight="0dp" />
                 android:dividerHeight="0dp" />
         </FrameLayout>
         </FrameLayout>
@@ -101,7 +101,9 @@
             android:id="@+id/buttonDefaultNeutral"
             android:id="@+id/buttonDefaultNeutral"
             style="@style/MD_ActionButton"
             style="@style/MD_ActionButton"
             android:layout_alignParentLeft="true"
             android:layout_alignParentLeft="true"
-            android:layout_marginLeft="@dimen/md_neutral_button_margin" />
+            android:layout_alignParentStart="true"
+            android:layout_marginLeft="@dimen/md_neutral_button_margin"
+            android:layout_marginStart="@dimen/md_neutral_button_margin" />
         <!-- toLeftOf rule added from invalidateActions() -->
         <!-- toLeftOf rule added from invalidateActions() -->
         <Button
         <Button
             android:id="@+id/buttonDefaultNegative"
             android:id="@+id/buttonDefaultNegative"
@@ -110,7 +112,8 @@
         <Button
         <Button
             android:id="@+id/buttonDefaultPositive"
             android:id="@+id/buttonDefaultPositive"
             style="@style/MD_ActionButton"
             style="@style/MD_ActionButton"
-            android:layout_alignParentRight="true" />
+            android:layout_alignParentRight="true"
+            android:layout_alignParentEnd="true" />
     </RelativeLayout>
     </RelativeLayout>
 
 
     <LinearLayout
     <LinearLayout

+ 1 - 1
library/src/main/res/values/dimens.xml

@@ -29,7 +29,7 @@
     <dimen name="md_content_textsize">18sp</dimen>
     <dimen name="md_content_textsize">18sp</dimen>
     <dimen name="md_button_textsize">14sp</dimen>
     <dimen name="md_button_textsize">14sp</dimen>
     <dimen name="md_listitem_textsize">18sp</dimen>
     <dimen name="md_listitem_textsize">18sp</dimen>
-    <dimen name="md_listitem_height">48dp</dimen>
+    <dimen name="md_listitem_height">52dp</dimen>
     <dimen name="md_listitem_control_margin">16dp</dimen>
     <dimen name="md_listitem_control_margin">16dp</dimen>
     <dimen name="md_icon_margin">16dp</dimen>
     <dimen name="md_icon_margin">16dp</dimen>
     <dimen name="md_listitem_margin_left">24dp</dimen>
     <dimen name="md_listitem_margin_left">24dp</dimen>

+ 1 - 1
sample/build.gradle

@@ -6,7 +6,7 @@ android {
 
 
     defaultConfig {
     defaultConfig {
         applicationId "com.afollestad.materialdialogssample"
         applicationId "com.afollestad.materialdialogssample"
-        minSdkVersion 10
+        minSdkVersion 11
         targetSdkVersion 21
         targetSdkVersion 21
         versionCode 56
         versionCode 56
         versionName "0.5.0"
         versionName "0.5.0"

+ 1 - 45
sample/src/main/java/com/afollestad/materialdialogssample/MainActivity.java

@@ -120,13 +120,6 @@ public class MainActivity extends ActionBarActivity implements FolderSelectorDia
             }
             }
         });
         });
 
 
-        findViewById(R.id.complex).setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                showComplexListeners();
-            }
-        });
-
         findViewById(R.id.customListItems).setOnClickListener(new View.OnClickListener() {
         findViewById(R.id.customListItems).setOnClickListener(new View.OnClickListener() {
             @Override
             @Override
             public void onClick(View v) {
             public void onClick(View v) {
@@ -212,6 +205,7 @@ public class MainActivity extends ActionBarActivity implements FolderSelectorDia
                 .content(R.string.useGoogleLocationServicesPrompt)
                 .content(R.string.useGoogleLocationServicesPrompt)
                 .positiveText(R.string.speedBoost)
                 .positiveText(R.string.speedBoost)
                 .negativeText(R.string.noThanks)
                 .negativeText(R.string.noThanks)
+                .forceStacking(true)  // this generally should not be forced, but is used for demo purposes
                 .show();
                 .show();
     }
     }
 
 
@@ -326,44 +320,6 @@ public class MainActivity extends ActionBarActivity implements FolderSelectorDia
                 .show();
                 .show();
     }
     }
 
 
-    private void showComplexListeners() {
-        new MaterialDialog.Builder(this)
-                .title(R.string.complex)
-                .positiveText("Yes")
-                .negativeText("No")
-                .neutralText("Maybe")
-                .items(R.array.socialNetworks)
-                .itemsCallbackSingleChoice(0, new MaterialDialog.ListCallback() {
-                    @Override
-                    public void onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) {
-                        Toast.makeText(MainActivity.this, "Clicked " + text, Toast.LENGTH_SHORT).show();
-                    }
-                })
-                .callback(new MaterialDialog.ButtonCallback() {
-                    @Override
-                    public void onNeutral(MaterialDialog dialog) {
-                        Toast.makeText(MainActivity.this, "Maybe", Toast.LENGTH_SHORT).show();
-                    }
-
-                    @Override
-                    public void onNegative(MaterialDialog dialog) {
-                        Toast.makeText(MainActivity.this, "No", Toast.LENGTH_SHORT).show();
-                    }
-
-                    @Override
-                    public void onPositive(MaterialDialog dialog) {
-                        Toast.makeText(MainActivity.this, "Yes", Toast.LENGTH_SHORT).show();
-                    }
-                })
-                .cancelListener(new DialogInterface.OnCancelListener() {
-                    @Override
-                    public void onCancel(DialogInterface dialog) {
-                        Toast.makeText(MainActivity.this, "Canceled", Toast.LENGTH_SHORT).show();
-                    }
-                })
-                .show();
-    }
-
     private void showCustomList() {
     private void showCustomList() {
         MaterialDialog dialog = new MaterialDialog.Builder(this)
         MaterialDialog dialog = new MaterialDialog.Builder(this)
                 .title(R.string.socialNetworks)
                 .title(R.string.socialNetworks)

+ 0 - 7
sample/src/main/res/layout/activity_main.xml

@@ -128,13 +128,6 @@
             android:text="@string/showCancelDismissCallbacks"
             android:text="@string/showCancelDismissCallbacks"
             android:layout_marginTop="@dimen/sample_button_spacing" />
             android:layout_marginTop="@dimen/sample_button_spacing" />
 
 
-        <Button
-            android:id="@+id/complex"
-            android:layout_width="match_parent"
-            android:layout_height="56dp"
-            android:text="@string/complex"
-            android:layout_marginTop="@dimen/sample_button_spacing" />
-
         <Button
         <Button
             android:id="@+id/folder_chooser"
             android:id="@+id/folder_chooser"
             android:layout_width="match_parent"
             android:layout_width="match_parent"

+ 0 - 1
sample/src/main/res/values/strings.xml

@@ -13,7 +13,6 @@
     <string name="list">Basic List</string>
     <string name="list">Basic List</string>
     <string name="singleChoice">Single Choice</string>
     <string name="singleChoice">Single Choice</string>
     <string name="multiChoice">Multi Choice</string>
     <string name="multiChoice">Multi Choice</string>
-    <string name="complex">Complex Listeners</string>
     <string name="customView">Custom View</string>
     <string name="customView">Custom View</string>
     <string name="themed">Themed</string>
     <string name="themed">Themed</string>
     <string name="signalStrength">Signal strength</string>
     <string name="signalStrength">Signal strength</string>