Refactor context menu for objects - make it quickaction independent and special case for accessibility

This commit is contained in:
Victor Shcherb 2014-07-06 03:08:08 +02:00
commit 157b5b0209
6 changed files with 35 additions and 24 deletions

View file

@ -1535,8 +1535,8 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
<string name="speak_street_names">Straatnamen aankondigen (TTS)</string> <string name="speak_street_names">Straatnamen aankondigen (TTS)</string>
<string name="osmodroid_mode_on">OsMoDroid stoppen</string> <string name="osmodroid_mode_on">OsMoDroid stoppen</string>
<string name="osmodroid_mode_off">OsMoDroid starten</string> <string name="osmodroid_mode_off">OsMoDroid starten</string>
<string name="driving_region_descr">Selecteer reisregio: VS, Europa, GB, Azië en andere</string> <string name="driving_region_descr">Selecteer land of regio: VS, Europa, GB, Azië en andere</string>
<string name="driving_region">Reisregio</string> <string name="driving_region">Land</string>
<string name="driving_region_japan">Japan</string> <string name="driving_region_japan">Japan</string>
<string name="driving_region_us">Verenigde Staten</string> <string name="driving_region_us">Verenigde Staten</string>
<string name="driving_region_canada">Canada</string> <string name="driving_region_canada">Canada</string>
@ -1583,7 +1583,7 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
</string> </string>
<string name="base_world_map">Basis-wereldkaart</string> <string name="base_world_map">Basis-wereldkaart</string>
<string name="map_magnifier">Kaartvergrootglas</string> <string name="map_magnifier">Kaartvergrootglas</string>
<string name="route_is_too_long">De bestemming ligt verder dan 200 kilometer. De routeberekening kan dan erg lang duren. Door zelf tussenliggende routepunten te maken kunt u de routeberekening sneller maken.</string> <string name="route_is_too_long">"De afstand tot de bestemming is meer dan 200 km. De routeberekening kan hierdoor erg lang duren (of zelfs mislukken). Door tussenliggende routepunten toe te voegen, wordt de routeberekening sneller."</string>
<string name="auto_zoom_none">Geen automatische zoom</string> <string name="auto_zoom_none">Geen automatische zoom</string>
<string name="auto_zoom_close">Zoom naar close-up</string> <string name="auto_zoom_close">Zoom naar close-up</string>
<string name="auto_zoom_far">Zoom naar gemiddelde afstand</string> <string name="auto_zoom_far">Zoom naar gemiddelde afstand</string>
@ -1791,7 +1791,7 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
<string name="osmo_create_group">Maak een nieuwe groep</string> <string name="osmo_create_group">Maak een nieuwe groep</string>
<string name="osmo_server_operation_failed">OsMo server probleem</string> <string name="osmo_server_operation_failed">OsMo server probleem</string>
<string name="osmo_activity">OsMo-monitor</string> <string name="osmo_activity">OsMo-monitor</string>
<string name="osmo_enable_tracker">Zend mijn posities</string> <string name="osmo_enable_tracker">Verzend mijn posities</string>
<string name="osmo_control">OsMo snelle toegang</string> <string name="osmo_control">OsMo snelle toegang</string>
<string name="local_index_mi_export">Exporteer</string> <string name="local_index_mi_export">Exporteer</string>
<string name="import_file_favourites">Bewaren als GPX bestand of importeren in favorieten?</string> <string name="import_file_favourites">Bewaren als GPX bestand of importeren in favorieten?</string>
@ -1859,7 +1859,7 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
<string name="selected_gpx_info_show">\n\nLang drukken om op de kaart te bekijken</string> <string name="selected_gpx_info_show">\n\nLang drukken om op de kaart te bekijken</string>
<string name="delay_navigation_start">Start navigatie met vertraging</string> <string name="delay_navigation_start">Start navigatie met vertraging</string>
<string name="selected">gekozen</string> <string name="selected">gekozen</string>
<string name="gpx_split_interval">Splits om de</string> <string name="gpx_split_interval">Splits om de</string>
<string name="gpx_info_waypoints">Routepunten: %1$s </string> <string name="gpx_info_waypoints">Routepunten: %1$s </string>
<string name="show_zoom_buttons_navigation_descr">Zoomknoppen tonen tijdens navigeren</string> <string name="show_zoom_buttons_navigation_descr">Zoomknoppen tonen tijdens navigeren</string>
<string name="show_zoom_buttons_navigation">Zoomknoppen</string> <string name="show_zoom_buttons_navigation">Zoomknoppen</string>

View file

@ -1600,4 +1600,10 @@
<string name="local_index_unselect_gpx_file">Avmarkera</string> <string name="local_index_unselect_gpx_file">Avmarkera</string>
<string name="local_index_select_gpx_file">Markera för att visa</string> <string name="local_index_select_gpx_file">Markera för att visa</string>
<string name="no_index_file_to_download">Inget att ladda ner; kolla din Internetanslutning.</string> <string name="no_index_file_to_download">Inget att ladda ner; kolla din Internetanslutning.</string>
<string name="osmo_gpx_points_downloaded">OsMo-punkter %1$s nedladdade.</string>
<string name="osmo_auto_connect_descr">Anslut automatiskt till tjänsten när appen startats</string>
<string name="osmo_auto_connect">Auto-anslut</string>
<string name="osmo_start_service">OsMo-tjänst</string>
<string name="osmo_gpx_track_downloaded">OsMo-spår %1$s nedladdat.</string>
<string name="tip_map_switch_t_v2">"Kartkälla och kartlager som ska visas ändras via \'Meny\' → \'Kartlager\'.\n\nUnder \'Kartkälla...\' kan du välja mellan de förladdade offline vektorkartorna (standard, krävs också för offline-navigering), eller fördefinierade (online eller cachade offline) kartbitskällor (aktivera insticksmodulen \'Online-kartor\' under \'Inställningar\'→ \'Plugin\' för detta), eller kartor skapade manuellt med t.ex. OsmaAndMapCreator på en PC.\n\nOsmAnd stöder också egna källor. "</string>
</resources> </resources>

View file

@ -1880,4 +1880,9 @@ OsmAnd 是開放原始碼,而且正在積極的開發。應用程式從報告
<string name="local_index_select_gpx_file">選取要顯示的</string> <string name="local_index_select_gpx_file">選取要顯示的</string>
<string name="route_descr_destination">\t</string> <string name="route_descr_destination">\t</string>
<string name="no_index_file_to_download">無法下載,請檢查網路連線。</string> <string name="no_index_file_to_download">無法下載,請檢查網路連線。</string>
<string name="osmo_gpx_points_downloaded">OsMo 標點 %1$s 已下載。</string>
<string name="osmo_auto_connect_descr">自動連線至服務,隨後啟動應用程式</string>
<string name="osmo_auto_connect">自動連線</string>
<string name="osmo_start_service">OsMo 服務</string>
<string name="osmo_gpx_track_downloaded">OsMo 軌跡 %1$s 已下載。</string>
</resources> </resources>

View file

