Refactoring SRTMf download ui, part 1

This commit is contained in:
nazar-kutz 2021-04-12 20:14:27 +03:00
parent b14f62822b
commit 9368b7383a
9 changed files with 600 additions and 435 deletions

View file

@ -0,0 +1,96 @@
package net.osmand.plus.base;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import net.osmand.AndroidUtils;
import net.osmand.plus.R;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.widgets.MultiStateToggleButton.RadioItem;
import java.util.Collections;
import java.util.List;
public class SelectModeBottomSheet extends SelectionBottomSheet {
public static final String TAG = SelectModeBottomSheet.class.getSimpleName();
private BottomSheetItemWithDescription previewUi;
private List<RadioItem> modes;
private SelectableItem previewItem;
@Override
protected void initHeaderUi() {
radioGroup.setItems(modes);
AndroidUiHelper.setVisibility(View.VISIBLE, secondaryDescription, toggleContainer);
AndroidUiHelper.setVisibility(View.GONE, checkBox, checkBoxTitle,
primaryDescription, selectedSize, selectAllButton);
}
@Override
protected void createSelectionUi() {
previewUi = (BottomSheetItemWithDescription) new BottomSheetItemWithDescription.Builder()
.setDescription(previewItem.getDescription())
.setDescriptionColorId(AndroidUtils.getSecondaryTextColorId(nightMode))
.setTitle(previewItem.getTitle())
.setIcon(uiUtilities.getIcon(previewItem.getIconId(), activeColorRes))
.setTag(previewItem)
.setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp)
.create();
items.add(previewUi);
}
private void updatePreviewUi() {
previewUi.setTitle(previewItem.getTitle());
previewUi.setIcon(uiUtilities.getIcon(previewItem.getIconId(), activeColorRes));
previewUi.setDescription(previewItem.getDescription());
previewUi.setTag(previewItem);
}
private void setModes(@NonNull List<RadioItem> modes) {
this.modes = modes;
}
public void setSelectedMode(@NonNull RadioItem mode) {
radioGroup.setSelectedItem(mode);
}
public void setPreviewItem(@NonNull SelectableItem preview) {
this.previewItem = preview;
if (previewUi != null) {
updatePreviewUi();
}
}
@Override
public void setDescription(@NonNull String description) {
secondaryDescription.setText(description);
}
@NonNull
@Override
public List<SelectableItem> getSelection() {
return Collections.singletonList(previewItem);
}
public static SelectModeBottomSheet showInstance(@NonNull AppCompatActivity activity,
@NonNull SelectableItem previewItem,
@NonNull List<RadioItem> radioItems,
boolean usedOnMap) {
SelectModeBottomSheet fragment = new SelectModeBottomSheet();
fragment.setUsedOnMap(usedOnMap);
fragment.setModes(radioItems);
fragment.setPreviewItem(previewItem);
FragmentManager fm = activity.getSupportFragmentManager();
fragment.show(fm, TAG);
return fragment;
}
}

View file

