This commit is contained in:
GaidamakUA 2015-10-23 10:30:44 +03:00
commit aecf8b6cc5
58 changed files with 1165 additions and 583 deletions

View file

@ -97,19 +97,35 @@ public class OsmandRegions {
}
private String getLang(BinaryMapDataObject o) {
return o.getNameByType(langType);
if (langType != null) {
return o.getNameByType(langType);
} else {
return null;
}
}
private String getMetric(BinaryMapDataObject o) {
return o.getNameByType(metricType);
if (metricType != null) {
return o.getNameByType(metricType);
} else {
return null;
}
}
private String getLeftHandDriving(BinaryMapDataObject o) {
return o.getNameByType(leftHandDrivingType);
if (leftHandDrivingType != null) {
return o.getNameByType(leftHandDrivingType);
} else {
return null;
}
}
private String getRoadSigns(BinaryMapDataObject o) {
return o.getNameByType(roadSignsType);
if (roadSignsType != null) {
return o.getNameByType(roadSignsType);
} else {
return null;
}
}
public String getDownloadName(BinaryMapDataObject o) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<nine-patch android:src="@drawable/bg_contextmenu_shadow_top_light" />
</item>
<item>
<shape>
<solid
android:color="@color/bg_color_dark" />
</shape>
</item>
</layer-list>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<nine-patch android:src="@drawable/bg_contextmenu_shadow_top_light" />
</item>
<item>
<shape>
<solid
android:color="@color/bg_color_light" />
</shape>
</item>
</layer-list>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<nine-patch android:src="@drawable/bg_contextmenu_shadow_right_light" />
</item>
<item>
<shape>
<solid
android:color="@color/bg_color_dark" />
</shape>
</item>
</layer-list>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<nine-patch android:src="@drawable/bg_contextmenu_shadow_right_light" />
</item>
<item>
<shape>
<solid
android:color="@color/bg_color_light" />
</shape>
</item>
</layer-list>

View file

@ -0,0 +1,256 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/point_edit_layout"
android:layout_width="350dp"
android:layout_height="match_parent"
android:background="@android:color/transparent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="fill_parent"
android:layout_height="@dimen/dashboard_map_toolbar"
android:background="?attr/pstsTabBackground"
android:minHeight="@dimen/dashboard_map_toolbar"
android:theme="?attr/toolbar_theme"
app:contentInsetLeft="72dp"
app:contentInsetStart="72dp">
<ImageButton
android:id="@+id/delete_button"
android:layout_width="?attr/actionBarSize"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="@android:color/transparent"
android:src="@drawable/ic_action_delete_dark"/>
<Button
android:id="@+id/save_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="@android:color/transparent"
android:text="@string/shared_string_save"/>
</android.support.v7.widget.Toolbar>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/ctx_menu_info_view_bg"
android:fillViewport="true">
<LinearLayout
android:id="@+id/main_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/title_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_point_editor_view"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp">
<TextView
android:id="@+id/header_caption"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="16dp"
android:layout_gravity="center_vertical"
android:text="Point info"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
<Button
android:id="@+id/button_replace"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:selectableItemBackground"
android:textColor="?attr/contextMenuButtonColor"
android:text="@string/update_existing"
android:visibility="gone"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal">
<LinearLayout
android:layout_width="42dp"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/name_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:scaleType="center"
android:src="@drawable/ic_action_building_number"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/name_caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:text="@string/favourites_edit_dialog_name"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"/>
<EditText
android:id="@+id/name_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginRight="16dp"
android:layout_marginLeft="8dp"
android:textColor="?android:textColorPrimary"
android:textColorHint="?android:textColorSecondary"
android:inputType="text"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal">
<LinearLayout
android:layout_width="42dp"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/category_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:scaleType="center"
android:src="@drawable/ic_action_building_number"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/category_caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:text="@string/favourites_edit_dialog_name"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"/>
<net.osmand.plus.widgets.AutoCompleteTextViewEx
android:id="@+id/category_edit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginRight="16dp"
android:layout_marginLeft="8dp"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:background="?attr/ctx_menu_info_view_bg"
android:orientation="horizontal">
<LinearLayout
android:layout_width="42dp"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/description_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:layout_marginTop="10dp"
android:scaleType="center"
android:src="@drawable/ic_action_note_dark"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_weight="1"
android:orientation="vertical">
<EditText
android:id="@+id/description_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:layout_marginLeft="8dp"
android:maxLines="8"
android:layout_gravity="center_vertical"
android:textColor="?android:textColorPrimary"
android:textColorHint="?android:textColorSecondary"
android:inputType="textMultiLine"/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
</FrameLayout>

View file

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:id="@+id/share_fragment_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="350dp"
android:layout_height="match_parent"
android:background="?attr/left_menu_view_bg">
<LinearLayout
android:id="@+id/main_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:clickable="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp">
<TextView
android:id="@+id/header_caption"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:layout_weight="1"
android:text="@string/share_menu_title"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal">
<ListView
android:id="@+id/list"
android:divider="@null"
android:dividerHeight="0dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
</ListView>
</LinearLayout>
</LinearLayout>
</FrameLayout>

View file

@ -71,7 +71,7 @@
android:background="?android:selectableItemBackground"
android:textColor="?attr/contextMenuButtonColor"
android:text="@string/update_existing"
android:visibility="visible"/>
android:visibility="gone"/>
</LinearLayout>

View file

@ -1,246 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/point_edit_layout"
android:layout_width="350dp"
android:layout_height="match_parent"
android:background="@android:color/transparent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="fill_parent"
android:layout_height="@dimen/dashboard_map_toolbar"
android:background="?attr/pstsTabBackground"
android:minHeight="@dimen/dashboard_map_toolbar"
android:theme="?attr/toolbar_theme"
app:contentInsetLeft="72dp"
app:contentInsetStart="72dp">
<ImageButton
android:id="@+id/delete_button"
android:layout_width="?attr/actionBarSize"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="@android:color/transparent"
android:src="@drawable/ic_action_delete_dark"/>
<Button
android:id="@+id/save_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="@android:color/transparent"
android:text="@string/shared_string_save"/>
</android.support.v7.widget.Toolbar>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/ctx_menu_info_view_bg"
android:fillViewport="true">
<LinearLayout
android:id="@+id/main_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/title_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_point_editor_view"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp">
<TextView
android:id="@+id/header_caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_gravity="center_vertical"
android:text="Point info"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal">
<LinearLayout
android:layout_width="42dp"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/name_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:scaleType="center"
android:src="@drawable/ic_action_building_number"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/name_caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:text="@string/favourites_edit_dialog_name"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"/>
<EditText
android:id="@+id/name_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginRight="16dp"
android:layout_marginLeft="8dp"
android:textColor="?android:textColorPrimary"
android:textColorHint="?android:textColorSecondary"
android:inputType="text"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal">
<LinearLayout
android:layout_width="42dp"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/category_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:scaleType="center"
android:src="@drawable/ic_action_building_number"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/category_caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:text="@string/favourites_edit_dialog_name"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"/>
<net.osmand.plus.widgets.AutoCompleteTextViewEx
android:id="@+id/category_edit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginRight="16dp"
android:layout_marginLeft="8dp"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:background="?attr/ctx_menu_info_view_bg"
android:orientation="horizontal">
<LinearLayout
android:layout_width="42dp"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/description_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:layout_marginTop="10dp"
android:scaleType="center"
android:src="@drawable/ic_action_note_dark"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_weight="1"
android:orientation="vertical">
<EditText
android:id="@+id/description_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:layout_marginLeft="8dp"
android:maxLines="8"
android:layout_gravity="center_vertical"
android:textColor="?android:textColorPrimary"
android:textColorHint="?android:textColorSecondary"
android:inputType="textMultiLine"/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
</FrameLayout>

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="?attr/expandable_list_item_background"
android:minHeight="@dimen/list_item_height"
android:orientation="horizontal"
android:paddingLeft="@dimen/list_content_padding">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/favorites_icon_right_margin"
android:layout_marginTop="@dimen/favorites_icon_top_margin"
android:focusable="false"
android:src="@drawable/ic_action_note_dark"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
tools:text="Message"/>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:id="@+id/share_fragment_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent">
<LinearLayout
android:id="@+id/main_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="?attr/bottom_menu_view_bg"
android:clickable="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp">
<TextView
android:id="@+id/header_caption"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:layout_weight="1"
android:text="@string/share_menu_title"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal">
<ListView
android:id="@+id/list"
android:divider="@null"
android:dividerHeight="0dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
</ListView>
</LinearLayout>
</LinearLayout>
</FrameLayout>

View file

@ -2163,9 +2163,9 @@
<string name="poi_caravans_no">Campingvogne: nej</string>
<string name="poi_impromptu_yes">Improviseret: ja</string>
<string name="poi_impromptu_no">Improviseret: nej</string>
<string name="poi_sanitary_dump_station_yes">Sanitære dump station: ja</string>
<string name="poi_sanitary_dump_station_no">Sanitære dump station: nej</string>
<string name="poi_sanitary_dump_station_customers">Sanitær dump station: kun for kunder</string>
<string name="poi_sanitary_dump_station_yes">Sanitær tømmestation: ja</string>
<string name="poi_sanitary_dump_station_no">Sanitær tømmestation: nej</string>
<string name="poi_sanitary_dump_station_customers">Sanitær tømmestation: kun for kunder</string>
<string name="poi_power_supply_yes">Strømforsyning: ja</string>
<string name="poi_power_supply_no">Strømforsyning: nej</string>
<string name="poi_power_supply_cee_17_blue">Strømforsyning (stik): CEE 17 blå</string>
@ -2183,7 +2183,7 @@
<string name="poi_social_facility_group_home">Socialfacilitet: bosted</string>
<string name="poi_social_facility_assisted_living">Socialfacilitet: plejehjem</string>
<string name="poi_social_facility_outreach">Socialfacilitet: opsøgende</string>
<string name="poi_social_facility_outreach">Socialfacilitet: privat humanitær organisation</string>
<string name="poi_social_facility_food_bank">Socialfacilitet: madcentral</string>
<string name="poi_social_facility_shelter">Socialfacilitet: herberg</string>
<string name="poi_social_facility_ambulatory_care">Socialfacilitet: ambulant behandling</string>
@ -2198,7 +2198,7 @@
<string name="poi_social_facility_for_juvenile">Socialmålgruppe: unge</string>
<string name="poi_social_facility_for_homeless">Socialmålgruppe: hjemløse</string>
<string name="poi_social_facility_for_migrant">Socialmålgruppe: indvandrere</string>
<string name="poi_social_facility_for_underprivileged">Socialmålgruppe: underprivilegerede</string>
<string name="poi_social_facility_for_underprivileged">Socialmålgruppe: dårligt stillede</string>
<string name="poi_social_facility_for_drug_addicted">Socialmålgruppe: stofmisbrugere</string>
<string name="poi_social_facility_for_unemployed">Socialmålgruppe: arbejdsløse</string>
<string name="poi_social_facility_for_diseased">Socialmålgruppe: syge</string>
@ -2247,7 +2247,7 @@
<string name="poi_step_count">Antal trin</string>
<string name="poi_step_condition_even">Trintilstand: jævn</string>
<string name="poi_step_condition_uneven">Trintilstand: ujævn</string>
<string name="poi_step_condition_rough">Trintilstand: ru</string>
<string name="poi_step_condition_rough">Trintilstand: dårlig</string>
<string name="poi_cairn">Varde</string>
@ -2260,7 +2260,7 @@
<string name="poi_tomb_rock_cut">Type: udhugget i sten</string>
<string name="poi_tomb_hypogeum">Type: hypogeum</string>
<string name="poi_tomb_vault">Type: hvælving</string>
<string name="poi_tomb_columbarium">Type: columbarium</string>
<string name="poi_tomb_columbarium">Type: klumbarium</string>
<string name="poi_tomb_mausoleum">Type: mausoleum</string>
<string name="poi_tomb_sarcophagus">Type: sarkofag</string>
<string name="poi_tomb_crypt">Type: krypt</string>

View file

@ -2186,4 +2186,11 @@
<string name="update_all">Opdater alle (%1$s MB)</string>
<string name="free_downloads_used_description">Indstil hvormange gratis filhentninger der er brugt</string>
<string name="free_downloads_used">Gratis filhentninger brugt</string>
<string name="share_clipboard">Udklipsholder</string>
<string name="share_geo">geo:</string>
<string name="share_qr_code">QR-kode</string>
<string name="simulate_initial_startup_descr">Nulstiller flag, der angiver første opstart, beholder andre indstillinger i deres oprindelige tilstand</string>
<string name="simulate_initial_startup">Simuler første opstart</string>
<string name="share_menu_location">Del placering</string>
<string name="shared_string_send">Send</string>
</resources>

View file

@ -2226,4 +2226,21 @@
<string name="poi_step_condition_uneven">Estado de los escalones: mala</string>
<string name="poi_step_condition_rough">Estado de los escalones: pésima</string>
<string name="poi_cairn">Cairn</string>
<string name="poi_memorial_fassade_decoration">Decoración de la fachada</string>
<string name="poi_defibrillator">Desfibrilador</string>
<string name="poi_defibrillator_yes">Con desfibrilador</string>
<string name="poi_tomb_war_grave">Tipo: guerra</string>
<string name="poi_tomb_tumulus">Tipo: túmulo</string>
<string name="poi_tomb_rock_cut">Tipo: excavación en la roca</string>
<string name="poi_tomb_hypogeum">Tipo: hipogeo</string>
<string name="poi_tomb_vault">Tipo: bóveda</string>
<string name="poi_tomb_columbarium">Tipo: columbario</string>
<string name="poi_tomb_mausoleum">Tipo: panteón</string>
<string name="poi_tomb_sarcophagus">Tipo: sarcófago</string>
<string name="poi_tomb_crypt">Tipo: cripta</string>
<string name="poi_tomb_pyramid">Tipo: pirámide</string>
</resources>

View file

@ -2109,4 +2109,9 @@
<string name="update_all">Actualizar todo (%1$s MB)</string>
<string name="free_downloads_used">Descargas gratis usadas</string>
<string name="free_downloads_used_description">Puedes configurar cuántas descargas gratis ha usado</string>
</resources>
<string name="simulate_initial_startup_descr">Restablece la bandera que indica el primer arranque y mantiene los demás ajustes en su estado original</string>
<string name="simulate_initial_startup">Simular arranque inicial</string>
<string name="share_geo">geo:</string>
<string name="share_menu_location">Compartir ubicación</string>
<string name="shared_string_send">Enviar</string>
</resources>

View file

@ -2230,4 +2230,21 @@
<string name="poi_step_condition_uneven">Estado de los escalones: mala</string>
<string name="poi_step_condition_rough">Estado de los escalones: pésima</string>
<string name="poi_cairn">Cairn</string>
<string name="poi_memorial_fassade_decoration">Decoración de la fachada</string>
<string name="poi_defibrillator">Desfibrilador</string>
<string name="poi_defibrillator_yes">Con desfibrilador</string>
<string name="poi_tomb_war_grave">Tipo: guerra</string>
<string name="poi_tomb_tumulus">Tipo: túmulo</string>
<string name="poi_tomb_rock_cut">Tipo: excavación en la roca</string>
<string name="poi_tomb_hypogeum">Tipo: hipogeo</string>
<string name="poi_tomb_vault">Tipo: bóveda</string>
<string name="poi_tomb_columbarium">Tipo: columbario</string>
<string name="poi_tomb_mausoleum">Tipo: panteón</string>
<string name="poi_tomb_sarcophagus">Tipo: sarcófago</string>
<string name="poi_tomb_crypt">Tipo: cripta</string>
<string name="poi_tomb_pyramid">Tipo: pirámide</string>
</resources>

View file

@ -58,10 +58,10 @@
<string name="index_name_europe">Europa</string>
<string name="index_name_france">Europa - Francia</string>
<string name="index_name_germany">Europa - Alemania</string>
<string name="index_name_russia">Europa/Asia - Rusia</string>
<string name="index_name_russia">Rusia</string>
<string name="index_name_africa">África</string>
<string name="index_name_asia">Asia</string>
<string name="index_name_oceania">Oceanía</string>
<string name="index_name_oceania">Australia y Oceanía</string>
<string name="index_name_other">Mapas del mundo y temáticos</string>
<string name="index_name_wiki">Wikipedia mundial</string>
<string name="index_name_voice">Mensajes de voz (grabado, funciones limitadas)</string>
@ -2245,4 +2245,9 @@
<string name="update_all">Actualizar todo (%1$s MB)</string>
<string name="free_downloads_used">Descargas gratis usadas</string>
<string name="free_downloads_used_description">Puedes configurar cuántas descargas gratis ha usado</string>
</resources>
<string name="simulate_initial_startup_descr">Restablece la bandera que indica el primer arranque y mantiene los demás ajustes en su estado original</string>
<string name="simulate_initial_startup">Simular arranque inicial</string>
<string name="share_geo">geo:</string>
<string name="share_menu_location">Compartir ubicación</string>
<string name="shared_string_send">Enviar</string>
</resources>

View file

@ -2209,4 +2209,9 @@ Afghanistan, Albanie, Algérie, Allemagne, Andorre, Angola, Anguilla, Antigua-et
<string name="update_all">Tout mettre à jour (%1$s MB)</string>
<string name="free_downloads_used">Téléchargements gratuits effectués</string>
<string name="free_downloads_used_description">Visualiser le nombre de téléchargements gratuits déjà effectués</string>
</resources>
<string name="share_common_send">Envoyer</string>
<string name="share_common_copy">Copier</string>
<string name="share_geo">geo :</string>
<string name="share_qr_code">QR-Code</string>
<string name="share_menu_title">Partager ce lieu</string>
</resources>

File diff suppressed because one or more lines are too long

View file

@ -913,7 +913,7 @@
<string name="poi_crossing_unmarked">Неразмеченный</string>
<string name="poi_population">Население</string>
<string name="poi_start_date">Дата начала постройки</string>
<string name="poi_start_date">Дата окончания постройки</string>
<string name="poi_wheelchair">Доступно для инвалидных кресел</string>
<string name="poi_wheelchair_no">Недоступно для инвалидных кресел</string>
<string name="poi_wheelchair_limited">Инвалидные кресла: ограничено</string>

View file

