This commit is contained in:
Alexey Kulish 2015-11-30 17:21:45 +03:00
commit 06ffd11139
7 changed files with 166 additions and 52 deletions

View file

@ -1327,7 +1327,7 @@ OsmAnd е с отворен код и активно да се развива.
<string name="poi_dialog_comment_default">Промяна на POI</string>
<string name="poi_dialog_other_tags_message">Всички други тагове се запазват</string>
<string name="default_buttons_commit">Изпрати</string>
<string name="shared_string_clear">Нулиране</string>
<string name="shared_string_clear">Изчисти</string>
<string name="filter_current_poiButton">Филтър</string>
<string name="edit_filter_save_as_menu_item">Запиши като</string>

View file

@ -1709,10 +1709,10 @@
<string name="poi_religion_multifaith">Mehrfachgläubig</string>
<string name="poi_religion_scientologist">Scientology</string>
<string name="poi_denomination_uniting">Vereinigung</string>
<string name="poi_denomination_congregational">Congregational</string>
<string name="poi_denomination_congregational">Kongregationalismus</string>
<string name="poi_denomination_ethiopian_orthodox_tewahedo">Äthiopisch-orthodoxe tewahedo-Kirche</string>
<string name="poi_denomination_unitarian">Unitarisch</string>
<string name="poi_denomination_wesleyan">Wesleyan</string>
<string name="poi_denomination_wesleyan">Wesleyaner</string>
<string name="poi_denomination_shingon_shu">Schule des wahren Wortes</string>
<string name="poi_denomination_mahayana">Mahayana</string>

View file

