Search in sources :

Example 16 with DividerSpaceItem

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

the class ExitImportBottomSheet method createMenuItems.

@Override
public void createMenuItems(Bundle savedInstanceState) {
    BaseBottomSheetItem titleItem = new BottomSheetItemWithDescription.Builder().setDescription(getString(R.string.exit_import_descr)).setTitle(getString(R.string.exit_import)).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)

Example 17 with DividerSpaceItem

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

the class SelectTrackDirectoryBottomSheet method createMenuItems.

@Override
public void createMenuItems(Bundle savedInstanceState) {
    LayoutInflater inflater = UiUtilities.getInflater(requireContext(), nightMode);
    BaseBottomSheetItem titleItem = new BottomSheetItemWithDescription.Builder().setDescription(getString(R.string.select_category_descr)).setTitle(getString(R.string.all_groups)).setLayoutId(R.layout.bottom_sheet_item_title_with_description).create();
    items.add(titleItem);
    items.add(new DividerSpaceItem(app, AndroidUtils.dpToPx(app, 12)));
    createAddFolderItem(inflater);
    items.add(new SimpleDividerItem(app));
    createFoldersItem(inflater);
}
Also used : BaseBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem) SimpleDividerItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.SimpleDividerItem) LayoutInflater(android.view.LayoutInflater) DividerSpaceItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem)

Example 18 with DividerSpaceItem

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

the class ClearTypesBottomSheet method createMenuItems.

@Override
public void createMenuItems(Bundle savedInstanceState) {
    items.add(new SimpleBottomSheetItem.Builder().setTitle(getString(clearType.titleId)).setLayoutId(R.layout.bottom_sheet_item_title).create());
    items.add(new LongDescriptionItem.Builder().setDescription(getString(clearType.descriptionId)).setLayoutId(R.layout.bottom_sheet_item_description_long).create());
    items.add(new DividerSpaceItem(getContext(), getResources().getDimensionPixelSize(R.dimen.content_padding_small)));
}
Also used : DividerSpaceItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem)

Example 19 with DividerSpaceItem

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

the class DeleteProgressBottomSheet method createMenuItems.

@Override
public void createMenuItems(Bundle savedInstanceState) {
    items.add(new TitleItem(getString(deletionFinished ? R.string.backup_deleted_all_data : R.string.backup_deleting_all_data)));
    if (!deletionFinished) {
        items.add(createProgressItem());
    }
    int descriptionId = deletionFinished ? R.string.backup_deleted_all_data_descr : R.string.backup_deleting_all_data_descr;
    BaseBottomSheetItem descriptionItem = new SimpleBottomSheetItem.Builder().setTitle(getString(descriptionId)).setTitleColorId(ColorUtilities.getSecondaryTextColorId(nightMode)).setLayoutId(R.layout.bottom_sheet_item_title_long).create();
    items.add(descriptionItem);
    int padding = getResources().getDimensionPixelSize(R.dimen.content_padding_small);
    items.add(new DividerSpaceItem(requireContext(), padding));
}
Also used : BaseBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem) TitleItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem) DividerSpaceItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem) SuppressLint(android.annotation.SuppressLint)

Example 20 with DividerSpaceItem

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

the class SaveAsNewTrackBottomSheetDialogFragment method createMenuItems.