@ -1,12 +1,7 @@
package net.osmand.plus.base; package net.osmand.plus.base;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -16,22 +11,11 @@ import androidx.core.widget.CompoundButtonCompat;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem; import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton; import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton.Builder; import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton.Builder;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.SimpleDividerItem;
import net.osmand.plus.download.MultipleIndexesUiHelper.SelectedItemsListener;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.widgets.MultiStateToggleButton;
import net.osmand.plus.widgets.MultiStateToggleButton.OnRadioItemClickListener;
import net.osmand.plus.widgets.MultiStateToggleButton.RadioItem;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import net.osmand.view.ThreeStateCheckbox;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -40,180 +24,68 @@ import static net.osmand.view.ThreeStateCheckbox.State.CHECKED;
import static net.osmand.view.ThreeStateCheckbox.State.MISC; import static net.osmand.view.ThreeStateCheckbox.State.MISC;
import static net.osmand.view.ThreeStateCheckbox.State.UNCHECKED; import static net.osmand.view.ThreeStateCheckbox.State.UNCHECKED;
public class SelectMultipleItemsBottomSheet extends MenuBottomSheetDialogFragment { public class SelectMultipleItemsBottomSheet extends SelectionBottomSheet {
public static final String TAG = SelectMultipleItemsBottomSheet.class.getSimpleName(); public static final String TAG = SelectMultipleItemsBottomSheet.class.getSimpleName();
private OsmandApplication app;
private UiUtilities uiUtilities;
private TextView title;
private TextView description;
private TextView applyButtonTitle;
private TextView checkBoxTitle;
private TextView selectedSize;
private ThreeStateCheckbox checkBox;
private int sizeAboveList = 0;
private int activeColorRes;
private int secondaryColorRes;
private String addDescriptionText;
private String leftRadioButtonText;
private String rightRadioButtonText;
private boolean customOptionsVisible;
private boolean leftButtonSelected;
private final List<SelectableItem> allItems = new ArrayList<>(); private final List<SelectableItem> allItems = new ArrayList<>();
private final List<SelectableItem> selectedItems = new ArrayList<>(); private final List<SelectableItem> selectedItems = new ArrayList<>();
private SelectionUpdateListener selectionUpdateListener; private SelectionUpdateListener selectionUpdateListener;
private OnApplySelectionListener onApplySelectionListener;
private OnRadioButtonSelectListener onRadioButtonSelectListener;
private SelectedItemsListener selectedItemsListener;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
View mainView = super.onCreateView(inflater, parent, savedInstanceState);
onSelectedItemsChanged();
return mainView;
}
@Override @Override
public void createMenuItems(Bundle savedInstanceState) { protected void initHeaderUi() {
app = requiredMyApplication(); selectAllButton.setOnClickListener(new View.OnClickListener() {
uiUtilities = app.getUIUtilities(); @Override
activeColorRes = nightMode ? R.color.icon_color_active_dark : R.color.icon_color_active_light; public void onClick(View v) {
secondaryColorRes = nightMode ? R.color.icon_color_secondary_dark : R.color.icon_color_secondary_light; checkBox.performClick();
boolean checked = checkBox.getState() == CHECKED;
items.add(createTitleItem()); if (checked) {
items.add(new SimpleDividerItem(app)); selectedItems.addAll(allItems);
sizeAboveList = items.size(); } else {
createListItems(); selectedItems.clear();
}
@Override
public void onPause() {
super.onPause();
if (requireActivity().isChangingConfigurations()) {
dismiss();
}
}
private BaseBottomSheetItem createTitleItem() {
LayoutInflater themedInflater = UiUtilities.getInflater(requireContext(), nightMode);
View view = themedInflater.inflate(R.layout.settings_group_title, null);
checkBox = view.findViewById(R.id.check_box);
checkBoxTitle = view.findViewById(R.id.check_box_title);
description = view.findViewById(R.id.description);
selectedSize = view.findViewById(R.id.selected_size);
title = view.findViewById(R.id.title);
View selectAllButton = view.findViewById(R.id.select_all_button);
TextView addDescription = view.findViewById(R.id.additional_description);
LinearLayout customRadioButtons = view.findViewById(R.id.custom_radio_buttons);
if (!isMultipleItem()) {
AndroidUiHelper.setVisibility(View.GONE, description, selectedSize, selectAllButton);
} else {
selectAllButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
checkBox.performClick();
boolean checked = checkBox.getState() == CHECKED;
if (checked) {
selectedItems.addAll(allItems);
} else {
selectedItems.clear();
}
onSelectedItemsChanged();
updateItems(checked);
} }
}); onSelectedItemsChanged();
} updateItems(checked);
if (!Algorithms.isEmpty(addDescriptionText)) {
addDescription.setText(addDescriptionText);
AndroidUiHelper.setVisibility(View.VISIBLE, addDescription);
}
if (customOptionsVisible) {
AndroidUiHelper.setVisibility(View.VISIBLE, customRadioButtons);
RadioItem leftRadioButton = new RadioItem(leftRadioButtonText);
RadioItem rightRadioButton = new RadioItem(rightRadioButtonText);
MultiStateToggleButton toggleButtons =
new MultiStateToggleButton(app, customRadioButtons, nightMode);
toggleButtons.setItems(leftRadioButton, rightRadioButton);
toggleButtons.updateView(true);
leftRadioButton.setOnClickListener(new OnRadioItemClickListener() {
@Override
public boolean onRadioItemClick(RadioItem radioItem, View view) {
onRadioButtonSelectListener.onSelect(leftButtonSelected = true);
updateSelectedSizeView();
updateSelectAllButton();
updateApplyButtonEnable();
return true;
}
});
rightRadioButton.setOnClickListener(new OnRadioItemClickListener() {
@Override
public boolean onRadioItemClick(RadioItem radioItem, View view) {
onRadioButtonSelectListener.onSelect(leftButtonSelected = false);
updateSelectedSizeView();
updateSelectAllButton();
updateApplyButtonEnable();
return true;
}
});
toggleButtons.setSelectedItem(leftButtonSelected ? leftRadioButton : rightRadioButton);
}
return new SimpleBottomSheetItem.Builder().setCustomView(view).create();
}
private void createListItems() {
if (isMultipleItem()) {
for (int i = 0; i < allItems.size(); i++) {
final SelectableItem item = allItems.get(i);
boolean checked = selectedItems.contains(item);
final int finalI = i;
items.add(new Builder()
.setChecked(checked)
.setButtonTintList(AndroidUtils.createCheckedColorStateList(app, secondaryColorRes, activeColorRes))
.setDescription(item.description)
.setIcon(uiUtilities.getIcon(item.iconId, activeColorRes))
.setTitle(item.title)
.setLayoutId(R.layout.bottom_sheet_item_with_descr_and_checkbox_56dp)
.setTag(item)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
BottomSheetItemWithCompoundButton item = (BottomSheetItemWithCompoundButton) items.get(finalI + sizeAboveList);
boolean checked = item.isChecked();
item.setChecked(!checked);
SelectableItem tag = (SelectableItem) item.getTag();
if (!checked) {
selectedItems.add(tag);
} else {
selectedItems.remove(tag);
}
onSelectedItemsChanged();
}
})
.create());
} }
} else if (allItems.size() == 1) { });
final SelectableItem item = allItems.get(0); }
items.add(new Builder()
.setDescription(item.description) @Override
.setDescriptionColorId(AndroidUtils.getSecondaryTextColorId(nightMode)) protected void createSelectionUi() {
.setIcon(uiUtilities.getIcon(item.iconId, activeColorRes)) for (final SelectableItem item : allItems) {
.setTitle(item.title) boolean checked = selectedItems.contains(item);
.setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp) final BottomSheetItemWithCompoundButton[] uiItem = new BottomSheetItemWithCompoundButton[1];
.setTag(item) final Builder builder = (BottomSheetItemWithCompoundButton.Builder) new Builder();
.create()); builder.setChecked(checked)
.setButtonTintList(AndroidUtils.createCheckedColorStateList(app, secondaryColorRes, activeColorRes))
.setLayoutId(R.layout.bottom_sheet_item_with_descr_and_checkbox_56dp)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean checked = !uiItem[0].isChecked();
uiItem[0].setChecked(checked);
SelectableItem tag = (SelectableItem) uiItem[0].getTag();
if (checked) {
selectedItems.add(tag);
} else {
selectedItems.remove(tag);
}
onSelectedItemsChanged();
}
})
.setTag(item);
setupListItem(builder, item);
uiItem[0] = builder.create();
items.add(uiItem[0]);
} }
} }
@Override
protected void notifyUiInitialized() {
onSelectedItemsChanged();
super.notifyUiInitialized();
}
private void onSelectedItemsChanged() { private void onSelectedItemsChanged() {
updateSelectAllButton(); updateSelectAllButton();
updateSelectedSizeView(); updateSelectedSizeView();
@ -223,32 +95,38 @@ public class SelectMultipleItemsBottomSheet extends MenuBottomSheetDialogFragmen
} }
} }
private void setupListItem(Builder builder, SelectableItem item) {
builder.setTitle(item.getTitle());
builder.setDescription(item.getDescription());
builder.setIcon(uiUtilities.getIcon(item.getIconId(), activeColorRes));
}
private void updateSelectAllButton() { private void updateSelectAllButton() {
if (isMultipleItem()) { String checkBoxTitle;
String checkBoxTitle; if (Algorithms.isEmpty(selectedItems)) {
if (Algorithms.isEmpty(selectedItems)) { checkBox.setState(UNCHECKED);
checkBox.setState(UNCHECKED); checkBoxTitle = getString(R.string.shared_string_select_all);
checkBoxTitle = getString(R.string.shared_string_select_all); } else {
} else { checkBox.setState(selectedItems.containsAll(allItems) ? CHECKED : MISC);
checkBox.setState(selectedItems.containsAll(allItems) ? CHECKED : MISC); checkBoxTitle = getString(R.string.shared_string_deselect_all);
checkBoxTitle = getString(R.string.shared_string_deselect_all);
}
int checkBoxColor = checkBox.getState() == UNCHECKED ? secondaryColorRes : activeColorRes;
CompoundButtonCompat.setButtonTintList(checkBox, ColorStateList.valueOf(ContextCompat.getColor(app, checkBoxColor)));
this.checkBoxTitle.setText(checkBoxTitle);
} }
int checkBoxColor = checkBox.getState() == UNCHECKED ? secondaryColorRes : activeColorRes;
CompoundButtonCompat.setButtonTintList(checkBox, ColorStateList.valueOf(ContextCompat.getColor(app, checkBoxColor)));
this.checkBoxTitle.setText(checkBoxTitle);
} }
private void updateSelectedSizeView() { private void updateSelectedSizeView() {
if (isMultipleItem()) { String selected = String.valueOf(selectedItems.size());
String selected = String.valueOf(selectedItems.size()); String all = String.valueOf(allItems.size());
String all = String.valueOf(allItems.size()); selectedSize.setText(getString(R.string.ltr_or_rtl_combine_via_slash, selected, all));
selectedSize.setText(getString(R.string.ltr_or_rtl_combine_via_slash, selected, all));
}
} }
private void updateApplyButtonEnable() { private void updateApplyButtonEnable() {
rightButton.setEnabled(!Algorithms.isEmpty(selectedItems)); if (Algorithms.isEmpty(selectedItems)) {
rightButton.setEnabled(false);
} else {
rightButton.setEnabled(true);
}
} }
private void updateItems(boolean checked) { private void updateItems(boolean checked) {
@ -259,127 +137,30 @@ public class SelectMultipleItemsBottomSheet extends MenuBottomSheetDialogFragmen
} }
} }
public void setItems(List<SelectableItem> allItems) { protected void setItems(List<SelectableItem> allItems) {
this.allItems.clear();
if (!Algorithms.isEmpty(allItems)) { if (!Algorithms.isEmpty(allItems)) {
this.allItems.clear();
this.allItems.addAll(allItems); this.allItems.addAll(allItems);
} }
} }
private void setSelectedItems(List<SelectableItem> selected) { protected void setSelectedItems(List<SelectableItem> selected) {
this.selectedItems.clear();
if (!Algorithms.isEmpty(selected)) { if (!Algorithms.isEmpty(selected)) {
/*List<SelectableItem> prevDownloadItems = new ArrayList<>(this.selectedItems); selectedItems.clear();
for (SelectableItem prevDownloadItem : selected) { selectedItems.addAll(selected);
Object object = prevDownloadItem.getObject();
if (object instanceof IndexItem && ((IndexItem) object).isDownloaded()) {
prevDownloadItems.add(prevDownloadItem);
}
}
selected.removeAll(prevDownloadItems);*/
this.selectedItems.addAll(selected);
} }
} }
public void recreateList(List<SelectableItem> allItems) { @NonNull
setItems(allItems); @Override
if (selectedItemsListener != null) { public List<SelectableItem> getSelection() {
setSelectedItems(selectedItemsListener.createSelectedItems(this.allItems, leftButtonSelected));
}
if (items.size() > sizeAboveList) {
for (int i = 0; i < this.allItems.size(); i++) {
SelectableItem item = this.allItems.get(i);
BottomSheetItemWithDescription button = (BottomSheetItemWithDescription) items.get(i + sizeAboveList);
button.setDescription(item.description);
button.setTitle(item.title);
button.setTag(item);
if (isMultipleItem()) {
((BottomSheetItemWithCompoundButton) button).setChecked(selectedItems.contains(item));
}
}
}
}
public boolean isMultipleItem() {
return allItems.size() > 1;
}
public List<SelectableItem> getSelectedItems() {
return selectedItems; return selectedItems;
} }
public void setConfirmButtonTitle(@NonNull String confirmButtonTitle) {
applyButtonTitle.setText(confirmButtonTitle);
}
public void setTitle(@NonNull String title) {
this.title.setText(title);
}
public void setDescription(@NonNull String description) {
this.description.setText(description);
}
public void setAddDescriptionText(String addDescriptionText) {
this.addDescriptionText = addDescriptionText;
}
public void setLeftRadioButtonText(String leftRadioButtonText) {
this.leftRadioButtonText = leftRadioButtonText;
}
public void setRightRadioButtonText(String rightRadioButtonText) {
this.rightRadioButtonText = rightRadioButtonText;
}
public void setCustomOptionsVisible(boolean customOptionsVisible) {
this.customOptionsVisible = customOptionsVisible;
}
public void setLeftButtonSelected(boolean leftButtonSelected) {
this.leftButtonSelected = leftButtonSelected;
}
public void setSelectionUpdateListener(SelectionUpdateListener selectionUpdateListener) { public void setSelectionUpdateListener(SelectionUpdateListener selectionUpdateListener) {
this.selectionUpdateListener = selectionUpdateListener; this.selectionUpdateListener = selectionUpdateListener;
} }
public void setOnApplySelectionListener(OnApplySelectionListener onApplySelectionListener) {
this.onApplySelectionListener = onApplySelectionListener;
}
public void setOnRadioButtonSelectListener(OnRadioButtonSelectListener onRadioButtonSelectListener) {
this.onRadioButtonSelectListener = onRadioButtonSelectListener;
}
public void setSelectedItemsListener(SelectedItemsListener selectedItemsListener) {
this.selectedItemsListener = selectedItemsListener;
}
@Override
protected void setupRightButton() {
super.setupRightButton();
applyButtonTitle = rightButton.findViewById(R.id.button_text);
}
@Override
protected void onRightBottomButtonClick() {
if (onApplySelectionListener != null) {
onApplySelectionListener.onSelectionApplied(selectedItems);
}
dismiss();
}
@Override
protected int getRightBottomButtonTextId() {
return R.string.shared_string_apply;
}
@Override
protected boolean useVerticalButtons() {
return true;
}
public static SelectMultipleItemsBottomSheet showInstance(@NonNull AppCompatActivity activity, public static SelectMultipleItemsBottomSheet showInstance(@NonNull AppCompatActivity activity,
@NonNull List<SelectableItem> items, @NonNull List<SelectableItem> items,
@Nullable List<SelectableItem> selected, @Nullable List<SelectableItem> selected,
@ -393,70 +174,8 @@ public class SelectMultipleItemsBottomSheet extends MenuBottomSheetDialogFragmen
return fragment; return fragment;
} }
public static SelectMultipleItemsBottomSheet showInstance(@NonNull AppCompatActivity activity,
@NonNull List<SelectableItem> items,
@Nullable List<SelectableItem> selected,
boolean usedOnMap,
String addDescription,
boolean customOptionsVisible,
boolean leftButtonSelected,
String leftRadioButtonText,
String rightRadioButtonText) {
SelectMultipleItemsBottomSheet fragment = new SelectMultipleItemsBottomSheet();
fragment.setUsedOnMap(usedOnMap);
fragment.setItems(items);
fragment.setSelectedItems(selected);
fragment.setAddDescriptionText(addDescription);
fragment.setCustomOptionsVisible(customOptionsVisible);
fragment.setLeftButtonSelected(leftButtonSelected);
fragment.setLeftRadioButtonText(leftRadioButtonText);
fragment.setRightRadioButtonText(rightRadioButtonText);
FragmentManager fm = activity.getSupportFragmentManager();
fragment.show(fm, TAG);
return fragment;
}
public interface SelectionUpdateListener { public interface SelectionUpdateListener {
void onSelectionUpdate(); void onSelectionUpdate();
} }
public interface OnApplySelectionListener {
void onSelectionApplied(List<SelectableItem> selectedItems);
}
public interface OnRadioButtonSelectListener {
void onSelect(boolean leftButton);
}
public static class SelectableItem {
private String title;
private String description;
private int iconId;
private Object object;
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public void setIconId(int iconId) {
this.iconId = iconId;
}
public void setObject(Object object) {
this.object = object;
}
public Object getObject() {
return object;
}
}
} }

