use of net.osmand.plus.OsmandSettings in project Osmand by osmandapp.
the class MapActivityLayers method showGPXFileLayer.
public AlertDialog showGPXFileLayer(List<String> files, final OsmandMapTileView mapView) {
final OsmandSettings settings = getApplication().getSettings();
CallbackWithObject<GPXFile[]> callbackWithObject = new CallbackWithObject<GPXFile[]>() {
@Override
public boolean processResult(GPXFile[] result) {
WptPt locToShow = null;
for (GPXFile g : result) {
if (g.showCurrentTrack) {
if (!settings.SAVE_TRACK_TO_GPX.get() && !settings.SAVE_GLOBAL_TRACK_TO_GPX.get()) {
Toast.makeText(activity, R.string.gpx_monitoring_disabled_warn, Toast.LENGTH_LONG).show();
}
break;
} else {
locToShow = g.findPointToShow();
}
}
getApplication().getSelectedGpxHelper().setGpxFileToDisplay(result);
if (locToShow != null) {
mapView.getAnimatedDraggingThread().startMoving(locToShow.lat, locToShow.lon, mapView.getZoom(), true);
}
mapView.refreshMap();
activity.getDashboard().refreshContent(true);
return true;
}
};
return GpxUiHelper.selectGPXFiles(files, activity, callbackWithObject);
}
use of net.osmand.plus.OsmandSettings in project Osmand by osmandapp.
the class MapActivityLayers method updateMapSource.
public void updateMapSource(OsmandMapTileView mapView, CommonPreference<String> settingsToWarnAboutMap) {
OsmandSettings settings = getApplication().getSettings();
// update transparency
int mapTransparency = settings.MAP_UNDERLAY.get() == null ? 255 : settings.MAP_TRANSPARENCY.get();
mapTileLayer.setAlpha(mapTransparency);
mapVectorLayer.setAlpha(mapTransparency);
ITileSource newSource = settings.getMapTileSource(settings.MAP_TILE_SOURCES == settingsToWarnAboutMap);
ITileSource oldMap = mapTileLayer.getMap();
if (newSource != oldMap) {
if (oldMap instanceof SQLiteTileSource) {
((SQLiteTileSource) oldMap).closeDB();
}
mapTileLayer.setMap(newSource);
}
boolean vectorData = !settings.MAP_ONLINE_DATA.get();
mapTileLayer.setVisible(!vectorData);
mapVectorLayer.setVisible(vectorData);
if (vectorData) {
mapView.setMainLayer(mapVectorLayer);
} else {
mapView.setMainLayer(mapTileLayer);
}
}
use of net.osmand.plus.OsmandSettings in project Osmand by osmandapp.
the class MapActivityLayers method updateLayers.
public void updateLayers(OsmandMapTileView mapView) {
OsmandSettings settings = getApplication().getSettings();
updateMapSource(mapView, settings.MAP_TILE_SOURCES);
boolean showStops = settings.getCustomRenderBooleanProperty(OsmandSettings.TRANSPORT_STOPS_OVER_MAP).get();
transportStopsLayer.setShowTransportStops(showStops);
OsmandPlugin.refreshLayers(mapView, activity);
}
use of net.osmand.plus.OsmandSettings in project Osmand by osmandapp.
the class FavoritesListFragment method showOnMap.
public static void showOnMap(FavouritePoint point, Activity activity) {
OsmandApplication app = (OsmandApplication) activity.getApplication();
final OsmandSettings settings = app.getSettings();
LatLon location = new LatLon(point.getLatitude(), point.getLongitude());
settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(), settings.getLastKnownMapZoom(), new PointDescription(PointDescription.POINT_TYPE_FAVORITE, point.getName()), true, // $NON-NLS-1$
point);
MapActivity.launchMapActivityMoveToTop(activity);
}
use of net.osmand.plus.OsmandSettings in project Osmand by osmandapp.
the class SecondSplashScreenFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
OsmandApplication app = getMyApplication();
OsmandSettings settings = app.getSettings();
FragmentActivity activity = getActivity();
RelativeLayout view = new RelativeLayout(activity);
view.setOnClickListener(null);
view.setBackgroundColor(getResources().getColor(R.color.map_background_color_light));
ImageView logo = new ImageView(getContext());
if (Version.isFreeVersion(app)) {
logo.setImageDrawable(getResources().getDrawable(R.drawable.ic_logo_splash_osmand));
} else if (Version.isPaidVersion(app) || Version.isDeveloperVersion(app)) {
logo.setImageDrawable(getResources().getDrawable(R.drawable.ic_logo_splash_osmand_plus));
}
RelativeLayout.LayoutParams logoLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
logoLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
logoLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
ImageView text = new ImageView(activity);
if (Version.isFreeVersion(app)) {
if (settings.LIVE_UPDATES_PURCHASED.get()) {
text.setImageDrawable(getResources().getDrawable(R.drawable.image_text_osmand_osmlive));
} else if (settings.FULL_VERSION_PURCHASED.get()) {
text.setImageDrawable(getResources().getDrawable(R.drawable.image_text_osmand_inapp));
} else {
text.setImageDrawable(getResources().getDrawable(R.drawable.image_text_osmand));
}
} else if (Version.isPaidVersion(app) || Version.isDeveloperVersion(app)) {
if (settings.LIVE_UPDATES_PURCHASED.get()) {
text.setImageDrawable(getResources().getDrawable(R.drawable.image_text_osmand_plus_osmlive));
} else {
text.setImageDrawable(getResources().getDrawable(R.drawable.image_text_osmand_plus));
}
}
RelativeLayout.LayoutParams textLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
textLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
textLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
int defaultLogoMarginTop = (int) getResources().getDimension(R.dimen.splash_screen_logo_top);
int logoMarginTop = defaultLogoMarginTop - (Build.VERSION.SDK_INT >= 21 ? 0 : getStatusBarHeight());
int logoPaddingLeft = 0;
int logoPaddingRight = 0;
int defaultTextMarginBottom = (int) getResources().getDimension(R.dimen.splash_screen_text_bottom);
int textMarginBottom = defaultTextMarginBottom - getNavigationBarHeight();
int textPaddingLeft = 0;
int textPaddingRight = 0;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N_MR1) {
int screenOrientation = AndroidUiHelper.getScreenOrientation(activity);
if (screenOrientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
logoPaddingLeft = getNavigationBarWidth();
textPaddingLeft = getNavigationBarWidth();
} else if (screenOrientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE) {
logoPaddingRight = getNavigationBarWidth();
textPaddingRight = getNavigationBarWidth();
}
} else {
logoPaddingLeft = getNavigationBarWidth();
textPaddingLeft = getNavigationBarWidth();
}
logoLayoutParams.setMargins(0, logoMarginTop, 0, 0);
logo.setPadding(logoPaddingLeft, 0, logoPaddingRight, 0);
logo.setLayoutParams(logoLayoutParams);
view.addView(logo);
textLayoutParams.setMargins(0, 0, 0, textMarginBottom);
text.setPadding(textPaddingLeft, 0, textPaddingRight, 0);
text.setLayoutParams(textLayoutParams);
view.addView(text);
return view;
}
Aggregations