@Override
public void createMenuItems(Bundle savedInstanceState) {
    app = getMyApplication();
    if (app == null) {
        return;
    }
    Context themedCtx = UiUtilities.getThemedContext(app, nightMode);
    int highlightColorId = nightMode ? R.color.list_background_color_dark : R.color.activity_background_color_light;
    if (savedInstanceState != null) {
        showOnMap = savedInstanceState.getBoolean(SHOW_ON_MAP_KEY);
        simplifiedTrack = savedInstanceState.getBoolean(SIMPLIFIED_TRACK_KEY);
        folderName = savedInstanceState.getString(DEST_FOLDER_NAME_KEY);
        destFileName = savedInstanceState.getString(DEST_FILE_NAME_KEY);
        sourceFileName = savedInstanceState.getString(SOURCE_FILE_NAME_KEY);
        sourceFolderName = savedInstanceState.getString(SOURCE_FOLDER_NAME_KEY);
        showSimplifiedButton = savedInstanceState.getBoolean(SHOW_SIMPLIFIED_BUTTON_KEY);
    } else {
        folderName = app.getAppPath(IndexConstants.GPX_INDEX_DIR).getName();
    }
    items.add(new TitleItem(getString(R.string.save_as_new_track)));
    View editNameView = View.inflate(themedCtx, R.layout.track_name_edit_text, null);
    nameTextBox = editNameView.findViewById(R.id.name_text_box);
    nameTextBox.setBoxBackgroundColorResource(highlightColorId);
    nameTextBox.setHint(AndroidUtils.addColon(app, R.string.shared_string_file_name));
    ColorStateList colorStateList = ColorStateList.valueOf(ColorUtilities.getSecondaryTextColor(app, nightMode));
    nameTextBox.setDefaultHintTextColor(colorStateList);
    TextInputEditText nameText = editNameView.findViewById(R.id.name_edit_text);
    nameText.setText(destFileName);
    nameText.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            updateFileNameFromEditText(s.toString());
        }
    });
    BaseBottomSheetItem editFileName = new BaseBottomSheetItem.Builder().setCustomView(editNameView).create();
    this.items.add(editFileName);
    updateFileNameFromEditText(destFileName);
    int contentPaddingSmall = app.getResources().getDimensionPixelSize(R.dimen.content_padding_small);
    int contentPaddingHalf = app.getResources().getDimensionPixelSize(R.dimen.content_padding_half);
    items.add(new DividerSpaceItem(app, contentPaddingSmall));
    View selectFolderView = View.inflate(themedCtx, R.layout.select_folder_row, null);
    selectFolderView.findViewById(R.id.select_folder_button).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            FragmentActivity activity = getActivity();
            if (activity != null) {
                File dest = getFile(app, folderName, destFileName);
                MoveGpxFileBottomSheet.showInstance(activity.getSupportFragmentManager(), SaveAsNewTrackBottomSheetDialogFragment.this, dest.getAbsolutePath(), usedOnMap, true);
            }
        }
    });
    BaseBottomSheetItem selectFolderItem = new BaseBottomSheetItem.Builder().setCustomView(selectFolderView).create();
    items.add(selectFolderItem);
    adapter = new FolderListAdapter(app, folderName, nightMode);
    adapter.setItems(getAdapterItems());
    if (adapter.getItemCount() > 0) {
        adapter.setListener(createFolderSelectListener());
        View view = View.inflate(themedCtx, R.layout.bottom_sheet_item_recyclerview, null);
        recyclerView = view.findViewById(R.id.recycler_view);
        recyclerView.setPadding(contentPaddingHalf, 0, contentPaddingHalf, 0);
        BaseBottomSheetItem scrollItem = new HorizontalRecyclerBottomSheetItem.Builder().setAdapter(adapter).setCustomView(view).create();
        this.items.add(scrollItem);
        items.add(new DividerSpaceItem(app, app.getResources().getDimensionPixelSize(R.dimen.dialog_content_margin)));
    }
    int activeColorRes = ColorUtilities.getActiveColorId(nightMode);
    if (showSimplifiedButton) {
        final BottomSheetItemWithCompoundButton[] simplifiedTrackItem = new BottomSheetItemWithCompoundButton[1];
        simplifiedTrackItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder().setChecked(simplifiedTrack).setCompoundButtonColorId(activeColorRes).setDescription(getSimplifiedTrackDescription()).setBackground(UiUtilities.getStrokedBackgroundForCompoundButton(app, R.color.activity_background_color_light, R.color.list_background_color_dark, simplifiedTrack, nightMode)).setTitle(getString(R.string.simplified_track)).setLayoutId(R.layout.bottom_sheet_item_with_switch_and_descr).setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                simplifiedTrack = !simplifiedTrack;
                simplifiedTrackItem[0].setChecked(simplifiedTrack);
                AndroidUtils.setBackground(simplifiedTrackItem[0].getView(), UiUtilities.getStrokedBackgroundForCompoundButton(app, R.color.activity_background_color_light, R.color.list_background_color_dark, simplifiedTrack, nightMode));
                simplifiedTrackItem[0].setDescription(getSimplifiedTrackDescription());
            }
        }).create();
        items.add(simplifiedTrackItem[0]);
        items.add(new DividerSpaceItem(app, app.getResources().getDimensionPixelSize(R.dimen.content_padding)));
    }
    final BottomSheetItemWithCompoundButton[] showOnMapItem = new BottomSheetItemWithCompoundButton[1];
    showOnMapItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder().setCompoundButtonColorId(activeColorRes).setChecked(showOnMap).setBackground(UiUtilities.getStrokedBackgroundForCompoundButton(app, R.color.activity_background_color_light, R.color.list_background_color_dark, showOnMap, nightMode)).setTitle(getString(R.string.shared_string_show_on_map)).setLayoutId(R.layout.bottom_sheet_item_with_switch_and_descr).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showOnMap = !showOnMap;
            showOnMapItem[0].setChecked(showOnMap);
            AndroidUtils.setBackground(showOnMapItem[0].getView(), UiUtilities.getStrokedBackgroundForCompoundButton(app, R.color.activity_background_color_light, R.color.list_background_color_dark, showOnMap, nightMode));
        }
    }).create();
    items.add(showOnMapItem[0]);
    items.add(new DividerSpaceItem(app, contentPaddingSmall));
}
Also used : Context(android.content.Context) BaseBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem) FolderListAdapter(net.osmand.plus.measurementtool.adapter.FolderListAdapter) ColorStateList(android.content.res.ColorStateList) TitleItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem) HorizontalRecyclerBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.HorizontalRecyclerBottomSheetItem) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) FragmentActivity(androidx.fragment.app.FragmentActivity) TextInputEditText(com.google.android.material.textfield.TextInputEditText) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) OnClickListener(android.view.View.OnClickListener) DividerSpaceItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem) GPXFile(net.osmand.GPXUtilities.GPXFile) File(java.io.File) BottomSheetItemWithCompoundButton(net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton)

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