-
-
Save Airsaid/dbb7d6080d55ad1ce6f67abfe633af1e to your computer and use it in GitHub Desktop.
Custom CircularRevealWidget for ImageView.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.airsaid.revealeffectview | |
import android.annotation.SuppressLint | |
import android.content.Context | |
import android.graphics.Canvas | |
import android.graphics.drawable.Drawable | |
import android.util.AttributeSet | |
import androidx.appcompat.widget.AppCompatImageView | |
import com.google.android.material.circularreveal.CircularRevealHelper | |
import com.google.android.material.circularreveal.CircularRevealWidget | |
/** | |
* @author airsaid | |
*/ | |
class CircularRevealImageView @JvmOverloads constructor( | |
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : AppCompatImageView(context, attrs, defStyleAttr) | |
, CircularRevealWidget { | |
private val helper: CircularRevealHelper = CircularRevealHelper(this) | |
override fun buildCircularRevealCache() { | |
this.helper.buildCircularRevealCache() | |
} | |
override fun destroyCircularRevealCache() { | |
this.helper.destroyCircularRevealCache() | |
} | |
override fun getRevealInfo(): CircularRevealWidget.RevealInfo? { | |
return this.helper.revealInfo | |
} | |
override fun setRevealInfo(revealInfo: CircularRevealWidget.RevealInfo?) { | |
this.helper.revealInfo = revealInfo | |
} | |
override fun getCircularRevealScrimColor(): Int { | |
return this.helper.circularRevealScrimColor | |
} | |
override fun setCircularRevealScrimColor(color: Int) { | |
this.helper.circularRevealScrimColor = color | |
} | |
override fun getCircularRevealOverlayDrawable(): Drawable? { | |
return this.helper.circularRevealOverlayDrawable | |
} | |
override fun setCircularRevealOverlayDrawable(drawable: Drawable?) { | |
this.helper.circularRevealOverlayDrawable = drawable | |
} | |
@SuppressLint("MissingSuperCall") | |
override fun draw(canvas: Canvas) { | |
this.helper.draw(canvas) | |
} | |
override fun actualDraw(canvas: Canvas) { | |
super.draw(canvas) | |
} | |
override fun isOpaque(): Boolean { | |
return this.helper.isOpaque | |
} | |
override fun actualIsOpaque(): Boolean { | |
return super.isOpaque() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment