some fixes;
This commit is contained in:
parent
695a0016b9
commit
e1da7bbadf
8 changed files with 98 additions and 115 deletions
|
@ -301,7 +301,7 @@ public class MonitoringSettingsFragment extends BaseSettingsFragment
|
|||
if (activity != null && !activity.isChangingConfigurations()) {
|
||||
Fragment target = getTargetFragment();
|
||||
if (target instanceof TripRecordingStartingBottomFragment) {
|
||||
((TripRecordingStartingBottomFragment) target).show(UPDATE_LOGGING_INTERVAL);
|
||||
((TripRecordingStartingBottomFragment) target).show();
|
||||
}
|
||||
}
|
||||
super.onDestroy();
|
||||
|
|
|
@ -25,6 +25,7 @@ import com.google.android.material.slider.Slider;
|
|||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.ValueHolder;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.NavigationService;
|
||||
|
@ -48,6 +49,8 @@ import net.osmand.plus.views.layers.MapInfoLayer;
|
|||
import net.osmand.plus.views.mapwidgets.widgets.TextInfoWidget;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Collections;
|
||||
|
@ -57,6 +60,7 @@ import static net.osmand.plus.UiUtilities.CompoundButtonType.PROFILE_DEPENDENT;
|
|||
|
||||
public class OsmandMonitoringPlugin extends OsmandPlugin {
|
||||
|
||||
private static final Log LOG = PlatformUtil.getLog(OsmandMonitoringPlugin.class);
|
||||
public static final String ID = "osmand.monitoring";
|
||||
public final static String OSMAND_SAVE_SERVICE_ACTION = "OSMAND_SAVE_SERVICE_ACTION";
|
||||
public static final int REQUEST_LOCATION_PERMISSION_FOR_GPX_RECORDING = 208;
|
||||
|
@ -470,12 +474,10 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
|||
try {
|
||||
SavingTrackHelper helper = app.getSavingTrackHelper();
|
||||
SaveGpxResult result = helper.saveDataToGpx(app.getAppCustomization().getTracksDir());
|
||||
if (stopRecording) {
|
||||
helper.close();
|
||||
}
|
||||
helper.close();
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LOG.error(e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import net.osmand.plus.OsmandPlugin;
|
|||
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;
|
||||
|
@ -60,12 +61,12 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment {
|
|||
|
||||
public static final String TAG = TripRecordingBottomFragment.class.getSimpleName();
|
||||
private static final Log LOG = PlatformUtil.getLog(TripRecordingBottomFragment.class);
|
||||
private static final String SAVE_CURRENT_GPX_FILE = "save_current_gpx_file";
|
||||
public static final String UPDATE_TRACK_ICON = "update_track_icon";
|
||||
private static final int GPS_UPDATE_INTERVAL = 1000;
|
||||
|
||||
private OsmandApplication app;
|
||||
private OsmandSettings settings;
|
||||
private SavingTrackHelper helper;
|
||||
private OsmandMonitoringPlugin plugin;
|
||||
|
||||
private View statusContainer;
|
||||
|
@ -85,7 +86,7 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment {
|
|||
}
|
||||
|
||||
private boolean hasDataToSave() {
|
||||
return app.getSavingTrackHelper().hasDataToSave();
|
||||
return helper.hasDataToSave();
|
||||
}
|
||||
|
||||
private boolean searchingGPS() {
|
||||
|
@ -108,7 +109,9 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment {
|
|||
public void createMenuItems(Bundle savedInstanceState) {
|
||||
app = requiredMyApplication();
|
||||
settings = app.getSettings();
|
||||
helper = app.getSavingTrackHelper();
|
||||
plugin = OsmandPlugin.getPlugin(OsmandMonitoringPlugin.class);
|
||||
selectedGpxFile = helper.getCurrentTrack();
|
||||
LayoutInflater inflater = UiUtilities.getInflater(getContext(), nightMode);
|
||||
final FragmentManager fragmentManager = getFragmentManager();
|
||||
|
||||
|
@ -121,12 +124,6 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment {
|
|||
updateStatus();
|
||||
|
||||
RecyclerView statBlocks = itemView.findViewById(R.id.block_statistics);
|
||||
if (savedInstanceState != null) {
|
||||
if (savedInstanceState.containsKey(SAVE_CURRENT_GPX_FILE)
|
||||
&& savedInstanceState.getBoolean(SAVE_CURRENT_GPX_FILE)) {
|
||||
selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack();
|
||||
}
|
||||
}
|
||||
blockStatisticsBuilder = new GpxBlockStatisticsBuilder(app, selectedGpxFile);
|
||||
blockStatisticsBuilder.setBlocksView(statBlocks);
|
||||
blockStatisticsBuilder.setBlocksClickable(false);
|
||||
|
@ -174,7 +171,7 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null && plugin != null && app.getSavingTrackHelper().hasDataToSave()) {
|
||||
if (mapActivity != null && plugin != null && hasDataToSave()) {
|
||||
plugin.saveCurrentTrack(null, mapActivity);
|
||||
app.getNotificationHelper().refreshNotifications();
|
||||
dismiss();
|
||||
|
@ -188,19 +185,13 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
if (fragmentManager != null) {
|
||||
TripRecordingOptionsBottomFragment.showInstance(fragmentManager, TripRecordingBottomFragment.this, selectedGpxFile);
|
||||
TripRecordingOptionsBottomFragment.showInstance(fragmentManager, TripRecordingBottomFragment.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putBoolean(SAVE_CURRENT_GPX_FILE, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
@ -387,18 +378,18 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment {
|
|||
}
|
||||
|
||||
public static void setItemBackground(Context context, boolean nightMode, View view, boolean enabled) {
|
||||
Drawable background = AppCompatResources.getDrawable(context, R.drawable.btn_background_inactive_light);
|
||||
if (view instanceof CardView) {
|
||||
int colorId = enabled ? getActiveTransparentColorId(nightMode) : getInactiveButtonColorId(nightMode);
|
||||
((CardView) view).setCardBackgroundColor(AndroidUtils.createPressedColorStateList(
|
||||
context, colorId, getActiveTextColorId(nightMode)
|
||||
));
|
||||
return;
|
||||
}
|
||||
Drawable background = AppCompatResources.getDrawable(context, getInactiveButtonBackgroundId(nightMode));
|
||||
if (background != null && enabled) {
|
||||
int normalColorId = view instanceof CardView
|
||||
? getActiveTransparentColorId(nightMode) : getInactiveButtonColorId(nightMode);
|
||||
ColorStateList iconColorStateList = AndroidUtils.createPressedColorStateList(
|
||||
context, normalColorId, getActiveTextColorId(nightMode)
|
||||
);
|
||||
if (view instanceof CardView) {
|
||||
((CardView) view).setCardBackgroundColor(iconColorStateList);
|
||||
return;
|
||||
}
|
||||
DrawableCompat.setTintList(background, iconColorStateList);
|
||||
DrawableCompat.setTintList(background, AndroidUtils.createPressedColorStateList(
|
||||
context, getInactiveButtonColorId(nightMode), getActiveTextColorId(nightMode)
|
||||
));
|
||||
} else {
|
||||
UiUtilities.tintDrawable(background, ContextCompat.getColor(context, getInactiveButtonColorId(nightMode)));
|
||||
}
|
||||
|
@ -483,6 +474,10 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment {
|
|||
}
|
||||
}
|
||||
|
||||
public interface DismissTargetFragment {
|
||||
void dismissTarget();
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
public static int getActiveTextColorId(boolean nightMode) {
|
||||
return nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light;
|
||||
|
@ -513,7 +508,7 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment {
|
|||
return nightMode ? R.color.icon_color_osmand_dark : R.color.icon_color_osmand_light;
|
||||
}
|
||||
|
||||
@DrawableRes
|
||||
@ColorRes
|
||||
public static int getActiveTransparentColorId(boolean nightMode) {
|
||||
return nightMode ? R.color.switch_button_active_dark : R.color.switch_button_active_light;
|
||||
}
|
||||
|
@ -533,6 +528,11 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment {
|
|||
return nightMode ? R.drawable.btn_background_stroked_inactive_dark : R.drawable.btn_background_stroked_inactive_light;
|
||||
}
|
||||
|
||||
@DrawableRes
|
||||
public static int getInactiveButtonBackgroundId(boolean nightMode) {
|
||||
return nightMode ? R.drawable.btn_background_inactive_dark : R.drawable.btn_background_inactive_light;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hideButtonsContainer() {
|
||||
return true;
|
||||
|
@ -546,5 +546,4 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,9 +18,8 @@ import androidx.fragment.app.Fragment;
|
|||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import static net.osmand.AndroidUtils.getPrimaryTextColorId;
|
||||
import static net.osmand.plus.monitoring.TripRecordingOptionsBottomFragment.*;
|
||||
|
||||
public class TripRecordingClearDataBottomFragment extends MenuBottomSheetDialogFragment {
|
||||
public class TripRecordingClearDataBottomFragment extends MenuBottomSheetDialogFragment implements TripRecordingBottomFragment.DismissTargetFragment {
|
||||
|
||||
public static final String TAG = TripRecordingClearDataBottomFragment.class.getSimpleName();
|
||||
|
||||
|
@ -41,7 +40,7 @@ public class TripRecordingClearDataBottomFragment extends MenuBottomSheetDialogF
|
|||
int verticalBig = getResources().getDimensionPixelSize(R.dimen.dialog_content_margin);
|
||||
int verticalNormal = getResources().getDimensionPixelSize(R.dimen.content_padding);
|
||||
String description = getString(R.string.clear_recorded_data_warning)
|
||||
.concat(getString(R.string.lost_data_warning));
|
||||
.concat("\n").concat(getString(R.string.lost_data_warning));
|
||||
final View buttonClear = createItem(inflater, ItemType.CLEAR_DATA);
|
||||
final View buttonCancel = createItem(inflater, ItemType.CANCEL);
|
||||
|
||||
|
@ -61,7 +60,7 @@ public class TripRecordingClearDataBottomFragment extends MenuBottomSheetDialogF
|
|||
public void onClick(View v) {
|
||||
app.getSavingTrackHelper().clearRecordedData(true);
|
||||
dismiss();
|
||||
dismissTargetDialog(TripRecordingClearDataBottomFragment.this, TripRecordingOptionsBottomFragment.class);
|
||||
dismissTarget();
|
||||
}
|
||||
})
|
||||
.create());
|
||||
|
@ -108,4 +107,11 @@ public class TripRecordingClearDataBottomFragment extends MenuBottomSheetDialogF
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismissTarget() {
|
||||
Fragment target = getTargetFragment();
|
||||
if (target instanceof TripRecordingOptionsBottomFragment) {
|
||||
((TripRecordingOptionsBottomFragment) target).dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,10 +19,9 @@ import androidx.fragment.app.Fragment;
|
|||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import static net.osmand.AndroidUtils.getPrimaryTextColorId;
|
||||
import static net.osmand.plus.monitoring.TripRecordingOptionsBottomFragment.ACTION_STOP_AND_DISCARD;
|
||||
import static net.osmand.plus.monitoring.TripRecordingOptionsBottomFragment.dismissTargetDialog;
|
||||
import static net.osmand.plus.monitoring.TripRecordingOptionsBottomFragment.ACTION_STOP_AND_DISMISS;
|
||||
|
||||
public class TripRecordingDiscardBottomFragment extends MenuBottomSheetDialogFragment {
|
||||
public class TripRecordingDiscardBottomFragment extends MenuBottomSheetDialogFragment implements TripRecordingBottomFragment.DismissTargetFragment {
|
||||
|
||||
public static final String TAG = TripRecordingDiscardBottomFragment.class.getSimpleName();
|
||||
|
||||
|
@ -43,13 +42,11 @@ public class TripRecordingDiscardBottomFragment extends MenuBottomSheetDialogFra
|
|||
LayoutInflater inflater = UiUtilities.getInflater(app, nightMode);
|
||||
int verticalBig = getResources().getDimensionPixelSize(R.dimen.dialog_content_margin);
|
||||
int verticalNormal = getResources().getDimensionPixelSize(R.dimen.content_padding);
|
||||
String description = getString(R.string.track_recording_description)
|
||||
.concat(getString(R.string.lost_data_warning));
|
||||
final View buttonDiscard = createItem(inflater, ItemType.STOP_AND_DISCARD);
|
||||
final View buttonCancel = createItem(inflater, ItemType.CANCEL);
|
||||
|
||||
items.add(new BottomSheetItemWithDescription.Builder()
|
||||
.setDescription(description)
|
||||
.setDescription(getString(R.string.track_recording_description))
|
||||
.setDescriptionColorId(getPrimaryTextColorId(nightMode))
|
||||
.setTitle(app.getString(R.string.track_recording_title))
|
||||
.setLayoutId(R.layout.bottom_sheet_item_title_with_description)
|
||||
|
@ -68,8 +65,14 @@ public class TripRecordingDiscardBottomFragment extends MenuBottomSheetDialogFra
|
|||
}
|
||||
app.getSavingTrackHelper().clearRecordedData(true);
|
||||
dismiss();
|
||||
dismissTargetDialog(TripRecordingDiscardBottomFragment.this,
|
||||
TripRecordingOptionsBottomFragment.class, ACTION_STOP_AND_DISCARD, true);
|
||||
|
||||
Fragment target = getTargetFragment();
|
||||
if (target != null) {
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean(ACTION_STOP_AND_DISMISS, true);
|
||||
target.setArguments(args);
|
||||
}
|
||||
dismissTarget();
|
||||
}
|
||||
})
|
||||
.create());
|
||||
|
@ -111,6 +114,14 @@ public class TripRecordingDiscardBottomFragment extends MenuBottomSheetDialogFra
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismissTarget() {
|
||||
Fragment target = getTargetFragment();
|
||||
if (target instanceof TripRecordingOptionsBottomFragment) {
|
||||
((TripRecordingOptionsBottomFragment) target).dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hideButtonsContainer() {
|
||||
return true;
|
||||
|
|
|
@ -11,7 +11,6 @@ import android.view.View;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
|
@ -36,11 +35,10 @@ import net.osmand.util.Algorithms;
|
|||
|
||||
import static net.osmand.AndroidUtils.getPrimaryTextColorId;
|
||||
|
||||
public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFragment {
|
||||
public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFragment implements TripRecordingBottomFragment.DismissTargetFragment {
|
||||
|
||||
public static final String TAG = TripRecordingOptionsBottomFragment.class.getSimpleName();
|
||||
public static final String ACTION_STOP_AND_DISCARD = "action_stop_and_discard";
|
||||
private static final String SAVE_CURRENT_GPX_FILE = "save_current_gpx_file";
|
||||
public static final String ACTION_STOP_AND_DISMISS = "action_stop_and_discard";
|
||||
private static final int SAVE_UPDATE_INTERVAL = 1000;
|
||||
|
||||
private OsmandApplication app;
|
||||
|
@ -72,11 +70,10 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra
|
|||
return settings.SAVE_GLOBAL_TRACK_TO_GPX.get();
|
||||
}
|
||||
|
||||
public static void showInstance(@NonNull FragmentManager fragmentManager, @NonNull Fragment target, SelectedGpxFile selectedGpxFile) {
|
||||
public static void showInstance(@NonNull FragmentManager fragmentManager, @NonNull Fragment target) {
|
||||
if (!fragmentManager.isStateSaved()) {
|
||||
TripRecordingOptionsBottomFragment fragment = new TripRecordingOptionsBottomFragment();
|
||||
fragment.setTargetFragment(target, 0);
|
||||
fragment.setSelectedGpxFile(selectedGpxFile);
|
||||
fragment.show(fragmentManager, TAG);
|
||||
}
|
||||
}
|
||||
|
@ -86,18 +83,12 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra
|
|||
app = requiredMyApplication();
|
||||
settings = app.getSettings();
|
||||
helper = app.getSavingTrackHelper();
|
||||
selectedGpxFile = helper.getCurrentTrack();
|
||||
LayoutInflater inflater = UiUtilities.getInflater(app, nightMode);
|
||||
final FragmentManager fragmentManager = getFragmentManager();
|
||||
int dp16 = getResources().getDimensionPixelSize(R.dimen.content_padding);
|
||||
int dp36 = getResources().getDimensionPixelSize(R.dimen.context_menu_controller_height);
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
if (savedInstanceState.containsKey(SAVE_CURRENT_GPX_FILE)
|
||||
&& savedInstanceState.getBoolean(SAVE_CURRENT_GPX_FILE)) {
|
||||
selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack();
|
||||
}
|
||||
}
|
||||
|
||||
buttonClear = createItem(inflater, ItemType.CLEAR_DATA, hasDataToSave());
|
||||
final View buttonDiscard = createItem(inflater, ItemType.STOP_AND_DISCARD);
|
||||
final View buttonOnline = createItem(inflater, ItemType.STOP_ONLINE, hasDataToSave());
|
||||
|
@ -193,12 +184,6 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putBoolean(SAVE_CURRENT_GPX_FILE, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
@ -213,14 +198,7 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra
|
|||
public void onPause() {
|
||||
super.onPause();
|
||||
stopUpdatingTimeTrackSaved();
|
||||
Fragment target = getTargetFragment();
|
||||
if (target instanceof TripRecordingBottomFragment) {
|
||||
if (isDiscard()) {
|
||||
((TripRecordingBottomFragment) target).dismiss();
|
||||
} else {
|
||||
((TripRecordingBottomFragment) target).show();
|
||||
}
|
||||
}
|
||||
dismissTarget();
|
||||
}
|
||||
|
||||
public void show() {
|
||||
|
@ -237,32 +215,6 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isDiscard() {
|
||||
Bundle args = getArguments();
|
||||
if (args != null) {
|
||||
return args.getBoolean(ACTION_STOP_AND_DISCARD);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static void dismissTargetDialog(Fragment current, Class<?> targetClass) {
|
||||
dismissTargetDialog(current, targetClass, null, null);
|
||||
}
|
||||
|
||||
protected static void dismissTargetDialog(Fragment current, Class<?> targetClass, String booleanKey, Boolean value) {
|
||||
if (targetClass.isInstance(current.getTargetFragment())) {
|
||||
Fragment target = current.getTargetFragment();
|
||||
if (booleanKey != null && value != null) {
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean(booleanKey, value);
|
||||
target.setArguments(args);
|
||||
}
|
||||
if (target instanceof DialogFragment) {
|
||||
((DialogFragment) target).dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void stopUpdatingTimeTrackSaved() {
|
||||
handler.removeCallbacks(updatingTimeTrackSaved);
|
||||
}
|
||||
|
@ -312,17 +264,37 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra
|
|||
OsmandMonitoringPlugin plugin = OsmandPlugin.getPlugin(OsmandMonitoringPlugin.class);
|
||||
if (mapActivity != null && plugin != null) {
|
||||
stopUpdatingTimeTrackSaved();
|
||||
settings.SAVE_GLOBAL_TRACK_TO_GPX.set(false);
|
||||
plugin.saveCurrentTrack(null, mapActivity, false, true);
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean(ACTION_STOP_AND_DISMISS, true);
|
||||
setArguments(args);
|
||||
dismiss();
|
||||
dismissTargetDialog(TripRecordingOptionsBottomFragment.this, TripRecordingBottomFragment.class);
|
||||
settings.SAVE_GLOBAL_TRACK_TO_GPX.set(true);
|
||||
runUpdatingTimeTrackSaved();
|
||||
dismissTarget();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private boolean isDiscard() {
|
||||
Bundle args = getArguments();
|
||||
if (args != null) {
|
||||
return args.getBoolean(ACTION_STOP_AND_DISMISS);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismissTarget() {
|
||||
Fragment target = getTargetFragment();
|
||||
if (target instanceof TripRecordingBottomFragment) {
|
||||
if (isDiscard()) {
|
||||
((TripRecordingBottomFragment) target).dismiss();
|
||||
} else {
|
||||
((TripRecordingBottomFragment) target).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public MapActivity getMapActivity() {
|
||||
Activity activity = getActivity();
|
||||
|
@ -346,5 +318,4 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra
|
|||
protected boolean useVerticalButtons() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -219,19 +219,13 @@ public class TripRecordingStartingBottomFragment extends MenuBottomSheetDialogFr
|
|||
dismiss();
|
||||
}
|
||||
|
||||
public void show(String... keys) {
|
||||
public void show() {
|
||||
Dialog dialog = getDialog();
|
||||
if (dialog != null) {
|
||||
dialog.show();
|
||||
for (String key : keys) {
|
||||
if (key.equals(UPDATE_TRACK_ICON)) {
|
||||
updateTrackIcon(app, trackAppearanceIcon);
|
||||
}
|
||||
if (key.equals(UPDATE_LOGGING_INTERVAL)) {
|
||||
updateIntervalValue();
|
||||
AndroidUiHelper.updateVisibility(intervalContainer, infoExpanded);
|
||||
}
|
||||
}
|
||||
updateTrackIcon(app, trackAppearanceIcon);
|
||||
updateIntervalValue();
|
||||
AndroidUiHelper.updateVisibility(intervalContainer, infoExpanded);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -399,7 +399,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
|||
public void onContextMenuDismiss(@NonNull ContextMenuFragment fragment) {
|
||||
Fragment target = getTargetFragment();
|
||||
if (target instanceof TripRecordingStartingBottomFragment) {
|
||||
((TripRecordingStartingBottomFragment) target).show(UPDATE_TRACK_ICON);
|
||||
((TripRecordingStartingBottomFragment) target).show();
|
||||
} else if (target instanceof TripRecordingBottomFragment) {
|
||||
((TripRecordingBottomFragment) target).show(UPDATE_TRACK_ICON);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue