This commit is contained in:
GaidamakUA 2015-12-22 17:58:53 +02:00
commit 06d41c7e55
30 changed files with 193 additions and 66 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -1888,4 +1888,9 @@ Per retornar a l\'estil habitual dels mapes d\'OsmAnd, només cal desactivar aqu
<string name="no_microphone_permission">L\'aplicació no té autorització per utilitzar el micròfon.</string>
<string name="impassable_road_desc">Indiqueu les vies que voleu evitar en la navegació</string>
<string name="shared_string_sound">So</string>
</resources>
<string name="live_updates">Actualitzacions al moment</string>
<string name="available_maps">Mapes disponibles</string>
<string name="select_voice_provider">Seleccioneu guiatge de veu</string>
<string name="select_voice_provider_descr">Seleccioneu o baixeu el guiatge de veu per al vostre idioma</string>
<string name="last_update">Darrera actualització: %s</string>
</resources>

View file

@ -2003,7 +2003,7 @@
<string name="copied_to_clipboard">In die Zwischenablage kopiert</string>
<string name="release_2_2">" • Neue Kontext-bezogene Benutzeroberfläche bei Auswahl von Orten auf der Karte und anderen Ansichten\n\n • Kartenansicht wird nun direkt gestartet, außer bei Auswahl von \'Zeige Dashboard bei App-Start\'\n\n • Auswahl der anzuzeigenden Elemente im Dashboard möglich\n\n • Dashboard kann umgangen werden, falls menü-basierte App-Steuerung gewünscht ist\n\n • Zum Herunterladen von Kartendateien können nun Regionen direkt durch Tippen auf der Weltkarte ausgewählt werden\n\n • Die POI-Suche ermöglicht nun speziellere Abfragen\n\n • Verbesserungen beim Editieren von POI- und OSM-Objekten\n\n • Oberfläche und Struktur zum Herunterladen der Karten wurden überarbeitet\n\n und mehr … "</string>
<string name="osm_save_offline">Offline speichern</string>
<string name="osm_edit_modified_poi">geänderter OSM-POI</string>
<string name="osm_edit_modified_poi">Geänderter OSM-POI</string>
<string name="osm_edit_deleted_poi">Gelöschter OSM-POI</string>
<string name="context_menu_item_open_note">OSM-Notiz erstellen</string>
<string name="osm_edit_reopened_note">Wiedereröffnete OSM-Notiz</string>

View file

@ -2051,7 +2051,7 @@
<string name="rendering_attr_horseRoutes_name">Lovaglóutak</string>
<string name="no_address_found">Ismeretlen cím</string>
<string name="looking_up_address">Cím keresése</string>
<string name="only_download_over_wifi">Letöltés csak WiFi kapcsolaton</string>
<string name="only_download_over_wifi">Letöltés csak WiFi-n</string>
<string name="live_update">Élő frissítés</string>
<string name="update_now">Frissítés most</string>
<string name="live_updates">Élő frissítések</string>

View file

@ -2068,7 +2068,7 @@
<string name="osn_add_dialog_error">C\'è stato un errore: la nota non è stata creata</string>
<string name="osn_close_dialog_success">La nota è stata chiusa con successo</string>
<string name="osn_close_dialog_error">È stato generato un errore: la nota non è stata chiusa</string>
<string name="shared_string_commit">Sottoponi</string>
<string name="shared_string_commit">Invia</string>
<string name="rendering_attr_currentTrackColor_description">Colore del GPX</string>
<string name="rendering_attr_currentTrackWidth_description">Larghezza del GPX</string>

View file