@ -212,7 +212,7 @@
<string name="index_name_russia">Евразия - Россия</string>
<string name="index_name_africa">Африка</string>
<string name="index_name_asia">Азия</string>
<string name="index_name_oceania">Океания</string>
<string name="index_name_oceania">Австралия и Океания</string>
<string name="index_name_other">Карты мира</string>
<string name="index_name_wiki">Всемирная Википедия</string>
<string name="index_name_voice">Голосовые данные (запись)</string>
@ -2148,4 +2148,7 @@
<string name="update_all">Обновить все (%1$s Мб)</string>
<string name="free_downloads_used">Использовано бесплатных загрузок</string>
<string name="free_downloads_used_description">Вы можете посмотреть сколько бесплатных загрузок вы использовали</string>
</resources>
<string name="share_clipboard">Буфер обмена</string>
<string name="share_qr_code">QR-код</string>
<string name="share_geo">гео:</string>
</resources>

View file

@ -332,7 +332,7 @@
<string name="index_name_europe">Europa</string>
<string name="index_name_france">Europa - Frankrike</string>
<string name="index_name_germany">Europa - Tyskland</string>
<string name="index_name_russia">Europa/Asien - Ryssland</string>
<string name="index_name_russia">Ryssland</string>
<string name="index_name_africa">Afrika</string>
<string name="index_name_asia">Asien</string>
<string name="index_name_oceania">Oceanien</string>
@ -2049,4 +2049,7 @@
<string name="free_downloads_used">Gratis nedladdningar hämtade</string>
<string name="free_downloads_used_description">Du kan ange hur många gratis nedladdningar som du har gjort</string>
<string name="downloading_number_of_files">Hämtar - %1$d fil(er)</string>
<string name="share_clipboard">Urklipp</string>
<string name="share_geo">geo:</string>
<string name="share_qr_code">QR-kod</string>
</resources>

View file

@ -2014,4 +2014,30 @@
<string name="poi_technical_monument">工藝不朽的遺迹</string>
<string name="poi_office_camping">露營服務處</string>
<string name="poi_model_aerodrome">模型機的機場</string>
<string name="poi_guide">導遊辦公室</string>
<string name="poi_quango">特殊法人</string>
<string name="poi_consulting">諮詢辦公室</string>
<string name="poi_cooperative">合作辦公室</string>
<string name="poi_office_forestry">林務辦公室</string>
<string name="poi_logistics">後勤辦公室</string>
<string name="poi_parish">教區辦公室</string>
<string name="poi_publisher">出版業辦公室</string>
<string name="poi_fuel_91ul">91UL 燃料</string>
<string name="poi_fuel_100ll">100LL 燃料</string>
<string name="poi_autogas">液化石油氣</string>
<string name="poi_jeta1">Jet A-1 燃料</string>
<string name="poi_fuel_adblue">AdBlue 燃料</string>
<string name="poi_fuel_wood">燃料:木材</string>
<string name="poi_fuel_charcoal">燃料:木炭</string>
<string name="poi_fuel_coal">燃料:煤</string>
<string name="poi_street_lamp">路燈</string>
<string name="poi_escape_lane">躲避道</string>
<string name="poi_crop_rice">作物:水稻</string>
<string name="poi_crop_grass">作物:牧草</string>
</resources>

View file

@ -2165,4 +2165,9 @@
<string name="update_all">全部更新 (%1$s MB)</string>
<string name="free_downloads_used">免費下載使用</string>
<string name="free_downloads_used_description">您可以設置,您有使用多少免費下載</string>
</resources>
<string name="simulate_initial_startup_descr">重置標誌指示第一次啟動,保持著其它設定在原來的狀態</string>
<string name="simulate_initial_startup">模擬初始啟動</string>
<string name="share_geo">地理:</string>
<string name="share_menu_location">分享位置</string>
<string name="shared_string_send">發送</string>
</resources>

View file

@ -14,6 +14,8 @@
<attr name="bg_map_context_menu" format="reference" />
<attr name="bg_point_editor_view" format="reference" />
<attr name="ctx_menu_info_view_bg" format="reference" />
<attr name="bottom_menu_view_bg" format="reference" />
<attr name="left_menu_view_bg" format="reference" />
<attr name="dashboard_divider" format="reference" />
<attr name="dashboard_button" format="reference" />

View file

@ -9,6 +9,11 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="simulate_initial_startup_descr">"Resets flag indicating first startup, keep other settings in the original state"</string>
<string name="simulate_initial_startup">Simulate initial startup</string>
<string name="share_geo">geo:</string>
<string name="share_menu_location">Share location</string>
<string name="shared_string_send">Send</string>
<string name="favorite_category_dublicate_message">Specified category name already exists. Please define other name.</string>
<string name="favorite_category_name">Category name</string>
<string name="favorite_category_add_new_title">Add new category</string>

View file

@ -67,6 +67,8 @@
<item name="bg_color">@color/bg_color_light</item>
<item name="bg_card">@drawable/bg_card_light</item>
<item name="bg_map_context_menu">@drawable/bg_map_context_menu_light</item>
<item name="bottom_menu_view_bg">@drawable/bg_bottom_menu_light</item>
<item name="left_menu_view_bg">@drawable/bg_left_menu_light</item>
<item name="bg_point_editor_view">@drawable/bg_point_editor_view_light</item>
<item name="dashboard_divider">@color/dashboard_divider_light</item>
<item name="divider_color">@color/divider_color</item>
@ -158,6 +160,8 @@
<item name="bg_color">@color/bg_color_dark</item>
<item name="bg_card">@drawable/bg_card_dark</item>
<item name="bg_map_context_menu">@drawable/bg_map_context_menu_dark</item>
<item name="bottom_menu_view_bg">@drawable/bg_bottom_menu_dark</item>
<item name="left_menu_view_bg">@drawable/bg_left_menu_dark</item>
<item name="bg_point_editor_view">@drawable/bg_point_editor_view_dark</item>
<item name="dashboard_divider">@color/dashboard_divider_dark</item>
<item name="divider_color">@color/dashboard_divider_dark</item>

View file

