some fixes;

This commit is contained in:
Skalii 2021-03-22 22:35:34 +02:00
parent 28d6dd0e4a
commit 3bc071c986
14 changed files with 89 additions and 99 deletions

View file

@ -11,9 +11,9 @@
Thx - Hardy
-->
<string name="trip_recording_show_start_dialog_setting">If disabled, recording will start right after tap on the widget or menu item, skipping the confirmation dialog.</string>
<string name="show_start_dialog">Show start dialog</string>
<string name="lost_data_warning">All unsaved data will be lost.</string>
<string name="trip_recording_show_start_dialog_setting">If disabled, recording will start right after tap on the widget or menu item, skipping the confirmation dialog.</string>
<string name="show_start_dialog">Show start dialog</string>
<string name="lost_data_warning">All unsaved data will be lost.</string>
<string name="trip_recording_save_and_continue">Save and continue</string>
<string name="trip_recording_logging_interval_info">Logging interval set time period in which OsmAnd will ask for the current location position data.</string>
<string name="select_another_colorization">Please select another type of colorization.</string>

View file

@ -104,7 +104,7 @@ import net.osmand.plus.measurementtool.LoginBottomSheetFragment;
import net.osmand.plus.measurementtool.MeasurementEditingContext;
import net.osmand.plus.measurementtool.MeasurementToolFragment;
import net.osmand.plus.measurementtool.SnapTrackWarningFragment;
import net.osmand.plus.monitoring.TripRecordingStartingBottomSheetFragment;
import net.osmand.plus.monitoring.TripRecordingStartingBottomSheet;
import net.osmand.plus.render.RendererRegistry;
import net.osmand.plus.resources.ResourceManager;
import net.osmand.plus.routepreparationmenu.ChooseRouteFragment;
@ -2241,8 +2241,8 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
return getFragment(MeasurementToolFragment.TAG);
}
public TripRecordingStartingBottomSheetFragment getTripRecordingBottomSheet() {
return getFragment(TripRecordingStartingBottomSheetFragment.TAG);
public TripRecordingStartingBottomSheet getTripRecordingBottomSheet() {
return getFragment(TripRecordingStartingBottomSheet.TAG);
}
public ChooseRouteFragment getChooseRouteFragment() {

View file

@ -62,8 +62,8 @@ import net.osmand.plus.mapmarkers.MarkersPlanRouteContext;
import net.osmand.plus.measurementtool.MeasurementToolFragment;
import net.osmand.plus.measurementtool.StartPlanRouteBottomSheet;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.monitoring.TripRecordingBottomSheetFragment;
import net.osmand.plus.monitoring.TripRecordingStartingBottomSheetFragment;
import net.osmand.plus.monitoring.TripRecordingBottomSheet;
import net.osmand.plus.monitoring.TripRecordingStartingBottomSheet;
import net.osmand.plus.osmedit.dialogs.DismissRouteBottomSheetFragment;
import net.osmand.plus.profiles.ProfileDataObject;
import net.osmand.plus.profiles.ProfileDataUtils;
@ -854,9 +854,9 @@ public class MapActivityActions implements DialogProvider {
app.logEvent("trip_recording_open");
MapActivity.clearPrevActivityIntent();
if (monitoringPlugin.hasDataToSave() || monitoringPlugin.wasTrackMonitored()) {
TripRecordingBottomSheetFragment.showInstance(mapActivity.getSupportFragmentManager(), monitoringPlugin.getCurrentTrack());
TripRecordingBottomSheet.showInstance(mapActivity.getSupportFragmentManager());
} else {
TripRecordingStartingBottomSheetFragment.showInstance(mapActivity.getSupportFragmentManager(), app, monitoringPlugin.getCurrentTrack());
TripRecordingStartingBottomSheet.showTripRecordingDialog(mapActivity.getSupportFragmentManager(), app);
}
return true;
}

View file

@ -85,9 +85,9 @@ import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFreq
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.runLiveUpdate;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.setAlarmForPendingIntent;
import static net.osmand.plus.liveupdates.LiveUpdatesSettingsDialogFragmentNew.getTertiaryTextColorId;
import static net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.getActiveTextColorId;
import static net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.getOsmandIconColorId;
import static net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.getSecondaryIconColorId;
import static net.osmand.plus.monitoring.TripRecordingBottomSheet.getActiveTextColorId;
import static net.osmand.plus.monitoring.TripRecordingBottomSheet.getOsmandIconColorId;
import static net.osmand.plus.monitoring.TripRecordingBottomSheet.getSecondaryIconColorId;
public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements OnLiveUpdatesForLocalChange {

View file

@ -300,8 +300,8 @@ public class MonitoringSettingsFragment extends BaseSettingsFragment
FragmentActivity activity = getActivity();
if (activity != null && !activity.isChangingConfigurations()) {
Fragment target = getTargetFragment();
if (target instanceof TripRecordingStartingBottomSheetFragment) {
((TripRecordingStartingBottomSheetFragment) target).show();
if (target instanceof TripRecordingStartingBottomSheet) {
((TripRecordingStartingBottomSheet) target).show();
}
}
super.onDestroy();

View file

@ -337,9 +337,9 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
public void controlDialog(final Activity activity, final boolean showTrackSelection) {
FragmentManager fragmentManager = ((FragmentActivity) activity).getSupportFragmentManager();
if (hasDataToSave() || wasTrackMonitored()) {
TripRecordingBottomSheetFragment.showInstance(fragmentManager, getCurrentTrack());
TripRecordingBottomSheet.showInstance(fragmentManager);
} else {
TripRecordingStartingBottomSheetFragment.showInstance(fragmentManager, app, getCurrentTrack());
TripRecordingStartingBottomSheet.showTripRecordingDialog(fragmentManager, app);
}
/*final boolean wasTrackMonitored = settings.SAVE_GLOBAL_TRACK_TO_GPX.get();
@ -507,7 +507,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
final Activity a = activityRef.get();
if (a instanceof FragmentActivity && !a.isFinishing()) {
List<String> singleName = Collections.singletonList(Algorithms.getFileNameWithoutExtension(file));
SaveGPXBottomSheetFragment.showInstance(((FragmentActivity) a)
SaveGPXBottomSheet.showInstance(((FragmentActivity) a)
.getSupportFragmentManager(), singleName);
}
}
@ -558,7 +558,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
runnable.run();
} else if (map instanceof FragmentActivity) {
FragmentActivity activity = (FragmentActivity) map;
TripRecordingStartingBottomSheetFragment.showInstance(activity.getSupportFragmentManager(), app, getCurrentTrack());
TripRecordingStartingBottomSheet.showTripRecordingDialog(activity.getSupportFragmentManager(), app);
}
}

View file

@ -42,10 +42,10 @@ import java.util.List;
import static net.osmand.FileUtils.ILLEGAL_FILE_NAME_CHARACTERS;
public class SaveGPXBottomSheetFragment extends MenuBottomSheetDialogFragment {
public class SaveGPXBottomSheet extends MenuBottomSheetDialogFragment {
public static final String TAG = "SaveGPXBottomSheetFragment";
public static final String SAVED_TRACKS_KEY = "saved_track_filename";
private static final Log LOG = PlatformUtil.getLog(SaveGPXBottomSheetFragment.class);
private static final Log LOG = PlatformUtil.getLog(SaveGPXBottomSheet.class);
private boolean openTrack = false;
private File file;
@ -227,7 +227,7 @@ public class SaveGPXBottomSheetFragment extends MenuBottomSheetDialogFragment {
if (fragmentManager.isStateSaved()) {
return;
}
SaveGPXBottomSheetFragment f = new SaveGPXBottomSheetFragment();
SaveGPXBottomSheet f = new SaveGPXBottomSheet();
Bundle b = new Bundle();
b.putStringArrayList(SAVED_TRACKS_KEY, new ArrayList<>(filenames));
f.setArguments(b);

View file

@ -73,10 +73,10 @@ import static net.osmand.plus.track.GpxBlockStatisticsBuilder.INIT_BLOCKS_ALTITU
import static net.osmand.plus.track.GpxBlockStatisticsBuilder.INIT_BLOCKS_GENERAL;
import static net.osmand.plus.track.GpxBlockStatisticsBuilder.INIT_BLOCKS_SPEED;
public class TripRecordingBottomSheetFragment extends MenuBottomSheetDialogFragment implements SegmentActionsListener {
public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment implements SegmentActionsListener {
public static final String TAG = TripRecordingBottomSheetFragment.class.getSimpleName();
private static final Log LOG = PlatformUtil.getLog(TripRecordingBottomSheetFragment.class);
public static final String TAG = TripRecordingBottomSheet.class.getSimpleName();
private static final Log LOG = PlatformUtil.getLog(TripRecordingBottomSheet.class);
public static final String UPDATE_TRACK_ICON = "update_track_icon";
private static final int GPS_UPDATE_INTERVAL = 1000;
private static final String[] INIT_BLOCKS_KEYS =
@ -104,10 +104,6 @@ public class TripRecordingBottomSheetFragment extends MenuBottomSheetDialogFragm
return selectedGpxFile.getGpxFile();
}
public void setSelectedGpxFile(SelectedGpxFile selectedGpxFile) {
this.selectedGpxFile = selectedGpxFile;
}
private boolean hasDataToSave() {
return helper.hasDataToSave();
}
@ -120,10 +116,9 @@ public class TripRecordingBottomSheetFragment extends MenuBottomSheetDialogFragm
return settings.SAVE_GLOBAL_TRACK_TO_GPX.get();
}
public static void showInstance(@NonNull FragmentManager fragmentManager, SelectedGpxFile selectedGpxFile) {
public static void showInstance(@NonNull FragmentManager fragmentManager) {
if (!fragmentManager.isStateSaved()) {
TripRecordingBottomSheetFragment fragment = new TripRecordingBottomSheetFragment();
fragment.setSelectedGpxFile(selectedGpxFile);
TripRecordingBottomSheet fragment = new TripRecordingBottomSheet();
fragment.show(fragmentManager, TAG);
}
}
@ -149,7 +144,7 @@ public class TripRecordingBottomSheetFragment extends MenuBottomSheetDialogFragm
LinearLayout showTrackContainer = itemView.findViewById(R.id.show_track_on_map);
trackAppearanceIcon = showTrackContainer.findViewById(R.id.additional_button_icon);
createShowTrackItem(showTrackContainer, trackAppearanceIcon, ItemType.SHOW_TRACK.getTitleId(),
TripRecordingBottomSheetFragment.this, nightMode, new Runnable() {
TripRecordingBottomSheet.this, nightMode, new Runnable() {
@Override
public void run() {
hide();
@ -213,7 +208,7 @@ public class TripRecordingBottomSheetFragment extends MenuBottomSheetDialogFragm
@Override
public void onClick(View v) {
if (fragmentManager != null) {
TripRecordingOptionsBottomSheetFragment.showInstance(fragmentManager, TripRecordingBottomSheetFragment.this);
TripRecordingOptionsBottomSheet.showInstance(fragmentManager, TripRecordingBottomSheet.this);
}
}
});

View file

@ -11,7 +11,7 @@ import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem;
import net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.ItemType;
import net.osmand.plus.monitoring.TripRecordingBottomSheet.ItemType;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
@ -19,15 +19,15 @@ import androidx.fragment.app.FragmentManager;
import static net.osmand.AndroidUtils.getPrimaryTextColorId;
public class TripRecordingClearDataBottomSheetFragment extends MenuBottomSheetDialogFragment implements TripRecordingBottomSheetFragment.DismissTargetFragment {
public class TripRecordingClearDataBottomSheet extends MenuBottomSheetDialogFragment implements TripRecordingBottomSheet.DismissTargetFragment {
public static final String TAG = TripRecordingClearDataBottomSheetFragment.class.getSimpleName();
public static final String TAG = TripRecordingClearDataBottomSheet.class.getSimpleName();
private OsmandApplication app;
public static void showInstance(@NonNull FragmentManager fragmentManager, @NonNull Fragment target) {
if (!fragmentManager.isStateSaved()) {
TripRecordingClearDataBottomSheetFragment fragment = new TripRecordingClearDataBottomSheetFragment();
TripRecordingClearDataBottomSheet fragment = new TripRecordingClearDataBottomSheet();
fragment.setTargetFragment(target, 0);
fragment.show(fragmentManager, TAG);
}
@ -81,15 +81,15 @@ public class TripRecordingClearDataBottomSheetFragment extends MenuBottomSheetDi
}
private View createItem(LayoutInflater inflater, ItemType type) {
return TripRecordingBottomSheetFragment.createItem(app, nightMode, inflater, type);
return TripRecordingBottomSheet.createItem(app, nightMode, inflater, type);
}
@Override
public void onResume() {
super.onResume();
Fragment target = getTargetFragment();
if (target instanceof TripRecordingOptionsBottomSheetFragment) {
((TripRecordingOptionsBottomSheetFragment) target).hide();
if (target instanceof TripRecordingOptionsBottomSheet) {
((TripRecordingOptionsBottomSheet) target).hide();
}
}
@ -97,8 +97,8 @@ public class TripRecordingClearDataBottomSheetFragment extends MenuBottomSheetDi
public void onPause() {
super.onPause();
Fragment target = getTargetFragment();
if (target instanceof TripRecordingOptionsBottomSheetFragment) {
((TripRecordingOptionsBottomSheetFragment) target).show();
if (target instanceof TripRecordingOptionsBottomSheet) {
((TripRecordingOptionsBottomSheet) target).show();
}
}
@ -110,8 +110,8 @@ public class TripRecordingClearDataBottomSheetFragment extends MenuBottomSheetDi
@Override
public void dismissTarget() {
Fragment target = getTargetFragment();
if (target instanceof TripRecordingOptionsBottomSheetFragment) {
((TripRecordingOptionsBottomSheetFragment) target).dismiss();
if (target instanceof TripRecordingOptionsBottomSheet) {
((TripRecordingOptionsBottomSheet) target).dismiss();
}
}
}

View file

@ -12,24 +12,24 @@ import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem;
import net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.ItemType;
import net.osmand.plus.monitoring.TripRecordingBottomSheet.ItemType;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import static net.osmand.AndroidUtils.getPrimaryTextColorId;
import static net.osmand.plus.monitoring.TripRecordingOptionsBottomSheetFragment.ACTION_STOP_AND_DISMISS;
import static net.osmand.plus.monitoring.TripRecordingOptionsBottomSheet.ACTION_STOP_AND_DISMISS;
public class TripRecordingDiscardBottomSheetFragment extends MenuBottomSheetDialogFragment implements TripRecordingBottomSheetFragment.DismissTargetFragment {
public class TripRecordingDiscardBottomSheet extends MenuBottomSheetDialogFragment implements TripRecordingBottomSheet.DismissTargetFragment {
public static final String TAG = TripRecordingDiscardBottomSheetFragment.class.getSimpleName();
public static final String TAG = TripRecordingDiscardBottomSheet.class.getSimpleName();
private OsmandApplication app;
public static void showInstance(@NonNull FragmentManager fragmentManager, @NonNull Fragment target) {
if (!fragmentManager.isStateSaved()) {
TripRecordingDiscardBottomSheetFragment fragment = new TripRecordingDiscardBottomSheetFragment();
TripRecordingDiscardBottomSheet fragment = new TripRecordingDiscardBottomSheet();
fragment.setTargetFragment(target, 0);
fragment.show(fragmentManager, TAG);
}
@ -93,15 +93,15 @@ public class TripRecordingDiscardBottomSheetFragment extends MenuBottomSheetDial
}
private View createItem(LayoutInflater inflater, ItemType type) {
return TripRecordingBottomSheetFragment.createItem(app, nightMode, inflater, type);
return TripRecordingBottomSheet.createItem(app, nightMode, inflater, type);
}
@Override
public void onResume() {
super.onResume();
Fragment target = getTargetFragment();
if (target instanceof TripRecordingOptionsBottomSheetFragment) {
((TripRecordingOptionsBottomSheetFragment) target).hide();
if (target instanceof TripRecordingOptionsBottomSheet) {
((TripRecordingOptionsBottomSheet) target).hide();
}
}
@ -109,16 +109,16 @@ public class TripRecordingDiscardBottomSheetFragment extends MenuBottomSheetDial
public void onPause() {
super.onPause();
Fragment target = getTargetFragment();
if (target instanceof TripRecordingOptionsBottomSheetFragment) {
((TripRecordingOptionsBottomSheetFragment) target).show();
if (target instanceof TripRecordingOptionsBottomSheet) {
((TripRecordingOptionsBottomSheet) target).show();
}
}
@Override
public void dismissTarget() {
Fragment target = getTargetFragment();
if (target instanceof TripRecordingOptionsBottomSheetFragment) {
((TripRecordingOptionsBottomSheetFragment) target).dismiss();
if (target instanceof TripRecordingOptionsBottomSheet) {
((TripRecordingOptionsBottomSheet) target).dismiss();
}
}

View file

@ -27,7 +27,7 @@ import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.ItemType;
import net.osmand.plus.monitoring.TripRecordingBottomSheet.ItemType;
import net.osmand.plus.myplaces.SaveCurrentTrackTask;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.track.SaveGpxAsyncTask.SaveGpxListener;
@ -35,9 +35,9 @@ import net.osmand.util.Algorithms;
import static net.osmand.AndroidUtils.getPrimaryTextColorId;
public class TripRecordingOptionsBottomSheetFragment extends MenuBottomSheetDialogFragment implements TripRecordingBottomSheetFragment.DismissTargetFragment {
public class TripRecordingOptionsBottomSheet extends MenuBottomSheetDialogFragment implements TripRecordingBottomSheet.DismissTargetFragment {
public static final String TAG = TripRecordingOptionsBottomSheetFragment.class.getSimpleName();
public static final String TAG = TripRecordingOptionsBottomSheet.class.getSimpleName();
public static final String ACTION_STOP_AND_DISMISS = "action_stop_and_discard";
private static final int SAVE_UPDATE_INTERVAL = 1000;
@ -72,7 +72,7 @@ public class TripRecordingOptionsBottomSheetFragment extends MenuBottomSheetDial
public static void showInstance(@NonNull FragmentManager fragmentManager, @NonNull Fragment target) {
if (!fragmentManager.isStateSaved()) {
TripRecordingOptionsBottomSheetFragment fragment = new TripRecordingOptionsBottomSheetFragment();
TripRecordingOptionsBottomSheet fragment = new TripRecordingOptionsBottomSheet();
fragment.setTargetFragment(target, 0);
fragment.show(fragmentManager, TAG);
}
@ -109,7 +109,7 @@ public class TripRecordingOptionsBottomSheetFragment extends MenuBottomSheetDial
@Override
public void onClick(View v) {
if (fragmentManager != null && hasDataToSave()) {
TripRecordingClearDataBottomSheetFragment.showInstance(fragmentManager, TripRecordingOptionsBottomSheetFragment.this);
TripRecordingClearDataBottomSheet.showInstance(fragmentManager, TripRecordingOptionsBottomSheet.this);
}
}
})
@ -123,7 +123,7 @@ public class TripRecordingOptionsBottomSheetFragment extends MenuBottomSheetDial
@Override
public void onClick(View v) {
if (fragmentManager != null) {
TripRecordingDiscardBottomSheetFragment.showInstance(fragmentManager, TripRecordingOptionsBottomSheetFragment.this);
TripRecordingDiscardBottomSheet.showInstance(fragmentManager, TripRecordingOptionsBottomSheet.this);
}
}
})
@ -189,8 +189,8 @@ public class TripRecordingOptionsBottomSheetFragment extends MenuBottomSheetDial
super.onResume();
runUpdatingTimeTrackSaved();
Fragment target = getTargetFragment();
if (target instanceof TripRecordingBottomSheetFragment) {
((TripRecordingBottomSheetFragment) target).hide();
if (target instanceof TripRecordingBottomSheet) {
((TripRecordingBottomSheet) target).hide();
}
}
@ -224,8 +224,8 @@ public class TripRecordingOptionsBottomSheetFragment extends MenuBottomSheetDial
@Override
public void run() {
String time = getTimeTrackSaved();
TripRecordingBottomSheetFragment.createItem(app, nightMode, buttonSave, ItemType.SAVE, hasDataToSave(), !Algorithms.isEmpty(time) ? time : null);
TripRecordingBottomSheetFragment.createItem(app, nightMode, buttonClear, ItemType.CLEAR_DATA, hasDataToSave(), null);
TripRecordingBottomSheet.createItem(app, nightMode, buttonSave, ItemType.SAVE, hasDataToSave(), !Algorithms.isEmpty(time) ? time : null);
TripRecordingBottomSheet.createItem(app, nightMode, buttonClear, ItemType.CLEAR_DATA, hasDataToSave(), null);
handler.postDelayed(this, SAVE_UPDATE_INTERVAL);
}
};
@ -244,11 +244,11 @@ public class TripRecordingOptionsBottomSheetFragment extends MenuBottomSheetDial
}
private View createItem(LayoutInflater inflater, ItemType type, boolean enabled) {
return TripRecordingBottomSheetFragment.createItem(app, nightMode, inflater, type, enabled, null);
return TripRecordingBottomSheet.createItem(app, nightMode, inflater, type, enabled, null);
}
private View createItem(LayoutInflater inflater, ItemType type) {
return TripRecordingBottomSheetFragment.createItem(app, nightMode, inflater, type);
return TripRecordingBottomSheet.createItem(app, nightMode, inflater, type);
}
private SaveGpxListener createSaveListener() {
@ -286,11 +286,11 @@ public class TripRecordingOptionsBottomSheetFragment extends MenuBottomSheetDial
@Override
public void dismissTarget() {
Fragment target = getTargetFragment();
if (target instanceof TripRecordingBottomSheetFragment) {
if (target instanceof TripRecordingBottomSheet) {
if (isDiscard()) {
((TripRecordingBottomSheetFragment) target).dismiss();
((TripRecordingBottomSheet) target).dismiss();
} else {
((TripRecordingBottomSheetFragment) target).show();
((TripRecordingBottomSheet) target).show();
}
}
}

View file

@ -19,31 +19,29 @@ import androidx.fragment.app.FragmentManager;
import com.google.android.material.slider.RangeSlider;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.NavigationService;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.SavingTrackHelper;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.ItemType;
import net.osmand.plus.monitoring.TripRecordingBottomSheet.ItemType;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.MINUTES;
import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.SECONDS;
import static net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.createItem;
import static net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.createShowTrackItem;
import static net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.updateTrackIcon;
import static net.osmand.plus.monitoring.TripRecordingBottomSheet.createItem;
import static net.osmand.plus.monitoring.TripRecordingBottomSheet.createShowTrackItem;
import static net.osmand.plus.monitoring.TripRecordingBottomSheet.updateTrackIcon;
public class TripRecordingStartingBottomSheetFragment extends MenuBottomSheetDialogFragment {
public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragment {
public static final String TAG = TripRecordingStartingBottomSheetFragment.class.getSimpleName();
public static final String TAG = TripRecordingStartingBottomSheet.class.getSimpleName();
public static final String UPDATE_LOGGING_INTERVAL = "update_logging_interval";
private OsmandApplication app;
@ -59,12 +57,12 @@ public class TripRecordingStartingBottomSheetFragment extends MenuBottomSheetDia
public static void showInstance(@NonNull FragmentManager fragmentManager) {
if (!fragmentManager.isStateSaved()) {
TripRecordingStartingBottomSheetFragment fragment = new TripRecordingStartingBottomSheetFragment();
TripRecordingStartingBottomSheet fragment = new TripRecordingStartingBottomSheet();
fragment.show(fragmentManager, TAG);
}
}
public static void showInstance(@NonNull FragmentManager fragmentManager, OsmandApplication app, SelectedGpxFile selectedGpxFile) {
public static void showTripRecordingDialog(@NonNull FragmentManager fragmentManager, OsmandApplication app) {
if (!fragmentManager.isStateSaved()) {
OsmandSettings settings = app.getSettings();
boolean showStartDialog = settings.SHOW_TRIP_REC_START_DIALOG.get();
@ -72,7 +70,7 @@ public class TripRecordingStartingBottomSheetFragment extends MenuBottomSheetDia
showInstance(fragmentManager);
} else {
startRecording(app);
TripRecordingBottomSheetFragment.showInstance(fragmentManager, selectedGpxFile);
TripRecordingBottomSheet.showInstance(fragmentManager);
}
}
}
@ -106,7 +104,7 @@ public class TripRecordingStartingBottomSheetFragment extends MenuBottomSheetDia
LinearLayout showTrackContainer = itemView.findViewById(R.id.show_track_on_map);
trackAppearanceIcon = showTrackContainer.findViewById(R.id.additional_button_icon);
createShowTrackItem(showTrackContainer, trackAppearanceIcon, R.string.shared_string_show_on_map,
TripRecordingStartingBottomSheetFragment.this, nightMode, new Runnable() {
TripRecordingStartingBottomSheet.this, nightMode, new Runnable() {
@Override
public void run() {
hide();
@ -142,7 +140,7 @@ public class TripRecordingStartingBottomSheetFragment extends MenuBottomSheetDia
if (mapActivity != null) {
hide();
BaseSettingsFragment.showInstance(mapActivity, SettingsScreenType.MONITORING_SETTINGS,
null, new Bundle(), TripRecordingStartingBottomSheetFragment.this);
null, new Bundle(), TripRecordingStartingBottomSheet.this);
}
}
});
@ -221,10 +219,8 @@ public class TripRecordingStartingBottomSheetFragment extends MenuBottomSheetDia
}
private static void startRecording(OsmandApplication app) {
OsmandSettings settings = app.getSettings();
SavingTrackHelper helper = app.getSavingTrackHelper();
helper.startNewSegment();
settings.SAVE_GLOBAL_TRACK_TO_GPX.set(true);
app.getSavingTrackHelper().startNewSegment();
app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.set(true);
app.startNavigationService(NavigationService.USED_BY_GPX);
}
@ -232,8 +228,7 @@ public class TripRecordingStartingBottomSheetFragment extends MenuBottomSheetDia
startRecording(app);
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
SavingTrackHelper helper = app.getSavingTrackHelper();
TripRecordingBottomSheetFragment.showInstance(mapActivity.getSupportFragmentManager(), helper.getCurrentTrack());
TripRecordingBottomSheet.showInstance(mapActivity.getSupportFragmentManager());
}
dismiss();
}

View file

@ -34,7 +34,7 @@ import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
import org.apache.commons.logging.Log;
import static net.osmand.plus.liveupdates.LiveUpdatesSettingsDialogFragmentNew.getActivePrimaryColorId;
import static net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.getSecondaryIconColorId;
import static net.osmand.plus.monitoring.TripRecordingBottomSheet.getSecondaryIconColorId;
public class BooleanPreferenceBottomSheet extends BasePreferenceBottomSheet {

View file

@ -36,8 +36,8 @@ import net.osmand.plus.dialogs.GpxAppearanceAdapter;
import net.osmand.plus.dialogs.GpxAppearanceAdapter.AppearanceListItem;
import net.osmand.plus.dialogs.GpxAppearanceAdapter.GpxAppearanceAdapterType;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.monitoring.TripRecordingBottomSheetFragment;
import net.osmand.plus.monitoring.TripRecordingStartingBottomSheetFragment;
import net.osmand.plus.monitoring.TripRecordingBottomSheet;
import net.osmand.plus.monitoring.TripRecordingStartingBottomSheet;
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
import net.osmand.plus.routepreparationmenu.cards.BaseCard.CardListener;
import net.osmand.plus.settings.backend.CommonPreference;
@ -64,7 +64,7 @@ import static net.osmand.plus.dialogs.ConfigureMapMenu.CURRENT_TRACK_COLOR_ATTR;
import static net.osmand.plus.dialogs.GpxAppearanceAdapter.TRACK_WIDTH_BOLD;
import static net.osmand.plus.dialogs.GpxAppearanceAdapter.TRACK_WIDTH_MEDIUM;
import static net.osmand.plus.dialogs.GpxAppearanceAdapter.getAppearanceItems;
import static net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.UPDATE_TRACK_ICON;
import static net.osmand.plus.monitoring.TripRecordingBottomSheet.UPDATE_TRACK_ICON;
public class TrackAppearanceFragment extends ContextMenuScrollFragment implements CardListener, ColorPickerListener {
@ -398,10 +398,10 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
@Override
public void onContextMenuDismiss(@NonNull ContextMenuFragment fragment) {
Fragment target = getTargetFragment();
if (target instanceof TripRecordingStartingBottomSheetFragment) {
((TripRecordingStartingBottomSheetFragment) target).show();
} else if (target instanceof TripRecordingBottomSheetFragment) {
((TripRecordingBottomSheetFragment) target).show(UPDATE_TRACK_ICON);
if (target instanceof TripRecordingStartingBottomSheet) {
((TripRecordingStartingBottomSheet) target).show();
} else if (target instanceof TripRecordingBottomSheet) {
((TripRecordingBottomSheet) target).show(UPDATE_TRACK_ICON);
}
}