@ -526,7 +526,7 @@
<string name="poi_religion_shinto">Xintoísmo</string>
<string name="poi_religion_taoist">Taoísmo</string>
<string name="poi_internet_access_wlan">Acesso à Internet: wlan</string>
<string name="poi_internet_access_wlan">Acesso à Internet: wifi</string>
<string name="poi_internet_access_terminal">Acesso à Internet: terminal</string>
<string name="poi_internet_access_wired">Acesso à Internet: com fio</string>
<string name="poi_internet_access_public">Acesso à Internet: público</string>
@ -1746,7 +1746,7 @@
<string name="poi_resource_lignite">Linhite</string>
<string name="poi_resource_limestone">Pedra calcária</string>
<string name="poi_resource_marble">Mármore</string>
<string name="poi_resource_mercury"/>
<string name="poi_resource_mercury">Mercúrio</string>
<string name="poi_resource_mica">Mica</string>
<string name="poi_resource_mineral_oil">Óleo mineral</string>
<string name="poi_resource_nickel">Níquel</string>
@ -1790,4 +1790,87 @@
<string name="poi_shelter_type_public_transport">Tipo de abrigo: transporte público</string>
<string name="poi_shelter_type_picnic_shelter">Tipo de abrigo: abrigo de piquenique</string>
<string name="poi_shelter_type_weather_shelter">Tipo de abrigo: abrigo do tempo</string>
<string name="poi_piste_grooming_scooter">Pista de preparação: scooter</string>
<string name="poi_piste_grooming_skating">Pista de preparação: skating</string>
<string name="poi_piste_grooming_no">Pista de preparação: não</string>
<string name="poi_piste_grooming_mogul">Pista de preparação: mogul</string>
<string name="poi_aerialway_bubble_yes">Bolha</string>
<string name="poi_aerialway_bubble_no">Sem bolha</string>
<string name="poi_vending_bicycle_tube">Tubos para bicicletas</string>
<string name="poi_branch">Seção</string>
<string name="poi_memorial_cross">Cruzeiro</string>
<string name="poi_wetland_tidalflat">Planície de maré</string>
<string name="poi_wetland_saltmarsh">Pântano salgado</string>
<string name="poi_wetland_mangrove">Mangue</string>
<string name="poi_wetland_string_bog">Cadeia de pântanos</string>
<string name="poi_wetland_fen">Pântano subeterrâneo</string>
<string name="poi_wetland_palsa_bog">Pântano palsa</string>
<string name="poi_wetland_mud">Lama</string>
<string name="poi_beach_sand">Tipo de praia: areia</string>
<string name="poi_beach_shingle">Tipo de praia: cascalho</string>
<string name="poi_beach_rocky">Tipo de praia: rocha</string>
<string name="poi_flagpole">Mastro de bandeira</string>
<string name="poi_shelter_type_lean_to">Tipo de abrigo: alpendre</string>
<string name="poi_shelter_type_basic_hut">Tipo de abrigo: cabana básica</string>
<string name="poi_shelter_type_building">Tipo de abrigo: edifício</string>
<string name="poi_shelter_type_wildlife_hide">Tipo de abrigo: esconderijo para animais selvagens</string>
<string name="poi_shelter_type_rock_shelter">Tipo de abrigo: rocha</string>
<string name="poi_shelter_type_sun_shelter">Tipo de abrigo: abrigo do sol</string>
<string name="poi_shelter_type_field_shelter">Tipo de abrigo: abrigo de campo</string>
<string name="poi_shelter_type_tent">Tipo de abrigo: tenda</string>
<string name="poi_shelter_type_abandoned">Tipo de abrigo: abandonado</string>
<string name="poi_internet_access_type_wlan">Tipo de acesso à Internet: wifi</string>
<string name="poi_internet_access_type_terminal">Tipo de acesso à Internet: terminal</string>
<string name="poi_internet_access_type_wired">Tipo de acesso à Internet: cabo</string>
<string name="poi_internet_access_type_public">Tipo de acesso à Internet: público</string>
<string name="poi_internet_access_type_service">Tipo de acesso à Internet: serviço</string>
<string name="poi_internet_access_type_no">Sem acesso à Internet</string>
<string name="poi_internet_access_type_yes">Com acesso à Internet</string>
<string name="poi_maxwidth">Largura máxima</string>
<string name="poi_iata">Código IATA</string>
<string name="poi_icao">Código ICAO</string>
<string name="poi_faa">Código FAA</string>
<string name="poi_artwork_type_sculpture">Tipo de obra de arte: escultura</string>
<string name="poi_artwork_type_statue">Tipo de obra de arte: estátua</string>
<string name="poi_artwork_type_mural">Tipo de obra de arte: mural</string>
<string name="poi_artwork_type_architecture">Tipo de obra de arte: arquitetura</string>
<string name="poi_artwork_type_painting">Tipo de obra de arte: pintura</string>
<string name="poi_artwork_type_stone">Tipo de obra de arte: pedra</string>
<string name="poi_artwork_type_bust">Tipo de obra de arte: busto</string>
<string name="poi_artwork_type_installation">Tipo de obra de arte: instalação</string>
<string name="poi_artwork_type_mosaic">Tipo de obra de arte: mosaico</string>
<string name="poi_artwork_type_relief">Tipo de obra de arte: relevo</string>
<string name="poi_artwork_type_graffiti">Tipo de obra de arte: grafite</string>
<string name="poi_artwork_type_stele">Tipo de obra de arte: estela</string>
<string name="poi_artwork_type_fountain">Tipo de obra de arte: fonte</string>
<string name="poi_width">Largura</string>
<string name="poi_architect_name">Arquiteto</string>
<string name="poi_architecture_modern">Arquitetura: moderna</string>
<string name="poi_architecture_stalinist_neoclassicism">Arquitetura: neoclassicismo stalinista</string>
<string name="poi_architecture_eclectic">Arquitetura: eclética</string>
<string name="poi_architecture_new_objectivity">Arquitetura: nova objetividade</string>
<string name="poi_architecture_contemporary">Arquitetura: contemporâneo</string>
<string name="poi_architecture_constructivism">Arquitetura: construtivismo</string>
<string name="poi_architecture_umgebinde">Arquitetura: umgebinde</string>
<string name="poi_architecture_timber_frame">Arquitetura: enxaimel</string>
<string name="poi_architecture_art_nouveau">Arquitetura: art nouveau</string>
<string name="poi_architecture_neoclassicism">Arquitetura: neoclassicismo</string>
<string name="poi_architecture_victorian">Arquitetura: vitoriana</string>
<string name="poi_architecture_brutalism">Arquitetura: brutalista</string>
<string name="poi_architecture_classicism">Arquitetura: classicismo</string>
<string name="poi_architecture_gothic">Arquitetura: gótica</string>
<string name="poi_architecture_oldrussian">Arquitetura: russa antiga</string>
<string name="poi_architecture_baroque">Arquitetura: barroca</string>
<string name="poi_architecture_postconstructivism">Arquitetura: pós-construtivismo</string>
</resources>

