Merge pull request #8718 from osmandapp/fix_slope_hillshade_ui

Fix slope hillshade ui
This commit is contained in:
vshcherb 2020-03-27 18:49:20 +01:00 committed by GitHub
commit d983309242
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 534 additions and 495 deletions

View file

@ -3,7 +3,7 @@
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<corners android:bottomLeftRadius="4dp" android:topLeftRadius="4dp" />
<corners android:radius="4dp" />
<stroke android:width="1dp" android:color="?attr/secondary_icon_color" />
</shape>
</item>

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/switch_button_active" />
<corners android:bottomLeftRadius="4dp" android:topLeftRadius="4dp" />
<stroke android:width="1dp" android:color="@color/switch_button_active_stroke" />
</shape>
</item>
</selector>

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/switch_button_active" />
<corners android:bottomRightRadius="4dp" android:topRightRadius="4dp" />
<stroke android:width="1dp" android:color="@color/switch_button_active_stroke" />
</shape>
</item>
</selector>

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<corners android:bottomRightRadius="4dp" android:topRightRadius="4dp" />
<stroke android:width="1dp" android:color="?attr/secondary_icon_color" />
</shape>
</item>
</selector>

View file

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:descendantFocusability="blocksDescendants"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:background="?attr/activity_background_basic"
android:orientation="vertical">
<LinearLayout
@ -13,458 +13,498 @@
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
<ImageView
android:id="@+id/shadow_on_map"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="@dimen/content_padding_half"
android:paddingBottom="@dimen/content_padding_half">
android:scaleType="fitXY"
android:src="@drawable/bg_shadow_onmap" />
<ImageView
android:id="@+id/icon_iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding"
tools:src="@drawable/ic_action_hillshade_dark" />
<LinearLayout
android:background="?attr/activity_background_basic"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="@dimen/setting_list_item_large_height"
android:background="?attr/bg_color"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingStart="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
tools:text="Terrain" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/state_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="Enabled" />
</LinearLayout>
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/switch_compat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding" />
</LinearLayout>
<include
android:id="@+id/titleBottomDivider"
layout="@layout/card_bottom_divider"
tools:visibility="gone" />
<LinearLayout
android:id="@+id/content_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:baselineAligned="false"
android:orientation="horizontal">
<FrameLayout
android:id="@+id/hillshade_btn_container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
tools:background="@drawable/btn_border_left_active">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/hillshade_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:text="@string/shared_string_hillshade"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold" />
</FrameLayout>
<FrameLayout
android:id="@+id/slope_btn_container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/slope_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:text="@string/shared_string_slope"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"
tools:background="@drawable/btn_border_right_inactive" />
</FrameLayout>
</LinearLayout>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="Hillshade map using dark shades to show slopes, peaks and lowlands." />
</LinearLayout>
<include layout="@layout/card_top_divider" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_small"
android:paddingEnd="@dimen/content_padding">
<net.osmand.plus.widgets.TextViewEx
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/shared_string_transparency"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/transparency_value_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="25%" />
</LinearLayout>
<com.google.android.material.slider.Slider
android:id="@+id/transparency_slider"
style="@style/Widget.MaterialComponents.Slider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/list_header_settings_top_margin"
android:stepSize="1"
android:theme="@style/Theme.MaterialComponents"
app:haloRadius="@dimen/slider_thumb_halo_size"
app:thumbRadius="@dimen/slider_thumb_size"
app:tickColor="@android:color/transparent"
app:trackHeight="@dimen/slider_track_height" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginTop="@dimen/content_padding_half"
android:background="?attr/dashboard_divider"
android:focusable="false" />
<net.osmand.plus.widgets.TextViewEx
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/content_padding"
android:paddingTop="@dimen/list_header_settings_top_margin"
android:paddingEnd="@dimen/content_padding"
android:text="@string/shared_string_zoom_levels"
android:textColor="@color/preference_category_title"
android:textSize="@dimen/default_desc_text_size" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingBottom="@dimen/content_padding_half">
<net.osmand.plus.widgets.TextViewEx
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="start"
android:text="Min"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size" />
<net.osmand.plus.widgets.TextViewEx
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="end"
android:text="Max"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/zoom_value_min"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="start"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="3" />
<com.google.android.material.slider.Slider
android:id="@+id/zoom_slider"
style="@style/Widget.MaterialComponents.Slider"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:stepSize="1"
app:tickColor="@color/color_black"
android:theme="@style/Theme.MaterialComponents"
app:haloRadius="@dimen/slider_thumb_halo_size"
app:thumbRadius="@dimen/slider_thumb_size"
app:trackHeight="@dimen/slider_track_height" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/zoom_value_max"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="19" />
</LinearLayout>
<net.osmand.plus.widgets.TextViewEx
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding"
android:text="@string/terrain_slider_description"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size" />
</LinearLayout>
<include layout="@layout/card_bottom_divider" />
<include
android:id="@+id/legend_top_divider"
layout="@layout/card_top_divider" />
<LinearLayout
android:id="@+id/legend_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/content_padding"
android:paddingTop="@dimen/list_header_settings_top_margin"
android:paddingBottom="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:text="@string/shared_string_legend"
android:textColor="@color/preference_category_title"
android:textSize="@dimen/default_desc_text_size" />
android:orientation="horizontal">
<ImageView
android:id="@+id/icon_iv"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/img_legend_slope" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/slope_read_more_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="@string/slope_read_more" />
</LinearLayout>
<include
android:id="@+id/legend_bottom_divider"
layout="@layout/card_bottom_divider" />
<include
android:id="@+id/download_container_top_divider"
layout="@layout/card_top_divider" />
<LinearLayout
android:id="@+id/download_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/content_padding"
android:paddingTop="@dimen/list_header_settings_top_margin"
android:paddingEnd="@dimen/content_padding"
android:text="@string/welmode_download_maps"
android:textColor="@color/preference_category_title"
android:textSize="@dimen/default_desc_text_size" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/download_description_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="@string/hillshade_download_description" />
<com.github.ksoichiro.android.observablescrollview.ObservableListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@null"
android:fadeScrollbars="true" />
</LinearLayout>
<include
android:id="@+id/download_container_bottom_divider"
layout="@layout/card_bottom_divider" />
</LinearLayout>
<LinearLayout
android:id="@+id/empty_state"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding_small">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/empty_state_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/img_empty_state_terrain" />
tools:src="@drawable/ic_action_hillshade_dark" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingStart="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding">
<FrameLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="Terrain" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|bottom"
android:layout_margin="@dimen/content_padding_half"
android:background="@drawable/bg_dark_transp"
android:gravity="start|bottom"
android:padding="@dimen/map_button_margin"
android:text="@string/shared_string_hillshade"
android:textColor="@color/color_white" />
</FrameLayout>
<FrameLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|bottom"
android:layout_margin="@dimen/content_padding_half"
android:background="@drawable/bg_dark_transp"
android:gravity="start|bottom"
android:padding="@dimen/map_button_margin"
android:text="@string/shared_string_slope"
android:textColor="@color/color_white" />
</FrameLayout>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/state_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="Enabled" />
</LinearLayout>
</FrameLayout>
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/switch_compat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/empty_state_description"
</LinearLayout>
<include
android:id="@+id/titleBottomDivider"
layout="@layout/card_bottom_divider"
tools:visibility="gone" />
<LinearLayout
android:id="@+id/content_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginBottom="@dimen/content_padding"
android:gravity="start"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="@string/terrain_empty_state_text" />
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dialog_button_height"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:background="@drawable/btn_bg_border_inactive"
android:baselineAligned="false"
android:orientation="horizontal">
<FrameLayout
android:id="@+id/hillshade_btn_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/hillshade_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:text="@string/shared_string_hillshade"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold" />
</FrameLayout>
<FrameLayout
android:id="@+id/slope_btn_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/slope_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:text="@string/shared_string_slope"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold" />
</FrameLayout>
</LinearLayout>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginTop="@dimen/content_padding_small"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginBottom="@dimen/content_padding_small"
android:lineSpacingExtra="@dimen/line_spacing_extra_description"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="Hillshade map using dark shades to show slopes, peaks and lowlands." />
</LinearLayout>
<include layout="@layout/card_bottom_divider" />
<include layout="@layout/card_top_divider" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_small"
android:paddingEnd="@dimen/content_padding">
<net.osmand.plus.widgets.TextViewEx
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:lineSpacingExtra="@dimen/line_spacing_extra_description"
android:text="@string/shared_string_transparency"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/transparency_value_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lineSpacingExtra="@dimen/line_spacing_extra_description"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="25%" />
</LinearLayout>
<com.google.android.material.slider.Slider
android:id="@+id/transparency_slider"
style="@style/Widget.MaterialComponents.Slider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/list_header_settings_top_margin"
android:paddingBottom="@dimen/dialog_content_margin"
android:stepSize="1"
android:theme="@style/Theme.MaterialComponents"
app:haloRadius="@dimen/slider_thumb_size"
app:thumbRadius="@dimen/slider_thumb_size"
app:tickColor="@android:color/transparent"
app:trackHeight="@dimen/slider_track_height" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding"
android:background="?attr/dashboard_divider"
android:focusable="false" />
<net.osmand.plus.widgets.TextViewEx
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:letterSpacing="@dimen/description_letter_spacing"
android:paddingStart="@dimen/content_padding"
android:paddingTop="@dimen/list_header_settings_top_margin"
android:paddingEnd="@dimen/content_padding"
android:text="@string/shared_string_zoom_levels"
android:textColor="@color/preference_category_title"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="@dimen/content_padding"
android:paddingTop="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding">
<net.osmand.plus.widgets.TextViewEx
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="start"
android:lineSpacingExtra="@dimen/line_spacing_extra_description"
android:text="@string/shared_string_min"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size" />
<net.osmand.plus.widgets.TextViewEx
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="end"
android:lineSpacingExtra="@dimen/line_spacing_extra_description"
android:text="@string/shared_string_max"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/zoom_value_min"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="wrap_content"
android:gravity="start"
android:lineSpacingExtra="@dimen/line_spacing_extra_description"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
tools:text="3" />
<com.google.android.material.slider.Slider
android:id="@+id/zoom_slider"
style="@style/Widget.MaterialComponents.Slider"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:stepSize="1"
android:theme="@style/Theme.MaterialComponents"
app:haloRadius="@dimen/slider_thumb_size"
app:thumbRadius="@dimen/slider_thumb_size"
app:tickColor="@color/color_black"
app:trackHeight="@dimen/slider_track_height" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/zoom_value_max"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="wrap_content"
android:gravity="end"
android:lineSpacingExtra="@dimen/line_spacing_extra_description"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
tools:text="19" />
</LinearLayout>
<net.osmand.plus.widgets.TextViewEx
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginBottom="@dimen/content_padding"
android:lineSpacingExtra="@dimen/line_spacing_extra_description"
android:text="@string/terrain_slider_description"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size" />
</LinearLayout>
<include layout="@layout/card_bottom_divider" />
<include
android:id="@+id/legend_top_divider"
layout="@layout/card_top_divider" />
<LinearLayout
android:id="@+id/legend_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:letterSpacing="@dimen/description_letter_spacing"
android:paddingStart="@dimen/content_padding"
android:paddingTop="@dimen/list_header_settings_top_margin"
android:paddingEnd="@dimen/content_padding"
android:paddingBottom="@dimen/content_padding"
android:text="@string/shared_string_legend"
android:textColor="@color/preference_category_title"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/img_legend_slope" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/slope_read_more_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="@string/slope_read_more" />
</LinearLayout>
<include
android:id="@+id/legend_bottom_divider"
layout="@layout/card_bottom_divider" />
<include
android:id="@+id/download_container_top_divider"
layout="@layout/card_top_divider" />
<LinearLayout
android:id="@+id/download_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:letterSpacing="@dimen/description_letter_spacing"
android:paddingStart="@dimen/content_padding"
android:paddingTop="@dimen/list_header_settings_top_margin"
android:paddingEnd="@dimen/content_padding"
android:text="@string/welmode_download_maps"
android:textColor="@color/preference_category_title"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/download_description_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginTop="@dimen/content_padding_half"
android:layout_marginEnd="@dimen/content_padding"
android:lineSpacingExtra="@dimen/line_spacing_extra_description"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="@string/hillshade_download_description" />
<com.github.ksoichiro.android.observablescrollview.ObservableListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@null"
android:fadeScrollbars="true" />
</LinearLayout>
<include
android:id="@+id/download_container_bottom_divider"
layout="@layout/card_bottom_divider" />
</LinearLayout>
<LinearLayout
android:id="@+id/empty_state"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding_small">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/empty_state_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/img_empty_state_terrain" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<FrameLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|bottom"
android:layout_margin="@dimen/content_padding_half"
android:background="@drawable/bg_dark_transp"
android:gravity="start|bottom"
android:padding="@dimen/map_button_margin"
android:text="@string/shared_string_hillshade"
android:textColor="@color/color_white" />
</FrameLayout>
<FrameLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|bottom"
android:layout_margin="@dimen/content_padding_half"
android:background="@drawable/bg_dark_transp"
android:gravity="start|bottom"
android:padding="@dimen/map_button_margin"
android:text="@string/shared_string_slope"
android:textColor="@color/color_white" />
</FrameLayout>
</LinearLayout>
</FrameLayout>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/empty_state_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginBottom="@dimen/content_padding"
android:gravity="start"
android:lineSpacingExtra="@dimen/line_spacing_extra_description"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="@string/terrain_empty_state_text" />
</LinearLayout>
<View
android:id="@+id/bottom_empty_space"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false" />
</LinearLayout>
<View
android:id="@+id/bottom_empty_space"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false" />
</LinearLayout>
</ScrollView>
</LinearLayout>

