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));
pager.setAdapter(graphsAdapter);

View file

@ -102,32 +102,19 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid
public GPXItemPagerAdapter(@NonNull OsmandApplication app,
@Nullable GpxDisplayItem gpxItem,
@Nullable TrackDisplayHelper displayHelper,
@NonNull TrackDisplayHelper displayHelper,
boolean nightMode,
@NonNull SegmentActionsListener actionsListener,
boolean onlyGraphs) {
super();
this.app = app;
this.gpxItem = gpxItem;
this.displayHelper = displayHelper;
this.nightMode = nightMode;
this.actionsListener = actionsListener;
this.onlyGraphs = onlyGraphs;
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();
fetchTabTypes();
}