Skip to content

Commit

Permalink
Merge pull request #2 from hendrawd/master
Browse files Browse the repository at this point in the history
Enable chaining calls when setting properties
  • Loading branch information
antoxa2584x committed Aug 23, 2017
2 parents 9e38ac4 + 3f85fe4 commit 986660d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 28 deletions.
30 changes: 15 additions & 15 deletions README.md
Expand Up @@ -50,21 +50,21 @@ Installation

### In Your Code
```java
PinCodeView pinCodeView = new PinCodeView(this);
pinCodeView.setLockType(LOCK_TYPE.ENTER_PIN);
pinCodeView.setPinEnteredListener(this);
pinCodeView.setPinReEnterListener(this);
pinCodeView.setPinMismatchListener(this);
pinCodeView.setInnerCircleColor(color);
pinCodeView.setOuterCircleColor(color);
pinCodeView.setErrorColor(color);
pinCodeView.setLockType(isChecked ? LOCK_TYPE.ENTER_PIN : LOCK_TYPE.UNLOCK);
pinCodeView.setPinLenght(lenght);
pinCodeView.setInnerAlpha(1);
pinCodeView.setTintInner(false);
pinCodeView.setTintOuter(false);
pinCodeView.setInnerDrawable(ContextCompat.getDrawable(this, R.drawable.circle));
pinCodeView.setOuterDrawable(ContextCompat.getDrawable(this, R.drawable.circle));
PinCodeView pinCodeView = new PinCodeView(this)
.setLockType(LOCK_TYPE.ENTER_PIN)
.setPinEnteredListener(this)
.setPinReEnterListener(this)
.setPinMismatchListener(this)
.setInnerCircleColor(color)
.setOuterCircleColor(color)
.setErrorColor(color)
.setLockType(isChecked ? LOCK_TYPE.ENTER_PIN : LOCK_TYPE.UNLOCK)
.setPinLenght(lenght)
.setInnerAlpha(1)
.setTintInner(false)
.setTintOuter(false)
.setInnerDrawable(ContextCompat.getDrawable(this, R.drawable.circle))
.setOuterDrawable(ContextCompat.getDrawable(this, R.drawable.circle));
```

## Changelog
Expand Down
Expand Up @@ -295,65 +295,78 @@ public void onClick(View v) {
*
* @param lockType
*/
public void setLockType(LOCK_TYPE lockType) {
public PinCodeView setLockType(LOCK_TYPE lockType) {
this.lockType = lockType;
this.pass = null;
clear();
return this;
}

public void setInnerCircleColor(@ColorInt int innerCircleColor) {
public PinCodeView setInnerCircleColor(@ColorInt int innerCircleColor) {
this.innerCircleColor = innerCircleColor;
setUpPins();
return this;
}

public void setOuterCircleColor(@ColorInt int outerCircleColor) {
public PinCodeView setOuterCircleColor(@ColorInt int outerCircleColor) {
this.outerCircleColor = outerCircleColor;
setUpPins();
return this;
}

public void setErrorColor(@ColorInt int errorColor) {
public PinCodeView setErrorColor(@ColorInt int errorColor) {
this.errorColor = errorColor;
return this;
}

public void setPinLenght(int pinCount) {
public PinCodeView setPinLenght(int pinCount) {
this.pinCount = pinCount;
setUpPins();
return this;
}

public void setInnerDrawable(Drawable innerDrawable) {
public PinCodeView setInnerDrawable(Drawable innerDrawable) {
this.innerDrawable = innerDrawable;
setUpPins();
return this;
}

public void setOuterDrawable(Drawable outerDrawable) {
public PinCodeView setOuterDrawable(Drawable outerDrawable) {
this.outerDrawable = outerDrawable;
setUpPins();
return this;
}

public void setInnerAlpha(float innerAlpha) {
public PinCodeView setInnerAlpha(float innerAlpha) {
this.innerAlpha = innerAlpha;
setUpPins();
return this;
}

public void setTintInner(boolean tintInner) {
public PinCodeView setTintInner(boolean tintInner) {
this.tintInner = tintInner;
setUpPins();
return this;
}

public void setTintOuter(boolean tintOuter) {
public PinCodeView setTintOuter(boolean tintOuter) {
this.tintOuter = tintOuter;
setUpPins();
return this;
}

public void setPinEnteredListener(Listeners.PinEnteredListener pinEnteredListener) {
public PinCodeView setPinEnteredListener(Listeners.PinEnteredListener pinEnteredListener) {
this.pinEnteredListener = pinEnteredListener;
return this;
}

public void setPinMismatchListener(Listeners.PinMismatchListener pinMismatchListener) {
public PinCodeView setPinMismatchListener(Listeners.PinMismatchListener pinMismatchListener) {
this.pinMismatchListener = pinMismatchListener;
return this;
}

public void setPinReEnterListener(Listeners.PinReEnterListener pinReEnterListener) {
public PinCodeView setPinReEnterListener(Listeners.PinReEnterListener pinReEnterListener) {
this.pinReEnterListener = pinReEnterListener;
return this;
}
}

0 comments on commit 986660d

Please sign in to comment.