View file

@ -1,19 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:background="?attr/bg_color"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/list_item_height"
android:gravity="center_vertical"
android:paddingLeft="@dimen/list_content_padding"
android:paddingStart="@dimen/list_content_padding">
android:minHeight="@dimen/setting_list_item_large_height"
android:gravity="center_vertical">
<ImageView
android:id="@+id/icon"
@ -21,6 +19,8 @@
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginStart="@dimen/list_content_padding"
tools:src="@drawable/ic_map"/>
<LinearLayout
@ -30,26 +30,30 @@
android:layout_weight="1"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginStart="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginEnd="@dimen/list_content_padding"
android:orientation="vertical">
<TextView
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="Germany"/>
<TextView
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:maxLines="25"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="Contour Lines"/>
<ProgressBar

View file

@ -15,5 +15,6 @@
<dimen name="context_img_card_height">160dp</dimen>
<dimen name="line_spacing_multiplier_description">1.2</dimen>
<dimen name="line_spacing_extra_description">5dp</dimen>
</resources>

View file

@ -11,6 +11,7 @@
Thx - Hardy
-->
<string name="shared_string_min">Min</string>
<string name="shared_string_square">Square</string>
<string name="shared_string_rhomb">Rhomb</string>
<string name="shared_string_circle">Circle</string>

