Merge pull request #1107 from Bars107/master

Updated to osm edits, fixed few icons in search. Updated parking card.
This commit is contained in:
vshcherb 2015-03-19 00:16:30 +01:00
commit 663d33e542
33 changed files with 707 additions and 884 deletions

View file

@ -1,41 +1,64 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dashListItemHeight"> android:layout_height="@dimen/dashListItemHeight"
<ImageView android:id="@+id/icon" android:orientation="horizontal">
android:layout_marginLeft="@dimen/dashFavIconMargin"
android:layout_marginRight="@dimen/dashFavIconMargin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout android:orientation="horizontal" <ImageView
android:layout_width="wrap_content" android:id="@+id/icon"
android:layout_height="wrap_content"> android:layout_width="wrap_content"
<ImageView android:id="@+id/people_icon" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_gravity="center_vertical"
android:layout_height="wrap_content"/> android:layout_marginLeft="@dimen/dashFavIconMargin"
<TextView android:id="@+id/people_count" android:layout_marginRight="@dimen/dashFavIconMargin"
android:layout_width="wrap_content" tools:src="@drawable/ic_gpx_track"/>
android:layout_height="wrap_content"/>
<ImageView android:id="@+id/direction_icon" <LinearLayout
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"
<TextView android:id="@+id/distance" android:layout_weight="1"
android:layout_width="wrap_content" android:orientation="vertical">
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="@string/app_version"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/people_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/people_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/direction_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<ImageButton android:id="@+id/show_on_map" <ImageButton
android:layout_marginLeft="@dimen/dashFavIconMargin" android:id="@+id/show_on_map"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="@dimen/dashFavIconMargin"
android:background="?attr/options_button_background"
tools:src="@drawable/ic_action_marker_dark"/>
</LinearLayout> </LinearLayout>

View file

@ -23,53 +23,52 @@
android:src="@drawable/ic_parking_postion_arrow"/> android:src="@drawable/ic_parking_postion_arrow"/>
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical"> android:orientation="vertical">
<TextView <LinearLayout
android:id="@+id/distance"
android:textSize="@dimen/dash_parking_text_size"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/color_white" android:orientation="horizontal">
tools:text="@string/app_version"/>
<TextView
android:id="@+id/distance"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/color_white"
android:textSize="@dimen/dash_parking_big_text_size"
tools:text="@string/app_version"/>
<TextView
android:id="@+id/time_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_white"
android:textSize="@dimen/dash_parking_small_text_size"
tools:text="@string/app_mode_aircraft"/>
<TextView
android:id="@+id/left_lbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dashFavIconMargin"
tools:text="@string/app_mode_aircraft"/>
</LinearLayout>
<TextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/color_white" android:textColor="@color/color_white"
android:textSize="@dimen/dashProgressTextSize" android:textSize="@dimen/dash_parking_small_text_size"
tools:text="@string/app_version"/> tools:text="@string/parking_place_limited"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="@dimen/dashFavIconMargin"
android:orientation="vertical">
<TextView
android:id="@+id/time_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_white"
android:textSize="@dimen/dash_parking_text_size"
tools:text="@string/app_mode_aircraft"/>
<TextView
android:id="@+id/left_lbl"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/osmand_parking_time_left"
android:textColor="@color/color_white"
android:textSize="@dimen/dashProgressTextSize"
tools:text="@string/app_version"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -222,27 +222,7 @@
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:text="@string/poi_dialog_other_tags_message" /> android:text="@string/poi_dialog_other_tags_message" />
<LinearLayout
android:id="@+id/LinearLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="bottom|center"
android:orientation="horizontal" >
<Button
android:id="@+id/Cancel"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:text="@string/shared_string_cancel" >
</Button>
<Button
android:id="@+id/Commit"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:text="@string/default_buttons_commit" >
</Button>
</LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View file

@ -2,7 +2,6 @@
<LinearLayout 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="fill_parent" android:layout_height="fill_parent"
android:background="?attr/colorPrimary"
android:orientation="vertical"> android:orientation="vertical">
<ListView <ListView

View file

@ -1,16 +1,20 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical"> android:orientation="vertical">
<fragment
android:id="@+id/osmEditsFragment"
android:name="net.osmand.plus.osmedit.OsmEditsFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<ListView <net.osmand.plus.activities.search.toolbar.SplitToolbar
android:id="@android:id/list" android:id="@+id/bottomControls"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="wrap_content"
android:layout_marginLeft="3dp" android:background="?attr/bottomToolBarColor"/>
android:layout_marginTop="3dp"
android:layout_marginRight="3dp"></ListView>
</LinearLayout> </LinearLayout>

View file

@ -1,4 +1,4 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<resources><string name="auto_zoom_none">Без аўтаматычнага маштабаваньня</string> <resources><string name="auto_zoom_none">Без аўтаматычнага маштабаваньня</string>
<string name="auto_zoom_close">Буйней</string> <string name="auto_zoom_close">Буйней</string>
<string name="auto_zoom_far">Для сярэдняга маштаба</string> <string name="auto_zoom_far">Для сярэдняга маштаба</string>
@ -2051,8 +2051,11 @@ OsmAnd мае адкрыты зыходны код і актыўна разві
<string name="route_points">Пункты маршруту</string> <string name="route_points">Пункты маршруту</string>
<string name="shared_string_more_actions">Больш дзеяньняў</string> <string name="shared_string_more_actions">Больш дзеяньняў</string>
<string name="osmand_parking_outdated">Састарэлі</string> <string name="osmand_parking_overdue">Састарэлі</string>
<string name="osmand_parking_hour">г</string><string name="osmand_parking_minute">хв</string><string name="osmand_parking_time_left">Засталося</string> <string name="action_create">Стварыць дзеяньне</string> <string name="osmand_parking_hour">г</string>
<string name="osmand_parking_minute">хв</string>
<string name="osmand_parking_time_left">Засталося</string>
<string name="action_create">Стварыць дзеяньне</string>
<string name="action_modify">Зьмяніць дзеяньне</string> <string name="action_modify">Зьмяніць дзеяньне</string>
<string name="action_delete">Выдаліць дзеяньне</string> <string name="action_delete">Выдаліць дзеяньне</string>
<string name="osm_edits">праўкі OSM</string> <string name="osm_edits">праўкі OSM</string>

View file

@ -1969,7 +1969,7 @@
<string name="osm_edits">OSM redigeringer</string> <string name="osm_edits">OSM redigeringer</string>
<string name="osmand_parking_hour">t</string><string name="osmand_parking_minute">m</string><string name="osmand_parking_time_left">Tilbage</string> <string name="parking_place_limited">Tidsbegrænset parkering</string> <string name="osmand_parking_hour">t</string><string name="osmand_parking_minute">m</string><string name="osmand_parking_time_left">Tilbage</string> <string name="parking_place_limited">Tidsbegrænset parkering</string>
<string name="your_edits">Dine redigeringer</string> <string name="your_edits">Dine redigeringer</string>
<string name="osmand_parking_outdated">Udløbet</string> <string name="osmand_parking_overdue">Udløbet</string>
<string name="delay_to_start_navigation_descr">Start navigation automatisk efter angivne interval</string> <string name="delay_to_start_navigation_descr">Start navigation automatisk efter angivne interval</string>
<string name="delay_to_start_navigation">Spring ruteplanlægning over</string> <string name="delay_to_start_navigation">Spring ruteplanlægning over</string>
<string name="shared_string_go">Udfør</string> <string name="shared_string_go">Udfør</string>

View file

@ -1985,7 +1985,7 @@
<string name="shared_string_photo">Foto</string> <string name="shared_string_photo">Foto</string>
<string name="route_points">Puntos de la ruta</string> <string name="route_points">Puntos de la ruta</string>
<string name="shared_string_release">Liberado</string> <string name="shared_string_release">Liberado</string>
<string name="osmand_parking_outdated">Obsoleto</string> <string name="osmand_parking_overdue">Obsoleto</string>
<string name="delay_to_start_navigation">Salta la planificación de ruta</string> <string name="delay_to_start_navigation">Salta la planificación de ruta</string>
<string name="shared_string_go">Ir</string> <string name="shared_string_go">Ir</string>
<string name="delay_to_start_navigation_descr">Comienza la navegación automáticamente después de un intervalo dado</string> <string name="delay_to_start_navigation_descr">Comienza la navegación automáticamente después de un intervalo dado</string>

View file

@ -1991,7 +1991,7 @@ Afghanistan, Albanie, Algérie, Allemagne, Andorre, Angola, Anguilla, Antigua-et
<string name="osm_edits">Éditions OSM</string> <string name="osm_edits">Éditions OSM</string>
<string name="osmand_parking_hour">h</string><string name="osmand_parking_minute">m</string><string name="osmand_parking_time_left">Restant</string> <string name="parking_place_limited">Stationnement à durée limitée</string> <string name="osmand_parking_hour">h</string><string name="osmand_parking_minute">m</string><string name="osmand_parking_time_left">Restant</string> <string name="parking_place_limited">Stationnement à durée limitée</string>
<string name="your_edits">Vos modifications</string> <string name="your_edits">Vos modifications</string>
<string name="osmand_parking_outdated">Expiré</string> <string name="osmand_parking_overdue">Expiré</string>
<string name="delay_to_start_navigation_descr">Démarrer automatiquement la navigation après le temps indiqué</string> <string name="delay_to_start_navigation_descr">Démarrer automatiquement la navigation après le temps indiqué</string>
<string name="shared_string_go">Aller</string> <string name="shared_string_go">Aller</string>
<string name="shared_string_not_use">Non utilisé</string> <string name="shared_string_not_use">Non utilisé</string>

View file

@ -2146,7 +2146,7 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz
<string name="osm_edits">Modifiche OSM</string> <string name="osm_edits">Modifiche OSM</string>
<string name="osmand_parking_hour">h</string><string name="osmand_parking_minute">m</string><string name="osmand_parking_time_left">Mancano</string> <string name="parking_place_limited">Parcheggio a tempo limitato</string> <string name="osmand_parking_hour">h</string><string name="osmand_parking_minute">m</string><string name="osmand_parking_time_left">Mancano</string> <string name="parking_place_limited">Parcheggio a tempo limitato</string>
<string name="your_edits">Le tue modifiche</string> <string name="your_edits">Le tue modifiche</string>
<string name="osmand_parking_outdated">Obsoleto</string> <string name="osmand_parking_overdue">Obsoleto</string>
<string name="delay_to_start_navigation_descr">Avvia automaticamente la novigazione dopo l\'intervallo specificato</string> <string name="delay_to_start_navigation_descr">Avvia automaticamente la novigazione dopo l\'intervallo specificato</string>
<string name="delay_to_start_navigation">Salta la pianificazione del percorso</string> <string name="delay_to_start_navigation">Salta la pianificazione del percorso</string>
<string name="shared_string_go">Vai</string> <string name="shared_string_go">Vai</string>

View file

@ -2160,7 +2160,7 @@ OsmAndはオープンソースであり、活発に開発が進められいま
<string name="voices">音声プロンプト</string> <string name="voices">音声プロンプト</string>
<string name="shared_string_disabled">有効</string> <string name="shared_string_disabled">有効</string>
<string name="shared_string_enabled">無効</string> <string name="shared_string_enabled">無効</string>
<string name="osmand_parking_outdated">期限切れ</string> <string name="osmand_parking_overdue">期限切れ</string>
<string name="action_create">アクションの作成</string> <string name="action_create">アクションの作成</string>
<string name="action_modify">アクションの変更</string> <string name="action_modify">アクションの変更</string>
<string name="action_delete">アクションの削除</string> <string name="action_delete">アクションの削除</string>

View file

@ -2202,7 +2202,7 @@
<string name="osm_edits">OSM 편집</string> <string name="osm_edits">OSM 편집</string>
<string name="osmand_parking_hour">시간</string><string name="osmand_parking_minute"></string><string name="osmand_parking_time_left">남은 시간</string> <string name="parking_place_limited">주차 장소 시간 제한</string> <string name="osmand_parking_hour">시간</string><string name="osmand_parking_minute"></string><string name="osmand_parking_time_left">남은 시간</string> <string name="parking_place_limited">주차 장소 시간 제한</string>
<string name="your_edits">편집</string> <string name="your_edits">편집</string>
<string name="osmand_parking_outdated">시간 초과</string> <string name="osmand_parking_overdue">시간 초과</string>
<string name="delay_to_start_navigation_descr">지정된 시간 경과후 자동으로 운행 시작</string> <string name="delay_to_start_navigation_descr">지정된 시간 경과후 자동으로 운행 시작</string>
<string name="delay_to_start_navigation">경로 계획 생략</string> <string name="delay_to_start_navigation">경로 계획 생략</string>
<string name="shared_string_go">실행</string> <string name="shared_string_go">실행</string>

View file

@ -1,4 +1,4 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<resources><string name="rendering_attr_roadColors_description">Velg fargeskjema for veier:</string> <resources><string name="rendering_attr_roadColors_description">Velg fargeskjema for veier:</string>
<string name="rendering_attr_roadColors_name">Veifargeskjema</string> <string name="rendering_attr_roadColors_name">Veifargeskjema</string>
<string name="map_widget_show_destination_arrow">Vis retning til målet</string> <string name="map_widget_show_destination_arrow">Vis retning til målet</string>
@ -1249,7 +1249,7 @@
<string name="route_points">Rutepunkter</string> <string name="route_points">Rutepunkter</string>
<string name="shared_string_ellipsis"></string> <string name="shared_string_ellipsis"></string>
<string name="osmand_parking_outdated">Utdatert</string> <string name="osmand_parking_overdue">Utdatert</string>
<string name="osm_edits">OSM-redigeringer</string> <string name="osm_edits">OSM-redigeringer</string>
<string name="osmand_parking_time_left">Igjen</string> <string name="your_edits">Dine redigeringer</string> <string name="osmand_parking_time_left">Igjen</string> <string name="your_edits">Dine redigeringer</string>
<string name="waypoint_visit_after">Besøk etter</string> <string name="waypoint_visit_after">Besøk etter</string>

View file

@ -2014,7 +2014,7 @@ Afganistan, Afryka Południowa, Albania, Algieria, Andora, Angola, Anguilla, Ant
<string name="proxy_port_title">Port proxy</string> <string name="proxy_port_title">Port proxy</string>
<string name="plugin_description_title">Opis</string> <string name="plugin_description_title">Opis</string>
<string name="plugin_install_needs_network">Do zainstalowania tej wtyczki potrzebujesz połączenia internetowego.</string> <string name="plugin_install_needs_network">Do zainstalowania tej wtyczki potrzebujesz połączenia internetowego.</string>
<string name="osmand_parking_outdated">Przestarzały</string> <string name="osmand_parking_overdue">Przestarzały</string>
<string name="action_create">Utwórz</string> <string name="action_create">Utwórz</string>
<string name="action_modify">Zmodyfikuj</string> <string name="action_modify">Zmodyfikuj</string>
<string name="action_delete">Usuń</string> <string name="action_delete">Usuń</string>

View file

@ -1929,7 +1929,7 @@
<string name="waypoint_visit_after">Посетить после</string> <string name="waypoint_visit_after">Посетить после</string>
<string name="waypoint_visit_before">Посетить до</string> <string name="waypoint_visit_before">Посетить до</string>
<string name="plugin_touringview_name">Туристическая карта</string> <string name="plugin_touringview_name">Туристическая карта</string>
<string name="osmand_parking_outdated">Просрочено</string> <string name="osmand_parking_overdue">Просрочено</string>
<string name="delay_to_start_navigation_descr">Автоматический запуск навигации после заданного интервала</string> <string name="delay_to_start_navigation_descr">Автоматический запуск навигации после заданного интервала</string>
<string name="delay_to_start_navigation">Задержка планирования маршрута</string> <string name="delay_to_start_navigation">Задержка планирования маршрута</string>
<string name="shared_string_go">Поехали</string> <string name="shared_string_go">Поехали</string>

View file

@ -1917,7 +1917,7 @@
<string name="shared_string_photo">Foto</string> <string name="shared_string_photo">Foto</string>
<string name="route_points">Puntos de s\'àndala</string> <string name="route_points">Puntos de s\'àndala</string>
<string name="shared_string_release">Essidu</string> <string name="shared_string_release">Essidu</string>
<string name="osmand_parking_outdated">Iscadidu</string> <string name="osmand_parking_overdue">Iscadidu</string>
<string name="delay_to_start_navigation_descr">Incumentza automaticamente su nàvigu a pustis de s\'intervallu dislindadu</string> <string name="delay_to_start_navigation_descr">Incumentza automaticamente su nàvigu a pustis de s\'intervallu dislindadu</string>
<string name="shared_string_not_use">No impreare</string> <string name="shared_string_not_use">No impreare</string>
<string name="shared_string_go">Bae</string> <string name="shared_string_go">Bae</string>

View file

@ -1833,7 +1833,7 @@
<string name="osm_edits">OSM-redigeringar</string> <string name="osm_edits">OSM-redigeringar</string>
<string name="osmand_parking_hour">h</string><string name="osmand_parking_minute">m</string><string name="osmand_parking_time_left">kvar</string> <string name="parking_place_limited">Tidsbegränsad parkering</string> <string name="osmand_parking_hour">h</string><string name="osmand_parking_minute">m</string><string name="osmand_parking_time_left">kvar</string> <string name="parking_place_limited">Tidsbegränsad parkering</string>
<string name="your_edits">Dina redigeringar</string> <string name="your_edits">Dina redigeringar</string>
<string name="osmand_parking_outdated">Föråldrad</string> <string name="osmand_parking_overdue">Föråldrad</string>
<string name="delay_to_start_navigation_descr">Starta navigering automatiskt efter bestämd tid</string> <string name="delay_to_start_navigation_descr">Starta navigering automatiskt efter bestämd tid</string>
<string name="delay_to_start_navigation">Hoppa över ruttplanering</string> <string name="delay_to_start_navigation">Hoppa över ruttplanering</string>
<string name="shared_string_go">Kör</string> <string name="shared_string_go">Kör</string>

View file

@ -1,4 +1,4 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<resources><string name="tip_recent_changes_0_8_1_t">Зміни в 0.8.1: <resources><string name="tip_recent_changes_0_8_1_t">Зміни в 0.8.1:
\n\t* Більш точні маршрути (трохи повільніше) \n\t* Більш точні маршрути (трохи повільніше)
\n\t* Розумний і швидкий перерахунок маршруту \n\t* Розумний і швидкий перерахунок маршруту
@ -2061,7 +2061,7 @@ OsmAnd має відкриті сирці і активно розвиваєть
\n\nФайл з даними містить всі навігаційні символи, у вигляди єдиного файлу з назвою \'World seamarks\'. \n\nФайл з даними містить всі навігаційні символи, у вигляди єдиного файлу з назвою \'World seamarks\'.
\n\nЦей стиль може бути скасовано шляхом його деактивації тут або зміною в пункті \'Стиль мапи\' меню \'Налаштування мапи\' на потрібний. \n\nЦей стиль може бути скасовано шляхом його деактивації тут або зміною в пункті \'Стиль мапи\' меню \'Налаштування мапи\' на потрібний.
</string> </string>
<string name="osmand_parking_outdated">Застарілі</string> <string name="osmand_parking_overdue">Застарілі</string>
<string name="action_create">Створити дію</string> <string name="action_create">Створити дію</string>
<string name="action_modify">Змінити дію</string> <string name="action_modify">Змінити дію</string>
<string name="action_delete">Вилучити дію</string> <string name="action_delete">Вилучити дію</string>

View file

@ -1947,7 +1947,7 @@
<string name="action_create">行動建立</string> <string name="action_create">行動建立</string>
<string name="action_modify">行動修改</string> <string name="action_modify">行動修改</string>
<string name="action_delete">行動刪除</string> <string name="action_delete">行動刪除</string>
<string name="osmand_parking_outdated">已過時</string> <string name="osmand_parking_overdue">已過時</string>
<string name="delay_to_start_navigation_descr">指定的時間間隔後自動開始導航</string> <string name="delay_to_start_navigation_descr">指定的時間間隔後自動開始導航</string>
<string name="delay_to_start_navigation">跳過航路規劃</string> <string name="delay_to_start_navigation">跳過航路規劃</string>
<string name="shared_string_go">執行</string> <string name="shared_string_go">執行</string>

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="parking_outdated_color">#f41a34</color>
<color name="osmo_header_dark">#2d383d</color> <color name="osmo_header_dark">#2d383d</color>
<color name="osmo_header_light">#b36d12</color> <color name="osmo_header_light">#b36d12</color>

View file

@ -92,5 +92,6 @@
<dimen name="dashFavDescTextSize">14sp</dimen> <dimen name="dashFavDescTextSize">14sp</dimen>
<dimen name="dashProgressTextSize">14sp</dimen> <dimen name="dashProgressTextSize">14sp</dimen>
<dimen name="dashParkingTextSize">24sp</dimen> <dimen name="dashParkingTextSize">24sp</dimen>
<dimen name="dash_parking_text_size">22sp</dimen> <dimen name="dash_parking_big_text_size">18sp</dimen>
<dimen name="dash_parking_small_text_size">14sp</dimen>
</resources> </resources>

View file

@ -9,22 +9,22 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). 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 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="local_osm_changes_upload_all_confirm">You are going to upload %1$d changes to osm. Are you sure?</string>
<string name="confirmation_to_clear_history">Do you want to clear the whole history?</string> <string name="confirmation_to_clear_history">Do you want to clear the whole history?</string>
<string name="delay_to_start_navigation_descr">Automatically start navigation after specified interval</string> <string name="delay_to_start_navigation_descr">Automatically start navigation after specified interval</string>
<string name="delay_to_start_navigation">Skip route planning</string> <string name="delay_to_start_navigation">Skip route planning</string>
<string name="shared_string_go">Go</string> <string name="shared_string_go">Go</string>
<string name="osmand_parking_outdated">Outdated</string> <string name="osmand_parking_overdue">overdue</string>
<string name="action_create">Action create</string> <string name="action_create">Action create</string>
<string name="action_modify">Action modify</string> <string name="action_modify">Action modify</string>
<string name="action_delete">Action delete</string> <string name="action_delete">Action delete</string>
<string name="osm_edits">OSM edits</string> <string name="osm_edits">OSM edits</string>
<!-- means first letter of word *hour* --> <string name="osmand_parking_hour">h</string><!-- means first letter of word *hour* -->
<string name="osmand_parking_hour">h</string> <string name="osmand_parking_minute">min</string><!-- means first letter of word *minute*-->
<!-- means first letter of word *minute* --> <!-- means first letter of word *minute* -->
<string name="osmand_parking_minute">m</string> <string name="parking_place_limited">Parking place time limited to</string>
<!-- used to describe time left, not left direction --> <!-- used to describe time left, not left direction -->
<string name="osmand_parking_time_left">Left</string> <string name="osmand_parking_time_left">Left</string>
<string name="parking_place_limited">Parking place time limited</string>
<string name="your_edits">Your Edits</string> <string name="your_edits">Your Edits</string>
<string name="waypoint_visit_after">Visit after</string> <string name="waypoint_visit_after">Visit after</string>
<string name="waypoint_visit_before">Visit before</string> <string name="waypoint_visit_before">Visit before</string>

