small fixes

This commit is contained in:
Skalii 2021-03-29 22:11:37 +03:00
parent 07280935c0
commit 82fa75db1d
2 changed files with 10 additions and 16 deletions

View file

@ -329,7 +329,14 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment impl
} }
}); });
graphsAdapter = new GPXItemPagerAdapter(app, null, null, nightMode, this, true); TrackDisplayHelper displayHelper = new TrackDisplayHelper(app);
GPXFile gpxFile = getGPXFile();
File file = new File(gpxFile.path);
displayHelper.setFile(file);
displayHelper.setGpxDataItem(app.getGpxDbHelper().getItem(file));
displayHelper.setGpx(gpxFile);
graphsAdapter = new GPXItemPagerAdapter(app, null, displayHelper, nightMode, this, true);
graphsAdapter.setChartHMargin(getResources().getDimensionPixelSize(R.dimen.content_padding)); graphsAdapter.setChartHMargin(getResources().getDimensionPixelSize(R.dimen.content_padding));
pager.setAdapter(graphsAdapter); pager.setAdapter(graphsAdapter);

View file

@ -102,32 +102,19 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid
public GPXItemPagerAdapter(@NonNull OsmandApplication app, public GPXItemPagerAdapter(@NonNull OsmandApplication app,
@Nullable GpxDisplayItem gpxItem, @Nullable GpxDisplayItem gpxItem,
@Nullable TrackDisplayHelper displayHelper, @NonNull TrackDisplayHelper displayHelper,
boolean nightMode, boolean nightMode,
@NonNull SegmentActionsListener actionsListener, @NonNull SegmentActionsListener actionsListener,
boolean onlyGraphs) { boolean onlyGraphs) {
super(); super();
this.app = app; this.app = app;
this.gpxItem = gpxItem; this.gpxItem = gpxItem;
this.displayHelper = displayHelper;
this.nightMode = nightMode; this.nightMode = nightMode;
this.actionsListener = actionsListener; this.actionsListener = actionsListener;
this.onlyGraphs = onlyGraphs; this.onlyGraphs = onlyGraphs;
iconsCache = app.getUIUtilities(); iconsCache = app.getUIUtilities();
if (displayHelper == null) {
this.displayHelper = new TrackDisplayHelper(app);
SelectedGpxFile currentTrack = app.getSavingTrackHelper().getCurrentTrack();
GPXFile gpxFile = currentTrack.getGpxFile();
if (currentTrack.isShowCurrentTrack()) {
File file = new File(gpxFile.path);
this.displayHelper.setFile(file);
this.displayHelper.setGpxDataItem(app.getGpxDbHelper().getItem(file));
}
this.displayHelper.setGpx(gpxFile);
} else {
this.displayHelper = displayHelper;
}
updateAnalysis(); updateAnalysis();
fetchTabTypes(); fetchTabTypes();
} }