Add check for import error
This commit is contained in:
parent
62848ac1d6
commit
63f933a9a3
1 changed files with 5 additions and 18 deletions
|
@ -20,11 +20,9 @@ import android.support.v7.app.AppCompatActivity;
|
|||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.GPXUtilities.GPXTrackAnalysis;
|
||||
import net.osmand.GPXUtilities.WptPt;
|
||||
import net.osmand.IProgress;
|
||||
import net.osmand.IndexConstants;
|
||||
|
@ -40,7 +38,6 @@ import net.osmand.plus.OsmandApplication;
|
|||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.TrackActivity;
|
||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
||||
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
||||
|
@ -668,13 +665,12 @@ public class ImportHelper {
|
|||
|
||||
@Override
|
||||
protected void onPostExecute(final String warning) {
|
||||
final String msg = warning == null ? MessageFormat.format(app.getString(R.string.gpx_saved_sucessfully), result.path) : warning;
|
||||
//Toast.makeText(activity, msg, Toast.LENGTH_LONG).show();
|
||||
|
||||
//showGpxOnMap(result);
|
||||
showGpxDetailsActivity(result);
|
||||
if(Algorithms.isEmpty(warning)) {
|
||||
showGpxOnMap(result);
|
||||
} else {
|
||||
Toast.makeText(activity, warning, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private MapActivity getMapActivity() {
|
||||
|
@ -699,15 +695,6 @@ public class ImportHelper {
|
|||
}
|
||||
}
|
||||
|
||||
private void showGpxDetailsActivity(final GPXFile gpxFile) {
|
||||
if (gpxFile.path != null) {
|
||||
Intent newIntent = new Intent(activity, app.getAppCustomization().getTrackActivity());
|
||||
newIntent.putExtra(TrackActivity.TRACK_FILE_NAME, gpxFile.path);
|
||||
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
activity.startActivity(newIntent);
|
||||
}
|
||||
}
|
||||
|
||||
private void importFavourites(final GPXFile gpxFile, final String fileName, final boolean save,
|
||||
final boolean useImportDir, final boolean forceImportFavourites) {
|
||||
if (gpxFile == null || gpxFile.isPointsEmpty()) {
|
||||
|
|
Loading…
Reference in a new issue