Banner view for ended live

This commit is contained in:
Maxime NATUREL 2022-07-25 09:49:18 +02:00
parent 1276b12188
commit 732582b6fe
5 changed files with 90 additions and 113 deletions

View File

@ -42,7 +42,7 @@ abstract class MessageLiveLocationInactiveItem :
override fun getViewStubId() = STUB_ID
class Holder : AbsMessageItem.Holder(STUB_ID) {
val bannerImageView by bind<ImageView>(R.id.locationLiveInactiveBanner)
val bannerImageView by bind<ImageView>(R.id.locationLiveEndedBannerBackground)
val noLocationMapImageView by bind<ImageView>(R.id.locationLiveInactiveMap)
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2022 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.features.location.live
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import im.vector.app.databinding.ViewLocationLiveEndedBannerBinding
class LocationLiveEndedBannerView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
init {
ViewLocationLiveEndedBannerBinding.inflate(
LayoutInflater.from(context),
this
)
}
}

View File

@ -15,16 +15,13 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/locationLiveInactiveBanner"
<im.vector.app.features.location.live.LocationLiveEndedBannerView
android:id="@+id/locationLiveEndedBanner"
android:layout_width="0dp"
android:layout_height="48dp"
android:alpha="0.75"
android:src="?android:colorBackground"
app:layout_constraintBottom_toBottomOf="@id/locationLiveInactiveMap"
app:layout_constraintEnd_toEndOf="@id/locationLiveInactiveMap"
app:layout_constraintStart_toStartOf="@id/locationLiveInactiveMap"
tools:ignore="ContentDescription" />
app:layout_constraintStart_toStartOf="@id/locationLiveInactiveMap" />
<ImageView
android:id="@+id/locationLiveInactiveIcon"
@ -37,37 +34,6 @@
app:tint="?vctr_content_quaternary"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/locationLiveInactiveBannerIcon"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_marginVertical="8dp"
android:layout_marginStart="8dp"
android:background="@drawable/circle"
android:backgroundTint="?vctr_content_quaternary"
android:padding="3dp"
app:layout_constraintBottom_toBottomOf="@id/locationLiveInactiveBanner"
app:layout_constraintStart_toStartOf="@id/locationLiveInactiveBanner"
app:layout_constraintTop_toTopOf="@id/locationLiveInactiveBanner"
app:srcCompat="@drawable/ic_attachment_location_live_white"
app:tint="?android:colorBackground"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/locationLiveInactiveTitle"
style="@style/Widget.Vector.TextView.Caption"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:lines="1"
android:text="@string/location_share_live_ended"
android:ellipsize="end"
android:textColor="?vctr_content_tertiary"
app:layout_constraintBottom_toBottomOf="@id/locationLiveInactiveBanner"
app:layout_constraintStart_toEndOf="@id/locationLiveInactiveBannerIcon"
app:layout_constraintEnd_toEndOf="@id/locationLiveInactiveBanner"
app:layout_constraintTop_toTopOf="@id/locationLiveInactiveBanner" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/locationLiveInactiveVerticalCenter"
android:layout_width="wrap_content"

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<ImageView
android:id="@+id/locationLiveEndedBannerBackground"
android:layout_width="0dp"
android:layout_height="48dp"
android:alpha="0.75"
android:src="?android:colorBackground"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/locationLiveEndedBannerIcon"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_marginVertical="8dp"
android:layout_marginStart="8dp"
android:background="@drawable/circle"
android:backgroundTint="?vctr_content_quaternary"
android:padding="3dp"
app:layout_constraintBottom_toBottomOf="@id/locationLiveEndedBannerBackground"
app:layout_constraintStart_toStartOf="@id/locationLiveEndedBannerBackground"
app:layout_constraintTop_toTopOf="@id/locationLiveEndedBannerBackground"
app:srcCompat="@drawable/ic_attachment_location_live_white"
app:tint="?android:colorBackground"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/locationLiveEndedTitle"
style="@style/Widget.Vector.TextView.Caption"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:ellipsize="end"
android:lines="1"
android:text="@string/location_share_live_ended"
android:textColor="?vctr_content_tertiary"
app:layout_constraintBottom_toBottomOf="@id/locationLiveEndedBannerBackground"
app:layout_constraintEnd_toEndOf="@id/locationLiveEndedBannerBackground"
app:layout_constraintStart_toEndOf="@id/locationLiveEndedBannerIcon"
app:layout_constraintTop_toTopOf="@id/locationLiveEndedBannerBackground" />
</merge>

View File

@ -1,75 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<ImageView
android:id="@+id/locationLiveMessageBannerBackground"
android:layout_width="0dp"
android:layout_height="50dp"
android:alpha="0.75"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:background="?android:colorBackground"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/locationLiveMessageBannerIcon"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginHorizontal="8dp"
android:background="@drawable/circle"
android:backgroundTint="?vctr_live_location"
android:padding="3dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@id/locationLiveMessageBannerBackground"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_attachment_location_live_white"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/locationLiveMessageBannerTitle"
style="@style/Widget.Vector.TextView.Caption"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:ellipsize="end"
android:lines="1"
android:textColor="?colorOnSurface"
app:layout_constraintBottom_toTopOf="@id/locationLiveMessageBannerSubTitle"
app:layout_constraintEnd_toStartOf="@id/locationLiveMessageBannerStop"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toEndOf="@id/locationLiveMessageBannerIcon"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="@string/location_share_live_enabled" />
<TextView
android:id="@+id/locationLiveMessageBannerSubTitle"
style="@style/Widget.Vector.TextView.Caption"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:lines="1"
android:textColor="?vctr_content_secondary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/locationLiveMessageBannerTitle"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="@id/locationLiveMessageBannerTitle"
app:layout_constraintTop_toBottomOf="@id/locationLiveMessageBannerTitle"
tools:text="9min left" />
<Button
android:id="@+id/locationLiveMessageBannerStop"
style="@style/Widget.Vector.Button.Text.LocationLive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/location_share_live_stop"
app:layout_constraintBottom_toBottomOf="@id/locationLiveMessageBannerBackground"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/locationLiveMessageBannerBackground" />
</merge>