View file

@ -3,10 +3,13 @@ package net.osmand.plus.srtmplugin;
import android.app.Activity;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.LayoutInflater;
@ -43,6 +46,8 @@ import net.osmand.plus.download.DownloadIndexesThread;
import net.osmand.plus.download.DownloadResources;
import net.osmand.plus.download.DownloadValidationManager;
import net.osmand.plus.download.IndexItem;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.widgets.style.CustomTypefaceSpan;
import org.apache.commons.logging.Log;
@ -161,8 +166,8 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL
getString(R.string.terrain_empty_state_text),
PLUGIN_URL
);
setupClickableText(slopeReadMoreTv, readMoreText, wikiString, SLOPES_WIKI_URL);
setupClickableText(emptyStateDescriptionTv, emptyStateText, PLUGIN_URL, PLUGIN_URL);
setupClickableText(slopeReadMoreTv, readMoreText, wikiString, SLOPES_WIKI_URL, false);
setupClickableText(emptyStateDescriptionTv, emptyStateText, PLUGIN_URL, PLUGIN_URL, true);
switchCompat.setChecked(terrainEnabled);
hillshadeBtn.setOnClickListener(this);
@ -305,42 +310,60 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL
}
private void adjustModeButtons(TerrainMode mode) {
int activeColor = ContextCompat.getColor(app, nightMode
? R.color.active_color_primary_dark
: R.color.active_color_primary_light);
int textColor = ContextCompat.getColor(app, nightMode
? R.color.text_color_primary_dark
: R.color.text_color_primary_light);
int radius = AndroidUtils.dpToPx(app, 4);
GradientDrawable background = new GradientDrawable();
background.setColor(UiUtilities.getColorWithAlpha(activeColor, 0.1f));
background.setStroke(AndroidUtils.dpToPx(app, 1), UiUtilities.getColorWithAlpha(activeColor, 0.5f));
if (mode == SLOPE) {
slopeBtnContainer.setBackgroundResource(R.drawable.btn_border_right_active);
slopeBtn.setTextColor(nightMode
? getResources().getColor(R.color.text_color_primary_dark)
: getResources().getColor(R.color.text_color_primary_light));
hillshadeBtnContainer.setBackgroundResource(R.drawable.btn_border_left_inactive);
hillshadeBtn.setTextColor(nightMode
? getResources().getColor(R.color.active_color_primary_dark)
: getResources().getColor(R.color.active_color_primary_light));
background.setCornerRadii(new float[]{0, 0, radius, radius, radius, radius, 0, 0});
slopeBtnContainer.setBackgroundDrawable(background);
slopeBtn.setTextColor(textColor);
hillshadeBtnContainer.setBackgroundColor(Color.TRANSPARENT);
hillshadeBtn.setTextColor(activeColor);
} else {
slopeBtnContainer.setBackgroundResource(R.drawable.btn_border_right_inactive);
slopeBtn.setTextColor(nightMode
? getResources().getColor(R.color.active_color_primary_dark)
: getResources().getColor(R.color.active_color_primary_light));
hillshadeBtnContainer.setBackgroundResource(R.drawable.btn_border_left_active);
hillshadeBtn.setTextColor(nightMode
? getResources().getColor(R.color.text_color_primary_dark)
: getResources().getColor(R.color.text_color_primary_light));
background.setCornerRadii(new float[]{radius, radius, 0, 0, 0, 0, radius, radius});
slopeBtnContainer.setBackgroundColor(Color.TRANSPARENT);
slopeBtn.setTextColor(activeColor);
hillshadeBtnContainer.setBackgroundDrawable(background);
hillshadeBtn.setTextColor(textColor);
}
}
private void setupClickableText(TextView textView,
String text,
String clickableText,
final String url) {
String text,
String clickableText,
final String url,
final boolean medium) {
SpannableString spannableString = new SpannableString(text);
ClickableSpan clickableSpan = new ClickableSpan() {
@Override
public void onClick(@NonNull View view) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
if (AndroidUtils.isIntentSafe(app, i)) {
startActivity(i);
}
}
@Override
public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
}
};
try {
int startIndex = text.indexOf(clickableText);
if (medium) {
spannableString.setSpan(new CustomTypefaceSpan(FontCache.getRobotoMedium(app)), startIndex, startIndex + clickableText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
spannableString.setSpan(clickableSpan, startIndex, startIndex + clickableText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
textView.setText(spannableString);
textView.setMovementMethod(LinkMovementMethod.getInstance());
@ -533,7 +556,7 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL
}
private void setupBottomEmptySpace() {
int h = terrainEnabled ? AndroidUtils.dpToPx(app, 48) : AndroidUtils.getScreenHeight(requireActivity()) / 3;
int h = terrainEnabled ? AndroidUtils.dpToPx(app, 120) : AndroidUtils.getScreenHeight(requireActivity()) / 3;
ViewGroup.LayoutParams params = bottomEmptySpace.getLayoutParams();
params.height = h;
bottomEmptySpace.setLayoutParams(params);