-
Notifications
You must be signed in to change notification settings - Fork 743
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5579 from vector-im/feature/mna/PSF-664-5571-live…
…-location-indicator #5571: Live location status bar indicator
- Loading branch information
Showing
6 changed files
with
127 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Live location sharing: Adding indicator view when enabled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
39 changes: 39 additions & 0 deletions
39
vector/src/main/java/im/vector/app/features/location/live/LocationLiveStatusView.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters