implementation of functionality;
many fixes;
This commit is contained in:
parent
fcd16ca99f
commit
7315679c8f
10 changed files with 221 additions and 131 deletions
|
@ -19,6 +19,7 @@
|
||||||
android:paddingEnd="@dimen/content_padding_small"
|
android:paddingEnd="@dimen/content_padding_small"
|
||||||
android:paddingRight="@dimen/content_padding_small"
|
android:paddingRight="@dimen/content_padding_small"
|
||||||
android:paddingBottom="@dimen/text_margin_small"
|
android:paddingBottom="@dimen/text_margin_small"
|
||||||
|
tools:background="@drawable/btn_background_inactive_dark"
|
||||||
tools:ignore="UselessParent">
|
tools:ignore="UselessParent">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -29,7 +30,7 @@
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
android:id="@+id/title"
|
android:id="@+id/button_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:duplicateParentState="true"
|
android:duplicateParentState="true"
|
||||||
|
@ -37,7 +38,7 @@
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
osmand:typeface="@string/font_roboto_medium"
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
tools:text="Title"
|
tools:text="Title"
|
||||||
tools:textColor="@color/text_color_secondary_light" />
|
tools:textColor="@color/active_color_primary_dark" />
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
android:id="@+id/desc"
|
android:id="@+id/desc"
|
||||||
|
@ -45,11 +46,11 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:duplicateParentState="true"
|
android:duplicateParentState="true"
|
||||||
android:letterSpacing="@dimen/description_letter_spacing"
|
android:letterSpacing="@dimen/description_letter_spacing"
|
||||||
android:textColor="@color/text_color_secondary_light"
|
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
osmand:typeface="@string/font_roboto_medium"
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
tools:text="Description"
|
tools:text="Description"
|
||||||
|
tools:textColor="@color/text_color_secondary_dark"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -62,7 +63,7 @@
|
||||||
android:layout_marginLeft="@dimen/context_menu_padding_margin_large"
|
android:layout_marginLeft="@dimen/context_menu_padding_margin_large"
|
||||||
android:duplicateParentState="true"
|
android:duplicateParentState="true"
|
||||||
tools:srcCompat="@drawable/ic_action_appearance"
|
tools:srcCompat="@drawable/ic_action_appearance"
|
||||||
tools:tint="@color/icon_color_secondary_light" />
|
tools:tint="@color/icon_color_active_dark" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
@ -9,9 +9,9 @@
|
||||||
android:id="@+id/button_container"
|
android:id="@+id/button_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:duplicateParentState="true"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:duplicateParentState="true"
|
|
||||||
android:paddingStart="@dimen/content_padding_small"
|
android:paddingStart="@dimen/content_padding_small"
|
||||||
android:paddingLeft="@dimen/content_padding_small"
|
android:paddingLeft="@dimen/content_padding_small"
|
||||||
android:paddingTop="@dimen/text_margin_small"
|
android:paddingTop="@dimen/text_margin_small"
|
||||||
|
@ -33,6 +33,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:duplicateParentState="true"
|
android:duplicateParentState="true"
|
||||||
|
android:letterSpacing="@dimen/description_letter_spacing"
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
osmand:typeface="@string/font_roboto_medium"
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
tools:text="Title"
|
tools:text="Title"
|
||||||
|
@ -43,10 +44,10 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:duplicateParentState="true"
|
android:duplicateParentState="true"
|
||||||
|
android:letterSpacing="@dimen/description_letter_spacing"
|
||||||
android:textColor="@color/text_color_secondary_light"
|
android:textColor="@color/text_color_secondary_light"
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:letterSpacing="@dimen/description_letter_spacing"
|
|
||||||
osmand:typeface="@string/font_roboto_medium"
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
tools:text="Description"
|
tools:text="Description"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
@ -57,9 +58,9 @@
|
||||||
android:id="@+id/icon"
|
android:id="@+id/icon"
|
||||||
android:layout_width="@dimen/map_widget_icon"
|
android:layout_width="@dimen/map_widget_icon"
|
||||||
android:layout_height="@dimen/map_widget_icon"
|
android:layout_height="@dimen/map_widget_icon"
|
||||||
android:duplicateParentState="true"
|
|
||||||
android:layout_marginStart="@dimen/context_menu_padding_margin_large"
|
android:layout_marginStart="@dimen/context_menu_padding_margin_large"
|
||||||
android:layout_marginLeft="@dimen/context_menu_padding_margin_large"
|
android:layout_marginLeft="@dimen/context_menu_padding_margin_large"
|
||||||
|
android:duplicateParentState="true"
|
||||||
tools:srcCompat="@drawable/ic_action_appearance"
|
tools:srcCompat="@drawable/ic_action_appearance"
|
||||||
tools:tint="@color/icon_color_secondary_light" />
|
tools:tint="@color/icon_color_secondary_light" />
|
||||||
|
|
||||||
|
|
|
@ -843,7 +843,8 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
}).createItem());
|
}).createItem());
|
||||||
|
|
||||||
boolean isTripRecordingPluginOn = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null;
|
final OsmandMonitoringPlugin monitoringPlugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
|
||||||
|
boolean isTripRecordingPluginOn = monitoringPlugin != null;
|
||||||
if (isTripRecordingPluginOn) {
|
if (isTripRecordingPluginOn) {
|
||||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.map_widget_monitoring, mapActivity)
|
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.map_widget_monitoring, mapActivity)
|
||||||
.setId(DRAWER_TRIP_RECORDING_ID)
|
.setId(DRAWER_TRIP_RECORDING_ID)
|
||||||
|
@ -853,7 +854,13 @@ public class MapActivityActions implements DialogProvider {
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||||
app.logEvent("trip_recording_open");
|
app.logEvent("trip_recording_open");
|
||||||
MapActivity.clearPrevActivityIntent();
|
MapActivity.clearPrevActivityIntent();
|
||||||
|
if (monitoringPlugin.isHasDataToSave() || monitoringPlugin.isWasTrackMonitored()) {
|
||||||
|
TripRecordingActiveBottomSheet.showInstance(mapActivity.getSupportFragmentManager(),
|
||||||
|
monitoringPlugin.getCurrentTrack(), monitoringPlugin.isWasTrackMonitored(),
|
||||||
|
monitoringPlugin.isHasDataToSave(), monitoringPlugin.isSearchingGPS());
|
||||||
|
} else {
|
||||||
TripRecordingBottomSheet.showInstance(mapActivity.getSupportFragmentManager());
|
TripRecordingBottomSheet.showInstance(mapActivity.getSupportFragmentManager());
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}).createItem());
|
}).createItem());
|
||||||
|
|
|
@ -102,26 +102,18 @@ public class ClearRecordedDataBottomSheetFragment extends MenuBottomSheetDialogF
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
// Replace later with tTripRecordingActiveBottomSheet.hide()
|
|
||||||
Fragment target = getTargetFragment();
|
Fragment target = getTargetFragment();
|
||||||
if (target instanceof TripRecordingActiveBottomSheet) {
|
if (target instanceof TripRecordingActiveBottomSheet) {
|
||||||
Dialog dialog = ((TripRecordingActiveBottomSheet) target).getDialog();
|
((TripRecordingActiveBottomSheet) target).hide();
|
||||||
if (dialog != null) {
|
|
||||||
dialog.hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
// Replace later with tTripRecordingActiveBottomSheet.show()
|
|
||||||
Fragment target = getTargetFragment();
|
Fragment target = getTargetFragment();
|
||||||
if (target instanceof TripRecordingActiveBottomSheet) {
|
if (target instanceof TripRecordingActiveBottomSheet) {
|
||||||
Dialog dialog = ((TripRecordingActiveBottomSheet) target).getDialog();
|
((TripRecordingActiveBottomSheet) target).show();
|
||||||
if (dialog != null) {
|
|
||||||
dialog.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@ import com.google.android.material.slider.Slider;
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.ValueHolder;
|
import net.osmand.ValueHolder;
|
||||||
|
import net.osmand.plus.GpxSelectionHelper;
|
||||||
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.NavigationService;
|
import net.osmand.plus.NavigationService;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmAndLocationProvider;
|
import net.osmand.plus.OsmAndLocationProvider;
|
||||||
|
@ -318,8 +320,34 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SelectedGpxFile getCurrentTrack() {
|
||||||
|
return app.getSavingTrackHelper().getCurrentTrack();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWasTrackMonitored() {
|
||||||
|
return settings.SAVE_GLOBAL_TRACK_TO_GPX.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isHasDataToSave() {
|
||||||
|
return app.getSavingTrackHelper().hasDataToSave();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSearchingGPS() {
|
||||||
|
OsmAndLocationProvider locationProvider = app.getLocationProvider();
|
||||||
|
Location lastKnownLocation = locationProvider.getLastKnownLocation();
|
||||||
|
return lastKnownLocation == null;
|
||||||
|
}
|
||||||
|
|
||||||
public void controlDialog(final Activity activity, final boolean showTrackSelection) {
|
public void controlDialog(final Activity activity, final boolean showTrackSelection) {
|
||||||
final boolean wasTrackMonitored = settings.SAVE_GLOBAL_TRACK_TO_GPX.get();
|
if (isHasDataToSave() || isWasTrackMonitored()) {
|
||||||
|
FragmentActivity fragmentActivity = (FragmentActivity) activity;
|
||||||
|
TripRecordingActiveBottomSheet.showInstance(fragmentActivity.getSupportFragmentManager(),
|
||||||
|
getCurrentTrack(), isWasTrackMonitored(), isHasDataToSave(), isSearchingGPS());
|
||||||
|
} else {
|
||||||
|
FragmentActivity fragmentActivity = (FragmentActivity) activity;
|
||||||
|
TripRecordingBottomSheet.showInstance(fragmentActivity.getSupportFragmentManager());
|
||||||
|
}
|
||||||
|
/*final boolean wasTrackMonitored = settings.SAVE_GLOBAL_TRACK_TO_GPX.get();
|
||||||
final boolean nightMode;
|
final boolean nightMode;
|
||||||
if (activity instanceof MapActivity) {
|
if (activity instanceof MapActivity) {
|
||||||
nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||||
|
@ -328,8 +356,6 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
AlertDialog.Builder bld = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
|
AlertDialog.Builder bld = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
|
||||||
final TIntArrayList items = new TIntArrayList();
|
final TIntArrayList items = new TIntArrayList();
|
||||||
FragmentActivity fragmentActivity = (FragmentActivity) activity;
|
|
||||||
TripRecordingActiveBottomSheet.showInstance(fragmentActivity.getSupportFragmentManager());
|
|
||||||
if (wasTrackMonitored) {
|
if (wasTrackMonitored) {
|
||||||
items.add(R.string.gpx_monitoring_stop);
|
items.add(R.string.gpx_monitoring_stop);
|
||||||
items.add(R.string.gpx_start_new_segment);
|
items.add(R.string.gpx_start_new_segment);
|
||||||
|
@ -419,7 +445,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// bld.show();
|
// bld.show();
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveCurrentTrack() {
|
public void saveCurrentTrack() {
|
||||||
|
|
|
@ -128,26 +128,18 @@ public class StopTrackRecordingBottomFragment extends MenuBottomSheetDialogFragm
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
// Replace later with tTripRecordingActiveBottomSheet.hide()
|
|
||||||
Fragment target = getTargetFragment();
|
Fragment target = getTargetFragment();
|
||||||
if (target instanceof TripRecordingActiveBottomSheet) {
|
if (target instanceof TripRecordingActiveBottomSheet) {
|
||||||
Dialog dialog = ((TripRecordingActiveBottomSheet) target).getDialog();
|
((TripRecordingActiveBottomSheet) target).hide();
|
||||||
if (dialog != null) {
|
|
||||||
dialog.hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
// Replace later with tTripRecordingActiveBottomSheet.show()
|
|
||||||
Fragment target = getTargetFragment();
|
Fragment target = getTargetFragment();
|
||||||
if (target instanceof TripRecordingActiveBottomSheet) {
|
if (target instanceof TripRecordingActiveBottomSheet) {
|
||||||
Dialog dialog = ((TripRecordingActiveBottomSheet) target).getDialog();
|
((TripRecordingActiveBottomSheet) target).show();
|
||||||
if (dialog != null) {
|
|
||||||
dialog.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ import androidx.appcompat.content.res.AppCompatResources;
|
||||||
import androidx.appcompat.widget.AppCompatImageView;
|
import androidx.appcompat.widget.AppCompatImageView;
|
||||||
import androidx.appcompat.widget.SwitchCompat;
|
import androidx.appcompat.widget.SwitchCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
@ -37,8 +36,9 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.GPXUtilities;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.OsmAndLocationProvider;
|
import net.osmand.plus.OsmAndLocationProvider;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -46,6 +46,7 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.SavingTrackHelper;
|
import net.osmand.plus.activities.SavingTrackHelper;
|
||||||
|
import net.osmand.plus.activities.SavingTrackHelper.SaveGpxResult;
|
||||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
|
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
@ -53,15 +54,18 @@ import net.osmand.plus.helpers.FontCache;
|
||||||
import net.osmand.plus.myplaces.SaveCurrentTrackTask;
|
import net.osmand.plus.myplaces.SaveCurrentTrackTask;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.track.GpxBlockStatisticsBuilder;
|
import net.osmand.plus.track.GpxBlockStatisticsBuilder;
|
||||||
import net.osmand.plus.track.SaveGpxAsyncTask;
|
import net.osmand.plus.track.SaveGpxAsyncTask.SaveGpxListener;
|
||||||
import net.osmand.plus.track.TrackAppearanceFragment;
|
import net.osmand.plus.track.TrackAppearanceFragment;
|
||||||
import net.osmand.plus.widgets.TextViewEx;
|
import net.osmand.plus.widgets.TextViewEx;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import static net.osmand.plus.UiUtilities.CompoundButtonType.PROFILE_DEPENDENT;
|
import static net.osmand.plus.UiUtilities.CompoundButtonType.PROFILE_DEPENDENT;
|
||||||
|
@ -69,58 +73,29 @@ import static net.osmand.plus.UiUtilities.CompoundButtonType.PROFILE_DEPENDENT;
|
||||||
public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragment {
|
public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
|
|
||||||
public static final String TAG = TripRecordingActiveBottomSheet.class.getSimpleName();
|
public static final String TAG = TripRecordingActiveBottomSheet.class.getSimpleName();
|
||||||
|
private static final Log log = PlatformUtil.getLog(TripRecordingActiveBottomSheet.class);
|
||||||
|
|
||||||
private OsmandApplication app;
|
private OsmandApplication app;
|
||||||
private OsmandSettings settings;
|
private OsmandSettings settings;
|
||||||
|
private SavingTrackHelper helper;
|
||||||
private SelectedGpxFile selectedGpxFile;
|
private SelectedGpxFile selectedGpxFile;
|
||||||
private GpxBlockStatisticsBuilder blockStatisticsBuilder;
|
|
||||||
private boolean wasTrackMonitored = false;
|
private boolean wasTrackMonitored = false;
|
||||||
private boolean hasDataToSave = false;
|
private boolean hasDataToSave = false;
|
||||||
private boolean searchingGPS = false;
|
private boolean searchingGPS = false;
|
||||||
|
|
||||||
private View statusContainer;
|
private View statusContainer;
|
||||||
|
private View buttonSave;
|
||||||
|
private GpxBlockStatisticsBuilder blockStatisticsBuilder;
|
||||||
|
|
||||||
private final Handler handler = new Handler();
|
private final Handler handler = new Handler();
|
||||||
private Runnable updatingGPS;
|
private Runnable updatingGPS;
|
||||||
|
private Runnable updatingTimeTrackSaved;
|
||||||
|
private SaveGpxListener saveGpxListener;
|
||||||
|
|
||||||
SaveGpxAsyncTask.SaveGpxListener saveGpxListener = new SaveGpxAsyncTask.SaveGpxListener() {
|
private GPXFile getGPXFile() {
|
||||||
|
return selectedGpxFile.getGpxFile();
|
||||||
@Override
|
|
||||||
public void gpxSavingStarted() {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void gpxSavingFinished(Exception errorMessage) {
|
|
||||||
String gpxFileName = Algorithms.getFileWithoutDirs(app.getSavingTrackHelper().getCurrentTrack().getGpxFile().path);
|
|
||||||
final MapActivity mapActivity = getMapActivity();
|
|
||||||
final Context context = getContext();
|
|
||||||
SavingTrackHelper helper = app.getSavingTrackHelper();
|
|
||||||
final SavingTrackHelper.SaveGpxResult result = helper.saveDataToGpx(app.getAppCustomization().getTracksDir());
|
|
||||||
if (mapActivity != null && context != null) {
|
|
||||||
Snackbar snackbar = Snackbar.make(mapActivity.getLayout(),
|
|
||||||
getString(R.string.shared_string_file_is_saved, gpxFileName),
|
|
||||||
Snackbar.LENGTH_LONG)
|
|
||||||
.setAction(R.string.shared_string_undo, new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
final WeakReference<MapActivity> mapActivityRef = new WeakReference<>(mapActivity);
|
|
||||||
final FragmentActivity fragmentActivity = mapActivityRef.get();
|
|
||||||
SaveGPXBottomSheetFragment.showInstance(fragmentActivity.getSupportFragmentManager(), result.getFilenames());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
View view = snackbar.getView();
|
|
||||||
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) view.getLayoutParams();
|
|
||||||
params.gravity = Gravity.TOP;
|
|
||||||
AndroidUtils.setMargins(params, 0, AndroidUtils.getStatusBarHeight(context), 0, 0);
|
|
||||||
view.setLayoutParams(params);
|
|
||||||
UiUtilities.setupSnackbar(snackbar, nightMode);
|
|
||||||
snackbar.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
public void setSelectedGpxFile(SelectedGpxFile selectedGpxFile) {
|
public void setSelectedGpxFile(SelectedGpxFile selectedGpxFile) {
|
||||||
this.selectedGpxFile = selectedGpxFile;
|
this.selectedGpxFile = selectedGpxFile;
|
||||||
}
|
}
|
||||||
|
@ -153,57 +128,30 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen
|
||||||
public void createMenuItems(Bundle savedInstanceState) {
|
public void createMenuItems(Bundle savedInstanceState) {
|
||||||
app = requiredMyApplication();
|
app = requiredMyApplication();
|
||||||
settings = app.getSettings();
|
settings = app.getSettings();
|
||||||
|
helper = app.getSavingTrackHelper();
|
||||||
LayoutInflater inflater = UiUtilities.getInflater(getContext(), nightMode);
|
LayoutInflater inflater = UiUtilities.getInflater(getContext(), nightMode);
|
||||||
final FragmentManager fragmentManager = getFragmentManager();
|
final FragmentManager fragmentManager = getFragmentManager();
|
||||||
final Fragment targetFragment = getTargetFragment();
|
|
||||||
|
|
||||||
View itemView = inflater.inflate(R.layout.trip_recording_active_fragment, null, false);
|
View itemView = inflater.inflate(R.layout.trip_recording_active_fragment, null, false);
|
||||||
items.add(new BottomSheetItemWithDescription.Builder()
|
items.add(new BottomSheetItemWithDescription.Builder()
|
||||||
.setCustomView(itemView)
|
.setCustomView(itemView)
|
||||||
.create());
|
.create());
|
||||||
|
|
||||||
long timeTrackSaved = app.getSavingTrackHelper().getLastTimeUpdated();
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy HH:mm:ss:SSS Z");
|
|
||||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
|
||||||
Date resultDate = new Date(timeTrackSaved);
|
|
||||||
String sdfFormatted = sdf.format(resultDate);
|
|
||||||
CharSequence formattedTimeTrackSaved = null;
|
|
||||||
try {
|
|
||||||
long time = sdf.parse(sdfFormatted).getTime();
|
|
||||||
long now = System.currentTimeMillis();
|
|
||||||
formattedTimeTrackSaved =
|
|
||||||
DateUtils.getRelativeTimeSpanString(time, now, DateUtils.MINUTE_IN_MILLIS);
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
View buttonClear = itemView.findViewById(R.id.button_clear);
|
View buttonClear = itemView.findViewById(R.id.button_clear);
|
||||||
View buttonStart = itemView.findViewById(R.id.button_start);
|
View buttonStart = itemView.findViewById(R.id.button_start);
|
||||||
View buttonSave = itemView.findViewById(R.id.button_save);
|
buttonSave = itemView.findViewById(R.id.button_save);
|
||||||
final View buttonPause = itemView.findViewById(R.id.button_pause);
|
final View buttonPause = itemView.findViewById(R.id.button_pause);
|
||||||
View buttonStop = itemView.findViewById(R.id.button_stop);
|
View buttonStop = itemView.findViewById(R.id.button_stop);
|
||||||
|
|
||||||
createItem(buttonClear, ItemType.CLEAR_DATA, hasDataToSave, null);
|
createItem(buttonClear, ItemType.CLEAR_DATA, hasDataToSave, null);
|
||||||
createItem(buttonStart, ItemType.START_SEGMENT, wasTrackMonitored, null);
|
createItem(buttonStart, ItemType.START_SEGMENT, wasTrackMonitored, null);
|
||||||
createItem(buttonSave, ItemType.SAVE, hasDataToSave, (String) formattedTimeTrackSaved);
|
// createItem(buttonSave, ItemType.SAVE, hasDataToSave, getTimeTrackSaved());
|
||||||
createItem(buttonPause, wasTrackMonitored ? ItemType.PAUSE : ItemType.RESUME, true, null);
|
createItem(buttonPause, wasTrackMonitored ? ItemType.PAUSE : ItemType.RESUME, true, null);
|
||||||
createItem(buttonStop, ItemType.STOP, true, null);
|
createItem(buttonStop, ItemType.STOP, true, null);
|
||||||
|
|
||||||
statusContainer = itemView.findViewById(R.id.status_container);
|
statusContainer = itemView.findViewById(R.id.status_container);
|
||||||
updateStatus();
|
updateStatus();
|
||||||
|
|
||||||
// todo example, need to check
|
|
||||||
buttonPause.findViewById(R.id.button_container).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
boolean wasTrackMonitored = !settings.SAVE_GLOBAL_TRACK_TO_GPX.get();
|
|
||||||
createItem(buttonPause, wasTrackMonitored ? ItemType.PAUSE : ItemType.RESUME, true, null);
|
|
||||||
TripRecordingActiveBottomSheet.this.wasTrackMonitored = wasTrackMonitored;
|
|
||||||
settings.SAVE_GLOBAL_TRACK_TO_GPX.set(wasTrackMonitored);
|
|
||||||
updateStatus();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
RecyclerView statBlocks = itemView.findViewById(R.id.block_statistics);
|
RecyclerView statBlocks = itemView.findViewById(R.id.block_statistics);
|
||||||
blockStatisticsBuilder = new GpxBlockStatisticsBuilder(app, selectedGpxFile, null);
|
blockStatisticsBuilder = new GpxBlockStatisticsBuilder(app, selectedGpxFile, null);
|
||||||
blockStatisticsBuilder.setBlocksView(statBlocks);
|
blockStatisticsBuilder.setBlocksView(statBlocks);
|
||||||
|
@ -265,28 +213,57 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
buttonClear.findViewById(R.id.button_container).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (fragmentManager != null && hasDataToSave) {
|
||||||
|
ClearRecordedDataBottomSheetFragment.showInstance(fragmentManager, TripRecordingActiveBottomSheet.this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonStart.findViewById(R.id.button_container).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (wasTrackMonitored) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setSaveListener();
|
||||||
buttonSave.findViewById(R.id.button_container).setOnClickListener(new View.OnClickListener() {
|
buttonSave.findViewById(R.id.button_container).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
final GPXUtilities.GPXFile gpxFile = app.getSavingTrackHelper().getCurrentTrack().getGpxFile();
|
if (hasDataToSave) {
|
||||||
|
final GPXFile gpxFile = getGPXFile();
|
||||||
new SaveCurrentTrackTask(app, gpxFile, saveGpxListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new SaveCurrentTrackTask(app, gpxFile, saveGpxListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// todo example, need to check
|
||||||
|
buttonPause.findViewById(R.id.button_container).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
boolean wasTrackMonitored = !settings.SAVE_GLOBAL_TRACK_TO_GPX.get();
|
||||||
|
createItem(buttonPause, wasTrackMonitored ? ItemType.PAUSE : ItemType.RESUME, true, null);
|
||||||
|
if (!wasTrackMonitored) {
|
||||||
|
blockStatisticsBuilder.stopUpdatingStatBlocks();
|
||||||
|
} else {
|
||||||
|
blockStatisticsBuilder.runUpdatingStatBlocks();
|
||||||
|
}
|
||||||
|
TripRecordingActiveBottomSheet.this.wasTrackMonitored = wasTrackMonitored;
|
||||||
|
settings.SAVE_GLOBAL_TRACK_TO_GPX.set(wasTrackMonitored);
|
||||||
|
updateStatus();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
buttonStop.findViewById(R.id.button_container).setOnClickListener(new View.OnClickListener() {
|
buttonStop.findViewById(R.id.button_container).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (fragmentManager != null) {
|
if (fragmentManager != null) {
|
||||||
StopTrackRecordingBottomFragment.showInstance(fragmentManager, targetFragment);
|
StopTrackRecordingBottomFragment.showInstance(fragmentManager, TripRecordingActiveBottomSheet.this);
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonClear.findViewById(R.id.button_container).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (fragmentManager != null) {
|
|
||||||
ClearRecordedDataBottomSheetFragment.showInstance(fragmentManager, targetFragment);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -314,7 +291,7 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen
|
||||||
type.setTintedIcon(icon, app, enabled, false, nightMode);
|
type.setTintedIcon(icon, app, enabled, false, nightMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView title = view.findViewById(R.id.title);
|
TextView title = view.findViewById(R.id.button_text);
|
||||||
if (title != null) {
|
if (title != null) {
|
||||||
title.setText(type.getTitleId());
|
title.setText(type.getTitleId());
|
||||||
type.setTextColor(title, app, enabled, false, nightMode);
|
type.setTextColor(title, app, enabled, false, nightMode);
|
||||||
|
@ -333,11 +310,29 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getTimeTrackSaved() {
|
||||||
|
long timeTrackSaved = helper.getLastTimeUpdated();
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy HH:mm:ss:SSS Z", Locale.getDefault());
|
||||||
|
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||||
|
Date resultDate = new Date(timeTrackSaved);
|
||||||
|
String sdfFormatted = sdf.format(resultDate);
|
||||||
|
CharSequence formattedTimeTrackSaved = null;
|
||||||
|
try {
|
||||||
|
long time = sdf.parse(sdfFormatted).getTime();
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
|
formattedTimeTrackSaved = DateUtils.getRelativeTimeSpanString(time, now, DateUtils.MINUTE_IN_MILLIS);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
log.error(e);
|
||||||
|
}
|
||||||
|
return String.valueOf(formattedTimeTrackSaved);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
blockStatisticsBuilder.runUpdatingStatBlocks();
|
blockStatisticsBuilder.runUpdatingStatBlocks();
|
||||||
runUpdatingGPS();
|
runUpdatingGPS();
|
||||||
|
runUpdatingTimeTrackSaved();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -345,6 +340,7 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen
|
||||||
super.onPause();
|
super.onPause();
|
||||||
blockStatisticsBuilder.stopUpdatingStatBlocks();
|
blockStatisticsBuilder.stopUpdatingStatBlocks();
|
||||||
stopUpdatingGPS();
|
stopUpdatingGPS();
|
||||||
|
stopUpdatingTimeTrackSaved();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopUpdatingGPS() {
|
public void stopUpdatingGPS() {
|
||||||
|
@ -366,6 +362,61 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen
|
||||||
handler.post(updatingGPS);
|
handler.post(updatingGPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stopUpdatingTimeTrackSaved() {
|
||||||
|
handler.removeCallbacks(updatingTimeTrackSaved);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void runUpdatingTimeTrackSaved() {
|
||||||
|
updatingTimeTrackSaved = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
String time = getTimeTrackSaved();
|
||||||
|
createItem(buttonSave, ItemType.SAVE, hasDataToSave, !Algorithms.isEmpty(time) ? time : null);
|
||||||
|
handler.postDelayed(this, 60000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
handler.post(updatingTimeTrackSaved);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setSaveListener() {
|
||||||
|
if (saveGpxListener == null) {
|
||||||
|
saveGpxListener = new SaveGpxListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void gpxSavingStarted() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void gpxSavingFinished(Exception errorMessage) {
|
||||||
|
String gpxFileName = Algorithms.getFileWithoutDirs(getGPXFile().path);
|
||||||
|
final MapActivity mapActivity = getMapActivity();
|
||||||
|
final Context context = getContext();
|
||||||
|
final SaveGpxResult result = helper.saveDataToGpx(app.getAppCustomization().getTracksDir());
|
||||||
|
if (mapActivity != null && context != null) {
|
||||||
|
Snackbar snackbar = Snackbar.make(mapActivity.getLayout(),
|
||||||
|
getString(R.string.shared_string_file_is_saved, gpxFileName),
|
||||||
|
Snackbar.LENGTH_LONG)
|
||||||
|
.setAction(R.string.shared_string_undo, new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
final WeakReference<MapActivity> mapActivityRef = new WeakReference<>(mapActivity);
|
||||||
|
final FragmentActivity fragmentActivity = mapActivityRef.get();
|
||||||
|
SaveGPXBottomSheetFragment.showInstance(fragmentActivity.getSupportFragmentManager(), result.getFilenames());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
View view = snackbar.getView();
|
||||||
|
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) view.getLayoutParams();
|
||||||
|
params.gravity = Gravity.TOP;
|
||||||
|
AndroidUtils.setMargins(params, 0, AndroidUtils.getStatusBarHeight(context), 0, 0);
|
||||||
|
view.setLayoutParams(params);
|
||||||
|
UiUtilities.setupSnackbar(snackbar, nightMode);
|
||||||
|
snackbar.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public MapActivity getMapActivity() {
|
public MapActivity getMapActivity() {
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
|
@ -375,6 +426,13 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void show() {
|
||||||
|
Dialog dialog = getDialog();
|
||||||
|
if (dialog != null) {
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void hide() {
|
public void hide() {
|
||||||
Dialog dialog = getDialog();
|
Dialog dialog = getDialog();
|
||||||
if (dialog != null) {
|
if (dialog != null) {
|
||||||
|
@ -443,7 +501,7 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen
|
||||||
if (tv != null) {
|
if (tv != null) {
|
||||||
tv.setTextColor(ContextCompat.getColor(context,
|
tv.setTextColor(ContextCompat.getColor(context,
|
||||||
enabled ? pressed ? getPressedColorId(nightMode)
|
enabled ? pressed ? getPressedColorId(nightMode)
|
||||||
: equals(ItemType.CLEAR_DATA) ? R.color.color_osm_edit_delete
|
: this == ItemType.CLEAR_DATA ? R.color.color_osm_edit_delete
|
||||||
: getActiveTextColorId(nightMode) : getSecondaryTextColorId(nightMode)));
|
: getActiveTextColorId(nightMode) : getSecondaryTextColorId(nightMode)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -452,10 +510,15 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen
|
||||||
if (iv != null) {
|
if (iv != null) {
|
||||||
int iconColor = ContextCompat.getColor(context,
|
int iconColor = ContextCompat.getColor(context,
|
||||||
enabled ? pressed ? getPressedColorId(nightMode)
|
enabled ? pressed ? getPressedColorId(nightMode)
|
||||||
: equals(ItemType.CLEAR_DATA) ? R.color.color_osm_edit_delete
|
: this == ItemType.CLEAR_DATA ? R.color.color_osm_edit_delete
|
||||||
: getActiveIconColorId(nightMode) : getSecondaryIconColorId(nightMode));
|
: getActiveIconColorId(nightMode) : getSecondaryIconColorId(nightMode));
|
||||||
Drawable icon = UiUtilities.createTintedDrawable(context, iconId, iconColor);
|
Drawable icon = UiUtilities.createTintedDrawable(context, iconId, iconColor);
|
||||||
iv.setImageDrawable(icon);
|
iv.setImageDrawable(icon);
|
||||||
|
if (this == ItemType.STOP) {
|
||||||
|
int stopSize = iv.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_icon_margin_large);
|
||||||
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(stopSize, stopSize);
|
||||||
|
iv.setLayoutParams(params);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.NavigationService;
|
import net.osmand.plus.NavigationService;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.UiUtilities.DialogButtonType;
|
import net.osmand.plus.UiUtilities.DialogButtonType;
|
||||||
|
@ -280,6 +281,9 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
app.getSavingTrackHelper().startNewSegment();
|
app.getSavingTrackHelper().startNewSegment();
|
||||||
settings.SAVE_GLOBAL_TRACK_TO_GPX.set(true);
|
settings.SAVE_GLOBAL_TRACK_TO_GPX.set(true);
|
||||||
app.startNavigationService(NavigationService.USED_BY_GPX);
|
app.startNavigationService(NavigationService.USED_BY_GPX);
|
||||||
|
OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
|
||||||
|
TripRecordingActiveBottomSheet.showInstance(getMapActivity().getSupportFragmentManager(),
|
||||||
|
plugin.getCurrentTrack(), plugin.isWasTrackMonitored(), plugin.isHasDataToSave(), plugin.isSearchingGPS());
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,7 @@ public class GpxBlockStatisticsBuilder {
|
||||||
if (bsAdapter != null) {
|
if (bsAdapter != null) {
|
||||||
initItems();
|
initItems();
|
||||||
bsAdapter.setItems(items);
|
bsAdapter.setItems(items);
|
||||||
|
AndroidUiHelper.updateVisibility(blocksView, !Algorithms.isEmpty(items));
|
||||||
}
|
}
|
||||||
int interval = app.getSettings().SAVE_GLOBAL_TRACK_INTERVAL.get();
|
int interval = app.getSettings().SAVE_GLOBAL_TRACK_INTERVAL.get();
|
||||||
handler.postDelayed(this, Math.max(1000, interval));
|
handler.postDelayed(this, Math.max(1000, interval));
|
||||||
|
@ -272,7 +273,7 @@ public class GpxBlockStatisticsBuilder {
|
||||||
public void setItems(List<StatBlock> statBlocks) {
|
public void setItems(List<StatBlock> statBlocks) {
|
||||||
this.statBlocks.clear();
|
this.statBlocks.clear();
|
||||||
this.statBlocks.addAll(statBlocks);
|
this.statBlocks.addAll(statBlocks);
|
||||||
notifyItemRangeChanged(0, getItemCount());
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ import net.osmand.plus.dialogs.GpxAppearanceAdapter;
|
||||||
import net.osmand.plus.dialogs.GpxAppearanceAdapter.AppearanceListItem;
|
import net.osmand.plus.dialogs.GpxAppearanceAdapter.AppearanceListItem;
|
||||||
import net.osmand.plus.dialogs.GpxAppearanceAdapter.GpxAppearanceAdapterType;
|
import net.osmand.plus.dialogs.GpxAppearanceAdapter.GpxAppearanceAdapterType;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
import net.osmand.plus.monitoring.TripRecordingActiveBottomSheet;
|
||||||
import net.osmand.plus.monitoring.TripRecordingBottomSheet;
|
import net.osmand.plus.monitoring.TripRecordingBottomSheet;
|
||||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard.CardListener;
|
import net.osmand.plus.routepreparationmenu.cards.BaseCard.CardListener;
|
||||||
|
@ -383,6 +384,8 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
||||||
Fragment target = getTargetFragment();
|
Fragment target = getTargetFragment();
|
||||||
if (target instanceof TripRecordingBottomSheet) {
|
if (target instanceof TripRecordingBottomSheet) {
|
||||||
((TripRecordingBottomSheet) target).show();
|
((TripRecordingBottomSheet) target).show();
|
||||||
|
} else if (target instanceof TripRecordingActiveBottomSheet) {
|
||||||
|
((TripRecordingActiveBottomSheet) target).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue