Skip to content

Commit

Permalink
Added delimiterPadding attribute
Browse files Browse the repository at this point in the history
New dimension attribute to allow a larger draggable area around the
arrows. Defaults to original 20.
  • Loading branch information
mudar committed Sep 11, 2017
1 parent 99a8dde commit 4a40f7a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public enum TouchMode {

private int delimiterColor;
private int delimiterWidth;
private int delimiterPadding;
private int arrowColor;
private boolean arrowVisible;
private int arrowWidth;
Expand Down Expand Up @@ -97,6 +98,8 @@ private void initAttrs(AttributeSet attrs) {
drawableRight = a.getDrawable(R.styleable.BifacialView_drawableRight);
delimiterColor = a.getColor(R.styleable.BifacialView_delimiterColor, Color.WHITE);
delimiterWidth = a.getDimensionPixelSize(R.styleable.BifacialView_delimiterWidth,3);
delimiterPadding = a.getDimensionPixelSize(R.styleable.BifacialView_delimiterPadding,
20);
arrowColor = a.getColor(R.styleable.BifacialView_arrowColor, Color.WHITE);
arrowVisible = a.getBoolean(R.styleable.BifacialView_arrowVisibility, false);
leftText = a.getString(R.styleable.BifacialView_leftText);
Expand Down Expand Up @@ -166,7 +169,7 @@ public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
if (touchMode == TouchMode.DELIMITER) {
if (x > delimiterPosition + 20 || x < delimiterPosition - 20) {
if (x > delimiterPosition + delimiterPadding || x < delimiterPosition - delimiterPadding) {
return false;
} else {
getParent().requestDisallowInterceptTouchEvent(true);
Expand Down
1 change: 1 addition & 0 deletions library/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<attr name="drawableRight" format="reference" />
<attr name="delimiterColor" format="color" />
<attr name="delimiterWidth" format="dimension" />
<attr name="delimiterPadding" format="dimension" />
<attr name="arrowColor" format="color" />
<attr name="arrowWidth" format="dimension"/>
<attr name="arrowHeight" format="dimension"/>
Expand Down

0 comments on commit 4a40f7a

Please sign in to comment.