mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 02:15:35 +03:00
Creating custom view for map loading error
This commit is contained in:
parent
09a91c4541
commit
8f91278d1a
3 changed files with 83 additions and 1 deletions
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
import im.vector.app.databinding.ViewMapLoadingErrorBinding
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom view to display an error when map fails to load.
|
||||||
|
*/
|
||||||
|
class MapLoadingErrorView @JvmOverloads constructor(
|
||||||
|
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||||
|
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
||||||
|
|
||||||
|
init {
|
||||||
|
ViewMapLoadingErrorBinding.inflate(
|
||||||
|
LayoutInflater.from(context),
|
||||||
|
this
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
42
vector/src/main/res/layout/view_map_loading_error.xml
Normal file
42
vector/src/main/res/layout/view_map_loading_error.xml
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<?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="match_parent"
|
||||||
|
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.helper.widget.Flow
|
||||||
|
android:id="@+id/mapLoadingErrorContainer"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:background="?vctr_system"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:constraint_referenced_ids="mapLoadingErrorIcon,mapLoadingErrorDescription"
|
||||||
|
app:flow_verticalGap="12dp"
|
||||||
|
app:flow_verticalStyle="packed"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/mapLoadingErrorIcon"
|
||||||
|
android:layout_width="28dp"
|
||||||
|
android:layout_height="28dp"
|
||||||
|
android:contentDescription="@string/a11y_location_share_option_pinned_icon"
|
||||||
|
tools:src="@drawable/ic_warning_badge" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/mapLoadingErrorDescription"
|
||||||
|
style="@style/TextAppearance.Vector.Body"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/location_share_loading_map_error"
|
||||||
|
android:textColor="?vctr_content_primary"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintWidth_percent="0.8" />
|
||||||
|
|
||||||
|
</merge>
|
|
@ -3113,7 +3113,9 @@
|
||||||
<string name="location_not_available_dialog_title">${app_name} could not access your location</string>
|
<string name="location_not_available_dialog_title">${app_name} could not access your location</string>
|
||||||
<string name="location_not_available_dialog_content">${app_name} could not access your location. Please try again later.</string>
|
<string name="location_not_available_dialog_content">${app_name} could not access your location. Please try again later.</string>
|
||||||
<string name="location_share_external">Open with</string>
|
<string name="location_share_external">Open with</string>
|
||||||
<string name="location_timeline_failed_to_load_map">Failed to load map</string>
|
<!-- TODO remove key -->
|
||||||
|
<string name="location_timeline_failed_to_load_map" tools:ignore="UnusedResources">Failed to load map</string>
|
||||||
|
<string name="location_share_loading_map_error">Unable to load map\nThis home server may not be configured to display maps.</string>
|
||||||
<string name="location_share_live_enabled">Live location enabled</string>
|
<string name="location_share_live_enabled">Live location enabled</string>
|
||||||
<string name="location_share_live_started">Loading live location…</string>
|
<string name="location_share_live_started">Loading live location…</string>
|
||||||
<string name="location_share_live_ended">Live location ended</string>
|
<string name="location_share_live_ended">Live location ended</string>
|
||||||
|
|
Loading…
Reference in a new issue