Kaynağa Gözat

A small change for #941

Aidan Follestad 9 yıl önce
ebeveyn
işleme
2b93f7d7fb

+ 11 - 16
core/src/main/java/com/afollestad/materialdialogs/util/DialogUtils.java

@@ -3,7 +3,6 @@ package com.afollestad.materialdialogs.util;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.res.ColorStateList;
-import android.content.res.Resources;
 import android.content.res.TypedArray;
 import android.graphics.Color;
 import android.graphics.drawable.Drawable;
@@ -24,15 +23,15 @@ import com.afollestad.materialdialogs.MaterialDialog;
  */
 public class DialogUtils {
 
-    @SuppressWarnings("ConstantConditions")
-    public static float resolveFloat(Context context, int attr) {
-        TypedArray a = context.obtainStyledAttributes(null, new int[]{attr});
-        try {
-            return a.getFloat(0, 0);
-        } finally {
-            a.recycle();
-        }
-    }
+//    @SuppressWarnings("ConstantConditions")
+//    public static float resolveFloat(Context context, int attr) {
+//        TypedArray a = context.obtainStyledAttributes(null, new int[]{attr});
+//        try {
+//            return a.getFloat(0, 0);
+//        } finally {
+//            a.recycle();
+//        }
+//    }
 
     public static int adjustAlpha(int color, @SuppressWarnings("SameParameterValue") float factor) {
         int alpha = Math.round(Color.alpha(color) * factor);
@@ -228,7 +227,7 @@ public class DialogUtils {
                 dialog.getInputEditText().requestFocus();
                 InputMethodManager imm = (InputMethodManager) builder.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
                 if (imm != null)
-                    imm.hideSoftInputFromWindow(dialog.getInputEditText().getWindowToken(), 0);
+                    imm.hideSoftInputFromWindow(dialog.getCurrentFocus().getWindowToken(), 0);
             }
         });
     }
@@ -256,8 +255,4 @@ public class DialogUtils {
         ta.recycle();
         return colors;
     }
-
-//    public static int getInternalIdentifier(String type, String name) {
-//        return Resources.getSystem().getIdentifier(name, type, "android");
-//    }
-}
+}