Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.esafirm.imagepicker.adapter
import android.content.Context
import android.net.Uri
import android.provider.MediaStore
import android.util.TypedValue
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
Expand Down Expand Up @@ -94,10 +95,12 @@ class ImagePickerAdapter(
addSelected(image, position)
}
}
container?.foreground = if (isSelected) ContextCompat.getDrawable(
context,
R.drawable.ef_ic_done_white
) else null
container?.foreground = if (isSelected) {
val typedValue = TypedValue()
context.theme.resolveAttribute(R.attr.ef_selected_image_overlay, typedValue, true)
val imageResId = typedValue.resourceId
ContextCompat.getDrawable(context, imageResId) ?: throw IllegalArgumentException("Cannot load drawable $imageResId")
} else null
}
}

Expand Down
3 changes: 3 additions & 0 deletions imagepicker/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<attr name="ef_selected_image_overlay" format="reference" />
</resources>
1 change: 1 addition & 0 deletions imagepicker/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<item name="colorPrimary">@color/ef_colorPrimary</item>
<item name="colorPrimaryDark">@color/ef_colorPrimaryDark</item>
<item name="colorAccent">@color/ef_colorAccent</item>
<item name="ef_selected_image_overlay">@drawable/ef_ic_done_white</item>
</style>

<style name="ef_CustomToolbarTheme" parent="Base.ThemeOverlay.AppCompat.ActionBar">
Expand Down