@ -56,8 +56,11 @@ import btools.routingapp.BRouterServiceConnection;
public class AppInitializer implements IProgress {
public static final boolean TIPS_AND_TRICKS = false;
private static final String FIRST_TIME_APP_RUN = "FIRST_TIME_APP_RUN"; //$NON-NLS-1$
public static final String NUMBER_OF_STARTS = "NUMBER_OF_STARTS"; //$NON-NLS-1$
public static final String FIRST_INSTALLED = "FIRST_INSTALLED"; //$NON-NLS-1$
private static final String VECTOR_INDEXES_CHECK = "VECTOR_INDEXES_CHECK"; //$NON-NLS-1$
private static final String VERSION_INSTALLED = "VERSION_INSTALLED"; //$NON-NLS-1$
private static final String EXCEPTION_FILE_SIZE = "EXCEPTION_FS"; //$NON-NLS-1$
public static final String LATEST_CHANGES_URL = "changes-2.1.html";
@ -76,6 +79,7 @@ public class AppInitializer implements IProgress {
private List<String> warnings = new ArrayList<String>();
private String taskName;
private List<AppInitializeListener> listeners = new ArrayList<AppInitializer.AppInitializeListener>();
private SharedPreferences startPrefs;
public enum InitEvents {
FAVORITES_INITIALIZED, NATIVE_INITIALIZED,
@ -110,22 +114,46 @@ public class AppInitializer implements IProgress {
if(initSettings) {
return;
}
OsmandSettings settings = getSettings(activity);
firstTime = settings.FIRST_TIME_APP_RUN.get();
if (firstTime) {
settings.FIRST_TIME_APP_RUN.set(false);
settings.VERSION_INSTALLED.set(Version.getFullVersion(app));
} else if (!Version.getFullVersion(app).equals(settings.VERSION_INSTALLED.get())) {
settings.VERSION_INSTALLED.set(Version.getFullVersion(app));
startPrefs = activity.getPreferences(Context.MODE_WORLD_WRITEABLE);
if(!startPrefs.contains(NUMBER_OF_STARTS)) {
startPrefs.edit().putInt(NUMBER_OF_STARTS, 1).commit();
} else {
startPrefs.edit().putInt(NUMBER_OF_STARTS, startPrefs.getInt(NUMBER_OF_STARTS, 0) + 1).commit();
}
if (!startPrefs.contains(FIRST_INSTALLED)) {
startPrefs.edit().putLong(FIRST_INSTALLED, System.currentTimeMillis()).commit();
}
if (!startPrefs.contains(FIRST_TIME_APP_RUN)) {
firstTime = true;
startPrefs.edit().putBoolean(FIRST_TIME_APP_RUN, true).commit();
startPrefs.edit().putString(VERSION_INSTALLED, Version.getFullVersion(app)).commit();
} else if (!Version.getFullVersion(app).equals(startPrefs.getString(VERSION_INSTALLED, ""))) {
startPrefs.edit().putString(VERSION_INSTALLED, Version.getFullVersion(app)).commit();
appVersionChanged = true;
}
settings.NUMBER_OF_APPLICATION_STARTS.set(settings.NUMBER_OF_APPLICATION_STARTS.get() + 1);
if (settings.FIRST_INSTALLED_DATE.get() == -1) {
settings.FIRST_INSTALLED_DATE.set(System.currentTimeMillis());
}
initSettings = true;
}
public int getNumberOfStarts() {
if(startPrefs == null) {
return 0;
}
return startPrefs.getInt(NUMBER_OF_STARTS, 1);
}
public long getFirstInstalled() {
if(startPrefs == null) {
return 0;
}
return startPrefs.getLong(FIRST_INSTALLED, 0);
}
public void resetFirstTimeRun() {
if(startPrefs != null) {
startPrefs.edit().remove(FIRST_TIME_APP_RUN).commit();
}
}
public boolean isFirstTime(Activity activity) {
initUiVars(activity);
return firstTime;
@ -134,17 +162,7 @@ public class AppInitializer implements IProgress {
public void setFirstTime(boolean firstTime) {
this.firstTime = firstTime;
}
public void writeFirstTime(boolean firstTime, Activity activity) {
setFirstTime(firstTime);
OsmandSettings settings = getSettings(activity);
settings.FIRST_TIME_APP_RUN.set(firstTime);
}
private OsmandSettings getSettings(Activity activity) {
return ((OsmandApplication) activity.getApplication()).getSettings();
}
public boolean checkAppVersionChanged(Activity activity) {
initUiVars(activity);
boolean showRecentChangesDialog = !firstTime && appVersionChanged;
@ -157,8 +175,20 @@ public class AppInitializer implements IProgress {
activityChangesShowed = true;
return true;
}
checkMapUpdates();
return false;
}
private void checkMapUpdates() {
long diff = System.currentTimeMillis() - app.getSettings().LAST_CHECKED_UPDATES.get();
if(diff >= 2 * 24 * 60 * 60l && new Random().nextInt(5) == 0 &&
app.getSettings().isInternetConnectionAvailable()) {
app.getDownloadThread().runReloadIndexFiles();
} else if(Version.isDeveloperVersion(app)) {
// app.getDownloadThread().runReloadIndexFiles();
}
}
public boolean checkPreviousRunsForExceptions(Activity activity, boolean writeFileSize) {
initUiVars(activity);
@ -422,6 +452,9 @@ public class AppInitializer implements IProgress {
}
private void restoreBackupForFavoritesFiles() {
final File appDir = app.getAppPath(null);
File save = new File(appDir, FavouritesDbHelper.FILE_TO_SAVE);
@ -622,4 +655,7 @@ public class AppInitializer implements IProgress {
public void removeListener(AppInitializeListener listener) {
this.listeners.remove(listener);
}
}

View file

@ -173,6 +173,7 @@ public class ContextMenuAdapter {
i.name = name;
return i;
}
public Item item(int resId) {
Item i = new Item();
@ -206,6 +207,7 @@ public class ContextMenuAdapter {
this.lightIcon = icon;
return this;
}
public Item position(int pos) {
this.pos = pos;
@ -257,6 +259,12 @@ public class ContextMenuAdapter {
cat = b;
return this;
}
public Item name(String name) {
this.name = name;
return this;
}
}
public String[] getItemNames() {

View file

@ -23,6 +23,7 @@ import net.osmand.plus.activities.SettingsActivity;
import net.osmand.plus.api.SQLiteAPI;
import net.osmand.plus.api.SQLiteAPIImpl;
import net.osmand.plus.dashboard.DashRateUsFragment;
import net.osmand.plus.download.DownloadIndexesThread;
import net.osmand.plus.helpers.AvoidSpecificRoads;
import net.osmand.plus.helpers.WaypointHelper;
import net.osmand.plus.monitoring.LiveMonitoringHelper;
@ -93,6 +94,7 @@ public class OsmandApplication extends Application {
LiveMonitoringHelper liveMonitoringHelper;
TargetPointsHelper targetPointsHelper;
WaypointHelper waypointHelper;
DownloadIndexesThread downloadIndexesThread;
AvoidSpecificRoads avoidSpecificRoads;
BRouterServiceConnection bRouterServiceConnection;
OsmandRegions regions;
@ -250,6 +252,13 @@ public class OsmandApplication extends Application {
public DayNightHelper getDaynightHelper() {
return daynightHelper;
}
public synchronized DownloadIndexesThread getDownloadThread() {
if(downloadIndexesThread == null) {
downloadIndexesThread = new DownloadIndexesThread(this);
}
return downloadIndexesThread;
}
@Override
public void onLowMemory() {

View file

@ -1874,8 +1874,6 @@ public class OsmandSettings {
public final CommonPreference<Boolean> SHOW_RULER =
new BooleanPreference("show_ruler", true).makeProfile().cache();
public final OsmandPreference<Long> FIRST_INSTALLED_DATE = new LongPreference("first_installed_date", -1).makeGlobal();
// public final OsmandPreference<Integer> NUMBER_OF_FREE_DOWNLOADS_V2 = new IntPreference("free_downloads_v2", 0).makeGlobal();
public final OsmandPreference<Integer> NUMBER_OF_FREE_DOWNLOADS = new IntPreference("free_downloads_v3", 0).makeGlobal();
@ -1883,17 +1881,17 @@ public class OsmandSettings {
// For DashRateUsFragment
public final OsmandPreference<Long> LAST_DISPLAY_TIME =
new LongPreference("last_display_time", 0).makeGlobal().cache();
public final OsmandPreference<Long> LAST_CHECKED_UPDATES =
new LongPreference("last_checked_updates", 0).makeGlobal();
public final OsmandPreference<Integer> NUMBER_OF_APPLICATION_STARTS =
new IntPreference("number_of_application_starts", 0).makeGlobal().cache();
new IntPreference("number_of_app_starts", 0).makeGlobal().cache();
public final OsmandPreference<DashRateUsFragment.RateUsState> RATE_US_STATE =
new EnumIntPreference<>("rate_us_state",
DashRateUsFragment.RateUsState.INITIAL_STATE, DashRateUsFragment.RateUsState.values())
.makeGlobal()
.cache();
public final OsmandPreference<Boolean> FIRST_TIME_APP_RUN =
new BooleanPreference("first_time_app_run", true).makeGlobal().cache();
public final OsmandPreference<String> VERSION_INSTALLED =
new StringPreference("version_installed", null).makeGlobal().cache();
.makeGlobal();
public enum DayNightMode {

View file

@ -31,7 +31,6 @@ import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import net.osmand.Location;
import net.osmand.StateChangedListener;
import net.osmand.access.AccessibilityPlugin;
@ -89,6 +88,7 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -240,7 +240,6 @@ public class MapActivity extends AccessibleActivity {
}
private void checkAppInitialization() {
if (app.isApplicationInitializing()) {
findViewById(R.id.init_progress).setVisibility(View.VISIBLE);

View file

@ -1,11 +1,25 @@
package net.osmand.plus.activities;
import java.io.File;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import net.londatiga.android.ActionItem;
import net.londatiga.android.QuickAction;
import net.osmand.IndexConstants;
@ -31,10 +45,10 @@ import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.activities.actions.OsmAndDialogs;
import net.osmand.plus.activities.actions.ShareLocation;
import net.osmand.plus.activities.search.SearchActivity;
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.dialogs.FavoriteDialogs;
import net.osmand.plus.download.IndexItem;
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.BaseMapLayer;
@ -44,26 +58,11 @@ import net.osmand.util.MapUtils;
import org.apache.commons.logging.Log;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.io.File;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class MapActivityActions implements DialogProvider {
private static final Log LOG = PlatformUtil.getLog(MapActivityActions.class);
@ -92,11 +91,6 @@ public class MapActivityActions implements DialogProvider {
routingHelper = mapActivity.getMyApplication().getRoutingHelper();
}
public void shareLocation(double latitude, double longitude) {
enhance(dialogBundle, latitude, longitude, mapActivity.getMapView().getZoom());
new ShareLocation(mapActivity).run();
}
public void showNavigationContextMenuPoint(final double latitude, final double longitude) {
final ContextMenuAdapter adapter = new ContextMenuAdapter(mapActivity);
@ -704,8 +698,14 @@ public class MapActivityActions implements DialogProvider {
return false;
}
}).reg();
optionsMenuHelper.item(R.string.index_settings).iconColor(R.drawable.ic_type_archive)
String d = getString(R.string.index_settings);
if(app.getDownloadThread().getIndexes().isDownloadedFromInternet) {
List<IndexItem> updt = app.getDownloadThread().getIndexes().getItemsToUpdate();
if(updt != null && updt.size() > 0) {
d += " ("+updt.size()+")";
}
}
optionsMenuHelper.item(R.string.index_settings).name(d).iconColor(R.drawable.ic_type_archive)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {

View file

@ -1,104 +0,0 @@
package net.osmand.plus.activities.actions;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.MapActivityActions;
import net.osmand.util.MapUtils;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.Toast;
public class ShareLocation extends OsmAndAction {
public ShareLocation(MapActivity mapActivity) {
super(mapActivity);
}
@Override
public int getDialogID() {
return OsmAndDialogs.DIALOG_SHARE_LOCATION;
}
@Override
public void run() {
super.showDialog();
}
public Dialog createDialog(Activity activity, final Bundle args) {
mapActivity = (MapActivity) activity;
AlertDialog.Builder builder = new Builder(mapActivity);
builder.setTitle(R.string.send_location_way_choose_title);
// "Email", "SMS",
builder.setItems(new String[]{
activity.getString(R.string.shared_string_message), "Clipboard", "geo:", "QR-Code"
}, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final double latitude = args.getDouble(MapActivityActions.KEY_LATITUDE);
final double longitude = args.getDouble(MapActivityActions.KEY_LONGITUDE);
final int zoom = args.getInt(MapActivityActions.KEY_ZOOM);
try {
final String geoUrl = MapUtils.buildGeoUrl(latitude, longitude, zoom);
// TODO change this to HTTPS once it is setup!
final String httpUrl = "http://osmand.net/go?lat=" + ((float) latitude) + "&lon=" + ((float) longitude) + "&z=" + zoom;
String sms = mapActivity.getString(R.string.send_location_sms_pattern, geoUrl, httpUrl);
if (which == 0) {
sendMessage(sms);
// } else if (which == 1) {
// sendEmail(httpUrl, geoUrl);
// } else if (which == 2) {
// sendSms(sms);
} else if (which == 1) {
sendToClipboard(sms);
} else if (which == 2) {
sendGeoActivity(geoUrl);
} else if (which == 3) {
sendQRCode(latitude, longitude);
}
} catch (RuntimeException e) {
Toast.makeText(mapActivity, R.string.shared_string_io_error, Toast.LENGTH_SHORT).show();
}
}
});
return builder.create();
}
private void sendMessage(String sms) {
ShareDialog.sendMessage(mapActivity, sms);
}
private void sendEmail(final String httpUrl, final String geoUrl) {
String email = mapActivity.getString(R.string.send_location_email_pattern, httpUrl, geoUrl);
ShareDialog.sendEmail(mapActivity, email, getString(R.string.send_location));
}
private void sendSms(String sms) {
ShareDialog.sendSms(mapActivity, sms);
}
private void sendToClipboard(String sms) {
ShareDialog.sendToClipboard(mapActivity, sms);
}
private void sendGeoActivity(final String geoUrl) {
Intent mapIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(geoUrl));
mapActivity.startActivity(mapIntent);
}
private void sendQRCode(final double latitude, final double longitude) {
Bundle bundle = new Bundle();
bundle.putFloat("LAT", (float) latitude);
bundle.putFloat("LONG", (float) longitude);
ShareDialog.sendQRCode(mapActivity, "LOCATION_TYPE", bundle, null);
}
}

View file

@ -2,8 +2,8 @@ package net.osmand.plus.base;
import net.osmand.IProgress;
import net.osmand.plus.OsmAndConstants;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Handler;
import android.os.Message;
@ -14,13 +14,13 @@ public abstract class BasicProgressAsyncTask<Tag, Params, Progress, Result> exte
protected int deltaProgress;
protected int work;
protected String message = ""; //$NON-NLS-1$
protected Context ctx;
protected OsmandApplication ctx;
protected boolean interrupted = false;
protected Tag tag;
private Handler uiHandler;
public BasicProgressAsyncTask(Context ctx) {
this.ctx = ctx;
public BasicProgressAsyncTask(OsmandApplication app) {
this.ctx = app;
this.work = -1;
}

View file

@ -10,6 +10,7 @@ import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmAndLocationSimulation;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.Version;
import net.osmand.plus.activities.SettingsBaseActivity;
import net.osmand.plus.activities.actions.AppModeDialog;
import net.osmand.util.SunriseSunset;
@ -58,8 +59,24 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
cat.addPreference(openGlRender);
cat.addPreference(createCheckBoxPreference(settings.BETA_TESTING_LIVE_UPDATES,
final Preference firstRunPreference = new Preference(this);
firstRunPreference.setTitle(R.string.simulate_initial_startup);
firstRunPreference.setSummary(R.string.simulate_initial_startup_descr);
firstRunPreference.setSelectable(true);
firstRunPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
getMyApplication().getAppInitializer().resetFirstTimeRun();
getMyApplication().showToastMessage(R.string.shared_string_ok);
return true;
}
});
cat.addPreference(firstRunPreference);
if(Version.isDeveloperVersion(getMyApplication())) {
cat.addPreference(createCheckBoxPreference(settings.BETA_TESTING_LIVE_UPDATES,
"Live updates", "Beta testing for live updates"));
}
Preference pref = new Preference(this);
final Preference simulate = pref;
final OsmAndLocationSimulation sim = getMyApplication().getLocationProvider().getLocationSimulation();
@ -182,21 +199,6 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
cat.addPreference(createCheckBoxPreference(settings.SHOULD_SHOW_FREE_VERSION_BANNER,
R.string.show_free_version_banner,
R.string.show_free_version_banner_description));
final Preference firstRunPreference = new Preference(this);
firstRunPreference.setTitle("Reset first run");
firstRunPreference.setSummary("After reset app wold act like it is it's firs run");
firstRunPreference.setSelectable(true);
firstRunPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
final SettingsDevelopmentActivity activity = SettingsDevelopmentActivity.this;
activity.getMyApplication().getAppInitializer()
.writeFirstTime(true, activity);
firstRunPreference.setSummary("First run flag has been reset");
return true;
}
});
cat.addPreference(firstRunPreference);
}
protected void availableProfileDialog() {

View file

@ -4,8 +4,10 @@ import java.io.File;
import java.lang.ref.WeakReference;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import net.osmand.IProgress;
import net.osmand.access.AccessibleToast;
@ -13,6 +15,7 @@ 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.ActionBarProgressActivity;
import net.osmand.plus.activities.LocalIndexInfo;
import net.osmand.plus.activities.TabActivity;
import net.osmand.plus.base.BasicProgressAsyncTask;
@ -23,6 +26,7 @@ import net.osmand.plus.download.ui.DownloadResourceGroupFragment;
import net.osmand.plus.download.ui.LocalIndexesFragment;
import net.osmand.plus.download.ui.UpdatesIndexFragment;
import net.osmand.plus.views.controls.PagerSlidingTabStrip;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
@ -41,7 +45,7 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
public class DownloadActivity extends BaseDownloadActivity {
public class DownloadActivity extends ActionBarProgressActivity implements DownloadEvents {
public static final int UPDATES_TAB_NUMBER = 2;
public static final int LOCAL_TAB_NUMBER = 1;
public static final int DOWNLOAD_TAB_NUMBER = 0;
@ -62,11 +66,16 @@ public class DownloadActivity extends BaseDownloadActivity {
private ViewPager viewPager;
private String filter;
private String filterCat;
protected Set<WeakReference<Fragment>> fragSet = new HashSet<>();
private DownloadIndexesThread downloadThread;
private DownloadValidationManager downloadValidationManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
getMyApplication().applyTheme(this);
super.onCreate(savedInstanceState);
downloadValidationManager = new DownloadValidationManager(getMyApplication());
downloadThread = getMyApplication().getDownloadThread();
DownloadResources indexes = getDownloadThread().getIndexes();
if (!indexes.isDownloadedFromInternet) {
getDownloadThread().runReloadIndexFiles();
@ -128,11 +137,29 @@ public class DownloadActivity extends BaseDownloadActivity {
}
new DataStoragePlaceDialogFragment().show(getFragmentManager(), null);
}
public DownloadIndexesThread getDownloadThread() {
return downloadThread;
}
public void startDownload(IndexItem... indexItem) {
downloadValidationManager.startDownload(this, indexItem);
}
public void makeSureUserCancelDownload(IndexItem item) {
downloadValidationManager.makeSureUserCancelDownload(this, item);
}
@Override
public void onAttachFragment(Fragment fragment) {
fragSet.add(new WeakReference<Fragment>(fragment));
}
@Override
protected void onResume() {
super.onResume();
getMyApplication().getAppCustomization().resumeActivity(DownloadActivity.class, this);
downloadThread.setUiActivity(this);
downloadInProgress();
}
@ -156,11 +183,16 @@ public class DownloadActivity extends BaseDownloadActivity {
public List<LocalIndexInfo> getLocalIndexInfos() {
return localIndexInfos;
}
public OsmandApplication getMyApplication() {
return (OsmandApplication) getApplication();
}
@Override
public void onPause() {
super.onPause();
getMyApplication().getAppCustomization().pauseActivity(DownloadActivity.class);
downloadThread.setUiActivity(null);
}
@Override
@ -246,7 +278,7 @@ public class DownloadActivity extends BaseDownloadActivity {
public static boolean isDownlodingPermitted(OsmandSettings settings) {
final Integer mapsDownloaded = settings.NUMBER_OF_FREE_DOWNLOADS.get();
int downloadsLeft = BaseDownloadActivity.MAXIMUM_AVAILABLE_FREE_DOWNLOADS - mapsDownloaded;
int downloadsLeft = DownloadValidationManager.MAXIMUM_AVAILABLE_FREE_DOWNLOADS - mapsDownloaded;
return Math.max(downloadsLeft, 0) > 0;
}
@ -346,15 +378,15 @@ public class DownloadActivity extends BaseDownloadActivity {
return;
}
freeVersionBanner.setVisibility(View.VISIBLE);
downloadsLeftProgressBar.setMax(BaseDownloadActivity.MAXIMUM_AVAILABLE_FREE_DOWNLOADS);
downloadsLeftProgressBar.setMax(DownloadValidationManager.MAXIMUM_AVAILABLE_FREE_DOWNLOADS);
freeVersionDescriptionTextView.setText(ctx.getString(R.string.free_version_message,
BaseDownloadActivity.MAXIMUM_AVAILABLE_FREE_DOWNLOADS));
DownloadValidationManager.MAXIMUM_AVAILABLE_FREE_DOWNLOADS));
freeVersionBanner.findViewById(R.id.getFullVersionButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
BaseDownloadActivity context = (BaseDownloadActivity) v.getContext();
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Version.marketPrefix(context
.getMyApplication()) + "net.osmand.plus"));
Activity context = (Activity) v.getContext();
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Version.marketPrefix((OsmandApplication) context
.getApplication()) + "net.osmand.plus"));
try {
context.startActivity(intent);
} catch (ActivityNotFoundException e) {
@ -374,7 +406,7 @@ public class DownloadActivity extends BaseDownloadActivity {
OsmandSettings settings = application.getSettings();
final Integer mapsDownloaded = settings.NUMBER_OF_FREE_DOWNLOADS.get();
downloadsLeftProgressBar.setProgress(mapsDownloaded);
int downloadsLeft = BaseDownloadActivity.MAXIMUM_AVAILABLE_FREE_DOWNLOADS - mapsDownloaded;
int downloadsLeft = DownloadValidationManager.MAXIMUM_AVAILABLE_FREE_DOWNLOADS - mapsDownloaded;
downloadsLeft = Math.max(downloadsLeft, 0);
if (downloadsLeft <= 0) {
laterButton.setVisibility(View.GONE);
@ -477,4 +509,8 @@ public class DownloadActivity extends BaseDownloadActivity {
messageTextView.setText(R.string.device_memory);
}
}

View file

@ -25,6 +25,7 @@ import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Notification;
import android.app.NotificationManager;
@ -48,10 +49,9 @@ import android.widget.Toast;
public class DownloadIndexesThread {
private final static Log LOG = PlatformUtil.getLog(DownloadIndexesThread.class);
private static final int NOTIFICATION_ID = 45;
private final Context ctx;
private OsmandApplication app;
private BaseDownloadActivity uiActivity = null;
private DownloadEvents uiActivity = null;
private DatabaseHelper dbHelper;
private DownloadFileHelper downloadFileHelper;
private List<BasicProgressAsyncTask<?, ?, ?, ?>> currentRunningTask = Collections.synchronizedList(new ArrayList<BasicProgressAsyncTask<?, ?, ?, ?>>());
@ -72,9 +72,8 @@ public class DownloadIndexesThread {
}
public DownloadIndexesThread(Context ctx) {
this.ctx = ctx;
app = (OsmandApplication) ctx.getApplicationContext();
public DownloadIndexesThread(OsmandApplication app) {
this.app = app;
indexes = new DownloadResources(app);
updateLoadedFiles();
downloadFileHelper = new DownloadFileHelper(app);
@ -86,7 +85,7 @@ public class DownloadIndexesThread {
}
/// UI notifications methods
public void setUiActivity(BaseDownloadActivity uiActivity) {
public void setUiActivity(DownloadEvents uiActivity) {
this.uiActivity = uiActivity;
}
@ -200,7 +199,7 @@ public class DownloadIndexesThread {
if (checkRunning()) {
return;
}
execute(new ReloadIndexesTask(ctx));
execute(new ReloadIndexesTask());
}
public void runDownloadFiles(IndexItem... items) {
@ -213,7 +212,7 @@ public class DownloadIndexesThread {
indexItemDownloading.add(i);
}
if (currentDownloadingItem == null) {
execute(new DownloadIndexesAsyncTask(ctx));
execute(new DownloadIndexesAsyncTask());
}
}
@ -282,8 +281,8 @@ public class DownloadIndexesThread {
private class ReloadIndexesTask extends BasicProgressAsyncTask<Void, Void, Void, DownloadResources> {
public ReloadIndexesTask(Context ctx) {
super(ctx);
public ReloadIndexesTask() {
super(app);
}
@Override
@ -304,6 +303,7 @@ public class DownloadIndexesThread {
}
result.isDownloadedFromInternet = indexFileList.isDownloadedFromInternet();
result.mapVersionIsIncreased = indexFileList.isIncreasedMapVersion();
app.getSettings().LAST_CHECKED_UPDATES.set(System.currentTimeMillis());
result.prepareData(indexFileList.getIndexFiles());
} catch (Exception e) {
}
@ -357,8 +357,8 @@ public class DownloadIndexesThread {
private OsmandPreference<Integer> downloads;
public DownloadIndexesAsyncTask(Context ctx) {
super(ctx);
public DownloadIndexesAsyncTask() {
super(app);
downloads = app.getSettings().NUMBER_OF_FREE_DOWNLOADS;
}
@ -389,8 +389,8 @@ public class DownloadIndexesThread {
// ctx.getString(R.string.shared_string_io_error) +": Interrupted";
if (!message.toLowerCase().contains("interrupted")) {
if (uiActivity == null ||
!message.equals(uiActivity.getString(R.string.shared_string_download_successful))) {
AccessibleToast.makeText(ctx, message, Toast.LENGTH_LONG).show();
!message.equals(app.getString(R.string.shared_string_download_successful))) {
app.showToastMessage(message);
}
}
}
@ -403,14 +403,14 @@ public class DownloadIndexesThread {
protected void onPreExecute() {
currentRunningTask.add(this);
super.onPreExecute();
if (uiActivity != null) {
downloadFileHelper.setInterruptDownloading(false);
View mainView = uiActivity.findViewById(R.id.MainLayout);
downloadFileHelper.setInterruptDownloading(false);
if (uiActivity instanceof Activity) {
View mainView = ((Activity) uiActivity).findViewById(R.id.MainLayout);
if (mainView != null) {
mainView.setKeepScreenOn(true);
}
startTask(ctx.getString(R.string.shared_string_downloading) + ctx.getString(R.string.shared_string_ellipsis), -1);
}
startTask(ctx.getString(R.string.shared_string_downloading) + ctx.getString(R.string.shared_string_ellipsis), -1);
}
@Override
@ -418,8 +418,8 @@ public class DownloadIndexesThread {
if (result != null && result.length() > 0) {
AccessibleToast.makeText(ctx, result, Toast.LENGTH_LONG).show();
}
if (uiActivity != null) {
View mainView = uiActivity.findViewById(R.id.MainLayout);
if (uiActivity instanceof Activity) {
View mainView = ((Activity) uiActivity).findViewById(R.id.MainLayout);
if (mainView != null) {
mainView.setKeepScreenOn(false);
}
@ -508,10 +508,10 @@ public class DownloadIndexesThread {
private boolean validateNotExceedsFreeLimit(IndexItem item) {
boolean exceed = Version.isFreeVersion(app) &&
DownloadActivityType.isCountedInDownloads(item) && downloads.get() >= DownloadActivity.MAXIMUM_AVAILABLE_FREE_DOWNLOADS;
DownloadActivityType.isCountedInDownloads(item) && downloads.get() >= DownloadValidationManager.MAXIMUM_AVAILABLE_FREE_DOWNLOADS;
if(exceed) {
String breakDownloadMessage = app.getString(R.string.free_version_message,
DownloadActivity.MAXIMUM_AVAILABLE_FREE_DOWNLOADS + "");
DownloadValidationManager.MAXIMUM_AVAILABLE_FREE_DOWNLOADS + "");
publishProgress(breakDownloadMessage);
}
return !exceed;

View file

@ -110,17 +110,17 @@ public class DownloadOsmandIndexesHelper {
}
public static IndexFileList getIndexesList(Context ctx) {
PackageManager pm = ctx.getPackageManager();
AssetManager amanager = ctx.getAssets();
IndexFileList result = downloadIndexesListFromInternet((OsmandApplication) ctx.getApplicationContext());
public static IndexFileList getIndexesList(OsmandApplication app) {
PackageManager pm = app.getPackageManager();
AssetManager amanager = app.getAssets();
IndexFileList result = downloadIndexesListFromInternet(app);
if (result == null) {
result = new IndexFileList();
} else {
result.setDownloadedFromInternet(true);
}
// add all tts files from assets
listVoiceAssets(result, amanager, pm, ((OsmandApplication) ctx.getApplicationContext()).getSettings());
listVoiceAssets(result, amanager, pm, app.getSettings());
return result;
}
@ -183,11 +183,12 @@ public class DownloadOsmandIndexesHelper {
try {
String strUrl = ctx.getAppCustomization().getIndexesUrl();
OsmandSettings settings = ctx.getSettings();
Long nd = settings.FIRST_INSTALLED_DATE.get();
long nd = ctx.getAppInitializer().getFirstInstalled();
if(nd > 0) {
strUrl += "&nd=" + ((System.currentTimeMillis() - nd) / (1000l * 24l * 60l * 60l));
}
strUrl += "&ns=" + settings.NUMBER_OF_APPLICATION_STARTS.get();
strUrl += "&ns=" + ctx.getAppInitializer().getNumberOfStarts();
try {
strUrl += "&aid=" + Secure.getString(ctx.getContentResolver(), Secure.ANDROID_ID);
} catch (Exception e) {

View file

@ -12,9 +12,11 @@ import net.osmand.plus.R;
import net.osmand.plus.Version;
import net.osmand.plus.activities.ActionBarProgressActivity;
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
@ -23,66 +25,38 @@ import android.support.annotation.NonNull;
import android.support.annotation.UiThread;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.widget.Toast;
public class BaseDownloadActivity extends ActionBarProgressActivity implements DownloadEvents {
protected OsmandSettings settings;
private static DownloadIndexesThread downloadListIndexThread;
protected Set<WeakReference<Fragment>> fragSet = new HashSet<>();
public class DownloadValidationManager {
public static final int MAXIMUM_AVAILABLE_FREE_DOWNLOADS = 5;
protected OsmandSettings settings;
private OsmandApplication app;
private DownloadIndexesThread downloadThread;
@Override
protected void onCreate(Bundle savedInstanceState) {
settings = ((OsmandApplication) getApplication()).getSettings();
if (downloadListIndexThread == null) {
downloadListIndexThread = new DownloadIndexesThread(this);
}
super.onCreate(savedInstanceState);
}
@Override
protected void onResume() {
super.onResume();
downloadListIndexThread.setUiActivity(this);
}
@Override
protected void onPause() {
super.onPause();
downloadListIndexThread.setUiActivity(null);
public DownloadValidationManager(OsmandApplication app) {
this.app = app;
settings = app.getSettings();
downloadThread = app.getDownloadThread();
}
public DownloadIndexesThread getDownloadThread() {
return downloadListIndexThread;
return downloadThread;
}
public void startDownload(IndexItem... items) {
downloadFilesWithAllChecks(items);
public void startDownload(FragmentActivity activity, IndexItem... items) {
downloadFilesWithAllChecks(activity, items);
}
@UiThread
public void downloadInProgress() {
}
@UiThread
public void downloadHasFinished() {
}
@UiThread
public void newDownloadIndexes() {
}
public OsmandApplication getMyApplication() {
return (OsmandApplication) getApplication();
return app;
}
public void downloadFilesCheck_3_ValidateSpace(final IndexItem... items) {
public void downloadFilesCheck_3_ValidateSpace(final FragmentActivity activity, final IndexItem... items) {
long szLong = 0;
int i = 0;
for (IndexItem es : downloadListIndexThread.getCurrentDownloadingItems()) {
for (IndexItem es : downloadThread.getCurrentDownloadingItems()) {
szLong += es.contentSize;
i++;
}
@ -92,77 +66,76 @@ public class BaseDownloadActivity extends ActionBarProgressActivity implements D
}
double sz = ((double) szLong) / (1 << 20);
// get availabile space
double asz = downloadListIndexThread.getAvailableSpace();
double asz = downloadThread.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), i, sz, asz));
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setMessage(MessageFormat.format(activity.getString(R.string.download_files_question_space), i, sz, asz));
builder.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
downloadFileCheck_Final_Run(items);
downloadFileCheck_Final_Run(activity, items);
}
});
builder.setNegativeButton(R.string.shared_string_no, null);
builder.show();
} else {
downloadFileCheck_Final_Run(items);
downloadFileCheck_Final_Run(activity, items);
}
}
private void downloadFileCheck_Final_Run(IndexItem[] items) {
downloadListIndexThread.runDownloadFiles(items);
downloadInProgress();
private void downloadFileCheck_Final_Run(FragmentActivity activity, IndexItem[] items) {
downloadThread.runDownloadFiles(items);
if(activity instanceof DownloadEvents) {
((DownloadEvents) activity).downloadInProgress();
}
}
protected void downloadFilesWithAllChecks(IndexItem[] items) {
downloadFilesCheck_1_FreeVersion(items);
protected void downloadFilesWithAllChecks(FragmentActivity activity, IndexItem[] items) {
downloadFilesCheck_1_FreeVersion(activity, items);
}
protected void downloadFilesCheck_1_FreeVersion(IndexItem[] items) {
protected void downloadFilesCheck_1_FreeVersion(FragmentActivity activity, IndexItem[] items) {
if (Version.isFreeVersion(getMyApplication())) {
int total = settings.NUMBER_OF_FREE_DOWNLOADS.get();
if (total > MAXIMUM_AVAILABLE_FREE_DOWNLOADS) {
new InstallPaidVersionDialogFragment()
.show(getSupportFragmentManager(), InstallPaidVersionDialogFragment.TAG);
.show(activity.getSupportFragmentManager(), InstallPaidVersionDialogFragment.TAG);
} else {
downloadFilesCheck_2_Internet(items);
downloadFilesCheck_2_Internet(activity, items);
}
} else {
downloadFilesCheck_2_Internet(items);
downloadFilesCheck_2_Internet(activity, items);
}
}
protected void downloadFilesCheck_2_Internet(final IndexItem[] items) {
protected void downloadFilesCheck_2_Internet(final FragmentActivity activity, final IndexItem[] items) {
if (!getMyApplication().getSettings().isWifiConnected()) {
if (getMyApplication().getSettings().isInternetConnectionAvailable()) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(getString(R.string.download_using_mobile_internet));
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setMessage(activity.getString(R.string.download_using_mobile_internet));
builder.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
downloadFilesCheck_3_ValidateSpace(items);
downloadFilesCheck_3_ValidateSpace(activity, items);
}
});
builder.setNegativeButton(R.string.shared_string_no, null);
builder.show();
} else {
AccessibleToast.makeText(this, R.string.no_index_file_to_download, Toast.LENGTH_LONG).show();
AccessibleToast.makeText(activity, R.string.no_index_file_to_download, Toast.LENGTH_LONG).show();
}
} else {
downloadFilesCheck_3_ValidateSpace(items);
downloadFilesCheck_3_ValidateSpace(activity, items);
}
}
@Override
public void onAttachFragment(Fragment fragment) {
fragSet.add(new WeakReference<Fragment>(fragment));
}
public void makeSureUserCancelDownload(final IndexItem item) {
AlertDialog.Builder bld = new AlertDialog.Builder(this);
bld.setTitle(getString(R.string.shared_string_cancel));
public void makeSureUserCancelDownload(Context ctx, final IndexItem item) {
AlertDialog.Builder bld = new AlertDialog.Builder(ctx);
bld.setTitle(ctx.getString(R.string.shared_string_cancel));
bld.setMessage(R.string.confirm_interrupt_download);
bld.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
@Override

View file

@ -23,6 +23,7 @@ import net.osmand.plus.mapcontextmenu.details.FavouritePointMenuController;
import net.osmand.plus.mapcontextmenu.details.HistoryMenuController;
import net.osmand.plus.mapcontextmenu.details.MenuController;
import net.osmand.plus.mapcontextmenu.details.PointDescriptionMenuController;
import net.osmand.plus.mapcontextmenu.other.ShareMenu;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.ContextMenuLayer;
import net.osmand.plus.views.OsmandMapLayer;
@ -397,7 +398,7 @@ public class MapContextMenu {
}
public void buttonSharePressed() {
mapActivity.getMapActions().shareLocation(latLon.getLatitude(), latLon.getLongitude());
ShareMenu.show(latLon, nameStr, mapActivity);
}
public void buttonMorePressed() {

View file

@ -27,7 +27,6 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import net.osmand.PlatformUtil;
import net.osmand.data.LatLon;
import net.osmand.data.QuadPoint;
import net.osmand.data.RotatedTileBox;
@ -40,8 +39,6 @@ import net.osmand.plus.mapcontextmenu.details.MenuController;
import net.osmand.plus.views.AnimateDraggingMapThread;
import net.osmand.plus.views.OsmandMapTileView;
import org.apache.commons.logging.Log;
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
import static net.osmand.plus.mapcontextmenu.details.MenuBuilder.SHADOW_HEIGHT_BOTTOM_DP;
import static net.osmand.plus.mapcontextmenu.details.MenuBuilder.SHADOW_HEIGHT_TOP_DP;
@ -50,7 +47,6 @@ import static net.osmand.plus.mapcontextmenu.details.MenuBuilder.SHADOW_HEIGHT_T
public class MapContextMenuFragment extends Fragment {
public static final String TAG = "MapContextMenuFragment";
private static final Log LOG = PlatformUtil.getLog(MapContextMenuFragment.class);
public static final float FAB_PADDING_TOP_DP = 4f;
public static final float MARKER_PADDING_DP = 20f;
@ -62,6 +58,7 @@ public class MapContextMenuFragment extends Fragment {
MapContextMenu menu;
private int menuTopViewHeight;
private int menuTopShadowHeight;
private int menuTopShadowAllHeight;
private int menuTitleHeight;
@ -319,7 +316,6 @@ public class MapContextMenuFragment extends Fragment {
// FAB
fabView = (ImageView)view.findViewById(R.id.context_menu_fab_view);
fabView.setImageDrawable(iconsCache.getIcon(menu.getFabIconId()));
fabView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -438,11 +434,17 @@ public class MapContextMenuFragment extends Fragment {
@Override
public void onGlobalLayout() {
int newMenuTopViewHeight = view.findViewById(R.id.context_menu_top_view).getHeight();
menuTopShadowHeight = view.findViewById(R.id.context_menu_top_shadow).getHeight();
menuTopShadowAllHeight = view.findViewById(R.id.context_menu_top_shadow_all).getHeight();
menuFullHeight = view.findViewById(R.id.context_menu_main).getHeight();
menuTitleHeight = menuTopShadowHeight + menuTopShadowAllHeight;
int dy = 0;
if (!menu.isLandscapeLayout() && menuTopViewHeight != 0) {
dy = Math.max(0, newMenuTopViewHeight - menuTopViewHeight);
}
menuTopViewHeight = newMenuTopViewHeight;
menuTitleHeight = menuTopShadowHeight + menuTopShadowAllHeight + dy;
menuBottomViewHeight = view.findViewById(R.id.context_menu_bottom_view).getHeight();
recalculateFullHeightMax();
@ -605,6 +607,11 @@ public class MapContextMenuFragment extends Fragment {
}
}
}
if (map.getLatitude() == latlon.getLatitude() && map.getLongitude() == latlon.getLongitude()) {
return;
}
if (animated) {
showOnMap(latlon, false, true);
} else {

View file

@ -12,6 +12,8 @@ import net.osmand.plus.helpers.AndroidUiHelper;
public abstract class MenuController {
public final static float LANDSCAPE_WIDTH_DP = 350f;
public class MenuState {
public static final int HEADER_ONLY = 1;
public static final int HALF_SCREEN = 2;
@ -60,7 +62,7 @@ public abstract class MenuController {
}
public float getLandscapeWidthDp() {
return 350f;
return LANDSCAPE_WIDTH_DP;
}
public int getSupportedMenuStates() {

View file

@ -66,11 +66,8 @@ public abstract class PointEditorFragment extends Fragment {
getActivity().findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);
if (getEditor().isLandscapeLayout()) {
view = inflater.inflate(R.layout.point_editor_fragment_land, container, false);
} else {
view = inflater.inflate(R.layout.point_editor_fragment, container, false);
}
view = inflater.inflate(R.layout.point_editor_fragment, container, false);
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setTitle(getToolbarTitle());
toolbar.setNavigationIcon(getMyApplication().getIconsCache().getIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha));

View file

@ -0,0 +1,160 @@
package net.osmand.plus.mapcontextmenu.other;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import net.osmand.data.LatLon;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.actions.ShareDialog;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
import java.util.LinkedList;
import java.util.List;
public class ShareMenu {
private final MapActivity mapActivity;
private LatLon latLon;
private String title;
private boolean portraitMode;
private boolean largeDevice;
private static final String KEY_SHARE_MENU_LATLON = "key_share_menu_latlon";
private static final String KEY_SHARE_MENU_POINT_TITLE = "key_share_menu_point_title";
public enum ShareItem {
MESSAGE(R.drawable.ic_action_export, R.string.shared_string_send),
CLIPBOARD(R.drawable.ic_action_export, R.string.shared_string_copy),
GEO(R.drawable.ic_action_export, R.string.share_geo),
QR_CODE(R.drawable.ic_action_export, R.string.share_qr_code);
final int iconResourceId;
final int titleResourceId;
ShareItem(int iconResourceId, int titleResourceId) {
this.iconResourceId = iconResourceId;
this.titleResourceId = titleResourceId;
}
public int getIconResourceId() {
return iconResourceId;
}
public int getTitleResourceId() {
return titleResourceId;
}
}
private ShareMenu(MapActivity mapActivity) {
this.mapActivity = mapActivity;
portraitMode = AndroidUiHelper.isOrientationPortrait(mapActivity);
largeDevice = AndroidUiHelper.isXLargeDevice(mapActivity);
}
public List<ShareItem> getItems() {
List<ShareItem> list = new LinkedList<>();
list.add(ShareItem.MESSAGE);
list.add(ShareItem.CLIPBOARD);
list.add(ShareItem.GEO);
list.add(ShareItem.QR_CODE);
return list;
}
public boolean isLandscapeLayout() {
return !portraitMode && !largeDevice;
}
public int getSlideInAnimation() {
if (isLandscapeLayout()) {
return R.anim.slide_in_left;
} else {
return R.anim.slide_in_bottom;
}
}
public int getSlideOutAnimation() {
if (isLandscapeLayout()) {
return R.anim.slide_out_left;
} else {
return R.anim.slide_out_bottom;
}
}
public MapActivity getMapActivity() {
return mapActivity;
}
public LatLon getLatLon() {
return latLon;
}
public String getTitle() {
return title;
}
public static void show(LatLon latLon, String title, MapActivity mapActivity) {
ShareMenu menu = new ShareMenu(mapActivity);
menu.latLon = latLon;
menu.title = title;
ShareMenuFragment.showInstance(menu);
}
public void share(ShareItem item) {
final int zoom = mapActivity.getMapView().getZoom();
final String geoUrl = MapUtils.buildGeoUrl(latLon.getLatitude(), latLon.getLongitude(), zoom);
final String httpUrl = "http://osmand.net/go?lat=" + ((float) latLon.getLatitude())
+ "&lon=" + ((float) latLon.getLongitude()) + "&z=" + zoom;
StringBuilder sb = new StringBuilder();
if (!Algorithms.isEmpty(title)) {
sb.append(title).append("\n");
}
sb.append(mapActivity.getString(R.string.search_tabs_location)).append(": ");
sb.append(geoUrl).append("\n").append(httpUrl);
String sms = sb.toString();
switch (item) {
case MESSAGE:
ShareDialog.sendMessage(mapActivity, sms);
break;
case CLIPBOARD:
ShareDialog.sendToClipboard(mapActivity, sms);
break;
case GEO:
Intent mapIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(geoUrl));
mapActivity.startActivity(mapIntent);
break;
case QR_CODE:
Bundle bundle = new Bundle();
bundle.putFloat("LAT", (float) latLon.getLatitude());
bundle.putFloat("LONG", (float) latLon.getLongitude());
ShareDialog.sendQRCode(mapActivity, "LOCATION_TYPE", bundle, null);
break;
}
}
public void saveMenu(Bundle bundle) {
bundle.putSerializable(KEY_SHARE_MENU_LATLON, latLon);
bundle.putString(KEY_SHARE_MENU_POINT_TITLE, title);
}
public static ShareMenu restoreMenu(Bundle bundle, MapActivity mapActivity) {
ShareMenu menu = new ShareMenu(mapActivity);
menu.title = bundle.getString(KEY_SHARE_MENU_POINT_TITLE);
Object latLonObj = bundle.getSerializable(KEY_SHARE_MENU_LATLON);
if (latLonObj != null) {
menu.latLon = (LatLon) latLonObj;
}
return menu;
}
}

View file

@ -0,0 +1,132 @@
package net.osmand.plus.mapcontextmenu.other;
import android.annotation.SuppressLint;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.other.ShareMenu.ShareItem;
import java.util.List;
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
public class ShareMenuFragment extends Fragment implements OnItemClickListener {
public static final String TAG = "ShareMenuFragment";
private ArrayAdapter<ShareItem> listAdapter;
private ShareMenu menu;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null && getActivity() instanceof MapActivity) {
menu = ShareMenu.restoreMenu(savedInstanceState, (MapActivity) getActivity());
}
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.share_menu_fragment, container, false);
ListView listView = (ListView) view.findViewById(R.id.list);
listAdapter = createAdapter();
listView.setAdapter(listAdapter);
listView.setOnItemClickListener(this);
return view;
}
@Override
public void onStart() {
super.onStart();
menu.getMapActivity().getContextMenu().setBaseFragmentVisibility(false);
}
@Override
public void onStop() {
super.onStop();
menu.getMapActivity().getContextMenu().setBaseFragmentVisibility(true);
}
@Override
public void onSaveInstanceState(Bundle outState) {
menu.saveMenu(outState);
}
public static void showInstance(ShareMenu menu) {
int slideInAnim = menu.getSlideInAnimation();
int slideOutAnim = menu.getSlideOutAnimation();
ShareMenuFragment fragment = new ShareMenuFragment();
fragment.menu = menu;
menu.getMapActivity().getSupportFragmentManager().beginTransaction()
.setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
.add(R.id.fragmentContainer, fragment, TAG)
.addToBackStack(TAG).commit();
}
private ArrayAdapter<ShareItem> createAdapter() {
final List<ShareItem> items = menu.getItems();
return new ArrayAdapter<ShareItem>(menu.getMapActivity(), R.layout.share_list_item, items) {
@SuppressLint("InflateParams")
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
v = menu.getMapActivity().getLayoutInflater().inflate(R.layout.share_list_item, null);
}
final ShareItem item = getItem(position);
ImageView icon = (ImageView) v.findViewById(R.id.icon);
icon.setImageDrawable(menu.getMapActivity().getMyApplication()
.getIconsCache().getContentIcon(item.getIconResourceId()));
TextView name = (TextView) v.findViewById(R.id.name);
name.setText(getContext().getText(item.getTitleResourceId()));
return v;
}
};
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
menu.share(listAdapter.getItem(position));
dismissMenu();
}
public void dismissMenu() {
if (menu.getMapActivity().getContextMenu().isVisible()) {
menu.getMapActivity().getContextMenu().hide();
} else {
menu.getMapActivity().getSupportFragmentManager().popBackStack();
}
}
private int dpToPx(float dp) {
Resources r = getActivity().getResources();
return (int) TypedValue.applyDimension(
COMPLEX_UNIT_DIP,
dp,
r.getDisplayMetrics()
);
}
}