Small Ui fixes

This commit is contained in:
Vitaliy 2020-11-25 19:02:52 +02:00
parent 4b99c282dd
commit dc45501c74
12 changed files with 119 additions and 38 deletions

View file

@ -36,6 +36,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:letterSpacing="@dimen/text_button_letter_spacing" android:letterSpacing="@dimen/text_button_letter_spacing"
android:paddingBottom="@dimen/measurement_tool_menu_title_padding_bottom"
android:text="@string/export_not_enough_space" android:text="@string/export_not_enough_space"
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_list_text_size"

View file

@ -82,6 +82,7 @@
android:layout_height="match_parent" /> android:layout_height="match_parent" />
<LinearLayout <LinearLayout
android:id="@+id/continue_button_container"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding_half" android:layout_marginLeft="@dimen/content_padding_half"

View file

@ -18,6 +18,7 @@
android:background="?attr/bg_color"> android:background="?attr/bg_color">
<LinearLayout <LinearLayout
android:id="@+id/item_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
@ -30,9 +31,7 @@
android:layout_width="@dimen/standard_icon_size" android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size" android:layout_height="@dimen/standard_icon_size"
android:layout_marginLeft="@dimen/content_padding" android:layout_marginLeft="@dimen/content_padding"
android:layout_marginTop="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/content_padding" android:layout_marginRight="@dimen/content_padding"
android:layout_marginBottom="@dimen/bottom_sheet_icon_margin"
osmand:srcCompat="@drawable/ic_action_arrow_down" /> osmand:srcCompat="@drawable/ic_action_arrow_down" />
<LinearLayout <LinearLayout
@ -48,6 +47,7 @@
android:id="@+id/title_tv" android:id="@+id/title_tv"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/subHeaderPadding"
android:letterSpacing="@dimen/text_button_letter_spacing" android:letterSpacing="@dimen/text_button_letter_spacing"
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_list_text_size"
@ -69,9 +69,7 @@
<View <View
android:id="@+id/vertical_divider" android:id="@+id/vertical_divider"
android:layout_width="1dp" android:layout_width="1dp"
android:layout_height="match_parent" android:layout_height="@dimen/dialog_button_height"
android:layout_marginTop="@dimen/setting_profile_item_switch_margin"
android:layout_marginBottom="@dimen/setting_profile_item_switch_margin"
android:background="?attr/list_divider" /> android:background="?attr/list_divider" />
<FrameLayout <FrameLayout
@ -79,6 +77,8 @@
style="@style/Widget.AppCompat.Toolbar.Button.Navigation" style="@style/Widget.AppCompat.Toolbar.Button.Navigation"
android:layout_width="@dimen/acceptable_touch_radius" android:layout_width="@dimen/acceptable_touch_radius"
android:layout_height="@dimen/acceptable_touch_radius" android:layout_height="@dimen/acceptable_touch_radius"
android:layout_marginStart="@dimen/content_padding_small"
android:layout_marginLeft="@dimen/content_padding_small"
android:layout_marginEnd="@dimen/text_margin_small" android:layout_marginEnd="@dimen/text_margin_small"
android:layout_marginRight="@dimen/text_margin_small"> android:layout_marginRight="@dimen/text_margin_small">

View file

@ -397,6 +397,7 @@
<dimen name="setting_list_item_small_height">42dp</dimen> <dimen name="setting_list_item_small_height">42dp</dimen>
<dimen name="setting_select_icon_button_height">128dp</dimen> <dimen name="setting_select_icon_button_height">128dp</dimen>
<dimen name="setting_select_icon_button_width">164dp</dimen> <dimen name="setting_select_icon_button_width">164dp</dimen>
<dimen name="setting_list_item_group_height">68dp</dimen>
<dimen name="slider_thumb_size">6dp</dimen> <dimen name="slider_thumb_size">6dp</dimen>
<dimen name="slider_thumb_halo_size">12dp</dimen> <dimen name="slider_thumb_halo_size">12dp</dimen>

View file

