Skip to content

Commit

Permalink
Allowing the user to specify whether the Window will be focusable or …
Browse files Browse the repository at this point in the history
…not, in case that we have layouts with Input fields inside of the custom layouts we supply to the Tooltip.
  • Loading branch information
milos192 committed Mar 17, 2017
1 parent 122e994 commit 0a34779
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public class SimpleTooltip implements PopupWindow.OnDismissListener {
private final long mAnimationDuration;
private final float mArrowWidth;
private final float mArrowHeight;
private final boolean mFocusable;
private boolean dismissed = false;


Expand Down Expand Up @@ -138,6 +139,7 @@ private SimpleTooltip(Builder builder) {
mAnimationDuration = builder.animationDuration;
mOnDismissListener = builder.onDismissListener;
mOnShowListener = builder.onShowListener;
mFocusable = builder.focusable;
mRootView = (ViewGroup) mAnchorView.getRootView();

init();
Expand All @@ -155,6 +157,7 @@ private void configPopupWindow() {
mPopupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
mPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
mPopupWindow.setClippingEnabled(false);
mPopupWindow.setFocusable(mFocusable);
}


Expand Down Expand Up @@ -551,6 +554,7 @@ public static class Builder {
private int arrowColor;
private float arrowHeight;
private float arrowWidth;
private boolean focusable;

public Builder(Context context) {
this.context = context;
Expand Down Expand Up @@ -970,13 +974,17 @@ public Builder arrowWidth(float arrowWidth) {
}

public Builder onDismissListener(OnDismissListener onDismissListener) {
this.onDismissListener = onDismissListener;
return this;
}

public Builder onShowListener(OnShowListener onShowListener) {
this.onShowListener = onShowListener;
return this;
}

public Builder focusable(boolean focusable) {
this.focusable = focusable;
return this;
}
}
}

0 comments on commit 0a34779

Please sign in to comment.