Skip to content

Commit b40bfec

Browse files
committed
Add get methods for public settable values.
1 parent ef34fc4 commit b40bfec

File tree

2 files changed

+69
-4
lines changed

2 files changed

+69
-4
lines changed

blurkit/src/main/java/com/alterac/blurkit/BlurLayout.java

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,14 @@ public void setDownscaleFactor(float downscaleFactor) {
377377
invalidate();
378378
}
379379

380+
/**
381+
* Get downscale factor.
382+
* See {@link #mDownscaleFactor}.
383+
*/
384+
public float getDownscaleFactor() {
385+
return this.mDownscaleFactor;
386+
}
387+
380388
/**
381389
* Sets blur radius to use on downscaled bitmap.
382390
* See {@link #mBlurRadius}.
@@ -391,7 +399,15 @@ public void setBlurRadius(int blurRadius) {
391399
}
392400

393401
/**
394-
* Sets FPS to invalidate blur with.
402+
* Get blur radius to use on downscaled bitmap.
403+
* See {@link #mBlurRadius}.
404+
*/
405+
public int getBlurRadius() {
406+
return this.mBlurRadius;
407+
}
408+
409+
/**
410+
* Sets FPS to invalidate blur.
395411
* See {@link #mFPS}.
396412
*/
397413
public void setFPS(int fps) {
@@ -406,6 +422,14 @@ public void setFPS(int fps) {
406422
}
407423
}
408424

425+
/**
426+
* Get FPS value.
427+
* See {@link #mFPS}.
428+
*/
429+
public int getFPS() {
430+
return this.mFPS;
431+
}
432+
409433
public void setCornerRadius(float cornerRadius) {
410434
this.mCornerRadius = cornerRadius;
411435
if (mImageView != null) {
@@ -414,8 +438,17 @@ public void setCornerRadius(float cornerRadius) {
414438
invalidate();
415439
}
416440

441+
/**
442+
* Get corner radius value.
443+
* See {@link #mFPS}.
444+
*/
445+
public float getCornerRadius() {
446+
return mCornerRadius;
447+
}
448+
417449
/**
418450
* Save the view bitmap to be re-used each frame instead of regenerating.
451+
* See {@link #mViewLocked}.
419452
*/
420453
public void lockView() {
421454
mViewLocked = true;
@@ -435,14 +468,24 @@ public void lockView() {
435468

436469
/**
437470
* Stop using saved view bitmap. View bitmap will now be re-made each frame.
471+
* See {@link #mViewLocked}.
438472
*/
439473
public void unlockView() {
440474
mViewLocked = false;
441475
mLockedBitmap = null;
442476
}
443477

478+
/**
479+
* Get the view locked value.
480+
* See {@link #mViewLocked}.
481+
*/
482+
public boolean getViewLocked() {
483+
return mViewLocked;
484+
}
485+
444486
/**
445487
* Save the view position to be re-used each frame instead of regenerating.
488+
* See {@link #mPositionLocked}.
446489
*/
447490
public void lockPosition() {
448491
mPositionLocked = true;
@@ -451,10 +494,19 @@ public void lockPosition() {
451494

452495
/**
453496
* Stop using saved point. Point will now be re-made each frame.
497+
* See {@link #mPositionLocked}.
454498
*/
455499
public void unlockPosition() {
456500
mPositionLocked = false;
457501
mLockedPoint = null;
458502
}
459503

504+
/**
505+
* Get the locked position value.
506+
* See {@link #mPositionLocked}.
507+
*/
508+
public boolean getPositionLocked() {
509+
return mPositionLocked;
510+
}
511+
460512
}

blurkit/src/main/java/com/alterac/blurkit/RoundedImageView.kt

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ class RoundedImageView : ImageView {
1616
private var rectF: RectF? = null
1717
private var porterDuffXfermode: PorterDuffXfermode? = null
1818

19+
companion object {
20+
const val DEFAULT_COLOR = -0x1000000
21+
}
22+
1923
constructor(context: Context) : super(context, null)
2024
constructor(context: Context, attributes: AttributeSet) : super(context, attributes)
2125

@@ -24,14 +28,17 @@ class RoundedImageView : ImageView {
2428
porterDuffXfermode = PorterDuffXfermode(PorterDuff.Mode.SRC_IN)
2529
}
2630

31+
/**
32+
* Draw the RoundedImageView.
33+
*/
2734
override fun onDraw(canvas: Canvas) {
2835
val myDrawable = drawable
2936
if (myDrawable != null && myDrawable is BitmapDrawable && mCornerRadius > 0) {
3037
val paint = myDrawable.paint
3138

3239
rectF!!.set(myDrawable.bounds)
3340

34-
val prevCount = canvas.saveLayer(rectF, null, Canvas.ALL_SAVE_FLAG)
41+
val prevCount = canvas.saveLayer(rectF, null)
3542

3643
paint.isAntiAlias = true
3744
paint.color = DEFAULT_COLOR
@@ -50,11 +57,17 @@ class RoundedImageView : ImageView {
5057
}
5158
}
5259

60+
/**
61+
* Set corner radius for RoundedImageView.
62+
*/
5363
fun setCornerRadius(cornerRadius: Float) {
5464
this.mCornerRadius = cornerRadius
5565
}
5666

57-
companion object {
58-
const val DEFAULT_COLOR = -0x1000000
67+
/**
68+
* Get corner radius value.
69+
*/
70+
fun getCornerRadius(): Float {
71+
return this.mCornerRadius
5972
}
6073
}

0 commit comments

Comments
 (0)