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));
}
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)));
}
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));
}
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]);
}
}
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)));
}
Aggregations