Adding icon for live location

This commit is contained in:
Maxime Naturel 2022-03-02 10:44:02 +01:00
parent 4586426958
commit 3bbb7167f1
6 changed files with 24 additions and 3 deletions

View File

@ -70,4 +70,7 @@
<item name="ftue_auth_profile_picture_height" format="float" type="dimen">0.15</item>
<item name="ftue_auth_profile_picture_icon_height" format="float" type="dimen">0.05</item>
</resources>
<!-- Location sharing -->
<dimen name="location_sharing_option_default_padding">10dp</dimen>
</resources>

View File

@ -24,6 +24,7 @@ import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.core.graphics.drawable.DrawableCompat
import androidx.core.view.setPadding
import im.vector.app.R
import im.vector.app.databinding.ViewLocationSharingOptionBinding
@ -76,6 +77,10 @@ class LocationSharingOptionView @JvmOverloads constructor(
R.styleable.LocationSharingOptionView_iconBackgroundTint,
ContextCompat.getColor(context, android.R.color.transparent)
)
val padding = typedArray.getDimensionPixelOffset(
R.styleable.LocationSharingOptionView_iconPadding,
context.resources.getDimensionPixelOffset(R.dimen.location_sharing_option_default_padding)
)
val description = typedArray.getString(R.styleable.LocationSharingOptionView_iconDescription)
binding.shareLocationOptionIcon.setImageDrawable(icon)
@ -85,6 +90,7 @@ class LocationSharingOptionView @JvmOverloads constructor(
backgroundDrawable
} ?: background
binding.shareLocationOptionIcon.background = bkg
binding.shareLocationOptionIcon.setPadding(padding)
binding.shareLocationOptionIcon.contentDescription = description
}

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="30dp"
android:height="16dp"
android:viewportWidth="30"
android:viewportHeight="16">
<path
android:pathData="M4.6144,14.8367C4.9699,14.4812 5.0048,13.9165 4.6841,13.533C2.007,10.2772 2.007,5.5504 4.6771,2.2877C4.9978,1.8973 4.9699,1.3256 4.6144,0.97C4.2031,0.5587 3.5198,0.5866 3.1503,1.0398C-0.1054,5.0206 -0.1054,10.7792 3.1503,14.767C3.5129,15.2202 4.1961,15.255 4.6144,14.8367ZM7.424,12.0271C7.7656,11.6855 7.8004,11.1487 7.5146,10.7513C6.3085,9.0502 6.3085,6.7635 7.5146,5.0624C7.7935,4.665 7.7656,4.1282 7.424,3.7866L7.417,3.7796C6.9987,3.3613 6.2876,3.3892 5.946,3.8703C4.21,6.2685 4.21,9.5382 5.946,11.9435C6.2945,12.4245 6.9987,12.4524 7.424,12.0271ZM15.3488,1.3771C12.6508,1.3771 10.4686,3.6186 10.4686,6.3901C10.4686,9.3764 13.5501,13.4943 14.819,15.0626C15.0978,15.4064 15.6068,15.4064 15.8856,15.0626C17.1475,13.4943 20.229,9.3764 20.229,6.3901C20.229,3.6186 18.0468,1.3771 15.3488,1.3771ZM15.3488,8.1805C14.3867,8.1805 13.6059,7.3784 13.6059,6.3901C13.6059,5.4018 14.3867,4.5997 15.3488,4.5997C16.3109,4.5997 17.0917,5.4018 17.0917,6.3901C17.0917,7.3784 16.3109,8.1805 15.3488,8.1805ZM25.3431,13.533C25.0224,13.9165 25.0573,14.4812 25.4128,14.8367C25.8311,15.255 26.5144,15.2202 26.8769,14.767C30.1327,10.7792 30.1327,5.0206 26.8769,1.0398C26.5074,0.5866 25.8242,0.5587 25.4128,0.97C25.0573,1.3256 25.0294,1.8973 25.3501,2.2877C28.0203,5.5504 28.0203,10.2772 25.3431,13.533ZM22.5126,10.7513C22.2268,11.1487 22.2616,11.6855 22.6033,12.0271C23.0285,12.4524 23.7327,12.4245 24.0813,11.9435C25.8172,9.5382 25.8172,6.2685 24.0813,3.8703C23.7396,3.3892 23.0285,3.3613 22.6102,3.7796L22.6033,3.7866C22.2616,4.1282 22.2338,4.665 22.5126,5.0624C23.7187,6.7635 23.7187,9.0502 22.5126,10.7513Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
</vector>

View File

@ -26,9 +26,9 @@
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/a11y_location_share_icon"
android:padding="10dp"
tools:background="@drawable/circle"
tools:backgroundTint="?colorPrimary"
tools:padding="10dp"
tools:src="@drawable/ic_attachment_location_white" />
<TextView

View File

@ -41,10 +41,11 @@
android:id="@+id/locationSharingOptionUserLiveLocation"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:icon="@drawable/ic_attachment_location_white"
app:icon="@drawable/ic_attachment_location_live_white"
app:iconBackground="@drawable/circle"
app:iconBackgroundTint="?colorPrimary"
app:iconDescription="@string/a11y_location_share_icon"
app:iconPadding="3dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

View File

@ -4,6 +4,7 @@
<attr name="icon" format="reference" />
<attr name="iconBackground" format="reference" />
<attr name="iconBackgroundTint" format="color" />
<attr name="iconPadding" format="dimension" />
<attr name="iconDescription" format="string" />
<attr name="title" format="string" />
</declare-styleable>