Skip to content

Commit

Permalink
Merge pull request #5579 from vector-im/feature/mna/PSF-664-5571-live…
Browse files Browse the repository at this point in the history
…-location-indicator

#5571: Live location status bar indicator
  • Loading branch information
mnaturel authored Mar 18, 2022
2 parents 3547c5a + d1aba46 commit 4761f77
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 13 deletions.
1 change: 1 addition & 0 deletions changelog.d/5571.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Live location sharing: Adding indicator view when enabled
11 changes: 11 additions & 0 deletions library/ui-styles/src/main/res/values/styles_location.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="Widget.Vector.Button.Text.OnPrimary.LocationLive">
<item name="android:background">?selectableItemBackground</item>
<item name="android:textSize">12sp</item>
<item name="android:padding">0dp</item>
<item name="android:gravity">center</item>
</style>

</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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 android.widget.Button
import androidx.constraintlayout.widget.ConstraintLayout
import im.vector.app.databinding.ViewLocationLiveStatusBinding

class LocationLiveStatusView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {

private val binding = ViewLocationLiveStatusBinding.inflate(
LayoutInflater.from(context),
this
)

val stopButton: Button
get() = binding.locationLiveStatusStop
}
38 changes: 25 additions & 13 deletions vector/src/main/res/layout/fragment_timeline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="48dp"
android:visibility="gone"/>
android:visibility="gone" />

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/roomToolbar"
Expand Down Expand Up @@ -46,20 +46,32 @@

<im.vector.app.features.sync.widget.SyncStateView
android:id="@+id/syncStateView"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/appBarLayout" />

<im.vector.app.features.location.live.LocationLiveStatusView
android:id="@+id/locationLiveStatusIndicator"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/syncStateView"
tools:visibility="visible" />

<im.vector.app.features.call.conference.RemoveJitsiWidgetView
android:id="@+id/removeJitsiWidgetView"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="?android:colorBackground"
android:minHeight="54dp"
android:visibility="visible"
app:layout_constraintTop_toBottomOf="@id/syncStateView" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/locationLiveStatusIndicator" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/timelineRecyclerView"
Expand All @@ -86,19 +98,19 @@
app:closeIcon="@drawable/ic_close_24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/removeJitsiWidgetView"/>
app:layout_constraintTop_toBottomOf="@id/removeJitsiWidgetView" />

<im.vector.app.core.ui.views.TypingMessageView
android:id="@+id/typingMessageView"
app:layout_constraintBottom_toTopOf="@id/composerLayout"
app:layout_constraintTop_toBottomOf="@id/timelineRecyclerView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_width="0dp"
android:layout_height="20dp"
android:paddingStart="20dp"
android:paddingEnd="20dp"
tools:visibility="visible"
android:layout_height="20dp"/>
app:layout_constraintBottom_toTopOf="@id/composerLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/timelineRecyclerView"
tools:visibility="visible" />

<im.vector.app.core.ui.views.NotificationAreaView
android:id="@+id/notificationAreaView"
Expand All @@ -108,7 +120,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:visibility="visible"/>
tools:visibility="visible" />

<ViewStub
android:id="@+id/failedMessagesWarningStub"
Expand All @@ -130,7 +142,7 @@
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
app:layout_constraintStart_toStartOf="parent" />

<im.vector.app.features.home.room.detail.composer.voice.VoiceMessageRecorderView
android:id="@+id/voiceMessageRecorderView"
Expand Down
49 changes: 49 additions & 0 deletions vector/src/main/res/layout/view_location_live_status.xml
Original file line number Diff line number Diff line change
@@ -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">

<androidx.constraintlayout.helper.widget.Flow
android:id="@+id/locationLiveStatusContainer"
android:layout_width="0dp"
android:layout_height="32dp"
android:background="?colorPrimary"
android:duplicateParentState="true"
android:paddingStart="9dp"
android:paddingEnd="12dp"
app:constraint_referenced_ids="locationLiveStatusIcon,locationLiveStatusTitle"
app:flow_horizontalBias="0"
app:flow_horizontalGap="8dp"
app:flow_horizontalStyle="packed"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

<ImageView
android:id="@+id/locationLiveStatusIcon"
android:layout_width="wrap_content"
android:layout_height="13dp"
app:srcCompat="@drawable/ic_attachment_location_live_white"
tools:ignore="ContentDescription" />

<TextView
android:id="@+id/locationLiveStatusTitle"
style="@style/Widget.Vector.TextView.Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/location_share_live_enabled"
android:textColor="?colorOnPrimary" />

<Button
android:id="@+id/locationLiveStatusStop"
style="@style/Widget.Vector.Button.Text.OnPrimary.LocationLive"
android:layout_width="60dp"
android:layout_height="0dp"
android:text="@string/location_share_live_stop"
app:layout_constraintBottom_toBottomOf="@id/locationLiveStatusContainer"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/locationLiveStatusContainer" />
</merge>
2 changes: 2 additions & 0 deletions vector/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2946,6 +2946,8 @@
<string name="settings_enable_location_sharing_summary">Once enabled you will be able to send your location to any room</string>
<string name="labs_render_locations_in_timeline">Render user locations in the timeline</string>
<string name="location_timeline_failed_to_load_map">Failed to load map</string>
<string name="location_share_live_enabled">Live location enabled</string>
<string name="location_share_live_stop">Stop</string>

<string name="message_bubbles">Show Message bubbles</string>

Expand Down

0 comments on commit 4761f77

Please sign in to comment.