Fix select name

This commit is contained in:
Dima-1 2020-02-03 12:50:15 +02:00
parent e2a4153871
commit f9fe1889ce
4 changed files with 10 additions and 7 deletions

View file

@ -528,7 +528,7 @@ public class MapActivityLayers {
return false;
}
});
}, null);
break;
case layerInstallMore:
OsmandRasterMapsPlugin.installMapLayers(activity, new ResultMatcher<TileSourceTemplate>() {

View file

@ -42,7 +42,6 @@ import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
import net.osmand.plus.resources.IncrementalChangesManager;
import net.osmand.util.Algorithms;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.graphics.Typeface;
@ -253,7 +252,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
getDownloadActivity().reloadLocalIndexes();
return true;
}
});
}, info.getName());
} else if (resId == R.string.local_index_mi_restore) {
new LocalIndexOperationTask(getDownloadActivity(), listAdapter, LocalIndexOperationTask.RESTORE_OPERATION).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, info);
} else if (resId == R.string.shared_string_delete) {

View file

@ -42,7 +42,6 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.MapActivityLayers;
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.dialogs.RasterMapMenu;
import net.osmand.plus.settings.BaseSettingsFragment;
import net.osmand.plus.views.MapTileLayer;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.util.Algorithms;
@ -478,7 +477,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
t.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
public static void defineNewEditLayer(final Activity activity, final ResultMatcher<TileSourceTemplate> resultMatcher) {
public static void defineNewEditLayer(final Activity activity, final ResultMatcher<TileSourceTemplate> resultMatcher, String editedLayerName) {
final OsmandApplication app = (OsmandApplication) activity.getApplication();
final OsmandSettings settings = app.getSettings();
final Map<String, String> entriesMap = settings.getTileSourceEntries(false);
@ -511,7 +510,12 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
existing.setAdapter(adapter);
existing.setSelection(0);
int position = 0;
if (editedLayerName != null) {
position = adapter.getPosition(editedLayerName);
existing.setEnabled(false);
}
existing.setSelection(position);
existing.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override

View file

@ -194,7 +194,7 @@ public class SettingsRasterMapsActivity extends SettingsBaseActivity {
updateTileSourceSummary();
return true;
}
});
}, null);
} else if(preference == tileSourcePreference){
settings.MAP_TILE_SOURCES.set((String) newValue);
updateTileSourceSummary();