forked from github/szkolny
[UI/Settings] Fix profile image button icon background.
This commit is contained in:
parent
7a43ef4dee
commit
a5cbee2b45
@ -4,9 +4,12 @@
|
||||
|
||||
package pl.szczodrzynski.edziennik.ui.dialogs.profile
|
||||
|
||||
import android.content.res.ColorStateList
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.widget.addTextChangedListener
|
||||
import com.google.android.material.color.MaterialColors
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.shape.MaterialShapeDrawable
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
@ -59,6 +62,15 @@ class ProfileConfigDialog(
|
||||
b.profile = profile
|
||||
profile.applyImageTo(b.image)
|
||||
|
||||
// I can't believe how simple it is to get the dialog's background color !!
|
||||
val shape = MaterialShapeDrawable(activity, null, R.attr.alertDialogStyle, R.style.MaterialAlertDialog_MaterialComponents)
|
||||
val surface = MaterialColors.getColor(activity, R.attr.colorSurface, TAG)
|
||||
shape.setCornerSize(18.dp.toFloat())
|
||||
shape.initializeElevationOverlay(activity)
|
||||
shape.fillColor = ColorStateList.valueOf(surface)
|
||||
shape.elevation = 16.dp.toFloat()
|
||||
b.circleView.background = shape
|
||||
|
||||
b.nameEdit.addTextChangedListener {
|
||||
profileChanged = true
|
||||
}
|
||||
|
@ -39,16 +39,22 @@
|
||||
android:scaleType="centerCrop"
|
||||
tools:src="@drawable/face_1" />
|
||||
|
||||
<View
|
||||
android:id="@+id/circleView"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_gravity="bottom|end"
|
||||
tools:background="?colorSurface" />
|
||||
|
||||
<com.mikepenz.iconics.view.IconicsImageView
|
||||
android:id="@+id/imageButtonIcon"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_gravity="bottom|end"
|
||||
app:iiv_background_color="?android:colorBackground"
|
||||
app:iiv_color="?colorOnBackground"
|
||||
app:iiv_corner_radius="18dp"
|
||||
app:iiv_icon="szf-image-plus-outline"
|
||||
app:iiv_padding="5dp" />
|
||||
app:iiv_padding="5dp"
|
||||
tools:background="@color/colorSurface_16dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/imageButton"
|
||||
|
Loading…
x
Reference in New Issue
Block a user