From 8f91278d1ada58b8c36294eb0a51122621d96566 Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Fri, 29 Jul 2022 15:58:18 +0200 Subject: [PATCH] Creating custom view for map loading error --- .../features/location/MapLoadingErrorView.kt | 38 +++++++++++++++++ .../res/layout/view_map_loading_error.xml | 42 +++++++++++++++++++ vector/src/main/res/values/strings.xml | 4 +- 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 vector/src/main/java/im/vector/app/features/location/MapLoadingErrorView.kt create mode 100644 vector/src/main/res/layout/view_map_loading_error.xml diff --git a/vector/src/main/java/im/vector/app/features/location/MapLoadingErrorView.kt b/vector/src/main/java/im/vector/app/features/location/MapLoadingErrorView.kt new file mode 100644 index 0000000000..45b7dfd6d6 --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/location/MapLoadingErrorView.kt @@ -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 + ) + } +} diff --git a/vector/src/main/res/layout/view_map_loading_error.xml b/vector/src/main/res/layout/view_map_loading_error.xml new file mode 100644 index 0000000000..dca03bf49b --- /dev/null +++ b/vector/src/main/res/layout/view_map_loading_error.xml @@ -0,0 +1,42 @@ + + + + + + + + + + diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 6b4eec1c9c..142cc3a8d9 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -3113,7 +3113,9 @@ ${app_name} could not access your location ${app_name} could not access your location. Please try again later. Open with - Failed to load map + + Failed to load map + Unable to load map\nThis home server may not be configured to display maps. Live location enabled Loading live location… Live location ended