Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
1445a3867f
14 changed files with 1748 additions and 197 deletions
|
@ -11,6 +11,18 @@
|
|||
-->
|
||||
|
||||
<!-- Not translatable -->
|
||||
<string name="search_map">Searching map…</string>
|
||||
<string name="first_usage_wizard_desc">We would like to determine your location and suggest to download map of this region.</string>
|
||||
<string name="location_not_found">Location not found</string>
|
||||
<string name="no_inet_connection">No internet connection</string>
|
||||
<string name="no_inet_connection_desc_map">Required to download the map</string>
|
||||
<string name="search_location">Searching location…</string>
|
||||
<string name="storage_free_space">Free space</string>
|
||||
<string name="storage_place_description">OsmAnd holds the data (maps, tracks, etc.) in the %1$s.</string>
|
||||
<string name="give_permission">Give permission</string>
|
||||
<string name="allow_access_location">Allow access to location</string>
|
||||
<string name="maps_and_navigation">Maps & Navigation</string>
|
||||
<string name="first_usage_greeting">Get directions, discover new places, without internet connection</string>
|
||||
<string name="osm_live">OSM Live (Beta)</string>
|
||||
<string name="ga_api_key">UA-28342846-2</string>
|
||||
<string name="ga_dispatchPeriod">10</string>
|
||||
|
|
20
OsmAnd/res/drawable/btn_round_blue_bottom.xml
Normal file
20
OsmAnd/res/drawable/btn_round_blue_bottom.xml
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_pressed="true"><shape android:shape="rectangle">
|
||||
<solid android:color="@color/map_widget_blue_pressed" />
|
||||
<corners android:bottomLeftRadius="@dimen/map_button_rect_rad"/>
|
||||
<corners android:bottomRightRadius="@dimen/map_button_rect_rad"/>
|
||||
</shape></item>
|
||||
<item android:state_enabled="false"><shape android:shape="rectangle">
|
||||
<solid android:color="@color/searchbar_tab_inactive_light" />
|
||||
<corners android:bottomLeftRadius="@dimen/map_button_rect_rad"/>
|
||||
<corners android:bottomRightRadius="@dimen/map_button_rect_rad"/>
|
||||
</shape></item>
|
||||
<item><shape android:shape="rectangle">
|
||||
<solid android:color="@color/map_widget_blue" />
|
||||
<corners android:bottomLeftRadius="@dimen/map_button_rect_rad"/>
|
||||
<corners android:bottomRightRadius="@dimen/map_button_rect_rad"/>
|
||||
</shape></item>
|
||||
|
||||
</selector>
|
|
@ -1,100 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:clickable="true"
|
||||
android:theme="@style/OsmandLightTheme">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/background_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:background="@color/osmand_orange"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="@color/color_transparent"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="16dp"
|
||||
android:paddingLeft="40dp"
|
||||
android:paddingRight="40dp">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name_osmand"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/first_usage_title_text_size"
|
||||
android:textStyle="bold"
|
||||
osmand:typeface="@string/font_roboto_regular"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="27dp"
|
||||
android:fontFamily="sans-serif-thin"
|
||||
android:text="@string/offline_maps_and_navigation"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/first_usage_title_text_size"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/shared_string_download_map"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/card_view"
|
||||
android:layout_width="280dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="center"
|
||||
osmand:cardCornerRadius="2dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/searchEditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:background="@null"
|
||||
tools:drawableLeft="@drawable/ic_action_search_dark"
|
||||
android:drawablePadding="12dp"
|
||||
android:gravity="center_vertical"
|
||||
android:hint="@string/enter_country_name"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/skip_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="skip skip skip"
|
||||
android:padding="12dp"
|
||||
android:background="@drawable/btn_round"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/shared_string_skip"
|
||||
android:textColor="@color/dashboard_general_button_text_light"/>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
|
@ -4,7 +4,6 @@
|
|||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:clickable="true"
|
||||
android:theme="@style/OsmandLightTheme">
|
||||
|
||||
|
@ -23,78 +22,82 @@
|
|||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="16dp"
|
||||
android:paddingLeft="40dp"
|
||||
android:paddingRight="40dp"
|
||||
android:paddingTop="@dimen/first_usage_title_margin">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:src="@drawable/icon"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginLeft="2dp">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="smAnd"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/first_usage_title_text_size"
|
||||
android:textStyle="bold"
|
||||
osmand:typeface="@string/font_roboto_regular"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-thin"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:text="@string/maps_and_navigation"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/first_usage_subtitle_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name_osmand"
|
||||
android:text="@string/first_usage_greeting"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/first_usage_title_text_size"
|
||||
android:layout_marginLeft="180dp"
|
||||
android:layout_marginRight="180dp"
|
||||
android:textSize="@dimen/first_usage_subtitle_text_size"
|
||||
android:textStyle="bold"
|
||||
osmand:typeface="@string/font_roboto_regular"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-thin"
|
||||
android:text="@string/offline_maps_and_navigation"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/first_usage_title_text_size"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/shared_string_download_map"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/card_view"
|
||||
android:layout_width="280dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="center"
|
||||
osmand:cardCornerRadius="2dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/searchEditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:background="@null"
|
||||
tools:drawableLeft="@drawable/ic_action_search_dark"
|
||||
android:drawablePadding="12dp"
|
||||
android:gravity="center_vertical"
|
||||
android:hint="@string/enter_country_name"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/skip_button"
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/start_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
tools:text="skip skip skip"
|
||||
android:padding="12dp"
|
||||
android:background="@drawable/btn_round"
|
||||
android:text="@string/shared_string_skip"
|
||||
android:textColor="@color/dashboard_general_button_text_light"/>
|
||||
android:layout_marginBottom="@dimen/first_usage_title_margin_bottom"
|
||||
android:background="@drawable/btn_round_blue"
|
||||
android:padding="14dp"
|
||||
android:text="@string/get_started"
|
||||
android:textColor="@color/color_white"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
102
OsmAnd/res/layout/first_usage_welcome_fragment.xml
Normal file
102
OsmAnd/res/layout/first_usage_welcome_fragment.xml
Normal file
|
@ -0,0 +1,102 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:theme="@style/OsmandLightTheme">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/background_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/osmand_orange"
|
||||
android:scaleType="centerCrop"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="@color/color_transparent"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="40dp"
|
||||
android:paddingRight="40dp"
|
||||
android:paddingTop="@dimen/first_usage_title_margin">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:src="@drawable/icon"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginLeft="2dp">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="smAnd"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/first_usage_title_text_size"
|
||||
android:textStyle="bold"
|
||||
osmand:typeface="@string/font_roboto_regular"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-thin"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:text="@string/maps_and_navigation"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/first_usage_subtitle_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/first_usage_greeting"
|
||||
android:textColor="@color/color_white"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:textSize="@dimen/first_usage_subtitle_text_size"
|
||||
android:textStyle="bold"
|
||||
osmand:typeface="@string/font_roboto_regular"/>
|
||||
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/start_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="@dimen/first_usage_title_margin_bottom"
|
||||
android:background="@drawable/btn_round_blue"
|
||||
android:padding="14dp"
|
||||
android:text="@string/get_started"
|
||||
android:textColor="@color/color_white"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
809
OsmAnd/res/layout/first_usage_wizard_fragment.xml
Normal file
809
OsmAnd/res/layout/first_usage_wizard_fragment.xml
Normal file
|
@ -0,0 +1,809 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:theme="@style/OsmandLightTheme">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
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:orientation="horizontal">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="44dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/icon_small"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wizard_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/shared_string_download_map"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/first_usage_subtitle_text_size"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/skip_button"
|
||||
style="@style/Widget.AppCompat.Button.ButtonBar.AlertDialog"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@string/shared_string_skip"
|
||||
android:textColor="@color/color_dialog_buttons_light"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wizard_description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="54dp"
|
||||
android:layout_marginRight="54dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:minHeight="106dp"
|
||||
android:text="@string/first_usage_wizard_desc"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/no_location_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:visibility="gone"
|
||||
osmand:cardBackgroundColor="@color/color_white">
|
||||
|
||||
<LinearLayout
|
||||
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:minHeight="48dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/no_location_icon"
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="60dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_location_off"
|
||||
android:tint="@color/icon_color"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="14dp"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="35dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_location_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/location_not_found"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/dashboard_divider_light"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/no_location_action_button"
|
||||
style="@style/Widget.AppCompat.Button.ButtonBar.AlertDialog"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:minHeight="47dp"
|
||||
android:text="@string/try_again"
|
||||
android:textColor="@color/color_dialog_buttons_light"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/no_inet_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:visibility="gone"
|
||||
osmand:cardBackgroundColor="@color/color_white">
|
||||
|
||||
<LinearLayout
|
||||
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:minHeight="48dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/no_inet_icon"
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="60dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_wifi_off"
|
||||
android:tint="@color/icon_color"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="14dp"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="35dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_inet_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/no_inet_connection"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_inet_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="@string/no_inet_connection_desc_map"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/dashboard_divider_light"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/no_inet_action_button"
|
||||
style="@style/Widget.AppCompat.Button.ButtonBar.AlertDialog"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:minHeight="47dp"
|
||||
android:text="@string/try_again"
|
||||
android:textColor="@color/color_dialog_buttons_light"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/search_location_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:visibility="gone"
|
||||
osmand:cardBackgroundColor="@color/color_white">
|
||||
|
||||
<LinearLayout
|
||||
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:minHeight="48dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="60dp"
|
||||
android:gravity="center">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/search_location_progress_bar"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:indeterminate="true"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="14dp"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="35dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/search_location_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/search_location"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/search_location_action_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/btn_round_blue_bottom"
|
||||
android:enabled="false"
|
||||
android:gravity="center"
|
||||
android:minHeight="48dp"
|
||||
android:text="@string/shared_string_download"
|
||||
android:textColor="@color/color_white"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/search_map_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:visibility="gone"
|
||||
osmand:cardBackgroundColor="@color/color_white">
|
||||
|
||||
<LinearLayout
|
||||
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:minHeight="48dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="60dp"
|
||||
android:gravity="center">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/search_map_progress_bar"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:indeterminate="true"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="14dp"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="35dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/search_map_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/search_map"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/search_map_action_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/btn_round_blue_bottom"
|
||||
android:enabled="false"
|
||||
android:gravity="center"
|
||||
android:minHeight="48dp"
|
||||
android:text="@string/shared_string_download"
|
||||
android:textColor="@color/color_white"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/map_download_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:visibility="gone"
|
||||
osmand:cardBackgroundColor="@color/color_white">
|
||||
|
||||
<LinearLayout
|
||||
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:minHeight="48dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/map_download_icon"
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="60dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_map"
|
||||
android:tint="@color/icon_color"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="14dp"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="35dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/map_download_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="The Netherlands"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/map_download_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"
|
||||
tools:text="255 MB"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/map_download_action_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/btn_round_blue_bottom"
|
||||
android:gravity="center"
|
||||
android:minHeight="48dp"
|
||||
android:text="@string/shared_string_download"
|
||||
android:textColor="@color/color_white"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/map_downloading_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:visibility="gone"
|
||||
osmand:cardBackgroundColor="@color/color_white">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/map_downloading_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="48dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/map_downloading_icon"
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="60dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_map"
|
||||
android:tint="@color/icon_color"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="14dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="14dp"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="35dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/map_downloading_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="The Netherlands"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/map_downloading_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"
|
||||
tools:text="255 MB"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/map_download_padding"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="14dp"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/map_download_progress_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-8dp"
|
||||
android:visibility="visible"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/map_download_progress_bar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/map_download_progress_button"
|
||||
style="@style/Widget.AppCompat.ActionButton"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:contentDescription="@string/shared_string_cancel"
|
||||
android:src="@drawable/map_action_cancel"
|
||||
android:tint="@color/icon_color"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/map_downloading_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/dashboard_divider_light"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/map2_downloading_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="48dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/map2_downloading_icon"
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="60dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_map"
|
||||
android:tint="@color/icon_color"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="14dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="14dp"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="35dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/map2_downloading_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="The Netherlands"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/map2_downloading_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"
|
||||
tools:text="255 MB"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/map2_download_padding"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="14dp"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/map2_download_progress_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/map2_download_progress_bar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/map2_download_progress_button"
|
||||
style="@style/Widget.AppCompat.ActionButton"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:contentDescription="@string/shared_string_cancel"
|
||||
android:src="@drawable/map_action_cancel"
|
||||
android:tint="@color/icon_color"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/map2_downloading_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/dashboard_divider_light"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/map_downloading_action_button"
|
||||
style="@style/Widget.AppCompat.Button.ButtonBar.AlertDialog"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:minHeight="47dp"
|
||||
android:text="@string/go_to_map"
|
||||
android:textColor="@color/color_dialog_buttons_light"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/action_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="@dimen/first_usage_title_margin_bottom"
|
||||
android:background="@drawable/btn_round_blue"
|
||||
android:padding="14dp"
|
||||
android:text="@string/give_permission"
|
||||
android:textColor="@color/color_white"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/storage_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider_color"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/storage_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="14dp"
|
||||
android:text="@string/storage_place_description"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/storage_free_space"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/storage_free_space"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/storage_free_space_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textStyle="bold"
|
||||
tools:text=" 12 GB"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/storage_change_button"
|
||||
style="@style/Widget.AppCompat.Button.ButtonBar.AlertDialog"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@string/shared_string_change"
|
||||
android:textColor="@color/color_dialog_buttons_light"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
|
@ -3,6 +3,8 @@
|
|||
<dimen name="app_defaultsize_h">400dip</dimen>
|
||||
<dimen name="app_minimumsize_w">400dip</dimen>
|
||||
<dimen name="app_minimumsize_h">200dip</dimen>
|
||||
<dimen name="first_usage_title_margin">87dp</dimen>
|
||||
<dimen name="first_usage_title_text_size">35sp</dimen>
|
||||
<dimen name="first_usage_title_margin">110dp</dimen>
|
||||
<dimen name="first_usage_title_margin_bottom">56dp</dimen>
|
||||
<dimen name="first_usage_title_text_size">52sp</dimen>
|
||||
<dimen name="first_usage_subtitle_text_size">18sp</dimen>
|
||||
</resources>
|
|
@ -9,8 +9,13 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<<<<<<< HEAD
|
||||
<string name="rendering_attr_hideOverground_name">Overground objects</string>
|
||||
|
||||
=======
|
||||
<string name="shared_string_change">Change</string>
|
||||
<string name="get_started">Get started</string>
|
||||
>>>>>>> 3ba6e68... First usage wizard in progress
|
||||
<string name="route_stops_before">%1$s stops before</string>
|
||||
<string name="coords_search">Coordinates search</string>
|
||||
<string name="advanced_coords_search">Advanced coordinates search</string>
|
||||
|
|
|
@ -37,6 +37,7 @@ import android.widget.ProgressBar;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.StateChangedListener;
|
||||
|
@ -54,7 +55,7 @@ import net.osmand.plus.AppInitializer;
|
|||
import net.osmand.plus.AppInitializer.AppInitializeListener;
|
||||
import net.osmand.plus.AppInitializer.InitEvents;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.FirstUsageFragment;
|
||||
import net.osmand.plus.firstusage.FirstUsageWelcomeFragment;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarkerChangedListener;
|
||||
import net.osmand.plus.OsmAndConstants;
|
||||
|
@ -74,6 +75,7 @@ import net.osmand.plus.dialogs.WhatsNewDialogFragment;
|
|||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||
import net.osmand.plus.download.ui.DataStoragePlaceDialogFragment;
|
||||
import net.osmand.plus.firstusage.FirstUsageWizardFragment;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.helpers.DiscountHelper;
|
||||
import net.osmand.plus.helpers.ExternalApiHelper;
|
||||
|
@ -106,6 +108,7 @@ import net.osmand.util.Algorithms;
|
|||
import org.apache.commons.logging.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
@ -272,11 +275,11 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
}
|
||||
mapView.refreshMap(true);
|
||||
|
||||
if (getMyApplication().getAppInitializer().isFirstTime() && FirstUsageFragment.SHOW) {
|
||||
FirstUsageFragment.SHOW = false;
|
||||
if ((getMyApplication().getAppInitializer().isFirstTime() || !app.getResourceManager().isAnyMapIstalled()) && FirstUsageWelcomeFragment.SHOW) {
|
||||
FirstUsageWelcomeFragment.SHOW = false;
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.add(R.id.fragmentContainer, new FirstUsageFragment(),
|
||||
FirstUsageFragment.TAG).commit();
|
||||
.add(R.id.fragmentContainer, new FirstUsageWelcomeFragment(),
|
||||
FirstUsageWelcomeFragment.TAG).commit();
|
||||
}
|
||||
mapActions.updateDrawerMenu();
|
||||
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
|
@ -1249,6 +1252,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
// DownloadEvents
|
||||
@Override
|
||||
public void newDownloadIndexes() {
|
||||
FirstUsageWizardFragment wizardFragment = (FirstUsageWizardFragment) getSupportFragmentManager().findFragmentByTag(FirstUsageWizardFragment.TAG);
|
||||
if (wizardFragment != null && !wizardFragment.isDetached()) {
|
||||
wizardFragment.newDownloadIndexes();
|
||||
}
|
||||
WeakReference<MapContextMenuFragment> fragmentRef = getContextMenu().findMenuFragment();
|
||||
if (fragmentRef != null) {
|
||||
fragmentRef.get().newDownloadIndexes();
|
||||
|
@ -1258,6 +1265,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
|
||||
@Override
|
||||
public void downloadInProgress() {
|
||||
FirstUsageWizardFragment wizardFragment = (FirstUsageWizardFragment) getSupportFragmentManager().findFragmentByTag(FirstUsageWizardFragment.TAG);
|
||||
if (wizardFragment != null && !wizardFragment.isDetached()) {
|
||||
wizardFragment.downloadInProgress();
|
||||
}
|
||||
WeakReference<MapContextMenuFragment> fragmentRef = getContextMenu().findMenuFragment();
|
||||
if (fragmentRef != null) {
|
||||
fragmentRef.get().downloadInProgress();
|
||||
|
@ -1266,6 +1277,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
|
||||
@Override
|
||||
public void downloadHasFinished() {
|
||||
FirstUsageWizardFragment wizardFragment = (FirstUsageWizardFragment) getSupportFragmentManager().findFragmentByTag(FirstUsageWizardFragment.TAG);
|
||||
if (wizardFragment != null && !wizardFragment.isDetached()) {
|
||||
wizardFragment.downloadHasFinished();
|
||||
}
|
||||
WeakReference<MapContextMenuFragment> fragmentRef = getContextMenu().findMenuFragment();
|
||||
if (fragmentRef != null) {
|
||||
fragmentRef.get().downloadHasFinished();
|
||||
|
@ -1287,6 +1302,12 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
&& Manifest.permission.WRITE_EXTERNAL_STORAGE.equals(permissions[0])) {
|
||||
permissionAsked = true;
|
||||
permissionGranted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
|
||||
|
||||
} else if (requestCode == FirstUsageWizardFragment.FIRST_USAGE_LOCATION_PERMISSION) {
|
||||
FirstUsageWizardFragment wizardFragment = (FirstUsageWizardFragment) getSupportFragmentManager().findFragmentByTag(FirstUsageWizardFragment.TAG);
|
||||
if (wizardFragment != null && !wizardFragment.isDetached()) {
|
||||
wizardFragment.processLocationPermission(grantResults[0] == PackageManager.PERMISSION_GRANTED);
|
||||
}
|
||||
}
|
||||
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
|
|
|
@ -200,9 +200,16 @@ public class DownloadIndexesThread {
|
|||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
public void runReloadIndexFilesSilent() {
|
||||
if (checkRunning(true)) {
|
||||
return;
|
||||
}
|
||||
execute(new ReloadIndexesTask());
|
||||
}
|
||||
|
||||
public void runReloadIndexFiles() {
|
||||
if (checkRunning()) {
|
||||
if (checkRunning(false)) {
|
||||
return;
|
||||
}
|
||||
execute(new ReloadIndexesTask());
|
||||
|
@ -210,7 +217,7 @@ public class DownloadIndexesThread {
|
|||
|
||||
public void runDownloadFiles(IndexItem... items) {
|
||||
if (getCurrentRunningTask() instanceof ReloadIndexesTask) {
|
||||
if(checkRunning()) {
|
||||
if(checkRunning(false)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -271,9 +278,11 @@ public class DownloadIndexesThread {
|
|||
|
||||
/// PRIVATE IMPL
|
||||
|
||||
private boolean checkRunning() {
|
||||
private boolean checkRunning(boolean silent) {
|
||||
if (getCurrentRunningTask() != null) {
|
||||
Toast.makeText(app, R.string.wait_current_task_finished, Toast.LENGTH_SHORT).show();
|
||||
if (!silent) {
|
||||
Toast.makeText(app, R.string.wait_current_task_finished, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -1,59 +1,44 @@
|
|||
package net.osmand.plus;
|
||||
package net.osmand.plus.firstusage;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.AppCompatButton;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.R;
|
||||
|
||||
public class FirstUsageFragment extends Fragment {
|
||||
public static final String TAG = "FirstUsageFragment";
|
||||
public class FirstUsageWelcomeFragment extends Fragment {
|
||||
public static final String TAG = "FirstUsageWelcomeFragment";
|
||||
public static boolean SHOW = true;
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.first_usage_fragment, container, false);
|
||||
View view = inflater.inflate(R.layout.first_usage_welcome_fragment, container, false);
|
||||
ImageView backgroundImage = (ImageView) view.findViewById(R.id.background_image);
|
||||
if (Build.VERSION.SDK_INT >= 14) {
|
||||
backgroundImage.setImageResource(R.drawable.bg_first_usage);
|
||||
} else {
|
||||
backgroundImage.setImageDrawable(null);
|
||||
}
|
||||
final EditText editText = (EditText) view.findViewById(R.id.searchEditText);
|
||||
Drawable searchIcon = ((MapActivity) getActivity()).getMyApplication().getIconsCache()
|
||||
.getIcon(R.drawable.ic_action_search_dark, true);
|
||||
editText.setCompoundDrawablesWithIntrinsicBounds(searchIcon, null, null, null);
|
||||
Button skipButton = (Button) view.findViewById(R.id.skip_button);
|
||||
|
||||
AppCompatButton skipButton = (AppCompatButton) view.findViewById(R.id.start_button);
|
||||
skipButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
getActivity().getSupportFragmentManager().beginTransaction()
|
||||
.remove(FirstUsageFragment.this).commit();
|
||||
}
|
||||
});
|
||||
editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (hasFocus) {
|
||||
getActivity().getSupportFragmentManager().beginTransaction()
|
||||
.remove(FirstUsageFragment.this).commit();
|
||||
final Intent intent = new Intent(getActivity(), DownloadActivity.class);
|
||||
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB);
|
||||
getActivity().startActivity(intent);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
Window w = getActivity().getWindow();
|
||||
w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
}
|
||||
FirstUsageWizardFragment.startWizard(getActivity());
|
||||
}
|
||||
});
|
||||
return view;
|
|
@ -0,0 +1,671 @@
|
|||
package net.osmand.plus.firstusage;
|
||||
|
||||
import android.Manifest;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.StatFs;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v7.widget.AppCompatButton;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidNetworkUtils;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.ValueHolder;
|
||||
import net.osmand.binary.BinaryMapDataObject;
|
||||
import net.osmand.map.OsmandRegions;
|
||||
import net.osmand.map.WorldRegion;
|
||||
import net.osmand.plus.AppInitializer;
|
||||
import net.osmand.plus.AppInitializer.AppInitializeListener;
|
||||
import net.osmand.plus.OsmAndLocationProvider;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.download.DownloadActivityType;
|
||||
import net.osmand.plus.download.DownloadIndexesThread;
|
||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||
import net.osmand.plus.download.DownloadValidationManager;
|
||||
import net.osmand.plus.download.IndexItem;
|
||||
import net.osmand.plus.download.ui.DataStoragePlaceDialogFragment;
|
||||
import net.osmand.plus.resources.ResourceManager;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class FirstUsageWizardFragment extends Fragment implements OsmAndLocationListener,
|
||||
AppInitializeListener, DownloadEvents {
|
||||
public static final String TAG = "FirstUsageWizardFrag";
|
||||
public static final int FIRST_USAGE_LOCATION_PERMISSION = 300;
|
||||
public static final String WIZARD_TYPE_KEY = "wizard_type_key";
|
||||
public static final String SEARCH_LOCATION_BY_IP_KEY = "search_location_by_ip_key";
|
||||
|
||||
private View view;
|
||||
private DownloadIndexesThread downloadThread;
|
||||
private MessageFormat formatGb = new MessageFormat("{0, number,#.##} GB", Locale.US);
|
||||
|
||||
private static WizardType wizardType;
|
||||
private static final WizardType DEFAULT_WIZARD_TYPE = WizardType.SEARCH_LOCATION;
|
||||
private static boolean searchLocationByIp;
|
||||
|
||||
private Timer locationSearchTimer;
|
||||
private boolean waitForIndexes;
|
||||
List<IndexItem> indexItems = new ArrayList<>();
|
||||
|
||||
private static Location location;
|
||||
private static IndexItem localMapIndexItem;
|
||||
private static IndexItem baseMapIndexItem;
|
||||
private static boolean firstMapDownloadCancelled;
|
||||
private static boolean secondMapDownloadCancelled;
|
||||
|
||||
enum WizardType {
|
||||
SEARCH_LOCATION,
|
||||
NO_INTERNET,
|
||||
NO_LOCATION,
|
||||
SEARCH_MAP,
|
||||
MAP_FOUND,
|
||||
MAP_DOWNLOAD
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
downloadThread = getMyApplication().getDownloadThread();
|
||||
Bundle args = getArguments();
|
||||
if (args != null) {
|
||||
wizardType = WizardType.valueOf(args.getString(WIZARD_TYPE_KEY, DEFAULT_WIZARD_TYPE.name()));
|
||||
searchLocationByIp = args.getBoolean(SEARCH_LOCATION_BY_IP_KEY, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
view = inflater.inflate(R.layout.first_usage_wizard_fragment, container, false);
|
||||
|
||||
AppCompatButton skipButton = (AppCompatButton) view.findViewById(R.id.skip_button);
|
||||
skipButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// todo show dialog
|
||||
closeWizard();
|
||||
}
|
||||
});
|
||||
|
||||
view.findViewById(R.id.action_button).setVisibility(View.GONE);
|
||||
|
||||
switch (wizardType) {
|
||||
case SEARCH_LOCATION:
|
||||
view.findViewById(R.id.search_location_card).setVisibility(View.VISIBLE);
|
||||
view.findViewById(R.id.search_location_action_button).setEnabled(false);
|
||||
break;
|
||||
case NO_INTERNET:
|
||||
view.findViewById(R.id.no_inet_card).setVisibility(View.VISIBLE);
|
||||
view.findViewById(R.id.no_inet_action_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startWizard(getActivity());
|
||||
}
|
||||
});
|
||||
break;
|
||||
case NO_LOCATION:
|
||||
view.findViewById(R.id.no_location_card).setVisibility(View.VISIBLE);
|
||||
view.findViewById(R.id.no_location_action_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
findLocation(getActivity(), false);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case SEARCH_MAP:
|
||||
view.findViewById(R.id.search_map_card).setVisibility(View.VISIBLE);
|
||||
view.findViewById(R.id.search_map_action_button).setEnabled(false);
|
||||
break;
|
||||
case MAP_FOUND:
|
||||
TextView mapTitle = (TextView) view.findViewById(R.id.map_download_title);
|
||||
TextView mapDescription = (TextView) view.findViewById(R.id.map_download_desc);
|
||||
IndexItem indexItem = localMapIndexItem != null ? localMapIndexItem : baseMapIndexItem;
|
||||
if (indexItem != null) {
|
||||
mapTitle.setText(indexItem.getVisibleName(getContext(), getMyApplication().getRegions(), false));
|
||||
mapDescription.setText(indexItem.getSizeDescription(getContext()));
|
||||
}
|
||||
view.findViewById(R.id.map_download_action_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showMapDownloadFragment(getActivity());
|
||||
}
|
||||
});
|
||||
view.findViewById(R.id.map_download_card).setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case MAP_DOWNLOAD:
|
||||
if (localMapIndexItem != null) {
|
||||
indexItems.add(localMapIndexItem);
|
||||
}
|
||||
if (baseMapIndexItem != null) {
|
||||
indexItems.add(baseMapIndexItem);
|
||||
}
|
||||
|
||||
if (indexItems.size() > 0) {
|
||||
final IndexItem item = indexItems.get(0);
|
||||
String mapName = item.getVisibleName(getContext(), getMyApplication().getRegions(), false);
|
||||
TextView mapNameTextView = (TextView) view.findViewById(R.id.map_downloading_title);
|
||||
mapNameTextView.setText(mapName);
|
||||
final TextView mapDescriptionTextView = (TextView) view.findViewById(R.id.map_downloading_desc);
|
||||
final View progressPadding = view.findViewById(R.id.map_download_padding);
|
||||
final View progressLayout = view.findViewById(R.id.map_download_progress_layout);
|
||||
mapDescriptionTextView.setText(item.getSizeDescription(getContext()));
|
||||
view.findViewById(R.id.map_download_progress_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
downloadThread.cancelDownload(item);
|
||||
firstMapDownloadCancelled = true;
|
||||
mapDescriptionTextView.setText(item.getSizeDescription(getContext()));
|
||||
progressPadding.setVisibility(View.VISIBLE);
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
if (item.isDownloaded() || firstMapDownloadCancelled) {
|
||||
progressPadding.setVisibility(View.VISIBLE);
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
}
|
||||
view.findViewById(R.id.map_downloading_layout).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
view.findViewById(R.id.map_downloading_layout).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.map_downloading_divider).setVisibility(View.GONE);
|
||||
}
|
||||
if (indexItems.size() > 1) {
|
||||
final IndexItem item = indexItems.get(1);
|
||||
String mapName = item.getVisibleName(getContext(), getMyApplication().getRegions(), false);
|
||||
TextView mapNameTextView = (TextView) view.findViewById(R.id.map2_downloading_title);
|
||||
mapNameTextView.setText(mapName);
|
||||
final TextView mapDescriptionTextView = (TextView) view.findViewById(R.id.map2_downloading_desc);
|
||||
final View progressPadding = view.findViewById(R.id.map2_download_padding);
|
||||
final View progressLayout = view.findViewById(R.id.map2_download_progress_layout);
|
||||
mapDescriptionTextView.setText(item.getSizeDescription(getContext()));
|
||||
view.findViewById(R.id.map2_download_progress_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
downloadThread.cancelDownload(item);
|
||||
secondMapDownloadCancelled = true;
|
||||
mapDescriptionTextView.setText(item.getSizeDescription(getContext()));
|
||||
progressPadding.setVisibility(View.VISIBLE);
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
if (item.isDownloaded() || secondMapDownloadCancelled) {
|
||||
progressPadding.setVisibility(View.VISIBLE);
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
}
|
||||
view.findViewById(R.id.map2_downloading_layout).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
view.findViewById(R.id.map_downloading_divider).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.map2_downloading_layout).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
view.findViewById(R.id.map_downloading_action_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MapActivity mapActivity = (MapActivity) getActivity();
|
||||
mapActivity.setMapLocation(location.getLatitude(), location.getLongitude());
|
||||
mapActivity.getMapView().setIntZoom(5);
|
||||
closeWizard();
|
||||
}
|
||||
});
|
||||
view.findViewById(R.id.map_downloading_card).setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
|
||||
updateStorageView(view.findViewById(R.id.storage_layout));
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
final OsmandApplication app = getMyApplication();
|
||||
|
||||
switch (wizardType) {
|
||||
case SEARCH_LOCATION:
|
||||
if (searchLocationByIp) {
|
||||
new AsyncTask<Void, Void, String>() {
|
||||
|
||||
@Override
|
||||
protected String doInBackground(Void... params) {
|
||||
try {
|
||||
return AndroidNetworkUtils.sendRequest(app,
|
||||
"http://osmand.net/api/geo-ip", null, "Requesting location by IP...", false);
|
||||
|
||||
} catch (Exception e) {
|
||||
logError("Requesting location by IP error: ", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String response) {
|
||||
if (response != null) {
|
||||
try {
|
||||
JSONObject obj = new JSONObject(response);
|
||||
double latitude = obj.getDouble("latitude");
|
||||
double longitude = obj.getDouble("longitude");
|
||||
location = new Location("geo-ip");
|
||||
location.setLatitude(latitude);
|
||||
location.setLongitude(longitude);
|
||||
|
||||
showSearchMapFragment(getActivity());
|
||||
} catch (Exception e) {
|
||||
logError("JSON parsing error: ", e);
|
||||
showNoLocationFragment(getActivity());
|
||||
}
|
||||
} else {
|
||||
showNoLocationFragment(getActivity());
|
||||
}
|
||||
}
|
||||
}.execute();
|
||||
|
||||
} else {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (!OsmAndLocationProvider.isLocationPermissionAvailable(activity)) {
|
||||
ActivityCompat.requestPermissions(activity,
|
||||
new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
|
||||
FIRST_USAGE_LOCATION_PERMISSION);
|
||||
} else {
|
||||
app.getLocationProvider().addLocationListener(this);
|
||||
locationSearchTimer = new Timer();
|
||||
locationSearchTimer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
FragmentActivity a = getActivity();
|
||||
if (a != null) {
|
||||
showNoLocationFragment(a);
|
||||
}
|
||||
}
|
||||
}, 1000 * 10);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NO_INTERNET:
|
||||
break;
|
||||
case NO_LOCATION:
|
||||
break;
|
||||
case SEARCH_MAP:
|
||||
if (app.isApplicationInitializing()) {
|
||||
app.getAppInitializer().addListener(this);
|
||||
} else {
|
||||
if (!downloadThread.getIndexes().isDownloadedFromInternet) {
|
||||
waitForIndexes = true;
|
||||
downloadThread.runReloadIndexFilesSilent();
|
||||
} else {
|
||||
searchMap();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MAP_FOUND:
|
||||
break;
|
||||
case MAP_DOWNLOAD:
|
||||
int i = 0;
|
||||
for (IndexItem indexItem : indexItems) {
|
||||
if (i == 0 && !firstMapDownloadCancelled) {
|
||||
new DownloadValidationManager(getMyApplication())
|
||||
.startDownload(getActivity(), indexItem);
|
||||
}
|
||||
if (i == 1 && !secondMapDownloadCancelled) {
|
||||
new DownloadValidationManager(getMyApplication())
|
||||
.startDownload(getActivity(), indexItem);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
OsmandApplication app = getMyApplication();
|
||||
cancelLocationSearchTimer();
|
||||
app.getLocationProvider().removeLocationListener(this);
|
||||
app.getAppInitializer().removeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLocation(final Location loc) {
|
||||
final OsmandApplication app = getMyApplication();
|
||||
app.runInUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
cancelLocationSearchTimer();
|
||||
app.getLocationProvider().removeLocationListener(FirstUsageWizardFragment.this);
|
||||
if (location == null) {
|
||||
location = new Location(loc);
|
||||
showSearchMapFragment(getActivity());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(AppInitializer init, AppInitializer.InitEvents event) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish(AppInitializer init) {
|
||||
if (!downloadThread.getIndexes().isDownloadedFromInternet) {
|
||||
waitForIndexes = true;
|
||||
downloadThread.runReloadIndexFilesSilent();
|
||||
} else {
|
||||
searchMap();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void newDownloadIndexes() {
|
||||
if (waitForIndexes && wizardType == WizardType.SEARCH_MAP) {
|
||||
waitForIndexes = false;
|
||||
searchMap();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadInProgress() {
|
||||
IndexItem indexItem = downloadThread.getCurrentDownloadingItem();
|
||||
if (indexItem != null) {
|
||||
int progress = downloadThread.getCurrentDownloadingItemProgress();
|
||||
double mb = indexItem.getArchiveSizeMB();
|
||||
String v;
|
||||
if (progress != -1) {
|
||||
v = getString(R.string.value_downloaded_of_max, mb * progress / 100, mb);
|
||||
} else {
|
||||
v = getString(R.string.file_size_in_mb, mb);
|
||||
}
|
||||
|
||||
int index = indexItems.indexOf(indexItem);
|
||||
if (index == 0) {
|
||||
if (!firstMapDownloadCancelled) {
|
||||
final TextView mapDescriptionTextView = (TextView) view.findViewById(R.id.map_downloading_desc);
|
||||
ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.map_download_progress_bar);
|
||||
mapDescriptionTextView.setText(v);
|
||||
progressBar.setProgress(progress < 0 ? 0 : progress);
|
||||
}
|
||||
} else if (index == 1) {
|
||||
if (!secondMapDownloadCancelled) {
|
||||
final TextView mapDescriptionTextView = (TextView) view.findViewById(R.id.map2_downloading_desc);
|
||||
ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.map2_download_progress_bar);
|
||||
mapDescriptionTextView.setText(v);
|
||||
progressBar.setProgress(progress < 0 ? 0 : progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadHasFinished() {
|
||||
int i = 0;
|
||||
for (IndexItem indexItem : indexItems) {
|
||||
if (indexItem.isDownloaded()) {
|
||||
if (i == 0) {
|
||||
final TextView mapDescriptionTextView = (TextView) view.findViewById(R.id.map_downloading_desc);
|
||||
final View progressLayout = view.findViewById(R.id.map_download_progress_layout);
|
||||
mapDescriptionTextView.setText(indexItem.getSizeDescription(getContext()));
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
} else if (i == 1) {
|
||||
final TextView mapDescriptionTextView = (TextView) view.findViewById(R.id.map2_downloading_desc);
|
||||
final View progressLayout = view.findViewById(R.id.map2_download_progress_layout);
|
||||
mapDescriptionTextView.setText(indexItem.getSizeDescription(getContext()));
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
private void searchMap() {
|
||||
if (location != null) {
|
||||
int point31x = MapUtils.get31TileNumberX(location.getLongitude());
|
||||
int point31y = MapUtils.get31TileNumberY(location.getLatitude());
|
||||
|
||||
ResourceManager rm = getMyApplication().getResourceManager();
|
||||
OsmandRegions osmandRegions = rm.getOsmandRegions();
|
||||
|
||||
List<BinaryMapDataObject> mapDataObjects = null;
|
||||
try {
|
||||
mapDataObjects = osmandRegions.queryBbox(point31x, point31x, point31y, point31y);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String selectedFullName = "";
|
||||
if (mapDataObjects != null) {
|
||||
Iterator<BinaryMapDataObject> it = mapDataObjects.iterator();
|
||||
while (it.hasNext()) {
|
||||
BinaryMapDataObject o = it.next();
|
||||
if (!osmandRegions.contain(o, point31x, point31y)) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
for (BinaryMapDataObject o : mapDataObjects) {
|
||||
String fullName = osmandRegions.getFullName(o);
|
||||
if (fullName.length() > selectedFullName.length()) {
|
||||
selectedFullName = fullName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!Algorithms.isEmpty(selectedFullName)) {
|
||||
WorldRegion downloadRegion = osmandRegions.getRegionData(selectedFullName);
|
||||
if (downloadRegion != null && downloadRegion.isRegionMapDownload()) {
|
||||
List<IndexItem> indexItems = new LinkedList<>(downloadThread.getIndexes().getIndexItems(downloadRegion));
|
||||
for (IndexItem item : indexItems) {
|
||||
if (item.getType() == DownloadActivityType.NORMAL_FILE) {
|
||||
localMapIndexItem = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
baseMapIndexItem = downloadThread.getIndexes().getWorldBaseMapItem();
|
||||
|
||||
if (localMapIndexItem != null || baseMapIndexItem != null) {
|
||||
showMapFoundFragment(getActivity());
|
||||
} else {
|
||||
closeWizard();
|
||||
}
|
||||
|
||||
} else {
|
||||
showNoLocationFragment(getActivity());
|
||||
}
|
||||
}
|
||||
|
||||
private void cancelLocationSearchTimer() {
|
||||
if (locationSearchTimer != null) {
|
||||
locationSearchTimer.cancel();
|
||||
locationSearchTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void startWizard(FragmentActivity activity) {
|
||||
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
||||
if (!app.getSettings().isInternetConnectionAvailable()) {
|
||||
showNoInternetFragment(activity);
|
||||
} else if (location == null) {
|
||||
findLocation(activity, true);
|
||||
} else {
|
||||
showSearchMapFragment(activity);
|
||||
}
|
||||
}
|
||||
|
||||
public void closeWizard() {
|
||||
getActivity().getSupportFragmentManager().beginTransaction()
|
||||
.remove(FirstUsageWizardFragment.this).commit();
|
||||
location = null;
|
||||
localMapIndexItem = null;
|
||||
baseMapIndexItem = null;
|
||||
}
|
||||
|
||||
public void processLocationPermission(boolean granted) {
|
||||
if (granted) {
|
||||
findLocation(getActivity(), false);
|
||||
} else {
|
||||
showNoLocationFragment(getActivity());
|
||||
}
|
||||
}
|
||||
|
||||
private static void findLocation(FragmentActivity activity, boolean searchLocationByIp) {
|
||||
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
||||
if (searchLocationByIp) {
|
||||
showSearchLocationFragment(activity, true);
|
||||
} else if (OsmAndLocationProvider.isLocationPermissionAvailable(activity)) {
|
||||
Location loc = app.getLocationProvider().getLastKnownLocation();
|
||||
if (loc == null) {
|
||||
showSearchLocationFragment(activity, false);
|
||||
} else {
|
||||
location = new Location(loc);
|
||||
showSearchMapFragment(activity);
|
||||
}
|
||||
} else {
|
||||
showSearchLocationFragment(activity, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateStorageView(View storageView) {
|
||||
TextView title = (TextView) storageView.findViewById(R.id.storage_title);
|
||||
OsmandSettings settings = getMyApplication().getSettings();
|
||||
int type;
|
||||
if (settings.getExternalStorageDirectoryTypeV19() >= 0) {
|
||||
type = settings.getExternalStorageDirectoryTypeV19();
|
||||
} else {
|
||||
ValueHolder<Integer> vh = new ValueHolder<>();
|
||||
settings.getExternalStorageDirectory(vh);
|
||||
if (vh.value != null && vh.value >= 0) {
|
||||
type = vh.value;
|
||||
} else {
|
||||
type = 0;
|
||||
}
|
||||
}
|
||||
title.setText(getString(R.string.storage_place_description, getStorageName(type)));
|
||||
|
||||
TextView freeSpace = (TextView) storageView.findViewById(R.id.storage_free_space);
|
||||
TextView freeSpaceValue = (TextView) storageView.findViewById(R.id.storage_free_space_value);
|
||||
String freeSpaceStr = getString(R.string.storage_free_space) + ": ";
|
||||
freeSpace.setText(freeSpaceStr);
|
||||
freeSpaceValue.setText(getFreeSpace(settings.getExternalStorageDirectory()));
|
||||
|
||||
AppCompatButton changeStorageButton = (AppCompatButton) storageView.findViewById(R.id.storage_change_button);
|
||||
changeStorageButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
DataStoragePlaceDialogFragment.showInstance(getActivity().getSupportFragmentManager(), false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String getStorageName(int type) {
|
||||
if (type == OsmandSettings.EXTERNAL_STORAGE_TYPE_INTERNAL_FILE) {
|
||||
return getString(R.string.storage_directory_internal_app);
|
||||
} else if (type == OsmandSettings.EXTERNAL_STORAGE_TYPE_DEFAULT) {
|
||||
return getString(R.string.storage_directory_shared);
|
||||
} else if (type == OsmandSettings.EXTERNAL_STORAGE_TYPE_EXTERNAL_FILE) {
|
||||
return getString(R.string.storage_directory_external);
|
||||
} else if (type == OsmandSettings.EXTERNAL_STORAGE_TYPE_OBB) {
|
||||
return getString(R.string.storage_directory_multiuser);
|
||||
} else if (type == OsmandSettings.EXTERNAL_STORAGE_TYPE_SPECIFIED) {
|
||||
return getString(R.string.storage_directory_manual);
|
||||
} else {
|
||||
return getString(R.string.storage_directory_manual);
|
||||
}
|
||||
}
|
||||
|
||||
private String getFreeSpace(File dir) {
|
||||
if (dir.canRead()) {
|
||||
StatFs fs = new StatFs(dir.getAbsolutePath());
|
||||
return formatGb.format(new Object[]{(float) (fs.getAvailableBlocks()) * fs.getBlockSize() / (1 << 30)});
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static void showSearchLocationFragment(FragmentActivity activity, boolean searchByIp) {
|
||||
Fragment fragment = new FirstUsageWizardFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(WIZARD_TYPE_KEY, WizardType.SEARCH_LOCATION.name());
|
||||
args.putBoolean(SEARCH_LOCATION_BY_IP_KEY, searchByIp);
|
||||
fragment.setArguments(args);
|
||||
showFragment(activity, fragment);
|
||||
}
|
||||
|
||||
public static void showSearchMapFragment(FragmentActivity activity) {
|
||||
Fragment fragment = new FirstUsageWizardFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(WIZARD_TYPE_KEY, WizardType.SEARCH_MAP.name());
|
||||
fragment.setArguments(args);
|
||||
showFragment(activity, fragment);
|
||||
}
|
||||
|
||||
public static void showMapFoundFragment(FragmentActivity activity) {
|
||||
Fragment fragment = new FirstUsageWizardFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(WIZARD_TYPE_KEY, WizardType.MAP_FOUND.name());
|
||||
fragment.setArguments(args);
|
||||
showFragment(activity, fragment);
|
||||
}
|
||||
|
||||
public static void showMapDownloadFragment(FragmentActivity activity) {
|
||||
Fragment fragment = new FirstUsageWizardFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(WIZARD_TYPE_KEY, WizardType.MAP_DOWNLOAD.name());
|
||||
fragment.setArguments(args);
|
||||
showFragment(activity, fragment);
|
||||
}
|
||||
|
||||
public static void showNoInternetFragment(FragmentActivity activity) {
|
||||
Fragment fragment = new FirstUsageWizardFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(WIZARD_TYPE_KEY, WizardType.NO_INTERNET.name());
|
||||
fragment.setArguments(args);
|
||||
showFragment(activity, fragment);
|
||||
}
|
||||
|
||||
public static void showNoLocationFragment(FragmentActivity activity) {
|
||||
Fragment fragment = new FirstUsageWizardFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(WIZARD_TYPE_KEY, WizardType.NO_LOCATION.name());
|
||||
fragment.setArguments(args);
|
||||
showFragment(activity, fragment);
|
||||
}
|
||||
|
||||
private static void showFragment(FragmentActivity activity, Fragment fragment) {
|
||||
activity.getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.fragmentContainer, fragment, FirstUsageWizardFragment.TAG)
|
||||
.commit();
|
||||
}
|
||||
|
||||
private OsmandApplication getMyApplication() {
|
||||
return (OsmandApplication) getActivity().getApplication();
|
||||
}
|
||||
|
||||
private static void logError(String msg, Throwable e) {
|
||||
Log.e(TAG, "Error: " + msg, e);
|
||||
}
|
||||
}
|
|
@ -16,7 +16,6 @@ import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
|||
import net.osmand.plus.mapcontextmenu.MenuController;
|
||||
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController.TransportStopRoute;
|
||||
import net.osmand.plus.views.TransportStopsLayer;
|
||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
@ -147,7 +146,8 @@ public class TransportRouteController extends MenuController {
|
|||
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
showMenuAndRoute(latLon, false);
|
||||
MapContextMenu menu = getMapActivity().getContextMenu();
|
||||
menu.showOrUpdate(latLon, getPointDescription(), transportRoute);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus.resources;
|
|||
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -1091,7 +1092,18 @@ public class ResourceManager {
|
|||
public boolean containsBasemap(){
|
||||
return !basemapFileNames.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
public boolean isAnyMapIstalled() {
|
||||
File appPath = context.getAppPath(null);
|
||||
File[] maps = appPath.listFiles(new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
return pathname.getName().endsWith(IndexConstants.BINARY_MAP_INDEX_EXT);
|
||||
}
|
||||
});
|
||||
return maps != null && maps.length > 0;
|
||||
}
|
||||
|
||||
public Map<String, String> getBackupIndexes(Map<String, String> map) {
|
||||
File file = context.getAppPath(IndexConstants.BACKUP_INDEX_DIR);
|
||||
if (file != null && file.isDirectory()) {
|
||||
|
|
Loading…
Reference in a new issue