Skip to content

Commit 11a8e42

Browse files
committedNov 6, 2024
blured background on image
1 parent 979617d commit 11a8e42

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
 

‎app/src/main/java/fr/nuage/souvenirs/view/DataBindingAdapters.java

+13
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ public static void setSrcCompatZoomOffset(ImageElementView view, String imagePat
5454
}
5555
}
5656

57+
@BindingAdapter(value = { "srcCompat"}, requireAll=false)
58+
public static void setSrcCompatZoomOffset(ImageView view, String imagePath) {
59+
if (imagePath != null) {
60+
if (imagePath.equals("")) {
61+
view.setImageDrawable(ContextCompat.getDrawable(view.getContext(),R.drawable.ic_image_black_24dp));
62+
} else {
63+
Glide.with(view.getContext()).load(new File(imagePath)).into(view);
64+
}
65+
} else {
66+
view.setImageDrawable(null);
67+
}
68+
}
69+
5770
@BindingAdapter(value = { "srcCompat" }, requireAll=false)
5871
public static void setSrcCompatZoomOffset(PaintElementView view, String imagePath) {
5972
if (imagePath != null) {

‎app/src/main/res/layout/image_element_view.xml

+8
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@
2626
app:layout_constraintStart_toEndOf="parent"
2727
app:layout_constraintTop_toBottomOf="parent">
2828

29+
<ImageView
30+
android:id="@+id/image_background"
31+
android:layout_width="match_parent"
32+
android:layout_height="match_parent"
33+
android:alpha="0.2"
34+
app:srcCompat="@{element.zoom >= 100 ? null : element.imagePath}"
35+
tools:visibility="visible" />
36+
2937
<fr.nuage.souvenirs.view.ImageElementView
3038
android:id="@+id/image_imageview"
3139
android:layout_width="match_parent"

0 commit comments

Comments
 (0)
Failed to load comments.