Fix attributes style id conflicts

This commit is contained in:
Maxime Naturel 2022-03-03 15:41:05 +01:00
parent 6515e457b5
commit 89db867ab3
3 changed files with 29 additions and 29 deletions

View file

@ -2,12 +2,12 @@
<resources> <resources>
<declare-styleable name="LocationSharingOptionView"> <declare-styleable name="LocationSharingOptionView">
<attr name="icon" format="reference" /> <attr name="locShareIcon" format="reference" />
<attr name="iconBackground" format="reference" /> <attr name="locShareIconBackground" format="reference" />
<attr name="iconBackgroundTint" format="color" /> <attr name="locShareIconBackgroundTint" format="color" />
<attr name="iconPadding" format="dimension" /> <attr name="locShareIconPadding" format="dimension" />
<attr name="iconDescription" format="string" /> <attr name="locShareIconDescription" format="string" />
<attr name="title" format="string" /> <attr name="locShareTitle" format="string" />
</declare-styleable> </declare-styleable>
</resources> </resources>

View file

@ -65,17 +65,17 @@ class LocationSharingOptionView @JvmOverloads constructor(
} }
private fun setIcon(typedArray: TypedArray) { private fun setIcon(typedArray: TypedArray) {
val icon = typedArray.getDrawable(R.styleable.LocationSharingOptionView_icon) val icon = typedArray.getDrawable(R.styleable.LocationSharingOptionView_locShareIcon)
val background = typedArray.getDrawable(R.styleable.LocationSharingOptionView_iconBackground) val background = typedArray.getDrawable(R.styleable.LocationSharingOptionView_locShareIconBackground)
val backgroundTint = typedArray.getColor( val backgroundTint = typedArray.getColor(
R.styleable.LocationSharingOptionView_iconBackgroundTint, R.styleable.LocationSharingOptionView_locShareIconBackgroundTint,
ContextCompat.getColor(context, android.R.color.transparent) ContextCompat.getColor(context, android.R.color.transparent)
) )
val padding = typedArray.getDimensionPixelOffset( val padding = typedArray.getDimensionPixelOffset(
R.styleable.LocationSharingOptionView_iconPadding, R.styleable.LocationSharingOptionView_locShareIconPadding,
context.resources.getDimensionPixelOffset(R.dimen.location_sharing_option_default_padding) context.resources.getDimensionPixelOffset(R.dimen.location_sharing_option_default_padding)
) )
val description = typedArray.getString(R.styleable.LocationSharingOptionView_iconDescription) val description = typedArray.getString(R.styleable.LocationSharingOptionView_locShareIconDescription)
iconView.setImageDrawable(icon) iconView.setImageDrawable(icon)
iconView.background = background iconView.background = background
@ -85,7 +85,7 @@ class LocationSharingOptionView @JvmOverloads constructor(
} }
private fun setTitle(typedArray: TypedArray) { private fun setTitle(typedArray: TypedArray) {
val title = typedArray.getString(R.styleable.LocationSharingOptionView_title) val title = typedArray.getString(R.styleable.LocationSharingOptionView_locShareTitle)
binding.shareLocationOptionTitle.text = title binding.shareLocationOptionTitle.text = title
} }
} }

View file

@ -10,16 +10,16 @@
android:id="@+id/locationSharingOptionPinned" android:id="@+id/locationSharingOptionPinned"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:icon="@drawable/ic_attachment_location_white"
app:iconPadding="11dp"
app:iconBackground="@drawable/circle"
app:iconBackgroundTint="?colorPrimary"
app:iconDescription="@string/a11y_location_share_option_pinned_icon"
app:layout_constraintBottom_toTopOf="@id/locationSharingOptionUserCurrent" app:layout_constraintBottom_toTopOf="@id/locationSharingOptionUserCurrent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:title="@string/location_share_option_pinned" /> app:locShareIcon="@drawable/ic_attachment_location_white"
app:locShareIconBackground="@drawable/circle"
app:locShareIconBackgroundTint="?colorPrimary"
app:locShareIconDescription="@string/a11y_location_share_option_pinned_icon"
app:locShareIconPadding="11dp"
app:locShareTitle="@string/location_share_option_pinned" />
<View <View
android:id="@+id/locationSharingOptionsDivider1" android:id="@+id/locationSharingOptionsDivider1"
@ -36,15 +36,15 @@
android:id="@+id/locationSharingOptionUserCurrent" android:id="@+id/locationSharingOptionUserCurrent"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:iconBackground="@drawable/circle"
app:iconBackgroundTint="?colorPrimary"
app:iconDescription="@string/a11y_location_share_option_user_current_icon"
app:iconPadding="3dp"
app:layout_constraintBottom_toTopOf="@id/locationSharingOptionUserLive" app:layout_constraintBottom_toTopOf="@id/locationSharingOptionUserLive"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/locationSharingOptionPinned" app:layout_constraintTop_toBottomOf="@id/locationSharingOptionPinned"
app:title="@string/location_share_option_user_current" /> app:locShareIconBackground="@drawable/circle"
app:locShareIconBackgroundTint="?colorPrimary"
app:locShareIconDescription="@string/a11y_location_share_option_user_current_icon"
app:locShareIconPadding="3dp"
app:locShareTitle="@string/location_share_option_user_current" />
<View <View
android:id="@+id/locationSharingOptionsDivider2" android:id="@+id/locationSharingOptionsDivider2"
@ -61,15 +61,15 @@
android:id="@+id/locationSharingOptionUserLive" android:id="@+id/locationSharingOptionUserLive"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:icon="@drawable/ic_attachment_location_live_white"
app:iconBackground="@drawable/circle"
app:iconBackgroundTint="?vctr_live_location"
app:iconDescription="@string/a11y_location_share_option_user_live_icon"
app:iconPadding="3dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/locationSharingOptionUserCurrent" app:layout_constraintTop_toBottomOf="@id/locationSharingOptionUserCurrent"
app:title="@string/location_share_option_user_live" /> app:locShareIcon="@drawable/ic_attachment_location_live_white"
app:locShareIconBackground="@drawable/circle"
app:locShareIconBackgroundTint="?vctr_live_location"
app:locShareIconDescription="@string/a11y_location_share_option_user_live_icon"
app:locShareIconPadding="3dp"
app:locShareTitle="@string/location_share_option_user_live" />
</merge> </merge>