@ -633,7 +633,7 @@
<string name="save_current_track_descr">Huidige GPX-track nu opslaan</string>
<string name="save_current_track">Huidige GPX-track opslaan</string>
<string name="save_track_interval">Registratie-interval bij navigatie</string>
<string name="save_track_interval_descr">Kies logging-interval voor trackregistratie tijdens navigatie</string>
<string name="save_track_interval_descr">Kies logging-interval voor GPX-track-opname tijdens navigatie</string>
<string name="save_track_to_gpx_descrp">Tijdens het navigeren worden tracks gemaakt en opgeslagen</string>
<string name="save_track_to_gpx">Track registreren tijdens navigatie</string>
<string name="update_tile">Kaart bijwerken</string>
@ -869,7 +869,7 @@
<string name="map_widget_parking">Parkeren</string>
<string name="map_widget_monitoring">Trackregistratie</string>
<string name="map_widget_monitoring">GPX-Track opnemen</string>
<string name="map_widget_speed">Snelheid</string>
<string name="map_widget_distance">Afstand tot bestemming</string>
<string name="map_widget_altitude">Hoogte</string>
@ -1033,7 +1033,7 @@
<string name="recording_unavailable">niet beschikbaar</string>
<string name="recording_context_menu_arecord">Maak een audionotitie</string>
<string name="recording_context_menu_vrecord">Maak een videonotitie</string>
<string name="layer_recordings">Opnamelaag</string>
<string name="layer_recordings">Audio/Video-Notities</string>
<string name="recording_can_not_be_played">Opname kan niet worden afgespeeld</string>
<string name="recording_context_menu_delete">Wis opname</string>
<string name="recording_context_menu_play">Afspelen</string>
@ -1094,7 +1094,7 @@
<string name="hno">Huisnummer</string>
<string name="monitoring_settings">Trip-registratie</string>
<string name="monitoring_settings">GPX-track</string>
<string name="monitoring_settings_descr">Configureer: hoe uw trips op te nemen</string>
<string name="street_name">Straatnaam</string>
@ -1917,7 +1917,7 @@
<string name="lang_nn">Noors (Nynorsk)</string>
<string name="lang_new">Newari / Nepalbhasa</string>
<string name="lang_ms">Maleis</string>
<string name="lang_ht">Haïtiaans Creools</string>
<string name="lang_ht">Haïtiaans</string>
<string name="lang_gl">Galicisch</string>
<string name="lang_et">Estisch</string>
<string name="lang_ceb">Cebuano</string>
@ -1962,7 +1962,7 @@
<string name="favourites_edit_dialog_title">Informatie over favoriet</string>
<string name="simulate_your_location_stop_descr">Stop simulatie</string>
<string name="simulate_your_location_descr">Routesimulatie met de berekende route of een GPX-track</string>
<string name="av_locations_descr">GPX-bestand met aantekeningen</string>
<string name="av_locations_descr">GPX-bestand met Audio/Video-notities</string>
<string name="av_locations">Locaties</string>
<string name="plugin_settings">Plugins</string>
<string name="routing_attr_avoid_shuttle_train_name">Vermijd autotreinen</string>

View file

@ -2574,4 +2574,19 @@
<string name="poi_judo">Judô</string>
<string name="poi_futsal">Futsal</string>
<string name="poi_squash">Squash</string>
</resources>
<string name="poi_parking_garage_boxes">Tipo: garagem box</string>
<string name="poi_parking_carports">Tipo: garagem coberta</string>
<string name="poi_dojo">Dojo</string>
<string name="poi_gaelic_games">Jogos gaélicos</string>
<string name="poi_running">Corrida</string>
<string name="poi_netball">Netball</string>
<string name="poi_karting">Kartismo</string>
<string name="poi_disc_golf">Golfe de disco</string>
<string name="poi_rc_car">Corrida de carrinho de controle remoto</string>
<string name="poi_shuffleboard">Shuffleboard</string>
<string name="poi_lacrosse">Lacrosse</string>
<string name="poi_boxing">Pugilismo</string>
</resources>

View file

@ -1963,4 +1963,9 @@
<string name="no_microphone_permission">App não tem permissão para acessar o microfone.</string>
<string name="impassable_road_desc">Escolha as vias que quer evitar durante a navegação</string>
<string name="shared_string_sound">Som</string>
</resources>
<string name="live_updates">Atualização ao vivo</string>
<string name="available_maps">Mapas disponíveis</string>
<string name="select_voice_provider">Selecione a orientação por voz</string>
<string name="select_voice_provider_descr">Selecione ou baixe a instrução por voz para o seu idioma</string>
<string name="last_update">Última atualização: %s</string>
</resources>

View file

