Merge accessibility branch + update imports
This commit is contained in:
parent
a672edf05d
commit
26f9216a8a
87 changed files with 1610 additions and 226 deletions
12
OsmAnd/res/layout/alert.xml
Normal file
12
OsmAnd/res/layout/alert.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/layout"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||||
|
android:orientation="vertical" android:background="@color/color_light_gray">
|
||||||
|
|
||||||
|
<TextView android:id="@+id/message" android:focusable="true"
|
||||||
|
android:layout_marginLeft="4dp" android:layout_marginRight="4dp"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||||
|
android:textColor="@color/color_black" android:textSize="18sp" android:gravity="fill_horizontal"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
<TextView android:id="@+id/TextView" android:layout_width="fill_parent" android:textSize="18dp" android:layout_height="wrap_content" android:gravity="center" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android:text="@string/recalculate_route_to_your_location"></TextView>
|
<TextView android:id="@+id/TextView" android:layout_width="fill_parent" android:textSize="18dp" android:layout_height="wrap_content" android:gravity="center" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android:text="@string/recalculate_route_to_your_location"></TextView>
|
||||||
<LinearLayout android:id="@+id/LinearLayout" android:layout_width="fill_parent" android:gravity="center" android:layout_height="wrap_content" android:orientation="horizontal">
|
<LinearLayout android:id="@+id/LinearLayout" android:layout_width="fill_parent" android:gravity="center" android:layout_height="wrap_content" android:orientation="horizontal">
|
||||||
<ToggleButton android:textOn="" android:textOff="" android:id="@+id/CarButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/car_icon" android:layout_marginLeft="10dp" />
|
<ToggleButton android:contentDescription="@string/app_mode_car" android:textOn="" android:textOff="" android:id="@+id/CarButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/car_icon" android:layout_marginLeft="10dp" />
|
||||||
<ToggleButton android:textOn="" android:textOff="" android:id="@+id/BicycleButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:background="@drawable/bicycle_icon"/>
|
<ToggleButton android:contentDescription="@string/app_mode_bicycle" android:textOn="" android:textOff="" android:id="@+id/BicycleButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:background="@drawable/bicycle_icon"/>
|
||||||
<ToggleButton android:textOn="" android:textOff="" android:id="@+id/PedestrianButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:background="@drawable/pedestrian_icon"/>
|
<ToggleButton android:contentDescription="@string/app_mode_pedestrian" android:textOn="" android:textOff="" android:id="@+id/PedestrianButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:background="@drawable/pedestrian_icon"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
12
OsmAnd/res/layout/notification.xml
Normal file
12
OsmAnd/res/layout/notification.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/layout"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||||
|
android:orientation="vertical" android:background="@color/color_light_gray">
|
||||||
|
|
||||||
|
<net.osmand.access.NotificationTextView android:id="@+id/message"
|
||||||
|
android:layout_marginLeft="4dp" android:layout_marginRight="4dp"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||||
|
android:textColor="@color/color_black" android:textSize="18sp" android:gravity="fill_horizontal"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -17,7 +17,7 @@
|
||||||
</TextView>
|
</TextView>
|
||||||
<Button android:id="@+id/CountryButton" android:text="@string/ChooseCountry">
|
<Button android:id="@+id/CountryButton" android:text="@string/ChooseCountry">
|
||||||
</Button>
|
</Button>
|
||||||
<ImageButton android:id="@+id/ResetCountry" android:layout_marginRight = "5dp" android:background="@drawable/reset">
|
<ImageButton android:id="@+id/ResetCountry" android:layout_marginRight = "5dp" android:background="@drawable/reset" android:contentDescription="@string/default_buttons_reset">
|
||||||
</ImageButton>
|
</ImageButton>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow android:id="@+id/TableRow" android:layout_marginLeft = "5dp" >
|
<TableRow android:id="@+id/TableRow" android:layout_marginLeft = "5dp" >
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
</TextView>
|
</TextView>
|
||||||
<Button android:id="@+id/CityButton" android:text="@string/choose_city">
|
<Button android:id="@+id/CityButton" android:text="@string/choose_city">
|
||||||
</Button>
|
</Button>
|
||||||
<ImageButton android:id="@+id/ResetCity" android:layout_marginRight = "5dp" android:background="@drawable/reset">
|
<ImageButton android:id="@+id/ResetCity" android:layout_marginRight = "5dp" android:background="@drawable/reset" android:contentDescription="@string/default_buttons_reset">
|
||||||
</ImageButton>
|
</ImageButton>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow android:id="@+id/TableRow" android:layout_marginLeft = "5dp">
|
<TableRow android:id="@+id/TableRow" android:layout_marginLeft = "5dp">
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
</TextView>
|
</TextView>
|
||||||
<Button android:id="@+id/StreetButton" android:text="@string/choose_street">
|
<Button android:id="@+id/StreetButton" android:text="@string/choose_street">
|
||||||
</Button>
|
</Button>
|
||||||
<ImageButton android:id="@+id/ResetStreet" android:layout_marginRight = "5dp" android:background="@drawable/reset">
|
<ImageButton android:id="@+id/ResetStreet" android:layout_marginRight = "5dp" android:background="@drawable/reset" android:contentDescription="@string/default_buttons_reset">
|
||||||
</ImageButton>
|
</ImageButton>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow android:id="@+id/TableRow" android:layout_marginLeft = "5dp">
|
<TableRow android:id="@+id/TableRow" android:layout_marginLeft = "5dp">
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
</TextView>
|
</TextView>
|
||||||
<Button android:id="@+id/BuildingButton" android:text="@string/choose_building">
|
<Button android:id="@+id/BuildingButton" android:text="@string/choose_building">
|
||||||
</Button>
|
</Button>
|
||||||
<ImageButton android:id="@+id/ResetBuilding" android:layout_marginRight = "5dp" android:background="@drawable/reset">
|
<ImageButton android:id="@+id/ResetBuilding" android:layout_marginRight = "5dp" android:background="@drawable/reset" android:contentDescription="@string/default_buttons_reset">
|
||||||
</ImageButton>
|
</ImageButton>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow android:id="@+id/TableRow" android:layout_marginLeft = "5dp" >
|
<TableRow android:id="@+id/TableRow" android:layout_marginLeft = "5dp" >
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/search_back_button"
|
android:id="@+id/search_back_button"
|
||||||
|
android:contentDescription="@string/close"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="top"
|
android:layout_gravity="top"
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
|
<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
|
||||||
<ImageButton android:src="@android:drawable/ic_input_get" android:text="@string/show_poi_on_map" android:id="@+id/ShowFilter"
|
<ImageButton android:src="@android:drawable/ic_input_get" android:text="@string/show_poi_on_map" android:id="@+id/ShowFilter"
|
||||||
android:layout_height="wrap_content" android:layout_width="wrap_content" />
|
android:layout_height="wrap_content" android:layout_width="wrap_content" android:contentDescription="@string/search_poi_filter"/>
|
||||||
<ImageButton android:src="@android:drawable/ic_dialog_map"
|
<ImageButton android:src="@android:drawable/ic_dialog_map" android:contentDescription="@string/search_shown_on_map"
|
||||||
android:id="@+id/ShowOnMap" android:layout_height="wrap_content" android:layout_width="wrap_content"/>
|
android:id="@+id/ShowOnMap" android:layout_height="wrap_content" android:layout_width="wrap_content"/>
|
||||||
<Button android:text="@string/search_POI_level_btn"
|
<Button android:text="@string/search_POI_level_btn"
|
||||||
android:id="@+id/SearchPOILevelButton" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_weight="1"/>
|
android:id="@+id/SearchPOILevelButton" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_weight="1"/>
|
||||||
|
|
|
@ -216,11 +216,11 @@
|
||||||
<string name="voice_not_use">Не использовать</string>
|
<string name="voice_not_use">Не использовать</string>
|
||||||
<string name="voice_not_specified">Нету</string>
|
<string name="voice_not_specified">Нету</string>
|
||||||
<string name="installing_new_resources">Распаковываются новые данные…</string>
|
<string name="installing_new_resources">Распаковываются новые данные…</string>
|
||||||
<string name="internet_connection_required_for_online_route">Вы собираетесь использовать интернет роутинг, но у вас нет активного интернет соединения.</string>
|
<string name="internet_connection_required_for_online_route">Вы собираетесь использовать интернет маршрутизацию, но у вас нет активного интернет соединения.</string>
|
||||||
<string name="tts_language_not_supported_title">Язык не поддерживается</string>
|
<string name="tts_language_not_supported_title">Язык не поддерживается</string>
|
||||||
<string name="tts_language_not_supported">Выбранный язык не поддерживается Android TTS (text-to-speech). Хотите найти в маркте другой TTS? Иначе язык TTS по умолчанию будет использован.</string>
|
<string name="tts_language_not_supported">Выбранный язык не поддерживается Android TTS (text-to-speech). Хотите найти в маркете другой TTS? Иначе язык TTS по умолчанию будет использован.</string>
|
||||||
<string name="tts_missing_language_data_title">Данные отсутсвуют</string>
|
<string name="tts_missing_language_data_title">Данные отсутсвуют</string>
|
||||||
<string name="tts_missing_language_data">Для данного языка отсутсвуют TTS данные. Вы хотите загрузить их из Маркета?</string>
|
<string name="tts_missing_language_data">Для данного языка отсутствуют TTS данные. Вы хотите загрузить их из Маркета?</string>
|
||||||
|
|
||||||
<string name="gpx_option_reverse_route">Выбрать обратное направление пути</string>
|
<string name="gpx_option_reverse_route">Выбрать обратное направление пути</string>
|
||||||
<string name="gpx_option_destination_point">Использовать текущую точку назначения</string>
|
<string name="gpx_option_destination_point">Использовать текущую точку назначения</string>
|
||||||
|
@ -259,11 +259,11 @@
|
||||||
<string name="tip_osm_improve">Улучшить Openstreetmap</string>
|
<string name="tip_osm_improve">Улучшить Openstreetmap</string>
|
||||||
<string name="tip_osm_improve_t">OsmAnd использует данные Openstreetmap.org data и имеет возможности улучшения этих данных. Вы можете добавить POI или сообщить о неточности на карте !
|
<string name="tip_osm_improve_t">OsmAnd использует данные Openstreetmap.org data и имеет возможности улучшения этих данных. Вы можете добавить POI или сообщить о неточности на карте !
|
||||||
\nПрежде всего необходимо ввести свои инициалы \'Меню\'->\'Настройки\'->\'OSM\'.
|
\nПрежде всего необходимо ввести свои инициалы \'Меню\'->\'Настройки\'->\'OSM\'.
|
||||||
\n\tДля добавления POI используйет \'Добавить POI\' в контекстном меню карты.
|
\n\tДля добавления POI используйте \'Добавить POI\' в контекстном меню карты.
|
||||||
\n\tЕсли вы нашли неточность на карте, вы можете сообщить об этом Openstreetmap сообществу.
|
\n\tЕсли вы нашли неточность на карте, вы можете сообщить об этом Openstreetmap сообществу.
|
||||||
\n\tНе забывайте, что для этих функций вам понадобится интернет!</string>
|
\n\tНе забывайте, что для этих функций вам понадобится интернет!</string>
|
||||||
<string name="create_poi_link_to_osm_doc"><u>Интернет OSM</u> классификация</string>
|
<string name="create_poi_link_to_osm_doc"><u>Интернет OSM</u> классификация</string>
|
||||||
<string name="error_doing_search">Ошибка offline поиска</string>
|
<string name="error_doing_search">Ошибка автономного поиска</string>
|
||||||
<string name="search_offline_geo_error">Невозможно разобрать запрос : \'%s\'</string>
|
<string name="search_offline_geo_error">Невозможно разобрать запрос : \'%s\'</string>
|
||||||
<string name="search_osm_offline">Поиск адреса используя offline карты</string>
|
<string name="search_osm_offline">Поиск адреса используя offline карты</string>
|
||||||
<string name="system_locale">Системная</string>
|
<string name="system_locale">Системная</string>
|
||||||
|
@ -272,7 +272,7 @@
|
||||||
<string name="tip_map_switch">Источник карты</string>
|
<string name="tip_map_switch">Источник карты</string>
|
||||||
<string name="tip_map_switch_t">Наиболее быстрый способ изменить источник карты и слои \'Меню\'->\'Слои\'.
|
<string name="tip_map_switch_t">Наиболее быстрый способ изменить источник карты и слои \'Меню\'->\'Слои\'.
|
||||||
\n\tПод \'Карта источник…\' вы можете выбрать из предопределенных типов или собственных, созданных OsmAndMapCreator на PC.
|
\n\tПод \'Карта источник…\' вы можете выбрать из предопределенных типов или собственных, созданных OsmAndMapCreator на PC.
|
||||||
\n\tOsmAnd поддерживает custom источники.</string>
|
\n\tOsmAnd поддерживает пользовательские источники.</string>
|
||||||
<string name="tip_app_mode">Режим работы</string>
|
<string name="tip_app_mode">Режим работы</string>
|
||||||
<string name="tip_app_mode_t">OsmAnd поддерживает различные типовые режимы отображения карты.
|
<string name="tip_app_mode_t">OsmAnd поддерживает различные типовые режимы отображения карты.
|
||||||
\n\tВы можете изменить режим в \'Меню\'->\'Настройки\'->\'Режим работы\', при этом меняется большинство настроек карты.</string>
|
\n\tВы можете изменить режим в \'Меню\'->\'Настройки\'->\'Режим работы\', при этом меняется большинство настроек карты.</string>
|
||||||
|
@ -349,9 +349,9 @@
|
||||||
<string name="version_index_is_not_supported">Версия индекса \'\'{0}\'\' не поддерживается</string>
|
<string name="version_index_is_not_supported">Версия индекса \'\'{0}\'\' не поддерживается</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="use_osmand_routing_service">OsmAnd offline навигация >20км</string>
|
<string name="use_osmand_routing_service">Автономная навигация OsmAnd >20км</string>
|
||||||
<string name="use_osmand_routing_service_descr">Использовать offline навигацию на длинные расстояние (экспериментально)</string>
|
<string name="use_osmand_routing_service_descr">Использовать offline навигацию на длинные расстояние (экспериментально)</string>
|
||||||
<string name="osmand_routing_experimental">OsmAnd offline навигация является экспериментальной и не работает на расстояния более 20 километров.\n\nВ этом случае автоматически переключается на CloudMade.</string>
|
<string name="osmand_routing_experimental">Автономная навигация OsmAnd является экспериментальной и не работает на расстояния более 20 километров.\n\nВ этом случае автоматически переключается на CloudMade.</string>
|
||||||
<string name="specified_dir_doesnt_exist">Невозможно найти указанную директорию.</string>
|
<string name="specified_dir_doesnt_exist">Невозможно найти указанную директорию.</string>
|
||||||
<string name="application_dir">Директория приложения</string>
|
<string name="application_dir">Директория приложения</string>
|
||||||
<string name="application_dir_change_warning">Изменение директории не переносит файлы автоматически. Вы должны это сделать самостоятельно. Продолжить?</string>
|
<string name="application_dir_change_warning">Изменение директории не переносит файлы автоматически. Вы должны это сделать самостоятельно. Продолжить?</string>
|
||||||
|
@ -785,4 +785,57 @@
|
||||||
<string name="edit_filter_delete_message">Фильтр {0} удален</string>
|
<string name="edit_filter_delete_message">Фильтр {0} удален</string>
|
||||||
<string name="edit_filter_create_message">Фильтр {0} создан</string>
|
<string name="edit_filter_create_message">Фильтр {0} создан</string>
|
||||||
<string name="default_buttons_selectall">Выделить все</string>
|
<string name="default_buttons_selectall">Выделить все</string>
|
||||||
|
|
||||||
|
<string name="backToMenu">Главное меню</string>
|
||||||
|
<string name="zoomOut">Уменьшить масштаб</string>
|
||||||
|
<string name="zoomIn">Увеличить масштаб</string>
|
||||||
|
<string name="zoomIs">Масштаб</string>
|
||||||
|
|
||||||
|
<string name="show_details">Подробности</string>
|
||||||
|
<string name="help">Помощь</string>
|
||||||
|
<string name="back_to_location">Вернуться</string>
|
||||||
|
<string name="north">север</string>
|
||||||
|
<string name="north_north_east">северо-северо-восток</string>
|
||||||
|
<string name="north_east">северо-восток</string>
|
||||||
|
<string name="east_north_east">восток-северо-восток</string>
|
||||||
|
<string name="east">восток</string>
|
||||||
|
<string name="east_south_east">восток-юго-восток</string>
|
||||||
|
<string name="south_east">юго-восток</string>
|
||||||
|
<string name="south_south_east">юго-юго-восток</string>
|
||||||
|
<string name="south">юг</string>
|
||||||
|
<string name="south_south_west">юго-юго-запад</string>
|
||||||
|
<string name="south_west">юго-запад</string>
|
||||||
|
<string name="west_south_west">запад-юго-запад</string>
|
||||||
|
<string name="west">запад</string>
|
||||||
|
<string name="west_north_west">запад-северо-запад</string>
|
||||||
|
<string name="north_west">северо-запад</string>
|
||||||
|
<string name="north_north_west">северо-северо-запад</string>
|
||||||
|
<string name="front">Вперед</string>
|
||||||
|
<string name="front_right">Направо вперед</string>
|
||||||
|
<string name="right">Направо</string>
|
||||||
|
<string name="back_right">Направо назад</string>
|
||||||
|
<string name="back">Назад</string>
|
||||||
|
<string name="back_left">Налево назад</string>
|
||||||
|
<string name="left">Налево</string>
|
||||||
|
<string name="front_left">Налево вперед</string>
|
||||||
|
<string name="oclock">ч.</string>
|
||||||
|
<string name="towards">на</string>
|
||||||
|
<string name="accuracy">Точность</string>
|
||||||
|
<string name="altitude">Высота</string>
|
||||||
|
<string name="no_info">Нет информации</string>
|
||||||
|
<string name="direction_style_sidewise">По сторонам (8 секторов)</string>
|
||||||
|
<string name="direction_style_clockwise">По циферблату (12 секторов)</string>
|
||||||
|
<string name="settings_direction_style">Стиль указания направлений</string>
|
||||||
|
<string name="settings_direction_style_descr">Выберите стиль указания относительных направлений во время движения</string>
|
||||||
|
<string name="auto_announce_on">Включить автооповещение</string>
|
||||||
|
<string name="auto_announce_off">Выключить автооповещение</string>
|
||||||
|
<string name="scroll_map_by_gestures_descr">Перемещать карту посредством жестов на сенсорном экране</string>
|
||||||
|
<string name="scroll_map_by_gestures">Естественное управление картой</string>
|
||||||
|
<string name="i_am_here">Я здесь</string>
|
||||||
|
<string name="zoom_by_trackball_descr">Менять масштаб карты горизонтальными движениями трекбола</string>
|
||||||
|
<string name="zoom_by_trackball">Использовать трекбол для изменения масштаба</string>
|
||||||
|
<string name="use_short_object_names_descr">Использовать краткие названия объектов при исследовании карты</string>
|
||||||
|
<string name="use_short_object_names">Использовать краткие названия объектов</string>
|
||||||
|
<string name="accessibility_preferences_descr">Настройки для невизуального доступа</string>
|
||||||
|
<string name="accessibility_preferences">Специальные возможности</string>
|
||||||
</resources>
|
</resources>
|
|
@ -3,6 +3,56 @@
|
||||||
<string name="show_ruler_level_descr">Display ruler on the map</string>
|
<string name="show_ruler_level_descr">Display ruler on the map</string>
|
||||||
<string name="show_ruler_level">Display ruler</string>
|
<string name="show_ruler_level">Display ruler</string>
|
||||||
|
|
||||||
|
<string name="backToMenu">Back To Menu</string>
|
||||||
|
<string name="zoomOut">Zoom out</string>
|
||||||
|
<string name="zoomIn">Zoom in</string>
|
||||||
|
<string name="zoomIs">Zoom is</string>
|
||||||
|
|
||||||
|
<string name="north">north</string>
|
||||||
|
<string name="north_north_east">north-north-east</string>
|
||||||
|
<string name="north_east">north-east</string>
|
||||||
|
<string name="east_north_east">east-north-east</string>
|
||||||
|
<string name="east">east</string>
|
||||||
|
<string name="east_south_east">east-south-east</string>
|
||||||
|
<string name="south_east">south-east</string>
|
||||||
|
<string name="south_south_east">south-south-east</string>
|
||||||
|
<string name="south">south</string>
|
||||||
|
<string name="south_south_west">south-south-west</string>
|
||||||
|
<string name="south_west">south-west</string>
|
||||||
|
<string name="west_south_west">west-south-west</string>
|
||||||
|
<string name="west">west</string>
|
||||||
|
<string name="west_north_west">west-north-west</string>
|
||||||
|
<string name="north_west">north-west</string>
|
||||||
|
<string name="north_north_west">north-north-west</string>
|
||||||
|
<string name="front">Front</string>
|
||||||
|
<string name="front_right">Front right</string>
|
||||||
|
<string name="right">Right</string>
|
||||||
|
<string name="back_right">Back right</string>
|
||||||
|
<string name="back">Back</string>
|
||||||
|
<string name="back_left">Back left</string>
|
||||||
|
<string name="left">Left</string>
|
||||||
|
<string name="front_left">Front left</string>
|
||||||
|
<string name="oclock">o\'clock</string>
|
||||||
|
<string name="towards">towards</string>
|
||||||
|
<string name="accuracy">Accuracy</string>
|
||||||
|
<string name="altitude">Altitude</string>
|
||||||
|
<string name="no_info">No info</string>
|
||||||
|
<string name="direction_style_sidewise">Sidewise (8 sectors)</string>
|
||||||
|
<string name="direction_style_clockwise">Clockwise (12 sectors)</string>
|
||||||
|
<string name="settings_direction_style">Direction style</string>
|
||||||
|
<string name="settings_direction_style_descr">Choose style to express relative directions while moving</string>
|
||||||
|
<string name="auto_announce_on">Start autoannouncing</string>
|
||||||
|
<string name="auto_announce_off">Stop autoannouncing</string>
|
||||||
|
<string name="scroll_map_by_gestures_descr">Scroll map by gestures on the touchscreen</string>
|
||||||
|
<string name="scroll_map_by_gestures">Natural map scrolling</string>
|
||||||
|
<string name="i_am_here">I am here</string>
|
||||||
|
<string name="zoom_by_trackball_descr">Change map zooming by horizontal trackball moves</string>
|
||||||
|
<string name="zoom_by_trackball">Use trackball for zoom control</string>
|
||||||
|
<string name="use_short_object_names_descr">Use short object names in touch exploration mode</string>
|
||||||
|
<string name="use_short_object_names">Use object names</string>
|
||||||
|
<string name="accessibility_preferences_descr">Accessibility related preferences</string>
|
||||||
|
<string name="accessibility_preferences">Accessibility</string>
|
||||||
|
|
||||||
<string name="rendering_out_of_memory">Not enough process memory to display selected area</string>
|
<string name="rendering_out_of_memory">Not enough process memory to display selected area</string>
|
||||||
<string name="use_fluorescent_overlays">Fluorescent overlays</string>
|
<string name="use_fluorescent_overlays">Fluorescent overlays</string>
|
||||||
<string name="use_fluorescent_overlays_descr">Use fluorescent colors to display tracks and routes</string>
|
<string name="use_fluorescent_overlays_descr">Use fluorescent colors to display tracks and routes</string>
|
||||||
|
|
|
@ -132,6 +132,13 @@
|
||||||
<ListPreference android:key="service_off_wait_interval" android:title="@string/background_service_wait_int"
|
<ListPreference android:key="service_off_wait_interval" android:title="@string/background_service_wait_int"
|
||||||
android:summary="@string/background_service_wait_int_descr"></ListPreference>
|
android:summary="@string/background_service_wait_int_descr"></ListPreference>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
||||||
|
<PreferenceScreen android:key="accessibility_preferences" android:title="@string/accessibility_preferences" android:summary="@string/accessibility_preferences_descr">
|
||||||
|
<ListPreference android:summary="@string/settings_direction_style_descr" android:title="@string/settings_direction_style" android:key="direction_style"></ListPreference>
|
||||||
|
<CheckBoxPreference android:key="zoom_by_trackball" android:title="@string/zoom_by_trackball" android:summary="@string/zoom_by_trackball_descr"></CheckBoxPreference>
|
||||||
|
<CheckBoxPreference android:key="scroll_map_by_gestures" android:title="@string/scroll_map_by_gestures" android:summary="@string/scroll_map_by_gestures_descr"></CheckBoxPreference>
|
||||||
|
<CheckBoxPreference android:key="use_short_object_names" android:title="@string/use_short_object_names" android:summary="@string/use_short_object_names_descr"></CheckBoxPreference>
|
||||||
|
</PreferenceScreen>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package net.osmand;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import net.osmand.OpenstreetmapRemoteUtil;
|
|
||||||
import net.osmand.data.AmenityType;
|
import net.osmand.data.AmenityType;
|
||||||
import net.osmand.osm.Node;
|
import net.osmand.osm.Node;
|
||||||
import net.osmand.osm.OSMSettings.OSMTagKey;
|
import net.osmand.osm.OSMSettings.OSMTagKey;
|
||||||
|
|
|
@ -16,6 +16,7 @@ import java.text.MessageFormat;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
import net.osmand.osm.Entity;
|
import net.osmand.osm.Entity;
|
||||||
import net.osmand.osm.Entity.EntityId;
|
import net.osmand.osm.Entity.EntityId;
|
||||||
|
@ -385,10 +386,10 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil {
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Loading node failed " + nodeId, e); //$NON-NLS-1$
|
log.error("Loading node failed " + nodeId, e); //$NON-NLS-1$
|
||||||
Toast.makeText(ctx, ctx.getResources().getString(R.string.error_io_error), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(ctx, ctx.getResources().getString(R.string.error_io_error), Toast.LENGTH_LONG).show();
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
log.error("Loading node failed " + nodeId, e); //$NON-NLS-1$
|
log.error("Loading node failed " + nodeId, e); //$NON-NLS-1$
|
||||||
Toast.makeText(ctx, ctx.getResources().getString(R.string.error_io_error), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(ctx, ctx.getResources().getString(R.string.error_io_error), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -417,10 +418,10 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil {
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Loading node failed " + nodeId, e); //$NON-NLS-1$
|
log.error("Loading node failed " + nodeId, e); //$NON-NLS-1$
|
||||||
Toast.makeText(ctx, ctx.getResources().getString(R.string.error_io_error), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(ctx, ctx.getResources().getString(R.string.error_io_error), Toast.LENGTH_LONG).show();
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
log.error("Loading node failed " + nodeId, e); //$NON-NLS-1$
|
log.error("Loading node failed " + nodeId, e); //$NON-NLS-1$
|
||||||
Toast.makeText(ctx, ctx.getResources().getString(R.string.error_io_error), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(ctx, ctx.getResources().getString(R.string.error_io_error), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -429,7 +430,7 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil {
|
||||||
view.post(new Runnable(){
|
view.post(new Runnable(){
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Toast.makeText(ctx, msg, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(ctx, msg, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ import net.osmand.data.AmenityType;
|
||||||
import net.osmand.data.City.CityType;
|
import net.osmand.data.City.CityType;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
|
||||||
import net.osmand.plus.OsmandSettings.MetricsConstants;
|
import net.osmand.plus.OsmandSettings.MetricsConstants;
|
||||||
|
import net.osmand.plus.R;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
public class OsmAndFormatter {
|
public class OsmAndFormatter {
|
||||||
|
|
|
@ -4,7 +4,6 @@ import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
public class Version {
|
public class Version {
|
||||||
|
|
79
OsmAnd/src/net/osmand/access/AccessibilityDelegate.java
Normal file
79
OsmAnd/src/net/osmand/access/AccessibilityDelegate.java
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
package net.osmand.access;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
|
// This class serves as a delegate of accessibility service
|
||||||
|
// providing a sort of touch exploration capability
|
||||||
|
// for a View hierarchy. It means that elements will be spoken
|
||||||
|
// on touch. Thus, you can slide your finger across the screen
|
||||||
|
// and hear available controls and items.
|
||||||
|
// Lift finger up on a control to make click.
|
||||||
|
//
|
||||||
|
// This class can not be instantiated directly.
|
||||||
|
// Use static method takeCareOf() to get it's functionality
|
||||||
|
// for respective objects.
|
||||||
|
//
|
||||||
|
public class AccessibilityDelegate extends AccessibleLayout {
|
||||||
|
|
||||||
|
private AccessibilityDelegate(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attach itself to a target View hierarchy to intercept touch events
|
||||||
|
// and provide on-touch accessibility feedback.
|
||||||
|
// Target View must be an instance of FrameLayout
|
||||||
|
// or have a parent which is an instance of ViewGroup.
|
||||||
|
private void attach(View target) {
|
||||||
|
ViewGroup parent;
|
||||||
|
if (target instanceof FrameLayout) {
|
||||||
|
parent = (ViewGroup)target;
|
||||||
|
while (parent.getChildCount() > 0) {
|
||||||
|
View child = parent.getChildAt(0);
|
||||||
|
parent.removeViewAt(0);
|
||||||
|
addView(child);
|
||||||
|
}
|
||||||
|
parent.addView(this, new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
|
||||||
|
} else if (target.getParent() instanceof ViewGroup) {
|
||||||
|
parent = (ViewGroup)target.getParent();
|
||||||
|
int position = parent.indexOfChild(target);
|
||||||
|
ViewGroup.LayoutParams params = target.getLayoutParams();
|
||||||
|
parent.removeViewAt(position);
|
||||||
|
addView(target, new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
|
||||||
|
parent.addView(this, position, params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Provide touch exploration capability for individual View
|
||||||
|
// or whole View hierarchy. The hierarchy root specified
|
||||||
|
// as an argument must either be an instance of FrameLayout
|
||||||
|
// or have a parent that is an instance of ViewGroup.
|
||||||
|
public static void takeCareOf(View hierarchy) {
|
||||||
|
final AccessibilityDelegate delegate = new AccessibilityDelegate(hierarchy.getContext());
|
||||||
|
delegate.attach(hierarchy);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Provide touch exploration capability for given window.
|
||||||
|
public static void takeCareOf(Window window) {
|
||||||
|
takeCareOf(window.getDecorView());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Provide touch exploration capability for an activity View content.
|
||||||
|
// Use after setContentView().
|
||||||
|
public static void takeCareOf(Activity activity) {
|
||||||
|
takeCareOf(activity.getWindow());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Provide touch exploration capability for a dialog View content.
|
||||||
|
// Use after setContentView().
|
||||||
|
public static void takeCareOf(Dialog dialog) {
|
||||||
|
takeCareOf(dialog.getWindow());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
45
OsmAnd/src/net/osmand/access/AccessibleActivity.java
Normal file
45
OsmAnd/src/net/osmand/access/AccessibleActivity.java
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
package net.osmand.access;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
// Provide some additional accessibility means for activity view elements.
|
||||||
|
//
|
||||||
|
// To make use of these capabilities simply derive your activity from this class
|
||||||
|
// and then add view elements you wish to be accessible
|
||||||
|
// to the accessibleContent list.
|
||||||
|
//
|
||||||
|
public class AccessibleActivity extends Activity implements AccessibleContent.Callback {
|
||||||
|
|
||||||
|
// List of accessible views. Use accessibleContent.add(element)
|
||||||
|
// to add element to it.
|
||||||
|
public final AccessibleContent accessibleContent = new AccessibleContent();
|
||||||
|
|
||||||
|
// Below are two helper methods to improve AlertDialog accessibility.
|
||||||
|
//
|
||||||
|
// Since usual message in an AlertDialog that is set by
|
||||||
|
// AlertDialog.Builder.setMessage() is spoken only once at the best case
|
||||||
|
// and there is no way to repeat it, use following two methods
|
||||||
|
// to wrap it into a View and set it by AlertDialog.Builder.setView().
|
||||||
|
// Such message will be focusable and so it can be repeated by selecting.
|
||||||
|
|
||||||
|
public View accessibleMessage(CharSequence msg) {
|
||||||
|
return TextMessage.makeView(this, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public View accessibleMessage(int msgid) {
|
||||||
|
return TextMessage.makeView(this, msgid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean dispatchNativeTouchEvent(MotionEvent event) {
|
||||||
|
return super.dispatchTouchEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||||
|
return accessibleContent.dispatchTouchEvent(event, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
76
OsmAnd/src/net/osmand/access/AccessibleContent.java
Normal file
76
OsmAnd/src/net/osmand/access/AccessibleContent.java
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
package net.osmand.access;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.os.SystemClock;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
|
|
||||||
|
// Provide some additional accessibility means for individual view elements.
|
||||||
|
// These elements will be spoken on touch. Thus, you can slide your finger
|
||||||
|
// across the screen and hear available controls.
|
||||||
|
// Lift finger up on a control to make click.
|
||||||
|
//
|
||||||
|
// To make use of these capabilities instantiate an object of this class
|
||||||
|
// and pass touch event to it via dispatchTouchEvent() method.
|
||||||
|
// Then you can add view elements you wish to be accessible to this list.
|
||||||
|
//
|
||||||
|
public class AccessibleContent extends ArrayList<View> {
|
||||||
|
|
||||||
|
public interface Callback {
|
||||||
|
public boolean dispatchNativeTouchEvent(MotionEvent event);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Rect testFrame = new Rect();
|
||||||
|
private View nowTouched;
|
||||||
|
|
||||||
|
private View findTouch(MotionEvent event) {
|
||||||
|
int x = (int)event.getX();
|
||||||
|
int y = (int)event.getY();
|
||||||
|
for (View v : this)
|
||||||
|
if ((v.getVisibility() != View.INVISIBLE) && v.getGlobalVisibleRect(testFrame) && testFrame.contains(x, y))
|
||||||
|
return v;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean dispatchTouchEvent(MotionEvent event, Callback callback) {
|
||||||
|
int action = event.getAction();
|
||||||
|
View newTouch;
|
||||||
|
switch (action) {
|
||||||
|
case MotionEvent.ACTION_MOVE:
|
||||||
|
newTouch = findTouch(event);
|
||||||
|
if ((newTouch != null) && (newTouch != nowTouched)) {
|
||||||
|
float x = event.getX();
|
||||||
|
float y = event.getY();
|
||||||
|
float pressure = event.getPressure();
|
||||||
|
float size = event.getSize();
|
||||||
|
int metaState = event.getMetaState();
|
||||||
|
float xPrecision = event.getXPrecision();
|
||||||
|
float yPrecision = event.getYPrecision();
|
||||||
|
int deviceId = event.getDeviceId();
|
||||||
|
int edgeFlags = event.getEdgeFlags();
|
||||||
|
event.setAction(MotionEvent.ACTION_CANCEL);
|
||||||
|
callback.dispatchNativeTouchEvent(event);
|
||||||
|
newTouch.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
|
||||||
|
long now = SystemClock.uptimeMillis();
|
||||||
|
event.recycle();
|
||||||
|
event = MotionEvent.obtain(now, now, MotionEvent.ACTION_DOWN, x, y, pressure, size,
|
||||||
|
metaState, xPrecision, yPrecision, deviceId, edgeFlags);
|
||||||
|
}
|
||||||
|
nowTouched = newTouch;
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
nowTouched = findTouch(event);
|
||||||
|
if (nowTouched != null)
|
||||||
|
nowTouched.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
nowTouched = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return callback.dispatchNativeTouchEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
115
OsmAnd/src/net/osmand/access/AccessibleLayout.java
Normal file
115
OsmAnd/src/net/osmand/access/AccessibleLayout.java
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
package net.osmand.access;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.os.SystemClock;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
// This class can be used in place of FrameLayout in order to provide
|
||||||
|
// a sort of touch exploration capability for enclosing View hierarchy.
|
||||||
|
// It means that elements will be spoken on touch.
|
||||||
|
// Thus, you can slide your finger across the screen
|
||||||
|
// and hear available controls and items.
|
||||||
|
// Lift finger up on a control to make click.
|
||||||
|
//
|
||||||
|
public class AccessibleLayout extends FrameLayout {
|
||||||
|
|
||||||
|
private final Rect testFrame = new Rect();
|
||||||
|
private View nowTouched;
|
||||||
|
|
||||||
|
|
||||||
|
// Conventional public constructors
|
||||||
|
|
||||||
|
public AccessibleLayout(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccessibleLayout(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccessibleLayout(Context context, AttributeSet attrs, int defStyle) {
|
||||||
|
super(context, attrs, defStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Recursive search through View tree.
|
||||||
|
private View findTouch(MotionEvent event) {
|
||||||
|
if (!getGlobalVisibleRect(testFrame))
|
||||||
|
return null;
|
||||||
|
final int x = (int)event.getX() + testFrame.left;
|
||||||
|
final int y = (int)event.getY() + testFrame.top;
|
||||||
|
View root = this;
|
||||||
|
View control = null;
|
||||||
|
View text = null;
|
||||||
|
while (root instanceof ViewGroup) {
|
||||||
|
int nBranches = ((ViewGroup)root).getChildCount();
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < nBranches; i++) {
|
||||||
|
View child = ((ViewGroup)root).getChildAt(i);
|
||||||
|
if ((child.getVisibility() != View.INVISIBLE) && child.getGlobalVisibleRect(testFrame) && testFrame.contains(x, y)) {
|
||||||
|
if (child.isClickable())
|
||||||
|
control = child;
|
||||||
|
else if (child instanceof TextView)
|
||||||
|
text = child;
|
||||||
|
root = child;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i == nBranches)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (control != null)
|
||||||
|
return control;
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||||
|
int action = event.getAction();
|
||||||
|
View newTouch;
|
||||||
|
switch (action) {
|
||||||
|
case MotionEvent.ACTION_MOVE:
|
||||||
|
newTouch = findTouch(event);
|
||||||
|
if ((newTouch != null) && (newTouch != nowTouched)) {
|
||||||
|
if (newTouch.isClickable()) {
|
||||||
|
float x = event.getX();
|
||||||
|
float y = event.getY();
|
||||||
|
float pressure = event.getPressure();
|
||||||
|
float size = event.getSize();
|
||||||
|
int metaState = event.getMetaState();
|
||||||
|
float xPrecision = event.getXPrecision();
|
||||||
|
float yPrecision = event.getYPrecision();
|
||||||
|
int deviceId = event.getDeviceId();
|
||||||
|
int edgeFlags = event.getEdgeFlags();
|
||||||
|
event.setAction(MotionEvent.ACTION_CANCEL);
|
||||||
|
super.dispatchTouchEvent(event);
|
||||||
|
long now = SystemClock.uptimeMillis();
|
||||||
|
event.recycle();
|
||||||
|
event = MotionEvent.obtain(now, now, MotionEvent.ACTION_DOWN, x, y, pressure, size,
|
||||||
|
metaState, xPrecision, yPrecision, deviceId, edgeFlags);
|
||||||
|
}
|
||||||
|
newTouch.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
|
||||||
|
}
|
||||||
|
nowTouched = newTouch;
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
nowTouched = findTouch(event);
|
||||||
|
if (nowTouched != null)
|
||||||
|
nowTouched.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
nowTouched = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
super.dispatchTouchEvent(event);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
45
OsmAnd/src/net/osmand/access/AccessibleToast.java
Normal file
45
OsmAnd/src/net/osmand/access/AccessibleToast.java
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
package net.osmand.access;
|
||||||
|
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
// Use this class instead of regular Toast to have
|
||||||
|
// accessibility feedback on toast messages.
|
||||||
|
//
|
||||||
|
public class AccessibleToast extends Toast {
|
||||||
|
|
||||||
|
public AccessibleToast(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Toast makeText(Context context, int msg, int duration) {
|
||||||
|
if(true){
|
||||||
|
// currently disabled (waiting for settings)
|
||||||
|
return Toast.makeText(context, msg, duration);
|
||||||
|
}
|
||||||
|
final Toast toast = new AccessibleToast(context);
|
||||||
|
toast.setView(TextMessage.makeView(context, msg, R.layout.notification));
|
||||||
|
toast.setDuration(duration);
|
||||||
|
return toast;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Toast makeText(Context context, CharSequence msg, int duration) {
|
||||||
|
if(true){
|
||||||
|
// currently disabled (waiting for settings)
|
||||||
|
return Toast.makeText(context, msg, duration);
|
||||||
|
}
|
||||||
|
final Toast toast = new AccessibleToast(context);
|
||||||
|
toast.setView(TextMessage.makeView(context, msg, R.layout.notification));
|
||||||
|
toast.setDuration(duration);
|
||||||
|
return toast;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
getView().sendAccessibilityEvent(AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED);
|
||||||
|
super.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
46
OsmAnd/src/net/osmand/access/AccessibleTrackedActivity.java
Normal file
46
OsmAnd/src/net/osmand/access/AccessibleTrackedActivity.java
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
package net.osmand.access;
|
||||||
|
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import com.google.android.apps.analytics.easytracking.TrackedActivity;
|
||||||
|
|
||||||
|
// Provide some additional accessibility means for activity view elements.
|
||||||
|
//
|
||||||
|
// To make use of these capabilities simply derive your activity from this class
|
||||||
|
// and then add view elements you wish to be accessible
|
||||||
|
// to the accessibleContent list.
|
||||||
|
//
|
||||||
|
public class AccessibleTrackedActivity extends TrackedActivity implements AccessibleContent.Callback {
|
||||||
|
|
||||||
|
// List of accessible views. Use accessibleContent.add(element)
|
||||||
|
// to add element to it.
|
||||||
|
public final AccessibleContent accessibleContent = new AccessibleContent();
|
||||||
|
|
||||||
|
// Below are two helper methods to improve AlertDialog accessibility.
|
||||||
|
//
|
||||||
|
// Since usual message in an AlertDialog that is set by
|
||||||
|
// AlertDialog.Builder.setMessage() is spoken only once at the best case
|
||||||
|
// and there is no way to repeat it, use following two methods
|
||||||
|
// to wrap it into a View and set it by AlertDialog.Builder.setView().
|
||||||
|
// Such message will be focusable and so it can be repeated by selecting.
|
||||||
|
|
||||||
|
public View accessibleMessage(CharSequence msg) {
|
||||||
|
return TextMessage.makeView(this, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public View accessibleMessage(int msgid) {
|
||||||
|
return TextMessage.makeView(this, msgid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean dispatchNativeTouchEvent(MotionEvent event) {
|
||||||
|
return super.dispatchTouchEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||||
|
return accessibleContent.dispatchTouchEvent(event, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
94
OsmAnd/src/net/osmand/access/ExplorableTextView.java
Normal file
94
OsmAnd/src/net/osmand/access/ExplorableTextView.java
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
package net.osmand.access;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.text.Layout;
|
||||||
|
import android.text.method.ArrowKeyMovementMethod;
|
||||||
|
import android.text.method.MovementMethod;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
// This class is intended to be used in place of the TextView
|
||||||
|
// to provide accessible exploration capability by arrow keys.
|
||||||
|
//
|
||||||
|
public class ExplorableTextView extends TextView {
|
||||||
|
|
||||||
|
private int cursor;
|
||||||
|
private int selectionStart;
|
||||||
|
private int selectionLength;
|
||||||
|
private boolean cursorTrackingEnabled = true;
|
||||||
|
|
||||||
|
|
||||||
|
// Conventional constructors.
|
||||||
|
|
||||||
|
public ExplorableTextView(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExplorableTextView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExplorableTextView(Context context, AttributeSet attrs, int style) {
|
||||||
|
super(context, attrs, style);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Overridden callback methods to provide accessible exploration means.
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
|
||||||
|
cursorTrackingEnabled = false;
|
||||||
|
boolean result = super.dispatchPopulateAccessibilityEvent(event);
|
||||||
|
if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED) {
|
||||||
|
if (isFocused()) {
|
||||||
|
event.getText().clear();
|
||||||
|
event.getText().add(getText().subSequence(selectionStart, selectionStart + selectionLength));
|
||||||
|
}
|
||||||
|
event.setAddedCount(selectionLength);
|
||||||
|
event.setRemovedCount(0);
|
||||||
|
event.setFromIndex(0);
|
||||||
|
event.setBeforeText(null);
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
cursorTrackingEnabled =true;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected MovementMethod getDefaultMovementMethod() {
|
||||||
|
return ArrowKeyMovementMethod.getInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onTextChanged(CharSequence text, int start, int before, int after) {
|
||||||
|
super.onTextChanged(text, start, before, after);
|
||||||
|
if (!isFocused()) {
|
||||||
|
selectionLength = Math.min(text.length(), AccessibilityEvent.MAX_TEXT_LENGTH);
|
||||||
|
sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onSelectionChanged(int start, int end) {
|
||||||
|
super.onSelectionChanged(start, end);
|
||||||
|
if (cursorTrackingEnabled && isFocused()) {
|
||||||
|
if (end >= getText().length()) {
|
||||||
|
cursor = getText().length();
|
||||||
|
} else if (cursor != end) {
|
||||||
|
if (Math.abs(cursor - end) > 1) {
|
||||||
|
final Layout layout = getLayout();
|
||||||
|
final int line = layout.getLineForOffset(end);
|
||||||
|
selectionStart = layout.getLineStart(line);
|
||||||
|
selectionLength = Math.min(layout.getLineEnd(line) - selectionStart, AccessibilityEvent.MAX_TEXT_LENGTH);
|
||||||
|
} else {
|
||||||
|
selectionStart = end;
|
||||||
|
selectionLength = 1;
|
||||||
|
}
|
||||||
|
sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED);
|
||||||
|
cursor = end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
172
OsmAnd/src/net/osmand/access/MapExplorer.java
Normal file
172
OsmAnd/src/net/osmand/access/MapExplorer.java
Normal file
|
@ -0,0 +1,172 @@
|
||||||
|
package net.osmand.access;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.osmand.osm.LatLon;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.views.ContextMenuLayer;
|
||||||
|
import net.osmand.plus.views.ContextMenuLayer.IContextMenuProvider;
|
||||||
|
import net.osmand.plus.views.OsmandMapLayer;
|
||||||
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.graphics.PointF;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
|
import android.view.GestureDetector.OnGestureListener;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
|
// Provide touch exploration mode for map view
|
||||||
|
// when scrolling it by gestures is disabled.
|
||||||
|
//
|
||||||
|
public class MapExplorer implements OnGestureListener, IContextMenuProvider {
|
||||||
|
|
||||||
|
private static final float VICINITY_RADIUS = 15;
|
||||||
|
|
||||||
|
private OsmandMapTileView mapView;
|
||||||
|
private OnGestureListener fallback;
|
||||||
|
private List<Object> selectedObjects = null;
|
||||||
|
private IContextMenuProvider contextProvider;
|
||||||
|
private final DisplayMetrics dm = new DisplayMetrics();
|
||||||
|
|
||||||
|
|
||||||
|
// OnGestureListener specified as a second argument
|
||||||
|
// will be used when scrolling map by gestures
|
||||||
|
// is enabled.
|
||||||
|
public MapExplorer(OsmandMapTileView mapView, OnGestureListener fallback) {
|
||||||
|
this.mapView = mapView;
|
||||||
|
this.fallback = fallback;
|
||||||
|
((WindowManager)(mapView.getContext().getSystemService(Context.WINDOW_SERVICE))).getDefaultDisplay().getMetrics(dm);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Compare two lists by content.
|
||||||
|
private boolean different(List<Object> l1, List<Object> l2) {
|
||||||
|
if ((l1 != null) && !l1.isEmpty()) {
|
||||||
|
if ((l2 != null) && !l2.isEmpty()) {
|
||||||
|
if (l1.size() != l2.size())
|
||||||
|
return true;
|
||||||
|
for (int i = 0; i < l1.size(); i++)
|
||||||
|
if (l1.get(i) != l2.get(i))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return ((l2 != null) && !l2.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find touched objects if any and emit accessible toast message
|
||||||
|
// with it's brief description.
|
||||||
|
private void describePointedObjects(MotionEvent event) {
|
||||||
|
PointF point = new PointF(event.getX(), event.getY());
|
||||||
|
List<Object> newSelections = new ArrayList<Object>();
|
||||||
|
for (OsmandMapLayer layer : mapView.getLayers())
|
||||||
|
if (layer instanceof IContextMenuProvider) {
|
||||||
|
((IContextMenuProvider)layer).collectObjectsFromPoint(point, newSelections);
|
||||||
|
if (!newSelections.isEmpty()) {
|
||||||
|
contextProvider = (IContextMenuProvider)layer;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (newSelections.isEmpty()) {
|
||||||
|
collectObjectsFromPoint(point, newSelections);
|
||||||
|
contextProvider = this;
|
||||||
|
}
|
||||||
|
if (different(newSelections, selectedObjects)) {
|
||||||
|
// FIXME Map explorer
|
||||||
|
// ContextMenuLayer contextMenuLayer = mapView.getContextMenuLayer();
|
||||||
|
// if (contextMenuLayer != null) {
|
||||||
|
// contextMenuLayer.setSelections(newSelections, contextProvider);
|
||||||
|
// if (!newSelections.isEmpty())
|
||||||
|
// mapView.showMessage(mapView.getSettings().USE_SHORT_OBJECT_NAMES.get() ?
|
||||||
|
// contextMenuLayer.getSelectedObjectName() :
|
||||||
|
// contextMenuLayer.getSelectedObjectDescription());
|
||||||
|
// }
|
||||||
|
// selectedObjects = newSelections;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// OnGestureListener interface implementation.
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onDown(MotionEvent e) {
|
||||||
|
if (mapView.getSettings().SCROLL_MAP_BY_GESTURES.get())
|
||||||
|
return fallback.onDown(e);
|
||||||
|
ContextMenuLayer contextMenuLayer = mapView.getLayerByClass(ContextMenuLayer.class);
|
||||||
|
// FIXME
|
||||||
|
// if (contextMenuLayer != null)
|
||||||
|
// contextMenuLayer.setSelections(null, null);
|
||||||
|
selectedObjects = null;
|
||||||
|
describePointedObjects(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
|
||||||
|
if (mapView.getSettings().SCROLL_MAP_BY_GESTURES.get())
|
||||||
|
return fallback.onFling(e1, e2, velocityX, velocityY);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLongPress(MotionEvent e) {
|
||||||
|
fallback.onLongPress(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
|
||||||
|
if (mapView.getSettings().SCROLL_MAP_BY_GESTURES.get()) {
|
||||||
|
return fallback.onScroll(e1, e2, distanceX, distanceY);
|
||||||
|
} else {
|
||||||
|
describePointedObjects(e2);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShowPress(MotionEvent e) {
|
||||||
|
if (mapView.getSettings().SCROLL_MAP_BY_GESTURES.get())
|
||||||
|
fallback.onShowPress(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onSingleTapUp(MotionEvent e) {
|
||||||
|
return fallback.onSingleTapUp(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// IContextMenuProvider interface implementation.
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collectObjectsFromPoint(PointF point, List<Object> objects) {
|
||||||
|
int radius = (int)(VICINITY_RADIUS * dm.density);
|
||||||
|
int dx = (int)Math.abs(point.x - mapView.getCenterPointX());
|
||||||
|
int dy = (int)Math.abs(point.y - mapView.getCenterPointY());
|
||||||
|
if ((dx < radius) && (dy < radius))
|
||||||
|
objects.add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LatLon getObjectLocation(Object o) {
|
||||||
|
return mapView.getLatLonFromScreenPoint(mapView.getCenterPointX(), mapView.getCenterPointY());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getObjectDescription(Object o) {
|
||||||
|
return mapView.getContext().getString(R.string.i_am_here);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getObjectName(Object o) {
|
||||||
|
return mapView.getContext().getString(R.string.i_am_here);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DialogInterface.OnClickListener getActionListener(List<String> actionsList, Object o) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
310
OsmAnd/src/net/osmand/access/NavigationInfo.java
Normal file
310
OsmAnd/src/net/osmand/access/NavigationInfo.java
Normal file
|
@ -0,0 +1,310 @@
|
||||||
|
package net.osmand.access;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.osmand.OsmAndFormatter;
|
||||||
|
import net.osmand.osm.LatLon;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.location.Location;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.SystemClock;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
public class NavigationInfo {
|
||||||
|
|
||||||
|
private static final long MIN_NOTIFICATION_PERIOD = 10000;
|
||||||
|
private static final float FULL_CIRCLE = 360.0f;
|
||||||
|
|
||||||
|
private class RelativeDirection {
|
||||||
|
|
||||||
|
private static final int UNKNOWN = -1;
|
||||||
|
|
||||||
|
private final int[] direction = {
|
||||||
|
R.string.front,
|
||||||
|
R.string.front_right,
|
||||||
|
R.string.right,
|
||||||
|
R.string.back_right,
|
||||||
|
R.string.back,
|
||||||
|
R.string.back_left,
|
||||||
|
R.string.left,
|
||||||
|
R.string.front_left
|
||||||
|
};
|
||||||
|
|
||||||
|
private RelativeDirectionStyle style;
|
||||||
|
private int value;
|
||||||
|
|
||||||
|
public RelativeDirection() {
|
||||||
|
style = settings.DIRECTION_STYLE.get();
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// The argument must be not null as well as the currentLocation
|
||||||
|
// and currentLocation must have bearing.
|
||||||
|
public RelativeDirection(final Location point) {
|
||||||
|
style = settings.DIRECTION_STYLE.get();
|
||||||
|
value = directionTo(point, currentLocation.getBearing());
|
||||||
|
}
|
||||||
|
|
||||||
|
// The first argument must be not null as well as the currentLocation.
|
||||||
|
public RelativeDirection(final Location point, float heading) {
|
||||||
|
style = settings.DIRECTION_STYLE.get();
|
||||||
|
value = directionTo(point, heading);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
value = UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The first argument must be not null as well as the currentLocation.
|
||||||
|
public boolean update(final Location point, float heading) {
|
||||||
|
boolean result = false;
|
||||||
|
final RelativeDirectionStyle newStyle = settings.DIRECTION_STYLE.get();
|
||||||
|
if (style != newStyle) {
|
||||||
|
style = newStyle;
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
final int newValue = directionTo(point, heading);
|
||||||
|
if (value != newValue) {
|
||||||
|
value = newValue;
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The argument must be not null as well as the currentLocation
|
||||||
|
// and currentLocation must have bearing.
|
||||||
|
public boolean update(final Location point) {
|
||||||
|
return update(point, currentLocation.getBearing());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getString() {
|
||||||
|
if (value < 0) // unknown direction
|
||||||
|
return null;
|
||||||
|
if (style == RelativeDirectionStyle.CLOCKWISE) {
|
||||||
|
String result = NavigationInfo.this.getString(R.string.towards);
|
||||||
|
result += " " + String.valueOf((value != 0) ? value : 12); //$NON-NLS-1$
|
||||||
|
result += " " + NavigationInfo.this.getString(R.string.oclock); //$NON-NLS-1$
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
return NavigationInfo.this.getString(direction[value]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The first argument must be not null as well as the currentLocation.
|
||||||
|
private int directionTo(final Location point, float heading) {
|
||||||
|
final float bearing = currentLocation.bearingTo(point) - heading;
|
||||||
|
final int nSectors = (style == RelativeDirectionStyle.CLOCKWISE) ? 12 : direction.length;
|
||||||
|
int sector = (int)Math.round(Math.abs(bearing) * (float)nSectors / FULL_CIRCLE) % nSectors;
|
||||||
|
if ((bearing < 0) && (sector != 0))
|
||||||
|
sector = nSectors - sector;
|
||||||
|
return sector;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private final int[] cardinal = {
|
||||||
|
R.string.north,
|
||||||
|
R.string.north_north_east,
|
||||||
|
R.string.north_east,
|
||||||
|
R.string.east_north_east,
|
||||||
|
R.string.east,
|
||||||
|
R.string.east_south_east,
|
||||||
|
R.string.south_east,
|
||||||
|
R.string.south_south_east,
|
||||||
|
R.string.south,
|
||||||
|
R.string.south_south_west,
|
||||||
|
R.string.south_west,
|
||||||
|
R.string.west_south_west,
|
||||||
|
R.string.west,
|
||||||
|
R.string.west_north_west,
|
||||||
|
R.string.north_west,
|
||||||
|
R.string.north_north_west
|
||||||
|
};
|
||||||
|
|
||||||
|
private Handler uiHandler = new Handler();
|
||||||
|
private final Context context;
|
||||||
|
private final OsmandSettings settings;
|
||||||
|
private Location currentLocation;
|
||||||
|
private RelativeDirection lastDirection;
|
||||||
|
private long lastNotificationTime;
|
||||||
|
private volatile boolean autoAnnounce;
|
||||||
|
|
||||||
|
|
||||||
|
public NavigationInfo(final Context context) {
|
||||||
|
this.context = context;
|
||||||
|
settings = ((OsmandApplication)(context.getApplicationContext())).getSettings();
|
||||||
|
currentLocation = null;
|
||||||
|
lastDirection = new RelativeDirection();
|
||||||
|
lastNotificationTime = SystemClock.uptimeMillis();
|
||||||
|
autoAnnounce = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String getString(int id) {
|
||||||
|
return context.getResources().getString(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The argument must be not null as well as the currentLocation
|
||||||
|
private String distanceString(final Location point) {
|
||||||
|
return OsmAndFormatter.getFormattedDistance(currentLocation.distanceTo(point), context);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The argument must be not null as well as the currentLocation
|
||||||
|
private String absoluteDirectionString(float bearing) {
|
||||||
|
int direction = (int)Math.round(Math.abs(bearing) * (float)cardinal.length / FULL_CIRCLE) % cardinal.length;
|
||||||
|
if ((bearing < 0) && (direction != 0))
|
||||||
|
direction = cardinal.length - direction;
|
||||||
|
return getString(cardinal[direction]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Get distance and direction string for specified point
|
||||||
|
public synchronized String getDirectionString(final Location point, Float heading) {
|
||||||
|
if ((currentLocation != null) && (point != null)) {
|
||||||
|
RelativeDirection direction = null;
|
||||||
|
String result = distanceString(point);
|
||||||
|
result += " "; //$NON-NLS-1$
|
||||||
|
if (currentLocation.hasBearing())
|
||||||
|
direction = new RelativeDirection(point);
|
||||||
|
else if (heading != null)
|
||||||
|
direction = new RelativeDirection(point, heading);
|
||||||
|
if (direction != null) {
|
||||||
|
// relative direction
|
||||||
|
result += direction.getString();
|
||||||
|
} else {
|
||||||
|
// absolute direction
|
||||||
|
result += getString(R.string.towards) + " "; //$NON-NLS-1$
|
||||||
|
result += absoluteDirectionString(currentLocation.bearingTo(point));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized String getDirectionString(final LatLon point, Float heading) {
|
||||||
|
if (point != null) {
|
||||||
|
Location destination = new Location("map"); //$NON-NLS-1$
|
||||||
|
destination.setLatitude(point.getLatitude());
|
||||||
|
destination.setLongitude(point.getLongitude());
|
||||||
|
return getDirectionString(destination, heading);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get current travelling speed and direction
|
||||||
|
public synchronized String getSpeedString() {
|
||||||
|
if ((currentLocation != null) && currentLocation.hasSpeed()) {
|
||||||
|
String result = OsmAndFormatter.getFormattedSpeed(currentLocation.getSpeed(), context);
|
||||||
|
if (currentLocation.hasBearing())
|
||||||
|
result += " " + absoluteDirectionString(currentLocation.getBearing()); //$NON-NLS-1$
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get positioning accuracy and provider information if available
|
||||||
|
public synchronized String getAccuracyString() {
|
||||||
|
String result = null;
|
||||||
|
if (currentLocation != null) {
|
||||||
|
String provider = currentLocation.getProvider();
|
||||||
|
if (currentLocation.hasAccuracy())
|
||||||
|
result = getString(R.string.accuracy) + " " + OsmAndFormatter.getFormattedDistance(currentLocation.getAccuracy(), context); //$NON-NLS-1$
|
||||||
|
if (result != null)
|
||||||
|
result += " (" + provider + ")"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
else
|
||||||
|
result = provider;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get altitude information string
|
||||||
|
public synchronized String getAltitudeString() {
|
||||||
|
if ((currentLocation != null) && currentLocation.hasAltitude())
|
||||||
|
return getString(R.string.altitude) + " " + OsmAndFormatter.getFormattedDistance((float)currentLocation.getAltitude(), context); //$NON-NLS-1$
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public synchronized void setLocation(Location location) {
|
||||||
|
currentLocation = location;
|
||||||
|
if (autoAnnounce) {
|
||||||
|
final LatLon point = settings.getPointToNavigate();
|
||||||
|
if (point != null) {
|
||||||
|
if ((currentLocation != null) && currentLocation.hasBearing()) {
|
||||||
|
final long now = SystemClock.uptimeMillis();
|
||||||
|
if ((now - lastNotificationTime) >= MIN_NOTIFICATION_PERIOD) {
|
||||||
|
Location destination = new Location("map"); //$NON-NLS-1$
|
||||||
|
destination.setLatitude(point.getLatitude());
|
||||||
|
destination.setLongitude(point.getLongitude());
|
||||||
|
if (lastDirection.update(destination)) {
|
||||||
|
final String notification = distanceString(destination) + " " + lastDirection.getString(); //$NON-NLS-1$
|
||||||
|
lastNotificationTime = now;
|
||||||
|
uiHandler.post(new Runnable(){
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
AccessibleToast.makeText(context, notification, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
lastDirection.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Show all available info
|
||||||
|
public void show(final LatLon point, Float heading) {
|
||||||
|
final List<String> attributes = new ArrayList<String>();
|
||||||
|
String item;
|
||||||
|
|
||||||
|
item = getDirectionString(point, heading);
|
||||||
|
if (item != null)
|
||||||
|
attributes.add(item);
|
||||||
|
item = getSpeedString();
|
||||||
|
if (item != null)
|
||||||
|
attributes.add(item);
|
||||||
|
item = getAccuracyString();
|
||||||
|
if (item != null)
|
||||||
|
attributes.add(item);
|
||||||
|
item = getAltitudeString();
|
||||||
|
if (item != null)
|
||||||
|
attributes.add(item);
|
||||||
|
if (attributes.isEmpty())
|
||||||
|
attributes.add(getString(R.string.no_info));
|
||||||
|
|
||||||
|
AlertDialog.Builder info = new AlertDialog.Builder(context);
|
||||||
|
if (point != null)
|
||||||
|
info.setPositiveButton(autoAnnounce ? R.string.auto_announce_off : R.string.auto_announce_on,
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
autoAnnounce = !autoAnnounce;
|
||||||
|
dialog.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
info.setNegativeButton(R.string.close, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
dialog.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
info.setItems(attributes.toArray(new String[attributes.size()]),
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
info.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
41
OsmAnd/src/net/osmand/access/NotificationTextView.java
Normal file
41
OsmAnd/src/net/osmand/access/NotificationTextView.java
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
package net.osmand.access;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
// This class is intended to be used in place of the TextView
|
||||||
|
// when constructing toast notifications to provide accessibility feedback.
|
||||||
|
//
|
||||||
|
public class NotificationTextView extends TextView {
|
||||||
|
|
||||||
|
// Conventional constructors.
|
||||||
|
|
||||||
|
public NotificationTextView(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NotificationTextView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NotificationTextView(Context context, AttributeSet attrs, int style) {
|
||||||
|
super(context, attrs, style);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Overridden callback methods to provide accessible exploration means.
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
|
||||||
|
boolean result = super.dispatchPopulateAccessibilityEvent(event);
|
||||||
|
if (event.getEventType() == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED) {
|
||||||
|
event.getText().clear();
|
||||||
|
event.getText().add(getText().subSequence(0, Math.min(getText().length(), AccessibilityEvent.MAX_TEXT_LENGTH)));
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
21
OsmAnd/src/net/osmand/access/RelativeDirectionStyle.java
Normal file
21
OsmAnd/src/net/osmand/access/RelativeDirectionStyle.java
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
package net.osmand.access;
|
||||||
|
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
public enum RelativeDirectionStyle {
|
||||||
|
|
||||||
|
SIDEWISE(R.string.direction_style_sidewise),
|
||||||
|
CLOCKWISE(R.string.direction_style_clockwise);
|
||||||
|
|
||||||
|
private final int key;
|
||||||
|
|
||||||
|
RelativeDirectionStyle(int key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String toHumanString(RelativeDirectionStyle style, Context ctx) {
|
||||||
|
return ctx.getResources().getString(style.key);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
42
OsmAnd/src/net/osmand/access/TextMessage.java
Normal file
42
OsmAnd/src/net/osmand/access/TextMessage.java
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
package net.osmand.access;
|
||||||
|
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
// This class contains only static methods intended to improve
|
||||||
|
// accessibility for AlertDialog and Toast messages.
|
||||||
|
//
|
||||||
|
// Since usual message in an AlertDialog that is set by
|
||||||
|
// AlertDialog.Builder.setMessage() is spoken only once
|
||||||
|
// at the best case and there is no way to explore or even repeat it,
|
||||||
|
// use public methods of this class to wrap it into a View
|
||||||
|
// and set it by AlertDialog.Builder.setView().
|
||||||
|
// Such message will be focusable and so it can be repeated
|
||||||
|
// by selecting.
|
||||||
|
//
|
||||||
|
public class TextMessage {
|
||||||
|
|
||||||
|
protected static View makeView(Context ctx, CharSequence msg, int resid) {
|
||||||
|
View layout = ((LayoutInflater)(ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE))).inflate(resid, null);
|
||||||
|
((TextView)layout.findViewById(R.id.message)).setText(msg);
|
||||||
|
return layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static View makeView(Context ctx, int msgid, int resid) {
|
||||||
|
View layout = ((LayoutInflater)(ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE))).inflate(resid, null);
|
||||||
|
((TextView)layout.findViewById(R.id.message)).setText(msgid);
|
||||||
|
return layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static View makeView(Context ctx, CharSequence msg) {
|
||||||
|
return makeView(ctx, msg, R.layout.alert);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static View makeView(Context ctx, int msgid) {
|
||||||
|
return makeView(ctx, msgid, R.layout.alert);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -4,19 +4,20 @@ import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.HandlerThread;
|
|
||||||
import net.osmand.Algoritms;
|
import net.osmand.Algoritms;
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.ResultMatcher;
|
import net.osmand.ResultMatcher;
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
import net.osmand.data.TransportStop;
|
|
||||||
import net.osmand.data.MapTileDownloader.DownloadRequest;
|
import net.osmand.data.MapTileDownloader.DownloadRequest;
|
||||||
import net.osmand.data.MapTileDownloader.IMapDownloaderCallback;
|
import net.osmand.data.MapTileDownloader.IMapDownloaderCallback;
|
||||||
|
import net.osmand.data.TransportStop;
|
||||||
import net.osmand.map.ITileSource;
|
import net.osmand.map.ITileSource;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.HandlerThread;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thread to load map objects (POI, transport stops )async
|
* Thread to load map objects (POI, transport stops )async
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -8,9 +8,9 @@ import java.util.Map;
|
||||||
|
|
||||||
import net.osmand.FavouritePoint;
|
import net.osmand.FavouritePoint;
|
||||||
import net.osmand.GPXUtilities;
|
import net.osmand.GPXUtilities;
|
||||||
import net.osmand.LogUtil;
|
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.GPXUtilities.WptPt;
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
|
import net.osmand.LogUtil;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus;
|
||||||
|
|
||||||
|
|
||||||
import net.osmand.Version;
|
import net.osmand.Version;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.plus.activities.LiveMonitoringHelper;
|
import net.osmand.plus.activities.LiveMonitoringHelper;
|
||||||
import net.osmand.plus.activities.SavingTrackHelper;
|
import net.osmand.plus.activities.SavingTrackHelper;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
|
@ -23,8 +24,8 @@ import android.os.Handler;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.SystemClock;
|
|
||||||
import android.os.PowerManager.WakeLock;
|
import android.os.PowerManager.WakeLock;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class NavigationService extends Service implements LocationListener {
|
public class NavigationService extends Service implements LocationListener {
|
||||||
|
@ -206,7 +207,7 @@ public class NavigationService extends Service implements LocationListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onProviderDisabled(String provider) {
|
public void onProviderDisabled(String provider) {
|
||||||
Toast.makeText(this, getString(R.string.off_router_service_no_gps_available), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(this, getString(R.string.off_router_service_no_gps_available), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,10 @@ import java.util.Locale;
|
||||||
import net.osmand.Algoritms;
|
import net.osmand.Algoritms;
|
||||||
import net.osmand.FavouritePoint;
|
import net.osmand.FavouritePoint;
|
||||||
import net.osmand.GPXUtilities;
|
import net.osmand.GPXUtilities;
|
||||||
import net.osmand.LogUtil;
|
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.GPXUtilities.WptPt;
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.LogUtil;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.plus.activities.DayNightHelper;
|
import net.osmand.plus.activities.DayNightHelper;
|
||||||
import net.osmand.plus.activities.SavingTrackHelper;
|
import net.osmand.plus.activities.SavingTrackHelper;
|
||||||
import net.osmand.plus.activities.SettingsActivity;
|
import net.osmand.plus.activities.SettingsActivity;
|
||||||
|
@ -27,7 +27,6 @@ import net.osmand.plus.voice.CommandPlayer;
|
||||||
import net.osmand.plus.voice.CommandPlayerException;
|
import net.osmand.plus.voice.CommandPlayerException;
|
||||||
import net.osmand.plus.voice.CommandPlayerFactory;
|
import net.osmand.plus.voice.CommandPlayerFactory;
|
||||||
import net.osmand.render.RenderingRulesStorage;
|
import net.osmand.render.RenderingRulesStorage;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -426,7 +425,7 @@ public class OsmandApplication extends Application {
|
||||||
uiHandler.post(new Runnable() {
|
uiHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Toast.makeText(uiContext, b.toString(), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(uiContext, b.toString(), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.osmand.Version;
|
import net.osmand.Version;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
|
import net.osmand.access.RelativeDirectionStyle;
|
||||||
import net.osmand.map.ITileSource;
|
import net.osmand.map.ITileSource;
|
||||||
import net.osmand.map.TileSourceManager;
|
import net.osmand.map.TileSourceManager;
|
||||||
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
||||||
|
@ -18,7 +20,6 @@ import net.osmand.plus.activities.search.SearchHistoryHelper;
|
||||||
import net.osmand.plus.render.RendererRegistry;
|
import net.osmand.plus.render.RendererRegistry;
|
||||||
import net.osmand.plus.routing.RouteProvider.RouteService;
|
import net.osmand.plus.routing.RouteProvider.RouteService;
|
||||||
import net.osmand.render.RenderingRulesStorage;
|
import net.osmand.render.RenderingRulesStorage;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.SharedPreferences.Editor;
|
import android.content.SharedPreferences.Editor;
|
||||||
|
@ -408,11 +409,32 @@ public class OsmandSettings {
|
||||||
public final OsmandPreference<MetricsConstants> METRIC_SYSTEM = new EnumIntPreference<MetricsConstants>(
|
public final OsmandPreference<MetricsConstants> METRIC_SYSTEM = new EnumIntPreference<MetricsConstants>(
|
||||||
"default_metric_system", MetricsConstants.KILOMETERS_AND_METERS, true, true, MetricsConstants.values());
|
"default_metric_system", MetricsConstants.KILOMETERS_AND_METERS, true, true, MetricsConstants.values());
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return "direction_style";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
|
// cache of metrics constants as they are used very often
|
||||||
|
public final OsmandPreference<RelativeDirectionStyle> DIRECTION_STYLE = new EnumIntPreference<RelativeDirectionStyle>(
|
||||||
|
"direction_style", RelativeDirectionStyle.SIDEWISE, true, true, RelativeDirectionStyle.values());
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public final OsmandPreference<Boolean> USE_TRACKBALL_FOR_MOVEMENTS =
|
public final OsmandPreference<Boolean> USE_TRACKBALL_FOR_MOVEMENTS =
|
||||||
new BooleanPreference("use_trackball_for_movements", true, true);
|
new BooleanPreference("use_trackball_for_movements", true, true);
|
||||||
|
|
||||||
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
|
public final OsmandPreference<Boolean> ZOOM_BY_TRACKBALL =
|
||||||
|
new BooleanPreference("zoom_by_trackball", true, true);
|
||||||
|
|
||||||
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
|
public final OsmandPreference<Boolean> SCROLL_MAP_BY_GESTURES =
|
||||||
|
new BooleanPreference("scroll_map_by_gestures", true, true);
|
||||||
|
|
||||||
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
|
public final OsmandPreference<Boolean> USE_SHORT_OBJECT_NAMES =
|
||||||
|
new BooleanPreference("use_short_object_names", false, true);
|
||||||
|
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public final OsmandPreference<Boolean> USE_HIGH_RES_MAPS =
|
public final OsmandPreference<Boolean> USE_HIGH_RES_MAPS =
|
||||||
|
@ -684,7 +706,7 @@ public class OsmandSettings {
|
||||||
} else if (dir.isDirectory() && !dir.getName().startsWith(".")) {
|
} else if (dir.isDirectory() && !dir.getName().startsWith(".")) {
|
||||||
TileSourceTemplate t = TileSourceManager.createTileSourceTemplate(dir);
|
TileSourceTemplate t = TileSourceManager.createTileSourceTemplate(dir);
|
||||||
if (warnWhenSelected && !t.isRuleAcceptable()) {
|
if (warnWhenSelected && !t.isRuleAcceptable()) {
|
||||||
Toast.makeText(ctx, ctx.getString(R.string.warning_tile_layer_not_downloadable, dir.getName()), Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(ctx, ctx.getString(R.string.warning_tile_layer_not_downloadable, dir.getName()), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
if (!TileSourceManager.isTileSourceMetaInfoExist(dir)) {
|
if (!TileSourceManager.isTileSourceMetaInfoExist(dir)) {
|
||||||
TileSourceTemplate ret = checkAmongAvailableTileSources(dir, knownTemplates);
|
TileSourceTemplate ret = checkAmongAvailableTileSources(dir, knownTemplates);
|
||||||
|
|
|
@ -6,9 +6,8 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import net.osmand.OsmAndFormatter;
|
import net.osmand.OsmAndFormatter;
|
||||||
import net.osmand.ResultMatcher;
|
import net.osmand.ResultMatcher;
|
||||||
|
|
|
@ -12,9 +12,9 @@ import java.util.TreeMap;
|
||||||
|
|
||||||
import net.osmand.Algoritms;
|
import net.osmand.Algoritms;
|
||||||
import net.osmand.CollatorStringMatcher;
|
import net.osmand.CollatorStringMatcher;
|
||||||
|
import net.osmand.CollatorStringMatcher.StringMatcherMode;
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.ResultMatcher;
|
import net.osmand.ResultMatcher;
|
||||||
import net.osmand.CollatorStringMatcher.StringMatcherMode;
|
|
||||||
import net.osmand.binary.BinaryMapIndexReader;
|
import net.osmand.binary.BinaryMapIndexReader;
|
||||||
import net.osmand.data.Building;
|
import net.osmand.data.Building;
|
||||||
import net.osmand.data.City;
|
import net.osmand.data.City;
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.ResultMatcher;
|
import net.osmand.ResultMatcher;
|
||||||
import net.osmand.binary.BinaryMapIndexReader;
|
import net.osmand.binary.BinaryMapIndexReader;
|
||||||
|
|
|
@ -12,6 +12,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.ResourceManager;
|
import net.osmand.plus.ResourceManager;
|
||||||
|
@ -106,7 +107,7 @@ public class ContributionVersionActivity extends OsmandListActivity {
|
||||||
}
|
}
|
||||||
if(operationId == DOWNLOAD_BUILDS_LIST){
|
if(operationId == DOWNLOAD_BUILDS_LIST){
|
||||||
if(e != null){
|
if(e != null){
|
||||||
Toast.makeText(this, getString(R.string.loading_builds_failed) + " : " + e.getMessage(), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(this, getString(R.string.loading_builds_failed) + " : " + e.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
finish();
|
finish();
|
||||||
} else {
|
} else {
|
||||||
setListAdapter(new OsmandBuildsAdapter(downloadedBuilds));
|
setListAdapter(new OsmandBuildsAdapter(downloadedBuilds));
|
||||||
|
@ -131,7 +132,7 @@ public class ContributionVersionActivity extends OsmandListActivity {
|
||||||
|
|
||||||
private void updateInstalledApp(boolean showMessage, Date d) {
|
private void updateInstalledApp(boolean showMessage, Date d) {
|
||||||
if (showMessage) {
|
if (showMessage) {
|
||||||
Toast.makeText(
|
AccessibleToast.makeText(
|
||||||
this,
|
this,
|
||||||
MessageFormat.format(getString(R.string.build_installed), currentSelectedBuild.tag, dateFormat
|
MessageFormat.format(getString(R.string.build_installed), currentSelectedBuild.tag, dateFormat
|
||||||
.format(currentSelectedBuild.date)), Toast.LENGTH_LONG).show();
|
.format(currentSelectedBuild.date)), Toast.LENGTH_LONG).show();
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class CustomTitleBar {
|
||||||
|
|
||||||
protected void initBackButton() {
|
protected void initBackButton() {
|
||||||
Button backButton = (Button) activity.findViewById(R.id.back_button);
|
Button backButton = (Button) activity.findViewById(R.id.back_button);
|
||||||
|
backButton.setContentDescription(activity.getString(R.string.close));
|
||||||
backButton.setOnClickListener(new View.OnClickListener() {
|
backButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
|
@ -11,6 +11,12 @@ import java.util.List;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
|
|
||||||
|
import net.osmand.IProgress;
|
||||||
|
import net.osmand.LogUtil;
|
||||||
|
import net.osmand.Version;
|
||||||
|
import net.osmand.data.IndexConstants;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
@ -18,12 +24,6 @@ import android.content.Context;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
|
|
||||||
import net.osmand.IProgress;
|
|
||||||
import net.osmand.LogUtil;
|
|
||||||
import net.osmand.Version;
|
|
||||||
import net.osmand.data.IndexConstants;
|
|
||||||
import net.osmand.plus.R;
|
|
||||||
|
|
||||||
public class DownloadFileHelper {
|
public class DownloadFileHelper {
|
||||||
|
|
||||||
private final static Log log = LogUtil.getLog(DownloadFileHelper.class);
|
private final static Log log = LogUtil.getLog(DownloadFileHelper.class);
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.util.TreeSet;
|
||||||
|
|
||||||
import net.osmand.IProgress;
|
import net.osmand.IProgress;
|
||||||
import net.osmand.Version;
|
import net.osmand.Version;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.IndexConstants;
|
import net.osmand.data.IndexConstants;
|
||||||
import net.osmand.plus.DownloadOsmandIndexesHelper;
|
import net.osmand.plus.DownloadOsmandIndexesHelper;
|
||||||
import net.osmand.plus.DownloadOsmandIndexesHelper.IndexItem;
|
import net.osmand.plus.DownloadOsmandIndexesHelper.IndexItem;
|
||||||
|
@ -234,7 +235,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
entriesToDownload.put(es.getFileName(), createDownloadEntry(es));
|
entriesToDownload.put(es.getFileName(), createDownloadEntry(es));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Toast.makeText(this, MessageFormat.format(getString(R.string.items_were_selected), selected), Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(this, MessageFormat.format(getString(R.string.items_were_selected), selected), Toast.LENGTH_SHORT).show();
|
||||||
listAdapter.notifyDataSetInvalidated();
|
listAdapter.notifyDataSetInvalidated();
|
||||||
if(selected > 0){
|
if(selected > 0){
|
||||||
findViewById(R.id.DownloadButton).setVisibility(View.VISIBLE);
|
findViewById(R.id.DownloadButton).setVisibility(View.VISIBLE);
|
||||||
|
@ -291,7 +292,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
uiActivity.showDialog(DownloadIndexActivity.DIALOG_MAP_VERSION_UPDATE);
|
uiActivity.showDialog(DownloadIndexActivity.DIALOG_MAP_VERSION_UPDATE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(uiActivity, R.string.list_index_files_was_not_loaded, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(uiActivity, R.string.list_index_files_was_not_loaded, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -521,7 +522,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
}
|
}
|
||||||
final DownloadEntry entry;
|
final DownloadEntry entry;
|
||||||
if(parent == null || !parent.exists()){
|
if(parent == null || !parent.exists()){
|
||||||
Toast.makeText(DownloadIndexActivity.this, getString(R.string.sd_dir_not_accessible), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(DownloadIndexActivity.this, getString(R.string.sd_dir_not_accessible), Toast.LENGTH_LONG).show();
|
||||||
entry = null;
|
entry = null;
|
||||||
} else {
|
} else {
|
||||||
entry = new DownloadEntry();
|
entry = new DownloadEntry();
|
||||||
|
@ -586,7 +587,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
asz = (((long) fs.getAvailableBlocks()) * fs.getBlockSize()) / (1 << 20);
|
asz = (((long) fs.getAvailableBlocks()) * fs.getBlockSize()) / (1 << 20);
|
||||||
}
|
}
|
||||||
if(asz != -1 && asz < sz ){
|
if(asz != -1 && asz < sz ){
|
||||||
Toast.makeText(this, getString(R.string.download_files_not_enough_space, sz, asz), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(this, getString(R.string.download_files_not_enough_space, sz, asz), Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
Builder builder = new AlertDialog.Builder(this);
|
Builder builder = new AlertDialog.Builder(this);
|
||||||
if (asz > 0 && sz/asz > 0.8) {
|
if (asz > 0 && sz/asz > 0.8) {
|
||||||
|
@ -653,7 +654,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
findViewById(R.id.DownloadButton).setVisibility(
|
findViewById(R.id.DownloadButton).setVisibility(
|
||||||
entriesToDownload.isEmpty() ? View.GONE : View.VISIBLE);
|
entriesToDownload.isEmpty() ? View.GONE : View.VISIBLE);
|
||||||
} else if(o instanceof String) {
|
} else if(o instanceof String) {
|
||||||
Toast.makeText(DownloadIndexActivity.this, (String) o, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(DownloadIndexActivity.this, (String) o, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.onProgressUpdate(values);
|
super.onProgressUpdate(values);
|
||||||
|
@ -672,7 +673,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(String result) {
|
protected void onPostExecute(String result) {
|
||||||
if(result != null){
|
if(result != null){
|
||||||
Toast.makeText(DownloadIndexActivity.this, result, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(DownloadIndexActivity.this, result, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
View mainView = findViewById(R.id.MainLayout);
|
View mainView = findViewById(R.id.MainLayout);
|
||||||
if(mainView != null){
|
if(mainView != null){
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.Version;
|
import net.osmand.Version;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.MapTileDownloader;
|
import net.osmand.data.MapTileDownloader;
|
||||||
import net.osmand.data.MapTileDownloader.DownloadRequest;
|
import net.osmand.data.MapTileDownloader.DownloadRequest;
|
||||||
import net.osmand.data.MapTileDownloader.IMapDownloaderCallback;
|
import net.osmand.data.MapTileDownloader.IMapDownloaderCallback;
|
||||||
|
@ -20,8 +21,8 @@ import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.ProgressDialog;
|
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
|
import android.app.ProgressDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
|
@ -50,11 +51,11 @@ public class DownloadTilesDialog {
|
||||||
public void openDialog(){
|
public void openDialog(){
|
||||||
BaseMapLayer mainLayer = mapView.getMainLayer();
|
BaseMapLayer mainLayer = mapView.getMainLayer();
|
||||||
if(!(mainLayer instanceof MapTileLayer) || !((MapTileLayer) mainLayer).isVisible()){
|
if(!(mainLayer instanceof MapTileLayer) || !((MapTileLayer) mainLayer).isVisible()){
|
||||||
Toast.makeText(ctx, R.string.maps_could_not_be_downloaded, Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(ctx, R.string.maps_could_not_be_downloaded, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
final ITileSource mapSource = ((MapTileLayer) mainLayer).getMap();
|
final ITileSource mapSource = ((MapTileLayer) mainLayer).getMap();
|
||||||
if(mapSource == null || !mapSource.couldBeDownloadedFromInternet()){
|
if(mapSource == null || !mapSource.couldBeDownloadedFromInternet()){
|
||||||
Toast.makeText(ctx, R.string.maps_could_not_be_downloaded, Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(ctx, R.string.maps_could_not_be_downloaded, Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final int max = mapSource.getMaximumZoomSupported();
|
final int max = mapSource.getMaximumZoomSupported();
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.LinkedHashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import net.osmand.OsmAndFormatter;
|
import net.osmand.OsmAndFormatter;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.AmenityType;
|
import net.osmand.data.AmenityType;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
import net.osmand.osm.MapRenderingTypes;
|
import net.osmand.osm.MapRenderingTypes;
|
||||||
|
@ -123,7 +124,7 @@ public class EditPOIFilterActivity extends OsmandListActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
if (helper.removePoiFilter(filter)) {
|
if (helper.removePoiFilter(filter)) {
|
||||||
Toast.makeText(
|
AccessibleToast.makeText(
|
||||||
EditPOIFilterActivity.this,
|
EditPOIFilterActivity.this,
|
||||||
MessageFormat.format(EditPOIFilterActivity.this.getText(R.string.edit_filter_delete_message).toString(),
|
MessageFormat.format(EditPOIFilterActivity.this.getText(R.string.edit_filter_delete_message).toString(),
|
||||||
filter.getName()), Toast.LENGTH_SHORT).show();
|
filter.getName()), Toast.LENGTH_SHORT).show();
|
||||||
|
@ -145,7 +146,7 @@ public class EditPOIFilterActivity extends OsmandListActivity {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
PoiFilter nFilter = new PoiFilter(editText.getText().toString(), null, filter.getAcceptedTypes(), (OsmandApplication) getApplication());
|
PoiFilter nFilter = new PoiFilter(editText.getText().toString(), null, filter.getAcceptedTypes(), (OsmandApplication) getApplication());
|
||||||
if (helper.createPoiFilter(nFilter)) {
|
if (helper.createPoiFilter(nFilter)) {
|
||||||
Toast.makeText(
|
AccessibleToast.makeText(
|
||||||
EditPOIFilterActivity.this,
|
EditPOIFilterActivity.this,
|
||||||
MessageFormat.format(EditPOIFilterActivity.this.getText(R.string.edit_filter_create_message).toString(),
|
MessageFormat.format(EditPOIFilterActivity.this.getText(R.string.edit_filter_create_message).toString(),
|
||||||
editText.getText().toString()), Toast.LENGTH_SHORT).show();
|
editText.getText().toString()), Toast.LENGTH_SHORT).show();
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.osmand.OpenstreetmapLocalUtil;
|
||||||
import net.osmand.OpenstreetmapRemoteUtil;
|
import net.osmand.OpenstreetmapRemoteUtil;
|
||||||
import net.osmand.OpenstreetmapUtil;
|
import net.osmand.OpenstreetmapUtil;
|
||||||
import net.osmand.OsmAndFormatter;
|
import net.osmand.OsmAndFormatter;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
import net.osmand.data.AmenityType;
|
import net.osmand.data.AmenityType;
|
||||||
import net.osmand.osm.EntityInfo;
|
import net.osmand.osm.EntityInfo;
|
||||||
|
@ -86,7 +87,7 @@ public class EditingPOIActivity implements DialogProvider {
|
||||||
if(n != null){
|
if(n != null){
|
||||||
showPOIDialog(DIALOG_EDIT_POI, n, editA.getType(), editA.getSubType());
|
showPOIDialog(DIALOG_EDIT_POI, n, editA.getType(), editA.getSubType());
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(ctx, ctx.getString(R.string.poi_error_poi_not_found), Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(ctx, ctx.getString(R.string.poi_error_poi_not_found), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +107,7 @@ public class EditingPOIActivity implements DialogProvider {
|
||||||
public void showDeleteDialog(Amenity a){
|
public void showDeleteDialog(Amenity a){
|
||||||
final Node n = openstreetmapUtil.loadNode(a);
|
final Node n = openstreetmapUtil.loadNode(a);
|
||||||
if(n == null){
|
if(n == null){
|
||||||
Toast.makeText(ctx, ctx.getResources().getString(R.string.poi_error_poi_not_found), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(ctx, ctx.getResources().getString(R.string.poi_error_poi_not_found), Toast.LENGTH_LONG).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dialogBundle.putSerializable(KEY_AMENITY, a);
|
dialogBundle.putSerializable(KEY_AMENITY, a);
|
||||||
|
@ -135,7 +136,7 @@ public class EditingPOIActivity implements DialogProvider {
|
||||||
commitNode(OpenstreetmapUtil.Action.DELETE, n, openstreetmapUtil.getEntityInfo(), c, new Runnable(){
|
commitNode(OpenstreetmapUtil.Action.DELETE, n, openstreetmapUtil.getEntityInfo(), c, new Runnable(){
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Toast.makeText(ctx, ctx.getResources().getString(R.string.poi_remove_success), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(ctx, ctx.getResources().getString(R.string.poi_remove_success), Toast.LENGTH_LONG).show();
|
||||||
if(ctx.getMapView() != null){
|
if(ctx.getMapView() != null){
|
||||||
ctx.getMapView().refreshMap();
|
ctx.getMapView().refreshMap();
|
||||||
}
|
}
|
||||||
|
@ -279,7 +280,7 @@ public class EditingPOIActivity implements DialogProvider {
|
||||||
commitNode(action, n, openstreetmapUtil.getEntityInfo(), commentText.getText().toString(), new Runnable() {
|
commitNode(action, n, openstreetmapUtil.getEntityInfo(), commentText.getText().toString(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Toast.makeText(ctx, MessageFormat.format(ctx.getResources().getString(R.string.poi_action_succeded_template), msg),
|
AccessibleToast.makeText(ctx, MessageFormat.format(ctx.getResources().getString(R.string.poi_action_succeded_template), msg),
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
if (ctx.getMapView() != null) {
|
if (ctx.getMapView() != null) {
|
||||||
ctx.getMapView().refreshMap();
|
ctx.getMapView().refreshMap();
|
||||||
|
@ -322,7 +323,7 @@ public class EditingPOIActivity implements DialogProvider {
|
||||||
private Dialog createOpenHoursDlg(){
|
private Dialog createOpenHoursDlg(){
|
||||||
List<OpeningHoursRule> time = OpeningHoursParser.parseOpenedHours(openingHours.getText().toString());
|
List<OpeningHoursRule> time = OpeningHoursParser.parseOpenedHours(openingHours.getText().toString());
|
||||||
if(time == null){
|
if(time == null){
|
||||||
Toast.makeText(ctx, ctx.getString(R.string.opening_hours_not_supported), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(ctx, ctx.getString(R.string.opening_hours_not_supported), Toast.LENGTH_LONG).show();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,10 +368,10 @@ public class EditingPOIActivity implements DialogProvider {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (repo == null) {
|
if (repo == null) {
|
||||||
Toast.makeText(app, app.getString(R.string.update_poi_no_offline_poi_index), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(app, app.getString(R.string.update_poi_no_offline_poi_index), Toast.LENGTH_LONG).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(app, app.getString(R.string.update_poi_does_not_change_indexes), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(app, app.getString(R.string.update_poi_does_not_change_indexes), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -394,7 +395,7 @@ public class EditingPOIActivity implements DialogProvider {
|
||||||
|
|
||||||
public void commitNode(final OpenstreetmapUtil.Action action, final Node n, final EntityInfo info, final String comment, final Runnable successAction) {
|
public void commitNode(final OpenstreetmapUtil.Action action, final Node n, final EntityInfo info, final String comment, final Runnable successAction) {
|
||||||
if (info == null && OpenstreetmapUtil.Action.CREATE != action) {
|
if (info == null && OpenstreetmapUtil.Action.CREATE != action) {
|
||||||
Toast.makeText(ctx, ctx.getResources().getString(R.string.poi_error_info_not_loaded), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(ctx, ctx.getResources().getString(R.string.poi_error_info_not_loaded), Toast.LENGTH_LONG).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final ProgressDialog progress = ProgressDialog.show(ctx, ctx.getString(R.string.uploading), ctx.getString(R.string.uploading_data));
|
final ProgressDialog progress = ProgressDialog.show(ctx, ctx.getString(R.string.uploading), ctx.getString(R.string.uploading_data));
|
||||||
|
|
|
@ -19,6 +19,7 @@ import net.osmand.GPXUtilities;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.GPXUtilities.WptPt;
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
import net.osmand.OsmAndFormatter;
|
import net.osmand.OsmAndFormatter;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
import net.osmand.osm.MapUtils;
|
import net.osmand.osm.MapUtils;
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
|
@ -294,7 +295,7 @@ public class FavouritesActivity extends OsmandExpandableListActivity {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
boolean deleted = helper.deleteFavourite(point);
|
boolean deleted = helper.deleteFavourite(point);
|
||||||
if (deleted) {
|
if (deleted) {
|
||||||
Toast.makeText(FavouritesActivity.this,
|
AccessibleToast.makeText(FavouritesActivity.this,
|
||||||
MessageFormat.format(resources.getString(R.string.favourites_remove_dialog_success), point.getName()),
|
MessageFormat.format(resources.getString(R.string.favourites_remove_dialog_success), point.getName()),
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
favouritesAdapter.synchronizeGroups();
|
favouritesAdapter.synchronizeGroups();
|
||||||
|
@ -343,9 +344,9 @@ public class FavouritesActivity extends OsmandExpandableListActivity {
|
||||||
final File tosave = new File(appDir, FavouritesDbHelper.FILE_TO_SAVE);
|
final File tosave = new File(appDir, FavouritesDbHelper.FILE_TO_SAVE);
|
||||||
if(item.getItemId() == EXPORT_ID){
|
if(item.getItemId() == EXPORT_ID){
|
||||||
if(favouritesAdapter.isEmpty()){
|
if(favouritesAdapter.isEmpty()){
|
||||||
Toast.makeText(this, R.string.no_fav_to_save, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(this, R.string.no_fav_to_save, Toast.LENGTH_LONG).show();
|
||||||
} else if(!appDir.exists()){
|
} else if(!appDir.exists()){
|
||||||
Toast.makeText(this, R.string.sd_dir_not_accessible, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(this, R.string.sd_dir_not_accessible, Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
final AsyncTask<Void, Void, String> exportTask = new AsyncTask<Void, Void, String>(){
|
final AsyncTask<Void, Void, String> exportTask = new AsyncTask<Void, Void, String>(){
|
||||||
@Override
|
@Override
|
||||||
|
@ -362,11 +363,11 @@ public class FavouritesActivity extends OsmandExpandableListActivity {
|
||||||
protected void onPostExecute(String warning) {
|
protected void onPostExecute(String warning) {
|
||||||
hideProgressBar();
|
hideProgressBar();
|
||||||
if(warning == null){
|
if(warning == null){
|
||||||
Toast.makeText(
|
AccessibleToast.makeText(
|
||||||
FavouritesActivity.this,
|
FavouritesActivity.this,
|
||||||
MessageFormat.format(getString(R.string.fav_saved_sucessfully), tosave.getAbsolutePath()), Toast.LENGTH_LONG).show();
|
MessageFormat.format(getString(R.string.fav_saved_sucessfully), tosave.getAbsolutePath()), Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(FavouritesActivity.this, warning, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(FavouritesActivity.this, warning, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -388,7 +389,7 @@ public class FavouritesActivity extends OsmandExpandableListActivity {
|
||||||
}
|
}
|
||||||
} else if(item.getItemId() == IMPORT_ID){
|
} else if(item.getItemId() == IMPORT_ID){
|
||||||
if(!tosave.exists()){
|
if(!tosave.exists()){
|
||||||
Toast.makeText(this, MessageFormat.format(getString(R.string.fav_file_to_load_not_found), tosave.getAbsolutePath()), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(this, MessageFormat.format(getString(R.string.fav_file_to_load_not_found), tosave.getAbsolutePath()), Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
new AsyncTask<Void, FavouritePoint, String>(){
|
new AsyncTask<Void, FavouritePoint, String>(){
|
||||||
@Override
|
@Override
|
||||||
|
@ -440,9 +441,9 @@ public class FavouritesActivity extends OsmandExpandableListActivity {
|
||||||
protected void onPostExecute(String warning) {
|
protected void onPostExecute(String warning) {
|
||||||
hideProgressBar();
|
hideProgressBar();
|
||||||
if(warning == null){
|
if(warning == null){
|
||||||
Toast.makeText(FavouritesActivity.this, R.string.fav_imported_sucessfully, Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(FavouritesActivity.this, R.string.fav_imported_sucessfully, Toast.LENGTH_SHORT).show();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(FavouritesActivity.this, warning, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(FavouritesActivity.this, warning, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
favouritesAdapter.synchronizeGroups();
|
favouritesAdapter.synchronizeGroups();
|
||||||
favouritesAdapter.sort(new Comparator<FavouritePoint>(){
|
favouritesAdapter.sort(new Comparator<FavouritePoint>(){
|
||||||
|
|
|
@ -6,8 +6,6 @@ package net.osmand.plus.activities;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.android.apps.analytics.easytracking.TrackedListActivity;
|
|
||||||
|
|
||||||
import net.osmand.FavouritePoint;
|
import net.osmand.FavouritePoint;
|
||||||
import net.osmand.OsmAndFormatter;
|
import net.osmand.OsmAndFormatter;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
|
@ -19,8 +17,8 @@ import net.osmand.plus.activities.search.SearchActivity;
|
||||||
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -32,6 +30,8 @@ import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.google.android.apps.analytics.easytracking.TrackedListActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -14,14 +14,14 @@ import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import net.osmand.GPXUtilities;
|
import net.osmand.GPXUtilities;
|
||||||
import net.osmand.OsmAndFormatter;
|
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.GPXUtilities.Track;
|
import net.osmand.GPXUtilities.Track;
|
||||||
import net.osmand.GPXUtilities.TrkSegment;
|
import net.osmand.GPXUtilities.TrkSegment;
|
||||||
import net.osmand.GPXUtilities.WptPt;
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
|
import net.osmand.OsmAndFormatter;
|
||||||
import net.osmand.binary.BinaryIndexPart;
|
import net.osmand.binary.BinaryIndexPart;
|
||||||
import net.osmand.binary.BinaryMapIndexReader;
|
|
||||||
import net.osmand.binary.BinaryMapAddressReaderAdapter.AddressRegion;
|
import net.osmand.binary.BinaryMapAddressReaderAdapter.AddressRegion;
|
||||||
|
import net.osmand.binary.BinaryMapIndexReader;
|
||||||
import net.osmand.binary.BinaryMapIndexReader.MapIndex;
|
import net.osmand.binary.BinaryMapIndexReader.MapIndex;
|
||||||
import net.osmand.binary.BinaryMapIndexReader.MapRoot;
|
import net.osmand.binary.BinaryMapIndexReader.MapRoot;
|
||||||
import net.osmand.binary.BinaryMapPoiReaderAdapter.PoiRegion;
|
import net.osmand.binary.BinaryMapPoiReaderAdapter.PoiRegion;
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.util.Set;
|
||||||
import net.osmand.Algoritms;
|
import net.osmand.Algoritms;
|
||||||
import net.osmand.GPXUtilities.WptPt;
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
import net.osmand.IProgress;
|
import net.osmand.IProgress;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -220,14 +221,14 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
|
||||||
String newName = editText.getText().toString();
|
String newName = editText.getText().toString();
|
||||||
File dest = new File(f.getParentFile(), newName);
|
File dest = new File(f.getParentFile(), newName);
|
||||||
if (dest.exists()) {
|
if (dest.exists()) {
|
||||||
Toast.makeText(LocalIndexesActivity.this, R.string.file_with_name_already_exists, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(LocalIndexesActivity.this, R.string.file_with_name_already_exists, Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
if(f.renameTo(dest)){
|
if(f.renameTo(dest)){
|
||||||
asyncLoader = new LoadLocalIndexTask();
|
asyncLoader = new LoadLocalIndexTask();
|
||||||
asyncLoader.execute(LocalIndexesActivity.this);
|
asyncLoader.execute(LocalIndexesActivity.this);
|
||||||
reloadIndexes();
|
reloadIndexes();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(LocalIndexesActivity.this, R.string.file_can_not_be_renamed, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(LocalIndexesActivity.this, R.string.file_can_not_be_renamed, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,7 +395,7 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(String result) {
|
protected void onPostExecute(String result) {
|
||||||
findViewById(R.id.ProgressBar).setVisibility(View.GONE);
|
findViewById(R.id.ProgressBar).setVisibility(View.GONE);
|
||||||
Toast.makeText(LocalIndexesActivity.this, result, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(LocalIndexesActivity.this, result, Toast.LENGTH_LONG).show();
|
||||||
listAdapter.clear();
|
listAdapter.clear();
|
||||||
reloadIndexes();
|
reloadIndexes();
|
||||||
|
|
||||||
|
@ -444,7 +445,7 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
|
||||||
}
|
}
|
||||||
b.append(values[i]);
|
b.append(values[i]);
|
||||||
}
|
}
|
||||||
Toast.makeText(LocalIndexesActivity.this, b.toString(), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(LocalIndexesActivity.this, b.toString(), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,7 +457,7 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(String result) {
|
protected void onPostExecute(String result) {
|
||||||
findViewById(R.id.ProgressBar).setVisibility(View.GONE);
|
findViewById(R.id.ProgressBar).setVisibility(View.GONE);
|
||||||
Toast.makeText(LocalIndexesActivity.this, result, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(LocalIndexesActivity.this, result, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -583,7 +584,7 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
|
||||||
final String actionButton = value;
|
final String actionButton = value;
|
||||||
if(listAdapter.getGroupCount() == 0){
|
if(listAdapter.getGroupCount() == 0){
|
||||||
listAdapter.cancelFilter();
|
listAdapter.cancelFilter();
|
||||||
Toast.makeText(LocalIndexesActivity.this, getString(R.string.local_index_no_items_to_do, actionButton.toLowerCase()), Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(LocalIndexesActivity.this, getString(R.string.local_index_no_items_to_do, actionButton.toLowerCase()), Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
collapseAllGroups();
|
collapseAllGroups();
|
||||||
|
@ -597,7 +598,7 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if(selectedItems.isEmpty()){
|
if(selectedItems.isEmpty()){
|
||||||
Toast.makeText(LocalIndexesActivity.this, getString(R.string.local_index_no_items_to_do, actionButton.toLowerCase()), Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(LocalIndexesActivity.this, getString(R.string.local_index_no_items_to_do, actionButton.toLowerCase()), Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -706,7 +707,7 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
|
||||||
}
|
}
|
||||||
b.append(w);
|
b.append(w);
|
||||||
}
|
}
|
||||||
Toast.makeText(LocalIndexesActivity.this, b.toString(), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(LocalIndexesActivity.this, b.toString(), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
asyncLoader.execute(LocalIndexesActivity.this);
|
asyncLoader.execute(LocalIndexesActivity.this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import net.osmand.LogUtil;
|
||||||
import net.osmand.OpenstreetmapPoint;
|
import net.osmand.OpenstreetmapPoint;
|
||||||
import net.osmand.OpenstreetmapRemoteUtil;
|
import net.osmand.OpenstreetmapRemoteUtil;
|
||||||
import net.osmand.OpenstreetmapUtil;
|
import net.osmand.OpenstreetmapUtil;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.osm.EntityInfo;
|
import net.osmand.osm.EntityInfo;
|
||||||
import net.osmand.plus.AmenityIndexRepositoryOdb;
|
import net.osmand.plus.AmenityIndexRepositoryOdb;
|
||||||
import net.osmand.plus.OpenstreetmapsDbHelper;
|
import net.osmand.plus.OpenstreetmapsDbHelper;
|
||||||
|
@ -185,7 +186,7 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity {
|
||||||
protected void onPostExecute(Integer result) {
|
protected void onPostExecute(Integer result) {
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
if(result != null){
|
if(result != null){
|
||||||
Toast.makeText(LocalOpenstreetmapActivity.this, MessageFormat.format(getString(R.string.local_openstreetmap_poi_were_uploaded), result.intValue()), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(LocalOpenstreetmapActivity.this, MessageFormat.format(getString(R.string.local_openstreetmap_poi_were_uploaded), result.intValue()), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
removeDialog(DIALOG_PROGRESS_UPLOAD);
|
removeDialog(DIALOG_PROGRESS_UPLOAD);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,6 @@ import java.io.File;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.google.android.apps.analytics.easytracking.TrackedActivity;
|
|
||||||
|
|
||||||
import net.osmand.Version;
|
import net.osmand.Version;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -14,9 +12,9 @@ import net.osmand.plus.activities.search.SearchActivity;
|
||||||
import net.osmand.plus.render.MapRenderRepositories;
|
import net.osmand.plus.render.MapRenderRepositories;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.app.AlertDialog.Builder;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.app.AlertDialog.Builder;
|
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
@ -32,13 +30,15 @@ import android.text.method.LinkMovementMethod;
|
||||||
import android.text.style.ClickableSpan;
|
import android.text.style.ClickableSpan;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
|
import android.view.Window;
|
||||||
import android.view.animation.AccelerateInterpolator;
|
import android.view.animation.AccelerateInterpolator;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.view.animation.TranslateAnimation;
|
import android.view.animation.TranslateAnimation;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.google.android.apps.analytics.easytracking.TrackedActivity;
|
||||||
|
|
||||||
public class MainMenuActivity extends TrackedActivity {
|
public class MainMenuActivity extends TrackedActivity {
|
||||||
|
|
||||||
private static final String FIRST_TIME_APP_RUN = "FIRST_TIME_APP_RUN"; //$NON-NLS-1$
|
private static final String FIRST_TIME_APP_RUN = "FIRST_TIME_APP_RUN"; //$NON-NLS-1$
|
||||||
|
|
|
@ -4,14 +4,13 @@ import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.android.apps.analytics.easytracking.TrackedActivity;
|
|
||||||
|
|
||||||
import net.osmand.Algoritms;
|
import net.osmand.Algoritms;
|
||||||
import net.osmand.GPXUtilities;
|
import net.osmand.GPXUtilities;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.GPXUtilities.WptPt;
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.Version;
|
import net.osmand.Version;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.MapTileDownloader.DownloadRequest;
|
import net.osmand.data.MapTileDownloader.DownloadRequest;
|
||||||
import net.osmand.data.MapTileDownloader.IMapDownloaderCallback;
|
import net.osmand.data.MapTileDownloader.IMapDownloaderCallback;
|
||||||
import net.osmand.map.IMapLocationListener;
|
import net.osmand.map.IMapLocationListener;
|
||||||
|
@ -63,8 +62,8 @@ import android.os.Environment;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.provider.Settings.Secure;
|
import android.provider.Settings.Secure;
|
||||||
import android.util.Log;
|
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
|
@ -78,6 +77,8 @@ import android.view.animation.Animation;
|
||||||
import android.view.animation.Transformation;
|
import android.view.animation.Transformation;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.google.android.apps.analytics.easytracking.TrackedActivity;
|
||||||
|
|
||||||
public class MapActivity extends TrackedActivity implements IMapLocationListener, SensorEventListener {
|
public class MapActivity extends TrackedActivity implements IMapLocationListener, SensorEventListener {
|
||||||
|
|
||||||
private static final String GPS_STATUS_ACTIVITY = "com.eclipsim.gpsstatus2.GPSStatus"; //$NON-NLS-1$
|
private static final String GPS_STATUS_ACTIVITY = "com.eclipsim.gpsstatus2.GPSStatus"; //$NON-NLS-1$
|
||||||
|
@ -97,6 +98,9 @@ public class MapActivity extends TrackedActivity implements IMapLocationListener
|
||||||
private static final int LOST_LOCATION_MSG_ID = 10;
|
private static final int LOST_LOCATION_MSG_ID = 10;
|
||||||
private static final long LOST_LOCATION_CHECK_DELAY = 20000;
|
private static final long LOST_LOCATION_CHECK_DELAY = 20000;
|
||||||
|
|
||||||
|
private static final int LONG_KEYPRESS_MSG_ID = 28;
|
||||||
|
private static final int LONG_KEYPRESS_DELAY = 500;
|
||||||
|
|
||||||
private long lastTimeAutoZooming = 0;
|
private long lastTimeAutoZooming = 0;
|
||||||
|
|
||||||
private long lastTimeGPSLocationFixed = 0;
|
private long lastTimeGPSLocationFixed = 0;
|
||||||
|
@ -162,7 +166,7 @@ public class MapActivity extends TrackedActivity implements IMapLocationListener
|
||||||
public void onDismiss(DialogInterface dialog) {
|
public void onDismiss(DialogInterface dialog) {
|
||||||
OsmandApplication app = ((OsmandApplication) getApplication());
|
OsmandApplication app = ((OsmandApplication) getApplication());
|
||||||
if (settings.MAP_VECTOR_DATA.get() && app.getResourceManager().getRenderer().isEmpty()) {
|
if (settings.MAP_VECTOR_DATA.get() && app.getResourceManager().getRenderer().isEmpty()) {
|
||||||
Toast.makeText(MapActivity.this, getString(R.string.no_vector_map_loaded), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(MapActivity.this, getString(R.string.no_vector_map_loaded), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -627,7 +631,7 @@ public class MapActivity extends TrackedActivity implements IMapLocationListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(locationLayer.getLastKnownLocation() == null){
|
if(locationLayer.getLastKnownLocation() == null){
|
||||||
Toast.makeText(this, R.string.unknown_location, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(this, R.string.unknown_location, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -967,9 +971,9 @@ public class MapActivity extends TrackedActivity implements IMapLocationListener
|
||||||
if(Environment.MEDIA_MOUNTED.equals(state)){
|
if(Environment.MEDIA_MOUNTED.equals(state)){
|
||||||
// ok
|
// ok
|
||||||
} else if(Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)){
|
} else if(Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)){
|
||||||
Toast.makeText(this, R.string.sd_mounted_ro, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(this, R.string.sd_mounted_ro, Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(this, R.string.sd_unmounted, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(this, R.string.sd_unmounted, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1337,7 +1341,7 @@ public class MapActivity extends TrackedActivity implements IMapLocationListener
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (settings.MAP_ACTIVITY_ENABLED.get()) {
|
if (settings.MAP_ACTIVITY_ENABLED.get()) {
|
||||||
Toast.makeText(MapActivity.this, R.string.auto_follow_location_enabled, Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(MapActivity.this, R.string.auto_follow_location_enabled, Toast.LENGTH_SHORT).show();
|
||||||
backToLocationImpl();
|
backToLocationImpl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import net.osmand.FavouritePoint;
|
||||||
import net.osmand.GPXUtilities;
|
import net.osmand.GPXUtilities;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
import net.osmand.map.ITileSource;
|
import net.osmand.map.ITileSource;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
|
@ -144,7 +145,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
point.setCategory(cat.getText().toString());
|
point.setCategory(cat.getText().toString());
|
||||||
boolean added = helper.addFavourite(point);
|
boolean added = helper.addFavourite(point);
|
||||||
if (added) {
|
if (added) {
|
||||||
Toast.makeText(mapActivity, MessageFormat.format(getString(R.string.add_favorite_dialog_favourite_added_template), point.getName()), Toast.LENGTH_SHORT)
|
AccessibleToast.makeText(mapActivity, MessageFormat.format(getString(R.string.add_favorite_dialog_favourite_added_template), point.getName()), Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
mapActivity.getMapView().refreshMap();
|
mapActivity.getMapView().refreshMap();
|
||||||
|
@ -158,7 +159,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
final Collection<FavouritePoint> points = helper.getFavouritePoints();
|
final Collection<FavouritePoint> points = helper.getFavouritePoints();
|
||||||
final String[] names = new String[points.size()];
|
final String[] names = new String[points.size()];
|
||||||
if(names.length == 0){
|
if(names.length == 0){
|
||||||
Toast.makeText(mapActivity, getString(R.string.fav_points_not_exist), Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(mapActivity, getString(R.string.fav_points_not_exist), Toast.LENGTH_SHORT).show();
|
||||||
helper.close();
|
helper.close();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +183,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
FavouritePoint fv = favs[which];
|
FavouritePoint fv = favs[which];
|
||||||
FavouritePoint point = (FavouritePoint) args.getSerializable(KEY_FAVORITE);
|
FavouritePoint point = (FavouritePoint) args.getSerializable(KEY_FAVORITE);
|
||||||
if(helper.editFavourite(fv, point.getLatitude(), point.getLongitude())){
|
if(helper.editFavourite(fv, point.getLatitude(), point.getLongitude())){
|
||||||
Toast.makeText(mapActivity, getString(R.string.fav_points_edited), Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(mapActivity, getString(R.string.fav_points_edited), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
mapActivity.getMapView().refreshMap();
|
mapActivity.getMapView().refreshMap();
|
||||||
}
|
}
|
||||||
|
@ -216,7 +217,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
if(OsmandApplication.getSettings().SHOW_CURRENT_GPX_TRACK.get()) {
|
if(OsmandApplication.getSettings().SHOW_CURRENT_GPX_TRACK.get()) {
|
||||||
getMyApplication().getFavorites().addFavoritePointToGPXFile(new FavouritePoint(latitude, longitude, name, ""));
|
getMyApplication().getFavorites().addFavoritePointToGPXFile(new FavouritePoint(latitude, longitude, name, ""));
|
||||||
}
|
}
|
||||||
Toast.makeText(mapActivity, MessageFormat.format(getString(R.string.add_waypoint_dialog_added), name), Toast.LENGTH_SHORT)
|
AccessibleToast.makeText(mapActivity, MessageFormat.format(getString(R.string.add_waypoint_dialog_added), name), Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
}
|
||||||
|
@ -241,12 +242,12 @@ public class MapActivityActions implements DialogProvider {
|
||||||
int zoom = args.getInt(KEY_ZOOM);
|
int zoom = args.getInt(KEY_ZOOM);
|
||||||
BaseMapLayer mainLayer = mapView.getMainLayer();
|
BaseMapLayer mainLayer = mapView.getMainLayer();
|
||||||
if(!(mainLayer instanceof MapTileLayer) || !((MapTileLayer) mainLayer).isVisible()){
|
if(!(mainLayer instanceof MapTileLayer) || !((MapTileLayer) mainLayer).isVisible()){
|
||||||
Toast.makeText(mapActivity, R.string.maps_could_not_be_downloaded, Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(mapActivity, R.string.maps_could_not_be_downloaded, Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final ITileSource mapSource = ((MapTileLayer) mainLayer).getMap();
|
final ITileSource mapSource = ((MapTileLayer) mainLayer).getMap();
|
||||||
if(mapSource == null || !mapSource.couldBeDownloadedFromInternet()){
|
if(mapSource == null || !mapSource.couldBeDownloadedFromInternet()){
|
||||||
Toast.makeText(mapActivity, R.string.maps_could_not_be_downloaded, Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(mapActivity, R.string.maps_could_not_be_downloaded, Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Rect pixRect = new Rect(0, 0, mapView.getWidth(), mapView.getHeight());
|
Rect pixRect = new Rect(0, 0, mapView.getWidth(), mapView.getHeight());
|
||||||
|
@ -283,16 +284,16 @@ public class MapActivityActions implements DialogProvider {
|
||||||
|
|
||||||
protected void updatePoiDb(int zoom, double latitude, double longitude){
|
protected void updatePoiDb(int zoom, double latitude, double longitude){
|
||||||
if(zoom < 15){
|
if(zoom < 15){
|
||||||
Toast.makeText(mapActivity, getString(R.string.update_poi_is_not_available_for_zoom), Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(mapActivity, getString(R.string.update_poi_is_not_available_for_zoom), Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final AmenityIndexRepositoryOdb repo = ((OsmandApplication) mapActivity.getApplication()).
|
final AmenityIndexRepositoryOdb repo = ((OsmandApplication) mapActivity.getApplication()).
|
||||||
getResourceManager().getUpdatablePoiDb();
|
getResourceManager().getUpdatablePoiDb();
|
||||||
if(repo == null){
|
if(repo == null){
|
||||||
Toast.makeText(mapActivity, getString(R.string.update_poi_no_offline_poi_index), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(mapActivity, getString(R.string.update_poi_no_offline_poi_index), Toast.LENGTH_LONG).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(mapActivity, getString(R.string.update_poi_does_not_change_indexes), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(mapActivity, getString(R.string.update_poi_does_not_change_indexes), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
final OsmandMapTileView mapView = mapActivity.getMapView();
|
final OsmandMapTileView mapView = mapActivity.getMapView();
|
||||||
Rect pixRect = new Rect(-mapView.getWidth()/2, -mapView.getHeight()/2, 3*mapView.getWidth()/2, 3*mapView.getHeight()/2);
|
Rect pixRect = new Rect(-mapView.getWidth()/2, -mapView.getHeight()/2, 3*mapView.getWidth()/2, 3*mapView.getHeight()/2);
|
||||||
|
@ -338,7 +339,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
mapActivity.runOnUiThread(new Runnable(){
|
mapActivity.runOnUiThread(new Runnable(){
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Toast.makeText(mapActivity, msg, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(mapActivity, msg, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -424,7 +425,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
private boolean checkPointToNavigate(){
|
private boolean checkPointToNavigate(){
|
||||||
MapActivityLayers mapLayers = mapActivity.getMapLayers();
|
MapActivityLayers mapLayers = mapActivity.getMapLayers();
|
||||||
if(mapLayers.getNavigationLayer().getPointToNavigate() == null){
|
if(mapLayers.getNavigationLayer().getPointToNavigate() == null){
|
||||||
Toast.makeText(mapActivity, R.string.mark_final_location_first, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(mapActivity, R.string.mark_final_location_first, Toast.LENGTH_LONG).show();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -702,7 +703,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(String result) {
|
protected void onPostExecute(String result) {
|
||||||
if(result != null){
|
if(result != null){
|
||||||
Toast.makeText(mapActivity, result, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(mapActivity, result, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,12 +18,13 @@ import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.GPXUtilities.WptPt;
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
import net.osmand.OsmAndFormatter;
|
import net.osmand.OsmAndFormatter;
|
||||||
import net.osmand.ResultMatcher;
|
import net.osmand.ResultMatcher;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.AmenityType;
|
import net.osmand.data.AmenityType;
|
||||||
import net.osmand.map.ITileSource;
|
import net.osmand.map.ITileSource;
|
||||||
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||||
import net.osmand.plus.OsmandApplication;
|
|
||||||
import net.osmand.plus.PoiFilter;
|
import net.osmand.plus.PoiFilter;
|
||||||
import net.osmand.plus.PoiFiltersHelper;
|
import net.osmand.plus.PoiFiltersHelper;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -216,7 +217,7 @@ public class MapActivityLayers {
|
||||||
ResourceManager rm = app.getResourceManager();
|
ResourceManager rm = app.getResourceManager();
|
||||||
if(vectorData && !app.isApplicationInitializing()){
|
if(vectorData && !app.isApplicationInitializing()){
|
||||||
if(rm.getRenderer().isEmpty()){
|
if(rm.getRenderer().isEmpty()){
|
||||||
Toast.makeText(activity, activity.getString(R.string.no_vector_map_loaded), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(activity, activity.getString(R.string.no_vector_map_loaded), Toast.LENGTH_LONG).show();
|
||||||
vectorData = false;
|
vectorData = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -424,7 +425,7 @@ public class MapActivityLayers {
|
||||||
GPXFile toShow = result;
|
GPXFile toShow = result;
|
||||||
if (toShow == null) {
|
if (toShow == null) {
|
||||||
if(!settings.SAVE_TRACK_TO_GPX.get()){
|
if(!settings.SAVE_TRACK_TO_GPX.get()){
|
||||||
Toast.makeText(activity, R.string.gpx_monitoring_disabled_warn, Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(activity, R.string.gpx_monitoring_disabled_warn, Toast.LENGTH_SHORT).show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Map<String, GPXFile> data = activity.getSavingTrackHelper().collectRecordedData();
|
Map<String, GPXFile> data = activity.getSavingTrackHelper().collectRecordedData();
|
||||||
|
@ -488,7 +489,7 @@ public class MapActivityLayers {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(list.isEmpty()){
|
if(list.isEmpty()){
|
||||||
Toast.makeText(activity, R.string.gpx_files_not_found, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(activity, R.string.gpx_files_not_found, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
if(!list.isEmpty() || showCurrentGpx){
|
if(!list.isEmpty() || showCurrentGpx){
|
||||||
Builder builder = new AlertDialog.Builder(activity);
|
Builder builder = new AlertDialog.Builder(activity);
|
||||||
|
@ -515,7 +516,7 @@ public class MapActivityLayers {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (res.warning != null) {
|
if (res.warning != null) {
|
||||||
Toast.makeText(activity, res.warning, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(activity, res.warning, Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
callbackWithObject.processResult(res);
|
callbackWithObject.processResult(res);
|
||||||
}
|
}
|
||||||
|
@ -631,7 +632,7 @@ public class MapActivityLayers {
|
||||||
if (layerKey.equals(layerOsmVector)) {
|
if (layerKey.equals(layerOsmVector)) {
|
||||||
MapRenderRepositories r = ((OsmandApplication) getApplication()).getResourceManager().getRenderer();
|
MapRenderRepositories r = ((OsmandApplication) getApplication()).getResourceManager().getRenderer();
|
||||||
if (r.isEmpty()) {
|
if (r.isEmpty()) {
|
||||||
Toast.makeText(activity, getString(R.string.no_vector_map_loaded), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(activity, getString(R.string.no_vector_map_loaded), Toast.LENGTH_LONG).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
settings.MAP_VECTOR_DATA.set(true);
|
settings.MAP_VECTOR_DATA.set(true);
|
||||||
|
|
|
@ -5,8 +5,6 @@ import java.text.DecimalFormatSymbols;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import com.google.android.apps.analytics.easytracking.TrackedActivity;
|
|
||||||
|
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
import net.osmand.osm.MapUtils;
|
import net.osmand.osm.MapUtils;
|
||||||
|
@ -29,6 +27,8 @@ import android.widget.RadioButton;
|
||||||
import android.widget.RadioGroup;
|
import android.widget.RadioGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.google.android.apps.analytics.easytracking.TrackedActivity;
|
||||||
|
|
||||||
public class NavigatePointActivity extends TrackedActivity implements SearchActivityChild {
|
public class NavigatePointActivity extends TrackedActivity implements SearchActivityChild {
|
||||||
Dialog dlg;
|
Dialog dlg;
|
||||||
MapActivity activity;
|
MapActivity activity;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package net.osmand.plus.activities;
|
package net.osmand.plus.activities;
|
||||||
|
|
||||||
import net.osmand.plus.R;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.R;
|
||||||
import android.app.ExpandableListActivity;
|
import android.app.ExpandableListActivity;
|
||||||
import android.widget.ExpandableListView;
|
import android.widget.ExpandableListView;
|
||||||
|
|
||||||
|
|
|
@ -12,15 +12,17 @@ import java.util.Set;
|
||||||
|
|
||||||
import net.osmand.ResultMatcher;
|
import net.osmand.ResultMatcher;
|
||||||
import net.osmand.Version;
|
import net.osmand.Version;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
|
import net.osmand.access.RelativeDirectionStyle;
|
||||||
import net.osmand.map.TileSourceManager;
|
import net.osmand.map.TileSourceManager;
|
||||||
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
||||||
import net.osmand.plus.NavigationService;
|
import net.osmand.plus.NavigationService;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||||
import net.osmand.plus.OsmandSettings.DayNightMode;
|
import net.osmand.plus.OsmandSettings.DayNightMode;
|
||||||
import net.osmand.plus.OsmandSettings.MetricsConstants;
|
import net.osmand.plus.OsmandSettings.MetricsConstants;
|
||||||
import net.osmand.plus.OsmandSettings.OsmandPreference;
|
import net.osmand.plus.OsmandSettings.OsmandPreference;
|
||||||
import net.osmand.plus.OsmandApplication;
|
|
||||||
import net.osmand.plus.ProgressDialogImplementation;
|
import net.osmand.plus.ProgressDialogImplementation;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.ResourceManager;
|
import net.osmand.plus.ResourceManager;
|
||||||
|
@ -50,10 +52,10 @@ import android.preference.CheckBoxPreference;
|
||||||
import android.preference.EditTextPreference;
|
import android.preference.EditTextPreference;
|
||||||
import android.preference.ListPreference;
|
import android.preference.ListPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceCategory;
|
|
||||||
import android.preference.Preference.OnPreferenceChangeListener;
|
import android.preference.Preference.OnPreferenceChangeListener;
|
||||||
import android.preference.Preference.OnPreferenceClickListener;
|
import android.preference.Preference.OnPreferenceClickListener;
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
|
import android.preference.PreferenceCategory;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
@ -173,6 +175,9 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
|
|
||||||
registerBooleanPreference(osmandSettings.SHOW_VIEW_ANGLE,screen);
|
registerBooleanPreference(osmandSettings.SHOW_VIEW_ANGLE,screen);
|
||||||
registerBooleanPreference(osmandSettings.USE_TRACKBALL_FOR_MOVEMENTS,screen);
|
registerBooleanPreference(osmandSettings.USE_TRACKBALL_FOR_MOVEMENTS,screen);
|
||||||
|
registerBooleanPreference(osmandSettings.ZOOM_BY_TRACKBALL,screen);
|
||||||
|
registerBooleanPreference(osmandSettings.SCROLL_MAP_BY_GESTURES,screen);
|
||||||
|
registerBooleanPreference(osmandSettings.USE_SHORT_OBJECT_NAMES,screen);
|
||||||
registerBooleanPreference(osmandSettings.USE_HIGH_RES_MAPS,screen);
|
registerBooleanPreference(osmandSettings.USE_HIGH_RES_MAPS,screen);
|
||||||
registerBooleanPreference(osmandSettings.USE_ENGLISH_NAMES,screen);
|
registerBooleanPreference(osmandSettings.USE_ENGLISH_NAMES,screen);
|
||||||
registerBooleanPreference(osmandSettings.AUTO_ZOOM_MAP,screen);
|
registerBooleanPreference(osmandSettings.AUTO_ZOOM_MAP,screen);
|
||||||
|
@ -271,6 +276,14 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
}
|
}
|
||||||
registerListPreference(osmandSettings.MAP_TEXT_SIZE, screen, entries, floatValues);
|
registerListPreference(osmandSettings.MAP_TEXT_SIZE, screen, entries, floatValues);
|
||||||
|
|
||||||
|
entries = new String[RelativeDirectionStyle.values().length];
|
||||||
|
for(int i=0; i<entries.length; i++){
|
||||||
|
entries[i] = RelativeDirectionStyle.toHumanString(RelativeDirectionStyle.values()[i], this);
|
||||||
|
}
|
||||||
|
registerListPreference(osmandSettings.DIRECTION_STYLE, screen, entries, RelativeDirectionStyle.values());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
startZoom = 1;
|
startZoom = 1;
|
||||||
endZoom = 18;
|
endZoom = 18;
|
||||||
entries = new String[endZoom - startZoom + 1];
|
entries = new String[endZoom - startZoom + 1];
|
||||||
|
@ -565,7 +578,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
if (boolPref.getId().equals(osmandSettings.MAP_VECTOR_DATA.getId())) {
|
if (boolPref.getId().equals(osmandSettings.MAP_VECTOR_DATA.getId())) {
|
||||||
MapRenderRepositories r = ((OsmandApplication)getApplication()).getResourceManager().getRenderer();
|
MapRenderRepositories r = ((OsmandApplication)getApplication()).getResourceManager().getRenderer();
|
||||||
if(r.isEmpty()){
|
if(r.isEmpty()){
|
||||||
Toast.makeText(this, getString(R.string.no_vector_map_loaded), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(this, getString(R.string.no_vector_map_loaded), Toast.LENGTH_LONG).show();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -613,9 +626,9 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
}
|
}
|
||||||
if (listPref.getId().equals(osmandSettings.RENDERER.getId())) {
|
if (listPref.getId().equals(osmandSettings.RENDERER.getId())) {
|
||||||
if(changed){
|
if(changed){
|
||||||
Toast.makeText(this, R.string.renderer_load_sucess, Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(this, R.string.renderer_load_sucess, Toast.LENGTH_SHORT).show();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(this, R.string.renderer_load_exception, Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(this, R.string.renderer_load_exception, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
createCustomRenderingProperties(true);
|
createCustomRenderingProperties(true);
|
||||||
}
|
}
|
||||||
|
@ -675,7 +688,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
File path = new File(newDir);
|
File path = new File(newDir);
|
||||||
path.mkdirs();
|
path.mkdirs();
|
||||||
if(!path.canRead() || !path.exists()){
|
if(!path.canRead() || !path.exists()){
|
||||||
Toast.makeText(this, R.string.specified_dir_doesnt_exist, Toast.LENGTH_LONG).show() ;
|
AccessibleToast.makeText(this, R.string.specified_dir_doesnt_exist, Toast.LENGTH_LONG).show() ;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -735,7 +748,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
protected void onPostExecute(Void result) {
|
protected void onPostExecute(Void result) {
|
||||||
progressDlg.dismiss();
|
progressDlg.dismiss();
|
||||||
if (!NativeOsmandLibrary.isNativeSupported(storage)) {
|
if (!NativeOsmandLibrary.isNativeSupported(storage)) {
|
||||||
Toast.makeText(SettingsActivity.this, R.string.native_library_not_supported, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(SettingsActivity.this, R.string.native_library_not_supported, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}.execute();
|
}.execute();
|
||||||
|
@ -769,7 +782,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Toast.makeText(SettingsActivity.this, b.toString(), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(SettingsActivity.this, b.toString(), Toast.LENGTH_LONG).show();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -834,12 +847,12 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
final OsmandSettings settings = ((OsmandApplication) activity.getApplication()).getSettings();
|
final OsmandSettings settings = ((OsmandApplication) activity.getApplication()).getSettings();
|
||||||
final Map<String, String> entriesMap = settings.getTileSourceEntries();
|
final Map<String, String> entriesMap = settings.getTileSourceEntries();
|
||||||
if(!settings.isInternetConnectionAvailable(true)){
|
if(!settings.isInternetConnectionAvailable(true)){
|
||||||
Toast.makeText(activity, R.string.internet_not_available, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(activity, R.string.internet_not_available, Toast.LENGTH_LONG).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final List<TileSourceTemplate> downloaded = TileSourceManager.downloadTileSourceTemplates(Version.getVersionAsURLParam(activity));
|
final List<TileSourceTemplate> downloaded = TileSourceManager.downloadTileSourceTemplates(Version.getVersionAsURLParam(activity));
|
||||||
if(downloaded == null || downloaded.isEmpty()){
|
if(downloaded == null || downloaded.isEmpty()){
|
||||||
Toast.makeText(activity, R.string.error_io_error, Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(activity, R.string.error_io_error, Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Builder builder = new AlertDialog.Builder(activity);
|
Builder builder = new AlertDialog.Builder(activity);
|
||||||
|
@ -854,7 +867,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
|
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
|
||||||
selected[which] = isChecked;
|
selected[which] = isChecked;
|
||||||
if(entriesMap.containsKey(downloaded.get(which).getName()) && isChecked){
|
if(entriesMap.containsKey(downloaded.get(which).getName()) && isChecked){
|
||||||
Toast.makeText(activity, R.string.tile_source_already_installed, Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(activity, R.string.tile_source_already_installed, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
*/
|
*/
|
||||||
package net.osmand.plus.activities;
|
package net.osmand.plus.activities;
|
||||||
|
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.voice.AbstractPrologCommandPlayer;
|
import net.osmand.plus.voice.AbstractPrologCommandPlayer;
|
||||||
import net.osmand.plus.voice.CommandBuilder;
|
import net.osmand.plus.voice.CommandBuilder;
|
||||||
|
@ -13,10 +14,10 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.LinearLayout.LayoutParams;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import android.widget.LinearLayout.LayoutParams;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test Voice activity
|
* Test Voice activity
|
||||||
|
@ -56,7 +57,7 @@ public class TestVoiceActivity extends Activity {
|
||||||
public void run() {
|
public void run() {
|
||||||
CommandPlayer p = app.getRoutingHelper().getVoiceRouter().getPlayer();
|
CommandPlayer p = app.getRoutingHelper().getVoiceRouter().getPlayer();
|
||||||
if (p == null) {
|
if (p == null) {
|
||||||
Toast.makeText(TestVoiceActivity.this, "Voice player not initialized", Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(TestVoiceActivity.this, "Voice player not initialized", Toast.LENGTH_SHORT).show();
|
||||||
} else {
|
} else {
|
||||||
addButtons(ll, p);
|
addButtons(ll, p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.util.Set;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import net.osmand.OsmAndFormatter;
|
import net.osmand.OsmAndFormatter;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.City;
|
import net.osmand.data.City;
|
||||||
import net.osmand.data.MapObject;
|
import net.osmand.data.MapObject;
|
||||||
import net.osmand.data.PostCode;
|
import net.osmand.data.PostCode;
|
||||||
|
@ -105,7 +106,7 @@ public class GeoIntentActivity extends OsmandListActivity {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (places == null) {
|
if (places == null) {
|
||||||
Toast.makeText(GeoIntentActivity.this, getString(warning),
|
AccessibleToast.makeText(GeoIntentActivity.this, getString(warning),
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
setListAdapter(new MapObjectAdapter(places));
|
setListAdapter(new MapObjectAdapter(places));
|
||||||
|
@ -325,7 +326,7 @@ public class GeoIntentActivity extends OsmandListActivity {
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Toast.makeText(GeoIntentActivity.this,
|
AccessibleToast.makeText(GeoIntentActivity.this,
|
||||||
getString(R.string.search_offline_geo_error, geo),
|
getString(R.string.search_offline_geo_error, geo),
|
||||||
Toast.LENGTH_LONG);
|
Toast.LENGTH_LONG);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,11 +75,12 @@ public class SearchActivity extends TabActivity {
|
||||||
public void locationUpdate(LatLon l);
|
public void locationUpdate(LatLon l);
|
||||||
}
|
}
|
||||||
|
|
||||||
private View getTabIndicator(int imageId){
|
private View getTabIndicator(int imageId, int stringId){
|
||||||
View r = getLayoutInflater().inflate(R.layout.search_main_tab_header, getTabHost(), false);
|
View r = getLayoutInflater().inflate(R.layout.search_main_tab_header, getTabHost(), false);
|
||||||
ImageView tabImage = (ImageView)r.findViewById(R.id.TabImage);
|
ImageView tabImage = (ImageView)r.findViewById(R.id.TabImage);
|
||||||
tabImage.setImageResource(imageId);
|
tabImage.setImageResource(imageId);
|
||||||
tabImage.setBackgroundResource(R.drawable.tab_icon_background);
|
tabImage.setBackgroundResource(R.drawable.tab_icon_background);
|
||||||
|
tabImage.setContentDescription(getString(stringId));
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,20 +126,20 @@ public class SearchActivity extends TabActivity {
|
||||||
TabWidget tabs = (TabWidget) findViewById(android.R.id.tabs);
|
TabWidget tabs = (TabWidget) findViewById(android.R.id.tabs);
|
||||||
tabs.setBackgroundResource(R.drawable.tab_icon_background);
|
tabs.setBackgroundResource(R.drawable.tab_icon_background);
|
||||||
TabHost host = getTabHost();
|
TabHost host = getTabHost();
|
||||||
host.addTab(host.newTabSpec("Search_POI").setIndicator(getTabIndicator(R.drawable.tab_search_poi_icon)).
|
host.addTab(host.newTabSpec("Search_POI").setIndicator(getTabIndicator(R.drawable.tab_search_poi_icon, R.string.poi)).
|
||||||
setContent(new Intent(this, SearchPoiFilterActivity.class))); //$NON-NLS-1$
|
setContent(new Intent(this, SearchPoiFilterActivity.class))); //$NON-NLS-1$
|
||||||
|
|
||||||
addressSpec = host.newTabSpec("Search_Address").
|
addressSpec = host.newTabSpec("Search_Address").
|
||||||
setIndicator(getTabIndicator(R.drawable.tab_search_address_icon));
|
setIndicator(getTabIndicator(R.drawable.tab_search_address_icon, R.string.address));
|
||||||
|
|
||||||
setAddressSpecContent();
|
setAddressSpecContent();
|
||||||
|
|
||||||
host.addTab(addressSpec);
|
host.addTab(addressSpec);
|
||||||
host.addTab(host.newTabSpec("Search_Location").setIndicator(getTabIndicator(R.drawable.tab_search_location_icon)).setContent(createIntent(NavigatePointActivity.class))); //$NON-NLS-1$
|
host.addTab(host.newTabSpec("Search_Location").setIndicator(getTabIndicator(R.drawable.tab_search_location_icon, R.string.search_tabs_location)).setContent(createIntent(NavigatePointActivity.class))); //$NON-NLS-1$
|
||||||
TabSpec transportTab = host.newTabSpec("Search_Transport").setIndicator(getTabIndicator(R.drawable.tab_search_transport_icon)).setContent(createIntent(SearchTransportActivity.class));
|
TabSpec transportTab = host.newTabSpec("Search_Transport").setIndicator(getTabIndicator(R.drawable.tab_search_transport_icon, R.string.transport)).setContent(createIntent(SearchTransportActivity.class));
|
||||||
host.addTab(transportTab); //$NON-NLS-1$
|
host.addTab(transportTab); //$NON-NLS-1$
|
||||||
host.addTab(host.newTabSpec("Search_Favorites").setIndicator(getTabIndicator(R.drawable.tab_search_favorites_icon)).setContent(createIntent(FavouritesListActivity.class))); //$NON-NLS-1$
|
host.addTab(host.newTabSpec("Search_Favorites").setIndicator(getTabIndicator(R.drawable.tab_search_favorites_icon, R.string.favorite)).setContent(createIntent(FavouritesListActivity.class))); //$NON-NLS-1$
|
||||||
host.addTab(host.newTabSpec("Search_History").setIndicator(getTabIndicator(R.drawable.tab_search_history_icon)).setContent(createIntent(SearchHistoryActivity.class))); //$NON-NLS-1$
|
host.addTab(host.newTabSpec("Search_History").setIndicator(getTabIndicator(R.drawable.tab_search_history_icon, R.string.history)).setContent(createIntent(SearchHistoryActivity.class))); //$NON-NLS-1$
|
||||||
host.setCurrentTab(POI_TAB_INDEX);
|
host.setCurrentTab(POI_TAB_INDEX);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import net.osmand.Algoritms;
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.OsmAndFormatter;
|
import net.osmand.OsmAndFormatter;
|
||||||
import net.osmand.Version;
|
import net.osmand.Version;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
import net.osmand.osm.MapUtils;
|
import net.osmand.osm.MapUtils;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -187,7 +188,7 @@ public class SearchAddressOnlineActivity extends OsmandListActivity implements S
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if(places == null){
|
if(places == null){
|
||||||
Toast.makeText(SearchAddressOnlineActivity.this, getString(warning), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(SearchAddressOnlineActivity.this, getString(warning), Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
lastResult = new PlacesAdapter(places);
|
lastResult = new PlacesAdapter(places);
|
||||||
setListAdapter(lastResult);
|
setListAdapter(lastResult);
|
||||||
|
|
|
@ -2,8 +2,6 @@ package net.osmand.plus.activities.search;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.android.apps.analytics.easytracking.TrackedListActivity;
|
|
||||||
|
|
||||||
import net.osmand.OsmAndFormatter;
|
import net.osmand.OsmAndFormatter;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
import net.osmand.osm.MapUtils;
|
import net.osmand.osm.MapUtils;
|
||||||
|
@ -27,6 +25,8 @@ import android.widget.ImageButton;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.google.android.apps.analytics.easytracking.TrackedListActivity;
|
||||||
|
|
||||||
public class SearchHistoryActivity extends TrackedListActivity implements SearchActivityChild {
|
public class SearchHistoryActivity extends TrackedListActivity implements SearchActivityChild {
|
||||||
private LatLon location;
|
private LatLon location;
|
||||||
private SearchHistoryHelper helper;
|
private SearchHistoryHelper helper;
|
||||||
|
|
|
@ -19,6 +19,7 @@ import net.osmand.Algoritms;
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.OsmAndFormatter;
|
import net.osmand.OsmAndFormatter;
|
||||||
import net.osmand.ResultMatcher;
|
import net.osmand.ResultMatcher;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
import net.osmand.data.AmenityType;
|
import net.osmand.data.AmenityType;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
|
@ -133,7 +134,7 @@ public class SearchPOIActivity extends OsmandListActivity implements SensorEvent
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
String query = searchFilter.getText().toString();
|
String query = searchFilter.getText().toString();
|
||||||
if (query.length() < 2 && (isNameFinderFilter() || isSearchByNameFilter())) {
|
if (query.length() < 2 && (isNameFinderFilter() || isSearchByNameFilter())) {
|
||||||
Toast.makeText(SearchPOIActivity.this, R.string.poi_namefinder_query_empty, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(SearchPOIActivity.this, R.string.poi_namefinder_query_empty, Toast.LENGTH_LONG).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(isNameFinderFilter() &&
|
if(isNameFinderFilter() &&
|
||||||
|
@ -300,7 +301,7 @@ public class SearchPOIActivity extends OsmandListActivity implements SensorEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
String s = typesToString(map);
|
String s = typesToString(map);
|
||||||
Toast.makeText(this, getString(R.string.poi_query_by_name_matches_categories) + s, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(this, getString(R.string.poi_query_by_name_matches_categories) + s, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -397,7 +398,7 @@ public class SearchPOIActivity extends OsmandListActivity implements SensorEvent
|
||||||
private void onLongClick(final Amenity amenity) {
|
private void onLongClick(final Amenity amenity) {
|
||||||
String format = OsmAndFormatter.getPoiSimpleFormat(amenity, SearchPOIActivity.this, settings.USE_ENGLISH_NAMES.get());
|
String format = OsmAndFormatter.getPoiSimpleFormat(amenity, SearchPOIActivity.this, settings.USE_ENGLISH_NAMES.get());
|
||||||
if (amenity.getOpeningHours() != null) {
|
if (amenity.getOpeningHours() != null) {
|
||||||
Toast.makeText(this, format + " " + getString(R.string.opening_hours) + " : " + amenity.getOpeningHours(), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(this, format + " " + getString(R.string.opening_hours) + " : " + amenity.getOpeningHours(), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(SearchPOIActivity.this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(SearchPOIActivity.this);
|
||||||
|
@ -585,7 +586,7 @@ public class SearchPOIActivity extends OsmandListActivity implements SensorEvent
|
||||||
searchPOILevel.setText(R.string.search_POI_level_btn);
|
searchPOILevel.setText(R.string.search_POI_level_btn);
|
||||||
if (isNameFinderFilter()) {
|
if (isNameFinderFilter()) {
|
||||||
if (!Algoritms.isEmpty(((NameFinderPoiFilter) filter).getLastError())) {
|
if (!Algoritms.isEmpty(((NameFinderPoiFilter) filter).getLastError())) {
|
||||||
Toast.makeText(SearchPOIActivity.this, ((NameFinderPoiFilter) filter).getLastError(), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(SearchPOIActivity.this, ((NameFinderPoiFilter) filter).getLastError(), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
amenityAdapter.setNewModel(result, "");
|
amenityAdapter.setNewModel(result, "");
|
||||||
showOnMap.setEnabled(amenityAdapter.getCount() > 0);
|
showOnMap.setEnabled(amenityAdapter.getCount() > 0);
|
||||||
|
|
|
@ -6,6 +6,7 @@ package net.osmand.plus.activities.search;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
import net.osmand.plus.NameFinderPoiFilter;
|
import net.osmand.plus.NameFinderPoiFilter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -117,7 +118,7 @@ public class SearchPoiFilterActivity extends TrackedListActivity {
|
||||||
if(!(filter instanceof NameFinderPoiFilter)){
|
if(!(filter instanceof NameFinderPoiFilter)){
|
||||||
ResourceManager rm = ((OsmandApplication) getApplication()).getResourceManager();
|
ResourceManager rm = ((OsmandApplication) getApplication()).getResourceManager();
|
||||||
if(!rm.containsAmenityRepositoryToSearch(filter instanceof SearchByNameFilter)){
|
if(!rm.containsAmenityRepositoryToSearch(filter instanceof SearchByNameFilter)){
|
||||||
Toast.makeText(this, R.string.data_to_search_poi_not_available, Toast.LENGTH_LONG);
|
AccessibleToast.makeText(this, R.string.data_to_search_poi_not_available, Toast.LENGTH_LONG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus.activities.search;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.RegionAddressRepository;
|
import net.osmand.plus.RegionAddressRepository;
|
||||||
|
@ -17,7 +18,7 @@ public class SearchRegionByNameActivity extends SearchByNameAbstractActivity<Reg
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
((TextView)findViewById(R.id.Label)).setText(R.string.choose_available_region);
|
((TextView)findViewById(R.id.Label)).setText(R.string.choose_available_region);
|
||||||
if(((OsmandApplication)getApplication()).getResourceManager().getAddressRepositories().isEmpty()){
|
if(((OsmandApplication)getApplication()).getResourceManager().getAddressRepositories().isEmpty()){
|
||||||
Toast.makeText(this, R.string.none_region_found, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(this, R.string.none_region_found, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
initialListToFilter = new ArrayList<RegionAddressRepository>(((OsmandApplication)getApplication()).getResourceManager().getAddressRepositories());
|
initialListToFilter = new ArrayList<RegionAddressRepository>(((OsmandApplication)getApplication()).getResourceManager().getAddressRepositories());
|
||||||
NamesAdapter namesAdapter = new NamesAdapter(new ArrayList<RegionAddressRepository>(initialListToFilter)); //$NON-NLS-1$
|
NamesAdapter namesAdapter = new NamesAdapter(new ArrayList<RegionAddressRepository>(initialListToFilter)); //$NON-NLS-1$
|
||||||
|
|
|
@ -5,8 +5,8 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.osmand.CollatorStringMatcher;
|
import net.osmand.CollatorStringMatcher;
|
||||||
import net.osmand.ResultMatcher;
|
|
||||||
import net.osmand.CollatorStringMatcher.StringMatcherMode;
|
import net.osmand.CollatorStringMatcher.StringMatcherMode;
|
||||||
|
import net.osmand.ResultMatcher;
|
||||||
import net.osmand.data.City;
|
import net.osmand.data.City;
|
||||||
import net.osmand.data.PostCode;
|
import net.osmand.data.PostCode;
|
||||||
import net.osmand.data.Street;
|
import net.osmand.data.Street;
|
||||||
|
|
|
@ -7,8 +7,6 @@ import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.android.apps.analytics.easytracking.TrackedListActivity;
|
|
||||||
|
|
||||||
import net.osmand.Algoritms;
|
import net.osmand.Algoritms;
|
||||||
import net.osmand.OsmAndFormatter;
|
import net.osmand.OsmAndFormatter;
|
||||||
import net.osmand.data.TransportRoute;
|
import net.osmand.data.TransportRoute;
|
||||||
|
@ -30,8 +28,8 @@ import android.graphics.Typeface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
|
@ -40,6 +38,8 @@ import android.widget.ListView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.google.android.apps.analytics.easytracking.TrackedListActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Set;
|
||||||
import net.osmand.Algoritms;
|
import net.osmand.Algoritms;
|
||||||
import net.osmand.IProgress;
|
import net.osmand.IProgress;
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.binary.BinaryMapDataObject;
|
import net.osmand.binary.BinaryMapDataObject;
|
||||||
import net.osmand.binary.BinaryMapIndexReader;
|
import net.osmand.binary.BinaryMapIndexReader;
|
||||||
import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
|
import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
|
||||||
|
@ -32,9 +33,9 @@ import net.osmand.data.MapTileDownloader.IMapDownloaderCallback;
|
||||||
import net.osmand.osm.MapRenderingTypes;
|
import net.osmand.osm.MapRenderingTypes;
|
||||||
import net.osmand.osm.MapUtils;
|
import net.osmand.osm.MapUtils;
|
||||||
import net.osmand.osm.MultyPolygon;
|
import net.osmand.osm.MultyPolygon;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||||
import net.osmand.plus.OsmandApplication;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.RotatedTileBox;
|
import net.osmand.plus.RotatedTileBox;
|
||||||
import net.osmand.plus.render.NativeOsmandLibrary.NativeSearchResult;
|
import net.osmand.plus.render.NativeOsmandLibrary.NativeSearchResult;
|
||||||
|
@ -581,7 +582,7 @@ public class MapRenderRepositories {
|
||||||
handler.post(new Runnable() {
|
handler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(context, msg, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -590,7 +591,7 @@ public class MapRenderRepositories {
|
||||||
handler.post(new Runnable() {
|
handler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Toast.makeText(context, R.string.rendering_exception, Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(context, R.string.rendering_exception, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (OutOfMemoryError e) {
|
} catch (OutOfMemoryError e) {
|
||||||
|
@ -600,7 +601,7 @@ public class MapRenderRepositories {
|
||||||
handler.post(new Runnable() {
|
handler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Toast.makeText(context, R.string.rendering_out_of_memory, Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(context, R.string.rendering_out_of_memory, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.osmand.plus.render;
|
package net.osmand.plus.render;
|
||||||
|
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.osm.MapUtils;
|
import net.osmand.osm.MapUtils;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.ResourceManager;
|
import net.osmand.plus.ResourceManager;
|
||||||
|
@ -107,7 +108,7 @@ public class MapVectorLayer extends BaseMapLayer {
|
||||||
// Arguments : 1. Map request to read data slows whole process // 2. It works in operating memory
|
// Arguments : 1. Map request to read data slows whole process // 2. It works in operating memory
|
||||||
if (warningToSwitchMapShown < 3) {
|
if (warningToSwitchMapShown < 3) {
|
||||||
if (!resourceManager.getRenderer().containsLatLonMapData(view.getLatitude(), view.getLongitude(), view.getZoom())) {
|
if (!resourceManager.getRenderer().containsLatLonMapData(view.getLatitude(), view.getLongitude(), view.getZoom())) {
|
||||||
Toast.makeText(view.getContext(), R.string.switch_to_raster_map_to_see, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(view.getContext(), R.string.switch_to_raster_map_to_see, Toast.LENGTH_LONG).show();
|
||||||
warningToSwitchMapShown++;
|
warningToSwitchMapShown++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package net.osmand.plus.render;
|
package net.osmand.plus.render;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
|
@ -9,6 +7,8 @@ import net.osmand.plus.render.OsmandRenderer.RenderingContext;
|
||||||
import net.osmand.render.RenderingRuleSearchRequest;
|
import net.osmand.render.RenderingRuleSearchRequest;
|
||||||
import net.osmand.render.RenderingRulesStorage;
|
import net.osmand.render.RenderingRulesStorage;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
|
||||||
public class NativeOsmandLibrary {
|
public class NativeOsmandLibrary {
|
||||||
|
|
|
@ -31,14 +31,14 @@ import android.graphics.Canvas;
|
||||||
import android.graphics.ColorFilter;
|
import android.graphics.ColorFilter;
|
||||||
import android.graphics.DashPathEffect;
|
import android.graphics.DashPathEffect;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.Paint.Cap;
|
||||||
|
import android.graphics.Paint.Style;
|
||||||
import android.graphics.Path;
|
import android.graphics.Path;
|
||||||
import android.graphics.PathEffect;
|
import android.graphics.PathEffect;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.graphics.PorterDuff.Mode;
|
import android.graphics.PorterDuff.Mode;
|
||||||
import android.graphics.PorterDuffColorFilter;
|
import android.graphics.PorterDuffColorFilter;
|
||||||
import android.graphics.Shader;
|
import android.graphics.Shader;
|
||||||
import android.graphics.Paint.Cap;
|
|
||||||
import android.graphics.Paint.Style;
|
|
||||||
import android.graphics.Shader.TileMode;
|
import android.graphics.Shader.TileMode;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
package net.osmand.plus.render;
|
package net.osmand.plus.render;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import net.osmand.LogUtil;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.R.drawable;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
@ -12,9 +16,6 @@ import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import net.osmand.plus.R;
|
|
||||||
import net.osmand.plus.R.drawable;
|
|
||||||
import net.osmand.LogUtil;
|
|
||||||
|
|
||||||
public class RenderingIcons {
|
public class RenderingIcons {
|
||||||
private static final Log log = LogUtil.getLog(RenderingIcons.class);
|
private static final Log log = LogUtil.getLog(RenderingIcons.class);
|
||||||
|
|
|
@ -16,11 +16,11 @@ import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.PointF;
|
|
||||||
import android.graphics.Rect;
|
|
||||||
import android.graphics.Paint.Align;
|
import android.graphics.Paint.Align;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
import android.graphics.Path;
|
import android.graphics.Path;
|
||||||
|
import android.graphics.PointF;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.text.TextPaint;
|
import android.text.TextPaint;
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.List;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.OsmAndFormatter;
|
import net.osmand.OsmAndFormatter;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
import net.osmand.osm.MapUtils;
|
import net.osmand.osm.MapUtils;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
@ -626,7 +627,7 @@ public class RoutingHelper {
|
||||||
uiHandler.post(new Runnable() {
|
uiHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Toast.makeText(context, msg, length).show();
|
AccessibleToast.makeText(context, msg, length).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package net.osmand.plus.routing;
|
||||||
import net.osmand.plus.activities.ApplicationMode;
|
import net.osmand.plus.activities.ApplicationMode;
|
||||||
import net.osmand.plus.routing.RoutingHelper.RouteDirectionInfo;
|
import net.osmand.plus.routing.RoutingHelper.RouteDirectionInfo;
|
||||||
import net.osmand.plus.routing.RoutingHelper.TurnType;
|
import net.osmand.plus.routing.RoutingHelper.TurnType;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
|
||||||
import net.osmand.plus.voice.AbstractPrologCommandPlayer;
|
import net.osmand.plus.voice.AbstractPrologCommandPlayer;
|
||||||
import net.osmand.plus.voice.CommandBuilder;
|
import net.osmand.plus.voice.CommandBuilder;
|
||||||
import net.osmand.plus.voice.CommandPlayer;
|
import net.osmand.plus.voice.CommandPlayer;
|
||||||
|
@ -180,9 +179,7 @@ public class VoiceRouter {
|
||||||
if(next == null || next.distance == 0) {
|
if(next == null || next.distance == 0) {
|
||||||
// if(currentStatus <= STATUS_UNKNOWN && currentDirection > 0){ This caused this prompt to be suppressed when coming back from a UTwp situation
|
// if(currentStatus <= STATUS_UNKNOWN && currentDirection > 0){ This caused this prompt to be suppressed when coming back from a UTwp situation
|
||||||
if(currentStatus <= STATUS_UNKNOWN){
|
if(currentStatus <= STATUS_UNKNOWN){
|
||||||
CommandBuilder play = getNewCommandPlayerToPlay();
|
if (playGoAheadToDestination()) {
|
||||||
if(play != null){
|
|
||||||
play.goAhead(router.getLeftDistance()).andArriveAtDestination().play();
|
|
||||||
currentStatus = STATUS_TOLD;
|
currentStatus = STATUS_TOLD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,6 +230,64 @@ public class VoiceRouter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void announceCurrentDirection() {
|
||||||
|
Location currentLocation = router.getCurrentLocation();
|
||||||
|
RouteDirectionInfo next = router.getNextRouteDirectionInfo();
|
||||||
|
int dist = router.getDistanceToNextRouteDirection();
|
||||||
|
float speed = DEFAULT_SPEED;
|
||||||
|
|
||||||
|
if(currentLocation != null && currentLocation.hasSpeed()){
|
||||||
|
speed = Math.max(currentLocation.getSpeed(), speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (currentStatus) {
|
||||||
|
case STATUS_UNKNOWN:
|
||||||
|
if ((currentDirection > 0) && ((next == null) || (next.distance == 0))) {
|
||||||
|
playGoAheadToDestination();
|
||||||
|
} else {
|
||||||
|
playGoAhead(dist);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case STATUS_TOLD:
|
||||||
|
if (currentDirection > 0) {
|
||||||
|
playGoAheadToDestination();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case STATUS_TURN:
|
||||||
|
if(next.distance < TURN_IN_DISTANCE_END) {
|
||||||
|
playMakeTurn(next, router.getNextNextRouteDirectionInfo());
|
||||||
|
} else {
|
||||||
|
playMakeTurn(next, null);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case STATUS_TURN_IN:
|
||||||
|
if(isDistanceLess(speed, next.distance, TURN_DISTANCE) || next.distance < TURN_IN_DISTANCE_END) {
|
||||||
|
playMakeTurnIn(next, dist, router.getNextNextRouteDirectionInfo());
|
||||||
|
} else {
|
||||||
|
playMakeTurnIn(next, dist, null);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case STATUS_PREPARE:
|
||||||
|
playPrepareTurn(next, dist);
|
||||||
|
break;
|
||||||
|
case STATUS_LONG_PREPARE:
|
||||||
|
playPrepareTurn(next, dist);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private boolean playGoAheadToDestination() {
|
||||||
|
CommandBuilder play = getNewCommandPlayerToPlay();
|
||||||
|
if(play != null){
|
||||||
|
play.goAhead(router.getLeftDistance()).andArriveAtDestination().play();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private void playGoAhead(int dist) {
|
private void playGoAhead(int dist) {
|
||||||
CommandBuilder play = getNewCommandPlayerToPlay();
|
CommandBuilder play = getNewCommandPlayerToPlay();
|
||||||
if(play != null){
|
if(play != null){
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.osmand.FavouritePoint;
|
import net.osmand.FavouritePoint;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -117,7 +118,7 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.I
|
||||||
}
|
}
|
||||||
res.append(view.getContext().getString(R.string.favorite) + " : " + fav.getName()); //$NON-NLS-1$
|
res.append(view.getContext().getString(R.string.favorite) + " : " + fav.getName()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
Toast.makeText(view.getContext(), res.toString(), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(view.getContext(), res.toString(), Toast.LENGTH_LONG).show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -11,12 +11,12 @@ import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Path;
|
|
||||||
import android.graphics.PointF;
|
|
||||||
import android.graphics.RectF;
|
|
||||||
import android.graphics.Paint.Cap;
|
import android.graphics.Paint.Cap;
|
||||||
import android.graphics.Paint.Join;
|
import android.graphics.Paint.Join;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
|
import android.graphics.Path;
|
||||||
|
import android.graphics.PointF;
|
||||||
|
import android.graphics.RectF;
|
||||||
|
|
||||||
public class GPXLayer extends OsmandMapLayer {
|
public class GPXLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ import net.londatiga.android.ActionItem;
|
||||||
import net.londatiga.android.QuickAction;
|
import net.londatiga.android.QuickAction;
|
||||||
import net.osmand.OsmAndFormatter;
|
import net.osmand.OsmAndFormatter;
|
||||||
import net.osmand.osm.MapUtils;
|
import net.osmand.osm.MapUtils;
|
||||||
import net.osmand.plus.R;
|
|
||||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||||
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.ApplicationMode;
|
import net.osmand.plus.activities.ApplicationMode;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -20,9 +20,9 @@ import android.text.TextPaint;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup.LayoutParams;
|
import android.view.ViewGroup.LayoutParams;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
@ -258,7 +258,8 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
private void initZoomButtons(final OsmandMapTileView view, FrameLayout parent) {
|
private void initZoomButtons(final OsmandMapTileView view, FrameLayout parent) {
|
||||||
int minimumWidth = view.getResources().getDrawable(R.drawable.map_zoom_in).getMinimumWidth();
|
int minimumWidth = view.getResources().getDrawable(R.drawable.map_zoom_in).getMinimumWidth();
|
||||||
|
|
||||||
ImageView bottomShadow = new ImageView(view.getContext());
|
Context ctx = view.getContext();
|
||||||
|
ImageView bottomShadow = new ImageView(ctx);
|
||||||
bottomShadow.setBackgroundResource(R.drawable.bottom_shadow);
|
bottomShadow.setBackgroundResource(R.drawable.bottom_shadow);
|
||||||
android.widget.FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT,
|
android.widget.FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT,
|
||||||
Gravity.BOTTOM);
|
Gravity.BOTTOM);
|
||||||
|
@ -272,20 +273,22 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
zoomShadow = view.getResources().getDrawable(R.drawable.zoom_background);
|
zoomShadow = view.getResources().getDrawable(R.drawable.zoom_background);
|
||||||
|
|
||||||
zoomInButton = new Button(view.getContext());
|
zoomInButton = new Button(ctx);
|
||||||
zoomInButton.setBackgroundResource(R.drawable.map_zoom_in);
|
zoomInButton.setBackgroundResource(R.drawable.map_zoom_in);
|
||||||
params = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
|
params = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
|
||||||
Gravity.BOTTOM | Gravity.RIGHT);
|
Gravity.BOTTOM | Gravity.RIGHT);
|
||||||
params.setMargins(0, 0, 0, 0);
|
params.setMargins(0, 0, 0, 0);
|
||||||
|
zoomInButton.setContentDescription(ctx.getString(R.string.zoomIn));
|
||||||
parent.addView(zoomInButton, params);
|
parent.addView(zoomInButton, params);
|
||||||
|
|
||||||
|
|
||||||
zoomOutButton = new Button(view.getContext());
|
zoomOutButton = new Button(ctx);
|
||||||
zoomOutButton.setBackgroundResource(R.drawable.map_zoom_out);
|
zoomOutButton.setBackgroundResource(R.drawable.map_zoom_out);
|
||||||
params = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
|
params = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
|
||||||
Gravity.BOTTOM | Gravity.RIGHT);
|
Gravity.BOTTOM | Gravity.RIGHT);
|
||||||
|
|
||||||
params.setMargins(0, 0, minimumWidth , 0);
|
params.setMargins(0, 0, minimumWidth , 0);
|
||||||
|
zoomOutButton.setContentDescription(ctx.getString(R.string.zoomOut));
|
||||||
parent.addView(zoomOutButton, params);
|
parent.addView(zoomOutButton, params);
|
||||||
|
|
||||||
zoomInButton.setOnClickListener(new View.OnClickListener() {
|
zoomInButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.osmand.plus.views;
|
package net.osmand.plus.views;
|
||||||
|
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.map.ITileSource;
|
import net.osmand.map.ITileSource;
|
||||||
import net.osmand.map.TileSourceManager;
|
import net.osmand.map.TileSourceManager;
|
||||||
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
||||||
|
@ -207,7 +208,7 @@ public class MapTileLayer extends BaseMapLayer {
|
||||||
|
|
||||||
if(mainMap && !oneTileShown && !useInternet && warningToSwitchMapShown < 3){
|
if(mainMap && !oneTileShown && !useInternet && warningToSwitchMapShown < 3){
|
||||||
if(resourceManager.getRenderer().containsLatLonMapData(view.getLatitude(), view.getLongitude(), nzoom)){
|
if(resourceManager.getRenderer().containsLatLonMapData(view.getLatitude(), view.getLongitude(), nzoom)){
|
||||||
Toast.makeText(view.getContext(), R.string.switch_to_vector_map_to_see, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(view.getContext(), R.string.switch_to_vector_map_to_see, Toast.LENGTH_LONG).show();
|
||||||
warningToSwitchMapShown++;
|
warningToSwitchMapShown++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.osmand.plus.views;
|
package net.osmand.plus.views;
|
||||||
|
|
||||||
|
import net.osmand.plus.R;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
@ -8,7 +9,6 @@ import android.graphics.Paint.Cap;
|
||||||
import android.graphics.Paint.Join;
|
import android.graphics.Paint.Join;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
import android.graphics.Path;
|
import android.graphics.Path;
|
||||||
import net.osmand.plus.R;
|
|
||||||
|
|
||||||
public class MiniMapControl extends MapInfoControl {
|
public class MiniMapControl extends MapInfoControl {
|
||||||
private float scaleCoefficient = MapInfoLayer.scaleCoefficient;
|
private float scaleCoefficient = MapInfoLayer.scaleCoefficient;
|
||||||
|
|
|
@ -29,6 +29,8 @@ public class MultiTouchSupport {
|
||||||
|
|
||||||
public void onZoomEnded(float distance, float relativeToStart);
|
public void onZoomEnded(float distance, float relativeToStart);
|
||||||
|
|
||||||
|
public void onGestureInit(float x1, float y1, float x2, float y2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean multiTouchAPISupported = false;
|
private boolean multiTouchAPISupported = false;
|
||||||
|
@ -95,6 +97,7 @@ public class MultiTouchSupport {
|
||||||
previousZoom = distance / zoomStartedDistance;
|
previousZoom = distance / zoomStartedDistance;
|
||||||
if (actionCode == ACTION_POINTER_DOWN) {
|
if (actionCode == ACTION_POINTER_DOWN) {
|
||||||
centerPoint = new PointF((x1 + x2) / 2, (y1 + y2) / 2);
|
centerPoint = new PointF((x1 + x2) / 2, (y1 + y2) / 2);
|
||||||
|
listener.onGestureInit(x1, y1, x2, y2);
|
||||||
listener.onZoomStarted(distance, centerPoint);
|
listener.onZoomStarted(distance, centerPoint);
|
||||||
zoomStartedDistance = distance;
|
zoomStartedDistance = distance;
|
||||||
inZoomMode = true;
|
inZoomMode = true;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package net.osmand.plus.views;
|
package net.osmand.plus.views;
|
||||||
|
|
||||||
import net.osmand.OsmAndFormatter;
|
import net.osmand.OsmAndFormatter;
|
||||||
import net.osmand.plus.routing.RoutingHelper.TurnType;
|
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
|
import net.osmand.plus.routing.RoutingHelper.TurnType;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
|
|
@ -13,12 +13,14 @@ import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.DialogProvider;
|
import net.osmand.plus.activities.DialogProvider;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
@ -230,7 +232,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements ContextMenuLayer.ICo
|
||||||
}
|
}
|
||||||
res.append(activity.getString(R.string.osb_bug_name)+ " : " + o.getName()); //$NON-NLS-1$
|
res.append(activity.getString(R.string.osb_bug_name)+ " : " + o.getName()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
Toast.makeText(activity, res.toString(), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(activity, res.toString(), Toast.LENGTH_LONG).show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -362,11 +364,11 @@ public class OsmBugsLayer extends OsmandMapLayer implements ContextMenuLayer.ICo
|
||||||
OsmandApplication.getSettings().USER_OSM_BUG_NAME.set(author);
|
OsmandApplication.getSettings().USER_OSM_BUG_NAME.set(author);
|
||||||
boolean bug = createNewBug(latitude, longitude, text, author);
|
boolean bug = createNewBug(latitude, longitude, text, author);
|
||||||
if (bug) {
|
if (bug) {
|
||||||
Toast.makeText(activity, activity.getResources().getString(R.string.osb_add_dialog_success), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(activity, activity.getResources().getString(R.string.osb_add_dialog_success), Toast.LENGTH_LONG).show();
|
||||||
clearCache();
|
clearCache();
|
||||||
refreshMap();
|
refreshMap();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(activity, activity.getResources().getString(R.string.osb_add_dialog_error), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(activity, activity.getResources().getString(R.string.osb_add_dialog_error), Toast.LENGTH_LONG).show();
|
||||||
openBugAlertDialog(latitude, longitude, text, author);
|
openBugAlertDialog(latitude, longitude, text, author);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -401,11 +403,11 @@ public class OsmBugsLayer extends OsmandMapLayer implements ContextMenuLayer.ICo
|
||||||
OsmandApplication.getSettings().USER_OSM_BUG_NAME.set(author);
|
OsmandApplication.getSettings().USER_OSM_BUG_NAME.set(author);
|
||||||
boolean added = addingComment(bug.getId(), text, author);
|
boolean added = addingComment(bug.getId(), text, author);
|
||||||
if (added) {
|
if (added) {
|
||||||
Toast.makeText(activity, activity.getResources().getString(R.string.osb_comment_dialog_success), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(activity, activity.getResources().getString(R.string.osb_comment_dialog_success), Toast.LENGTH_LONG).show();
|
||||||
clearCache();
|
clearCache();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(activity, activity.getResources().getString(R.string.osb_comment_dialog_error), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(activity, activity.getResources().getString(R.string.osb_comment_dialog_error), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -433,11 +435,11 @@ public class OsmBugsLayer extends OsmandMapLayer implements ContextMenuLayer.ICo
|
||||||
OpenStreetBug bug = (OpenStreetBug) args.getSerializable(KEY_BUG);
|
OpenStreetBug bug = (OpenStreetBug) args.getSerializable(KEY_BUG);
|
||||||
boolean closed = closingBug(bug.getId());
|
boolean closed = closingBug(bug.getId());
|
||||||
if (closed) {
|
if (closed) {
|
||||||
Toast.makeText(activity, activity.getString(R.string.osb_close_dialog_success), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(activity, activity.getString(R.string.osb_close_dialog_success), Toast.LENGTH_LONG).show();
|
||||||
clearCache();
|
clearCache();
|
||||||
refreshMap();
|
refreshMap();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(activity, activity.getString(R.string.osb_close_dialog_error), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(activity, activity.getString(R.string.osb_close_dialog_error), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.MapTileDownloader.DownloadRequest;
|
import net.osmand.data.MapTileDownloader.DownloadRequest;
|
||||||
import net.osmand.data.MapTileDownloader.IMapDownloaderCallback;
|
import net.osmand.data.MapTileDownloader.IMapDownloaderCallback;
|
||||||
import net.osmand.map.IMapLocationListener;
|
import net.osmand.map.IMapLocationListener;
|
||||||
|
@ -23,23 +24,24 @@ import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.Paint.Style;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.graphics.Paint.Style;
|
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.FloatMath;
|
import android.util.FloatMath;
|
||||||
import android.view.GestureDetector;
|
import android.view.GestureDetector;
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.SurfaceHolder;
|
|
||||||
import android.view.SurfaceView;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
import android.view.GestureDetector.OnDoubleTapListener;
|
import android.view.GestureDetector.OnDoubleTapListener;
|
||||||
import android.view.GestureDetector.OnGestureListener;
|
import android.view.GestureDetector.OnGestureListener;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.SurfaceHolder;
|
||||||
import android.view.SurfaceHolder.Callback;
|
import android.view.SurfaceHolder.Callback;
|
||||||
|
import android.view.SurfaceView;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCallback, Callback {
|
public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCallback, Callback {
|
||||||
|
|
||||||
|
@ -204,6 +206,16 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
||||||
return layers;
|
return layers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public <T extends OsmandMapLayer> T getLayerByClass(Class<T> cl) {
|
||||||
|
for(OsmandMapLayer lr : layers) {
|
||||||
|
if(cl.isInstance(cl)){
|
||||||
|
return (T) lr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public OsmandApplication getApplication() {
|
public OsmandApplication getApplication() {
|
||||||
return application;
|
return application;
|
||||||
}
|
}
|
||||||
|
@ -729,11 +741,24 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
||||||
return animatedDraggingThread;
|
return animatedDraggingThread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showMessage(final String msg) {
|
||||||
|
handler.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
AccessibleToast.makeText(getContext(), msg, Toast.LENGTH_SHORT).show(); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private class MapTileViewMultiTouchZoomListener implements MultiTouchZoomListener {
|
private class MapTileViewMultiTouchZoomListener implements MultiTouchZoomListener {
|
||||||
private float initialMultiTouchZoom;
|
private float initialMultiTouchZoom;
|
||||||
private PointF initialMultiTouchCenterPoint;
|
private PointF initialMultiTouchCenterPoint;
|
||||||
private LatLon initialMultiTouchLocation;
|
private LatLon initialMultiTouchLocation;
|
||||||
|
private float x1;
|
||||||
|
private float y1;
|
||||||
|
private float x2;
|
||||||
|
private float y2;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onZoomEnded(float distance, float relativeToStart) {
|
public void onZoomEnded(float distance, float relativeToStart) {
|
||||||
|
@ -743,6 +768,14 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
||||||
zoomPositionChanged(getZoom());
|
zoomPositionChanged(getZoom());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGestureInit(float x1, float y1, float x2, float y2) {
|
||||||
|
this.x1 = x1;
|
||||||
|
this.y1 = y1;
|
||||||
|
this.x2 = x2;
|
||||||
|
this.y2 = y2;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onZoomStarted(float distance, PointF centerPoint) {
|
public void onZoomStarted(float distance, PointF centerPoint) {
|
||||||
initialMultiTouchCenterPoint = centerPoint;
|
initialMultiTouchCenterPoint = centerPoint;
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.List;
|
||||||
|
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.OsmAndFormatter;
|
import net.osmand.OsmAndFormatter;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
import net.osmand.data.AmenityType;
|
import net.osmand.data.AmenityType;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
|
@ -20,16 +21,16 @@ import android.app.AlertDialog;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
|
import android.content.Intent;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.PointF;
|
|
||||||
import android.graphics.RectF;
|
|
||||||
import android.graphics.Paint.Align;
|
import android.graphics.Paint.Align;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
|
import android.graphics.PointF;
|
||||||
|
import android.graphics.RectF;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
@ -104,7 +105,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
}
|
}
|
||||||
buildPoiInformation(res, n);
|
buildPoiInformation(res, n);
|
||||||
}
|
}
|
||||||
Toast.makeText(view.getContext(), res.toString(), Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(view.getContext(), res.toString(), Toast.LENGTH_SHORT).show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -335,7 +336,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
view.getContext().startActivity(intent);
|
view.getContext().startActivity(intent);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
log.error("Failed to invoke call", e); //$NON-NLS-1$
|
log.error("Failed to invoke call", e); //$NON-NLS-1$
|
||||||
Toast.makeText(view.getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(view.getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
} else if (which == siteIndex) {
|
} else if (which == siteIndex) {
|
||||||
try {
|
try {
|
||||||
|
@ -344,7 +345,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
view.getContext().startActivity(intent);
|
view.getContext().startActivity(intent);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
log.error("Failed to invoke call", e); //$NON-NLS-1$
|
log.error("Failed to invoke call", e); //$NON-NLS-1$
|
||||||
Toast.makeText(view.getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(view.getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
} else if (which == descriptionIndex) {
|
} else if (which == descriptionIndex) {
|
||||||
showDescriptionDialog(a);
|
showDescriptionDialog(a);
|
||||||
|
|
|
@ -8,8 +8,8 @@ import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.RectF;
|
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
|
import android.graphics.RectF;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
|
|
@ -7,9 +7,9 @@ import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.Paint.Style;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.graphics.Paint.Style;
|
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
|
|
@ -5,17 +5,17 @@ import java.util.List;
|
||||||
|
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
import net.osmand.osm.MapUtils;
|
import net.osmand.osm.MapUtils;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.Paint.Cap;
|
||||||
|
import android.graphics.Paint.Join;
|
||||||
|
import android.graphics.Paint.Style;
|
||||||
import android.graphics.Path;
|
import android.graphics.Path;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.graphics.Paint.Cap;
|
|
||||||
import android.graphics.Paint.Join;
|
|
||||||
import android.graphics.Paint.Style;
|
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,13 @@ package net.osmand.plus.views;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.TransportRoute;
|
import net.osmand.data.TransportRoute;
|
||||||
import net.osmand.data.TransportStop;
|
import net.osmand.data.TransportStop;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TransportIndexRepository.RouteInfoLocation;
|
import net.osmand.plus.TransportIndexRepository.RouteInfoLocation;
|
||||||
import net.osmand.plus.activities.TransportRouteHelper;
|
import net.osmand.plus.activities.TransportRouteHelper;
|
||||||
import net.osmand.plus.R;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
@ -138,7 +139,7 @@ public class TransportInfoLayer extends OsmandMapLayer {
|
||||||
int x = view.getRotatedMapXForPoint(location.getLatitude(), location.getLongitude());
|
int x = view.getRotatedMapXForPoint(location.getLatitude(), location.getLongitude());
|
||||||
int y = view.getRotatedMapYForPoint(location.getLatitude(), location.getLongitude());
|
int y = view.getRotatedMapYForPoint(location.getLatitude(), location.getLongitude());
|
||||||
if (Math.abs(x - ex) < getRadius() * 3 /2 && Math.abs(y - ey) < getRadius() * 3 /2) {
|
if (Math.abs(x - ex) < getRadius() * 3 /2 && Math.abs(y - ey) < getRadius() * 3 /2) {
|
||||||
Toast.makeText(view.getContext(), st.getName(view.getSettings().USE_ENGLISH_NAMES.get()) + " : " + //$NON-NLS-1$
|
AccessibleToast.makeText(view.getContext(), st.getName(view.getSettings().USE_ENGLISH_NAMES.get()) + " : " + //$NON-NLS-1$
|
||||||
route.getType() + " " + route.getRef() //$NON-NLS-1$
|
route.getType() + " " + route.getRef() //$NON-NLS-1$
|
||||||
, Toast.LENGTH_LONG).show();
|
, Toast.LENGTH_LONG).show();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.views;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.TransportStop;
|
import net.osmand.data.TransportStop;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -77,7 +78,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
||||||
}
|
}
|
||||||
res.append(getStopDescription(n, true));
|
res.append(getStopDescription(n, true));
|
||||||
}
|
}
|
||||||
Toast.makeText(view.getContext(), res.toString(), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(view.getContext(), res.toString(), Toast.LENGTH_LONG).show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
package net.osmand.plus.views;
|
package net.osmand.plus.views;
|
||||||
|
|
||||||
import net.osmand.plus.routing.RoutingHelper.TurnType;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.routing.RoutingHelper.TurnType;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.ColorFilter;
|
import android.graphics.ColorFilter;
|
||||||
import android.graphics.Matrix;
|
import android.graphics.Matrix;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.Paint.Style;
|
||||||
import android.graphics.Path;
|
import android.graphics.Path;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.graphics.Paint.Style;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.util.FloatMath;
|
import android.util.FloatMath;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import java.net.URL;
|
||||||
|
|
||||||
import net.osmand.Algoritms;
|
import net.osmand.Algoritms;
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.ResourceManager;
|
import net.osmand.plus.ResourceManager;
|
||||||
|
@ -32,7 +33,7 @@ public class YandexTrafficAdapter extends MapTileAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInit() {
|
public void onInit() {
|
||||||
Toast.makeText(view.getContext(), R.string.thanks_yandex_traffic, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(view.getContext(), R.string.thanks_yandex_traffic, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue