Revert "show sqlite extension"

This reverts commit 40407988
This commit is contained in:
veliymolfar 2020-06-12 17:15:46 +03:00
parent 73d7c93f67
commit 30674159e1

View file

@ -235,6 +235,7 @@ public class EditMapSourceDialogFragment extends BaseOsmAndDialogFragment
if (!editedLayerName.endsWith(IndexConstants.SQLITE_EXT)) {
File f = app.getAppPath(IndexConstants.TILES_INDEX_DIR + editedLayerName);
template = TileSourceManager.createTileSourceTemplate(f);
sqliteDB = false;
} else {
List<TileSourceTemplate> knownTemplates = TileSourceManager.getKnownSourceTemplates();
File tPath = app.getAppPath(IndexConstants.TILES_INDEX_DIR);
@ -247,9 +248,11 @@ public class EditMapSourceDialogFragment extends BaseOsmAndDialogFragment
sqLiteTileSource.getBitDensity(), AVG_SIZE);
template.setExpirationTimeMinutes(sqLiteTileSource.getExpirationTimeMinutes());
template.setEllipticYTile(sqLiteTileSource.isEllipticYTile());
sqliteDB = true;
}
}
if (savedInstanceState == null) {
editedLayerName = template.getName();
urlToLoad = template.getUrlTemplate();
expireTimeMinutes = template.getExpirationTimeMinutes();
minZoom = template.getMinimumZoomSupported();
@ -272,13 +275,6 @@ public class EditMapSourceDialogFragment extends BaseOsmAndDialogFragment
super.onSaveInstanceState(outState);
}
@Override
public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
super.onViewStateRestored(savedInstanceState);
sqliteDB = nameEditText.getText().toString().contains(IndexConstants.SQLITE_EXT);
updateDescription(ConfigurationItem.STORAGE_FORMAT);
}
@Override
public void onResume() {
super.onResume();
@ -335,13 +331,6 @@ public class EditMapSourceDialogFragment extends BaseOsmAndDialogFragment
public void onStorageFormatSelected(boolean sqliteDb) {
if (isAdded()) {
this.sqliteDB = sqliteDb;
String name = nameEditText.getText().toString();
if (sqliteDb && !name.contains(IndexConstants.SQLITE_EXT)) {
name += IndexConstants.SQLITE_EXT;
nameEditText.setText(name);
} else if (!sqliteDb) {
nameEditText.setText(name.replace(IndexConstants.SQLITE_EXT, ""));
}
updateDescription(ConfigurationItem.STORAGE_FORMAT);
wasChanged = true;
}
@ -363,7 +352,7 @@ public class EditMapSourceDialogFragment extends BaseOsmAndDialogFragment
private void saveTemplate() {
try {
String newName = nameEditText.getText().toString().replace(IndexConstants.SQLITE_EXT, "");
String newName = nameEditText.getText().toString();
String urlToLoad = urlEditText.getText().toString();
template.setName(newName);
template.setUrlToLoad(urlToLoad.isEmpty() ? null : urlToLoad.replace("{$x}", "{1}").replace("{$y}", "{2}").replace("{$z}", "{0}"));
@ -418,7 +407,7 @@ public class EditMapSourceDialogFragment extends BaseOsmAndDialogFragment
}
private void updateUi() {
nameEditText.setText(editedLayerName);
nameEditText.setText(editedLayerName != null ? editedLayerName.replace(IndexConstants.SQLITE_EXT, "") : "");
urlEditText.setText(urlToLoad);
nameEditText.addTextChangedListener(new MapSourceTextWatcher(nameInputLayout));
urlEditText.addTextChangedListener(new MapSourceTextWatcher(urlInputLayout));