Skip to content

Commit

Permalink
Fix #2, view parent is unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
duanhong169 committed Sep 7, 2018
1 parent a2cd044 commit 31604fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void popup(View v) {
.showIndicator(true)
.showValue(true)
.build()
.show(v, new ColorPickerPopup.ColorPickerObserver() {
.show(new ColorPickerPopup.ColorPickerObserver() {
@Override
public void onColorPicked(int color) {
v.setBackgroundColor(color);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ private ColorPickerPopup(Builder builder) {
this.showValue = builder.showValue;
}

public void show(final ColorPickerObserver observer) {
show(null, observer);
}

public void show(View parent, final ColorPickerObserver observer) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(LAYOUT_INFLATER_SERVICE);
if (inflater == null) return;
Expand Down Expand Up @@ -93,6 +97,7 @@ public void onColor(int color, boolean fromUser) {
}

popupWindow.setAnimationStyle(R.style.TopDefaultsViewColorPickerPopupAnimation);
if (parent == null) parent = layout;
popupWindow.showAtLocation(parent, Gravity.CENTER, 0, 0);
}

Expand Down

0 comments on commit 31604fb

Please sign in to comment.