View file

@ -4,45 +4,6 @@
package net.osmand.plus.activities.search; package net.osmand.plus.activities.search;
import gnu.trove.set.hash.TLongHashSet;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import net.osmand.ResultMatcher;
import net.osmand.access.AccessibleToast;
import net.osmand.access.NavigationInfo;
import net.osmand.data.Amenity;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.osm.PoiCategory;
import net.osmand.osm.PoiType;
import net.osmand.plus.OsmAndConstants;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.EditPOIFilterActivity;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.OsmandListActivity;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.poi.NameFinderPoiFilter;
import net.osmand.plus.poi.PoiLegacyFilter;
import net.osmand.plus.poi.SearchByNameFilter;
import net.osmand.plus.render.RenderingIcons;
import net.osmand.plus.views.DirectionDrawable;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
import net.osmand.util.OpeningHoursParser;
import net.osmand.util.OpeningHoursParser.OpeningHours;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.AlertDialog.Builder; import android.app.AlertDialog.Builder;
import android.content.Context; import android.content.Context;
@ -83,6 +44,46 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import net.osmand.ResultMatcher;
import net.osmand.access.AccessibleToast;
import net.osmand.access.NavigationInfo;
import net.osmand.data.Amenity;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.osm.PoiCategory;
import net.osmand.osm.PoiType;
import net.osmand.plus.OsmAndConstants;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.EditPOIFilterActivity;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.OsmandListActivity;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.poi.NameFinderPoiFilter;
import net.osmand.plus.poi.PoiLegacyFilter;
import net.osmand.plus.poi.SearchByNameFilter;
import net.osmand.plus.render.RenderingIcons;
import net.osmand.plus.views.DirectionDrawable;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
import net.osmand.util.OpeningHoursParser;
import net.osmand.util.OpeningHoursParser.OpeningHours;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import gnu.trove.set.hash.TLongHashSet;
/** /**
* Search poi activity * Search poi activity
@ -147,7 +148,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
showFilterItem = menu.add(0, FILTER, 0, R.string.search_poi_filter); showFilterItem = menu.add(0, FILTER, 0, R.string.search_poi_filter);
MenuItemCompat.setShowAsAction(showFilterItem, MenuItemCompat.setShowAsAction(showFilterItem,
MenuItemCompat.SHOW_AS_ACTION_ALWAYS); MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
showFilterItem = showFilterItem.setIcon(R.drawable.ic_action_filter_dark); showFilterItem = showFilterItem.setIcon(getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_filter_dark));
showFilterItem.setOnMenuItemClickListener(new OnMenuItemClickListener() { showFilterItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override @Override
public boolean onMenuItemClick(MenuItem item) { public boolean onMenuItemClick(MenuItem item) {

View file

@ -3,28 +3,15 @@
*/ */
package net.osmand.plus.activities.search; package net.osmand.plus.activities.search;
import java.util.ArrayList;
import java.util.List;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.ListFragment;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.view.*;
import net.osmand.access.AccessibleToast;
import net.osmand.data.LatLon;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.EditPOIFilterActivity;
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
import net.osmand.plus.poi.NameFinderPoiFilter;
import net.osmand.plus.poi.PoiLegacyFilter;
import net.osmand.plus.poi.PoiFiltersHelper;
import net.osmand.plus.poi.SearchByNameFilter;
import net.osmand.plus.render.RenderingIcons;
import net.osmand.plus.resources.ResourceManager;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.ImageView; import android.widget.ImageView;
@ -32,6 +19,23 @@ import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import net.osmand.access.AccessibleToast;
import net.osmand.data.LatLon;
import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.EditPOIFilterActivity;
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
import net.osmand.plus.poi.NameFinderPoiFilter;
import net.osmand.plus.poi.PoiFiltersHelper;
import net.osmand.plus.poi.PoiLegacyFilter;
import net.osmand.plus.poi.SearchByNameFilter;
import net.osmand.plus.render.RenderingIcons;
import net.osmand.plus.resources.ResourceManager;
import java.util.ArrayList;
import java.util.List;
public class SearchPoiFilterFragment extends ListFragment implements SearchActivityChild { public class SearchPoiFilterFragment extends ListFragment implements SearchActivityChild {
@ -151,8 +155,9 @@ public class SearchPoiFilterFragment extends ListFragment implements SearchActiv
OsmandApplication app = getMyApplication(); OsmandApplication app = getMyApplication();
final PoiLegacyFilter model = getItem(position); final PoiLegacyFilter model = getItem(position);
label.setText(model.getName()); label.setText(model.getName());
IconsCache iconsCache = app.getIconsCache();
if(model.getFilterId().equals(PoiLegacyFilter.CUSTOM_FILTER_ID)) { if(model.getFilterId().equals(PoiLegacyFilter.CUSTOM_FILTER_ID)) {
icon.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.ic_action_filter_dark)); icon.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_action_filter_dark));
} else if (model.getFilterId().equals(PoiLegacyFilter.BY_NAME_FILTER_ID)) { } else if (model.getFilterId().equals(PoiLegacyFilter.BY_NAME_FILTER_ID)) {
icon.setImageResource(android.R.drawable.ic_search_category_default); icon.setImageResource(android.R.drawable.ic_search_category_default);
} else { } else {
@ -163,6 +168,7 @@ public class SearchPoiFilterFragment extends ListFragment implements SearchActiv
} }
} }
ImageView editIcon = (ImageView) row.findViewById(R.id.folder_edit_icon); ImageView editIcon = (ImageView) row.findViewById(R.id.folder_edit_icon);
editIcon.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_action_filter_dark));
if (model.isStandardFilter()) { if (model.isStandardFilter()) {
editIcon.setVisibility(View.GONE); editIcon.setVisibility(View.GONE);
} else { } else {

View file

@ -1,15 +1,5 @@
package net.osmand.plus.dashboard; package net.osmand.plus.dashboard;
import java.util.ArrayList;
import java.util.List;
import net.osmand.Location;
import net.osmand.data.LatLon;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.views.DirectionDrawable;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
@ -19,6 +9,16 @@ import android.view.WindowManager;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import net.osmand.Location;
import net.osmand.data.LatLon;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.views.DirectionDrawable;
import java.util.ArrayList;
import java.util.List;
/** /**
* Created by Denis * Created by Denis
* on 26.01.2015. * on 26.01.2015.
@ -134,7 +134,7 @@ public abstract class DashLocationFragment extends DashBaseFragment {
if (paint) { if (paint) {
dd.setImage(arrowResId, useCenter ? R.color.color_distance : R.color.color_myloc_distance); dd.setImage(arrowResId, useCenter ? R.color.color_distance : R.color.color_myloc_distance);
} else { } else {
dd.setImage(arrowResId); dd.setImage(arrowResId, useCenter ? R.color.color_distance : R.color.color_white);
} }
if (fromLoc == null || h == null) { if (fromLoc == null || h == null) {
dd.setAngle(0); dd.setAngle(0);

View file

@ -19,6 +19,7 @@ import net.osmand.plus.development.OsmandDevelopmentPlugin;
import net.osmand.plus.download.DownloadActivity; import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.helpers.ScreenOrientationHelper; import net.osmand.plus.helpers.ScreenOrientationHelper;
import net.osmand.plus.monitoring.DashTrackFragment; import net.osmand.plus.monitoring.DashTrackFragment;
import net.osmand.plus.osmedit.DashOsmEditsFragment;
import net.osmand.plus.osmo.DashOsmoFragment; import net.osmand.plus.osmo.DashOsmoFragment;
import net.osmand.plus.parkingpoint.DashParkingFragment; import net.osmand.plus.parkingpoint.DashParkingFragment;
import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.routing.RoutingHelper;
@ -389,6 +390,7 @@ public class DashboardOnMap {
FragmentTransaction fragmentTransaction = manager.beginTransaction(); FragmentTransaction fragmentTransaction = manager.beginTransaction();
showFragment(manager, fragmentTransaction, DashErrorFragment.TAG, DashErrorFragment.class, showFragment(manager, fragmentTransaction, DashErrorFragment.TAG, DashErrorFragment.class,
mapActivity.getMyApplication().getAppInitializer().checkPreviousRunsForExceptions(mapActivity) && showCards); mapActivity.getMyApplication().getAppInitializer().checkPreviousRunsForExceptions(mapActivity) && showCards);
showFragment(manager, fragmentTransaction, DashParkingFragment.TAG, DashParkingFragment.class, showCards); showFragment(manager, fragmentTransaction, DashParkingFragment.TAG, DashParkingFragment.class, showCards);
@ -398,8 +400,8 @@ public class DashboardOnMap {
showFragment(manager, fragmentTransaction, DashFavoritesFragment.TAG, DashFavoritesFragment.class, showCards); showFragment(manager, fragmentTransaction, DashFavoritesFragment.TAG, DashFavoritesFragment.class, showCards);
showFragment(manager, fragmentTransaction, DashAudioVideoNotesFragment.TAG, DashAudioVideoNotesFragment.class, showCards); showFragment(manager, fragmentTransaction, DashAudioVideoNotesFragment.TAG, DashAudioVideoNotesFragment.class, showCards);
showFragment(manager, fragmentTransaction, DashTrackFragment.TAG, DashTrackFragment.class, showCards); showFragment(manager, fragmentTransaction, DashTrackFragment.TAG, DashTrackFragment.class, showCards);
showFragment(manager, fragmentTransaction, DashOsmoFragment.TAG, DashOsmoFragment.class, showCards); //showFragment(manager, fragmentTransaction, DashOsmoFragment.TAG, DashOsmoFragment.class, showCards);
//showFragment(manager, fragmentTransaction, DashOsmEditsFragment.TAG, DashOsmEditsFragment.class, showCards); showFragment(manager, fragmentTransaction, DashOsmEditsFragment.TAG, DashOsmEditsFragment.class, showCards);
// showFragment(manager, fragmentTransaction, DashUpdatesFragment.TAG, DashUpdatesFragment.class, showCards); // showFragment(manager, fragmentTransaction, DashUpdatesFragment.TAG, DashUpdatesFragment.class, showCards);
showFragment(manager, fragmentTransaction, DashPluginsFragment.TAG, DashPluginsFragment.class, showCards); showFragment(manager, fragmentTransaction, DashPluginsFragment.TAG, DashPluginsFragment.class, showCards);
showFragment(manager, fragmentTransaction, DashSimulateFragment.TAG, DashSimulateFragment.class, showFragment(manager, fragmentTransaction, DashSimulateFragment.TAG, DashSimulateFragment.class,

View file

@ -1,18 +1,8 @@
package net.osmand.plus.osmedit; package net.osmand.plus.osmedit;
import net.osmand.data.PointDescription; import android.app.AlertDialog;
import net.osmand.plus.OsmAndAppCustomization;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.ProgressImplementation;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashBaseFragment;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.myplaces.FavoritesActivity;
import android.app.Activity;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Intent; import android.content.DialogInterface;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -23,6 +13,15 @@ import android.widget.ImageButton;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import net.osmand.data.PointDescription;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.ProgressImplementation;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashBaseFragment;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.myplaces.FavoritesActivity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -91,22 +90,11 @@ public class DashOsmEditsFragment extends DashBaseFragment implements OsmEditsUp
OsmEditsFragment.getOsmEditView(view, point, getMyApplication()); OsmEditsFragment.getOsmEditView(view, point, getMyApplication());
ImageButton send =(ImageButton) view.findViewById(R.id.play); ImageButton send =(ImageButton) view.findViewById(R.id.play);
send.setImageDrawable(getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_gup_dark)); send.setImageDrawable(getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_export));
send.setOnClickListener(new View.OnClickListener() { send.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
OpenstreetmapRemoteUtil remotepoi = new OpenstreetmapRemoteUtil(getActivity()); uploadItem(point);
OsmPoint[] toUpload = new OsmPoint[]{point};
OsmBugsRemoteUtil remotebug = new OsmBugsRemoteUtil(getMyApplication());
ProgressDialog dialog = ProgressImplementation.createProgressDialog(
getActivity(),
getString(R.string.uploading),
getString(R.string.local_openstreetmap_uploading),
ProgressDialog.STYLE_HORIZONTAL).getDialog();
UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask(dialog,DashOsmEditsFragment.this, remotepoi,
remotebug, toUpload.length);
uploadTask.execute(toUpload);
dialog.show();
} }
}); });
view.findViewById(R.id.options).setVisibility(View.GONE); view.findViewById(R.id.options).setVisibility(View.GONE);
@ -127,6 +115,34 @@ public class DashOsmEditsFragment extends DashBaseFragment implements OsmEditsUp
} }
} }
private void uploadItem(final OsmPoint point){
AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
b.setMessage(getString(R.string.local_osm_changes_upload_all_confirm, 1));
b.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
showProgressDialog(point);
}
});
b.setNegativeButton(R.string.shared_string_cancel, null);
b.show();
}
private void showProgressDialog(OsmPoint point) {
OpenstreetmapRemoteUtil remotepoi = new OpenstreetmapRemoteUtil(getActivity());
OsmPoint[] toUpload = new OsmPoint[]{point};
OsmBugsRemoteUtil remotebug = new OsmBugsRemoteUtil(getMyApplication());
ProgressDialog dialog = ProgressImplementation.createProgressDialog(
getActivity(),
getString(R.string.uploading),
getString(R.string.local_openstreetmap_uploading),
ProgressDialog.STYLE_HORIZONTAL).getDialog();
UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask(dialog,DashOsmEditsFragment.this, remotepoi,
remotebug, toUpload.length);
uploadTask.execute(toUpload);
dialog.show();
}
private void getOsmPoints(ArrayList<OsmPoint> dataPoints) { private void getOsmPoints(ArrayList<OsmPoint> dataPoints) {
OpenstreetmapsDbHelper dbpoi = new OpenstreetmapsDbHelper(getActivity()); OpenstreetmapsDbHelper dbpoi = new OpenstreetmapsDbHelper(getActivity());
OsmBugsDbHelper dbbug = new OsmBugsDbHelper(getActivity()); OsmBugsDbHelper dbbug = new OsmBugsDbHelper(getActivity());

View file

@ -1,35 +1,5 @@
package net.osmand.plus.osmedit; package net.osmand.plus.osmedit;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import net.osmand.access.AccessibleToast;
import net.osmand.data.Amenity;
import net.osmand.osm.MapPoiTypes;
import net.osmand.osm.MapRenderingTypes;
import net.osmand.osm.PoiCategory;
import net.osmand.osm.PoiType;
import net.osmand.osm.edit.EntityInfo;
import net.osmand.osm.edit.EntityParser;
import net.osmand.osm.edit.Node;
import net.osmand.osm.edit.OSMSettings.OSMTagKey;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.DialogProvider;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.OpeningHoursView;
import net.osmand.util.OpeningHoursParser;
import net.osmand.util.OpeningHoursParser.BasicOpeningHourRule;
import net.osmand.util.OpeningHoursParser.OpeningHours;
import net.osmand.util.OpeningHoursParser.OpeningHoursRule;
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;
@ -60,6 +30,37 @@ import android.widget.TableRow;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import net.osmand.access.AccessibleToast;
import net.osmand.data.Amenity;
import net.osmand.osm.MapPoiTypes;
import net.osmand.osm.MapRenderingTypes;
import net.osmand.osm.PoiCategory;
import net.osmand.osm.PoiType;
import net.osmand.osm.edit.EntityInfo;
import net.osmand.osm.edit.EntityParser;
import net.osmand.osm.edit.Node;
import net.osmand.osm.edit.OSMSettings.OSMTagKey;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.DialogProvider;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.OpeningHoursView;
import net.osmand.util.OpeningHoursParser;
import net.osmand.util.OpeningHoursParser.BasicOpeningHourRule;
import net.osmand.util.OpeningHoursParser.OpeningHours;
import net.osmand.util.OpeningHoursParser.OpeningHoursRule;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
public class EditingPOIActivity implements DialogProvider { public class EditingPOIActivity implements DialogProvider {
private final Activity activity; private final Activity activity;
@ -145,7 +146,7 @@ public class EditingPOIActivity implements DialogProvider {
Amenity a = EntityParser.parseAmenity(n, type, subType, null, MapRenderingTypes.getDefault()); Amenity a = EntityParser.parseAmenity(n, type, subType, null, MapRenderingTypes.getDefault());
dialogBundle.putSerializable(KEY_AMENITY, a); dialogBundle.putSerializable(KEY_AMENITY, a);
dialogBundle.putSerializable(KEY_AMENITY_NODE, n); dialogBundle.putSerializable(KEY_AMENITY_NODE, n);
activity.showDialog(dialogID); createPOIDialog(dialogID, dialogBundle).show();
} }
public void showDeleteDialog(final Amenity a){ public void showDeleteDialog(final Amenity a){
@ -205,10 +206,9 @@ public class EditingPOIActivity implements DialogProvider {
return builder.create(); return builder.create();
} }
private void preparePOIDialog(int dialogId, Dialog dlg, Bundle args, int title) { private void preparePOIDialog(View dlg, Bundle args) {
Amenity a = (Amenity) args.getSerializable(KEY_AMENITY); Amenity a = (Amenity) args.getSerializable(KEY_AMENITY);
Node n = (Node) args.getSerializable(KEY_AMENITY_NODE); Node n = (Node) args.getSerializable(KEY_AMENITY_NODE);
dlg.setTitle(title);
EditText nameText = ((EditText)dlg.findViewById(R.id.Name)); EditText nameText = ((EditText)dlg.findViewById(R.id.Name));
nameText.setText(a.getName()); nameText.setText(a.getName());
EditText openingHours = ((EditText)dlg.findViewById(R.id.OpeningHours)); EditText openingHours = ((EditText)dlg.findViewById(R.id.OpeningHours));
@ -224,7 +224,6 @@ public class EditingPOIActivity implements DialogProvider {
final TableLayout layout = ((TableLayout)dlg.findViewById(R.id.advancedModeTable)); final TableLayout layout = ((TableLayout)dlg.findViewById(R.id.advancedModeTable));
layout.setVisibility(View.GONE); layout.setVisibility(View.GONE);
updateType(a); updateType(a);
attachListeners(dialogId, dlg, a, n);
} }
private void addTagValueRow(final Node n, final TableLayout layout, String tg, String vl) { private void addTagValueRow(final Node n, final TableLayout layout, String tg, String vl) {
@ -327,27 +326,37 @@ public class EditingPOIActivity implements DialogProvider {
layout.invalidate(); layout.invalidate();
} }
private Dialog createPOIDialog(final int dialogID, Bundle args) { private Builder createPOIDialog(final int dialogID, Bundle args) {
final Dialog dlg = new Dialog(activity); final View view = activity.getLayoutInflater().inflate(R.layout.editing_poi, null);
dlg.setContentView(R.layout.editing_poi); final Builder dlg = new Builder(activity);
dlg.setView(view);
switch (dialogID) {
case DIALOG_CREATE_POI:
dlg.setTitle(R.string.poi_create_title);
break;
case DIALOG_EDIT_POI:
dlg.setTitle(R.string.poi_edit_title);
break;
}
dlg.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);; //dlg.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);;
nameText = ((EditText)dlg.findViewById(R.id.Name)); nameText = ((EditText)view.findViewById(R.id.Name));
openingHours = ((EditText)dlg.findViewById(R.id.OpeningHours)); openingHours = ((EditText)view.findViewById(R.id.OpeningHours));
typeText = ((AutoCompleteTextView)dlg.findViewById(R.id.Type)); typeText = ((AutoCompleteTextView)view.findViewById(R.id.Type));
typeButton = ((Button)dlg.findViewById(R.id.TypeButton)); typeButton = ((Button)view.findViewById(R.id.TypeButton));
openHoursButton = ((Button)dlg.findViewById(R.id.OpenHoursButton)); openHoursButton = ((Button)view.findViewById(R.id.OpenHoursButton));
typeText = ((AutoCompleteTextView)dlg.findViewById(R.id.Type)); typeText = ((AutoCompleteTextView)view.findViewById(R.id.Type));
typeText.setThreshold(1); typeText.setThreshold(1);
commentText = ((EditText)dlg.findViewById(R.id.Comment)); commentText = ((EditText)view.findViewById(R.id.Comment));
phoneText = ((EditText)dlg.findViewById(R.id.Phone)); phoneText = ((EditText)view.findViewById(R.id.Phone));
hnoText = ((EditText)dlg.findViewById(R.id.HouseNumber)); hnoText = ((EditText)view.findViewById(R.id.HouseNumber));
streetNameText = ((EditText)dlg.findViewById(R.id.StreetName)); streetNameText = ((EditText)view.findViewById(R.id.StreetName));
websiteText = ((EditText)dlg.findViewById(R.id.Website)); websiteText = ((EditText)view.findViewById(R.id.Website));
closeChange = ((CheckBox) dlg.findViewById(R.id.CloseChangeset)); closeChange = ((CheckBox) view.findViewById(R.id.CloseChangeset));
TextView linkToOsmDoc = (TextView) dlg.findViewById(R.id.LinkToOsmDoc);
TextView linkToOsmDoc = (TextView) view.findViewById(R.id.LinkToOsmDoc);
linkToOsmDoc.setOnClickListener(new View.OnClickListener() { linkToOsmDoc.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -357,14 +366,79 @@ public class EditingPOIActivity implements DialogProvider {
}); });
linkToOsmDoc.setMovementMethod(LinkMovementMethod.getInstance()); linkToOsmDoc.setMovementMethod(LinkMovementMethod.getInstance());
// final Amenity a = (Amenity) args.getSerializable(KEY_AMENITY); final Amenity a = (Amenity) args.getSerializable(KEY_AMENITY);
// final Node n = (Node) args.getSerializable(KEY_AMENITY_NODE); final Node n = (Node) args.getSerializable(KEY_AMENITY_NODE);
// attachListeners(dialogID, dlg, a, n); dlg.setNegativeButton(R.string.shared_string_cancel, null);
dlg.setPositiveButton(R.string.default_buttons_commit, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Resources resources = view.getResources();
final String msg = n.getId() == -1 ? resources.getString(R.string.poi_action_add) : resources
.getString(R.string.poi_action_change);
OsmPoint.Action action = n.getId() == -1 ? OsmPoint.Action.CREATE : OsmPoint.Action.MODIFY;
String subType = typeText.getText().toString();
if(allTranslatedSubTypes.get(subType.trim()) != null) {
PoiType pt = allTranslatedSubTypes.get(subType);
n.putTag(pt.getOsmTag() , pt.getOsmValue());
if(pt.getOsmTag2() != null) {
n.putTag(pt.getOsmTag2(), pt.getOsmValue2());
}
} else {
n.putTag(a.getType().getDefaultTag(), subType);
}
String name = nameText.getText().toString();
if(name.length() > 0) {
n.putTag(OSMTagKey.NAME.getValue(), name);
}
if (openingHours.getText().toString().length() == 0) {
n.removeTag(OSMTagKey.OPENING_HOURS.getValue());
} else {
n.putTag(OSMTagKey.OPENING_HOURS.getValue(), openingHours.getText().toString());
}
String website = websiteText.getText().toString();
if (website.length() > 0 ){
n.putTag(OSMTagKey.WEBSITE.getValue(),website);
} else {
n.removeTag(OSMTagKey.WEBSITE.getValue());
}
String phone = phoneText.getText().toString();
if (phone.length() > 0 ){
n.putTag(OSMTagKey.PHONE.getValue(),phone);
} else {
n.removeTag(OSMTagKey.PHONE.getValue());
}
String str = streetNameText.getText().toString();
if (str .length() > 0 ){
n.putTag(OSMTagKey.ADDR_STREET.getValue(),str);
} else {
n.removeTag(OSMTagKey.ADDR_STREET.getValue());
}
String hno = hnoText.getText().toString();
if (hno .length() > 0 ){
n.putTag(OSMTagKey.ADDR_HOUSE_NUMBER.getValue(),hno);
} else {
n.removeTag(OSMTagKey.ADDR_HOUSE_NUMBER.getValue());
}
commitNode(action, n, openstreetmapUtil.getEntityInfo(), commentText.getText().toString(), closeChange.isSelected(),
new Runnable() {
@Override
public void run() {
AccessibleToast.makeText(activity, MessageFormat.format(activity.getResources().getString(R.string.poi_action_succeded_template), msg),
Toast.LENGTH_LONG).show();
if (activity instanceof MapActivity) {
((MapActivity) activity).getMapView().refreshMap(true);
}
activity.removeDialog(dialogID);
}
});
}
});
preparePOIDialog(view, args);
attachListeners(view, a, n);
return dlg; return dlg;
} }
private void attachListeners(final int dialogID, final Dialog dlg, final Amenity a, final Node n) { private void attachListeners(final View dlg, final Amenity a, final Node n) {
// DO NOT show on focus with empty text predefined list of subcategories - problems when rotating // DO NOT show on focus with empty text predefined list of subcategories - problems when rotating
typeText.setOnClickListener(new View.OnClickListener() { typeText.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -451,77 +525,6 @@ public class EditingPOIActivity implements DialogProvider {
} }
}); });
((Button)dlg.findViewById(R.id.Cancel)).setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
//we must do remove, because there are two dialogs EDIT,CREATE using same variables!!
activity.removeDialog(dialogID);
}
});
((Button)dlg.findViewById(R.id.Commit)).setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
Resources resources = v.getResources();
final String msg = n.getId() == -1 ? resources.getString(R.string.poi_action_add) : resources
.getString(R.string.poi_action_change);
OsmPoint.Action action = n.getId() == -1 ? OsmPoint.Action.CREATE : OsmPoint.Action.MODIFY;
String subType = typeText.getText().toString();
if(allTranslatedSubTypes.get(subType.trim()) != null) {
PoiType pt = allTranslatedSubTypes.get(subType);
n.putTag(pt.getOsmTag() , pt.getOsmValue());
if(pt.getOsmTag2() != null) {
n.putTag(pt.getOsmTag2(), pt.getOsmValue2());
}
} else {
n.putTag(a.getType().getDefaultTag(), subType);
}
String name = nameText.getText().toString();
if(name.length() > 0) {
n.putTag(OSMTagKey.NAME.getValue(), name);
}
if (openingHours.getText().toString().length() == 0) {
n.removeTag(OSMTagKey.OPENING_HOURS.getValue());
} else {
n.putTag(OSMTagKey.OPENING_HOURS.getValue(), openingHours.getText().toString());
}
String website = websiteText.getText().toString();
if (website.length() > 0 ){
n.putTag(OSMTagKey.WEBSITE.getValue(),website);
} else {
n.removeTag(OSMTagKey.WEBSITE.getValue());
}
String phone = phoneText.getText().toString();
if (phone.length() > 0 ){
n.putTag(OSMTagKey.PHONE.getValue(),phone);
} else {
n.removeTag(OSMTagKey.PHONE.getValue());
}
String str = streetNameText.getText().toString();
if (str .length() > 0 ){
n.putTag(OSMTagKey.ADDR_STREET.getValue(),str);
} else {
n.removeTag(OSMTagKey.ADDR_STREET.getValue());
}
String hno = hnoText.getText().toString();
if (hno .length() > 0 ){
n.putTag(OSMTagKey.ADDR_HOUSE_NUMBER.getValue(),hno);
} else {
n.removeTag(OSMTagKey.ADDR_HOUSE_NUMBER.getValue());
}
commitNode(action, n, openstreetmapUtil.getEntityInfo(), commentText.getText().toString(), closeChange.isSelected(),
new Runnable() {
@Override
public void run() {
AccessibleToast.makeText(activity, MessageFormat.format(activity.getResources().getString(R.string.poi_action_succeded_template), msg),
Toast.LENGTH_LONG).show();
if (activity instanceof MapActivity) {
((MapActivity) activity).getMapView().refreshMap(true);
}
activity.removeDialog(dialogID);
}
});
}
});
} }
private void showSubCategory(Amenity a) { private void showSubCategory(Amenity a) {
@ -646,9 +649,6 @@ public class EditingPOIActivity implements DialogProvider {
public Dialog onCreateDialog(int id) { public Dialog onCreateDialog(int id) {
Bundle args = dialogBundle; Bundle args = dialogBundle;
switch (id) { switch (id) {
case DIALOG_CREATE_POI:
case DIALOG_EDIT_POI:
return createPOIDialog(id, args);
case DIALOG_DELETE_POI: case DIALOG_DELETE_POI:
return createDeleteDialog(args); return createDeleteDialog(args);
case DIALOG_SUB_CATEGORIES: { case DIALOG_SUB_CATEGORIES: {
@ -712,12 +712,6 @@ public class EditingPOIActivity implements DialogProvider {
public void onPrepareDialog(int id, Dialog dialog) { public void onPrepareDialog(int id, Dialog dialog) {
Bundle args = dialogBundle; Bundle args = dialogBundle;
switch (id) { switch (id) {
case DIALOG_CREATE_POI:
preparePOIDialog(id, dialog,args,R.string.poi_create_title);
break;
case DIALOG_EDIT_POI:
preparePOIDialog(id, dialog,args,R.string.poi_edit_title);
break;
case DIALOG_DELETE_POI: case DIALOG_DELETE_POI:
prepareDeleteDialog(dialog,args); prepareDeleteDialog(dialog,args);
break; break;

View file

@ -1,460 +1,32 @@
package net.osmand.plus.osmedit; package net.osmand.plus.osmedit;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import android.support.v4.view.MenuItemCompat;
import android.view.*;
import android.widget.AdapterView;
import net.osmand.access.AccessibleToast;
import net.osmand.osm.edit.EntityInfo;
import net.osmand.osm.edit.Node;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.ProgressImplementation;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.OsmandListActivity;
import net.osmand.plus.osmedit.OsmPoint.Action;
import org.xmlpull.v1.XmlSerializer;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.util.Xml; import android.view.MenuItem;
import android.view.ContextMenu.ContextMenuInfo;
import android.widget.ArrayAdapter; import net.osmand.plus.OsmandApplication;
import android.widget.TextView; import net.osmand.plus.R;
import android.widget.Toast; import net.osmand.plus.activities.ActionBarProgressActivity;
public class LocalOpenstreetmapActivity extends OsmandListActivity {
/** dialogs **/
protected static final int DIALOG_PROGRESS_UPLOAD = 0;
protected static final int MENU_GROUP = 0;
private static final int UPLOAD_ID = 1;
private static final int BACKUP_ID = 2;
private static final int DELETE_ID = 3;
private LocalOpenstreetmapAdapter listAdapter;
private OpenstreetmapsDbHelper dbpoi;
private OsmBugsDbHelper dbbug;
private OpenstreetmapRemoteUtil remotepoi;
private OsmBugsRemoteUtil remotebug;
protected OsmPoint[] toUpload = new OsmPoint[0];
private ArrayList<OsmPoint> dataPoints;
public class LocalOpenstreetmapActivity extends ActionBarProgressActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
((OsmandApplication) getApplication()).applyTheme(this);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.local_openstreetmap); setContentView(R.layout.local_openstreetmap);
getSupportActionBar().setTitle(R.string.shared_string_download);
setSupportProgressBarIndeterminateVisibility(false);
listAdapter = new LocalOpenstreetmapAdapter();
getListView().setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.localosm_child, menu);
}
});
setListAdapter(listAdapter);
dbpoi = new OpenstreetmapsDbHelper(this);
dbbug = new OsmBugsDbHelper(this);
remotepoi = new OpenstreetmapRemoteUtil(this);
remotebug = new OsmBugsRemoteUtil(getMyApplication());
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
createMenuItem(menu, UPLOAD_ID, R.string.local_openstreetmap_uploadall, R.drawable.ic_action_gup_dark, R.drawable.ic_action_gup_dark,
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
createMenuItem(menu, BACKUP_ID, R.string.local_osm_changes_backup, R.drawable.ic_action_gsave_dark, R.drawable.ic_action_gsave_dark,
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
createMenuItem(menu, DELETE_ID, R.string.shared_string_delete_all, R.drawable.ic_action_gdiscard_dark, R.drawable.ic_action_gdiscard_dark,
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
return super.onCreateOptionsMenu(menu);
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == UPLOAD_ID) {
toUpload = dataPoints.toArray(new OsmPoint[0]);
showDialog(DIALOG_PROGRESS_UPLOAD);
return true;
} else if (item.getItemId() == BACKUP_ID) {
new BackupOpenstreetmapPointAsyncTask().execute(dataPoints.toArray(new OsmPoint[0]));
return true;
} else if (item.getItemId() == DELETE_ID) {
Builder b = new AlertDialog.Builder(this);
b.setMessage(getString(R.string.local_osm_changes_delete_all_confirm, dataPoints.size()));
b.setPositiveButton(R.string.shared_string_delete, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Iterator<OsmPoint> it = dataPoints.iterator();
while(it.hasNext()) {
OsmPoint info = it.next();
if (info.getGroup() == OsmPoint.Group.POI) {
dbpoi.deletePOI((OpenstreetmapPoint) info);
} else if (info.getGroup() == OsmPoint.Group.BUG) {
dbbug.deleteAllBugModifications((OsmNotesPoint) info);
}
it.remove();
listAdapter.delete(info);
}
listAdapter.notifyDataSetChanged();
}
});
b.setNegativeButton(R.string.shared_string_cancel, null);
b.show();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onResume() {
super.onResume();
dataPoints = new ArrayList<OsmPoint>();
List<OpenstreetmapPoint> l1 = dbpoi.getOpenstreetmapPoints();
List<OsmNotesPoint> l2 = dbbug.getOsmbugsPoints();
dataPoints.addAll(l1);
dataPoints.addAll(l2);
listAdapter.clear();
for (OpenstreetmapPoint p : l1) {
listAdapter.add(p);
}
for (OsmNotesPoint p : l2) {
listAdapter.add(p);
}
listAdapter.notifyDataSetChanged();
}
@Override
public boolean onContextItemSelected(MenuItem item) {
int pos = ((android.widget.AdapterView.AdapterContextMenuInfo)item.getMenuInfo()).position;
int itemId = item.getItemId(); int itemId = item.getItemId();
if(itemId == R.id.showmod) { switch (itemId) {
OsmandSettings settings = getMyApplication().getSettings(); case android.R.id.home:
OsmPoint info = listAdapter.getItem(pos); finish();
settings.setMapLocationToShow(info.getLatitude(), info.getLongitude(), settings.getLastKnownMapZoom()); return true;
MapActivity.launchMapActivityMoveToTop(LocalOpenstreetmapActivity.this);
return true;
} else if(itemId == R.id.deletemod) {
OsmPoint info = listAdapter.getItem(pos);
if (info.getGroup() == OsmPoint.Group.POI) {
dbpoi.deletePOI((OpenstreetmapPoint) info);
} else if (info.getGroup() == OsmPoint.Group.BUG) {
dbbug.deleteAllBugModifications((OsmNotesPoint) info);
}
listAdapter.delete(info);
return true;
} else if (itemId == R.id.uploadmods) {
toUpload = new OsmPoint[]{ listAdapter.getItem(pos)};
showDialog(DIALOG_PROGRESS_UPLOAD);
return true;
} }
return false;
return super.onContextItemSelected(item);
}
@Override
protected void onDestroy() {
super.onDestroy();
if (dbpoi != null) {
dbpoi.close();
}
if (dbbug != null) {
dbbug.close();
}
}
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case DIALOG_PROGRESS_UPLOAD:
return ProgressImplementation.createProgressDialog(
LocalOpenstreetmapActivity.this,
getString(R.string.uploading),
getString(R.string.local_openstreetmap_uploading),
ProgressDialog.STYLE_HORIZONTAL).getDialog();
}
return null;
}
@Override
protected void onPrepareDialog(int id, Dialog dialog, Bundle args) {
switch (id) {
case DIALOG_PROGRESS_UPLOAD:
UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask((ProgressDialog) dialog, remotepoi,
remotebug, toUpload.length);
uploadTask.execute(toUpload);
break;
}
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
}
public class BackupOpenstreetmapPointAsyncTask extends AsyncTask<OsmPoint, OsmPoint, String> {
private File osmchange;
public BackupOpenstreetmapPointAsyncTask() {
OsmandApplication app = LocalOpenstreetmapActivity.this.getMyApplication();
osmchange = app.getAppPath("poi_modification.osc");
}
@Override
protected String doInBackground(OsmPoint... points) {
FileOutputStream out = null;
try {
out = new FileOutputStream(osmchange);
XmlSerializer sz = Xml.newSerializer();
sz.setOutput(out, "UTF-8");
sz.startDocument("UTF-8", true);
sz.startTag("", "osmChange");
sz.attribute("", "generator", "OsmAnd");
sz.attribute("", "version", "0.6");
sz.startTag("", "create");
writeContent(sz, points, OsmPoint.Action.CREATE);
sz.endTag("", "create");
sz.startTag("", "modify");
writeContent(sz, points, OsmPoint.Action.MODIFY);
sz.endTag("", "modify");
sz.startTag("", "delete");
writeContent(sz, points, OsmPoint.Action.DELETE);
sz.endTag("", "delete");
sz.endTag("", "osmChange");
sz.endDocument();
} catch (Exception e) {
return e.getMessage();
} finally {
try {
if(out!= null) out.close();
} catch (IOException e) {
}
}
return null;
}
private void writeContent(XmlSerializer sz, OsmPoint[] points, Action a) throws IllegalArgumentException, IllegalStateException, IOException {
for (OsmPoint point : points) {
if (point.getGroup() == OsmPoint.Group.POI) {
OpenstreetmapPoint p = (OpenstreetmapPoint) point;
if (p.getAction() == a) {
sz.startTag("", "node");
sz.attribute("", "lat", p.getLatitude() + "");
sz.attribute("", "lon", p.getLongitude() + "");
sz.attribute("", "id", p.getId() + "");
sz.attribute("", "version", "1");
for (String tag : p.getEntity().getTagKeySet()) {
String val = p.getEntity().getTag(tag);
sz.startTag("", "tag");
sz.attribute("", "k", tag);
sz.attribute("", "v", val);
sz.endTag("", "tag");
}
sz.endTag("", "node");
}
} else if (point.getGroup() == OsmPoint.Group.BUG) {
OsmNotesPoint p = (OsmNotesPoint) point;
if (p.getAction() == a) {
sz.startTag("", "note");
sz.attribute("", "lat", p.getLatitude() + "");
sz.attribute("", "lon", p.getLongitude() + "");
sz.attribute("", "id", p.getId() + "");
sz.startTag("", "comment");
sz.attribute("", "text", p.getText() +"");
sz.endTag("", "comment");
sz.endTag("", "note");
}
}
}
}
@Override
protected void onPreExecute() {
LocalOpenstreetmapActivity.this.setProgressBarIndeterminateVisibility(true);
}
@Override
protected void onPostExecute(String result) {
LocalOpenstreetmapActivity.this.setProgressBarIndeterminateVisibility(false);
if (result != null) {
AccessibleToast.makeText(LocalOpenstreetmapActivity.this, getString(R.string.local_osm_changes_backup_failed) + " " + result, Toast.LENGTH_LONG).show();
} else {
AccessibleToast.makeText(LocalOpenstreetmapActivity.this, getString(R.string.local_osm_changes_backup_successful, osmchange.getAbsolutePath()), Toast.LENGTH_LONG).show();
}
}
}
public class UploadOpenstreetmapPointAsyncTask extends AsyncTask<OsmPoint, OsmPoint, Integer> {
private ProgressDialog progress;
private OpenstreetmapRemoteUtil remotepoi;
private OsmBugsRemoteUtil remotebug;
private int listSize = 0;
private boolean interruptUploading = false;
public UploadOpenstreetmapPointAsyncTask(ProgressDialog progress, OpenstreetmapRemoteUtil remotepoi, OsmBugsRemoteUtil remotebug,
int listSize) {
this.progress = progress;
this.remotepoi = remotepoi;
this.remotebug = remotebug;
this.listSize = listSize;
}
@Override
protected Integer doInBackground(OsmPoint... points) {
int uploaded = 0;
for (OsmPoint point : points) {
if (interruptUploading)
break;
if (point.getGroup() == OsmPoint.Group.POI) {
OpenstreetmapPoint p = (OpenstreetmapPoint) point;
EntityInfo entityInfo = null;
if (OsmPoint.Action.CREATE != p.getAction()) {
entityInfo = remotepoi.loadNode(p.getEntity());
}
Node n = remotepoi.commitNodeImpl(p.getAction(), p.getEntity(), entityInfo, p.getComment(), false);
if (n != null) {
dbpoi.deletePOI(p);
publishProgress(p);
uploaded++;
}
} else if (point.getGroup() == OsmPoint.Group.BUG) {
OsmNotesPoint p = (OsmNotesPoint) point;
boolean success = false;
if (p.getAction() == OsmPoint.Action.CREATE) {
success = remotebug.createNewBug(p.getLatitude(), p.getLongitude(), p.getText()) == null;
} else if (p.getAction() == OsmPoint.Action.MODIFY) {
success = remotebug.addingComment(p.getId(), p.getText()) == null;
} else if (p.getAction() == OsmPoint.Action.DELETE) {
success = remotebug.closingBug(p.getId(), p.getText()) == null;
}
if (success) {
dbbug.deleteAllBugModifications(p);
uploaded++;
publishProgress(p);
}
}
}
return uploaded;
}
@Override
protected void onPreExecute() {
interruptUploading = false;
progress.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
UploadOpenstreetmapPointAsyncTask.this.setInterruptUploading(true);
}
});
progress.setIndeterminate(false);
progress.setMax(listSize);
progress.setProgress(0);
}
@Override
protected void onPostExecute(Integer result) {
listAdapter.notifyDataSetChanged();
if (result != null) {
AccessibleToast.makeText(LocalOpenstreetmapActivity.this,
MessageFormat.format(getString(R.string.local_openstreetmap_were_uploaded), result), Toast.LENGTH_LONG)
.show();
}
removeDialog(DIALOG_PROGRESS_UPLOAD);
}
public void setInterruptUploading(boolean b) {
interruptUploading = b;
}
@Override
protected void onProgressUpdate(OsmPoint... points) {
for(OsmPoint p : points) {
listAdapter.delete(p);
progress.incrementProgressBy(1);
}
}
}
protected class LocalOpenstreetmapAdapter extends ArrayAdapter<OsmPoint> {
public LocalOpenstreetmapAdapter() {
super(LocalOpenstreetmapActivity.this, net.osmand.plus.R.layout.local_openstreetmap_list_item);
}
public void delete(OsmPoint i) {
dataPoints.remove(i);
remove(i);
listAdapter.notifyDataSetChanged();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
final OsmPoint child = getItem(position);
if (v == null ) {
LayoutInflater inflater = getLayoutInflater();
v = inflater.inflate(net.osmand.plus.R.layout.local_openstreetmap_list_item, parent, false);
}
TextView viewName = ((TextView) v.findViewById(R.id.local_openstreetmap_name));
String idPrefix = (child.getGroup() == OsmPoint.Group.POI ? "POI " : "Bug ") + " id: " + child.getId();
if (child.getGroup() == OsmPoint.Group.POI)
viewName.setText(idPrefix + " (" + ((OpenstreetmapPoint) child).getSubtype() + ") " + ((OpenstreetmapPoint) child).getName());
else if (child.getGroup() == OsmPoint.Group.BUG)
viewName.setText(idPrefix + " (" + ((OsmNotesPoint) child).getAuthor() + ") " + ((OsmNotesPoint) child).getText());
if (child.getAction() == OsmPoint.Action.CREATE) {
viewName.setTextColor(getResources().getColor(R.color.color_ok));
} else if (child.getAction() == OsmPoint.Action.MODIFY) {
viewName.setTextColor(getResources().getColor(R.color.color_update));
} else if (child.getAction() == OsmPoint.Action.DELETE) {
viewName.setTextColor(getResources().getColor(R.color.color_warning));
}
return v;
}
} }
} }

