Fixed invisible avatar in side menu
This commit is contained in:
parent
898d3d0aa4
commit
5f0de830e4
2 changed files with 28 additions and 6 deletions
|
@ -310,6 +310,27 @@ fun setImageViewScaleType(imageView: ImageView, scaleType: ImageView.ScaleType)
|
||||||
imageView.scaleType = scaleType
|
imageView.scaleType = scaleType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@BindingAdapter("glideRoundPath")
|
||||||
|
fun loadRoundImageWithGlide(imageView: ImageView, path: String?) {
|
||||||
|
if (path != null && path.isNotEmpty() && FileUtils.isExtensionImage(path)) {
|
||||||
|
if (corePreferences.vfsEnabled && path.endsWith(FileUtils.VFS_PLAIN_FILE_EXTENSION)) {
|
||||||
|
GlideApp.with(imageView)
|
||||||
|
.load(path)
|
||||||
|
.signature(ObjectKey(coreContext.contactsManager.latestContactFetch))
|
||||||
|
.apply(RequestOptions.circleCropTransform())
|
||||||
|
.into(imageView)
|
||||||
|
} else {
|
||||||
|
GlideApp
|
||||||
|
.with(imageView)
|
||||||
|
.load(path)
|
||||||
|
.apply(RequestOptions.circleCropTransform())
|
||||||
|
.into(imageView)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.w("[Data Binding] [Glide] Can't load $path")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@BindingAdapter("glidePath")
|
@BindingAdapter("glidePath")
|
||||||
fun loadImageWithGlide(imageView: ImageView, path: String?) {
|
fun loadImageWithGlide(imageView: ImageView, path: String?) {
|
||||||
if (path != null && path.isNotEmpty() && FileUtils.isExtensionImage(path)) {
|
if (path != null && path.isNotEmpty() && FileUtils.isExtensionImage(path)) {
|
||||||
|
|
|
@ -46,19 +46,20 @@
|
||||||
android:background="?attr/lightToolbarBackgroundColor">
|
android:background="?attr/lightToolbarBackgroundColor">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:visibility="@{viewModel.defaultAccountFound ? View.VISIBLE : View.GONE}"
|
|
||||||
android:onClick="@{selfPictureClickListener}"
|
|
||||||
android:id="@+id/avatar"
|
android:id="@+id/avatar"
|
||||||
|
glideRoundPath="@{viewModel.defaultAccountAvatar}"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
android:background="@drawable/generated_avatar_bg"
|
android:background="@drawable/generated_avatar_bg"
|
||||||
android:src="@drawable/icon_single_contact_avatar"
|
|
||||||
android:contentDescription="@string/content_description_change_own_picture"
|
android:contentDescription="@string/content_description_change_own_picture"
|
||||||
glideAvatar="@{viewModel.defaultAccountAvatar}" />
|
android:onClick="@{selfPictureClickListener}"
|
||||||
|
android:src="@drawable/icon_single_contact_avatar"
|
||||||
|
android:visibility="@{viewModel.defaultAccountFound ? View.VISIBLE : View.GONE}" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/avatar_border"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
|
@ -70,7 +71,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_toRightOf="@id/avatar"
|
android:layout_toRightOf="@id/avatar_border"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue