Forráskód Böngészése

Removed the deprecated button callbacks, made action buttons focusable

Aidan Follestad 10 éve
szülő
commit
39415c2644

+ 2 - 27
library/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java

@@ -23,6 +23,7 @@ import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 import android.support.annotation.StringRes;
 import android.text.method.LinkMovementMethod;
+import android.util.Log;
 import android.view.ContextThemeWrapper;
 import android.view.Gravity;
 import android.view.LayoutInflater;
@@ -1432,6 +1433,7 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
     @Deprecated
     @Override
     public Button getButton(int whichButton) {
+        Log.w("MaterialDialog", "Warning: getButton() is a deprecated method that does not return valid references to action buttons.");
         if (whichButton == AlertDialog.BUTTON_POSITIVE) {
             return mBuilder.positiveText != null ? new Button(getContext()) : null;
         } else if (whichButton == AlertDialog.BUTTON_NEUTRAL) {
@@ -1697,33 +1699,6 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
         void onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text);
     }
 
-    /**
-     * @deprecated Use the new {@link com.afollestad.materialdialogs.MaterialDialog.ButtonCallback}
-     */
-    @Deprecated
-    public abstract static class SimpleCallback extends ButtonCallback {
-        @Override
-        public abstract void onPositive(MaterialDialog dialog);
-    }
-
-    /**
-     * @deprecated Use the new {@link com.afollestad.materialdialogs.MaterialDialog.ButtonCallback}
-     */
-    @Deprecated
-    public abstract static class Callback extends SimpleCallback {
-        @Override
-        public abstract void onNegative(MaterialDialog dialog);
-    }
-
-    /**
-     * @deprecated Use the new {@link com.afollestad.materialdialogs.MaterialDialog.ButtonCallback}
-     */
-    @Deprecated
-    public abstract static class FullCallback extends Callback {
-        @Override
-        public abstract void onNeutral(MaterialDialog dialog);
-    }
-
     /**
      * Override these as needed, so no needing to sub empty methods from an interface
      */

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

@@ -35,8 +35,9 @@
     <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:text">@android:string/ok</item>
         <item name="android:layout_gravity">end|center_vertical</item>
+        <item name="android:focusable">true</item>
+        <item name="android:focusableInTouchMode">true</item>
     </style>
 
     <style name="MD_ActionButton.Text">