Instagram-like (from broadcasts) double avatar view with cropping
Demo APK: https://petersamokhin.com/files/projects/doubleavatar/dav.apk
- Add
jitpack
repo to your project-levelbuild.gradle
:
allprojects {
repositories {
// other repos
maven { url 'https://jitpack.io' }
}
}
- Add library to your dependencies:
dependencies {
implementation 'com.github.petersamokhin:double-avatar-view:$ACTUAL_VERSION'
}
See last version: https://github.com/petersamokhin/double-avatar-view/releases
Configure view in your xml layout file:
<com.petersamokhin.android.doubleavatarview.DoubleAvatarView
android:id="@+id/dav"
android:layout_width="200dp"
android:layout_height="200dp"
app:cut_size_coeff="1.115"
app:second_size_coeff="2"
app:horizontal_offset="0.15"
app:vertical_offset="0.15" />
Or configure view from Java/Kotlin:
val config = DoubleAvatarView.Config(
"https://back.avatar/",
"https://front.avatar/",
0.15f, // horizontal offset in percents of back image's width
0.15f, // vertical offset in percents of back image's height
2f, // front image radius multiplier
1.115f // front image's cropped background radius multiplier
)
dav.updateConfig(config)