Search in sources :

Example 1 with TrackMenuFragment

use of net.osmand.plus.track.fragments.TrackMenuFragment in project Osmand by osmandapp.

the class EditTrackGroupDialogFragment method createShowOnMapItem.

private BaseBottomSheetItem createShowOnMapItem(final SelectedGpxFile selectedGpxFile) {
    boolean checked = !selectedGpxFile.isGroupHidden(group.getName());
    final ApplicationMode mode = app.getSettings().getApplicationMode();
    final BottomSheetItemWithCompoundButton[] showOnMapItem = new BottomSheetItemWithCompoundButton[1];
    showOnMapItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder().setCompoundButtonColor(mode.getProfileColor(nightMode)).setChecked(checked).setTitle(getString(R.string.shared_string_show_on_map)).setCustomView(getCustomButtonView(app, mode, checked, nightMode)).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean checked = !showOnMapItem[0].isChecked();
            if (checked) {
                selectedGpxFile.removeHiddenGroups(group.getName());
            } else {
                selectedGpxFile.addHiddenGroups(group.getName());
            }
            app.getSelectedGpxHelper().updateSelectedGpxFile(selectedGpxFile);
            showOnMapItem[0].setChecked(checked);
            updateCustomButtonView(app, mode, v, checked, nightMode);
            FragmentActivity activity = getActivity();
            if (activity instanceof MapActivity) {
                ((MapActivity) activity).refreshMap();
            }
            Fragment fragment = getTargetFragment();
            if (fragment instanceof TrackMenuFragment) {
                ((TrackMenuFragment) fragment).updateContent();
            }
        }
    }).create();
    return showOnMapItem[0];
}
Also used : FragmentActivity(androidx.fragment.app.FragmentActivity) TrackMenuFragment(net.osmand.plus.track.fragments.TrackMenuFragment) ApplicationMode(net.osmand.plus.settings.backend.ApplicationMode) ImageView(android.widget.ImageView) View(android.view.View) BooleanPreferenceBottomSheet.updateCustomButtonView(net.osmand.plus.settings.bottomsheets.BooleanPreferenceBottomSheet.updateCustomButtonView) AdapterView(android.widget.AdapterView) BooleanPreferenceBottomSheet.getCustomButtonView(net.osmand.plus.settings.bottomsheets.BooleanPreferenceBottomSheet.getCustomButtonView) TrackMenuFragment(net.osmand.plus.track.fragments.TrackMenuFragment) Fragment(androidx.fragment.app.Fragment) MenuBottomSheetDialogFragment(net.osmand.plus.base.MenuBottomSheetDialogFragment) BottomSheetItemWithCompoundButton(net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton) MapActivity(net.osmand.plus.activities.MapActivity)

Example 2 with TrackMenuFragment

use of net.osmand.plus.track.fragments.TrackMenuFragment in project Osmand by osmandapp.

the class AddGpxPointBottomSheetHelper method onClose.

private void onClose() {
    TrackMenuFragment fragment = mapActivity.getTrackMenuFragment();
    if (fragment != null) {
        fragment.updateContent();
        fragment.show();
    } else {
        TrackMenuFragment.openTrack(mapActivity, new File(newGpxPoint.getGpx().path), null);
    }
}
Also used : TrackMenuFragment(net.osmand.plus.track.fragments.TrackMenuFragment) GPXFile(net.osmand.GPXUtilities.GPXFile) File(java.io.File)

Example 3 with TrackMenuFragment

use of net.osmand.plus.track.fragments.TrackMenuFragment in project Osmand by osmandapp.

the class MapActivity method shouldHideTopControls.

public boolean shouldHideTopControls() {
    boolean hideTopControls = !mapContextMenu.shouldShowTopControls();
    TrackMenuFragment fragment = getTrackMenuFragment();
    if (fragment != null) {
        hideTopControls = hideTopControls || !fragment.shouldShowTopControls();
    }
    return hideTopControls;
}
Also used : TrackMenuFragment(net.osmand.plus.track.fragments.TrackMenuFragment)

Example 4 with TrackMenuFragment

use of net.osmand.plus.track.fragments.TrackMenuFragment in project Osmand by osmandapp.

the class UpdateGpxCategoryTask method onPostExecute.

@Override
protected void onPostExecute(Void aVoid) {
    GPXFile gpxFile = group.getGpx();
    if (gpxFile != null && wasUpdated) {
        syncGpx(gpxFile);
    }
    if (progressDialog != null && progressDialog.isShowing()) {
        progressDialog.dismiss();
    }
    FragmentActivity activity = activityRef.get();
    if (activity instanceof MapActivity) {
        MapActivity mapActivity = (MapActivity) activity;
        TrackMenuFragment fragment = mapActivity.getTrackMenuFragment();
        if (fragment != null) {
            fragment.updateContent();
        }
    }
}
Also used : FragmentActivity(androidx.fragment.app.FragmentActivity) TrackMenuFragment(net.osmand.plus.track.fragments.TrackMenuFragment) GPXFile(net.osmand.GPXUtilities.GPXFile) MapActivity(net.osmand.plus.activities.MapActivity)

Example 5 with TrackMenuFragment

use of net.osmand.plus.track.fragments.TrackMenuFragment in project Osmand by osmandapp.

the class EditTrackGroupDialogFragment method onPointsDeleted.

@Override
public void onPointsDeleted() {
    Fragment fragment = getTargetFragment();
    if (fragment instanceof TrackMenuFragment) {
        ((TrackMenuFragment) fragment).updateContent();
    }
    dismiss();
}
Also used : TrackMenuFragment(net.osmand.plus.track.fragments.TrackMenuFragment) TrackMenuFragment(net.osmand.plus.track.fragments.TrackMenuFragment) Fragment(androidx.fragment.app.Fragment) MenuBottomSheetDialogFragment(net.osmand.plus.base.MenuBottomSheetDialogFragment)

Aggregations

TrackMenuFragment (net.osmand.plus.track.fragments.TrackMenuFragment)5 Fragment (androidx.fragment.app.Fragment)2 FragmentActivity (androidx.fragment.app.FragmentActivity)2 GPXFile (net.osmand.GPXUtilities.GPXFile)2 MapActivity (net.osmand.plus.activities.MapActivity)2 MenuBottomSheetDialogFragment (net.osmand.plus.base.MenuBottomSheetDialogFragment)2 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 File (java.io.File)1 BottomSheetItemWithCompoundButton (net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton)1 ApplicationMode (net.osmand.plus.settings.backend.ApplicationMode)1 BooleanPreferenceBottomSheet.getCustomButtonView (net.osmand.plus.settings.bottomsheets.BooleanPreferenceBottomSheet.getCustomButtonView)1 BooleanPreferenceBottomSheet.updateCustomButtonView (net.osmand.plus.settings.bottomsheets.BooleanPreferenceBottomSheet.updateCustomButtonView)1