@ -170,8 +170,8 @@ public class FavouritesTreeFragment extends OsmandExpandableListFragment {
}; };
MapActivityActions.createDirectionsActions(qa, location, point, name, settings.getLastKnownMapZoom(), MapActivityActions.createDirectionsActions(qa, location, point, name, settings.getLastKnownMapZoom(),
getActivity(), true, false); getActivity(), true, false);
Item edit = qa.item(R.string.favourites_context_menu_edit).icons(R.drawable.ic_action_edit_light , Item edit = qa.item(R.string.favourites_context_menu_edit).icons(
R.drawable.ic_action_edit_dark); R.drawable.ic_action_edit_dark, R.drawable.ic_action_edit_light);
edit.listen( edit.listen(
new OnContextMenuClick() { new OnContextMenuClick() {
@ -180,8 +180,8 @@ public class FavouritesTreeFragment extends OsmandExpandableListFragment {
editPoint(point); editPoint(point);
} }
}).reg(); }).reg();
Item delete = qa.item(R.string.favourites_context_menu_delete).icons(R.drawable.ic_action_delete_light , Item delete = qa.item(R.string.favourites_context_menu_delete).icons(
R.drawable.ic_action_delete_dark); R.drawable.ic_action_delete_dark, R.drawable.ic_action_delete_light);
delete.listen( delete.listen(
new OnContextMenuClick() { new OnContextMenuClick() {

View file

@ -1034,8 +1034,8 @@ public class MapActivityActions implements DialogProvider {
final TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper(); final TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
Item dir = qa.item(R.string.get_directions).icons(R.drawable.ic_action_gdirections_light , Item dir = qa.item(R.string.get_directions).icons(
R.drawable.ic_action_gdirections_dark); R.drawable.ic_action_gdirections_dark, R.drawable.ic_action_gdirections_light);
dir.listen( dir.listen(
new OnContextMenuClick() { new OnContextMenuClick() {
@ -1046,11 +1046,11 @@ public class MapActivityActions implements DialogProvider {
}).reg(); }).reg();
Item intermediate; Item intermediate;
if (targetPointsHelper.getPointToNavigate() != null) { if (targetPointsHelper.getPointToNavigate() != null) {
intermediate = qa.item(R.string.context_menu_item_intermediate_point).icons(R.drawable.ic_action_flage_light, intermediate = qa.item(R.string.context_menu_item_intermediate_point).icons(
R.drawable.ic_action_flage_dark); R.drawable.ic_action_flage_dark,R.drawable.ic_action_flage_light);
} else { } else {
intermediate = qa.item(R.string.context_menu_item_destination_point).icons(R.drawable.ic_action_flag_light, intermediate = qa.item(R.string.context_menu_item_destination_point).icons(
R.drawable.ic_action_flag_dark); R.drawable.ic_action_flag_dark, R.drawable.ic_action_flag_light);
} }
intermediate.listen(new OnContextMenuClick() { intermediate.listen(new OnContextMenuClick() {
@Override @Override
@ -1059,8 +1059,8 @@ public class MapActivityActions implements DialogProvider {
} }
}).reg(); }).reg();
Item showOnMap = qa.item(R.string.show_poi_on_map).icons(R.drawable.ic_action_marker_light , Item showOnMap = qa.item(R.string.show_poi_on_map).icons(
R.drawable.ic_action_marker_dark); R.drawable.ic_action_marker_dark, R.drawable.ic_action_marker_light );
showOnMap.listen( showOnMap.listen(
new OnContextMenuClick() { new OnContextMenuClick() {
@ -1072,8 +1072,8 @@ public class MapActivityActions implements DialogProvider {
} }
}).reg(); }).reg();
if (favorite) { if (favorite) {
Item addToFavorite = qa.item(R.string.add_to_favourite).icons(R.drawable.ic_action_fav_light, Item addToFavorite = qa.item(R.string.add_to_favourite).icons(
R.drawable.ic_action_fav_dark); R.drawable.ic_action_fav_dark, R.drawable.ic_action_fav_light);
addToFavorite.listen(new OnContextMenuClick() { addToFavorite.listen(new OnContextMenuClick() {
@Override @Override
@ -1111,7 +1111,7 @@ public class MapActivityActions implements DialogProvider {
for (int i = 0; i < qa.length(); i++) { for (int i = 0; i < qa.length(); i++) {
ActionItem ai = new ActionItem(); ActionItem ai = new ActionItem();
int id = qa.getImageId(0, true); int id = qa.getImageId(i, true);
if (id != 0) { if (id != 0) {
ai.setIcon(activity.getResources().getDrawable(id)); ai.setIcon(activity.getResources().getDrawable(id));
} }

View file

@ -571,8 +571,8 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
MapActivityActions.createDirectionsActions(adapter, amenity.getLocation(), amenity, name, z, this, true ); MapActivityActions.createDirectionsActions(adapter, amenity.getLocation(), amenity, name, z, this, true );
final String d = OsmAndFormatter.getAmenityDescriptionContent(getMyApplication(), amenity, false); final String d = OsmAndFormatter.getAmenityDescriptionContent(getMyApplication(), amenity, false);
if(d.toString().trim().length() > 0) { if(d.toString().trim().length() > 0) {
Item poiDescr = adapter.item(R.string.poi_context_menu_showdescription).icons(R.drawable.ic_action_note_light, Item poiDescr = adapter.item(R.string.poi_context_menu_showdescription).icons(
R.drawable.ic_action_note_dark); R.drawable.ic_action_note_dark, R.drawable.ic_action_note_light);
poiDescr.listen(new OnContextMenuClick() { poiDescr.listen(new OnContextMenuClick() {
@Override @Override