Search in sources :

Example 1 with DividerSpaceItem

use of net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem in project Osmand by osmandapp.

the class TripRecordingClearDataBottomSheet method createMenuItems.

@Override
public void createMenuItems(Bundle savedInstanceState) {
    app = requiredMyApplication();
    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.clear_recorded_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);
    items.add(new BottomSheetItemWithDescription.Builder().setDescription(description).setDescriptionColorId(ColorUtilities.getPrimaryTextColorId(nightMode)).setTitle(app.getString(R.string.clear_recorded_data)).setLayoutId(R.layout.bottom_sheet_item_title_with_description).create());
    items.add(new DividerSpaceItem(app, verticalBig));
    items.add(new BaseBottomSheetItem.Builder().setCustomView(buttonClear).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            app.getSavingTrackHelper().clearRecordedData(true);
            dismiss();
            dismissTarget();
        }
    }).create());
    items.add(new DividerSpaceItem(app, verticalBig));
    items.add(new BaseBottomSheetItem.Builder().setCustomView(buttonCancel).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            dismiss();
        }
    }).create());
    items.add(new DividerSpaceItem(app, verticalNormal));
}
Also used : LayoutInflater(android.view.LayoutInflater) DividerSpaceItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem) View(android.view.View)

Example 2 with DividerSpaceItem

use of net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem in project Osmand by osmandapp.

the class AddPhotosBottomSheetDialogFragment method createMenuItems.

@Override
public void createMenuItems(Bundle savedInstanceState) {
    OsmandApplication app = getMyApplication();
    if (app == null) {
        return;
    }
    View view = View.inflate(UiUtilities.getThemedContext(app, nightMode), R.layout.opr_add_photo, null);
    setDescriptionSpan(view);
    items.add(new SimpleBottomSheetItem.Builder().setCustomView(view).create());
    items.add(new DividerSpaceItem(app, app.getResources().getDimensionPixelSize(R.dimen.text_margin_small)));
}
Also used : SimpleBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem) OsmandApplication(net.osmand.plus.OsmandApplication) DividerSpaceItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem) TextView(android.widget.TextView) View(android.view.View)

Example 3 with DividerSpaceItem

use of net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem in project Osmand by osmandapp.

the class TripRecordingDiscardBottomSheet method createMenuItems.

@Override
public void createMenuItems(Bundle savedInstanceState) {
    app = requiredMyApplication();
    final OsmandMonitoringPlugin plugin = OsmandPlugin.getPlugin(OsmandMonitoringPlugin.class);
    LayoutInflater inflater = UiUtilities.getInflater(app, nightMode);
    int verticalBig = getResources().getDimensionPixelSize(R.dimen.dialog_content_margin);
    int verticalNormal = getResources().getDimensionPixelSize(R.dimen.content_padding);
    final View buttonDiscard = createItem(inflater, ItemType.STOP);
    final View buttonCancel = createItem(inflater, ItemType.CANCEL);
    items.add(new BottomSheetItemWithDescription.Builder().setDescription(getString(R.string.track_recording_description)).setDescriptionColorId(ColorUtilities.getPrimaryTextColorId(nightMode)).setTitle(app.getString(R.string.track_recording_stop_without_saving)).setLayoutId(R.layout.bottom_sheet_item_title_with_description).create());
    items.add(new DividerSpaceItem(app, verticalBig));
    items.add(new BaseBottomSheetItem.Builder().setCustomView(buttonDiscard).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (plugin != null && app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get()) {
                plugin.stopRecording();
                app.getNotificationHelper().refreshNotifications();
            }
            app.getSavingTrackHelper().clearRecordedData(true);
            dismiss();
            Fragment target = getTargetFragment();
            if (target instanceof TripRecordingOptionsBottomSheet) {
                Bundle args = target.getArguments();
                if (args != null) {
                    args.putBoolean(ACTION_STOP_AND_DISMISS, true);
                } else {
                    args = new Bundle();
                    args.putBoolean(ACTION_STOP_AND_DISMISS, true);
                    target.setArguments(args);
                }
            }
            dismissTarget();
        }
    }).create());
    items.add(new DividerSpaceItem(app, verticalBig));
    items.add(new BaseBottomSheetItem.Builder().setCustomView(buttonCancel).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            dismiss();
        }
    }).create());
    items.add(new DividerSpaceItem(app, verticalNormal));
}
Also used : Bundle(android.os.Bundle) LayoutInflater(android.view.LayoutInflater) DividerSpaceItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem) View(android.view.View) Fragment(androidx.fragment.app.Fragment) MenuBottomSheetDialogFragment(net.osmand.plus.base.MenuBottomSheetDialogFragment) DismissTargetFragment(net.osmand.plus.plugins.monitoring.TripRecordingBottomSheet.DismissTargetFragment)