@ -1965,4 +1965,7 @@ Afganistan, Albánsko, Alžírsko, Andora, Angola, Anguilla, Antigua a Barbuda,
<string name="no_microphone_permission">Aplikácia nemá oprávnenia na prístup k mikrofónu.</string>
<string name="select_voice_provider">Zvoľte hlasové pokyny</string>
<string name="select_voice_provider_descr">Vyberte alebo stiahnite hlasové pokyny pre váš jazyk</string>
</resources>
<string name="live_updates">Okamžité aktualizácie</string>
<string name="available_maps">Dostupné mapy</string>
<string name="last_update">Posledná aktualizácia: %s</string>
</resources>

View file

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><resources>
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="about_version">Верзија:</string>
<string name="shared_string_about">Oko</string>
<string name="about_settings_descr">Верзија инфо, лиценце, чланови пројекта</string>
@ -398,7 +399,7 @@
<string name="av_audio_format_descr">Изаберите облик за звучни излаз</string>
<string name="av_audio_bitrate">Битски проток звука</string>
<string name="av_audio_bitrate_descr">Изаберите битски проток звука</string>
<string name="please_specify_poi_type_only_from_list">"Молим, изаберите тачну врсту тачке занимања или је прескочите. "</string>
<string name="please_specify_poi_type_only_from_list">Молим, изаберите тачну врсту тачке занимања или је прескочите</string>
<string name="access_from_map_description">Дугме изборника не покреће изборник, већ плочу полетника</string>
<string name="access_from_map">Приступ са карте</string>
<string name="show_on_start_description">„Искључи“ покреће екран мапе</string>
@ -707,4 +708,34 @@
<string name="osmo_group_by_invite">Уђи по позиву</string>
<string name="osmo_group_information">Молим, прочитајте пре стварања скупа</string>
<string name="gpx_wpt">Пролазна тачка</string>
</resources>
<string name="available_maps">Доступне карте</string>
<string name="select_voice_provider">Изаберите гласовно навођење</string>
<string name="select_voice_provider_descr">Изаберите или преузмите гласовно навођење свог језика</string>
<string name="impassable_road_desc">Изаберите које путеве желите да избегавате током навођења</string>
<string name="shared_string_sound">Звук</string>
<string name="no_location_permission">Програм нема дозволу да приступи подацима о положају</string>
<string name="no_camera_permission">Програм нема дозволу да приступи камери.</string>
<string name="no_microphone_permission">Програм нема дозволу да приступи микрофону.</string>
<string name="route_distance">Растојање:</string>
<string name="route_duration">Време:</string>
<string name="shared_string_near">Близу</string>
<string name="live_updates">Надоградње уживо</string>
<string name="no_address_found">Није одређена адреса</string>
<string name="av_video_quality_low">Најнижа каквоћа</string>
<string name="av_video_quality_high">Највиша каквоћа</string>
<string name="av_video_quality">Каквоћа излаза слике</string>
<string name="av_video_quality_descr">Изаберите својства излазног приказа</string>
<string name="osm_edit_created_note">Направи белешку ОСМ-а</string>
<string name="context_menu_item_delete_waypoint">Да ли избрисати пролазну тачку ГПИкс-а?</string>
<string name="context_menu_item_edit_waypoint">Уреди пролазну тачку ГПИкс-а</string>
<string name="share_osm_edits_subject">Уредбе ОСМ-а дељене на Османду</string>
<string name="osm_edit_created_poi">Тачка занимања ОСМ-а је направљена</string>
<string name="nm">nm</string>
<string name="nm_h">nmh</string>
<string name="min_mile">min/m</string>
<string name="min_km">min/km</string>
<string name="m_s">m/s</string>
<string name="routing_attr_avoid_shuttle_train_description"/>
<string name="routing_attr_avoid_shuttle_train_name"></string>
</resources>

View file

@ -21,6 +21,7 @@ import net.osmand.plus.download.DownloadActivity;
public class FirstUsageFragment extends Fragment {
public static final String TAG = "FirstUsageFragment";
public static boolean SHOW = true;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

View file

@ -970,7 +970,7 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> DEBUG_RENDERING_INFO = new BooleanPreference("debug_rendering", false).makeGlobal();
// this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference<Boolean> SHOW_FAVORITES = new BooleanPreference("show_favorites", false).makeGlobal().cache();
public final OsmandPreference<Boolean> SHOW_FAVORITES = new BooleanPreference("show_favorites", true).makeGlobal().cache();
public final CommonPreference<Boolean> SHOW_ZOOM_BUTTONS_NAVIGATION = new BooleanPreference("show_zoom_buttons_navigation", false).makeProfile().cache();
{

View file

@ -20,6 +20,7 @@ import android.support.v4.app.ActivityCompat;
import android.support.v4.app.NotificationCompat.Builder;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.NotificationCompat;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MotionEvent;
@ -176,9 +177,19 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
mapView = new OsmandMapTileView(this, getWindow().getDecorView().getWidth(),
getWindow().getDecorView().getHeight());
if (app.getAppInitializer().checkAppVersionChanged(this)) {
int statusBarHeight = 0;
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
statusBarHeight = getResources().getDimensionPixelSize(resourceId);
}
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int w = dm.widthPixels;
int h = dm.heightPixels - statusBarHeight;
mapView = new OsmandMapTileView(this, w, h);
if (app.getAppInitializer().checkAppVersionChanged(this) && WhatsNewDialogFragment.SHOW) {
WhatsNewDialogFragment.SHOW = false;
new WhatsNewDialogFragment().show(getSupportFragmentManager(), null);
}
mapActions = new MapActivityActions(this);
@ -240,7 +251,8 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
}
mapView.refreshMap(true);
if (getMyApplication().getAppInitializer().isFirstTime(this)) {
if (getMyApplication().getAppInitializer().isFirstTime(this) && FirstUsageFragment.SHOW) {
FirstUsageFragment.SHOW = false;
getSupportFragmentManager().beginTransaction()
.add(R.id.fragmentContainer, new FirstUsageFragment(),
FirstUsageFragment.TAG).commit();
@ -552,22 +564,24 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
if (dashboardOnMap.isVisible()) {
dashboardOnMap.hideDashboard();
}
// remember if map should come back to isMapLinkedToLocation=true
mapViewTrackingUtilities.setMapLinkedToLocation(false);
if (mapLabelToShow != null && !mapLabelToShow.contextMenuDisabled()) {
mapContextMenu.setMapCenter(latLonToShow);
mapContextMenu.setMapPosition(mapView.getMapPosition());
mapContextMenu.setCenterMarker(true);
mapContextMenu.setMapZoom(settings.getMapZoomToShow());
if (mapLayers.getMapControlsLayer().getMapRouteInfoMenu().isVisible()) {
mapContextMenu.showMinimized(latLonToShow, mapLabelToShow, toShow);
mapLayers.getMapControlsLayer().getMapRouteInfoMenu().updateMenu();
} else {
mapContextMenu.show(latLonToShow, mapLabelToShow, toShow);
}
}
if (!latLonToShow.equals(cur)) {
} else if (!latLonToShow.equals(cur)) {
mapView.getAnimatedDraggingThread().startMoving(latLonToShow.getLatitude(),
latLonToShow.getLongitude(), settings.getMapZoomToShow(), true);
}
// remember if map should come back to isMapLinkedToLocation=true
mapViewTrackingUtilities.setMapLinkedToLocation(false);
}
}

View file

@ -42,7 +42,7 @@ public class AudioVideoNoteMenuBuilder extends MenuBuilder {
DateFormat dateFormat = android.text.format.DateFormat.getMediumDateFormat(view.getContext());
DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(view.getContext());
Date date = new Date(recording.getFile().lastModified());
buildRow(view, R.drawable.ic_action_data, dateFormat.format(date) + "" + timeFormat.format(date), 0, false, 0);
buildRow(view, R.drawable.ic_action_data, dateFormat.format(date) + "" + timeFormat.format(date), 0, false, 0, false);
buildPlainMenuItems(view);

View file

@ -19,6 +19,7 @@ import org.apache.commons.logging.Log;
public class WhatsNewDialogFragment extends DialogFragment {
private static final Log LOG = PlatformUtil.getLog(WhatsNewDialogFragment.class);
public static boolean SHOW = true;
@NonNull
@Override

View file

@ -55,6 +55,8 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
private LatLon mapCenter;
private int mapPosition = 0;
private boolean centerMarker;
private int mapZoom;
private LatLon myLocation;
private Float heading;
@ -149,6 +151,18 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
this.mapCenter = mapCenter;
}
public void setCenterMarker(boolean centerMarker) {
this.centerMarker = centerMarker;
}
public int getMapZoom() {
return mapZoom;
}
public void setMapZoom(int mapZoom) {
this.mapZoom = mapZoom;
}
public void updateMapCenter(LatLon mapCenter) {
WeakReference<MapContextMenuFragment> fragmentRef = findMenuFragment();
if (fragmentRef != null) {
@ -261,9 +275,10 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
public void show(LatLon latLon, PointDescription pointDescription, Object object) {
if (init(latLon, pointDescription, object)) {
if (!MapContextMenuFragment.showInstance(this, mapActivity, false)) {
if (!MapContextMenuFragment.showInstance(this, mapActivity, centerMarker)) {
active = false;
}
centerMarker = false;
}
}

View file

@ -93,6 +93,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
private boolean moving;
private boolean nightMode;
private boolean centered;
private boolean initLayout = true;
private float skipHalfScreenStateLimit;
@ -687,9 +688,6 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
if (menu.displayDistanceDirection()) {
getMapActivity().getMapViewTrackingUtilities().setContextMenu(menu);
}
if (centered) {
centerMarkerLocation();
}
}
@Override
@ -705,6 +703,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
map.setLatLon(mapCenter.getLatitude(), mapCenter.getLongitude());
}
menu.setMapCenter(null);
menu.setMapZoom(0);
getMapActivity().getMapLayers().getMapControlsLayer().setControlsClickable(true);
}
@ -763,9 +762,13 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
origMarkerY = view.getHeight() / 2;
}
if (initLayout && centered) {
centerMarkerLocation();
}
if (!moving) {
doLayoutMenu();
}
initLayout = false;
}
});
@ -776,15 +779,24 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
showOnMap(menu.getLatLon(), true, true, false);
}
private int getZoom() {
int zoom = menu.getMapZoom();
if (zoom == 0) {
zoom = map.getZoom();
}
return zoom;
}
private void showOnMap(LatLon latLon, boolean updateCoords, boolean needMove, boolean alreadyAdjusted) {
AnimateDraggingMapThread thread = map.getAnimatedDraggingThread();
int fZoom = map.getZoom();
int fZoom = getZoom();
double flat = latLon.getLatitude();
double flon = latLon.getLongitude();
RotatedTileBox cp = map.getCurrentRotatedTileBox().copy();
cp.setCenterLocation(0.5f, map.getMapPosition() == OsmandSettings.BOTTOM_CONSTANT ? 0.15f : 0.5f);
cp.setLatLonCenter(flat, flon);
cp.setZoom(fZoom);
flat = cp.getLatFromPixel(cp.getPixWidth() / 2, cp.getPixHeight() / 2);
flon = cp.getLonFromPixel(cp.getPixWidth() / 2, cp.getPixHeight() / 2);
@ -796,7 +808,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
}
if (!alreadyAdjusted) {
LatLon adjustedLatLon = getAdjustedMarkerLocation(getPosY(), new LatLon(flat, flon), true);
LatLon adjustedLatLon = getAdjustedMarkerLocation(getPosY(), new LatLon(flat, flon), true, fZoom);
flat = adjustedLatLon.getLatitude();
flon = adjustedLatLon.getLongitude();
}
@ -937,7 +949,8 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
}
private void adjustMapPosition(int y, boolean animated, boolean center) {
LatLon latlon = getAdjustedMarkerLocation(y, menu.getLatLon(), center);
map.getAnimatedDraggingThread().stopAnimatingSync();
LatLon latlon = getAdjustedMarkerLocation(y, menu.getLatLon(), center, getZoom());
if (map.getLatitude() == latlon.getLatitude() && map.getLongitude() == latlon.getLongitude()) {
return;
@ -950,11 +963,12 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
}
}
private LatLon getAdjustedMarkerLocation(int y, LatLon reqMarkerLocation, boolean center) {
private LatLon getAdjustedMarkerLocation(int y, LatLon reqMarkerLocation, boolean center, int zoom) {
double markerLat = reqMarkerLocation.getLatitude();
double markerLon = reqMarkerLocation.getLongitude();
RotatedTileBox box = map.getCurrentRotatedTileBox().copy();
box.setCenterLocation(0.5f, map.getMapPosition() == OsmandSettings.BOTTOM_CONSTANT ? 0.15f : 0.5f);
box.setZoom(zoom);
int markerMapCenterX = (int)box.getPixXFromLatLon(mapCenter.getLatitude(), mapCenter.getLongitude());
int markerMapCenterY = (int)box.getPixYFromLatLon(mapCenter.getLatitude(), mapCenter.getLongitude());
float cpyOrig = box.getCenterPixelPoint().y;
@ -1021,9 +1035,8 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
private void doLayoutMenu() {
final int posY = getPosY();
setViewY(posY, true, true);
setViewY(posY, true, !initLayout || !centered);
updateMainViewLayout(posY);
// centering = false;
}
public void dismissMenu() {
@ -1044,6 +1057,9 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
public void setFragmentVisibility(boolean visible) {
if (visible) {
view.setVisibility(View.VISIBLE);
if (mapCenter != null) {
map.setLatLon(mapCenter.getLatitude(), mapCenter.getLongitude());
}
adjustMapPosition(getPosY(), true, false);
} else {
view.setVisibility(View.GONE);

View file

@ -2,9 +2,11 @@ package net.osmand.plus.mapcontextmenu;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.text.ClipboardManager;
import android.text.util.Linkify;
import android.util.TypedValue;
@ -40,11 +42,13 @@ public class MenuBuilder {
private int iconId;
private String text;
private boolean needLinks;
private boolean url;
public PlainMenuItem(int iconId, String text, boolean needLinks) {
public PlainMenuItem(int iconId, String text, boolean needLinks, boolean url) {
this.iconId = iconId;
this.text = text;
this.needLinks = needLinks;
this.url = url;
}
public int getIconId() {
@ -58,6 +62,10 @@ public class MenuBuilder {
public boolean isNeedLinks() {
return needLinks;
}
public boolean isUrl() {
return url;
}
}
public MenuBuilder(OsmandApplication app) {
@ -80,7 +88,7 @@ public class MenuBuilder {
protected void buildPlainMenuItems(View view) {
for (PlainMenuItem item : plainMenuItems) {
buildRow(view, item.getIconId(), item.getText(), 0, item.isNeedLinks(), 0);
buildRow(view, item.getIconId(), item.getText(), 0, item.isNeedLinks(), 0, item.isUrl());
}
}
@ -103,11 +111,11 @@ public class MenuBuilder {
firstRow = false;
}
protected View buildRow(View view, int iconId, String text, int textColor, boolean needLinks, int textLinesLimit) {
return buildRow(view, getRowIcon(iconId), text, textColor, needLinks, textLinesLimit);
protected View buildRow(View view, int iconId, String text, int textColor, boolean needLinks, int textLinesLimit, boolean isUrl) {
return buildRow(view, getRowIcon(iconId), text, textColor, needLinks, textLinesLimit, isUrl);
}
protected View buildRow(final View view, Drawable icon, final String text, int textColor, boolean needLinks, int textLinesLimit) {
protected View buildRow(final View view, Drawable icon, final String text, int textColor, boolean needLinks, int textLinesLimit, boolean isUrl) {
if (!isFirstRow()) {
buildRowDivider(view, false);
@ -154,7 +162,9 @@ public class MenuBuilder {
textView.setTextSize(16);
textView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_info_text_light : R.color.ctx_menu_info_text_dark));
if (needLinks) {
if (isUrl) {
textView.setTextColor(textView.getLinkTextColors());
} else if (needLinks) {
textView.setAutoLinkMask(Linkify.ALL);
textView.setLinksClickable(true);
}
@ -173,6 +183,17 @@ public class MenuBuilder {
llText.setLayoutParams(llTextViewParams);
llText.addView(textView);
if (isUrl) {
ll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(text));
v.getContext().startActivity(intent);
}
});
}
((LinearLayout) view).addView(ll);
rowBuilt();
@ -248,8 +269,8 @@ public class MenuBuilder {
public void buildCustomAddressLine(LinearLayout ll) {
}
public void addPlainMenuItem(int iconId, String text, boolean needLinks) {
plainMenuItems.add(new PlainMenuItem(iconId, text, needLinks));
public void addPlainMenuItem(int iconId, String text, boolean needLinks, boolean isUrl) {
plainMenuItems.add(new PlainMenuItem(iconId, text, needLinks, isUrl));
}
public void clearPlainMenuItems() {

View file

@ -125,8 +125,8 @@ public abstract class MenuController extends BaseMenuController {
protected abstract void setObject(Object object);
public void addPlainMenuItem(int iconId, String text, boolean needLinks) {
builder.addPlainMenuItem(iconId, text, needLinks);
public void addPlainMenuItem(int iconId, String text, boolean needLinks, boolean isUrl) {
builder.addPlainMenuItem(iconId, text, needLinks, isUrl);
}
public void clearPlainMenuItems() {
@ -139,7 +139,7 @@ public abstract class MenuController extends BaseMenuController {
protected void addMyLocationToPlainItems(LatLon latLon) {
addPlainMenuItem(R.drawable.ic_action_get_my_location, PointDescription.getLocationName(getMapActivity(),
latLon.getLatitude(), latLon.getLongitude(), true).replaceAll("\n", ""), false);
latLon.getLatitude(), latLon.getLongitude(), true).replaceAll("\n", ""), false, false);
}
public PointDescription getPointDescription() {

View file

@ -344,7 +344,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
buildRow(view, R.drawable.ic_action_get_my_location, PointDescription.getLocationName(app,
amenity.getLocation().getLatitude(), amenity.getLocation().getLongitude(), true)
.replaceAll("\n", ""), 0, false, 0);
.replaceAll("\n", ""), 0, false, 0, false);
}
public void buildAmenityRow(View view, AmenityInfoRow info) {

View file

@ -25,7 +25,7 @@ public class FavouritePointMenuBuilder extends MenuBuilder {
@Override
public void buildInternal(View view) {
if (!Algorithms.isEmpty(fav.getDescription())) {
buildRow(view, R.drawable.ic_action_note_dark, fav.getDescription(), 0, true, 0);
buildRow(view, R.drawable.ic_action_note_dark, fav.getDescription(), 0, true, 0, false);
}
buildPlainMenuItems(view);

View file

@ -34,7 +34,7 @@ public class GpxItemMenuBuilder extends MenuBuilder {
String description = GpxUiHelper.getDescription(app, item.analysis, false);
String[] lines = description.split("\n");
for (String line : lines) {
buildRow(view, R.drawable.ic_action_info_dark, line, 0, false, 0);
buildRow(view, R.drawable.ic_action_info_dark, line, 0, false, 0, false);
}
}

View file

@ -34,23 +34,23 @@ public class WptPtMenuBuilder extends MenuBuilder {
DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(view.getContext());
Date date = new Date(wpt.time);
buildRow(view, R.drawable.ic_action_data,
dateFormat.format(date) + "" + timeFormat.format(date), 0, false, 0);
dateFormat.format(date) + "" + timeFormat.format(date), 0, false, 0, false);
}
if (wpt.speed > 0) {
buildRow(view, R.drawable.ic_action_speed,
OsmAndFormatter.getFormattedSpeed((float)wpt.speed, app), 0, false, 0);
OsmAndFormatter.getFormattedSpeed((float)wpt.speed, app), 0, false, 0, false);
}
if (!Double.isNaN(wpt.ele)) {
buildRow(view, R.drawable.ic_action_altitude,
OsmAndFormatter.getFormattedDistance((float) wpt.ele, app), 0, false, 0);
OsmAndFormatter.getFormattedDistance((float) wpt.ele, app), 0, false, 0, false);
}
if (!Double.isNaN(wpt.hdop)) {
buildRow(view, R.drawable.ic_action_gps_info,
Algorithms.capitalizeFirstLetterAndLowercase(app.getString(R.string.plugin_distance_point_hdop)) + ": "
+ OsmAndFormatter.getFormattedDistance((float)wpt.hdop, app), 0, false, 0);
+ OsmAndFormatter.getFormattedDistance((float)wpt.hdop, app), 0, false, 0, false);
}
if (!Algorithms.isEmpty(wpt.desc)) {
final View row = buildRow(view, R.drawable.ic_action_note_dark, wpt.desc, 0, true, 10);
final View row = buildRow(view, R.drawable.ic_action_note_dark, wpt.desc, 0, true, 10, false);
row.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

View file

@ -97,7 +97,7 @@ public class AmenityMenuController extends MenuController {
if (resId == 0) {
resId = R.drawable.ic_action_folder_stroke;
}
addPlainMenuItem(resId, typeStr, false);
addPlainMenuItem(resId, typeStr, false, false);
}
}
}

View file

@ -184,8 +184,8 @@ public class MapDataMenuController extends MenuController {
@Override
public void addPlainMenuItems(String typeStr, PointDescription pointDescription, LatLon latLon) {
if (indexItem != null) {
addPlainMenuItem(R.drawable.ic_action_info_dark, indexItem.getType().getString(getMapActivity()), false);
addPlainMenuItem(R.drawable.ic_action_info_dark, indexItem.getSizeDescription(getMapActivity()), false);
addPlainMenuItem(R.drawable.ic_action_info_dark, indexItem.getType().getString(getMapActivity()), false, false);
addPlainMenuItem(R.drawable.ic_action_info_dark, indexItem.getSizeDescription(getMapActivity()), false, false);
}
if (!Algorithms.isEmpty(mapObject.getWorldRegion().getParams().getWikiLink())) {
String[] items = mapObject.getWorldRegion().getParams().getWikiLink().split(":");
@ -195,11 +195,11 @@ public class MapDataMenuController extends MenuController {
} else {
url = "https://wikipedia.org/wiki/" + items[0].replace(' ', '_');
}
addPlainMenuItem(R.drawable.ic_world_globe_dark, url, true);
addPlainMenuItem(R.drawable.ic_world_globe_dark, url, false, true);
}
if (indexItem != null) {
DateFormat dateFormat = android.text.format.DateFormat.getMediumDateFormat(getMapActivity());
addPlainMenuItem(R.drawable.ic_action_data, indexItem.getRemoteDate(dateFormat), false);
addPlainMenuItem(R.drawable.ic_action_data, indexItem.getRemoteDate(dateFormat), false, false);
}
}

View file

@ -31,8 +31,8 @@ public class EditPOIMenuBuilder extends MenuBuilder {
if (osmPoint instanceof OsmNotesPoint) {
OsmNotesPoint notes = (OsmNotesPoint) osmPoint;
buildRow(view, R.drawable.ic_action_note_dark, notes.getText(), 0, false, 0);
buildRow(view, R.drawable.ic_group, notes.getAuthor(), 0, false, 0);
buildRow(view, R.drawable.ic_action_note_dark, notes.getText(), 0, false, 0, false);
buildRow(view, R.drawable.ic_group, notes.getAuthor(), 0, false, 0, false);
} else if (osmPoint instanceof OpenstreetmapPoint) {
OpenstreetmapPoint point = (OpenstreetmapPoint) osmPoint;
@ -57,7 +57,7 @@ public class EditPOIMenuBuilder extends MenuBuilder {
if (resId == 0) {
resId = R.drawable.ic_action_folder_stroke;
}
buildRow(view, resId, poiTranslation, 0, false, 0);
buildRow(view, resId, poiTranslation, 0, false, 0, false);
break;
}
}
@ -67,12 +67,12 @@ public class EditPOIMenuBuilder extends MenuBuilder {
continue;
}
String text = e.getKey() + "=" + e.getValue();
buildRow(view, R.drawable.ic_action_info_dark, text, 0, false, 0);
buildRow(view, R.drawable.ic_action_info_dark, text, 0, false, 0, false);
}
}
buildRow(view, R.drawable.ic_action_get_my_location, PointDescription.getLocationName(app,
osmPoint.getLatitude(), osmPoint.getLongitude(), true)
.replaceAll("\n", ""), 0, false, 0);
.replaceAll("\n", ""), 0, false, 0, false);
}
}

View file

@ -96,7 +96,7 @@ public class OsmBugMenuController extends MenuController {
public void addPlainMenuItems(String typeStr, PointDescription pointDescription, LatLon latLon) {
super.addPlainMenuItems(typeStr, pointDescription, latLon);
for (String description : bug.getCommentDescriptionList()) {
addPlainMenuItem(R.drawable.ic_action_note_dark, description, true);
addPlainMenuItem(R.drawable.ic_action_note_dark, description, true, false);
}
}