Skip to content

Commit

Permalink
Small code improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-kutz committed Sep 29, 2024
1 parent 4cdead7 commit f682f6a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
import net.osmand.plus.quickaction.QuickAction;
import net.osmand.plus.quickaction.QuickActionType;

abstract class BaseTripRecordingAction extends QuickAction {
abstract class BaseMonitoringAction extends QuickAction {

public BaseTripRecordingAction(QuickActionType actionType) {
public BaseMonitoringAction(QuickActionType actionType) {
super(actionType);
}

public BaseTripRecordingAction(QuickAction quickAction) {
public BaseMonitoringAction(QuickAction quickAction) {
super(quickAction);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import net.osmand.plus.quickaction.QuickAction;
import net.osmand.plus.quickaction.QuickActionType;

public class FinishTripRecordingAction extends BaseTripRecordingAction {
public class FinishTripRecordingAction extends BaseMonitoringAction {

public static final QuickActionType TYPE = new QuickActionType(FINISH_TRIP_RECORDING_ACTION,
"finish.trip.recording", FinishTripRecordingAction.class)
Expand All @@ -39,9 +39,9 @@ public void execute(@NonNull MapActivity mapActivity) {
OsmandMonitoringPlugin plugin = getPlugin();
if (plugin != null) {
OsmandApplication app = mapActivity.getMyApplication();
if (!plugin.isRecordingTrack()) {
if (!isRecordingTrack()) {
app.showToastMessage(R.string.start_trip_recording_first_m);
} else if (!plugin.hasDataToSave()) {
} else if (!hasDataToSave()) {
app.showToastMessage(R.string.track_does_not_contain_data_to_save);
} else {
plugin.finishRecording();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import net.osmand.plus.track.helpers.save.SaveGpxHelper;
import net.osmand.shared.gpx.GpxFile;

public class SaveRecordedTripAndContinueAction extends BaseTripRecordingAction {
public class SaveRecordedTripAndContinueAction extends BaseMonitoringAction {

public static final QuickActionType TYPE = new QuickActionType(SAVE_RECORDED_TRIP_AND_CONTINUE_ACTION,
"save.trip.and.continue", SaveRecordedTripAndContinueAction.class)
Expand All @@ -41,9 +41,9 @@ public void execute(@NonNull MapActivity mapActivity) {
OsmandMonitoringPlugin plugin = getPlugin();
if (plugin != null) {
OsmandApplication app = mapActivity.getMyApplication();
if (!plugin.isRecordingTrack()) {
if (!isRecordingTrack()) {
app.showToastMessage(R.string.start_trip_recording_first_m);
} else if (!plugin.hasDataToSave()) {
} else if (!hasDataToSave()) {
app.showToastMessage(R.string.track_does_not_contain_data_to_save);
} else {
GpxFile gpxFile = app.getSavingTrackHelper().getCurrentTrack().getGpxFile();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import net.osmand.plus.quickaction.QuickAction;
import net.osmand.plus.quickaction.QuickActionType;

public class StartNewTripSegmentAction extends BaseTripRecordingAction {
public class StartNewTripSegmentAction extends BaseMonitoringAction {

public static final QuickActionType TYPE = new QuickActionType(START_NEW_TRIP_SEGMENT_ACTION,
"start.new.trip.segment", StartNewTripSegmentAction.class)
Expand All @@ -39,7 +39,7 @@ public void execute(@NonNull MapActivity mapActivity) {
OsmandMonitoringPlugin plugin = getPlugin();
if (plugin != null) {
OsmandApplication app = mapActivity.getMyApplication();
if (plugin.isRecordingTrack()) {
if (isRecordingTrack()) {
app.getSavingTrackHelper().startNewSegment();
app.showToastMessage(R.string.new_segment_started_m);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import net.osmand.plus.quickaction.QuickAction;
import net.osmand.plus.quickaction.QuickActionType;

public class TripRecordingAction extends BaseTripRecordingAction {
public class TripRecordingAction extends BaseMonitoringAction {

public static final QuickActionType TYPE = new QuickActionType(TRIP_RECORDING_ACTION,
"trip.recording.startpause", TripRecordingAction.class)
Expand All @@ -39,7 +39,7 @@ public TripRecordingAction(QuickAction quickAction) {
public void execute(@NonNull MapActivity mapActivity) {
OsmandMonitoringPlugin plugin = getPlugin();
if (plugin != null) {
if (plugin.hasDataToSave()) {
if (hasDataToSave()) {
plugin.pauseOrResumeRecording();
} else {
plugin.askShowTripRecordingDialog(mapActivity);
Expand Down

0 comments on commit f682f6a

Please sign in to comment.