View file

@ -2354,4 +2354,8 @@
<string name="poi_aerialway_length">長度</string>
</resources>
<string name="poi_wiki_lang_ast">阿斯圖爾-萊昂語維基</string>
<string name="poi_wiki_lang_tg">塔吉克語維基</string>
<string name="poi_wiki_lang_ba">巴什基爾語維基</string>
<string name="poi_wiki_lang_sco">低地蘇格蘭語維基</string>
</resources>

View file

@ -1,5 +1,9 @@
package net.osmand.plus;
import android.content.Context;
import net.osmand.StateChangedListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@ -8,9 +12,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import net.osmand.StateChangedListener;
import android.content.Context;
public class ApplicationMode {
private static Map<String, Set<ApplicationMode>> widgets = new LinkedHashMap<String, Set<ApplicationMode>>();
@ -99,8 +100,10 @@ public class ApplicationMode {
}
public ApplicationModeBuilder carLocation(){
applicationMode.bearingIcon = R.drawable.map_car_bearing;
applicationMode.locationIcon = R.drawable.map_car_location;
applicationMode.bearingIconDay = R.drawable.map_car_bearing;
applicationMode.bearingIconNight = R.drawable.map_car_bearing_night;
applicationMode.locationIconDay = R.drawable.map_car_location;
applicationMode.locationIconNight = R.drawable.map_car_location_night;
return this;
}
@ -110,14 +113,18 @@ public class ApplicationMode {
}
public ApplicationModeBuilder bicycleLocation(){
applicationMode.bearingIcon = R.drawable.map_bicycle_bearing;
applicationMode.locationIcon = R.drawable.map_bicycle_location;
applicationMode.bearingIconDay = R.drawable.map_bicycle_bearing;
applicationMode.bearingIconNight = R.drawable.map_bicycle_bearing_night;
applicationMode.locationIconDay = R.drawable.map_bicycle_location;
applicationMode.locationIconNight = R.drawable.map_bicycle_location_night;
return this;
}
public ApplicationModeBuilder defLocation(){
applicationMode.bearingIcon = R.drawable.map_pedestrian_bearing;
applicationMode.locationIcon = R.drawable.map_pedestrian_location;
applicationMode.bearingIconDay = R.drawable.map_pedestrian_bearing;
applicationMode.bearingIconNight = R.drawable.map_pedestrian_bearing_night;
applicationMode.locationIconDay = R.drawable.map_pedestrian_location;
applicationMode.locationIconNight = R.drawable.map_pedestrian_location_night;
return this;
}
@ -138,21 +145,6 @@ public class ApplicationMode {
builder.applicationMode = new ApplicationMode(key, stringKey);
return builder;
}
private final int key;
private final String stringKey;
private ApplicationMode parent;
private int iconId = R.drawable.ic_browse_map;
private int smallIconDark = R.drawable.ic_world_globe_dark ;
private float defaultSpeed = 10f;
private int minDistanceForTurn = 50;
private int arrivalDistance = 90;
private int bearingIcon = R.drawable.map_pedestrian_bearing;
private int locationIcon = R.drawable.map_pedestrian_location;
private static StateChangedListener<String> listener;
private ApplicationMode(int key, String stringKey) {
this.key = key;
@ -240,12 +232,20 @@ public class ApplicationMode {
return getDefaultSpeed() > 10;
}
public int getResourceBearing() {
return bearingIcon;
public int getResourceBearingDay() {
return bearingIconDay;
}
public int getResourceBearingNight() {
return bearingIconNight;
}
public int getResourceLocation() {
return locationIcon;
public int getResourceLocationDay() {
return locationIconDay;
}
public int getResourceLocationNight() {
return locationIconNight;
}
public String getStringKey() {
@ -292,8 +292,19 @@ public class ApplicationMode {
public boolean isDerivedRoutingFrom(ApplicationMode mode) {
return this == mode || getParent() == mode;
}
private final int key;
private final String stringKey;
private ApplicationMode parent;
private int iconId = R.drawable.ic_browse_map;
private int smallIconDark = R.drawable.ic_world_globe_dark ;
private float defaultSpeed = 10f;
private int minDistanceForTurn = 50;
private int arrivalDistance = 90;
private int bearingIconDay = R.drawable.map_pedestrian_bearing;
private int bearingIconNight = R.drawable.map_pedestrian_bearing_night;
private int locationIconDay = R.drawable.map_pedestrian_location;
private int locationIconNight = R.drawable.map_pedestrian_location_night;
private static StateChangedListener<String> listener;
}

View file

@ -38,6 +38,6 @@ public class MyLocationMenuController extends MenuController {
@Override
public Drawable getLeftIcon() {
ApplicationMode appMode = getMapActivity().getMyApplication().getSettings().getApplicationMode();
return getMapActivity().getResources().getDrawable(appMode.getResourceLocation());
return getMapActivity().getResources().getDrawable(appMode.getResourceLocationDay());
}
}

View file

@ -1,14 +1,6 @@
package net.osmand.plus.views;
import net.osmand.Location;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.RotatedTileBox;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmAndLocationProvider;
import net.osmand.plus.R;
import net.osmand.plus.base.MapViewTrackingUtilities;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
@ -17,9 +9,23 @@ import android.graphics.Paint.Style;
import android.graphics.PointF;
import android.graphics.RectF;
import net.osmand.Location;
import net.osmand.PlatformUtil;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.RotatedTileBox;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmAndLocationProvider;
import net.osmand.plus.R;
import net.osmand.plus.base.MapViewTrackingUtilities;
import org.apache.commons.logging.Log;
import java.util.List;
public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider {
private static final Log LOG = PlatformUtil.getLog(PointLocationLayer.class);
protected final static int RADIUS = 7;
protected final static float HEADING_ANGLE = 60;
@ -35,7 +41,7 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
private Bitmap locationIcon;
private OsmAndLocationProvider locationProvider;
private MapViewTrackingUtilities mapViewTrackingUtilities;
private boolean nm;
private boolean nm = false;
public PointLocationLayer(MapViewTrackingUtilities mv) {
this.mapViewTrackingUtilities = mv;
@ -62,7 +68,7 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
headingPaint.setAntiAlias(true);
headingPaint.setStyle(Style.FILL);
checkAppMode(view.getSettings().getApplicationMode());
checkAppMode(view.getSettings().getApplicationMode(), false, false);
locationProvider = view.getApplication().getLocationProvider();
}
@ -86,11 +92,14 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
}
// draw
boolean nm = nightMode != null && nightMode.isNightMode();
boolean shouldForceUpdate = false;
if(nm != this.nm) {
this.nm = nm;
area.setColor(view.getResources().getColor(!nm?R.color.pos_area : R.color.pos_area_night));
headingPaint.setColor(view.getResources().getColor(!nm?R.color.pos_heading :R.color.pos_heading_night));
shouldForceUpdate = true;
}
checkAppMode(view.getSettings().getApplicationMode(), nm, shouldForceUpdate);
Location lastKnownLocation = locationProvider.getLastKnownLocation();
if(lastKnownLocation == null || view == null){
return;
@ -108,7 +117,6 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
}
// draw bearing/direction/location
if (isLocationVisible(box, lastKnownLocation)) {
checkAppMode(view.getSettings().getApplicationMode());
boolean isBearing = lastKnownLocation.hasBearing();
Float heading = locationProvider.getHeading();
@ -138,11 +146,19 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
public void destroyLayer() {
}
public void checkAppMode(ApplicationMode appMode) {
if (appMode != this.appMode) {
public void checkAppMode(ApplicationMode appMode, boolean nighMode, boolean force) {
if (appMode != this.appMode || force) {
this.appMode = appMode;
bearingIcon = BitmapFactory.decodeResource(view.getResources(), appMode.getResourceBearing());
locationIcon = BitmapFactory.decodeResource(view.getResources(), appMode.getResourceLocation());
final int resourceBearingDay = appMode.getResourceBearingDay();
final int resourceBearingNight = appMode.getResourceBearingNight();
final int resourceBearing = nighMode ? resourceBearingNight : resourceBearingDay;
bearingIcon = BitmapFactory.decodeResource(view.getResources(), resourceBearing);
final int resourceLocationDay = appMode.getResourceLocationDay();
final int resourceLocationNight = appMode.getResourceLocationNight();
final int resourceLocation = nighMode ? resourceLocationNight : resourceLocationDay;
locationIcon = BitmapFactory.decodeResource(view.getResources(), resourceLocation);
}
}