Skip to content

Commit a277daf

Browse files
author
roman_tcaregorodtcev
committed
OmegaCircleImageView added
1 parent 7849f68 commit a277daf

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

omegaviwslibs/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ dependencies {
3131
implementation fileTree(dir: 'libs', include: ['*.jar'])
3232
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
3333
implementation 'com.github.Omega-R.OmegaTypes:omegatypes:1.0.0'
34+
implementation 'de.hdodenhof:circleimageview:3.0.0'
3435

3536
implementation 'androidx.appcompat:appcompat:1.0.2'
3637

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.omega_r.libs.views
2+
3+
import android.content.Context
4+
import android.graphics.drawable.Drawable
5+
import android.os.Build.VERSION.SDK_INT
6+
import android.os.Build.VERSION_CODES.LOLLIPOP
7+
import android.util.AttributeSet
8+
import de.hdodenhof.circleimageview.CircleImageView
9+
10+
open class OmegaCircleImageView @JvmOverloads constructor(
11+
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = R.attr.omegaCircleImageViewStyle
12+
) : CircleImageView(context, attrs, defStyleAttr) {
13+
14+
override fun setImageDrawable(drawable: Drawable?) {
15+
super.setImageDrawable(drawable)
16+
if (SDK_INT >= LOLLIPOP) invalidateOutline()
17+
}
18+
19+
}

omegaviwslibs/src/main/res/values/attrs.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33

4+
<declare-styleable name="styles">
5+
<attr name="omegaCircleImageViewStyle" format="reference"/>
6+
</declare-styleable>
7+
48
<declare-styleable name="OmegaTextView">
59
<attr name="startText" format="string" localization="suggested"/>
610
<attr name="endText" format="string" localization="suggested"/>

0 commit comments

Comments
 (0)