use of net.osmand.plus.base.bottomsheetmenu.simpleitems.LongDescriptionItem in project Osmand by osmandapp.
the class SendAnalyticsBottomSheetDialogFragment method createMenuItems.
@Override
public void createMenuItems(Bundle savedInstanceState) {
OsmandApplication app = getMyApplication();
Context context = getContext();
if (context == null || app == null) {
return;
}
final View titleView = View.inflate(new ContextThemeWrapper(context, themeRes), R.layout.make_better_title, null);
final SimpleBottomSheetItem titleItem = (SimpleBottomSheetItem) new SimpleBottomSheetItem.Builder().setCustomView(titleView).create();
items.add(titleItem);
items.add(new SubtitleDividerItem(context));
if (app.getSettings().SEND_ANONYMOUS_MAP_DOWNLOADS_DATA.isSet()) {
sendAnonymousMapDownloadsData = app.getSettings().SEND_ANONYMOUS_MAP_DOWNLOADS_DATA.get();
} else {
sendAnonymousMapDownloadsData = true;
}
if (app.getSettings().SEND_ANONYMOUS_APP_USAGE_DATA.isSet()) {
sendAnonymousAppUsageData = app.getSettings().SEND_ANONYMOUS_APP_USAGE_DATA.get();
} else {
sendAnonymousAppUsageData = true;
}
final BottomSheetItemWithCompoundButton[] downloadedMapsItem = new BottomSheetItemWithCompoundButton[1];
downloadedMapsItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder().setChecked(sendAnonymousMapDownloadsData).setTitle(getString(R.string.downloaded_maps)).setLayoutId(R.layout.bottom_sheet_item_with_switch_no_icon).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean checked = !downloadedMapsItem[0].isChecked();
downloadedMapsItem[0].setChecked(checked);
sendAnonymousMapDownloadsData = checked;
updateBottomButtons();
}
}).setTag("downloaded_maps").create();
items.add(downloadedMapsItem[0]);
items.add(new LongDescriptionItem(getString(R.string.downloaded_maps_collect_descr)));
items.add(new SubtitmeListDividerItem(context));
final BottomSheetItemWithCompoundButton[] visitedScreensItem = new BottomSheetItemWithCompoundButton[1];
visitedScreensItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder().setChecked(sendAnonymousAppUsageData).setTitle(getString(R.string.visited_screens)).setLayoutId(R.layout.bottom_sheet_item_with_switch_no_icon).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean checked = !visitedScreensItem[0].isChecked();
visitedScreensItem[0].setChecked(checked);
sendAnonymousAppUsageData = checked;
updateBottomButtons();
}
}).setTag("visited_screens").create();
items.add(visitedScreensItem[0]);
items.add(new LongDescriptionItem(getString(R.string.visited_screens_collect_descr)));
items.add(new DividerItem(context));
String privacyPolicyText = getString(R.string.shared_string_privacy_policy);
String text = getString(R.string.privacy_and_security_change_descr, privacyPolicyText);
SpannableString spannable = new SpannableString(text);
int start = text.indexOf(privacyPolicyText);
int end = start + privacyPolicyText.length();
spannable.setSpan(new URLSpan(OsmandApplication.OSMAND_PRIVACY_POLICY_URL) {
@Override
public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
}
}, start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
int linkTextColor = ContextCompat.getColor(context, !nightMode ? R.color.ctx_menu_bottom_view_url_color_light : R.color.ctx_menu_bottom_view_url_color_dark);
spannable.setSpan(new ForegroundColorSpan(linkTextColor), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
LongDescriptionItem descriptionItem = new LongDescriptionItem(spannable);
descriptionItem.setDescriptionLinksClickable(true);
items.add(descriptionItem);
}
use of net.osmand.plus.base.bottomsheetmenu.simpleitems.LongDescriptionItem in project Osmand by osmandapp.
the class SpeedCamerasUninstallRestartBottomSheet method createMenuItems.
@Override
public void createMenuItems(Bundle savedInstanceState) {
items.add(new TitleItem(getString(R.string.uninstall_speed_cameras)));
items.add(new LongDescriptionItem(getString(R.string.speed_cameras_restart_descr)));
}
use of net.osmand.plus.base.bottomsheetmenu.simpleitems.LongDescriptionItem in project Osmand by osmandapp.
the class AllocatedRoutingMemoryBottomSheet method createMenuItems.
@Override
public void createMenuItems(Bundle savedInstanceState) {
LayoutInflater inflater = UiUtilities.getInflater(getContext(), nightMode);
String title = getString(R.string.memory_allocated_for_routing);
items.add(new TitleItem(title));
String description = getString(R.string.memory_allocated_for_routing_ds);
items.add(new LongDescriptionItem(description));
View view = inflater.inflate(R.layout.bottom_sheet_allocated_routing_memory, null);
items.add(new BaseBottomSheetItem.Builder().setCustomView(view).create());
sliderContainer = view.findViewById(R.id.slider_container);
setupSliderView(sliderContainer);
View buttonView = view.findViewById(R.id.button_container);
setupResetButton(buttonView);
}
use of net.osmand.plus.base.bottomsheetmenu.simpleitems.LongDescriptionItem in project Osmand by osmandapp.
the class SelectBaseProfileBottomSheet method createMenuItems.
@Override
public void createMenuItems(Bundle savedInstanceState) {
items.add(new TitleItem(getString(R.string.select_base_profile_dialog_title)));
items.add(new LongDescriptionItem(getString(R.string.select_base_profile_dialog_message)));
for (int i = 0; i < profiles.size(); i++) {
addProfileItem(profiles.get(i));
}
}
use of net.osmand.plus.base.bottomsheetmenu.simpleitems.LongDescriptionItem in project Osmand by osmandapp.
the class SelectDefaultProfileBottomSheet method createMenuItems.
@Override
public void createMenuItems(@Nullable Bundle savedInstanceState) {
items.add(new TitleItem(getString(R.string.settings_preset)));
items.add(new LongDescriptionItem(getString(R.string.profile_by_default_description)));
boolean useLastAppModeByDefault = app.getSettings().USE_LAST_APPLICATION_MODE_BY_DEFAULT.get();
addCheckableItem(R.string.shared_string_last_used, useLastAppModeByDefault, new OnClickListener() {
@Override
public void onClick(View v) {
Bundle args = new Bundle();
args.putBoolean(USE_LAST_PROFILE_ARG, true);
Fragment target = getTargetFragment();
if (target instanceof OnSelectProfileCallback) {
((OnSelectProfileCallback) target).onProfileSelected(args);
}
dismiss();
}
});
items.add(new SimpleDividerItem(app));
for (int i = 0; i < profiles.size(); i++) {
addProfileItem(profiles.get(i));
}
}
Aggregations