Jelajahi Sumber

Another update to ColorChooserDialog

Aidan Follestad 9 tahun lalu
induk
melakukan
27172bae9b

+ 2 - 2
sample/src/main/java/com/afollestad/materialdialogssample/ColorChooserDialog.java

@@ -352,7 +352,7 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
     }
 
     public interface ColorCallback {
-        void onColorSelection(@ColorInt int topLevelColor, @ColorInt int subLevelColor);
+        void onColorSelection(@StringRes int dialogTitle, @ColorInt int topLevelColor, @ColorInt int subLevelColor);
     }
 
     @NonNull
@@ -410,7 +410,7 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
                             topLevelColor = TOP_LEVEL_COLORS[topIndex()];
                         if (subIndex() > -1)
                             subLevelColor = SUB_LEVEL_COLORS[topIndex()][subIndex()];
-                        mCallback.onColorSelection(topLevelColor, subLevelColor);
+                        mCallback.onColorSelection(getArguments().getInt("title", 0), topLevelColor, subLevelColor);
                         dismiss();
                     }
 

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

@@ -572,7 +572,7 @@ public class MainActivity extends AppCompatActivity implements
     }
 
     @Override
-    public void onColorSelection(int topLevelColor, int subLevelColor) {
+    public void onColorSelection(@StringRes int dialogTitle, int topLevelColor, int subLevelColor) {
         this.topLevelColor = topLevelColor;
         this.subLevelColor = subLevelColor;
         int color = topLevelColor;