View file

@ -0,0 +1,51 @@
package net.osmand.plus.base;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.widgets.MultiStateToggleButton.RadioItem;
import java.util.List;
public class SelectMultipleWithModeBottomSheet extends SelectMultipleItemsBottomSheet {
private List<RadioItem> modes;
@Override
protected void initHeaderUi() {
super.initHeaderUi();
radioGroup.setItems(modes);
AndroidUiHelper.setVisibility(View.VISIBLE, secondaryDescription, toggleContainer,
checkBox, checkBoxTitle, primaryDescription, selectedSize, selectAllButton);
}
private void setModes(@NonNull List<RadioItem> modes) {
this.modes = modes;
}
public void setSelectedMode(@NonNull RadioItem mode) {
radioGroup.setSelectedItem(mode);
}
public static SelectMultipleWithModeBottomSheet showInstance(@NonNull AppCompatActivity activity,
@NonNull List<SelectableItem> items,
@Nullable List<SelectableItem> selected,
@NonNull List<RadioItem> modes,
boolean usedOnMap) {
SelectMultipleWithModeBottomSheet fragment = new SelectMultipleWithModeBottomSheet();
fragment.setUsedOnMap(usedOnMap);
fragment.setItems(items);
fragment.setSelectedItems(selected);
fragment.setModes(modes);
FragmentManager fm = activity.getSupportFragmentManager();
fragment.show(fm, TAG);
return fragment;
}
}

View file

@ -0,0 +1,201 @@
package net.osmand.plus.base;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.SimpleDividerItem;
import net.osmand.plus.widgets.MultiStateToggleButton;
import net.osmand.view.ThreeStateCheckbox;
import java.util.List;
public abstract class SelectionBottomSheet extends MenuBottomSheetDialogFragment {
protected OsmandApplication app;
protected UiUtilities uiUtilities;
protected TextView title;
protected TextView primaryDescription;
protected TextView secondaryDescription;
protected TextView selectedSize;
protected LinearLayout toggleContainer;
protected MultiStateToggleButton radioGroup;
protected View selectAllButton;
protected TextView checkBoxTitle;
protected ThreeStateCheckbox checkBox;
protected LinearLayout selectionListView;
protected TextView applyButtonTitle;
protected int activeColorRes;
protected int secondaryColorRes;
private OnUiInitializedListener uiInitializedListener;
private OnApplySelectionListener applySelectionListener;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
View mainView = super.onCreateView(inflater, parent, savedInstanceState);
notifyUiInitialized();
return mainView;
}
@Override
public void createMenuItems(Bundle savedInstanceState) {
app = requiredMyApplication();
uiUtilities = app.getUIUtilities();
activeColorRes = nightMode ? R.color.icon_color_active_dark : R.color.icon_color_active_light;
secondaryColorRes = nightMode ? R.color.icon_color_secondary_dark : R.color.icon_color_secondary_light;
items.add(createHeaderUi());
items.add(new SimpleDividerItem(app));
createSelectionUi();
}
@Override
public void onPause() {
super.onPause();
if (requireActivity().isChangingConfigurations()) {
dismiss();
}
}
private BaseBottomSheetItem createHeaderUi() {
LayoutInflater themedInflater = UiUtilities.getInflater(requireContext(), nightMode);
View view = themedInflater.inflate(R.layout.settings_group_title, null);
title = view.findViewById(R.id.title);
primaryDescription = view.findViewById(R.id.description);
secondaryDescription = view.findViewById(R.id.additional_description);
selectedSize = view.findViewById(R.id.selected_size);
toggleContainer = view.findViewById(R.id.custom_radio_buttons);
radioGroup = new MultiStateToggleButton(app, toggleContainer, nightMode);
selectAllButton = view.findViewById(R.id.select_all_button);
checkBoxTitle = view.findViewById(R.id.check_box_title);
checkBox = view.findViewById(R.id.check_box);
initHeaderUi();
return new SimpleBottomSheetItem.Builder().setCustomView(view).create();
}
protected abstract void createSelectionUi();
protected abstract void initHeaderUi();
@Override
protected void setupRightButton() {
super.setupRightButton();
applyButtonTitle = rightButton.findViewById(R.id.button_text);
}
public void setTitle(@NonNull String title) {
this.title.setText(title);
}
public void setDescription(@NonNull String description) {
this.primaryDescription.setText(description);
}
public void setSecondaryDescription(@NonNull String description) {
this.secondaryDescription.setText(description);
}
public void setApplyButtonTitle(@NonNull String title) {
applyButtonTitle.setText(title);
}
@Override
protected void onRightBottomButtonClick() {
if (applySelectionListener != null) {
applySelectionListener.onSelectionApplied(getSelection());
}
dismiss();
}
@NonNull
public abstract List<SelectableItem> getSelection();
@Override
protected int getRightBottomButtonTextId() {
return R.string.shared_string_apply;
}
public void setUiInitializedListener(OnUiInitializedListener uiInitializedListener) {
this.uiInitializedListener = uiInitializedListener;
}
public void setOnApplySelectionListener(OnApplySelectionListener onApplySelectionListener) {
this.applySelectionListener = onApplySelectionListener;
}
protected void notifyUiInitialized() {
if (uiInitializedListener != null) {
uiInitializedListener.onUiInitialized();
}
}
@Override
protected boolean useVerticalButtons() {
return true;
}
public interface OnUiInitializedListener {
void onUiInitialized();
}
public interface OnApplySelectionListener {
void onSelectionApplied(List<SelectableItem> selectedItems);
}
public static class SelectableItem {
private String title;
private String description;
private int iconId;
private Object object;
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
public int getIconId() {
return iconId;
}
public Object getObject() {
return object;
}
public void setTitle(String title) {
this.title = title;
}
public void setDescription(String description) {
this.description = description;
}
public void setIconId(int iconId) {
this.iconId = iconId;
}
public void setObject(Object object) {
this.object = object;
}
}
}

View file

@ -29,7 +29,7 @@ import java.util.Map;
import static net.osmand.IndexConstants.BINARY_MAP_INDEX_EXT; import static net.osmand.IndexConstants.BINARY_MAP_INDEX_EXT;
import static net.osmand.plus.activities.LocalIndexHelper.LocalIndexType.SRTM_DATA; import static net.osmand.plus.activities.LocalIndexHelper.LocalIndexType.SRTM_DATA;
import static net.osmand.plus.download.MultipleIndexesUiHelper.getSRTMExt; import static net.osmand.plus.download.SelectIndexesUiHelper.getSRTMExt;
public class DownloadActivityType { public class DownloadActivityType {
private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd.MM.yyyy", Locale.US); private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd.MM.yyyy", Locale.US);

View file

@ -12,7 +12,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import static net.osmand.plus.download.DownloadActivityType.SRTM_COUNTRY_FILE; import static net.osmand.plus.download.DownloadActivityType.SRTM_COUNTRY_FILE;
import static net.osmand.plus.download.MultipleIndexesUiHelper.isBaseSRTMItem; import static net.osmand.plus.download.SelectIndexesUiHelper.isBaseSRTMItem;
public class MultipleIndexItem extends DownloadItem { public class MultipleIndexItem extends DownloadItem {

View file

@ -1,6 +1,7 @@
package net.osmand.plus.download; package net.osmand.plus.download;
import android.content.Context; import android.content.Context;
import android.view.View;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
@ -11,22 +12,28 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.LocalIndexInfo; import net.osmand.plus.activities.LocalIndexInfo;
import net.osmand.plus.base.SelectMultipleItemsBottomSheet; import net.osmand.plus.base.SelectMultipleItemsBottomSheet;
import net.osmand.plus.base.SelectMultipleItemsBottomSheet.OnApplySelectionListener;
import net.osmand.plus.base.SelectMultipleItemsBottomSheet.OnRadioButtonSelectListener;
import net.osmand.plus.base.SelectMultipleItemsBottomSheet.SelectableItem;
import net.osmand.plus.base.SelectMultipleItemsBottomSheet.SelectionUpdateListener; import net.osmand.plus.base.SelectMultipleItemsBottomSheet.SelectionUpdateListener;
import net.osmand.plus.base.SelectModeBottomSheet;
import net.osmand.plus.base.SelectMultipleWithModeBottomSheet;
import net.osmand.plus.base.SelectionBottomSheet;
import net.osmand.plus.base.SelectionBottomSheet.OnApplySelectionListener;
import net.osmand.plus.base.SelectionBottomSheet.OnUiInitializedListener;
import net.osmand.plus.base.SelectionBottomSheet.SelectableItem;
import net.osmand.plus.helpers.enums.MetricsConstants; import net.osmand.plus.helpers.enums.MetricsConstants;
import net.osmand.plus.widgets.MultiStateToggleButton.OnRadioItemClickListener;
import net.osmand.plus.widgets.MultiStateToggleButton.RadioItem;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import static net.osmand.IndexConstants.BINARY_SRTM_MAP_INDEX_EXT; import static net.osmand.IndexConstants.BINARY_SRTM_MAP_INDEX_EXT;
import static net.osmand.IndexConstants.BINARY_SRTM_MAP_INDEX_EXT_ZIP; import static net.osmand.IndexConstants.BINARY_SRTM_MAP_INDEX_EXT_ZIP;
import static net.osmand.plus.download.DownloadActivityType.SRTM_COUNTRY_FILE; import static net.osmand.plus.download.DownloadActivityType.SRTM_COUNTRY_FILE;
public class MultipleIndexesUiHelper { public class SelectIndexesUiHelper {
public static void showDialog(@NonNull DownloadItem item, public static void showDialog(@NonNull DownloadItem item,
@NonNull AppCompatActivity activity, @NonNull AppCompatActivity activity,
@ -35,7 +42,11 @@ public class MultipleIndexesUiHelper {
boolean showRemoteDate, boolean showRemoteDate,
@NonNull final SelectItemsToDownloadListener listener) { @NonNull final SelectItemsToDownloadListener listener) {
if (item.getType() == SRTM_COUNTRY_FILE) { if (item.getType() == SRTM_COUNTRY_FILE) {
showSRTMDialog(item, activity, app, dateFormat, showRemoteDate, listener); if (item instanceof MultipleIndexItem) {
showMultipleSrtmDialog(item, activity, app, dateFormat, showRemoteDate, listener);
} else {
showSingleSrtmDialog(item, activity, app, dateFormat, showRemoteDate, listener);
}
} else if (item instanceof MultipleIndexItem) { } else if (item instanceof MultipleIndexItem) {
showBaseDialog((MultipleIndexItem) item, activity, app, dateFormat, showRemoteDate, listener); showBaseDialog((MultipleIndexItem) item, activity, app, dateFormat, showRemoteDate, listener);
} }
@ -70,24 +81,116 @@ public class MultipleIndexesUiHelper {
final SelectMultipleItemsBottomSheet dialog = final SelectMultipleItemsBottomSheet dialog =
SelectMultipleItemsBottomSheet.showInstance(activity, allItems, selectedItems, true); SelectMultipleItemsBottomSheet.showInstance(activity, allItems, selectedItems, true);
dialog.setUiInitializedListener(new OnUiInitializedListener() {
@Override
public void onUiInitialized() {
dialog.setTitle(app.getString(R.string.welmode_download_maps));
}
});
dialog.setSelectionUpdateListener(new SelectionUpdateListener() { dialog.setSelectionUpdateListener(new SelectionUpdateListener() {
@Override @Override
public void onSelectionUpdate() { public void onSelectionUpdate() {
updateSize(app, dialog); updateSize(app, dialog, true);
} }
}); });
dialog.setOnApplySelectionListener(getOnApplySelectionListener(listener)); dialog.setOnApplySelectionListener(getOnApplySelectionListener(listener));
} }
public static void showSRTMDialog(@NonNull final DownloadItem downloadItem, public static void showSingleSrtmDialog(@NonNull final DownloadItem downloadItem,
@NonNull AppCompatActivity activity, @NonNull AppCompatActivity activity,
@NonNull final OsmandApplication app, @NonNull final OsmandApplication app,
@NonNull final DateFormat dateFormat, @NonNull final DateFormat dateFormat,
final boolean showRemoteDate, final boolean showRemoteDate,
@NonNull final SelectItemsToDownloadListener listener) { @NonNull final SelectItemsToDownloadListener listener) {
List<IndexItem> allIndexes = getIndexesToDownload(downloadItem);
boolean baseSRTM = isBaseSRTMMetricSystem(app);
List<RadioItem> radioItems = new ArrayList<>();
final RadioItem meters = new RadioItem(Algorithms.capitalizeFirstLetter(app.getString(R.string.shared_string_meters)));
RadioItem feet = new RadioItem(Algorithms.capitalizeFirstLetter(app.getString(R.string.shared_string_feets)));
radioItems.add(meters);
radioItems.add(feet);
SelectableItem meterItem = null;
SelectableItem feetItem = null;
for (IndexItem indexItem : allIndexes) {
boolean baseItem = isBaseSRTMItem(indexItem);
SelectableItem selectableItem = new SelectableItem();
selectableItem.setTitle(indexItem.getVisibleName(app, app.getRegions(), false));
String size = indexItem.getSizeDescription(app);
size += " (" + getSRTMAbbrev(app, baseItem) + ")";
String date = indexItem.getDate(dateFormat, showRemoteDate);
String description = app.getString(R.string.ltr_or_rtl_combine_via_bold_point, size, date);
selectableItem.setDescription(description);
selectableItem.setIconId(indexItem.getType().getIconResource());
selectableItem.setObject(indexItem);
if (baseItem) {
meterItem = selectableItem;
} else {
feetItem = selectableItem;
}
}
final SelectableItem initMeter = meterItem;
final SelectableItem initFeet = feetItem;
final SelectModeBottomSheet dialog = SelectModeBottomSheet.showInstance(activity,
baseSRTM ? meterItem : feetItem, radioItems, true);
meters.setOnClickListener(new OnRadioItemClickListener() {
@Override
public boolean onRadioItemClick(RadioItem radioItem, View view) {
dialog.setPreviewItem(initMeter);
updateSize(app, dialog, false);
return true;
}
});
feet.setOnClickListener(new OnRadioItemClickListener() {
@Override
public boolean onRadioItemClick(RadioItem radioItem, View view) {
dialog.setPreviewItem(initFeet);
double sizeToDownload = getDownloadSizeInMb(Collections.singletonList(initFeet));
String size = DownloadItem.getFormattedMb(app, sizeToDownload);
String btnTitle = app.getString(R.string.shared_string_download);
if (sizeToDownload > 0) {
btnTitle = app.getString(R.string.ltr_or_rtl_combine_via_dash, btnTitle, size);
}
dialog.setApplyButtonTitle(btnTitle);
return true;
}
});
final RadioItem initRadio = baseSRTM ? meters : feet;
dialog.setUiInitializedListener(new OnUiInitializedListener() {
@Override
public void onUiInitialized() {
dialog.setTitle(app.getString(R.string.srtm_unit_format));
dialog.setDescription(app.getString(R.string.srtm_download_single_help_message));
double sizeToDownload = getDownloadSizeInMb(Collections.singletonList(initFeet));
String size = DownloadItem.getFormattedMb(app, sizeToDownload);
String btnTitle = app.getString(R.string.shared_string_download);
if (sizeToDownload > 0) {
btnTitle = app.getString(R.string.ltr_or_rtl_combine_via_dash, btnTitle, size);
}
dialog.setApplyButtonTitle(btnTitle);
dialog.setSelectedMode(initRadio);
}
});
dialog.setOnApplySelectionListener(getOnApplySelectionListener(listener));
}
public static void showMultipleSrtmDialog(@NonNull final DownloadItem downloadItem,
@NonNull AppCompatActivity activity,
@NonNull final OsmandApplication app,
@NonNull final DateFormat dateFormat,
final boolean showRemoteDate,
@NonNull final SelectItemsToDownloadListener listener) {
List<SelectableItem> selectedItems = new ArrayList<>(); List<SelectableItem> selectedItems = new ArrayList<>();
final List<SelectableItem> leftItems = new ArrayList<>(); final List<SelectableItem> meterItems = new ArrayList<>();
final List<SelectableItem> rightItems = new ArrayList<>(); final List<SelectableItem> feetItems = new ArrayList<>();
List<IndexItem> indexesToDownload = getIndexesToDownload(downloadItem); List<IndexItem> indexesToDownload = getIndexesToDownload(downloadItem);
boolean baseSRTM = isBaseSRTMMetricSystem(app); boolean baseSRTM = isBaseSRTMMetricSystem(app);
@ -115,9 +218,9 @@ public class MultipleIndexesUiHelper {
selectableItem.setObject(indexItem); selectableItem.setObject(indexItem);
if (baseItem) { if (baseItem) {
leftItems.add(selectableItem); meterItems.add(selectableItem);
} else { } else {
rightItems.add(selectableItem); feetItems.add(selectableItem);
} }
if (indexesToDownload.contains(indexItem) if (indexesToDownload.contains(indexItem)
@ -126,45 +229,48 @@ public class MultipleIndexesUiHelper {
} }
} }
String addDescription = app.getString(isListDialog(app, leftItems, rightItems) List<RadioItem> radioItems = new ArrayList<>();
? R.string.srtm_download_list_help_message : R.string.srtm_download_single_help_message); RadioItem meters = new RadioItem(Algorithms.capitalizeFirstLetter(app.getString(R.string.shared_string_meters)));
final SelectMultipleItemsBottomSheet dialog = SelectMultipleItemsBottomSheet.showInstance( RadioItem feet = new RadioItem(Algorithms.capitalizeFirstLetter(app.getString(R.string.shared_string_feets)));
activity, baseSRTM ? leftItems : rightItems, selectedItems, true, final RadioItem selectedMode = isBaseSRTMItem(downloadItem) ? meters : feet;
addDescription, true, baseSRTM, radioItems.add(meters);
Algorithms.capitalizeFirstLetter(app.getString(R.string.shared_string_meters)), radioItems.add(feet);
Algorithms.capitalizeFirstLetter(app.getString(R.string.shared_string_feets)));
final SelectMultipleWithModeBottomSheet dialog = SelectMultipleWithModeBottomSheet.showInstance(
activity, baseSRTM ? meterItems : feetItems, selectedItems, radioItems, true);
meters.setOnClickListener(new OnRadioItemClickListener() {
@Override
public boolean onRadioItemClick(RadioItem radioItem, View view) {
// dialog.recreateList(meterItems);
return true;
}
});
feet.setOnClickListener(new OnRadioItemClickListener() {
@Override
public boolean onRadioItemClick(RadioItem radioItem, View view) {
// dialog.recreateList(feetItems);
return true;
}
});
dialog.setUiInitializedListener(new OnUiInitializedListener() {
@Override
public void onUiInitialized() {
dialog.setTitle(app.getString(R.string.welmode_download_maps));
dialog.setSelectedMode(selectedMode);
dialog.setSecondaryDescription(app.getString(R.string.srtm_download_list_help_message));
}
});
dialog.setSelectionUpdateListener(new SelectionUpdateListener() { dialog.setSelectionUpdateListener(new SelectionUpdateListener() {
@Override @Override
public void onSelectionUpdate() { public void onSelectionUpdate() {
updateSize(app, dialog); updateSize(app, dialog, true);
} }
}); });
dialog.setOnApplySelectionListener(getOnApplySelectionListener(listener)); dialog.setOnApplySelectionListener(getOnApplySelectionListener(listener));
dialog.setOnRadioButtonSelectListener(new OnRadioButtonSelectListener() {
@Override
public void onSelect(boolean leftButton) {
dialog.recreateList(leftButton ? leftItems : rightItems);
updateSize(app, dialog);
}
});
dialog.setSelectedItemsListener(new SelectedItemsListener() {
@Override
public List<SelectableItem> createSelectedItems(List<SelectableItem> currentAllItems, boolean baseSRTM) {
List<IndexItem> indexesToDownload = getIndexesToDownload(downloadItem);
List<SelectableItem> selectedItems = new ArrayList<>();
for (SelectableItem currentItem : currentAllItems) {
IndexItem indexItem = (IndexItem) currentItem.getObject();
boolean baseItem = isBaseSRTMItem(indexItem);
if (indexesToDownload.contains(indexItem)
&& (baseSRTM && baseItem || !baseSRTM && !baseItem)) {
selectedItems.add(currentItem);
}
}
return selectedItems;
}
});
} }
private static OnApplySelectionListener getOnApplySelectionListener(final SelectItemsToDownloadListener listener) { private static OnApplySelectionListener getOnApplySelectionListener(final SelectItemsToDownloadListener listener) {
@ -183,12 +289,12 @@ public class MultipleIndexesUiHelper {
}; };
} }
private static void updateSize(OsmandApplication app, SelectMultipleItemsBottomSheet dialog) { private static void updateSize(OsmandApplication app,
boolean isListDialog = dialog.isMultipleItem(); SelectionBottomSheet dialog,
dialog.setTitle(app.getString(isListDialog ? R.string.welmode_download_maps : R.string.srtm_unit_format)); boolean updateDescription) {
double sizeToDownload = getDownloadSizeInMb(dialog.getSelectedItems()); double sizeToDownload = getDownloadSizeInMb(dialog.getSelection());
String size = DownloadItem.getFormattedMb(app, sizeToDownload); String size = DownloadItem.getFormattedMb(app, sizeToDownload);
if (isListDialog) { if (updateDescription) {
String total = app.getString(R.string.shared_string_total); String total = app.getString(R.string.shared_string_total);
String description = app.getString(R.string.ltr_or_rtl_combine_via_colon, total, size); String description = app.getString(R.string.ltr_or_rtl_combine_via_colon, total, size);
dialog.setDescription(description); dialog.setDescription(description);
@ -197,12 +303,7 @@ public class MultipleIndexesUiHelper {
if (sizeToDownload > 0) { if (sizeToDownload > 0) {
btnTitle = app.getString(R.string.ltr_or_rtl_combine_via_dash, btnTitle, size); btnTitle = app.getString(R.string.ltr_or_rtl_combine_via_dash, btnTitle, size);
} }
dialog.setConfirmButtonTitle(btnTitle); dialog.setApplyButtonTitle(btnTitle);
}
private static boolean isListDialog(OsmandApplication app,
List<SelectableItem> leftItems, List<SelectableItem> rightItems) {
return (isBaseSRTMMetricSystem(app) ? leftItems : rightItems).size() > 1;
} }
public static String getSRTMAbbrev(Context context, boolean base) { public static String getSRTMAbbrev(Context context, boolean base) {
@ -266,7 +367,4 @@ public class MultipleIndexesUiHelper {
void onItemsToDownloadSelected(List<IndexItem> items); void onItemsToDownloadSelected(List<IndexItem> items);
} }
public interface SelectedItemsListener {
List<SelectableItem> createSelectedItems(List<SelectableItem> currentAllItems, boolean base);
}
} }

View file

@ -41,8 +41,8 @@ import net.osmand.plus.download.DownloadActivityType;
import net.osmand.plus.download.DownloadResourceGroup; import net.osmand.plus.download.DownloadResourceGroup;
import net.osmand.plus.download.DownloadResources; import net.osmand.plus.download.DownloadResources;
import net.osmand.plus.download.IndexItem; import net.osmand.plus.download.IndexItem;
import net.osmand.plus.download.MultipleIndexesUiHelper; import net.osmand.plus.download.SelectIndexesUiHelper;
import net.osmand.plus.download.MultipleIndexesUiHelper.SelectItemsToDownloadListener; import net.osmand.plus.download.SelectIndexesUiHelper.SelectItemsToDownloadListener;
import net.osmand.plus.download.MultipleIndexItem; import net.osmand.plus.download.MultipleIndexItem;
import net.osmand.plus.download.ui.LocalIndexesFragment.LocalIndexOperationTask; import net.osmand.plus.download.ui.LocalIndexesFragment.LocalIndexOperationTask;
import net.osmand.plus.helpers.FileNameTranslationHelper; import net.osmand.plus.helpers.FileNameTranslationHelper;
@ -56,9 +56,9 @@ import java.util.List;
import static net.osmand.plus.download.DownloadActivityType.SRTM_COUNTRY_FILE; import static net.osmand.plus.download.DownloadActivityType.SRTM_COUNTRY_FILE;
import static net.osmand.plus.download.DownloadActivityType.isSRTMItem; import static net.osmand.plus.download.DownloadActivityType.isSRTMItem;
import static net.osmand.plus.download.MultipleIndexesUiHelper.getSRTMAbbrev; import static net.osmand.plus.download.SelectIndexesUiHelper.getSRTMAbbrev;
import static net.osmand.plus.download.MultipleIndexesUiHelper.isBaseSRTMItem; import static net.osmand.plus.download.SelectIndexesUiHelper.isBaseSRTMItem;
import static net.osmand.plus.download.MultipleIndexesUiHelper.isBaseSRTMMetricSystem; import static net.osmand.plus.download.SelectIndexesUiHelper.isBaseSRTMMetricSystem;
public class ItemViewHolder { public class ItemViewHolder {
@ -523,7 +523,7 @@ public class ItemViewHolder {
private void selectIndexesToDownload(DownloadItem item) { private void selectIndexesToDownload(DownloadItem item) {
OsmandApplication app = context.getMyApplication(); OsmandApplication app = context.getMyApplication();
MultipleIndexesUiHelper.showDialog(item, context, app, dateFormat, showRemoteDate, SelectIndexesUiHelper.showDialog(item, context, app, dateFormat, showRemoteDate,
new SelectItemsToDownloadListener() { new SelectItemsToDownloadListener() {
@Override @Override
public void onItemsToDownloadSelected(List<IndexItem> indexes) { public void onItemsToDownloadSelected(List<IndexItem> indexes) {

View file

@ -75,8 +75,8 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import static net.osmand.plus.download.DownloadActivityType.isSRTMItem; import static net.osmand.plus.download.DownloadActivityType.isSRTMItem;
import static net.osmand.plus.download.MultipleIndexesUiHelper.getSRTMAbbrev; import static net.osmand.plus.download.SelectIndexesUiHelper.getSRTMAbbrev;
import static net.osmand.plus.download.MultipleIndexesUiHelper.isBaseSRTMItem; import static net.osmand.plus.download.SelectIndexesUiHelper.isBaseSRTMItem;
public class LocalIndexesFragment extends OsmandExpandableListFragment implements DownloadEvents, public class LocalIndexesFragment extends OsmandExpandableListFragment implements DownloadEvents,
OnMapSourceUpdateListener, RenameCallback { OnMapSourceUpdateListener, RenameCallback {