Example 4 with DividerSpaceItem

use of net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem in project Osmand by osmandapp.

the class SelectWikiLanguagesBottomSheet method createMenuItems.

@Override
public void createMenuItems(Bundle savedInstanceState) {
    final int activeColorResId = ColorUtilities.getActiveColorId(nightMode);
    final int profileColor = appMode.getProfileColor(nightMode);
    final int contentPadding = app.getResources().getDimensionPixelSize(R.dimen.content_padding);
    final int contentPaddingSmall = app.getResources().getDimensionPixelSize(R.dimen.content_padding_small);
    final int contentPaddingHalf = app.getResources().getDimensionPixelSize(R.dimen.content_padding_half);
    items.add(new TitleItem(getString(R.string.shared_string_languages)));
    items.add(new LongDescriptionItem(getString(R.string.some_articles_may_not_available_in_lang)));
    items.add(new DividerSpaceItem(app, contentPadding));
    items.add(new LongDescriptionItem(getString(R.string.select_wikipedia_article_langs)));
    items.add(new DividerSpaceItem(app, contentPaddingSmall));
    final BottomSheetItemWithCompoundButton[] btnSelectAll = new BottomSheetItemWithCompoundButton[1];
    btnSelectAll[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder().setChecked(this.isGlobalWikiPoiEnabled).setCompoundButtonColor(profileColor).setTitle(getString(R.string.shared_string_all_languages)).setTitleColorId(activeColorResId).setCustomView(getCustomButtonView()).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            isGlobalWikiPoiEnabled = !isGlobalWikiPoiEnabled;
            btnSelectAll[0].setChecked(isGlobalWikiPoiEnabled);
            setLanguageListEnable(!isGlobalWikiPoiEnabled);
        }
    }).create();
    items.add(btnSelectAll[0]);
    items.add(new DividerSpaceItem(app, contentPaddingHalf));
    languageItems = new ArrayList<>();
    boolean categoryChanged = false;
    for (final WikiLanguageItem language : languages) {
        if (!categoryChanged && !language.isTopDefined()) {
            categoryChanged = true;
            DividerItem divider = new DividerItem(app);
            divider.setMargins(contentPadding, 0, 0, 0);
            items.add(divider);
        }
        final BottomSheetItemWithCompoundButton[] languageItem = new BottomSheetItemWithCompoundButton[1];
        languageItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder().setChecked(language.isChecked()).setTitle(language.getTitle()).setLayoutId(R.layout.bottom_sheet_item_title_with_checkbox).setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                boolean newValue = !languageItem[0].isChecked();
                languageItem[0].setChecked(newValue);
                language.setChecked(newValue);
            }
        }).create();
        languageItems.add(languageItem[0]);
        items.add(languageItem[0]);
    }
}
Also used : LongDescriptionItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.LongDescriptionItem) TitleItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem) View(android.view.View) DividerSpaceItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem) DividerItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem) BottomSheetItemWithCompoundButton(net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton)

Example 5 with DividerSpaceItem

use of net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem in project Osmand by osmandapp.

the class SkipPointsSelectionBottomSheet method createMenuItems.

@Override
public void createMenuItems(Bundle savedInstanceState) {
    BaseBottomSheetItem titleItem = new BottomSheetItemWithDescription.Builder().setDescription(getString(R.string.points_selection_descr)).setTitle(getString(R.string.are_you_sure)).setLayoutId(R.layout.bottom_sheet_item_title_with_description).create();
    items.add(titleItem);
    Context context = requireContext();
    items.add(new DividerSpaceItem(context, AndroidUtils.dpToPx(context, 12)));
}
Also used : BaseBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem) Context(android.content.Context) DividerSpaceItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem)

Aggregations

DividerSpaceItem (net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem)25 BaseBottomSheetItem (net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem)14 View (android.view.View)12 Context (android.content.Context)8 TitleItem (net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem)8 LayoutInflater (android.view.LayoutInflater)7 TextView (android.widget.TextView)5 BottomSheetItemWithCompoundButton (net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton)5 SimpleBottomSheetItem (net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem)4 ColorStateList (android.content.res.ColorStateList)3 Fragment (androidx.fragment.app.Fragment)3 BottomSheetItemWithDescription (net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription)3 ShortDescriptionItem (net.osmand.plus.base.bottomsheetmenu.simpleitems.ShortDescriptionItem)3 SuppressLint (android.annotation.SuppressLint)2 Bundle (android.os.Bundle)2 Editable (android.text.Editable)2 SpannableString (android.text.SpannableString)2 TextWatcher (android.text.TextWatcher)2 LinearLayout (android.widget.LinearLayout)2 Slider (com.google.android.material.slider.Slider)2