use of net.osmand.plus.track.TrackDrawInfo in project Osmand by osmandapp.
the class TrackAppearanceFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
app = requireMyApplication();
settings = app.getSettings();
gpxDbHelper = app.getGpxDbHelper();
if (savedInstanceState != null) {
trackDrawInfo = new TrackDrawInfo(savedInstanceState);
if (selectedGpxFile == null) {
restoreSelectedGpxFile(trackDrawInfo.getFilePath(), trackDrawInfo.isCurrentRecording());
}
if (!trackDrawInfo.isCurrentRecording()) {
gpxDataItem = gpxDbHelper.getItem(new File(trackDrawInfo.getFilePath()));
}
showStartFinishIconsInitialValue = savedInstanceState.getBoolean(SHOW_START_FINISH_ICONS_INITIAL_VALUE_KEY, settings.SHOW_START_FINISH_ICONS.get());
} else {
showStartFinishIconsInitialValue = settings.SHOW_START_FINISH_ICONS.get();
if (selectedGpxFile.isShowCurrentTrack()) {
trackDrawInfo = new TrackDrawInfo(app, true);
} else {
GpxDataItemCallback callback = new GpxDataItemCallback() {
@Override
public boolean isCancelled() {
return false;
}
@Override
public void onGpxDataItemReady(GpxDataItem item) {
if (item != null) {
gpxDataItem = item;
trackDrawInfo.updateParams(item);
}
if (view != null) {
initContent();
}
}
};
String filePath = selectedGpxFile.getGpxFile().path;
gpxDataItem = gpxDbHelper.getItem(new File(filePath), callback);
trackDrawInfo = new TrackDrawInfo(filePath, gpxDataItem, false);
}
}
requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
public void handleOnBackPressed() {
dismiss();
}
});
}
Aggregations