Merge remote-tracking branch 'origin/master'
|
@ -54,20 +54,21 @@
|
||||||
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:resource="@dimen/app_minimumsize_w" android:value="" />
|
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:resource="@dimen/app_minimumsize_w" android:value="" />
|
||||||
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:resource="@dimen/app_minimumsize_h" android:value="" />
|
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:resource="@dimen/app_minimumsize_h" android:value="" />
|
||||||
<meta-data android:name="com.sec.minimode.icon.portrait.normal" android:resource="@drawable/icon" android:value="" />
|
<meta-data android:name="com.sec.minimode.icon.portrait.normal" android:resource="@drawable/icon" android:value="" />
|
||||||
<meta-data android:name="com.sec.minimode.icon.landscape.normal" android:resource="@drawable/icon" android:value="" />
|
<meta-data android:name="com.sec.minimode.icon.landscape.normal" android:resource="@drawable/icon" android:value="" /><activity
|
||||||
|
android:name="net.osmand.plus.activities.MainMenuActivity"
|
||||||
|
android:label="@string/app_name" >
|
||||||
|
</activity>
|
||||||
|
<activity android:name="net.osmand.plus.activities.HelpActivity" />
|
||||||
|
<activity
|
||||||
|
android:name="net.osmand.plus.activities.DashboardActivity"
|
||||||
|
android:label="@string/app_name" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
<activity android:name="net.osmand.plus.activities.MainMenuActivity" android:label="@string/app_name">
|
|
||||||
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity android:name="net.osmand.plus.activities.HelpActivity" />
|
|
||||||
<activity android:name="net.osmand.plus.activities.DashboardActivity" android:label="@string/app_name">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="net.osmand.plus.activities.MapActivity" android:label="@string/app_name"
|
<activity android:name="net.osmand.plus.activities.MapActivity" android:label="@string/app_name"
|
||||||
|
|
BIN
OsmAnd/res/drawable-hdpi/ic_download_cancel_normal.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
OsmAnd/res/drawable-hdpi/ic_download_cancel_tap.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
OsmAnd/res/drawable-hdpi/ic_download_normal.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
OsmAnd/res/drawable-hdpi/ic_download_tap.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
OsmAnd/res/drawable-mdpi/ic_download_cancel_normal.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
OsmAnd/res/drawable-mdpi/ic_download_cancel_tap.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
OsmAnd/res/drawable-mdpi/ic_download_normal.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
OsmAnd/res/drawable-mdpi/ic_download_tap.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
OsmAnd/res/drawable-xhdpi/ic_download_cancel_normal.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
OsmAnd/res/drawable-xhdpi/ic_download_cancel_tap.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
OsmAnd/res/drawable-xhdpi/ic_download_normal.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
OsmAnd/res/drawable-xhdpi/ic_download_tap.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/ic_download_cancel_normal.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/ic_download_cancel_tap.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/ic_download_normal.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/ic_download_tap.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
8
OsmAnd/res/drawable/cancel_button.xml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:drawable="@drawable/ic_download_cancel_tap" android:state_selected="true"/>
|
||||||
|
<item android:drawable="@drawable/ic_download_cancel_tap" android:state_pressed="true"/>
|
||||||
|
<item android:drawable="@drawable/ic_download_cancel_normal" android:state_selected="false"/>
|
||||||
|
<item android:drawable="@drawable/ic_download_cancel_normal" android:state_pressed="false"/>
|
||||||
|
</selector>
|
8
OsmAnd/res/drawable/download_button.xml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:drawable="@drawable/ic_download_tap" android:state_selected="true"/>
|
||||||
|
<item android:drawable="@drawable/ic_download_tap" android:state_pressed="true"/>
|
||||||
|
<item android:drawable="@drawable/ic_download_normal" android:state_selected="false"/>
|
||||||
|
<item android:drawable="@drawable/ic_download_normal" android:state_pressed="false"/>
|
||||||
|
</selector>
|
|
@ -52,7 +52,7 @@
|
||||||
android:drawableTop="@drawable/ic_action_marker2"
|
android:drawableTop="@drawable/ic_action_marker2"
|
||||||
android:text="@string/coordinates" />
|
android:text="@string/coordinates" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="1dp"
|
android:layout_width="1dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/dashboard_divider" />
|
android:background="@color/dashboard_divider" />
|
23
OsmAnd/res/layout/dash_favorites_fragment.xml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/main_fav"
|
||||||
|
android:background="@drawable/bg_cardui"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<LinearLayout android:orientation="horizontal"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="40dp">
|
||||||
|
<TextView android:id="@+id/fav_text"
|
||||||
|
android:text="@string/my_data_Button"
|
||||||
|
style="@style/DashboardSubHeader"/>
|
||||||
|
<Button android:id="@+id/show_all"
|
||||||
|
android:text="@string/show_all"
|
||||||
|
style="@style/DashboardGeneralButton"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout android:id="@+id/favorites"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
</LinearLayout>
|
39
OsmAnd/res/layout/dash_favorites_item.xml
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:background="@drawable/dashboard_button"
|
||||||
|
android:layout_height="50dp">
|
||||||
|
<View android:layout_width="match_parent"
|
||||||
|
android:background="@color/dashboard_divider"
|
||||||
|
android:layout_height="1dp"/>
|
||||||
|
<LinearLayout android:orientation="horizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<ImageView android:id="@+id/icon"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginLeft="12dp"
|
||||||
|
android:layout_marginRight="12dp"
|
||||||
|
android:layout_width="28dp"
|
||||||
|
android:layout_height="28dp"/>
|
||||||
|
|
||||||
|
<LinearLayout android:orientation="vertical"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView android:id="@+id/name"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textColor="@color/dashboard_black"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
<TextView android:id="@+id/distance"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:textColor="@color/dashboard_blue"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
29
OsmAnd/res/layout/dash_map_fragment.xml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:background="@drawable/bg_cardui"
|
||||||
|
android:layout_marginBottom="4dp"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<LinearLayout android:orientation="horizontal"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="40dp">
|
||||||
|
<TextView android:id="@+id/map_text"
|
||||||
|
android:text="@string/map_Button"
|
||||||
|
style="@style/DashboardSubHeader"/>
|
||||||
|
<Button android:id="@+id/show_map"
|
||||||
|
android:text="@string/show_map"
|
||||||
|
style="@style/DashboardGeneralButton"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<net.osmand.plus.views.OsmAndMapSurfaceView
|
||||||
|
android:id="@+id/MapView"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="110dp"
|
||||||
|
android:layout_marginLeft="2dp"
|
||||||
|
android:layout_marginRight="2dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:contentDescription="@string/map_view"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
</LinearLayout>
|
35
OsmAnd/res/layout/dash_plugin_item.xml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp">
|
||||||
|
<View android:layout_width="match_parent"
|
||||||
|
android:background="@color/dashboard_divider"
|
||||||
|
android:layout_height="1dp"/>
|
||||||
|
<LinearLayout android:orientation="horizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:paddingRight="12dp"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<LinearLayout android:orientation="vertical"
|
||||||
|
android:layout_marginLeft="12dp"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<TextView android:id="@+id/plugin_name"
|
||||||
|
android:textColor="@color/dashboard_black"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:lines="1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
<TextView android:id="@+id/plugin_descr"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:lines="1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<include layout="@layout/check_item_rel"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
25
OsmAnd/res/layout/dash_plugins_fragment.xml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:background="@drawable/bg_cardui"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<LinearLayout android:orientation="horizontal"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="40dp">
|
||||||
|
<TextView android:id="@+id/plugin_text"
|
||||||
|
android:text="@string/prefs_plugins"
|
||||||
|
style="@style/DashboardSubHeader"/>
|
||||||
|
<Button android:id="@+id/show_all"
|
||||||
|
android:text="@string/show_all"
|
||||||
|
style="@style/DashboardGeneralButton"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout android:id="@+id/plugins"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
95
OsmAnd/res/layout/dash_search_fragment.xml
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/search"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="4dp"
|
||||||
|
android:background="@drawable/bg_cardui"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/search_for"
|
||||||
|
style="@style/DashboardSubHeader"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:text="@string/search_for" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/dashboard_divider" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="90dp"
|
||||||
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/poi"
|
||||||
|
style="@style/DashboardSearchButton"
|
||||||
|
android:drawableTop="@drawable/ic_action_info2"
|
||||||
|
android:text="@string/poi" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/dashboard_divider" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/address"
|
||||||
|
style="@style/DashboardSearchButton"
|
||||||
|
android:drawableTop="@drawable/ic_action_home2"
|
||||||
|
android:text="@string/address" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/dashboard_divider" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/coord"
|
||||||
|
style="@style/DashboardSearchButton"
|
||||||
|
android:drawableTop="@drawable/ic_action_marker2"
|
||||||
|
android:text="@string/coordinates" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/dashboard_divider" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="90dp"
|
||||||
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/fav_btn"
|
||||||
|
style="@style/DashboardSearchButton"
|
||||||
|
android:drawableTop="@drawable/ic_action_fav2"
|
||||||
|
android:text="@string/my_favorites" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/dashboard_divider" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/history"
|
||||||
|
style="@style/DashboardSearchButton"
|
||||||
|
android:drawableTop="@drawable/ic_action_history2"
|
||||||
|
android:text="@string/history" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/dashboard_divider" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/transport"
|
||||||
|
style="@style/DashboardSearchButton"
|
||||||
|
android:drawableTop="@drawable/ic_action_bus2"
|
||||||
|
android:text="@string/rendering_category_transport" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
39
OsmAnd/res/layout/dash_updates_fragment.xml
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<LinearLayout android:id="@+id/maps"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:background="@drawable/bg_cardui"
|
||||||
|
android:layout_marginBottom="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp">
|
||||||
|
<TextView android:text="@string/map_update"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:paddingTop="2dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/dashboard_black"/>
|
||||||
|
<TextView android:id="@+id/update_count"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:textColor="@color/dashboard_blue"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
<View android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
<Button android:id="@+id/show_all"
|
||||||
|
android:text="@string/show_all"
|
||||||
|
style="@style/DashboardGeneralButton"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout android:id="@+id/updates_items"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
45
OsmAnd/res/layout/dash_updates_item.xml
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_marginLeft="12dp"
|
||||||
|
android:layout_marginRight="12dp"
|
||||||
|
android:layout_height="50dp">
|
||||||
|
<View android:layout_width="match_parent"
|
||||||
|
android:background="@color/dashboard_divider"
|
||||||
|
android:layout_height="1dp"/>
|
||||||
|
<LinearLayout android:orientation="horizontal"
|
||||||
|
android:layout_marginLeft="12dp"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent">
|
||||||
|
<LinearLayout android:orientation="vertical"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView android:id="@+id/map_name"
|
||||||
|
android:textColor="@color/dashboard_black"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
<TextView android:id="@+id/map_descr"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<ImageButton android:id="@+id/btn_download"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:src="@drawable/download_button"
|
||||||
|
android:background="@drawable/dashboard_button"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ProgressBar android:id="@+id/ProgressBar"
|
||||||
|
android:layout_marginLeft="12dp"
|
||||||
|
android:layout_marginRight="12dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -9,121 +9,61 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="6dp" >
|
android:padding="6dp" >
|
||||||
<include layout="@layout/dashboard_search"/>
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
<LinearLayout
|
android:id="@+id/content"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:layout_marginBottom="4dp"
|
|
||||||
android:background="@drawable/bg_cardui"
|
|
||||||
android:orientation="vertical" >
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:orientation="horizontal" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/map_text"
|
|
||||||
style="@style/DashboardSubHeader"
|
|
||||||
android:text="@string/map_Button" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/show_map"
|
|
||||||
style="@style/DashboardGeneralButton"
|
|
||||||
android:text="@string/show_map" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<net.osmand.plus.views.OsmAndMapSurfaceView
|
|
||||||
android:id="@+id/MapView"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="110dp"
|
|
||||||
android:layout_marginBottom="2dp"
|
|
||||||
android:layout_marginLeft="2dp"
|
|
||||||
android:layout_marginRight="2dp"
|
|
||||||
android:contentDescription="@string/map_view"
|
|
||||||
android:visibility="gone" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/main_fav"
|
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/bg_cardui"
|
android:orientation="horizontal"
|
||||||
android:orientation="vertical" >
|
android:padding="6dp" >
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="40dp"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal" >
|
android:layout_gravity="bottom"
|
||||||
|
android:layout_weight="0.5" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/fav_text"
|
android:id="@+id/About"
|
||||||
style="@style/DashboardSubHeader"
|
android:layout_width="wrap_content"
|
||||||
android:text="@string/my_data_Button" />
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="left|bottom"
|
||||||
<Button
|
android:text="@string/about_settings"
|
||||||
android:id="@+id/show_all"
|
android:textSize="20sp" />
|
||||||
style="@style/DashboardGeneralButton"
|
|
||||||
android:text="@string/show_all" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/favorites"
|
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical" />
|
android:layout_weight="0.5"
|
||||||
</LinearLayout>
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:padding="6dp" >
|
|
||||||
|
|
||||||
<LinearLayout
|
<TextView
|
||||||
android:layout_width="fill_parent"
|
android:id="@+id/Copyright"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_gravity="bottom"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.5">
|
android:layout_gravity="right"
|
||||||
|
android:gravity="right"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/About"
|
android:id="@+id/OpenStreetMaps"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="left|bottom"
|
android:layout_gravity="right"
|
||||||
android:text="@string/about_settings"
|
android:layout_marginTop="5dp"
|
||||||
android:textSize="20sp" />
|
android:autoLink="web"
|
||||||
</LinearLayout>
|
android:gravity="right"
|
||||||
|
android:text="@string/openstreetmap_copyright"
|
||||||
<LinearLayout
|
android:textSize="14sp" />
|
||||||
android:layout_width="fill_parent"
|
</LinearLayout>
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="0.5"
|
|
||||||
android:orientation="vertical" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/Copyright"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="right"
|
|
||||||
android:gravity="right"
|
|
||||||
android:textSize="14sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/OpenStreetMaps"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="right"
|
|
||||||
android:gravity="right"
|
|
||||||
android:autoLink="web"
|
|
||||||
android:text="@string/openstreetmap_copyright"
|
|
||||||
android:textSize="14sp" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
|
@ -1,97 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/search"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="4dp"
|
|
||||||
android:background="@drawable/bg_cardui"
|
|
||||||
android:orientation="vertical" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/search_for"
|
|
||||||
style="@style/DashboardSubHeader"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:text="@string/search_for" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:background="@color/dashboard_divider" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="90dp"
|
|
||||||
android:orientation="horizontal" >
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/poi"
|
|
||||||
style="@style/DashboardSearchButton"
|
|
||||||
android:drawableTop="@drawable/ic_action_info2"
|
|
||||||
android:text="@string/poi" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/dashboard_divider" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/address"
|
|
||||||
style="@style/DashboardSearchButton"
|
|
||||||
android:drawableTop="@drawable/ic_action_home2"
|
|
||||||
android:text="@string/address" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/dashboard_divider" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/coord"
|
|
||||||
style="@style/DashboardSearchButton"
|
|
||||||
android:drawableTop="@drawable/ic_action_marker2"
|
|
||||||
android:text="@string/coordinates" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:background="@color/dashboard_divider" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="90dp"
|
|
||||||
android:orientation="horizontal" >
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/fav_btn"
|
|
||||||
style="@style/DashboardSearchButton"
|
|
||||||
android:drawableTop="@drawable/ic_action_fav2"
|
|
||||||
android:text="@string/my_favorites" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/dashboard_divider" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/history"
|
|
||||||
style="@style/DashboardSearchButton"
|
|
||||||
android:drawableTop="@drawable/ic_action_history2"
|
|
||||||
android:text="@string/history" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/dashboard_divider" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/transport"
|
|
||||||
style="@style/DashboardSearchButton"
|
|
||||||
android:drawableTop="@drawable/ic_action_bus2"
|
|
||||||
android:text="@string/rendering_category_transport" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
|
@ -1,55 +1,58 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_horizontal">
|
android:paddingBottom="10dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TableRow
|
<LinearLayout
|
||||||
android:id="@+id/tableRow1"
|
android:id="@+id/tableRow1"
|
||||||
android:layout_width="fill_parent"
|
android:orientation="vertical"
|
||||||
android:layout_height="wrap_content">
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton android:layout_height="wrap_content"
|
||||||
android:id="@+id/parking_no_lim_button"
|
android:layout_width="wrap_content"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginRight="32dp"
|
android:id="@+id/parking_no_lim_button"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:background="@drawable/poi_parking_pos_no_limit_menu"
|
android:background="@drawable/poi_parking_pos_no_limit_menu"
|
||||||
android:contentDescription="@string/osmand_parking_time_no_limit" />
|
android:contentDescription="@string/osmand_parking_time_no_limit"/>
|
||||||
|
|
||||||
<ImageButton
|
<TextView android:layout_height="wrap_content"
|
||||||
android:id="@+id/parking_lim_button"
|
android:layout_width="wrap_content"
|
||||||
android:layout_column="1"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginRight="16dp"
|
android:id="@+id/parking_lim_text"
|
||||||
android:layout_marginLeft="32dp"
|
android:gravity="center_horizontal"
|
||||||
android:gravity="center_horizontal"
|
android:text="@string/osmand_parking_no_lim_text"/>
|
||||||
android:background="@drawable/poi_parking_pos_limit_menu"
|
</LinearLayout>
|
||||||
android:contentDescription="@string/osmand_parking_time_limit" />
|
|
||||||
|
|
||||||
</TableRow>
|
<LinearLayout android:id="@+id/tableRow2"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<ImageButton android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:id="@+id/parking_lim_button"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:background="@drawable/poi_parking_pos_limit_menu"
|
||||||
|
android:contentDescription="@string/osmand_parking_time_limit"/>
|
||||||
|
|
||||||
|
<TextView android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:id="@+id/parking_no_lim_text"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:text="@string/osmand_parking_lim_text"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<TableRow
|
|
||||||
android:id="@+id/tableRow2"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/parking_lim_text"
|
|
||||||
android:layout_column="0"
|
|
||||||
android:layout_marginRight="4dp"
|
|
||||||
android:layout_marginLeft="4dp"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:maxWidth="10dp"
|
|
||||||
android:text="@string/osmand_parking_no_lim_text" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/parking_no_lim_text"
|
|
||||||
android:layout_column="1"
|
|
||||||
android:layout_marginRight="4dp"
|
|
||||||
android:layout_marginLeft="4dp"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:maxWidth="10dp"
|
|
||||||
android:text="@string/osmand_parking_lim_text" />
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
</TableLayout>
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
<string name="app_name_ver">OsmAnd 1.9</string>
|
||||||
<string name="app_name">OsmAnd~</string>
|
<string name="app_name">OsmAnd~</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
<string name="osmo_use_https_descr">Use secure connection with server</string>
|
<string name="osmo_use_https_descr">Use secure connection with server</string>
|
||||||
<string name="osmo_use_https">Use https</string>
|
<string name="osmo_use_https">Use https</string>
|
||||||
<string name="advanced_settings">Advanced</string>
|
<string name="advanced_settings">Advanced</string>
|
||||||
|
<string name="map_update">Maps</string>
|
||||||
<string name="search_for">Search for</string>
|
<string name="search_for">Search for</string>
|
||||||
<string name="show_map">SHOW MAP</string>
|
<string name="show_map">SHOW MAP</string>
|
||||||
<string name="show_all">SHOW ALL</string>
|
<string name="show_all">SHOW ALL</string>
|
||||||
|
|
|
@ -11,7 +11,6 @@ import net.osmand.Location;
|
||||||
import net.osmand.data.LocationPoint;
|
import net.osmand.data.LocationPoint;
|
||||||
import net.osmand.plus.activities.DashboardActivity;
|
import net.osmand.plus.activities.DashboardActivity;
|
||||||
import net.osmand.plus.activities.FavouritesActivity;
|
import net.osmand.plus.activities.FavouritesActivity;
|
||||||
import net.osmand.plus.activities.MainMenuActivity;
|
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.PluginsActivity;
|
import net.osmand.plus.activities.PluginsActivity;
|
||||||
import net.osmand.plus.activities.SettingsActivity;
|
import net.osmand.plus.activities.SettingsActivity;
|
||||||
|
|
|
@ -1,33 +1,26 @@
|
||||||
package net.osmand.plus.activities;
|
package net.osmand.plus.activities;
|
||||||
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.osmand.access.AccessibleAlertBuilder;
|
import net.osmand.access.AccessibleAlertBuilder;
|
||||||
import net.osmand.data.FavouritePoint;
|
|
||||||
import net.osmand.data.LatLon;
|
|
||||||
import net.osmand.map.MapTileDownloader.DownloadRequest;
|
|
||||||
import net.osmand.map.MapTileDownloader.IMapDownloaderCallback;
|
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
|
||||||
import net.osmand.plus.OsmAndAppCustomization;
|
import net.osmand.plus.OsmAndAppCustomization;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.search.SearchActivity;
|
import net.osmand.plus.dashboard.DashFavoritesFragment;
|
||||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
import net.osmand.plus.dashboard.DashMapFragment;
|
||||||
|
import net.osmand.plus.dashboard.DashPluginsFragment;
|
||||||
|
import net.osmand.plus.dashboard.DashSearchFragment;
|
||||||
|
import net.osmand.plus.dashboard.DashUpdatesFragment;
|
||||||
|
import net.osmand.plus.download.BaseDownloadActivity;
|
||||||
import net.osmand.plus.download.DownloadActivity;
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
import net.osmand.plus.render.MapRenderRepositories;
|
import net.osmand.plus.render.MapRenderRepositories;
|
||||||
import net.osmand.plus.render.MapVectorLayer;
|
|
||||||
import net.osmand.plus.resources.ResourceManager;
|
|
||||||
import net.osmand.plus.sherpafy.TourViewActivity;
|
import net.osmand.plus.sherpafy.TourViewActivity;
|
||||||
import net.osmand.plus.views.MapTextLayer;
|
|
||||||
import net.osmand.plus.views.OsmAndMapSurfaceView;
|
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
|
||||||
import net.osmand.util.MapUtils;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
|
@ -40,7 +33,6 @@ import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.graphics.Typeface;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
@ -51,27 +43,18 @@ import android.text.format.DateFormat;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.text.style.ClickableSpan;
|
import android.text.style.ClickableSpan;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.ContextMenu;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
|
||||||
import com.actionbarsherlock.view.Menu;
|
import com.actionbarsherlock.view.Menu;
|
||||||
import com.actionbarsherlock.view.MenuInflater;
|
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
import com.ibm.icu.util.Calendar;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Denis on 05.11.2014.
|
* Created by Denis on 05.11.2014.
|
||||||
*/
|
*/
|
||||||
public class DashboardActivity extends SherlockFragmentActivity implements IMapDownloaderCallback {
|
public class DashboardActivity extends BaseDownloadActivity {
|
||||||
public static final boolean TIPS_AND_TRICKS = false;
|
public static final boolean TIPS_AND_TRICKS = false;
|
||||||
public static final int APP_EXIT_CODE = 4;
|
public static final int APP_EXIT_CODE = 4;
|
||||||
public static final String APP_EXIT_KEY = "APP_EXIT_KEY";
|
public static final String APP_EXIT_KEY = "APP_EXIT_KEY";
|
||||||
|
@ -84,14 +67,9 @@ public class DashboardActivity extends SherlockFragmentActivity implements IMapD
|
||||||
|
|
||||||
private static final String CONTRIBUTION_VERSION_FLAG = "CONTRIBUTION_VERSION_FLAG";
|
private static final String CONTRIBUTION_VERSION_FLAG = "CONTRIBUTION_VERSION_FLAG";
|
||||||
private ProgressDialog startProgressDialog;
|
private ProgressDialog startProgressDialog;
|
||||||
private OsmandMapTileView osmandMapTileView;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
getMyApplication().getResourceManager().getMapTileDownloader().removeDownloaderCallback(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -111,15 +89,28 @@ public class DashboardActivity extends SherlockFragmentActivity implements IMapD
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setContentView(R.layout.dashboard);
|
setContentView(R.layout.dashboard);
|
||||||
setupContributionVersion();
|
|
||||||
getSupportActionBar().setTitle(Version.getFullVersion(getMyApplication()));
|
final String textVersion = Version.getFullVersion(getMyApplication());
|
||||||
|
getSupportActionBar().setTitle(textVersion);
|
||||||
|
final int abTitleId = getResources().getIdentifier("action_bar_title", "id", "android");
|
||||||
|
final SharedPreferences prefs = getApplicationContext().getSharedPreferences("net.osmand.settings", MODE_WORLD_READABLE);
|
||||||
|
findViewById(abTitleId).setOnClickListener(new View.OnClickListener() {
|
||||||
|
int i=0;
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
if(i++ > 8) {
|
||||||
|
prefs.edit().putBoolean(CONTRIBUTION_VERSION_FLAG, true).commit();
|
||||||
|
enableLink(DashboardActivity.this, textVersion, (TextView)view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
ColorDrawable color = new ColorDrawable(getResources().getColor(R.color.actionbar_color));
|
ColorDrawable color = new ColorDrawable(getResources().getColor(R.color.actionbar_color));
|
||||||
getSupportActionBar().setBackgroundDrawable(color);
|
getSupportActionBar().setBackgroundDrawable(color);
|
||||||
getSupportActionBar().setIcon(android.R.color.transparent);
|
getSupportActionBar().setIcon(android.R.color.transparent);
|
||||||
setupMapView();
|
|
||||||
setupButtons();
|
setupContributionVersion();
|
||||||
setupFonts();
|
addFragments();
|
||||||
getMyApplication().getResourceManager().getMapTileDownloader().addDownloaderCallback(this);
|
initApp(this, getMyApplication());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -167,6 +158,36 @@ public class DashboardActivity extends SherlockFragmentActivity implements IMapD
|
||||||
about.setMovementMethod(LinkMovementMethod.getInstance());
|
about.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addFragments() {
|
||||||
|
android.support.v4.app.FragmentManager manager = getSupportFragmentManager();
|
||||||
|
android.support.v4.app.FragmentTransaction fragmentTransaction = manager.beginTransaction();
|
||||||
|
//after rotation list of fragments in fragment transaction is not cleared
|
||||||
|
//so we need to check whether some fragments are already existing
|
||||||
|
if (manager.findFragmentByTag(DashSearchFragment.TAG) == null){
|
||||||
|
DashSearchFragment searchFragment = new DashSearchFragment();
|
||||||
|
fragmentTransaction.add(R.id.content, searchFragment, DashSearchFragment.TAG);
|
||||||
|
}
|
||||||
|
if (manager.findFragmentByTag(DashMapFragment.TAG) == null){
|
||||||
|
DashMapFragment mapFragment = new DashMapFragment();
|
||||||
|
fragmentTransaction.add(R.id.content, mapFragment, DashMapFragment.TAG);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (manager.findFragmentByTag(DashFavoritesFragment.TAG) == null){
|
||||||
|
DashFavoritesFragment favoritesFragment = new DashFavoritesFragment();
|
||||||
|
fragmentTransaction.add(R.id.content, favoritesFragment, DashFavoritesFragment.TAG);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (manager.findFragmentByTag(DashUpdatesFragment.TAG) == null){
|
||||||
|
DashUpdatesFragment updatesFragment = new DashUpdatesFragment();
|
||||||
|
fragmentTransaction.add(R.id.content, updatesFragment, DashUpdatesFragment.TAG);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (manager.findFragmentByTag(DashPluginsFragment.TAG) == null){
|
||||||
|
DashPluginsFragment pluginsFragment = new DashPluginsFragment();
|
||||||
|
fragmentTransaction.add(R.id.content, pluginsFragment, DashPluginsFragment.TAG).commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void showAboutDialog(final Activity activity, final OsmandApplication app) {
|
public static void showAboutDialog(final Activity activity, final OsmandApplication app) {
|
||||||
Builder bld = new AlertDialog.Builder(activity);
|
Builder bld = new AlertDialog.Builder(activity);
|
||||||
bld.setTitle(R.string.about_settings);
|
bld.setTitle(R.string.about_settings);
|
||||||
|
@ -212,15 +233,9 @@ public class DashboardActivity extends SherlockFragmentActivity implements IMapD
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
setupFavorites();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
protected void initApp(final Activity activity, OsmandApplication app) {
|
||||||
|
final OsmAndAppCustomization appCustomization = app.getAppCustomization();
|
||||||
protected void initApp(final OsmAndAppCustomization appCustomization, final Activity activity, OsmandApplication app) {
|
|
||||||
// restore follow route mode
|
// restore follow route mode
|
||||||
if(app.getSettings().FOLLOW_THE_ROUTE.get() && !app.getRoutingHelper().isRouteCalculated()){
|
if(app.getSettings().FOLLOW_THE_ROUTE.get() && !app.getRoutingHelper().isRouteCalculated()){
|
||||||
final Intent mapIndent = new Intent(this, appCustomization.getMapActivity());
|
final Intent mapIndent = new Intent(this, appCustomization.getMapActivity());
|
||||||
|
@ -370,162 +385,7 @@ public class DashboardActivity extends SherlockFragmentActivity implements IMapD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupFonts() {
|
|
||||||
Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Medium.ttf");
|
|
||||||
((TextView) findViewById(R.id.search_for)).setTypeface(typeface);
|
|
||||||
((TextView) findViewById(R.id.map_text)).setTypeface(typeface);
|
|
||||||
((TextView) findViewById(R.id.fav_text)).setTypeface(typeface);
|
|
||||||
((Button) findViewById(R.id.show_map)).setTypeface(typeface);
|
|
||||||
((Button) findViewById(R.id.show_all)).setTypeface(typeface);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupFavorites(){
|
|
||||||
final FavouritesDbHelper helper = getMyApplication().getFavorites();
|
|
||||||
final List<FavouritePoint> points = helper.getFavouritePoints();
|
|
||||||
LinearLayout favorites = (LinearLayout) findViewById(R.id.favorites);
|
|
||||||
favorites.removeAllViews();
|
|
||||||
if (points.size() == 0){
|
|
||||||
(findViewById(R.id.main_fav)).setVisibility(View.GONE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (points.size() > 3){
|
|
||||||
while (points.size() != 3){
|
|
||||||
points.remove(3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for (final FavouritePoint point : points) {
|
|
||||||
LayoutInflater inflater = getLayoutInflater();
|
|
||||||
View view = inflater.inflate(R.layout.dash_fav_list, null, false);
|
|
||||||
TextView name = (TextView) view.findViewById(R.id.name);
|
|
||||||
TextView label = (TextView) view.findViewById(R.id.distance);
|
|
||||||
ImageView icon = (ImageView) view.findViewById(R.id.icon);
|
|
||||||
name.setText(point.getName());
|
|
||||||
icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(DashboardActivity.this, point.getColor()));
|
|
||||||
LatLon lastKnownMapLocation = getMyApplication().getSettings().getLastKnownMapLocation();
|
|
||||||
int dist = (int) (MapUtils.getDistance(point.getLatitude(), point.getLongitude(),
|
|
||||||
lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude()));
|
|
||||||
String distance = OsmAndFormatter.getFormattedDistance(dist, getMyApplication()) + " ";
|
|
||||||
label.setText(distance, TextView.BufferType.SPANNABLE);
|
|
||||||
label.setTypeface(Typeface.DEFAULT, point.isVisible() ? Typeface.NORMAL : Typeface.ITALIC);
|
|
||||||
view.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
final Intent mapIntent = new Intent(DashboardActivity.this, getMyApplication().getAppCustomization().getMapActivity());
|
|
||||||
getMyApplication().getSettings().setLastKnownMapLocation(point.getLatitude(), point.getLongitude());
|
|
||||||
startActivity(mapIntent);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50, getResources().getDisplayMetrics());
|
|
||||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, height);
|
|
||||||
view.setLayoutParams(lp);
|
|
||||||
favorites.addView(view);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupButtons(){
|
|
||||||
final Activity activity = this;
|
|
||||||
final OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
|
|
||||||
|
|
||||||
(findViewById(R.id.show_map)).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
final Intent mapIndent = new Intent(activity, appCustomization.getMapActivity());
|
|
||||||
activity.startActivityForResult(mapIndent, 0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
(findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
final Intent favorites = new Intent(activity, appCustomization.getFavoritesActivity());
|
|
||||||
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
||||||
activity.startActivity(favorites);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
(findViewById(R.id.poi)).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
|
|
||||||
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
||||||
getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.POI_TAB_INDEX);
|
|
||||||
activity.startActivity(search);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
(findViewById(R.id.address)).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
|
|
||||||
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
||||||
getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.ADDRESS_TAB_INDEX);
|
|
||||||
activity.startActivity(search);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
(findViewById(R.id.coord)).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
|
|
||||||
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
||||||
getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.LOCATION_TAB_INDEX);
|
|
||||||
activity.startActivity(search);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
(findViewById(R.id.fav_btn)).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
|
|
||||||
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
||||||
getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.FAVORITES_TAB_INDEX);
|
|
||||||
activity.startActivity(search);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
(findViewById(R.id.history)).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
|
|
||||||
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
||||||
getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.HISTORY_TAB_INDEX);
|
|
||||||
activity.startActivity(search);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
(findViewById(R.id.transport)).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
|
|
||||||
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
||||||
getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.TRANSPORT_TAB_INDEX);
|
|
||||||
activity.startActivity(search);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupMapView() {
|
|
||||||
OsmAndMapSurfaceView surf = (OsmAndMapSurfaceView) findViewById(R.id.MapView);
|
|
||||||
osmandMapTileView = surf.getMapView();
|
|
||||||
osmandMapTileView.getView().setVisibility(View.VISIBLE);
|
|
||||||
osmandMapTileView.removeAllLayers();
|
|
||||||
MapVectorLayer mapVectorLayer = new MapVectorLayer(null);
|
|
||||||
MapTextLayer mapTextLayer = new MapTextLayer();
|
|
||||||
mapTextLayer.setAlwaysVisible(true);
|
|
||||||
// 5.95 all labels
|
|
||||||
osmandMapTileView.addLayer(mapTextLayer, 5.95f);
|
|
||||||
osmandMapTileView.addLayer(mapVectorLayer, 0.5f);
|
|
||||||
osmandMapTileView.setMainLayer(mapVectorLayer);
|
|
||||||
mapVectorLayer.setVisible(true);
|
|
||||||
LatLon lm = getMyApplication().getSettings().getLastKnownMapLocation();
|
|
||||||
int zm = getMyApplication().getSettings().getLastKnownMapZoom();
|
|
||||||
osmandMapTileView.setLatLon(lm.getLatitude(), lm.getLongitude());
|
|
||||||
osmandMapTileView.setIntZoom(zm);
|
|
||||||
osmandMapTileView.refreshMap(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
@ -539,10 +399,8 @@ public class DashboardActivity extends SherlockFragmentActivity implements IMapD
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,10 +425,6 @@ public class DashboardActivity extends SherlockFragmentActivity implements IMapD
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OsmandApplication getMyApplication() {
|
|
||||||
return (OsmandApplication) getApplication();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void checkVectorIndexesDownloaded() {
|
protected void checkVectorIndexesDownloaded() {
|
||||||
MapRenderRepositories maps = getMyApplication().getResourceManager().getRenderer();
|
MapRenderRepositories maps = getMyApplication().getResourceManager().getRenderer();
|
||||||
SharedPreferences pref = getPreferences(MODE_WORLD_WRITEABLE);
|
SharedPreferences pref = getPreferences(MODE_WORLD_WRITEABLE);
|
||||||
|
@ -618,17 +472,4 @@ public class DashboardActivity extends SherlockFragmentActivity implements IMapD
|
||||||
textVersionView.setText(content);
|
textVersionView.setText(content);
|
||||||
textVersionView.setMovementMethod(LinkMovementMethod.getInstance());
|
textVersionView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void tileDownloaded(DownloadRequest request) {
|
|
||||||
if(request != null && !request.error && request.fileToSave != null){
|
|
||||||
ResourceManager mgr = getMyApplication().getResourceManager();
|
|
||||||
mgr.tileDownloaded(request);
|
|
||||||
}
|
|
||||||
if(request == null || !request.error){
|
|
||||||
if(osmandMapTileView != null) {
|
|
||||||
osmandMapTileView.tileDownloaded(request);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,6 +116,7 @@ public class MapActivity extends AccessibleActivity implements
|
||||||
private PowerManager.WakeLock wakeLock = null;
|
private PowerManager.WakeLock wakeLock = null;
|
||||||
private ReleaseWakeLocksRunnable releaseWakeLocksRunnable = new ReleaseWakeLocksRunnable();
|
private ReleaseWakeLocksRunnable releaseWakeLocksRunnable = new ReleaseWakeLocksRunnable();
|
||||||
private boolean active = false;
|
private boolean active = false;
|
||||||
|
private boolean intentLocation = false;
|
||||||
|
|
||||||
private DevicePolicyManager mDevicePolicyManager;
|
private DevicePolicyManager mDevicePolicyManager;
|
||||||
private ComponentName mDeviceAdmin;
|
private ComponentName mDeviceAdmin;
|
||||||
|
@ -361,10 +362,12 @@ public class MapActivity extends AccessibleActivity implements
|
||||||
}
|
}
|
||||||
app.getLocationProvider().resumeAllUpdates();
|
app.getLocationProvider().resumeAllUpdates();
|
||||||
|
|
||||||
if (settings != null && settings.isLastKnownMapLocation()) {
|
if (settings != null && settings.isLastKnownMapLocation() && !intentLocation) {
|
||||||
LatLon l = settings.getLastKnownMapLocation();
|
LatLon l = settings.getLastKnownMapLocation();
|
||||||
mapView.setLatLon(l.getLatitude(), l.getLongitude());
|
mapView.setLatLon(l.getLatitude(), l.getLongitude());
|
||||||
mapView.setIntZoom(settings.getLastKnownMapZoom());
|
mapView.setIntZoom(settings.getLastKnownMapZoom());
|
||||||
|
} else {
|
||||||
|
intentLocation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.MAP_ACTIVITY_ENABLED.set(true);
|
settings.MAP_ACTIVITY_ENABLED.set(true);
|
||||||
|
|
14
OsmAnd/src/net/osmand/plus/dashboard/DashBaseFragment.java
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
package net.osmand.plus.dashboard;
|
||||||
|
|
||||||
|
import com.actionbarsherlock.app.SherlockFragment;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Denis on 24.11.2014.
|
||||||
|
*/
|
||||||
|
public class DashBaseFragment extends SherlockFragment {
|
||||||
|
|
||||||
|
public OsmandApplication getMyApplication(){
|
||||||
|
return (OsmandApplication) getActivity().getApplication();
|
||||||
|
}
|
||||||
|
}
|
120
OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java
Normal file
|
@ -0,0 +1,120 @@
|
||||||
|
package net.osmand.plus.dashboard;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.util.TypedValue;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import net.osmand.data.FavouritePoint;
|
||||||
|
import net.osmand.data.LatLon;
|
||||||
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
|
import net.osmand.plus.OsmAndAppCustomization;
|
||||||
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||||
|
import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Denis on 24.11.2014.
|
||||||
|
*/
|
||||||
|
public class DashFavoritesFragment extends DashBaseFragment {
|
||||||
|
public static final String TAG = "DASH_FAVORITES_FRAGMENT";
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_favorites_fragment, container, false);
|
||||||
|
Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Medium.ttf");
|
||||||
|
((TextView) view.findViewById(R.id.fav_text)).setTypeface(typeface);
|
||||||
|
((Button) view.findViewById(R.id.show_all)).setTypeface(typeface);
|
||||||
|
|
||||||
|
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
|
||||||
|
final Intent favorites = new Intent(activity, appCustomization.getFavoritesActivity());
|
||||||
|
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
activity.startActivity(favorites);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
setupFavorites();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupFavorites(){
|
||||||
|
View mainView = getView();
|
||||||
|
final FavouritesDbHelper helper = getMyApplication().getFavorites();
|
||||||
|
final List<FavouritePoint> points = new ArrayList<FavouritePoint>(helper.getFavouritePoints());
|
||||||
|
if (points.size() == 0){
|
||||||
|
(mainView.findViewById(R.id.main_fav)).setVisibility(View.GONE);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
(mainView.findViewById(R.id.main_fav)).setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
Collections.sort(points, new Comparator<FavouritePoint>() {
|
||||||
|
@Override
|
||||||
|
public int compare(FavouritePoint point, FavouritePoint point2) {
|
||||||
|
LatLon lastKnownMapLocation = getMyApplication().getSettings().getLastKnownMapLocation();
|
||||||
|
int dist = (int) (MapUtils.getDistance(point.getLatitude(), point.getLongitude(),
|
||||||
|
lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude()));
|
||||||
|
int dist2 = (int) (MapUtils.getDistance(point2.getLatitude(), point2.getLongitude(),
|
||||||
|
lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude()));
|
||||||
|
return (dist - dist2);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
LinearLayout favorites = (LinearLayout) mainView.findViewById(R.id.favorites);
|
||||||
|
favorites.removeAllViews();
|
||||||
|
if (points.size() > 3){
|
||||||
|
while (points.size() != 3){
|
||||||
|
points.remove(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final FavouritePoint point : points) {
|
||||||
|
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||||
|
View view = inflater.inflate(R.layout.dash_favorites_item, null, false);
|
||||||
|
TextView name = (TextView) view.findViewById(R.id.name);
|
||||||
|
TextView label = (TextView) view.findViewById(R.id.distance);
|
||||||
|
ImageView icon = (ImageView) view.findViewById(R.id.icon);
|
||||||
|
name.setText(point.getName());
|
||||||
|
icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(getActivity(), point.getColor()));
|
||||||
|
LatLon lastKnownMapLocation = getMyApplication().getSettings().getLastKnownMapLocation();
|
||||||
|
int dist = (int) (MapUtils.getDistance(point.getLatitude(), point.getLongitude(),
|
||||||
|
lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude()));
|
||||||
|
String distance = OsmAndFormatter.getFormattedDistance(dist, getMyApplication()) + " ";
|
||||||
|
label.setText(distance, TextView.BufferType.SPANNABLE);
|
||||||
|
label.setTypeface(Typeface.DEFAULT, point.isVisible() ? Typeface.NORMAL : Typeface.ITALIC);
|
||||||
|
view.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
getMyApplication().getSettings().setMapLocationToShow(point.getLatitude(), point.getLongitude(), 15, null, point.getName(),
|
||||||
|
point); //$NON-NLS-1$
|
||||||
|
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50, getResources().getDisplayMetrics());
|
||||||
|
|
||||||
|
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, height);
|
||||||
|
view.setLayoutParams(lp);
|
||||||
|
favorites.addView(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
97
OsmAnd/src/net/osmand/plus/dashboard/DashMapFragment.java
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
package net.osmand.plus.dashboard;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import net.osmand.data.LatLon;
|
||||||
|
import net.osmand.map.MapTileDownloader.DownloadRequest;
|
||||||
|
import net.osmand.map.MapTileDownloader.IMapDownloaderCallback;
|
||||||
|
import net.osmand.plus.OsmAndAppCustomization;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.render.MapVectorLayer;
|
||||||
|
import net.osmand.plus.resources.ResourceManager;
|
||||||
|
import net.osmand.plus.views.MapTextLayer;
|
||||||
|
import net.osmand.plus.views.OsmAndMapSurfaceView;
|
||||||
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Denis on 24.11.2014.
|
||||||
|
*/
|
||||||
|
public class DashMapFragment extends DashBaseFragment implements IMapDownloaderCallback {
|
||||||
|
|
||||||
|
public static final String TAG = "DASH_MAP_FRAGMENT";
|
||||||
|
private OsmandMapTileView osmandMapTileView;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
getMyApplication().getResourceManager().getMapTileDownloader().removeDownloaderCallback(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
getMyApplication().getResourceManager().getMapTileDownloader().addDownloaderCallback(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_map_fragment, container, false);
|
||||||
|
setupMapView(view);
|
||||||
|
Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Medium.ttf");
|
||||||
|
((TextView) view.findViewById(R.id.map_text)).setTypeface(typeface);
|
||||||
|
((Button) view.findViewById(R.id.show_map)).setTypeface(typeface);
|
||||||
|
|
||||||
|
(view.findViewById(R.id.show_map)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
|
||||||
|
final Intent mapIndent = new Intent(activity, appCustomization.getMapActivity());
|
||||||
|
activity.startActivityForResult(mapIndent, 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupMapView(View view){
|
||||||
|
OsmAndMapSurfaceView surf = (OsmAndMapSurfaceView) view.findViewById(R.id.MapView);
|
||||||
|
osmandMapTileView = surf.getMapView();
|
||||||
|
osmandMapTileView.getView().setVisibility(View.VISIBLE);
|
||||||
|
osmandMapTileView.removeAllLayers();
|
||||||
|
MapVectorLayer mapVectorLayer = new MapVectorLayer(null);
|
||||||
|
MapTextLayer mapTextLayer = new MapTextLayer();
|
||||||
|
mapTextLayer.setAlwaysVisible(true);
|
||||||
|
// 5.95 all labels
|
||||||
|
osmandMapTileView.addLayer(mapTextLayer, 5.95f);
|
||||||
|
osmandMapTileView.addLayer(mapVectorLayer, 0.5f);
|
||||||
|
osmandMapTileView.setMainLayer(mapVectorLayer);
|
||||||
|
mapVectorLayer.setVisible(true);
|
||||||
|
LatLon lm = getMyApplication().getSettings().getLastKnownMapLocation();
|
||||||
|
int zm = getMyApplication().getSettings().getLastKnownMapZoom();
|
||||||
|
osmandMapTileView.setLatLon(lm.getLatitude(), lm.getLongitude());
|
||||||
|
osmandMapTileView.setIntZoom(zm);
|
||||||
|
osmandMapTileView.refreshMap(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tileDownloaded(DownloadRequest request) {
|
||||||
|
if(request != null && !request.error && request.fileToSave != null){
|
||||||
|
ResourceManager mgr = getMyApplication().getResourceManager();
|
||||||
|
mgr.tileDownloaded(request);
|
||||||
|
}
|
||||||
|
if(request == null || !request.error){
|
||||||
|
if(osmandMapTileView != null) {
|
||||||
|
osmandMapTileView.tileDownloaded(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
package net.osmand.plus.dashboard;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.util.TypedValue;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Denis on 21.11.2014.
|
||||||
|
*/
|
||||||
|
public class DashPluginsFragment extends DashBaseFragment {
|
||||||
|
|
||||||
|
public static final String TAG = "DASH_PLUGINS_FRAGMENT";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_plugins_fragment, container, false);
|
||||||
|
Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Medium.ttf");
|
||||||
|
((TextView) view.findViewById(R.id.plugin_text)).setTypeface(typeface);
|
||||||
|
((Button) view.findViewById(R.id.show_all)).setTypeface(typeface);
|
||||||
|
view.findViewById(R.id.show_all).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
startActivityForResult(new Intent(getActivity(), getMyApplication().getAppCustomization().getPluginsActivity()), 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
LinearLayout layout = (LinearLayout) getView().findViewById(R.id.plugins);
|
||||||
|
layout.removeAllViews();
|
||||||
|
addPlugins(layout);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addPlugins(View parent){
|
||||||
|
LinearLayout layout = (LinearLayout) parent;
|
||||||
|
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||||
|
|
||||||
|
List<OsmandPlugin> availablePlugins = OsmandPlugin.getAvailablePlugins();
|
||||||
|
List<OsmandPlugin> enabledPlugins = OsmandPlugin.getEnabledPlugins();
|
||||||
|
for (int i=0; i < availablePlugins.size(); i++){
|
||||||
|
if (i> 2){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
final OsmandPlugin plugin = availablePlugins.get(i);
|
||||||
|
View view = inflater.inflate(R.layout.dash_plugin_item, null, false);
|
||||||
|
((TextView) view.findViewById(R.id.plugin_name)).setText(plugin.getName());
|
||||||
|
((TextView) view.findViewById(R.id.plugin_descr)).setText(plugin.getDescription());
|
||||||
|
CompoundButton check = (CompoundButton) view.findViewById(R.id.check_item);
|
||||||
|
check.setChecked(enabledPlugins.contains(plugin));
|
||||||
|
check.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
||||||
|
OsmandPlugin.enablePlugin(getMyApplication(),plugin, b);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50, getResources().getDisplayMetrics());
|
||||||
|
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, height);
|
||||||
|
view.setLayoutParams(lp);
|
||||||
|
layout.addView(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
102
OsmAnd/src/net/osmand/plus/dashboard/DashSearchFragment.java
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
package net.osmand.plus.dashboard;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import net.osmand.plus.OsmAndAppCustomization;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.activities.search.SearchActivity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Denis on 24.11.2014.
|
||||||
|
*/
|
||||||
|
public class DashSearchFragment extends DashBaseFragment {
|
||||||
|
|
||||||
|
public static final String TAG = "DASH_SEARCH_FRAGMENT";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_search_fragment, container, false);
|
||||||
|
setupButtons(view);
|
||||||
|
Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Medium.ttf");
|
||||||
|
((TextView) view.findViewById(R.id.search_for)).setTypeface(typeface);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupButtons(View view){
|
||||||
|
final Activity activity = getActivity();
|
||||||
|
final OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
|
||||||
|
(view.findViewById(R.id.poi)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
|
||||||
|
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.POI_TAB_INDEX);
|
||||||
|
activity.startActivity(search);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
(view.findViewById(R.id.address)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
|
||||||
|
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.ADDRESS_TAB_INDEX);
|
||||||
|
activity.startActivity(search);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
(view.findViewById(R.id.coord)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
|
||||||
|
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.LOCATION_TAB_INDEX);
|
||||||
|
activity.startActivity(search);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
(view.findViewById(R.id.fav_btn)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
|
||||||
|
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.FAVORITES_TAB_INDEX);
|
||||||
|
activity.startActivity(search);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
(view.findViewById(R.id.history)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
|
||||||
|
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.HISTORY_TAB_INDEX);
|
||||||
|
activity.startActivity(search);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
(view.findViewById(R.id.transport)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
|
||||||
|
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.TRANSPORT_TAB_INDEX);
|
||||||
|
activity.startActivity(search);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
169
OsmAnd/src/net/osmand/plus/dashboard/DashUpdatesFragment.java
Normal file
|
@ -0,0 +1,169 @@
|
||||||
|
package net.osmand.plus.dashboard;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.base.BasicProgressAsyncTask;
|
||||||
|
import net.osmand.plus.download.BaseDownloadActivity;
|
||||||
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
|
import net.osmand.plus.download.DownloadEntry;
|
||||||
|
import net.osmand.plus.download.IndexItem;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Denis on 21.11.2014.
|
||||||
|
*/
|
||||||
|
public class DashUpdatesFragment extends DashBaseFragment {
|
||||||
|
|
||||||
|
public static final String TAG = "DASH_UPDATES_FRAGMENT";
|
||||||
|
|
||||||
|
private ProgressBar currentProgress;
|
||||||
|
private List<ProgressBar> progressBars = new ArrayList<ProgressBar>();
|
||||||
|
private List<String> baseNames = new ArrayList<String>();
|
||||||
|
private List<ImageButton> downloadButtons = new ArrayList<ImageButton>();
|
||||||
|
private ImageButton cancelButton;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_updates_fragment, container, false);
|
||||||
|
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
final Intent intent = new Intent(view.getContext(), getMyApplication().getAppCustomization().getDownloadIndexActivity());
|
||||||
|
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.UPDATES_TAB);
|
||||||
|
getActivity().startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
if (BaseDownloadActivity.downloadListIndexThread != null){
|
||||||
|
currentProgress = null;
|
||||||
|
cancelButton = null;
|
||||||
|
updatedDownloadsList(BaseDownloadActivity.downloadListIndexThread.getItemsToUpdate());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updatedDownloadsList(List<IndexItem> list) {
|
||||||
|
View mainView = getView();
|
||||||
|
//it may be null because download index thread is async
|
||||||
|
if (mainView == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
progressBars.clear();
|
||||||
|
baseNames.clear();
|
||||||
|
downloadButtons.clear();
|
||||||
|
if (list.size() > 0) {
|
||||||
|
mainView.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
mainView.setVisibility(View.GONE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
((TextView)mainView.findViewById(R.id.update_count)).setText(String.valueOf(list.size()));
|
||||||
|
|
||||||
|
LinearLayout updates = (LinearLayout) mainView.findViewById(R.id.updates_items);
|
||||||
|
updates.removeAllViews();
|
||||||
|
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
final IndexItem item = list.get(i);
|
||||||
|
if (i > 2) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||||
|
View view = inflater.inflate(R.layout.dash_updates_item, null, false);
|
||||||
|
String name = item.getVisibleName(getMyApplication(), getMyApplication().getResourceManager().getOsmandRegions());
|
||||||
|
String d = item.getDate(getMyApplication().getResourceManager().getDateFormat()) + ", " + item.getSizeDescription(getMyApplication());
|
||||||
|
String eName = name.replace("\n", " ");
|
||||||
|
((TextView) view.findViewById(R.id.map_name)).setText(eName);
|
||||||
|
((TextView) view.findViewById(R.id.map_descr)).setText(d);
|
||||||
|
final ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.ProgressBar);
|
||||||
|
View downloadButton = (view.findViewById(R.id.btn_download));
|
||||||
|
downloadButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
getDownloadActivity().startDownload(item);
|
||||||
|
currentProgress = progressBar;
|
||||||
|
cancelButton = (ImageButton)view;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
downloadButtons.add((ImageButton)downloadButton);
|
||||||
|
baseNames.add(item.getBasename());
|
||||||
|
progressBars.add(progressBar);
|
||||||
|
updates.addView(view);
|
||||||
|
}
|
||||||
|
updateProgress(BaseDownloadActivity.downloadListIndexThread.getCurrentRunningTask(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private BaseDownloadActivity getDownloadActivity(){
|
||||||
|
return (BaseDownloadActivity)getActivity();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateProgress(BasicProgressAsyncTask<?, ?, ?> basicProgressAsyncTask, boolean updateOnlyProgress) {
|
||||||
|
if (basicProgressAsyncTask == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//needed when rotation is performed and progress can be null
|
||||||
|
if (currentProgress == null){
|
||||||
|
getProgressIfPossible(basicProgressAsyncTask.getDescription());
|
||||||
|
if (currentProgress == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(updateOnlyProgress){
|
||||||
|
if(!basicProgressAsyncTask.isIndeterminate()){
|
||||||
|
currentProgress.setProgress(basicProgressAsyncTask.getProgressPercentage());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
boolean visible = basicProgressAsyncTask.getStatus() != AsyncTask.Status.FINISHED;
|
||||||
|
if (!visible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cancelButton.setImageResource(R.drawable.cancel_button);
|
||||||
|
cancelButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
getDownloadActivity().makeSureUserCancelDownload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
boolean intermediate = basicProgressAsyncTask.isIndeterminate();
|
||||||
|
currentProgress.setVisibility(intermediate ? View.GONE : View.VISIBLE);
|
||||||
|
if (!intermediate) {
|
||||||
|
currentProgress.setProgress(basicProgressAsyncTask.getProgressPercentage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getProgressIfPossible(String message) {
|
||||||
|
for (int i =0; i<baseNames.size(); i++){
|
||||||
|
if (message.equals(getActivity().getString(R.string.downloading_file_new) + " " + baseNames.get(i))){
|
||||||
|
currentProgress = progressBars.get(i);
|
||||||
|
cancelButton = downloadButtons.get(i);
|
||||||
|
currentProgress.setVisibility(View.VISIBLE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
200
OsmAnd/src/net/osmand/plus/download/BaseDownloadActivity.java
Normal file
|
@ -0,0 +1,200 @@
|
||||||
|
package net.osmand.plus.download;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.Version;
|
||||||
|
import net.osmand.plus.activities.DashboardActivity;
|
||||||
|
import net.osmand.plus.base.BasicProgressAsyncTask;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Denis on 25.11.2014.
|
||||||
|
*/
|
||||||
|
public class BaseDownloadActivity extends SherlockFragmentActivity {
|
||||||
|
protected DownloadActivityType type = DownloadActivityType.NORMAL_FILE;
|
||||||
|
protected OsmandSettings settings;
|
||||||
|
public static DownloadIndexesThread downloadListIndexThread;
|
||||||
|
protected List<WeakReference<Fragment>> fragList = new ArrayList<WeakReference<Fragment>>();
|
||||||
|
|
||||||
|
public static final int MAXIMUM_AVAILABLE_FREE_DOWNLOADS = 10;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
if(downloadListIndexThread == null) {
|
||||||
|
downloadListIndexThread = new DownloadIndexesThread(this);
|
||||||
|
}
|
||||||
|
if (downloadListIndexThread.getCachedIndexFiles() != null && downloadListIndexThread.isDownloadedFromInternet()) {
|
||||||
|
downloadListIndexThread.runCategorization(type);
|
||||||
|
} else {
|
||||||
|
downloadListIndexThread.runReloadIndexFiles();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
downloadListIndexThread.setUiActivity(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void updateDownloadList(List<IndexItem> list){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateProgress(boolean updateOnlyProgress) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public DownloadActivityType getDownloadType(){
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<IndexItem, List<DownloadEntry>> getEntriesToDownload() {
|
||||||
|
if(downloadListIndexThread == null) {
|
||||||
|
return new LinkedHashMap<IndexItem, List<DownloadEntry>>();
|
||||||
|
}
|
||||||
|
return downloadListIndexThread.getEntriesToDownload();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void downloadedIndexes() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateDownloadButton(boolean scroll) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void downloadListUpdated(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public OsmandApplication getMyApplication(){
|
||||||
|
return (OsmandApplication)getApplication();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void categorizationFinished(List<IndexItem> filtered, List<IndexItemCategory> cats){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startDownload(IndexItem item){
|
||||||
|
if (downloadListIndexThread.getCurrentRunningTask() != null){
|
||||||
|
Toast.makeText(this, "Please wait before previous download is finished", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<DownloadEntry> download = item.createDownloadEntry(getMyApplication(), item.getType(), new ArrayList<DownloadEntry>());
|
||||||
|
getEntriesToDownload().put(item, download);
|
||||||
|
downloadFilesCheckFreeVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void downloadFilesPreCheckSpace() {
|
||||||
|
double sz = 0;
|
||||||
|
List<DownloadEntry> list = downloadListIndexThread.flattenDownloadEntries();
|
||||||
|
for (DownloadEntry es : list) {
|
||||||
|
sz += es.sizeMB;
|
||||||
|
}
|
||||||
|
// get availabile space
|
||||||
|
double asz = downloadListIndexThread.getAvailableSpace();
|
||||||
|
if (asz != -1 && asz > 0 && sz / asz > 0.4) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
builder.setMessage(MessageFormat.format(getString(R.string.download_files_question_space), list.size(), sz, asz));
|
||||||
|
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
downloadListIndexThread.runDownloadFiles();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.setNegativeButton(R.string.default_buttons_no, null);
|
||||||
|
builder.show();
|
||||||
|
} else {
|
||||||
|
downloadListIndexThread.runDownloadFiles();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void downloadFilesCheckFreeVersion() {
|
||||||
|
if (Version.isFreeVersion(getMyApplication()) ) {
|
||||||
|
int total = settings.NUMBER_OF_FREE_DOWNLOADS.get();
|
||||||
|
boolean wiki = false;
|
||||||
|
for (IndexItem es : DownloadActivity.downloadListIndexThread.getEntriesToDownload().keySet()) {
|
||||||
|
if (es.getBasename() != null && es.getBasename().contains("_wiki")) {
|
||||||
|
wiki = true;
|
||||||
|
break;
|
||||||
|
} else if (DownloadActivityType.isCountedInDownloads(es.getType())) {
|
||||||
|
total++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (total > MAXIMUM_AVAILABLE_FREE_DOWNLOADS || wiki) {
|
||||||
|
String msgTx = getString(R.string.free_version_message, MAXIMUM_AVAILABLE_FREE_DOWNLOADS + "");
|
||||||
|
AlertDialog.Builder msg = new AlertDialog.Builder(this);
|
||||||
|
msg.setTitle(R.string.free_version_title);
|
||||||
|
msg.setMessage(msgTx);
|
||||||
|
msg.setPositiveButton(R.string.default_buttons_ok, null);
|
||||||
|
msg.show();
|
||||||
|
} else {
|
||||||
|
downloadFilesCheckInternet();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
downloadFilesCheckInternet();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void downloadFilesCheckInternet() {
|
||||||
|
if(!getMyApplication().getSettings().isWifiConnected()) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
builder.setMessage(getString(R.string.download_using_mobile_internet));
|
||||||
|
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
downloadFilesPreCheckSpace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.setNegativeButton(R.string.default_buttons_no, null);
|
||||||
|
builder.show();
|
||||||
|
} else {
|
||||||
|
downloadFilesPreCheckSpace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttachFragment(Fragment fragment) {
|
||||||
|
fragList.add(new WeakReference<Fragment>(fragment));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void makeSureUserCancelDownload() {
|
||||||
|
AlertDialog.Builder bld = new AlertDialog.Builder(this);
|
||||||
|
bld.setTitle(getString(R.string.default_buttons_cancel));
|
||||||
|
bld.setMessage(R.string.confirm_interrupt_download);
|
||||||
|
bld.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
BasicProgressAsyncTask<?, ?, ?> t = DownloadActivity.downloadListIndexThread.getCurrentRunningTask();
|
||||||
|
if (t != null) {
|
||||||
|
t.setInterrupted(true);
|
||||||
|
}
|
||||||
|
// list of items to download need to be cleared in case of dashboard activity
|
||||||
|
if (BaseDownloadActivity.this instanceof DashboardActivity) {
|
||||||
|
getEntriesToDownload().clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
bld.setNegativeButton(R.string.default_buttons_no, null);
|
||||||
|
bld.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -36,15 +36,10 @@ import java.util.*;
|
||||||
/**
|
/**
|
||||||
* Created by Denis on 08.09.2014.
|
* Created by Denis on 08.09.2014.
|
||||||
*/
|
*/
|
||||||
public class DownloadActivity extends SherlockFragmentActivity {
|
public class DownloadActivity extends BaseDownloadActivity {
|
||||||
|
|
||||||
private TabHost tabHost;
|
private TabHost tabHost;
|
||||||
private FavouritesActivity.TabsAdapter mTabsAdapter;
|
private FavouritesActivity.TabsAdapter mTabsAdapter;
|
||||||
public static DownloadIndexesThread downloadListIndexThread;
|
|
||||||
private DownloadActivityType type = DownloadActivityType.NORMAL_FILE;
|
|
||||||
public static final int MAXIMUM_AVAILABLE_FREE_DOWNLOADS = 10;
|
|
||||||
|
|
||||||
private OsmandSettings settings;
|
|
||||||
|
|
||||||
private View progressView;
|
private View progressView;
|
||||||
private ProgressBar indeterminateProgressBar;
|
private ProgressBar indeterminateProgressBar;
|
||||||
|
@ -53,7 +48,6 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
private TextView progressPercent;
|
private TextView progressPercent;
|
||||||
private ImageView cancel;
|
private ImageView cancel;
|
||||||
private List<LocalIndexInfo> localIndexInfos = new ArrayList<LocalIndexInfo>();
|
private List<LocalIndexInfo> localIndexInfos = new ArrayList<LocalIndexInfo>();
|
||||||
List<WeakReference<Fragment>> fragList = new ArrayList<WeakReference<Fragment>>();
|
|
||||||
|
|
||||||
private String initialFilter = "";
|
private String initialFilter = "";
|
||||||
|
|
||||||
|
@ -62,8 +56,15 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
|
|
||||||
public static final String TAB_TO_OPEN = "Tab_to_open";
|
public static final String TAB_TO_OPEN = "Tab_to_open";
|
||||||
public static final String DOWNLOAD_TAB = "download";
|
public static final String DOWNLOAD_TAB = "download";
|
||||||
|
public static final String UPDATES_TAB = "updates";
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
BaseDownloadActivity.downloadListIndexThread.resetUiActivity(DownloadActivity.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
getMyApplication().applyTheme(this);
|
getMyApplication().applyTheme(this);
|
||||||
|
@ -72,15 +73,6 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
setProgressBarIndeterminateVisibility(false);
|
setProgressBarIndeterminateVisibility(false);
|
||||||
|
|
||||||
setContentView(R.layout.tab_content);
|
setContentView(R.layout.tab_content);
|
||||||
if(downloadListIndexThread == null) {
|
|
||||||
downloadListIndexThread = new DownloadIndexesThread(this);
|
|
||||||
}
|
|
||||||
if (downloadListIndexThread.getCachedIndexFiles() != null && downloadListIndexThread.isDownloadedFromInternet()) {
|
|
||||||
downloadListIndexThread.runCategorization(type);
|
|
||||||
} else {
|
|
||||||
downloadListIndexThread.runReloadIndexFiles();
|
|
||||||
}
|
|
||||||
downloadListIndexThread.setUiActivity(this);
|
|
||||||
|
|
||||||
settings = ((OsmandApplication) getApplication()).getSettings();
|
settings = ((OsmandApplication) getApplication()).getSettings();
|
||||||
tabHost = (TabHost) findViewById(android.R.id.tabhost);
|
tabHost = (TabHost) findViewById(android.R.id.tabhost);
|
||||||
|
@ -151,6 +143,8 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
if (tab != null) {
|
if (tab != null) {
|
||||||
if (tab.equals(DOWNLOAD_TAB)){
|
if (tab.equals(DOWNLOAD_TAB)){
|
||||||
tabHost.setCurrentTab(1);
|
tabHost.setCurrentTab(1);
|
||||||
|
} else if (tab.equals(UPDATES_TAB)){
|
||||||
|
tabHost.setCurrentTab(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,8 +236,6 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
return localIndexInfos;
|
return localIndexInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DownloadActivityType getDownloadType() { return type;}
|
|
||||||
|
|
||||||
public void setType(DownloadActivityType type) { this.type = type;}
|
public void setType(DownloadActivityType type) { this.type = type;}
|
||||||
|
|
||||||
public void changeType(final DownloadActivityType tp) {
|
public void changeType(final DownloadActivityType tp) {
|
||||||
|
@ -254,90 +246,12 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void downloadFilesPreCheckSpace() {
|
|
||||||
double sz = 0;
|
|
||||||
List<DownloadEntry> list = downloadListIndexThread.flattenDownloadEntries();
|
|
||||||
for (DownloadEntry es : list) {
|
|
||||||
sz += es.sizeMB;
|
|
||||||
}
|
|
||||||
// get availabile space
|
|
||||||
double asz = downloadListIndexThread.getAvailableSpace();
|
|
||||||
if (asz != -1 && asz > 0 && sz / asz > 0.4) {
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
||||||
builder.setMessage(MessageFormat.format(getString(R.string.download_files_question_space), list.size(), sz, asz));
|
|
||||||
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
downloadListIndexThread.runDownloadFiles();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
builder.setNegativeButton(R.string.default_buttons_no, null);
|
|
||||||
builder.show();
|
|
||||||
} else {
|
|
||||||
downloadListIndexThread.runDownloadFiles();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<IndexItem, List<DownloadEntry>> getEntriesToDownload() {
|
|
||||||
if(downloadListIndexThread == null) {
|
|
||||||
return new LinkedHashMap<IndexItem, List<DownloadEntry>>();
|
|
||||||
}
|
|
||||||
return downloadListIndexThread.getEntriesToDownload();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
(getMyApplication()).setDownloadActivity(null);
|
(getMyApplication()).setDownloadActivity(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void downloadFilesCheckFreeVersion() {
|
|
||||||
if (Version.isFreeVersion(getMyApplication()) ) {
|
|
||||||
int total = settings.NUMBER_OF_FREE_DOWNLOADS.get();
|
|
||||||
boolean wiki = false;
|
|
||||||
for (IndexItem es : DownloadActivity.downloadListIndexThread.getEntriesToDownload().keySet()) {
|
|
||||||
if (es.getBasename() != null && es.getBasename().contains("_wiki")) {
|
|
||||||
wiki = true;
|
|
||||||
break;
|
|
||||||
} else if (DownloadActivityType.isCountedInDownloads(es.getType())) {
|
|
||||||
total++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (total > MAXIMUM_AVAILABLE_FREE_DOWNLOADS || wiki) {
|
|
||||||
String msgTx = getString(R.string.free_version_message, MAXIMUM_AVAILABLE_FREE_DOWNLOADS + "");
|
|
||||||
AlertDialog.Builder msg = new AlertDialog.Builder(this);
|
|
||||||
msg.setTitle(R.string.free_version_title);
|
|
||||||
msg.setMessage(msgTx);
|
|
||||||
msg.setPositiveButton(R.string.default_buttons_ok, null);
|
|
||||||
msg.show();
|
|
||||||
} else {
|
|
||||||
downloadFilesCheckInternet();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
downloadFilesCheckInternet();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void downloadFilesCheckInternet() {
|
|
||||||
if(!getMyApplication().getSettings().isWifiConnected()) {
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
||||||
builder.setMessage(getString(R.string.download_using_mobile_internet));
|
|
||||||
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
downloadFilesPreCheckSpace();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
builder.setNegativeButton(R.string.default_buttons_no, null);
|
|
||||||
builder.show();
|
|
||||||
} else {
|
|
||||||
downloadFilesPreCheckSpace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public OsmandApplication getMyApplication(){ return (OsmandApplication)getApplication();}
|
|
||||||
|
|
||||||
public void showDialogOfFreeDownloadsIfNeeded() {
|
public void showDialogOfFreeDownloadsIfNeeded() {
|
||||||
if (Version.isFreeVersion(getMyApplication())) {
|
if (Version.isFreeVersion(getMyApplication())) {
|
||||||
AlertDialog.Builder msg = new AlertDialog.Builder(this);
|
AlertDialog.Builder msg = new AlertDialog.Builder(this);
|
||||||
|
@ -362,6 +276,7 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void updateProgress(boolean updateOnlyProgress) {
|
public void updateProgress(boolean updateOnlyProgress) {
|
||||||
BasicProgressAsyncTask<?, ?, ?> basicProgressAsyncTask = DownloadActivity.downloadListIndexThread.getCurrentRunningTask();
|
BasicProgressAsyncTask<?, ?, ?> basicProgressAsyncTask = DownloadActivity.downloadListIndexThread.getCurrentRunningTask();
|
||||||
//needed when rotation is performed and progress can be null
|
//needed when rotation is performed and progress can be null
|
||||||
|
@ -394,24 +309,7 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void makeSureUserCancelDownload() {
|
@Override
|
||||||
AlertDialog.Builder bld = new AlertDialog.Builder(this);
|
|
||||||
bld.setTitle(getString(R.string.default_buttons_cancel));
|
|
||||||
bld.setMessage(R.string.confirm_interrupt_download);
|
|
||||||
bld.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
dialog.dismiss();
|
|
||||||
BasicProgressAsyncTask<?, ?, ?> t = DownloadActivity.downloadListIndexThread.getCurrentRunningTask();
|
|
||||||
if(t != null) {
|
|
||||||
t.setInterrupted(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
bld.setNegativeButton(R.string.default_buttons_no, null);
|
|
||||||
bld.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateDownloadList(List<IndexItem> list){
|
public void updateDownloadList(List<IndexItem> list){
|
||||||
for(WeakReference<Fragment> ref : fragList) {
|
for(WeakReference<Fragment> ref : fragList) {
|
||||||
Fragment f = ref.get();
|
Fragment f = ref.get();
|
||||||
|
@ -423,6 +321,7 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void categorizationFinished(List<IndexItem> filtered, List<IndexItemCategory> cats){
|
public void categorizationFinished(List<IndexItem> filtered, List<IndexItemCategory> cats){
|
||||||
for(WeakReference<Fragment> ref : fragList) {
|
for(WeakReference<Fragment> ref : fragList) {
|
||||||
Fragment f = ref.get();
|
Fragment f = ref.get();
|
||||||
|
@ -445,6 +344,7 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void downloadedIndexes(){
|
public void downloadedIndexes(){
|
||||||
for(WeakReference<Fragment> ref : fragList) {
|
for(WeakReference<Fragment> ref : fragList) {
|
||||||
Fragment f = ref.get();
|
Fragment f = ref.get();
|
||||||
|
@ -465,6 +365,7 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void updateDownloadButton(boolean scroll) {
|
public void updateDownloadButton(boolean scroll) {
|
||||||
// View view = getView();
|
// View view = getView();
|
||||||
// if (view == null || getExpandableListView() == null){
|
// if (view == null || getExpandableListView() == null){
|
||||||
|
@ -520,10 +421,6 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
return ((OsmandApplication) getApplication()).getSettings().isLightActionBar();
|
return ((OsmandApplication) getApplication()).getSettings().isLightActionBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAttachFragment(Fragment fragment) {
|
|
||||||
fragList.add(new WeakReference<Fragment>(fragment));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void copyFilesForAndroid19(final String newLoc) {
|
private void copyFilesForAndroid19(final String newLoc) {
|
||||||
SettingsGeneralActivity.MoveFilesToDifferentDirectory task =
|
SettingsGeneralActivity.MoveFilesToDifferentDirectory task =
|
||||||
|
|
|
@ -281,7 +281,6 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
|
||||||
EditText filterText = (EditText) getView().findViewById(R.id.search_box);
|
EditText filterText = (EditText) getView().findViewById(R.id.search_box);
|
||||||
filterText.removeTextChangedListener(textWatcher);
|
filterText.removeTextChangedListener(textWatcher);
|
||||||
}
|
}
|
||||||
DownloadActivity.downloadListIndexThread.setUiActivity(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> toString(List<DownloadActivityType> t) {
|
public List<String> toString(List<DownloadActivityType> t) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class DownloadIndexesThread {
|
public class DownloadIndexesThread {
|
||||||
private DownloadActivity uiActivity = null;
|
private BaseDownloadActivity uiActivity = null;
|
||||||
private IndexFileList indexFiles = null;
|
private IndexFileList indexFiles = null;
|
||||||
private Map<IndexItem, List<DownloadEntry>> entriesToDownload = new ConcurrentHashMap<IndexItem, List<DownloadEntry>>();
|
private Map<IndexItem, List<DownloadEntry>> entriesToDownload = new ConcurrentHashMap<IndexItem, List<DownloadEntry>>();
|
||||||
private Set<DownloadEntry> currentDownloads = new HashSet<DownloadEntry>();
|
private Set<DownloadEntry> currentDownloads = new HashSet<DownloadEntry>();
|
||||||
|
@ -69,10 +69,10 @@ public class DownloadIndexesThread {
|
||||||
indexFiles = null;
|
indexFiles = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUiActivity(DownloadActivity uiActivity) {
|
public void setUiActivity(BaseDownloadActivity uiActivity) {
|
||||||
this.uiActivity = uiActivity;
|
this.uiActivity = uiActivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DownloadEntry> flattenDownloadEntries() {
|
public List<DownloadEntry> flattenDownloadEntries() {
|
||||||
List<DownloadEntry> res = new ArrayList<DownloadEntry>();
|
List<DownloadEntry> res = new ArrayList<DownloadEntry>();
|
||||||
for(List<DownloadEntry> ens : getEntriesToDownload().values()) {
|
for(List<DownloadEntry> ens : getEntriesToDownload().values()) {
|
||||||
|
@ -120,7 +120,17 @@ public class DownloadIndexesThread {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IndexItem> getItemsToUpdate() { return itemsToUpdate;}
|
public List<IndexItem> getItemsToUpdate() { return itemsToUpdate;}
|
||||||
|
|
||||||
|
public void resetUiActivity(Class<?> downloadActivityClass) {
|
||||||
|
if (uiActivity== null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uiActivity.getClass().equals(downloadActivityClass)){
|
||||||
|
uiActivity = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class DownloadIndexesAsyncTask extends BasicProgressAsyncTask<IndexItem, Object, String> implements DownloadFileShowWarning {
|
public class DownloadIndexesAsyncTask extends BasicProgressAsyncTask<IndexItem, Object, String> implements DownloadFileShowWarning {
|
||||||
|
|
||||||
private OsmandPreference<Integer> downloads;
|
private OsmandPreference<Integer> downloads;
|
||||||
|
@ -395,7 +405,9 @@ public class DownloadIndexesThread {
|
||||||
uiActivity.getEntriesToDownload().put(basemap, downloadEntry);
|
uiActivity.getEntriesToDownload().put(basemap, downloadEntry);
|
||||||
AccessibleToast.makeText(uiActivity, R.string.basemap_was_selected_to_download,
|
AccessibleToast.makeText(uiActivity, R.string.basemap_was_selected_to_download,
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
uiActivity.findViewById(R.id.DownloadButton).setVisibility(View.VISIBLE);
|
if (uiActivity instanceof DownloadActivity){
|
||||||
|
uiActivity.findViewById(R.id.DownloadButton).setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (indexFiles.isIncreasedMapVersion()) {
|
if (indexFiles.isIncreasedMapVersion()) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class UpdatesIndexFragment extends SherlockListFragment {
|
||||||
updateColor = getResources().getColor(R.color.color_update);
|
updateColor = getResources().getColor(R.color.color_update);
|
||||||
osmandRegions = getMyApplication().getResourceManager().getOsmandRegions();
|
osmandRegions = getMyApplication().getResourceManager().getOsmandRegions();
|
||||||
List<IndexItem> indexItems = new ArrayList<IndexItem>();
|
List<IndexItem> indexItems = new ArrayList<IndexItem>();
|
||||||
if (DownloadActivity.downloadListIndexThread != null) {
|
if (BaseDownloadActivity.downloadListIndexThread != null) {
|
||||||
indexItems = DownloadActivity.downloadListIndexThread.getItemsToUpdate();
|
indexItems = DownloadActivity.downloadListIndexThread.getItemsToUpdate();
|
||||||
}
|
}
|
||||||
listAdapter = new UpdateIndexAdapter(getDownloadActivity(), R.layout.download_index_list_item, indexItems);
|
listAdapter = new UpdateIndexAdapter(getDownloadActivity(), R.layout.download_index_list_item, indexItems);
|
||||||
|
|