Keep name of imported file when saving gpx track
This commit is contained in:
parent
7552c91b01
commit
69750b7912
2 changed files with 12 additions and 4 deletions
|
@ -297,7 +297,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
mapActivity.showDialog(DIALOG_SAVE_DIRECTIONS);
|
mapActivity.showDialog(DIALOG_SAVE_DIRECTIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Dialog createSaveDirections(Activity activity) {
|
public static Dialog createSaveDirections(Activity activity, RoutingHelper routingHelper) {
|
||||||
final OsmandApplication app = ((OsmandApplication) activity.getApplication());
|
final OsmandApplication app = ((OsmandApplication) activity.getApplication());
|
||||||
final File fileDir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
|
final File fileDir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
|
||||||
final Dialog dlg = new Dialog(activity);
|
final Dialog dlg = new Dialog(activity);
|
||||||
|
@ -305,7 +305,15 @@ public class MapActivityActions implements DialogProvider {
|
||||||
dlg.setContentView(R.layout.save_directions_dialog);
|
dlg.setContentView(R.layout.save_directions_dialog);
|
||||||
final EditText edit = (EditText) dlg.findViewById(R.id.FileNameEdit);
|
final EditText edit = (EditText) dlg.findViewById(R.id.FileNameEdit);
|
||||||
|
|
||||||
edit.setText("_" + MessageFormat.format("{0,date,yyyy-MM-dd}", new Date()) + "_");
|
final GPXRouteParamsBuilder rp = routingHelper.getCurrentGPXRoute();
|
||||||
|
final String editText;
|
||||||
|
if (rp == null || rp.getFile() == null || rp.getFile().path == null) {
|
||||||
|
editText = "_" + MessageFormat.format("{0,date,yyyy-MM-dd}", new Date()) + "_";
|
||||||
|
} else {
|
||||||
|
editText = new File(rp.getFile().path).getName();
|
||||||
|
}
|
||||||
|
edit.setText(editText);
|
||||||
|
|
||||||
((Button) dlg.findViewById(R.id.Save)).setOnClickListener(new View.OnClickListener() {
|
((Button) dlg.findViewById(R.id.Save)).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -582,7 +590,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
case DIALOG_RELOAD_TITLE:
|
case DIALOG_RELOAD_TITLE:
|
||||||
return createReloadTitleDialog(args);
|
return createReloadTitleDialog(args);
|
||||||
case DIALOG_SAVE_DIRECTIONS:
|
case DIALOG_SAVE_DIRECTIONS:
|
||||||
return createSaveDirections(mapActivity);
|
return createSaveDirections(mapActivity, mapActivity.getRoutingHelper());
|
||||||
}
|
}
|
||||||
return OsmAndDialogs.createDialog(id, mapActivity, args);
|
return OsmAndDialogs.createDialog(id, mapActivity, args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class ShowRouteInfoActivity extends OsmandListActivity {
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() == SAVE) {
|
if (item.getItemId() == SAVE) {
|
||||||
MapActivityActions.createSaveDirections(ShowRouteInfoActivity.this).show();
|
MapActivityActions.createSaveDirections(ShowRouteInfoActivity.this, helper).show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
|
Loading…
Reference in a new issue