@ -11,6 +11,7 @@
Thx - Hardy Thx - Hardy
--> -->
<string name="ltr_or_rtl_combine_via_star">%1$s * %2$s</string>
<string name="add_photos_descr">OsmAnd shows photos from several sources:\nOpenPlaceReviews - POI photos;\nMapillary - street-level imagery;\nWeb / Wikimedia - POI photos specified in OpenStreetMap data.</string> <string name="add_photos_descr">OsmAnd shows photos from several sources:\nOpenPlaceReviews - POI photos;\nMapillary - street-level imagery;\nWeb / Wikimedia - POI photos specified in OpenStreetMap data.</string>
<string name="use_dev_url">Use dev.openstreetmap.org</string> <string name="use_dev_url">Use dev.openstreetmap.org</string>
<string name="use_dev_url_descr">Switch to use "dev.openstreetmap.org" instead of "openstreetmap.org" to testing uploading OSM Note / POI / GPX.</string> <string name="use_dev_url_descr">Switch to use "dev.openstreetmap.org" instead of "openstreetmap.org" to testing uploading OSM Note / POI / GPX.</string>

View file

@ -10,7 +10,6 @@ public enum ExportSettingsType {
GLOBAL(R.string.general_settings_2, R.drawable.ic_action_settings), GLOBAL(R.string.general_settings_2, R.drawable.ic_action_settings),
QUICK_ACTIONS(R.string.configure_screen_quick_action, R.drawable.ic_quick_action), QUICK_ACTIONS(R.string.configure_screen_quick_action, R.drawable.ic_quick_action),
POI_TYPES(R.string.poi_dialog_poi_type, R.drawable.ic_action_info_dark), POI_TYPES(R.string.poi_dialog_poi_type, R.drawable.ic_action_info_dark),
SEARCH_HISTORY(R.string.shared_string_search_history, R.drawable.ic_action_history),
AVOID_ROADS(R.string.avoid_road, R.drawable.ic_action_alert), AVOID_ROADS(R.string.avoid_road, R.drawable.ic_action_alert),
FAVORITES(R.string.shared_string_favorites, R.drawable.ic_action_favorite), FAVORITES(R.string.shared_string_favorites, R.drawable.ic_action_favorite),
TRACKS(R.string.shared_string_tracks, R.drawable.ic_action_route_distance), TRACKS(R.string.shared_string_tracks, R.drawable.ic_action_route_distance),
@ -19,6 +18,7 @@ public enum ExportSettingsType {
MULTIMEDIA_NOTES(R.string.audionotes_plugin_name, R.drawable.ic_grouped_by_type), MULTIMEDIA_NOTES(R.string.audionotes_plugin_name, R.drawable.ic_grouped_by_type),
ACTIVE_MARKERS(R.string.map_markers, R.drawable.ic_action_flag), ACTIVE_MARKERS(R.string.map_markers, R.drawable.ic_action_flag),
HISTORY_MARKERS(R.string.markers_history, R.drawable.ic_action_flag), HISTORY_MARKERS(R.string.markers_history, R.drawable.ic_action_flag),
SEARCH_HISTORY(R.string.shared_string_search_history, R.drawable.ic_action_history),
CUSTOM_RENDER_STYLE(R.string.shared_string_rendering_style, R.drawable.ic_action_map_style), CUSTOM_RENDER_STYLE(R.string.shared_string_rendering_style, R.drawable.ic_action_map_style),
CUSTOM_ROUTING(R.string.shared_string_routing, R.drawable.ic_action_route_distance), CUSTOM_ROUTING(R.string.shared_string_routing, R.drawable.ic_action_route_distance),
MAP_SOURCES(R.string.quick_action_map_source_title, R.drawable.ic_map), MAP_SOURCES(R.string.quick_action_map_source_title, R.drawable.ic_map),
@ -48,12 +48,13 @@ public enum ExportSettingsType {
public boolean isSettingsCategory() { public boolean isSettingsCategory() {
return this == PROFILE || this == GLOBAL || this == QUICK_ACTIONS || this == POI_TYPES return this == PROFILE || this == GLOBAL || this == QUICK_ACTIONS || this == POI_TYPES
|| this == SEARCH_HISTORY || this == AVOID_ROADS; || this == AVOID_ROADS;
} }
public boolean isMyPlacesCategory() { public boolean isMyPlacesCategory() {
return this == FAVORITES || this == TRACKS || this == OSM_EDITS || this == OSM_NOTES return this == FAVORITES || this == TRACKS || this == OSM_EDITS || this == OSM_NOTES
|| this == MULTIMEDIA_NOTES || this == ACTIVE_MARKERS || this == HISTORY_MARKERS; || this == MULTIMEDIA_NOTES || this == ACTIVE_MARKERS || this == HISTORY_MARKERS
|| this == SEARCH_HISTORY;
} }
public boolean isResourcesCategory() { public boolean isResourcesCategory() {

View file

@ -539,10 +539,6 @@ public class SettingsHelper {
if (!poiList.isEmpty()) { if (!poiList.isEmpty()) {
settingsItems.put(ExportSettingsType.POI_TYPES, poiList); settingsItems.put(ExportSettingsType.POI_TYPES, poiList);
} }
List<HistoryEntry> historyEntries = SearchHistoryHelper.getInstance(app).getHistoryEntries(false);
if (!historyEntries.isEmpty()) {
settingsItems.put(ExportSettingsType.SEARCH_HISTORY, historyEntries);
}
Map<LatLon, AvoidRoadInfo> impassableRoads = app.getAvoidSpecificRoads().getImpassableRoads(); Map<LatLon, AvoidRoadInfo> impassableRoads = app.getAvoidSpecificRoads().getImpassableRoads();
if (!impassableRoads.isEmpty()) { if (!impassableRoads.isEmpty()) {
settingsItems.put(ExportSettingsType.AVOID_ROADS, new ArrayList<>(impassableRoads.values())); settingsItems.put(ExportSettingsType.AVOID_ROADS, new ArrayList<>(impassableRoads.values()));
@ -611,6 +607,10 @@ public class SettingsHelper {
markersGroup.setMarkers(markersHistory); markersGroup.setMarkers(markersHistory);
myPlacesItems.put(ExportSettingsType.HISTORY_MARKERS, Collections.singletonList(markersGroup)); myPlacesItems.put(ExportSettingsType.HISTORY_MARKERS, Collections.singletonList(markersGroup));
} }
List<HistoryEntry> historyEntries = SearchHistoryHelper.getInstance(app).getHistoryEntries(false);
if (!historyEntries.isEmpty()) {
myPlacesItems.put(ExportSettingsType.SEARCH_HISTORY, historyEntries);
}
return myPlacesItems; return myPlacesItems;
} }

View file

@ -11,6 +11,7 @@ import android.view.ViewTreeObserver;
import android.widget.ExpandableListView; import android.widget.ExpandableListView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
@ -31,6 +32,7 @@ import net.osmand.plus.settings.backend.ExportSettingsCategory;
import net.osmand.plus.settings.backend.ExportSettingsType; import net.osmand.plus.settings.backend.ExportSettingsType;
import net.osmand.plus.settings.fragments.ExportSettingsAdapter.OnItemSelectedListener; import net.osmand.plus.settings.fragments.ExportSettingsAdapter.OnItemSelectedListener;
import net.osmand.plus.widgets.TextViewEx; import net.osmand.plus.widgets.TextViewEx;
import net.osmand.util.Algorithms;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@ -73,6 +75,17 @@ public abstract class BaseSettingsListFragment extends BaseOsmAndFragment implem
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
app = requireMyApplication(); app = requireMyApplication();
nightMode = !app.getSettings().isLightContent(); nightMode = !app.getSettings().isLightContent();
requireActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
if (!hasSelectedData()) {
dismissFragment();
} else {
showExitDialog();
}
}
});
} }
@Nullable @Nullable
@ -101,10 +114,14 @@ public abstract class BaseSettingsListFragment extends BaseOsmAndFragment implem
continueBtn = root.findViewById(R.id.continue_button); continueBtn = root.findViewById(R.id.continue_button);
UiUtilities.setupDialogButton(nightMode, continueBtn, DialogButtonType.PRIMARY, getString(R.string.shared_string_continue)); UiUtilities.setupDialogButton(nightMode, continueBtn, DialogButtonType.PRIMARY, getString(R.string.shared_string_continue));
continueBtn.setOnClickListener(new View.OnClickListener() { root.findViewById(R.id.continue_button_container).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (expandableList.getHeaderViewsCount() >= 2) {
onContinueButtonClickAction(); onContinueButtonClickAction();
} else {
expandableList.smoothScrollToPositionFromTop(0, 0, 100);
}
} }
}); });
@ -185,8 +202,12 @@ public abstract class BaseSettingsListFragment extends BaseOsmAndFragment implem
toolbar.setNavigationOnClickListener(new View.OnClickListener() { toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (!hasSelectedData()) {
dismissFragment();
} else {
showExitDialog(); showExitDialog();
} }
}
}); });
} }
@ -204,16 +225,25 @@ public abstract class BaseSettingsListFragment extends BaseOsmAndFragment implem
continueBtn.setEnabled(false); continueBtn.setEnabled(false);
} else { } else {
updateWarningHeaderVisibility(false); updateWarningHeaderVisibility(false);
continueBtn.setEnabled(adapter.hasSelectedData()); continueBtn.setEnabled(hasSelectedData());
} }
itemsSizeContainer.setVisibility(View.VISIBLE); itemsSizeContainer.setVisibility(View.VISIBLE);
} else { } else {
updateWarningHeaderVisibility(false); updateWarningHeaderVisibility(false);
itemsSizeContainer.setVisibility(View.INVISIBLE); itemsSizeContainer.setVisibility(View.INVISIBLE);
continueBtn.setEnabled(adapter.hasSelectedData()); continueBtn.setEnabled(hasSelectedData());
} }
} }
public boolean hasSelectedData() {
for (List<?> items : selectedItemsMap.values()) {
if (!Algorithms.isEmpty(items)) {
return true;
}
}
return false;
}
private void updateWarningHeaderVisibility(boolean visible) { private void updateWarningHeaderVisibility(boolean visible) {
if (visible) { if (visible) {
if (expandableList.getHeaderViewsCount() < 2) { if (expandableList.getHeaderViewsCount() < 2) {

View file

@ -153,7 +153,30 @@ public class ExportItemsBottomSheet extends MenuBottomSheetDialogFragment {
int checkBoxColor = checkBox.getState() == UNCHECKED ? secondaryColorRes : activeColorRes; int checkBoxColor = checkBox.getState() == UNCHECKED ? secondaryColorRes : activeColorRes;
CompoundButtonCompat.setButtonTintList(checkBox, ColorStateList.valueOf(ContextCompat.getColor(app, checkBoxColor))); CompoundButtonCompat.setButtonTintList(checkBox, ColorStateList.valueOf(ContextCompat.getColor(app, checkBoxColor)));
selectedSize.setText(getString(R.string.ltr_or_rtl_combine_via_slash, selectedItems.size(), allItems.size())); String description;
if (type == ExportSettingsType.OFFLINE_MAPS && !selectedItems.isEmpty()) {
String size = AndroidUtils.formatSize(app, calculateSelectedItemsSize());
String selected = getString(R.string.ltr_or_rtl_combine_via_slash, selectedItems.size(), allItems.size());
description = getString(R.string.ltr_or_rtl_combine_via_comma, selected, size);
} else {
description = getString(R.string.ltr_or_rtl_combine_via_slash, selectedItems.size(), allItems.size());
}
selectedSize.setText(description);
}
private long calculateSelectedItemsSize() {
long itemsSize = 0;
for (int i = 0; i < allItems.size(); i++) {
Object object = allItems.get(i);
if (selectedItems.contains(object)) {
if (object instanceof FileSettingsItem) {
itemsSize += ((FileSettingsItem) object).getSize();
} else if (object instanceof File) {
itemsSize += ((File) object).length();
}
}
}
return itemsSize;
} }
private void updateItems(boolean checked) { private void updateItems(boolean checked) {
@ -275,6 +298,10 @@ public class ExportItemsBottomSheet extends MenuBottomSheetDialogFragment {
builder.setTitle(group.getDisplayName(app)); builder.setTitle(group.getDisplayName(app));
int color = group.getColor() == 0 ? ContextCompat.getColor(app, R.color.color_favorite) : group.getColor(); int color = group.getColor() == 0 ? ContextCompat.getColor(app, R.color.color_favorite) : group.getColor();
builder.setIcon(uiUtilities.getPaintedIcon(R.drawable.ic_action_folder, color)); builder.setIcon(uiUtilities.getPaintedIcon(R.drawable.ic_action_folder, color));
int points = group.getPoints().size();
String itemsDescr = app.getString(R.string.shared_string_gpx_points);
builder.setDescription(getString(R.string.ltr_or_rtl_combine_via_colon, itemsDescr, points));
} else if (object instanceof GlobalSettingsItem) { } else if (object instanceof GlobalSettingsItem) {
GlobalSettingsItem globalSettingsItem = (GlobalSettingsItem) object; GlobalSettingsItem globalSettingsItem = (GlobalSettingsItem) object;
builder.setTitle(globalSettingsItem.getPublicName(app)); builder.setTitle(globalSettingsItem.getPublicName(app));
@ -285,9 +312,12 @@ public class ExportItemsBottomSheet extends MenuBottomSheetDialogFragment {
builder.setTitle(getString(R.string.map_markers)); builder.setTitle(getString(R.string.map_markers));
builder.setIcon(uiUtilities.getIcon(R.drawable.ic_action_flag, activeColorRes)); builder.setIcon(uiUtilities.getIcon(R.drawable.ic_action_flag, activeColorRes));
} else if (ExportSettingsType.HISTORY_MARKERS.name().equals(markersGroup.getId())) { } else if (ExportSettingsType.HISTORY_MARKERS.name().equals(markersGroup.getId())) {
builder.setTitle(getString(R.string.map_markers)); builder.setTitle(getString(R.string.markers_history));
builder.setIcon(uiUtilities.getIcon(R.drawable.ic_action_history, activeColorRes)); builder.setIcon(uiUtilities.getIcon(R.drawable.ic_action_history, activeColorRes));
} }
int selectedMarkers = markersGroup.getMarkers().size();
String itemsDescr = app.getString(R.string.shared_string_items);
builder.setDescription(getString(R.string.ltr_or_rtl_combine_via_colon, itemsDescr, selectedMarkers));
} else if (object instanceof HistoryEntry) { } else if (object instanceof HistoryEntry) {
HistoryEntry historyEntry = (HistoryEntry) object; HistoryEntry historyEntry = (HistoryEntry) object;
builder.setTitle(historyEntry.getName().getName()); builder.setTitle(historyEntry.getName().getName());
@ -305,6 +335,7 @@ public class ExportItemsBottomSheet extends MenuBottomSheetDialogFragment {
} else if (file.getAbsolutePath().contains(IndexConstants.GPX_INDEX_DIR)) { } else if (file.getAbsolutePath().contains(IndexConstants.GPX_INDEX_DIR)) {
builder.setTitle(GpxUiHelper.getGpxTitle(file.getName())); builder.setTitle(GpxUiHelper.getGpxTitle(file.getName()));
builder.setIcon(uiUtilities.getIcon(R.drawable.ic_action_route_distance, activeColorRes)); builder.setIcon(uiUtilities.getIcon(R.drawable.ic_action_route_distance, activeColorRes));
builder.setDescription(file.getParentFile().getName());
} else if (file.getAbsolutePath().contains(IndexConstants.AV_INDEX_DIR)) { } else if (file.getAbsolutePath().contains(IndexConstants.AV_INDEX_DIR)) {
int iconId = AudioVideoNotesPlugin.getIconIdForRecordingFile(file); int iconId = AudioVideoNotesPlugin.getIconIdForRecordingFile(file);
if (iconId == -1) { if (iconId == -1) {
@ -316,6 +347,31 @@ public class ExportItemsBottomSheet extends MenuBottomSheetDialogFragment {
|| fileSubtype == FileSettingsItem.FileSubtype.VOICE) { || fileSubtype == FileSettingsItem.FileSubtype.VOICE) {
builder.setTitle(FileNameTranslationHelper.getFileNameWithRegion(app, file.getName())); builder.setTitle(FileNameTranslationHelper.getFileNameWithRegion(app, file.getName()));
builder.setIcon(uiUtilities.getIcon(fileSubtype.getIconId(), activeColorRes)); builder.setIcon(uiUtilities.getIcon(fileSubtype.getIconId(), activeColorRes));
if (fileSubtype.isMap()) {
String mapDescription = getMapDescription(file);
String size = AndroidUtils.formatSize(app, file.length());
if (mapDescription != null) {
builder.setDescription(getString(R.string.ltr_or_rtl_combine_via_star, mapDescription, size));
} else {
builder.setDescription(size);
} }
} }
}
}
private String getMapDescription(File file) {
if (file.isDirectory() || file.getName().endsWith(IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT)) {
return getString(R.string.online_map);
} else if (file.getName().endsWith(IndexConstants.BINARY_ROAD_MAP_INDEX_EXT)) {
return getString(R.string.download_roads_only_item);
} else if (file.getName().endsWith(IndexConstants.BINARY_WIKI_MAP_INDEX_EXT)) {
return getString(R.string.download_wikipedia_maps);
} else if (file.getName().endsWith(IndexConstants.BINARY_SRTM_MAP_INDEX_EXT)) {
return getString(R.string.download_srtm_maps);
} else if (file.getName().endsWith(IndexConstants.BINARY_MAP_INDEX_EXT)) {
return getString(R.string.download_regular_maps);
}
return null;
}
} }

View file

@ -18,6 +18,7 @@ import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter; import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.FontCache; import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.settings.backend.ExportSettingsCategory; import net.osmand.plus.settings.backend.ExportSettingsCategory;
import net.osmand.plus.settings.backend.ExportSettingsType; import net.osmand.plus.settings.backend.ExportSettingsType;
import net.osmand.plus.settings.backend.backup.FileSettingsItem; import net.osmand.plus.settings.backend.backup.FileSettingsItem;
@ -70,6 +71,8 @@ public class ExportSettingsAdapter extends OsmandBaseExpandableListAdapter {
View group = convertView; View group = convertView;
if (group == null) { if (group == null) {
group = themedInflater.inflate(R.layout.profile_data_list_item_group, parent, false); group = themedInflater.inflate(R.layout.profile_data_list_item_group, parent, false);
int minHeight = app.getResources().getDimensionPixelSize(R.dimen.setting_list_item_group_height);
group.findViewById(R.id.item_container).setMinimumHeight(minHeight);
} }
final ExportSettingsCategory category = itemsTypes.get(groupPosition); final ExportSettingsCategory category = itemsTypes.get(groupPosition);
final SettingsCategoryItems items = itemsMap.get(category); final SettingsCategoryItems items = itemsMap.get(category);
@ -122,6 +125,8 @@ public class ExportSettingsAdapter extends OsmandBaseExpandableListAdapter {
View child = convertView; View child = convertView;
if (child == null) { if (child == null) {
child = themedInflater.inflate(R.layout.profile_data_list_item_group, parent, false); child = themedInflater.inflate(R.layout.profile_data_list_item_group, parent, false);
int minHeight = app.getResources().getDimensionPixelSize(R.dimen.setting_list_item_large_height);
child.findViewById(R.id.item_container).setMinimumHeight(minHeight);
} }
final ExportSettingsCategory category = itemsTypes.get(groupPosition); final ExportSettingsCategory category = itemsTypes.get(groupPosition);
final SettingsCategoryItems categoryItems = itemsMap.get(category); final SettingsCategoryItems categoryItems = itemsMap.get(category);
@ -247,10 +252,6 @@ public class ExportSettingsAdapter extends OsmandBaseExpandableListAdapter {
notifyDataSetChanged(); notifyDataSetChanged();
} }
public boolean hasSelectedData() {
return !selectedItemsMap.isEmpty();
}
public List<? super Object> getData() { public List<? super Object> getData() {
List<Object> selectedItems = new ArrayList<>(); List<Object> selectedItems = new ArrayList<>();
for (List<?> items : selectedItemsMap.values()) { for (List<?> items : selectedItemsMap.values()) {
@ -307,6 +308,10 @@ public class ExportSettingsAdapter extends OsmandBaseExpandableListAdapter {
itemsSize += ((FileSettingsItem) object).getSize(); itemsSize += ((FileSettingsItem) object).getSize();
} else if (object instanceof File) { } else if (object instanceof File) {
itemsSize += ((File) object).length(); itemsSize += ((File) object).length();
} else if (object instanceof MapMarkersGroup) {
int selectedMarkers = ((MapMarkersGroup) object).getMarkers().size();
String itemsDescr = app.getString(R.string.shared_string_items);
return app.getString(R.string.ltr_or_rtl_combine_via_colon, itemsDescr, selectedMarkers);
} }
} }
} }

View file

@ -11,7 +11,6 @@ import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
@ -77,13 +76,6 @@ public class ExportSettingsFragment extends BaseSettingsListFragment {
progressValue = savedInstanceState.getInt(PROGRESS_VALUE_KEY); progressValue = savedInstanceState.getInt(PROGRESS_VALUE_KEY);
} }
dataList = app.getSettingsHelper().getAdditionalData(globalExport); dataList = app.getSettingsHelper().getAdditionalData(globalExport);
requireActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
showExitDialog();
}
});
} }
@Nullable @Nullable

View file

@ -12,7 +12,6 @@ import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
@ -102,12 +101,6 @@ public class ImportSettingsFragment extends BaseSettingsListFragment {
duplicateStartTime = savedInstanceState.getLong(DUPLICATES_START_TIME_KEY); duplicateStartTime = savedInstanceState.getLong(DUPLICATES_START_TIME_KEY);
} }
settingsHelper = app.getSettingsHelper(); settingsHelper = app.getSettingsHelper();
requireActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
showExitDialog();
}
});
ImportAsyncTask importTask = settingsHelper.getImportTask(); ImportAsyncTask importTask = settingsHelper.getImportTask();
if (importTask != null) { if (importTask != null) {