View file

@ -67,7 +67,6 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
protected static final String KEY_LATITUDE = "latitude"; protected static final String KEY_LATITUDE = "latitude";
protected static final String KEY_LONGITUDE = "longitude"; protected static final String KEY_LONGITUDE = "longitude";
protected static final String KEY_BUG = "bug"; protected static final String KEY_BUG = "bug";
private static final int DIALOG_OPEN_BUG = 300;
private static final int DIALOG_COMMENT_BUG = 301; private static final int DIALOG_COMMENT_BUG = 301;
private static final int DIALOG_CLOSE_BUG = 302; private static final int DIALOG_CLOSE_BUG = 302;
private static Bundle dialogBundle = new Bundle(); private static Bundle dialogBundle = new Bundle();
@ -328,7 +327,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
dialogBundle.putString(KEY_MESSAGE, message); dialogBundle.putString(KEY_MESSAGE, message);
OsmandSettings settings = activity.getMyApplication().getSettings(); OsmandSettings settings = activity.getMyApplication().getSettings();
dialogBundle.putString(KEY_AUTHOR, settings.USER_NAME.get()); dialogBundle.putString(KEY_AUTHOR, settings.USER_NAME.get());
activity.showDialog(DIALOG_OPEN_BUG); createOpenBugDialog(dialogBundle).show();
} }
private void prepareOpenBugDialog(Dialog dlg, Bundle args) { private void prepareOpenBugDialog(Dialog dlg, Bundle args) {
@ -548,8 +547,6 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
public Dialog onCreateDialog(int id) { public Dialog onCreateDialog(int id) {
Bundle args = dialogBundle; Bundle args = dialogBundle;
switch (id) { switch (id) {
case DIALOG_OPEN_BUG:
return createOpenBugDialog(args);
case DIALOG_COMMENT_BUG: case DIALOG_COMMENT_BUG:
return createCommentBugDialog(args); return createCommentBugDialog(args);
case DIALOG_CLOSE_BUG: case DIALOG_CLOSE_BUG:
@ -560,11 +557,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
@Override @Override
public void onPrepareDialog(int id, Dialog dialog) { public void onPrepareDialog(int id, Dialog dialog) {
Bundle args = dialogBundle;
switch (id) { switch (id) {
case DIALOG_OPEN_BUG:
prepareOpenBugDialog(dialog, args);
break;
case DIALOG_COMMENT_BUG: case DIALOG_COMMENT_BUG:
((EditText)dialog.findViewById(R.id.BugMessage)).setText(""); ((EditText)dialog.findViewById(R.id.BugMessage)).setText("");
break; break;

View file

@ -3,10 +3,14 @@ package net.osmand.plus.osmedit;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.ListFragment; import android.support.v4.app.ListFragment;
import android.support.v4.view.MenuItemCompat; import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.view.ActionMode;
import android.support.v7.widget.PopupMenu; import android.support.v7.widget.PopupMenu;
import android.util.Xml; import android.util.Xml;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -18,16 +22,19 @@ import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import net.osmand.access.AccessibleToast; import net.osmand.access.AccessibleToast;
import net.osmand.data.PointDescription;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.ProgressImplementation; import net.osmand.plus.ProgressImplementation;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.ActionBarProgressActivity;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dialogs.DirectionsDialogs; import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.helpers.ScreenOrientationHelper; import net.osmand.plus.helpers.ScreenOrientationHelper;
@ -52,14 +59,19 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
private ArrayList<OsmPoint> dataPoints; private ArrayList<OsmPoint> dataPoints;
private OsmEditsAdapter listAdapter; private OsmEditsAdapter listAdapter;
private boolean selectionMode = false;
private OpenstreetmapsDbHelper dbpoi; private OpenstreetmapsDbHelper dbpoi;
private OsmBugsDbHelper dbbug; private OsmBugsDbHelper dbbug;
private OpenstreetmapRemoteUtil remotepoi; private OpenstreetmapRemoteUtil remotepoi;
private OsmBugsRemoteUtil remotebug; private OsmBugsRemoteUtil remotebug;
private ActionMode actionMode;
protected OsmPoint[] toUpload = new OsmPoint[0]; protected OsmPoint[] toUpload = new OsmPoint[0];
private ArrayList<OsmPoint> osmEditsSelected = new ArrayList<>();
ProgressDialog dialog; ProgressDialog dialog;
@Override @Override
@ -83,24 +95,23 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
menu.clear(); menu.clear();
if (ScreenOrientationHelper.isOrientationPortrait(getActivity())) { if (ScreenOrientationHelper.isOrientationPortrait(getActivity())) {
menu = ((FavoritesActivity) getActivity()).getClearToolbar(true).getMenu(); menu = ((ActionBarProgressActivity) getActivity()).getClearToolbar(true).getMenu();
} else { } else {
((FavoritesActivity) getActivity()).getClearToolbar(false); ((ActionBarProgressActivity) getActivity()).getClearToolbar(false);
} }
MenuItem item = menu.add(R.string.local_openstreetmap_uploadall). MenuItem item = menu.add(R.string.local_openstreetmap_uploadall).
setIcon(R.drawable.ic_action_export); setIcon(R.drawable.ic_action_export);
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override @Override
public boolean onMenuItemClick(MenuItem item) { public boolean onMenuItemClick(MenuItem item) {
toUpload = dataPoints.toArray(new OsmPoint[0]); enterUploadMode();
showUploadItemsDialog();
return true; return true;
} }
}); });
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
item = menu.add(R.string.local_osm_changes_backup). item = menu.add(R.string.local_osm_changes_backup).
setIcon(R.drawable.ic_action_gsave_dark); setIcon(R.drawable.ic_action_gshare_dark);
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override @Override
@ -115,32 +126,139 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override @Override
public boolean onMenuItemClick(MenuItem item) { public boolean onMenuItemClick(MenuItem item) {
AlertDialog.Builder b = new AlertDialog.Builder(getActivity()); enterDeleteMode();
b.setMessage(getString(R.string.local_osm_changes_delete_all_confirm, dataPoints.size()));
b.setPositiveButton(R.string.shared_string_delete, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Iterator<OsmPoint> it = dataPoints.iterator();
while(it.hasNext()) {
OsmPoint info = it.next();
if (info.getGroup() == OsmPoint.Group.POI) {
dbpoi.deletePOI((OpenstreetmapPoint) info);
} else if (info.getGroup() == OsmPoint.Group.BUG) {
dbbug.deleteAllBugModifications((OsmNotesPoint) info);
}
it.remove();
listAdapter.delete(info);
}
listAdapter.notifyDataSetChanged();
}
});
b.setNegativeButton(R.string.shared_string_cancel, null);
b.show();
return true; return true;
} }
}); });
} }
private void enterUploadMode() {
actionMode = getActionBarActivity().startSupportActionMode(new ActionMode.Callback() {
@Override
public boolean onCreateActionMode(final ActionMode mode, Menu menu) {
enableSelectionMode(true);
MenuItem item = menu.add(R.string.local_openstreetmap_uploadall).
setIcon(R.drawable.ic_action_export);
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
uploadItems(osmEditsSelected.toArray(new OsmPoint[0]));
mode.finish();
return true;
}
});
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
osmEditsSelected.clear();
listAdapter.notifyDataSetInvalidated();
updateSelectionMode(mode);
return true;
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return false;
}
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
return false;
}
@Override
public void onDestroyActionMode(ActionMode mode) {
enableSelectionMode(false);
listAdapter.notifyDataSetInvalidated();
}
});
}
private void enterDeleteMode() {
actionMode = getActionBarActivity().startSupportActionMode(new ActionMode.Callback() {
@Override
public boolean onCreateActionMode(final ActionMode mode, Menu menu) {
enableSelectionMode(true);
MenuItem item = menu.add(R.string.shared_string_delete_all).setIcon(R.drawable.ic_action_delete_dark);
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
deleteItems(osmEditsSelected);
mode.finish();
return true;
}
});
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
osmEditsSelected.clear();
listAdapter.notifyDataSetInvalidated();
updateSelectionMode(mode);
return true;
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return false;
}
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
return false;
}
@Override
public void onDestroyActionMode(ActionMode mode) {
enableSelectionMode(false);
listAdapter.notifyDataSetInvalidated();
}
});
}
private void updateSelectionMode(ActionMode m) {
if(osmEditsSelected.size() > 0) {
m.setTitle(osmEditsSelected.size() + " " + getMyApplication().getString(R.string.shared_string_selected_lowercase));
} else{
m.setTitle("");
}
}
private void enableSelectionMode(boolean selectionMode) {
this.selectionMode = selectionMode;
((FavoritesActivity)getActivity()).setToolbarVisibility(!selectionMode);
}
public ActionBarActivity getActionBarActivity() {
if (getActivity() instanceof ActionBarActivity) {
return (ActionBarActivity) getActivity();
}
return null;
}
private void deleteItems(final ArrayList<OsmPoint> points) {
AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
b.setMessage(getString(R.string.local_osm_changes_delete_all_confirm, points.size()));
b.setPositiveButton(R.string.shared_string_delete, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Iterator<OsmPoint> it = points.iterator();
while (it.hasNext()) {
OsmPoint info = it.next();
if (info.getGroup() == OsmPoint.Group.POI) {
dbpoi.deletePOI((OpenstreetmapPoint) info);
} else if (info.getGroup() == OsmPoint.Group.BUG) {
dbbug.deleteAllBugModifications((OsmNotesPoint) info);
}
it.remove();
listAdapter.delete(info);
}
listAdapter.notifyDataSetChanged();
}
});
b.setNegativeButton(R.string.shared_string_cancel, null);
b.show();
}
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
@ -163,10 +281,10 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
} }
public static void getOsmEditView(View v, OsmPoint child, OsmandApplication app){ public static void getOsmEditView(View v, OsmPoint child, OsmandApplication app) {
TextView viewName = ((TextView) v.findViewById(R.id.name)); TextView viewName = ((TextView) v.findViewById(R.id.name));
ImageView icon = (ImageView) v.findViewById(R.id.icon); ImageView icon = (ImageView) v.findViewById(R.id.icon);
String idPrefix = (child.getGroup() == OsmPoint.Group.POI ? "POI " : "Bug ") + " id: " + child.getId(); String idPrefix = getPrefix(child);
if (child.getGroup() == OsmPoint.Group.POI) { if (child.getGroup() == OsmPoint.Group.POI) {
viewName.setText(idPrefix + " (" + ((OpenstreetmapPoint) child).getSubtype() + ") " + ((OpenstreetmapPoint) child).getName()); viewName.setText(idPrefix + " (" + ((OpenstreetmapPoint) child).getSubtype() + ") " + ((OpenstreetmapPoint) child).getName());
icon.setImageDrawable(app.getIconsCache(). icon.setImageDrawable(app.getIconsCache().
@ -211,15 +329,55 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
v.findViewById(R.id.play).setVisibility(View.GONE); v.findViewById(R.id.play).setVisibility(View.GONE);
final CheckBox ch = (CheckBox) v.findViewById(R.id.check_local_index);
View options = v.findViewById(R.id.options);
if(selectionMode) {
options.setVisibility(View.GONE);
ch.setVisibility(View.VISIBLE);
ch.setChecked(osmEditsSelected.contains(child));
v.findViewById(R.id.icon).setVisibility(View.GONE);
ch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onItemSelect(ch, child);
}
});
} else {
v.findViewById(R.id.icon).setVisibility(View.VISIBLE);
options.setVisibility(View.VISIBLE);
ch.setVisibility(View.GONE);
}
v.findViewById(R.id.options).setOnClickListener(new View.OnClickListener() { v.findViewById(R.id.options).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
openPopUpMenu(v, child); openPopUpMenu(v, child);
} }
}); });
v.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (selectionMode) {
ch.setChecked(!ch.isChecked());
onItemSelect(ch, child);
} else {
showOnMap(child);
}
}
});
return v; return v;
} }
public void onItemSelect(CheckBox ch, OsmPoint child) {
if (ch.isChecked()) {
osmEditsSelected.add(child);
} else {
osmEditsSelected.remove(child);
}
updateSelectionMode(actionMode);
}
} }
private void openPopUpMenu(View v, final OsmPoint info) { private void openPopUpMenu(View v, final OsmPoint info) {
@ -242,13 +400,11 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override @Override
public boolean onMenuItemClick(MenuItem item) { public boolean onMenuItemClick(MenuItem item) {
if (info.getGroup() == OsmPoint.Group.POI) { ArrayList<OsmPoint> points = new ArrayList<OsmPoint>();
dbpoi.deletePOI((OpenstreetmapPoint) info); points.add(info);
} else if (info.getGroup() == OsmPoint.Group.BUG) { deleteItems(new ArrayList<OsmPoint>(points));
dbbug.deleteAllBugModifications((OsmNotesPoint) info);
}
listAdapter.delete(info);
return true; return true;
} }
}); });
item = optionsMenu.getMenu().add(R.string.local_openstreetmap_upload). item = optionsMenu.getMenu().add(R.string.local_openstreetmap_upload).
@ -256,8 +412,7 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override @Override
public boolean onMenuItemClick(MenuItem item) { public boolean onMenuItemClick(MenuItem item) {
toUpload = new OsmPoint[]{info}; uploadItems(new OsmPoint[]{info});
showUploadItemsDialog();
return true; return true;
} }
}); });
@ -268,7 +423,21 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
return (OsmandApplication) getActivity().getApplication(); return (OsmandApplication) getActivity().getApplication();
} }
private void showUploadItemsDialog(){ private void uploadItems(final OsmPoint[] items){
AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
b.setMessage(getString(R.string.local_osm_changes_upload_all_confirm, items.length));
b.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
toUpload = items;
showUploadItemsProgressDialog();
}
});
b.setNegativeButton(R.string.shared_string_cancel, null);
b.show();
}
private void showUploadItemsProgressDialog() {
dialog = ProgressImplementation.createProgressDialog( dialog = ProgressImplementation.createProgressDialog(
getActivity(), getActivity(),
getString(R.string.uploading), getString(R.string.uploading),
@ -320,7 +489,7 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
return e.getMessage(); return e.getMessage();
} finally { } finally {
try { try {
if(out!= null) out.close(); if (out != null) out.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -356,7 +525,7 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
sz.attribute("", "lon", p.getLongitude() + ""); sz.attribute("", "lon", p.getLongitude() + "");
sz.attribute("", "id", p.getId() + ""); sz.attribute("", "id", p.getId() + "");
sz.startTag("", "comment"); sz.startTag("", "comment");
sz.attribute("", "text", p.getText() +""); sz.attribute("", "text", p.getText() + "");
sz.endTag("", "comment"); sz.endTag("", "comment");
sz.endTag("", "note"); sz.endTag("", "note");
} }
@ -376,18 +545,23 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
if (result != null) { if (result != null) {
AccessibleToast.makeText(getActivity(), getString(R.string.local_osm_changes_backup_failed) + " " + result, Toast.LENGTH_LONG).show(); AccessibleToast.makeText(getActivity(), getString(R.string.local_osm_changes_backup_failed) + " " + result, Toast.LENGTH_LONG).show();
} else { } else {
AccessibleToast.makeText(getActivity(), getString(R.string.local_osm_changes_backup_successful, osmchange.getAbsolutePath()), Toast.LENGTH_LONG).show(); final Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_fav_subject));
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(osmchange));
sendIntent.setType("text/plain");
startActivity(sendIntent);
} }
} }
} }
@Override @Override
public void uploadUpdated(OsmPoint point){ public void uploadUpdated(OsmPoint point) {
listAdapter.delete(point); listAdapter.delete(point);
} }
@Override @Override
public void uploadEnded(Integer result){ public void uploadEnded(Integer result) {
listAdapter.notifyDataSetChanged(); listAdapter.notifyDataSetChanged();
if (result != null) { if (result != null) {
AccessibleToast.makeText(getActivity(), AccessibleToast.makeText(getActivity(),
@ -397,4 +571,16 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
dialog.dismiss(); dialog.dismiss();
} }
private void showOnMap(OsmPoint osmPoint) {
boolean isOsmPoint = osmPoint instanceof OpenstreetmapPoint;
String type = osmPoint.getGroup() == OsmPoint.Group.POI ? PointDescription.POINT_TYPE_POI : PointDescription.POINT_TYPE_OSM_BUG;
String name = (isOsmPoint ? ((OpenstreetmapPoint) osmPoint).getName() : ((OsmNotesPoint) osmPoint).getText());
getMyApplication().getSettings().setMapLocationToShow(osmPoint.getLatitude(), osmPoint.getLongitude(), 15,
new PointDescription(type, name), true, osmPoint); //$NON-NLS-1$
MapActivity.launchMapActivityMoveToTop(getActivity());
}
public static String getPrefix(OsmPoint osmPoint) {
return (osmPoint.getGroup() == OsmPoint.Group.POI ? "POI " : "Bug ") + " id: " + osmPoint.getId();
}
} }

View file

@ -2,6 +2,7 @@ package net.osmand.plus.osmo;
import android.content.Intent; import android.content.Intent;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -11,14 +12,20 @@ import android.widget.ImageButton;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import net.osmand.Location;
import net.osmand.data.PointDescription;
import net.osmand.plus.IconsCache; import net.osmand.plus.IconsCache;
import net.osmand.plus.NavigationService; import net.osmand.plus.NavigationService;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashBaseFragment; import net.osmand.plus.dashboard.DashBaseFragment;
import net.osmand.plus.helpers.FontCache; import net.osmand.plus.helpers.FontCache;
import java.util.ArrayList;
import java.util.List;
/** /**
* Created by Denis * Created by Denis
* on 20.01.2015. * on 20.01.2015.
@ -79,19 +86,19 @@ public class DashOsmoFragment extends DashBaseFragment {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked) { if (isChecked) {
if (plugin != null && plugin.getTracker() != null){ if (plugin != null && plugin.getTracker() != null) {
plugin.getTracker().enableTracker(); plugin.getTracker().enableTracker();
} }
app.startNavigationService(NavigationService.USED_BY_LIVE); app.startNavigationService(NavigationService.USED_BY_LIVE);
//interval setting not needed here, handled centrally in app.startNavigationService //interval setting not needed here, handled centrally in app.startNavigationService
//app.getSettings().SERVICE_OFF_INTERVAL.set(0); //app.getSettings().SERVICE_OFF_INTERVAL.set(0);
} else { } else {
if (plugin != null && plugin.getTracker() != null){ if (plugin != null && plugin.getTracker() != null) {
plugin.getTracker().disableTracker(); plugin.getTracker().disableTracker();
} }
if (app.getNavigationService() != null) { if (app.getNavigationService() != null) {
app.getNavigationService().stopIfNeeded(app,NavigationService.USED_BY_LIVE); app.getNavigationService().stopIfNeeded(app, NavigationService.USED_BY_LIVE);
} }
} }
updateStatus(); updateStatus();
@ -109,32 +116,66 @@ public class DashOsmoFragment extends DashBaseFragment {
updateStatus(); updateStatus();
} }
private void updateStatus(){ private void updateStatus() {
View header = getView(); View header = getView();
if(getView() == null) { if (getView() == null) {
return; return;
} }
CompoundButton trackr = (CompoundButton) header.findViewById(R.id.check_item); CompoundButton trackr = (CompoundButton) header.findViewById(R.id.check_item);
if(plugin != null && plugin.getTracker() != null){ if (plugin != null && plugin.getTracker() != null) {
trackr.setChecked(plugin.getTracker().isEnabledTracker()); trackr.setChecked(plugin.getTracker().isEnabledTracker());
} }
updateConnectedDevices(header);
} }
private void synchronizeGroups(boolean clear){ private void updateConnectedDevices(View mainView) {
View mainView = getView(); OsMoGroups grps = plugin.getGroups();
OsMoGroupsStorage.OsMoGroup mainGroup = null;
LinearLayout items = (LinearLayout) mainView.findViewById(R.id.items); for (OsMoGroupsStorage.OsMoGroup grp : grps.getGroups()) {
items.removeAllViews(); if (grp.getGroupId() == null) {
if (clear) { mainGroup = grp;
break;
}
}
LinearLayout contentList = (LinearLayout) mainView.findViewById(R.id.items);
contentList.removeAllViews();
if (mainGroup == null) {
return; return;
} }
}
private void showProgress(boolean show) { List<OsMoGroupsStorage.OsMoDevice> devices =
if (getView() != null){ new ArrayList<>(mainGroup.getVisibleGroupUsers(plugin.getService().getMyGroupTrackerId()));
getView().findViewById(R.id.progress).setVisibility(show ? View.VISIBLE : View.GONE);
while (devices.size() > 3){
devices.remove(devices.size() - 1);
}
Drawable markerIcon = getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_marker_dark);
LayoutInflater inflater = getActivity().getLayoutInflater();
for (final OsMoGroupsStorage.OsMoDevice device : devices) {
View v = inflater.inflate(R.layout.dash_osmo_item, null, false);
ImageButton showOnMap = (ImageButton)v.findViewById(R.id.show_on_map);
showOnMap.setImageDrawable(markerIcon);
final String name = device.getVisibleName();
showOnMap.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Location loc = device.getLastLocation();
getMyApplication().getSettings().setMapLocationToShow(loc.getLatitude(),
loc.getLongitude(), 15,
new PointDescription(PointDescription.POINT_TYPE_MARKER, name),
false, device); //$NON-NLS-1$
MapActivity.launchMapActivityMoveToTop(getActivity());
}
});
((TextView)v.findViewById(R.id.name)).setText(name);
contentList.addView(v);
} }
} }
} }

View file

@ -54,7 +54,7 @@ public class DashParkingFragment extends DashLocationFragment {
public void onClick(View v) { public void onClick(View v) {
LatLon point = plugin.getParkingPosition(); LatLon point = plugin.getParkingPosition();
getMyApplication().getSettings().setMapLocationToShow(point.getLatitude(), point.getLongitude(), getMyApplication().getSettings().setMapLocationToShow(point.getLatitude(), point.getLongitude(),
15, new PointDescription(PointDescription.POINT_TYPE_FAVORITE, plugin.getParkingDescription(getActivity())), true, 15, new PointDescription(PointDescription.POINT_TYPE_FAVORITE, plugin.getParkingDescription(getActivity())), false,
point); //$NON-NLS-1$ point); //$NON-NLS-1$
MapActivity.launchMapActivityMoveToTop(getActivity()); MapActivity.launchMapActivityMoveToTop(getActivity());
} }
@ -83,31 +83,33 @@ public class DashParkingFragment extends DashLocationFragment {
LatLon loc = getDefaultLocation(); LatLon loc = getDefaultLocation();
LatLon position = plugin.getParkingPosition(); LatLon position = plugin.getParkingPosition();
boolean limited = plugin.getParkingType(); boolean limited = plugin.getParkingType();
String parking_name = limited ? String descr;
getString(R.string.parking_place_limited) : getString(R.string.parking_place);
TextView timeLeft = (TextView) mainView.findViewById(R.id.time_left);
if (limited) { if (limited) {
descr = getString(R.string.parking_place_limited) + " " + plugin.getFormattedTime( plugin.getParkingTime(), getActivity());
long endtime = plugin.getParkingTime(); long endtime = plugin.getParkingTime();
long currTime = Calendar.getInstance().getTimeInMillis(); long currTime = Calendar.getInstance().getTimeInMillis();
long timeDiff = endtime - currTime; long timeDiff = endtime - currTime;
String time = getFormattedTime(timeDiff); String time = getFormattedTime(timeDiff) + " ";
TextView timeLeft = (TextView) mainView.findViewById(R.id.time_left); TextView leftLbl = (TextView) mainView.findViewById(R.id.left_lbl);
TextView leftLabel = (TextView) mainView.findViewById(R.id.left_lbl);
timeLeft.setText(time); timeLeft.setText(time);
if (timeDiff < 0) { if (timeDiff < 0) {
timeLeft.setTextColor(Color.RED); timeLeft.setText(time);
leftLabel.setTextColor(Color.RED); leftLbl.setTextColor(getResources().getColor(R.color.parking_outdated_color));
leftLabel.setText(R.string.osmand_parking_outdated); leftLbl.setText(getString(R.string.osmand_parking_overdue));
} else { } else {
timeLeft.setTextColor(Color.WHITE); timeLeft.setText(time);
leftLabel.setTextColor(Color.WHITE); leftLbl.setTextColor(Color.WHITE);
leftLabel.setText(R.string.osmand_parking_time_left); leftLbl.setText(getString(R.string.osmand_parking_time_left));
} }
mainView.findViewById(R.id.left_lbl).setVisibility(View.VISIBLE); timeLeft.setVisibility(View.VISIBLE);
} else { } else {
((TextView) mainView.findViewById(R.id.time_left)).setText(""); descr = getString(R.string.parking_place);
mainView.findViewById(R.id.left_lbl).setVisibility(View.GONE); timeLeft.setText("");
timeLeft.setVisibility(View.GONE);
} }
((TextView) mainView.findViewById(R.id.name)).setText(parking_name); ((TextView) mainView.findViewById(R.id.name)).setText(descr);
ImageView direction = (ImageView) mainView.findViewById(R.id.direction_icon); ImageView direction = (ImageView) mainView.findViewById(R.id.direction_icon);
if (loc != null) { if (loc != null) {
DashLocationView dv = new DashLocationView(direction, (TextView) mainView.findViewById(R.id.distance), position); DashLocationView dv = new DashLocationView(direction, (TextView) mainView.findViewById(R.id.distance), position);