Fixed formatting

This commit is contained in:
GaidamakUA 2016-02-08 17:19:52 +02:00
parent 8e979c02b9
commit 64bc77eb1d
5 changed files with 189 additions and 184 deletions

View file

@ -196,6 +196,7 @@
android:layout_height="wrap_content">
<include layout="@layout/recording_note_fragment"/>
<LinearLayout
android:id="@+id/map_context_menu_layout"
android:layout_width="match_parent"

View file

@ -351,6 +351,7 @@ public class ContextMenuAdapter {
private OsmandApplication app;
private boolean holoLight;
private int layoutId;
public ContextMenuArrayAdapter(Activity context, int resource, int textViewResourceId,
String[] objects, OsmandApplication app, boolean holoLight) {
super(context, resource, textViewResourceId, objects);
@ -445,7 +446,7 @@ public class ContextMenuAdapter {
if (convertView.findViewById(R.id.seekbar) != null) {
SeekBar seekBar = (SeekBar) convertView.findViewById(R.id.seekbar);
if(progressList.get(position) != -1) {
if (progressList.get(position) != -1) {
seekBar.setProgress(getProgress(position));
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override

View file

@ -91,12 +91,12 @@ public class MapActivityLayers {
return mapWidgetRegistry;
}
public OsmandApplication getApplication(){
public OsmandApplication getApplication() {
return (OsmandApplication) activity.getApplication();
}
public void createLayers(final OsmandMapTileView mapView){
public void createLayers(final OsmandMapTileView mapView) {
OsmandApplication app = (OsmandApplication) getApplication();
RoutingHelper routingHelper = app.getRoutingHelper();
@ -171,12 +171,12 @@ public class MapActivityLayers {
}
public void updateLayers(OsmandMapTileView mapView){
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();
if(mapView.getLayers().contains(transportStopsLayer) != showStops){
if(showStops){
if (mapView.getLayers().contains(transportStopsLayer) != showStops) {
if (showStops) {
mapView.addLayer(transportStopsLayer, 5);
} else {
mapView.removeLayer(transportStopsLayer);
@ -185,7 +185,7 @@ public class MapActivityLayers {
OsmandPlugin.refreshLayers(mapView, activity);
}
public void updateMapSource(OsmandMapTileView mapView, CommonPreference<String> settingsToWarnAboutMap){
public void updateMapSource(OsmandMapTileView mapView, CommonPreference<String> settingsToWarnAboutMap) {
OsmandSettings settings = getApplication().getSettings();
// update transparency
@ -205,7 +205,7 @@ public class MapActivityLayers {
boolean vectorData = !settings.MAP_ONLINE_DATA.get();
mapTileLayer.setVisible(!vectorData);
mapVectorLayer.setVisible(vectorData);
if(vectorData){
if (vectorData) {
mapView.setMainLayer(mapVectorLayer);
} else {
mapView.setMainLayer(mapTileLayer);
@ -253,7 +253,7 @@ public class MapActivityLayers {
}
public AlertDialog selectPOIFilterLayer(final OsmandMapTileView mapView, final PoiUIFilter[] selected){
public AlertDialog selectPOIFilterLayer(final OsmandMapTileView mapView, final PoiUIFilter[] selected) {
OsmandApplication app = (OsmandApplication) getApplication();
final PoiFiltersHelper poiFilters = app.getPoiFilters();
final ContextMenuAdapter adapter = new ContextMenuAdapter(activity);
@ -266,12 +266,12 @@ public class MapActivityLayers {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
ListAdapter listAdapter = adapter.createListAdapter(activity, app.getSettings().isLightContent());
builder.setAdapter(listAdapter, new DialogInterface.OnClickListener(){
builder.setAdapter(listAdapter, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
PoiUIFilter pf = list.get(which);
String filterId = pf.getFilterId();
if(filterId.equals(PoiUIFilter.CUSTOM_FILTER_ID)){
if (filterId.equals(PoiUIFilter.CUSTOM_FILTER_ID)) {
Intent search = new Intent(activity, SearchActivity.class);
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
activity.getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.POI_TAB_INDEX);
@ -283,7 +283,7 @@ public class MapActivityLayers {
}
getApplication().getSettings().SELECTED_POI_FILTER_FOR_MAP.set(filterId);
mapView.refreshMap();
if(selected != null && selected.length > 0) {
if (selected != null && selected.length > 0) {
selected[0] = pf;
}
}
@ -305,8 +305,8 @@ public class MapActivityLayers {
it.reg();
}
public void selectMapLayer(final OsmandMapTileView mapView){
if(OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) == null) {
public void selectMapLayer(final OsmandMapTileView mapView) {
if (OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) == null) {
AccessibleToast.makeText(activity, R.string.map_online_plugin_is_not_installed, Toast.LENGTH_LONG).show();
return;
}
@ -355,7 +355,7 @@ public class MapActivityLayers {
items[i++] = entry.getValue();
}
builder.setSingleChoiceItems(items, selectedItem, new DialogInterface.OnClickListener(){
builder.setSingleChoiceItems(items, selectedItem, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String layerKey = entriesMapList.get(which).getKey();
@ -383,10 +383,11 @@ public class MapActivityLayers {
OsmandRasterMapsPlugin.installMapLayers(activity, new ResultMatcher<TileSourceTemplate>() {
TileSourceTemplate template = null;
int count = 0;
@Override
public boolean publish(TileSourceTemplate object) {
if(object == null){
if(count == 1){
if (object == null) {
if (count == 1) {
settings.MAP_TILE_SOURCES.set(template.getName());
settings.MAP_ONLINE_DATA.set(true);
updateMapSource(mapView, settings.MAP_TILE_SOURCES);
@ -394,7 +395,7 @@ public class MapActivityLayers {
selectMapLayer(mapView);
}
} else {
count ++;
count++;
template = object;
}
return false;

View file

@ -70,10 +70,12 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
public String getId() {
return ID;
}
@Override
public String getDescription() {
return app.getString(R.string.osmand_rastermaps_plugin_description);
}
@Override
public String getName() {
return app.getString(R.string.shared_string_online_maps);
@ -111,17 +113,17 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
public void updateMapLayers(OsmandMapTileView mapView, CommonPreference<String> settingsToWarnAboutMap,
final MapActivityLayers layers) {
if(overlayLayer == null) {
if (overlayLayer == null) {
createLayers();
}
overlayLayer.setAlpha(settings.MAP_OVERLAY_TRANSPARENCY.get());
if(isActive()) {
if (isActive()) {
updateLayer(mapView, settings, overlayLayer, settings.MAP_OVERLAY, 0.7f, settings.MAP_OVERLAY == settingsToWarnAboutMap);
} else {
mapView.removeLayer(overlayLayer);
overlayLayer.setMap(null);
}
if(isActive()) {
if (isActive()) {
updateLayer(mapView, settings, underlayLayer, settings.MAP_UNDERLAY, -0.5f, settings.MAP_UNDERLAY == settingsToWarnAboutMap);
} else {
mapView.removeLayer(underlayLayer);
@ -133,8 +135,8 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
public void updateLayer(OsmandMapTileView mapView, OsmandSettings settings,
MapTileLayer layer, CommonPreference<String> preference, float layerOrder, boolean warnWhenSelected) {
ITileSource overlay = settings.getTileSourceByName(preference.get(), warnWhenSelected);
if(!Algorithms.objectEquals(overlay, layer.getMap())){
if(overlay == null){
if (!Algorithms.objectEquals(overlay, layer.getMap())) {
if (overlay == null) {
mapView.removeLayer(layer);
} else if (mapView.getMapRenderer() == null) {
mapView.addLayer(layer, layerOrder);
@ -146,7 +148,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
public void selectMapOverlayLayer(final OsmandMapTileView mapView,
final CommonPreference<String> mapPref,
final MapActivity activity){
final MapActivity activity) {
final OsmandSettings settings = app.getSettings();
final MapActivityLayers layers = activity.getMapLayers();
Map<String, String> entriesMap = settings.getTileSourceEntries();
@ -154,7 +156,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
final String[] items = new String[entriesMap.size() + 1];
int i = 0;
for(String it : entriesMap.values()){
for (String it : entriesMap.values()) {
items[i++] = it;
}
@ -209,10 +211,10 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
if (itemId == R.string.layer_map) {
layers.selectMapLayer(mapView);
} else if(itemId == R.string.layer_overlay){
} else if (itemId == R.string.layer_overlay) {
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.OVERLAY_MAP);
return false;
} else if(itemId == R.string.layer_underlay){
} else if (itemId == R.string.layer_underlay) {
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.UNDERLAY_MAP);
return false;
}
@ -257,7 +259,6 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
}
public static void installMapLayers(final Activity activity, final ResultMatcher<TileSourceTemplate> result) {
final OsmandApplication app = (OsmandApplication) activity.getApplication();
final OsmandSettings settings = app.getSettings();
@ -271,6 +272,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
protected List<TileSourceTemplate> doInBackground(Void... params) {
return TileSourceManager.downloadTileSourceTemplates(Version.getVersionAsURLParam(app));
}
protected void onPostExecute(final java.util.List<TileSourceTemplate> downloaded) {
if (downloaded == null || downloaded.isEmpty()) {
AccessibleToast.makeText(activity, R.string.shared_string_io_error, Toast.LENGTH_SHORT).show();
@ -327,9 +329,9 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
final OsmandApplication app = (OsmandApplication) activity.getApplication();
final OsmandSettings settings = app.getSettings();
final Map<String, String> entriesMap = settings.getTileSourceEntries(false);
TileSourceTemplate ts = new TileSourceTemplate("NewMapnik","http://mapnik.osmand.net/{0}/{1}/{2}.png",
TileSourceTemplate ts = new TileSourceTemplate("NewMapnik", "http://mapnik.osmand.net/{0}/{1}/{2}.png",
"png", 17, 5, 256, 16, 32000);
final TileSourceTemplate[] result = new TileSourceTemplate[] { ts };
final TileSourceTemplate[] result = new TileSourceTemplate[]{ts};
AlertDialog.Builder bld = new AlertDialog.Builder(activity);
View view = activity.getLayoutInflater().inflate(R.layout.editing_tile_source, null);
final EditText name = (EditText) view.findViewById(R.id.Name);
@ -378,7 +380,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
TileSourceTemplate r = result[0];
try {
r.setName(name.getText().toString());
r.setExpirationTimeMinutes(expire.getText().length() == 0 ? - 1 :
r.setExpirationTimeMinutes(expire.getText().length() == 0 ? -1 :
Integer.parseInt(expire.getText().toString()));
r.setMinZoom(Integer.parseInt(minZoom.getText().toString()));
r.setMaxZoom(Integer.parseInt(maxZoom.getText().toString()));
@ -403,11 +405,11 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
private static void updateTileSourceEditView(TileSourceTemplate ts, EditText name, final EditText urlToLoad, final EditText minZoom,
final EditText maxZoom, EditText expire, final CheckBox elliptic) {
minZoom.setText(ts.getMinimumZoomSupported()+"");
maxZoom.setText(ts.getMaximumZoomSupported()+"");
minZoom.setText(ts.getMinimumZoomSupported() + "");
maxZoom.setText(ts.getMaximumZoomSupported() + "");
name.setText(ts.getName());
expire.setText(ts.getExpirationTimeMinutes() < 0 ? "" : ts.getExpirationTimeMinutes() + "");
urlToLoad.setText(ts.getUrlTemplate() == null? "" :
urlToLoad.setText(ts.getUrlTemplate() == null ? "" :
ts.getUrlTemplate().replace("{$x}", "{1}").replace("{$y}", "{2}").replace("{$z}", "{0}"));
elliptic.setChecked(ts.isEllipticYTile());
}