terrain ui work in progress
This commit is contained in:
parent
5d2bfca53e
commit
65d9f5f910
9 changed files with 349 additions and 109 deletions
9
OsmAnd/res/drawable/bg_dark_transp.xml
Normal file
9
OsmAnd/res/drawable/bg_dark_transp.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?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/terrain_empty_hint_bg" />
|
||||||
|
<corners android:radius="3dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView 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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
@ -9,7 +10,7 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -173,11 +174,20 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatSeekBar
|
<com.google.android.material.slider.Slider
|
||||||
android:id="@+id/transparency_slider"
|
android:id="@+id/transparency_slider"
|
||||||
|
style="@style/Widget.MaterialComponents.Slider"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/list_header_settings_top_margin" />
|
android:layout_marginTop="@dimen/list_header_settings_top_margin"
|
||||||
|
android:stepSize="1"
|
||||||
|
android:theme="@style/Theme.MaterialComponents"
|
||||||
|
android:valueFrom="0"
|
||||||
|
android:valueTo="100"
|
||||||
|
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
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -228,6 +238,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingStart="@dimen/content_padding"
|
android:paddingStart="@dimen/content_padding"
|
||||||
android:paddingEnd="@dimen/content_padding">
|
android:paddingEnd="@dimen/content_padding">
|
||||||
|
@ -242,17 +253,24 @@
|
||||||
tools:text="3" />
|
tools:text="3" />
|
||||||
|
|
||||||
<com.google.android.material.slider.Slider
|
<com.google.android.material.slider.Slider
|
||||||
|
android:id="@+id/zoom_slider"
|
||||||
|
style="@style/Widget.MaterialComponents.Slider"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/content_padding"
|
android:layout_weight="1"
|
||||||
android:layout_marginEnd="@dimen/content_padding"
|
android:stepSize="1"
|
||||||
android:layout_weight="1" />
|
android:theme="@style/Theme.MaterialComponents"
|
||||||
|
android:valueFrom="2"
|
||||||
|
android:valueTo="22"
|
||||||
|
app:haloRadius="@dimen/slider_thumb_halo_size"
|
||||||
|
app:thumbRadius="@dimen/slider_thumb_size"
|
||||||
|
app:trackHeight="@dimen/slider_track_height" />
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
android:id="@+id/zoom_value_max"
|
android:id="@+id/zoom_value_max"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="end"
|
android:gravity="end"
|
||||||
android:textColor="?android:textColorSecondary"
|
android:textColor="?android:textColorSecondary"
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
tools:text="19" />
|
tools:text="19" />
|
||||||
|
@ -358,16 +376,72 @@
|
||||||
android:background="?attr/bg_color"
|
android:background="?attr/bg_color"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<ImageView
|
<FrameLayout
|
||||||
android:id="@+id/empty_state_image"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
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
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
android:id="@+id/empty_state_description"
|
android:id="@+id/empty_state_description"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/content_padding"
|
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:textColor="?android:textColorSecondary"
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
tools:text="@string/terrain_empty_state_text" />
|
tools:text="@string/terrain_empty_state_text" />
|
||||||
|
|
|
@ -460,5 +460,6 @@
|
||||||
|
|
||||||
<color name="terrain_active_button">#1A237BFF</color>
|
<color name="terrain_active_button">#1A237BFF</color>
|
||||||
<color name="terrain_active_button_stroke">#80237BFF</color>
|
<color name="terrain_active_button_stroke">#80237BFF</color>
|
||||||
|
<color name="terrain_empty_hint_bg">#80000000</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -12,9 +12,9 @@
|
||||||
<dimen name="action_bar_height">64dp</dimen>
|
<dimen name="action_bar_height">64dp</dimen>
|
||||||
<dimen name="list_content_padding_large">32dp</dimen>
|
<dimen name="list_content_padding_large">32dp</dimen>
|
||||||
<dimen name="title_padding">20dp</dimen>
|
<dimen name="title_padding">20dp</dimen>
|
||||||
<dimen name="title_text_size">28sp</dimen>
|
<dimen name="title_text_size">28sp</dimen>
|
||||||
<dimen name="card_title_row_min_height">64dp</dimen>
|
<dimen name="card_title_row_min_height">64dp</dimen>
|
||||||
<dimen name="card_row_min_height">48dp</dimen>
|
<dimen name="card_row_min_height">48dp</dimen>
|
||||||
<dimen name="card_button_min_size">58dp</dimen>
|
<dimen name="card_button_min_size">58dp</dimen>
|
||||||
<dimen name="card_button_progress_size">32dp</dimen>
|
<dimen name="card_button_progress_size">32dp</dimen>
|
||||||
<dimen name="card_button_progress_size_small">24dp</dimen>
|
<dimen name="card_button_progress_size_small">24dp</dimen>
|
||||||
|
@ -26,43 +26,43 @@
|
||||||
<dimen name="widget_turn_lane_margin">2dp</dimen>
|
<dimen name="widget_turn_lane_margin">2dp</dimen>
|
||||||
<dimen name="widget_turn_lane_min_delta">18dp</dimen>
|
<dimen name="widget_turn_lane_min_delta">18dp</dimen>
|
||||||
|
|
||||||
<dimen name="acceptable_touch_radius">48dp</dimen>
|
<dimen name="acceptable_touch_radius">48dp</dimen>
|
||||||
|
|
||||||
<dimen name="dialog_button_height">36dp</dimen>
|
<dimen name="dialog_button_height">36dp</dimen>
|
||||||
<dimen name="undo_bottom_offset">15dp</dimen>
|
<dimen name="undo_bottom_offset">15dp</dimen>
|
||||||
<dimen name="touch_slop">32dp</dimen>
|
<dimen name="touch_slop">32dp</dimen>
|
||||||
|
|
||||||
<dimen name="list_item_height">50dp</dimen>
|
<dimen name="list_item_height">50dp</dimen>
|
||||||
<dimen name="list_header_height">40dp</dimen>
|
<dimen name="list_header_height">40dp</dimen>
|
||||||
<dimen name="dashboard_map_top_padding">240dp</dimen>
|
<dimen name="dashboard_map_top_padding">240dp</dimen>
|
||||||
<dimen name="dashboard_land_width">360dp</dimen>
|
<dimen name="dashboard_land_width">360dp</dimen>
|
||||||
<dimen name="dashboard_map_toolbar">56dp</dimen>
|
<dimen name="dashboard_map_toolbar">56dp</dimen>
|
||||||
<dimen name="dash_parking_height">78dp</dimen>
|
<dimen name="dash_parking_height">78dp</dimen>
|
||||||
<dimen name="dashboard_land_shadow_width">15dp</dimen>
|
<dimen name="dashboard_land_shadow_width">15dp</dimen>
|
||||||
|
|
||||||
<dimen name="subHeaderPadding">2dp</dimen>
|
<dimen name="subHeaderPadding">2dp</dimen>
|
||||||
<dimen name="subHeaderMarginLeft">15dp</dimen>
|
<dimen name="subHeaderMarginLeft">15dp</dimen>
|
||||||
<dimen name = "subHeaderMarginRight">15dp</dimen>
|
<dimen name="subHeaderMarginRight">15dp</dimen>
|
||||||
<dimen name="showAllButtonMarginRight">14dp</dimen>
|
<dimen name="showAllButtonMarginRight">14dp</dimen>
|
||||||
<dimen name="showAllButtonHeight">36dp</dimen>
|
<dimen name="showAllButtonHeight">36dp</dimen>
|
||||||
<dimen name="dashFavIconSize">28dp</dimen>
|
<dimen name="dashFavIconSize">28dp</dimen>
|
||||||
<dimen name="dashFavIconMargin">12dp</dimen>
|
<dimen name="dashFavIconMargin">12dp</dimen>
|
||||||
<dimen name="dashFavDirectionSize">10dp</dimen>
|
<dimen name="dashFavDirectionSize">10dp</dimen>
|
||||||
<dimen name="directionIconSize">14dp</dimen>
|
<dimen name="directionIconSize">14dp</dimen>
|
||||||
|
|
||||||
<dimen name="dashNoteIconSize">28dp</dimen>
|
<dimen name="dashNoteIconSize">28dp</dimen>
|
||||||
<dimen name="dashPluginPadding">4dp</dimen>
|
<dimen name="dashPluginPadding">4dp</dimen>
|
||||||
<dimen name="dashPluginMargin">8dp</dimen>
|
<dimen name="dashPluginMargin">8dp</dimen>
|
||||||
<dimen name="dashSearchBtnHeight">90dp</dimen>
|
<dimen name="dashSearchBtnHeight">90dp</dimen>
|
||||||
<dimen name="dashSearchPaddingTop">17dp</dimen>
|
<dimen name="dashSearchPaddingTop">17dp</dimen>
|
||||||
<dimen name="dashSearchPaddingBot">11dp</dimen>
|
<dimen name="dashSearchPaddingBot">11dp</dimen>
|
||||||
<dimen name="dashPadding">6dp</dimen>
|
<dimen name="dashPadding">6dp</dimen>
|
||||||
<dimen name="dashCardMargin">4dp</dimen>
|
<dimen name="dashCardMargin">4dp</dimen>
|
||||||
<dimen name="abp__shadow_height">4dp</dimen>
|
<dimen name="abp__shadow_height">4dp</dimen>
|
||||||
<dimen name="dashFABMargin">0dp</dimen>
|
<dimen name="dashFABMargin">0dp</dimen>
|
||||||
|
|
||||||
<dimen name="list_content_padding">16dp</dimen>
|
<dimen name="list_content_padding">16dp</dimen>
|
||||||
<dimen name="list_header_padding">8dp</dimen>
|
<dimen name="list_header_padding">8dp</dimen>
|
||||||
|
|
||||||
<dimen name="list_header_top_margin">16dp</dimen>
|
<dimen name="list_header_top_margin">16dp</dimen>
|
||||||
<dimen name="list_header_settings_top_margin">10dp</dimen>
|
<dimen name="list_header_settings_top_margin">10dp</dimen>
|
||||||
|
@ -127,7 +127,6 @@
|
||||||
<dimen name="map_minwidth_widget">100dp</dimen>
|
<dimen name="map_minwidth_widget">100dp</dimen>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<dimen name="map_widget_text_size">23sp</dimen>
|
<dimen name="map_widget_text_size">23sp</dimen>
|
||||||
<dimen name="map_top_widget_text_size">22sp</dimen>
|
<dimen name="map_top_widget_text_size">22sp</dimen>
|
||||||
<dimen name="map_widget_text_size_small">15sp</dimen>
|
<dimen name="map_widget_text_size_small">15sp</dimen>
|
||||||
|
@ -145,17 +144,17 @@
|
||||||
|
|
||||||
<!-- ContextMenu -->
|
<!-- ContextMenu -->
|
||||||
<dimen name="context_menu_top_shadow_h">20dp</dimen>
|
<dimen name="context_menu_top_shadow_h">20dp</dimen>
|
||||||
<dimen name="context_menu_icon_top_padding">17dp</dimen>
|
<dimen name="context_menu_icon_top_padding">17dp</dimen>
|
||||||
<dimen name="context_menu_first_line_top_margin">14dp</dimen>
|
<dimen name="context_menu_first_line_top_margin">14dp</dimen>
|
||||||
<dimen name="context_menu_first_line_bottom_margin">16dp</dimen>
|
<dimen name="context_menu_first_line_bottom_margin">16dp</dimen>
|
||||||
<dimen name="context_menu_second_line_top_margin">4dp</dimen>
|
<dimen name="context_menu_second_line_top_margin">4dp</dimen>
|
||||||
<dimen name="context_menu_top_right_button_min_width">76dp</dimen>
|
<dimen name="context_menu_top_right_button_min_width">76dp</dimen>
|
||||||
<dimen name="context_menu_button_padding_x">10dp</dimen>
|
<dimen name="context_menu_button_padding_x">10dp</dimen>
|
||||||
<dimen name="context_menu_buttons_top_margin">-16dp</dimen>
|
<dimen name="context_menu_buttons_top_margin">-16dp</dimen>
|
||||||
<dimen name="context_menu_buttons_padding_bottom">4dp</dimen>
|
<dimen name="context_menu_buttons_padding_bottom">4dp</dimen>
|
||||||
<dimen name="context_menu_progress_min_height">54dp</dimen>
|
<dimen name="context_menu_progress_min_height">54dp</dimen>
|
||||||
<dimen name="context_menu_progress_cancel_button_size">44dp</dimen>
|
<dimen name="context_menu_progress_cancel_button_size">44dp</dimen>
|
||||||
<dimen name="context_menu_action_buttons_h">54dp</dimen>
|
<dimen name="context_menu_action_buttons_h">54dp</dimen>
|
||||||
<dimen name="context_menu_sub_info_height">24dp</dimen>
|
<dimen name="context_menu_sub_info_height">24dp</dimen>
|
||||||
<dimen name="context_menu_buttons_bottom_height">48dp</dimen>
|
<dimen name="context_menu_buttons_bottom_height">48dp</dimen>
|
||||||
<dimen name="context_menu_padding_margin_large">20dp</dimen>
|
<dimen name="context_menu_padding_margin_large">20dp</dimen>
|
||||||
|
@ -182,14 +181,14 @@
|
||||||
<dimen name="context_menu_big_icon_size">40dp</dimen>
|
<dimen name="context_menu_big_icon_size">40dp</dimen>
|
||||||
|
|
||||||
<dimen name="fab_size_with_shadow">62dp</dimen>
|
<dimen name="fab_size_with_shadow">62dp</dimen>
|
||||||
<dimen name="fab_margin_right">12dp</dimen>
|
<dimen name="fab_margin_right">12dp</dimen>
|
||||||
<dimen name="fab_margin_bottom_big">72dp</dimen>
|
<dimen name="fab_margin_bottom_big">72dp</dimen>
|
||||||
|
|
||||||
<!-- TextSizes -->
|
<!-- TextSizes -->
|
||||||
<dimen name="default_list_text_size_large">19sp</dimen>
|
<dimen name="default_list_text_size_large">19sp</dimen>
|
||||||
<dimen name="default_list_text_size">16sp</dimen>
|
<dimen name="default_list_text_size">16sp</dimen>
|
||||||
<dimen name="default_desc_text_size">14sp</dimen>
|
<dimen name="default_desc_text_size">14sp</dimen>
|
||||||
<dimen name="default_sub_text_size">12sp</dimen>
|
<dimen name="default_sub_text_size">12sp</dimen>
|
||||||
<dimen name="default_sub_text_size_small">10sp</dimen>
|
<dimen name="default_sub_text_size_small">10sp</dimen>
|
||||||
<dimen name="welcome_header_text_size">23sp</dimen>
|
<dimen name="welcome_header_text_size">23sp</dimen>
|
||||||
<dimen name="text_button_text_size">15sp</dimen>
|
<dimen name="text_button_text_size">15sp</dimen>
|
||||||
|
@ -220,7 +219,7 @@
|
||||||
<dimen name="empty_state_text_button_padding_right">60dp</dimen>
|
<dimen name="empty_state_text_button_padding_right">60dp</dimen>
|
||||||
<dimen name="empty_state_text_button_padding_top">64dp</dimen>
|
<dimen name="empty_state_text_button_padding_top">64dp</dimen>
|
||||||
|
|
||||||
<dimen name="bottom_sheet_cancel_button_height">48dp</dimen>
|
<dimen name="bottom_sheet_cancel_button_height">48dp</dimen>
|
||||||
<dimen name="bottom_sheet_cancel_button_height_small">36dp</dimen>
|
<dimen name="bottom_sheet_cancel_button_height_small">36dp</dimen>
|
||||||
<dimen name="landscape_bottom_sheet_dialog_fragment_width">360dp</dimen>
|
<dimen name="landscape_bottom_sheet_dialog_fragment_width">360dp</dimen>
|
||||||
|
|
||||||
|
@ -307,9 +306,9 @@
|
||||||
<dimen name="multi_selection_menu_padding_top">13dp</dimen>
|
<dimen name="multi_selection_menu_padding_top">13dp</dimen>
|
||||||
<dimen name="multi_selection_menu_padding_bottom">15dp</dimen>
|
<dimen name="multi_selection_menu_padding_bottom">15dp</dimen>
|
||||||
|
|
||||||
<dimen name="grid_menu_item_width">120dp</dimen>
|
<dimen name="grid_menu_item_width">120dp</dimen>
|
||||||
<dimen name="grid_menu_item_bottom_top_margin">16dp</dimen>
|
<dimen name="grid_menu_item_bottom_top_margin">16dp</dimen>
|
||||||
<dimen name="grid_menu_item_sides_margin">40dp</dimen>
|
<dimen name="grid_menu_item_sides_margin">40dp</dimen>
|
||||||
|
|
||||||
<dimen name="bottom_sheet_menu_peek_height">300dp</dimen>
|
<dimen name="bottom_sheet_menu_peek_height">300dp</dimen>
|
||||||
|
|
||||||
|
@ -356,4 +355,8 @@
|
||||||
<dimen name="setting_list_item_large_height">72dp</dimen>
|
<dimen name="setting_list_item_large_height">72dp</dimen>
|
||||||
<dimen name="setting_list_item_small_height">42dp</dimen>
|
<dimen name="setting_list_item_small_height">42dp</dimen>
|
||||||
|
|
||||||
|
<dimen name="slider_thumb_size">8dp</dimen>
|
||||||
|
<dimen name="slider_thumb_halo_size">12dp</dimen>
|
||||||
|
<dimen name="slider_track_height">2dp</dimen>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -16,7 +16,7 @@
|
||||||
<string name="saving_new_profile">Saving new profile</string>
|
<string name="saving_new_profile">Saving new profile</string>
|
||||||
<string name="profile_backup_failed">Could not back up profile.</string>
|
<string name="profile_backup_failed">Could not back up profile.</string>
|
||||||
<string name="shared_string_hillshade">Hillshade</string>
|
<string name="shared_string_hillshade">Hillshade</string>
|
||||||
<string name="terrain_empty_state_text">Turn on to view the layer with shading relief or a map of the slope of the slopes. \n\nYou can find out why such cards are needed and how they work on our website</string>
|
<string name="terrain_empty_state_text">Enable to view hillshade or slope map. You can read more about this map types on our site</string>
|
||||||
<string name="shared_string_legend">Legend</string>
|
<string name="shared_string_legend">Legend</string>
|
||||||
<string name="shared_string_zoom_levels">Zoom levels</string>
|
<string name="shared_string_zoom_levels">Zoom levels</string>
|
||||||
<string name="shared_string_transparency">Transparency</string>
|
<string name="shared_string_transparency">Transparency</string>
|
||||||
|
|
|
@ -2097,6 +2097,18 @@ public class OsmandSettings {
|
||||||
|
|
||||||
public final CommonPreference<Boolean> HILLSHADE = new BooleanPreference("hillshade_layer", true).makeProfile();
|
public final CommonPreference<Boolean> HILLSHADE = new BooleanPreference("hillshade_layer", true).makeProfile();
|
||||||
|
|
||||||
|
public final CommonPreference<Integer> HILLSHADE_MIN_ZOOM = new IntPreference("hillshade_min_zoom", 3).makeProfile();
|
||||||
|
|
||||||
|
public final CommonPreference<Integer> HILLSHADE_MAX_ZOOM = new IntPreference("hillshade_max_zoom", 19).makeProfile();
|
||||||
|
|
||||||
|
public final CommonPreference<Integer> HILLSHADE_TRANSPARENCY = new IntPreference("hillshade_transparency", 100).makeProfile();
|
||||||
|
|
||||||
|
public final CommonPreference<Integer> SLOPE_MIN_ZOOM = new IntPreference("slope_min_zoom", 3).makeProfile();
|
||||||
|
|
||||||
|
public final CommonPreference<Integer> SLOPE_MAX_ZOOM = new IntPreference("slope_max_zoom", 19).makeProfile();
|
||||||
|
|
||||||
|
public final CommonPreference<Integer> SLOPE_TRANSPARENCY = new IntPreference("slope_transparency", 100).makeProfile();
|
||||||
|
|
||||||
public final CommonPreference<Boolean> TERRAIN = new BooleanPreference("terrain_layer", true).makeProfile();
|
public final CommonPreference<Boolean> TERRAIN = new BooleanPreference("terrain_layer", true).makeProfile();
|
||||||
|
|
||||||
public final CommonPreference<TerrainMode> TERRAIN_MODE = new EnumIntPreference<>("terrain_mode", TerrainMode.HILLSHADE, TerrainMode.values()).makeProfile();
|
public final CommonPreference<TerrainMode> TERRAIN_MODE = new EnumIntPreference<>("terrain_mode", TerrainMode.HILLSHADE, TerrainMode.values()).makeProfile();
|
||||||
|
|
|
@ -38,6 +38,7 @@ public class HillshadeLayer extends MapTileLayer {
|
||||||
private final static int MAX_TRANSPARENCY_ZOOM = 17;
|
private final static int MAX_TRANSPARENCY_ZOOM = 17;
|
||||||
private final static int DEFAULT_ALPHA = 100;
|
private final static int DEFAULT_ALPHA = 100;
|
||||||
private final static int MAX_TRANSPARENCY_ALPHA = 20;
|
private final static int MAX_TRANSPARENCY_ALPHA = 20;
|
||||||
|
private SRTMPlugin srtmPlugin;
|
||||||
|
|
||||||
private QuadTree<String> indexedResources = new QuadTree<String>(new QuadRect(0, 0, 1 << (ZOOM_BOUNDARY+1), 1 << (ZOOM_BOUNDARY+1)), 8, 0.55f);
|
private QuadTree<String> indexedResources = new QuadTree<String>(new QuadRect(0, 0, 1 << (ZOOM_BOUNDARY+1), 1 << (ZOOM_BOUNDARY+1)), 8, 0.55f);
|
||||||
|
|
||||||
|
@ -47,6 +48,7 @@ public class HillshadeLayer extends MapTileLayer {
|
||||||
indexHillshadeFiles(app);
|
indexHillshadeFiles(app);
|
||||||
setAlpha(DEFAULT_ALPHA);
|
setAlpha(DEFAULT_ALPHA);
|
||||||
setMap(createTileSource(activity));
|
setMap(createTileSource(activity));
|
||||||
|
this.srtmPlugin = srtmPlugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -54,7 +56,7 @@ public class HillshadeLayer extends MapTileLayer {
|
||||||
if (tileBox.getZoom() >= MAX_TRANSPARENCY_ZOOM) {
|
if (tileBox.getZoom() >= MAX_TRANSPARENCY_ZOOM) {
|
||||||
setAlpha(MAX_TRANSPARENCY_ALPHA);
|
setAlpha(MAX_TRANSPARENCY_ALPHA);
|
||||||
} else {
|
} else {
|
||||||
setAlpha(DEFAULT_ALPHA);
|
setAlpha(srtmPlugin.getHillshadeTransparency());
|
||||||
}
|
}
|
||||||
super.onPrepareBufferImage(canvas, tileBox, drawSettings);
|
super.onPrepareBufferImage(canvas, tileBox, drawSettings);
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,13 +129,14 @@ public class SRTMPlugin extends OsmandPlugin {
|
||||||
public String getHelpFileName() {
|
public String getHelpFileName() {
|
||||||
return "feature_articles/contour-lines-plugin.html";
|
return "feature_articles/contour-lines-plugin.html";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean init(@NonNull final OsmandApplication app, Activity activity) {
|
public boolean init(@NonNull final OsmandApplication app, Activity activity) {
|
||||||
OsmandSettings settings = app.getSettings();
|
OsmandSettings settings = app.getSettings();
|
||||||
CommonPreference<String> pref = settings.getCustomRenderProperty("contourLines");
|
CommonPreference<String> pref = settings.getCustomRenderProperty("contourLines");
|
||||||
if(pref.get().equals("")) {
|
if (pref.get().equals("")) {
|
||||||
for(ApplicationMode m : ApplicationMode.allPossibleValues()) {
|
for (ApplicationMode m : ApplicationMode.allPossibleValues()) {
|
||||||
if(pref.getModeValue(m).equals("")) {
|
if (pref.getModeValue(m).equals("")) {
|
||||||
pref.setModeValue(m, "13");
|
pref.setModeValue(m, "13");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,6 +175,72 @@ public class SRTMPlugin extends OsmandPlugin {
|
||||||
settings.TERRAIN_MODE.set(mode);
|
settings.TERRAIN_MODE.set(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTransparency(int transparency) {
|
||||||
|
switch (getTerrainMode()) {
|
||||||
|
case HILLSHADE:
|
||||||
|
settings.HILLSHADE_TRANSPARENCY.set(transparency);
|
||||||
|
break;
|
||||||
|
case SLOPE:
|
||||||
|
settings.SLOPE_TRANSPARENCY.set(transparency);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZoomValues(int minZoom, int maxZoom) {
|
||||||
|
switch (getTerrainMode()) {
|
||||||
|
case HILLSHADE:
|
||||||
|
settings.HILLSHADE_MIN_ZOOM.set(minZoom);
|
||||||
|
settings.HILLSHADE_MAX_ZOOM.set(maxZoom);
|
||||||
|
break;
|
||||||
|
case SLOPE:
|
||||||
|
settings.SLOPE_MIN_ZOOM.set(minZoom);
|
||||||
|
settings.SLOPE_MAX_ZOOM.set(maxZoom);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTransparency() {
|
||||||
|
switch (getTerrainMode()) {
|
||||||
|
case HILLSHADE:
|
||||||
|
return settings.HILLSHADE_TRANSPARENCY.get();
|
||||||
|
case SLOPE:
|
||||||
|
return settings.SLOPE_TRANSPARENCY.get();
|
||||||
|
}
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHillshadeTransparency(){
|
||||||
|
return settings.HILLSHADE_TRANSPARENCY.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHillshadeMinZoom(){
|
||||||
|
return settings.HILLSHADE_MIN_ZOOM.get();
|
||||||
|
}
|
||||||
|
public int getHillshadeMaxZoom(){
|
||||||
|
return settings.HILLSHADE_MAX_ZOOM.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getMinZoom() {
|
||||||
|
switch (getTerrainMode()) {
|
||||||
|
case HILLSHADE:
|
||||||
|
return settings.HILLSHADE_MIN_ZOOM.get();
|
||||||
|
case SLOPE:
|
||||||
|
return settings.SLOPE_MIN_ZOOM.get();
|
||||||
|
}
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxZoom() {
|
||||||
|
switch (getTerrainMode()) {
|
||||||
|
case HILLSHADE:
|
||||||
|
return settings.HILLSHADE_MAX_ZOOM.get();
|
||||||
|
case SLOPE:
|
||||||
|
return settings.SLOPE_MAX_ZOOM.get();
|
||||||
|
}
|
||||||
|
return 19;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isContourLinesLayerEnabled(OsmandApplication app) {
|
public static boolean isContourLinesLayerEnabled(OsmandApplication app) {
|
||||||
boolean contourLinesEnabled = false;
|
boolean contourLinesEnabled = false;
|
||||||
|
|
||||||
|
@ -379,8 +446,8 @@ public class SRTMPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toggleHillshade(final MapActivity activity,
|
public void toggleHillshade(final MapActivity activity,
|
||||||
final boolean isChecked,
|
final boolean isChecked,
|
||||||
final Runnable callback) {
|
final Runnable callback) {
|
||||||
settings.HILLSHADE.set(isChecked);
|
settings.HILLSHADE.set(isChecked);
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.run();
|
callback.run();
|
||||||
|
@ -396,9 +463,9 @@ public class SRTMPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void selectPropertyValue(final MapActivity activity,
|
public void selectPropertyValue(final MapActivity activity,
|
||||||
final RenderingRuleProperty p,
|
final RenderingRuleProperty p,
|
||||||
final OsmandSettings.CommonPreference<String> pref,
|
final OsmandSettings.CommonPreference<String> pref,
|
||||||
final Runnable callback) {
|
final Runnable callback) {
|
||||||
final String propertyDescr = SettingsActivity.getStringPropertyDescription(activity,
|
final String propertyDescr = SettingsActivity.getStringPropertyDescription(activity,
|
||||||
p.getAttrName(), p.getName());
|
p.getAttrName(), p.getName());
|
||||||
boolean nightMode = isNightMode(activity, app);
|
boolean nightMode = isNightMode(activity, app);
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
package net.osmand.plus.srtmplugin;
|
package net.osmand.plus.srtmplugin;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Color;
|
import android.content.res.ColorStateList;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
|
@ -12,7 +11,6 @@ import android.text.style.ClickableSpan;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
@ -20,11 +18,12 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.widget.AppCompatSeekBar;
|
|
||||||
import androidx.appcompat.widget.SwitchCompat;
|
import androidx.appcompat.widget.SwitchCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import net.osmand.plus.ContextMenuAdapter;
|
import com.google.android.material.slider.Slider;
|
||||||
import net.osmand.plus.ContextMenuItem;
|
|
||||||
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
@ -33,25 +32,19 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
|
||||||
import net.osmand.plus.download.DownloadActivityType;
|
|
||||||
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.inapp.InAppPurchaseHelper;
|
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||||
|
|
||||||
import java.io.IOException;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static net.osmand.plus.srtmplugin.ContourLinesMenu.closeDashboard;
|
|
||||||
|
|
||||||
public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickListener {
|
public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickListener,
|
||||||
|
Slider.OnSliderTouchListener, Slider.OnChangeListener {
|
||||||
|
|
||||||
public static final String TAG = TerrainFragment.class.getSimpleName();
|
public static final String TAG = TerrainFragment.class.getSimpleName();
|
||||||
|
private static final Log LOG = PlatformUtil.getLog(TerrainFragment.class.getSimpleName());
|
||||||
// TODO replace with correct string
|
private static final String SLOPES_WIKI_URL = "https://en.wikipedia.org/wiki/Grade_(slope)";
|
||||||
private static final String SLOPES_WIKI_URL = "https://osmand.net/features/contour-lines-plugin";
|
|
||||||
private static final String PLUGIN_URL = "https://osmand.net/features/contour-lines-plugin";
|
private static final String PLUGIN_URL = "https://osmand.net/features/contour-lines-plugin";
|
||||||
|
|
||||||
private OsmandApplication app;
|
private OsmandApplication app;
|
||||||
|
@ -63,28 +56,33 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL
|
||||||
private boolean terrainEnabled;
|
private boolean terrainEnabled;
|
||||||
|
|
||||||
private int colorProfile;
|
private int colorProfile;
|
||||||
|
private ColorStateList colorProfileStateList;
|
||||||
|
private ColorStateList colorProfileInactiveStateList;
|
||||||
|
|
||||||
private TextView downloadDescriptionTv;
|
|
||||||
private TextView emptyStateDescriptionTv;
|
private TextView emptyStateDescriptionTv;
|
||||||
|
private TextView downloadDescriptionTv;
|
||||||
private TextView transparencyValueTv;
|
private TextView transparencyValueTv;
|
||||||
private TextView slopeReadMoreTv;
|
private TextView slopeReadMoreTv;
|
||||||
private TextView descriptionTv;
|
private TextView descriptionTv;
|
||||||
|
private TextView hillshadeBtn;
|
||||||
|
private TextView minZoomTv;
|
||||||
|
private TextView maxZoomTv;
|
||||||
|
private TextView slopeBtn;
|
||||||
private TextView titleTv;
|
private TextView titleTv;
|
||||||
private TextView stateTv;
|
private TextView stateTv;
|
||||||
private TextView slopeBtn;
|
|
||||||
private TextView hillshadeBtn;
|
|
||||||
private FrameLayout slopeBtnContainer;
|
|
||||||
private FrameLayout hillshadeBtnContainer;
|
private FrameLayout hillshadeBtnContainer;
|
||||||
|
private FrameLayout slopeBtnContainer;
|
||||||
private SwitchCompat switchCompat;
|
private SwitchCompat switchCompat;
|
||||||
private ImageView iconIv;
|
private ImageView iconIv;
|
||||||
private LinearLayout legendContainer;
|
|
||||||
private LinearLayout emptyState;
|
private LinearLayout emptyState;
|
||||||
|
private LinearLayout legendContainer;
|
||||||
private LinearLayout contentContainer;
|
private LinearLayout contentContainer;
|
||||||
private LinearLayout downloadContainer;
|
private LinearLayout downloadContainer;
|
||||||
private View legendTopDivider;
|
|
||||||
private View legendBottomDivider;
|
private View legendBottomDivider;
|
||||||
private View titleBottomDivider;
|
private View titleBottomDivider;
|
||||||
private AppCompatSeekBar transparencySlider;
|
private View legendTopDivider;
|
||||||
|
private Slider transparencySlider;
|
||||||
|
private Slider zoomSlider;
|
||||||
|
|
||||||
public TerrainFragment() {
|
public TerrainFragment() {
|
||||||
|
|
||||||
|
@ -100,6 +98,9 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL
|
||||||
srtmEnabled = OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) != null
|
srtmEnabled = OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) != null
|
||||||
|| InAppPurchaseHelper.isSubscribedToLiveUpdates(app);
|
|| InAppPurchaseHelper.isSubscribedToLiveUpdates(app);
|
||||||
colorProfile = settings.getApplicationMode().getIconColorInfo().getColor(nightMode);
|
colorProfile = settings.getApplicationMode().getIconColorInfo().getColor(nightMode);
|
||||||
|
colorProfileStateList = ColorStateList.valueOf(ContextCompat.getColor(app, colorProfile));
|
||||||
|
colorProfileInactiveStateList = ColorStateList
|
||||||
|
.valueOf(UiUtilities.getColorWithAlpha(colorProfile, 0.6f));
|
||||||
terrainEnabled = srtmPlugin.isTerrainLayerEnabled();
|
terrainEnabled = srtmPlugin.isTerrainLayerEnabled();
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
@ -126,29 +127,54 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL
|
||||||
stateTv = root.findViewById(R.id.state_tv);
|
stateTv = root.findViewById(R.id.state_tv);
|
||||||
iconIv = root.findViewById(R.id.icon_iv);
|
iconIv = root.findViewById(R.id.icon_iv);
|
||||||
slopeBtn = root.findViewById(R.id.slope_btn);
|
slopeBtn = root.findViewById(R.id.slope_btn);
|
||||||
|
zoomSlider = root.findViewById(R.id.zoom_slider);
|
||||||
|
minZoomTv = root.findViewById(R.id.zoom_value_min);
|
||||||
|
maxZoomTv = root.findViewById(R.id.zoom_value_max);
|
||||||
hillshadeBtn = root.findViewById(R.id.hillshade_btn);
|
hillshadeBtn = root.findViewById(R.id.hillshade_btn);
|
||||||
slopeBtnContainer = root.findViewById(R.id.slope_btn_container);
|
slopeBtnContainer = root.findViewById(R.id.slope_btn_container);
|
||||||
hillshadeBtnContainer = root.findViewById(R.id.hillshade_btn_container);
|
|
||||||
downloadContainer = root.findViewById(R.id.download_container);
|
downloadContainer = root.findViewById(R.id.download_container);
|
||||||
|
hillshadeBtnContainer = root.findViewById(R.id.hillshade_btn_container);
|
||||||
|
|
||||||
titleTv.setText(R.string.shared_string_terrain);
|
titleTv.setText(R.string.shared_string_terrain);
|
||||||
String emptyStateText = String.format(
|
|
||||||
getString(R.string.ltr_or_rtl_combine_via_colon),
|
|
||||||
getString(R.string.terrain_empty_state_text),
|
|
||||||
PLUGIN_URL
|
|
||||||
);
|
|
||||||
setupClickableText(emptyStateDescriptionTv, emptyStateText, PLUGIN_URL, PLUGIN_URL);
|
|
||||||
String wikiString = getString(R.string.shared_string_wikipedia);
|
String wikiString = getString(R.string.shared_string_wikipedia);
|
||||||
String readMoreText = String.format(
|
String readMoreText = String.format(
|
||||||
getString(R.string.slope_read_more),
|
getString(R.string.slope_read_more),
|
||||||
wikiString
|
wikiString
|
||||||
);
|
);
|
||||||
|
String emptyStateText = String.format(
|
||||||
|
getString(R.string.ltr_or_rtl_combine_via_space),
|
||||||
|
getString(R.string.terrain_empty_state_text),
|
||||||
|
PLUGIN_URL
|
||||||
|
);
|
||||||
setupClickableText(slopeReadMoreTv, readMoreText, wikiString, SLOPES_WIKI_URL);
|
setupClickableText(slopeReadMoreTv, readMoreText, wikiString, SLOPES_WIKI_URL);
|
||||||
|
setupClickableText(emptyStateDescriptionTv, emptyStateText, PLUGIN_URL, PLUGIN_URL);
|
||||||
|
|
||||||
switchCompat.setChecked(terrainEnabled);
|
switchCompat.setChecked(terrainEnabled);
|
||||||
|
hillshadeBtn.setOnClickListener(this);
|
||||||
switchCompat.setOnClickListener(this);
|
switchCompat.setOnClickListener(this);
|
||||||
slopeBtn.setOnClickListener(this);
|
slopeBtn.setOnClickListener(this);
|
||||||
hillshadeBtn.setOnClickListener(this);
|
|
||||||
|
transparencySlider.setTrackColorInactive(colorProfileInactiveStateList);
|
||||||
|
transparencySlider.setTrackColorActive(colorProfileStateList);
|
||||||
|
transparencySlider.setHaloColor(colorProfileInactiveStateList);
|
||||||
|
transparencySlider.setThumbColor(colorProfileStateList);
|
||||||
|
transparencySlider.setLabelBehavior(Slider.LABEL_GONE);
|
||||||
|
zoomSlider.setTrackColorInactive(colorProfileInactiveStateList);
|
||||||
|
zoomSlider.setTrackColorActive(colorProfileStateList);
|
||||||
|
zoomSlider.setHaloColor(colorProfileInactiveStateList);
|
||||||
|
zoomSlider.setThumbColor(colorProfileStateList);
|
||||||
|
zoomSlider.setLabelBehavior(Slider.LABEL_GONE);
|
||||||
|
zoomSlider.setTickColor(nightMode
|
||||||
|
? ColorStateList.valueOf(R.color.color_white)
|
||||||
|
: ColorStateList.valueOf(R.color.color_black));
|
||||||
|
|
||||||
|
transparencySlider.addOnSliderTouchListener(this);
|
||||||
|
zoomSlider.addOnSliderTouchListener(this);
|
||||||
|
transparencySlider.addOnChangeListener(this);
|
||||||
|
zoomSlider.addOnChangeListener(this);
|
||||||
|
|
||||||
|
UiUtilities.setupCompoundButton(switchCompat, nightMode, UiUtilities.CompoundButtonType.PROFILE_DEPENDENT);
|
||||||
|
|
||||||
updateUiMode();
|
updateUiMode();
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
@ -170,15 +196,63 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStartTrackingTouch(@NonNull Slider slider) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStopTrackingTouch(@NonNull Slider slider) {
|
||||||
|
switch (slider.getId()) {
|
||||||
|
case R.id.transparency_slider:
|
||||||
|
srtmPlugin.setTransparency((int) slider.getValue());
|
||||||
|
break;
|
||||||
|
case R.id.zoom_slider:
|
||||||
|
List<Float> values = slider.getValues();
|
||||||
|
srtmPlugin.setZoomValues(values.get(0).intValue(), values.get(1).intValue());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
MapActivity mapActivity = (MapActivity) getActivity();
|
||||||
|
srtmPlugin.updateLayers(mapActivity.getMapView(), mapActivity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onValueChange(@NonNull Slider slider, float value, boolean fromUser) {
|
||||||
|
if (fromUser) {
|
||||||
|
switch (slider.getId()) {
|
||||||
|
case R.id.transparency_slider:
|
||||||
|
String transparency = (int) value + "%";
|
||||||
|
transparencyValueTv.setText(transparency);
|
||||||
|
break;
|
||||||
|
case R.id.zoom_slider:
|
||||||
|
List<Float> values = slider.getValues();
|
||||||
|
minZoomTv.setText(String.valueOf(values.get(0).intValue()));
|
||||||
|
maxZoomTv.setText(String.valueOf(values.get(1).intValue()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateUiMode() {
|
private void updateUiMode() {
|
||||||
TerrainMode mode = srtmPlugin.getTerrainMode();
|
TerrainMode mode = srtmPlugin.getTerrainMode();
|
||||||
if (terrainEnabled) {
|
if (terrainEnabled) {
|
||||||
|
int transparencyValue = srtmPlugin.getTransparency();
|
||||||
|
String transparency = transparencyValue + "%";
|
||||||
|
int minZoom = srtmPlugin.getMinZoom();
|
||||||
|
int maxZoom = srtmPlugin.getMaxZoom();
|
||||||
iconIv.setImageDrawable(uiUtilities.getIcon(R.drawable.ic_action_hillshade_dark, colorProfile));
|
iconIv.setImageDrawable(uiUtilities.getIcon(R.drawable.ic_action_hillshade_dark, colorProfile));
|
||||||
stateTv.setText(R.string.shared_string_enabled);
|
stateTv.setText(R.string.shared_string_enabled);
|
||||||
|
transparencySlider.setValue(transparencyValue);
|
||||||
|
transparencyValueTv.setText(transparency);
|
||||||
|
zoomSlider.setValues((float) minZoom, (float) maxZoom);
|
||||||
|
minZoomTv.setText(String.valueOf(minZoom));
|
||||||
|
maxZoomTv.setText(String.valueOf(maxZoom));
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case HILLSHADE:
|
case HILLSHADE:
|
||||||
descriptionTv.setText(R.string.hillshade_description);
|
descriptionTv.setText(R.string.hillshade_description);
|
||||||
downloadDescriptionTv.setText(R.string.hillshade_download_description);
|
downloadDescriptionTv.setText(R.string.hillshade_download_description);
|
||||||
|
// zoomSlider.setValueFrom();
|
||||||
|
// zoomSlider.setValueTo();
|
||||||
break;
|
break;
|
||||||
case SLOPE:
|
case SLOPE:
|
||||||
descriptionTv.setText(R.string.slope_description);
|
descriptionTv.setText(R.string.slope_description);
|
||||||
|
@ -255,7 +329,7 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL
|
||||||
? getResources().getColor(R.color.active_color_primary_dark)
|
? getResources().getColor(R.color.active_color_primary_dark)
|
||||||
: getResources().getColor(R.color.active_color_primary_light));
|
: getResources().getColor(R.color.active_color_primary_light));
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// LOG.error("Error trying to find index of " + clickableText + " " + e);
|
LOG.error("Error trying to find index of " + clickableText + " " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,6 +347,4 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL
|
||||||
updateUiMode();
|
updateUiMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue