UI fixes second part

This commit is contained in:
Vitaliy 2020-11-27 06:14:53 +02:00
parent 246af24ec3
commit 4a1934e09c
8 changed files with 170 additions and 58 deletions

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<item>
<objectAnimator
android:propertyName="elevation"
android:valueTo="@dimen/design_appbar_elevation"
android:valueType="floatType" />
</item>
</selector>

View file

@ -33,7 +33,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="2"
android:textAppearance="@style/TextAppearance.ListItemTitle" android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="Some title"/> tools:text="Some title"/>

View file

@ -23,16 +23,22 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="?attr/bg_color"
android:gravity="center"
android:minHeight="@dimen/bottom_sheet_title_height"
android:orientation="vertical"> android:orientation="vertical">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/buttons_shadow"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_top_shadow_height"
android:layout_gravity="bottom"
android:src="@drawable/shadow" />
<include layout="@layout/divider" /> <include layout="@layout/divider" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:minHeight="@dimen/measurement_tool_controls_height"
android:orientation="horizontal"> android:orientation="horizontal">
<LinearLayout <LinearLayout
@ -105,7 +111,8 @@
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@android:color/transparent"> android:background="@android:color/transparent"
android:stateListAnimator="@animator/appbar_always_elevated">
<com.google.android.material.appbar.CollapsingToolbarLayout <com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/toolbar_layout" android:id="@+id/toolbar_layout"

View file

@ -2,12 +2,10 @@ package net.osmand.plus.settings.fragments;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.ExpandableListView; import android.widget.ExpandableListView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@ -62,6 +60,7 @@ public abstract class BaseSettingsListFragment extends BaseOsmAndFragment implem
protected ExpandableListView expandableList; protected ExpandableListView expandableList;
protected ExportSettingsAdapter adapter; protected ExportSettingsAdapter adapter;
protected boolean exportMode;
protected boolean nightMode; protected boolean nightMode;
private boolean wasDrawerDisabled; private boolean wasDrawerDisabled;
@ -79,10 +78,10 @@ public abstract class BaseSettingsListFragment extends BaseOsmAndFragment implem
requireActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) { requireActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
@Override @Override
public void handleOnBackPressed() { public void handleOnBackPressed() {
if (!hasSelectedData()) { if (hasSelectedData()) {
dismissFragment();
} else {
showExitDialog(); showExitDialog();
} else {
dismissFragment();
} }
} }
}); });
@ -117,27 +116,12 @@ public abstract class BaseSettingsListFragment extends BaseOsmAndFragment implem
root.findViewById(R.id.continue_button_container).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) { if (expandableList.getHeaderViewsCount() <= 1) {
onContinueButtonClickAction(); if (hasSelectedData()) {
} else { onContinueButtonClickAction();
expandableList.smoothScrollToPositionFromTop(0, 0, 100);
}
}
});
ViewTreeObserver treeObserver = buttonsContainer.getViewTreeObserver();
treeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (buttonsContainer != null) {
ViewTreeObserver vts = buttonsContainer.getViewTreeObserver();
int height = buttonsContainer.getMeasuredHeight();
expandableList.setPadding(0, 0, 0, height);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
vts.removeOnGlobalLayoutListener(this);
} else {
vts.removeGlobalOnLayoutListener(this);
} }
} else {
expandableList.smoothScrollToPosition(0);
} }
} }
}); });
@ -202,10 +186,10 @@ 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()) { if (hasSelectedData()) {
dismissFragment();
} else {
showExitDialog(); showExitDialog();
} else {
dismissFragment();
} }
} }
}); });
@ -285,13 +269,24 @@ public abstract class BaseSettingsListFragment extends BaseOsmAndFragment implem
updateAvailableSpace(); updateAvailableSpace();
} }
protected List<Object> getItemsForType(ExportSettingsType type) {
for (SettingsCategoryItems categoryItems : dataList.values()) {
if (categoryItems.getTypes().contains(type)) {
return (List<Object>) categoryItems.getItemsForType(type);
}
}
return null;
}
protected List<Object> getSelectedItemsForType(ExportSettingsType type) {
return (List<Object>) selectedItemsMap.get(type);
}
@Override @Override
public void onTypeClicked(ExportSettingsCategory category, ExportSettingsType type) { public void onTypeClicked(ExportSettingsType type) {
FragmentManager fragmentManager = getFragmentManager(); FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null && type != ExportSettingsType.GLOBAL && type != ExportSettingsType.SEARCH_HISTORY) { if (fragmentManager != null && type != ExportSettingsType.GLOBAL && type != ExportSettingsType.SEARCH_HISTORY) {
List<Object> items = (List<Object>) dataList.get(category).getItemsForType(type); ExportItemsBottomSheet.showInstance(fragmentManager, type, this, exportMode);
List<Object> selectedItems = (List<Object>) selectedItemsMap.get(type);
ExportItemsBottomSheet.showInstance(type, selectedItems, items, fragmentManager, this);
} }
} }
} }

View file

@ -14,11 +14,15 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.GPXUtilities.GPXTrackAnalysis;
import net.osmand.IndexConstants; import net.osmand.IndexConstants;
import net.osmand.PlatformUtil; import net.osmand.PlatformUtil;
import net.osmand.map.ITileSource; import net.osmand.map.ITileSource;
import net.osmand.map.TileSourceManager.TileSourceTemplate; import net.osmand.map.TileSourceManager.TileSourceTemplate;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.GPXDatabase.GpxDataItem;
import net.osmand.plus.GpxDbHelper.GpxDataItemCallback;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.SQLiteTileSource; import net.osmand.plus.SQLiteTileSource;
@ -28,6 +32,7 @@ import net.osmand.plus.base.MenuBottomSheetDialogFragment;
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.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.SimpleDividerItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.SimpleDividerItem;
import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo; import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
@ -47,6 +52,7 @@ import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean; import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean;
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;
import net.osmand.plus.settings.backend.backup.FileSettingsItem.FileSubtype;
import net.osmand.plus.settings.backend.backup.GlobalSettingsItem; import net.osmand.plus.settings.backend.backup.GlobalSettingsItem;
import net.osmand.plus.settings.fragments.ExportSettingsAdapter.OnItemSelectedListener; import net.osmand.plus.settings.fragments.ExportSettingsAdapter.OnItemSelectedListener;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
@ -67,18 +73,43 @@ public class ExportItemsBottomSheet extends MenuBottomSheetDialogFragment {
public static final String TAG = ExportItemsBottomSheet.class.getSimpleName(); public static final String TAG = ExportItemsBottomSheet.class.getSimpleName();
private static final Log LOG = PlatformUtil.getLog(ExportItemsBottomSheet.class); private static final Log LOG = PlatformUtil.getLog(ExportItemsBottomSheet.class);
private static final String SETTINGS_TYPE_KEY = "settings_type_key";
private static final String EXPORT_MODE_KEY = "export_mode_key";
private OsmandApplication app; private OsmandApplication app;
private UiUtilities uiUtilities; private UiUtilities uiUtilities;
private ExportSettingsType type; private ExportSettingsType type;
private List<Object> allItems; private final List<Object> allItems = new ArrayList<>();
private List<Object> selectedItems = new ArrayList<>(); private final List<Object> selectedItems = new ArrayList<>();
private TextView selectedSize; private TextView selectedSize;
private ThreeStateCheckbox checkBox; private ThreeStateCheckbox checkBox;
private int activeColorRes; private int activeColorRes;
private int secondaryColorRes; private int secondaryColorRes;
private boolean exportMode;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
exportMode = savedInstanceState.getBoolean(EXPORT_MODE_KEY);
type = ExportSettingsType.valueOf(savedInstanceState.getString(SETTINGS_TYPE_KEY));
}
Fragment target = getTargetFragment();
if (target instanceof BaseSettingsListFragment) {
BaseSettingsListFragment fragment = (BaseSettingsListFragment) target;
List<Object> items = fragment.getItemsForType(type);
if (items != null) {
allItems.addAll(items);
}
List<Object> selectedItemsForType = fragment.getSelectedItemsForType(type);
if (selectedItemsForType != null) {
selectedItems.addAll(selectedItemsForType);
}
}
}
@Override @Override
public void createMenuItems(Bundle savedInstanceState) { public void createMenuItems(Bundle savedInstanceState) {
@ -111,11 +142,18 @@ public class ExportItemsBottomSheet extends MenuBottomSheetDialogFragment {
}) })
.setTag(object); .setTag(object);
setupBottomSheetItem(builder, object); setupBottomSheetItem(builder, object);
item[0] = (BottomSheetItemWithCompoundButton) builder.create(); item[0] = builder.create();
items.add(item[0]); items.add(item[0]);
} }
} }
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean(EXPORT_MODE_KEY, exportMode);
outState.putString(SETTINGS_TYPE_KEY, type.name());
}
private BaseBottomSheetItem createTitleItem() { private BaseBottomSheetItem createTitleItem() {
LayoutInflater themedInflater = UiUtilities.getInflater(requireContext(), nightMode); LayoutInflater themedInflater = UiUtilities.getInflater(requireContext(), nightMode);
View view = themedInflater.inflate(R.layout.settings_group_title, null); View view = themedInflater.inflate(R.layout.settings_group_title, null);
@ -207,15 +245,13 @@ public class ExportItemsBottomSheet extends MenuBottomSheetDialogFragment {
dismiss(); dismiss();
} }
public static void showInstance(@NonNull ExportSettingsType type, List<Object> selectedItems, List<?> allItems, @NonNull FragmentManager fm, @Nullable Fragment target) { public static void showInstance(@NonNull FragmentManager fm, @NonNull ExportSettingsType type,
@NonNull BaseSettingsListFragment target, boolean exportMode) {
try { try {
if (!fm.isStateSaved() && fm.findFragmentByTag(TAG) == null) { if (!fm.isStateSaved() && fm.findFragmentByTag(TAG) == null) {
ExportItemsBottomSheet fragment = new ExportItemsBottomSheet(); ExportItemsBottomSheet fragment = new ExportItemsBottomSheet();
fragment.type = type; fragment.type = type;
fragment.allItems = (List<Object>) allItems; fragment.exportMode = exportMode;
if (selectedItems != null) {
fragment.selectedItems.addAll(selectedItems);
}
fragment.setTargetFragment(target, 0); fragment.setTargetFragment(target, 0);
fragment.show(fm, TAG); fragment.show(fm, TAG);
} }
@ -234,7 +270,7 @@ public class ExportItemsBottomSheet extends MenuBottomSheetDialogFragment {
return null; return null;
} }
private void setupBottomSheetItem(BottomSheetItemWithCompoundButton.Builder builder, Object object) { private void setupBottomSheetItem(Builder builder, Object object) {
if (object instanceof ApplicationModeBean) { if (object instanceof ApplicationModeBean) {
ApplicationModeBean modeBean = (ApplicationModeBean) object; ApplicationModeBean modeBean = (ApplicationModeBean) object;
String profileName = modeBean.userProfileName; String profileName = modeBean.userProfileName;
@ -298,9 +334,8 @@ 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(); int points = group.getPoints().size();
String itemsDescr = app.getString(R.string.shared_string_gpx_points); String itemsDescr = getString(R.string.shared_string_gpx_points);
builder.setDescription(getString(R.string.ltr_or_rtl_combine_via_colon, itemsDescr, 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;
@ -316,7 +351,7 @@ public class ExportItemsBottomSheet extends MenuBottomSheetDialogFragment {
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(); int selectedMarkers = markersGroup.getMarkers().size();
String itemsDescr = app.getString(R.string.shared_string_items); String itemsDescr = getString(R.string.shared_string_items);
builder.setDescription(getString(R.string.ltr_or_rtl_combine_via_colon, itemsDescr, selectedMarkers)); 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;
@ -326,7 +361,7 @@ public class ExportItemsBottomSheet extends MenuBottomSheetDialogFragment {
} }
private void setupBottomSheetItemForFile(Builder builder, File file) { private void setupBottomSheetItemForFile(Builder builder, File file) {
FileSettingsItem.FileSubtype fileSubtype = FileSettingsItem.FileSubtype.getSubtypeByPath(app, file.getPath()); FileSubtype fileSubtype = FileSubtype.getSubtypeByPath(app, file.getPath());
builder.setTitle(file.getName()); builder.setTitle(file.getName());
if (file.getAbsolutePath().contains(IndexConstants.RENDERERS_DIR)) { if (file.getAbsolutePath().contains(IndexConstants.RENDERERS_DIR)) {
builder.setIcon(uiUtilities.getIcon(R.drawable.ic_action_map_style, activeColorRes)); builder.setIcon(uiUtilities.getIcon(R.drawable.ic_action_map_style, activeColorRes));
@ -334,8 +369,9 @@ public class ExportItemsBottomSheet extends MenuBottomSheetDialogFragment {
builder.setIcon(uiUtilities.getIcon(R.drawable.ic_action_route_distance, activeColorRes)); builder.setIcon(uiUtilities.getIcon(R.drawable.ic_action_route_distance, activeColorRes));
} 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.setTag(file);
builder.setDescription(getTrackDescr(file));
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) {
@ -360,6 +396,60 @@ public class ExportItemsBottomSheet extends MenuBottomSheetDialogFragment {
} }
} }
private final GpxDataItemCallback gpxDataItemCallback = new GpxDataItemCallback() {
@Override
public boolean isCancelled() {
return false;
}
@Override
public void onGpxDataItemReady(GpxDataItem item) {
for (BaseBottomSheetItem bottomSheetItem : items) {
if (Algorithms.objectEquals(item.getFile(), bottomSheetItem.getTag())) {
((BottomSheetItemWithDescription) bottomSheetItem).setDescription(getTrackDescrForDataItem(item));
break;
}
}
}
};
private String getTrackDescr(@NonNull File file) {
String folder = "";
File parent = file.getParentFile();
if (parent != null) {
folder = Algorithms.capitalizeFirstLetter(parent.getName());
}
if (exportMode) {
GpxDataItem dataItem = getDataItem(file, gpxDataItemCallback);
if (dataItem != null) {
return getTrackDescrForDataItem(dataItem);
}
} else {
String date = OsmAndFormatter.getFormattedDate(app, file.lastModified());
String size = AndroidUtils.formatSize(app, file.length());
String descr = getString(R.string.ltr_or_rtl_combine_via_bold_point, folder, date);
return getString(R.string.ltr_or_rtl_combine_via_comma, descr, size);
}
return null;
}
private String getTrackDescrForDataItem(@NonNull GpxDataItem dataItem) {
GPXTrackAnalysis analysis = dataItem.getAnalysis();
if (analysis != null) {
File parent = dataItem.getFile().getParentFile();
String folder = Algorithms.capitalizeFirstLetter(parent.getName());
String dist = OsmAndFormatter.getFormattedDistance(analysis.totalDistance, app);
String points = analysis.wptPoints + " " + getString(R.string.shared_string_gpx_points).toLowerCase();
String descr = getString(R.string.ltr_or_rtl_combine_via_bold_point, folder, dist);
return getString(R.string.ltr_or_rtl_combine_via_comma, descr, points);
}
return null;
}
private GpxDataItem getDataItem(File file, @Nullable GpxDataItemCallback callback) {
return app.getGpxDbHelper().getItem(file, callback);
}
private String getMapDescription(File file) { private String getMapDescription(File file) {
if (file.isDirectory() || file.getName().endsWith(IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT)) { if (file.isDirectory() || file.getName().endsWith(IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT)) {
return getString(R.string.online_map); return getString(R.string.online_map);

View file

@ -55,6 +55,9 @@ public class ExportSettingsAdapter extends OsmandBaseExpandableListAdapter {
private final boolean nightMode; private final boolean nightMode;
private final int activeColorRes; private final int activeColorRes;
private final int secondaryColorRes; private final int secondaryColorRes;
private final int groupViewHeight;
private final int childViewHeight;
private final int listBottomPadding;
ExportSettingsAdapter(OsmandApplication app, OnItemSelectedListener listener, boolean nightMode) { ExportSettingsAdapter(OsmandApplication app, OnItemSelectedListener listener, boolean nightMode) {
this.app = app; this.app = app;
@ -64,6 +67,9 @@ public class ExportSettingsAdapter extends OsmandBaseExpandableListAdapter {
themedInflater = UiUtilities.getInflater(app, nightMode); themedInflater = UiUtilities.getInflater(app, nightMode);
activeColorRes = nightMode ? R.color.icon_color_active_dark : R.color.icon_color_active_light; 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; secondaryColorRes = nightMode ? R.color.icon_color_secondary_dark : R.color.icon_color_secondary_light;
groupViewHeight = app.getResources().getDimensionPixelSize(R.dimen.setting_list_item_group_height);
childViewHeight = app.getResources().getDimensionPixelSize(R.dimen.setting_list_item_large_height);
listBottomPadding = app.getResources().getDimensionPixelSize(R.dimen.fab_recycler_view_padding_bottom);
} }
@Override @Override
@ -71,8 +77,7 @@ 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(groupViewHeight);
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);
@ -111,6 +116,9 @@ public class ExportSettingsAdapter extends OsmandBaseExpandableListAdapter {
} }
}); });
boolean addPadding = !isExpanded && groupPosition == getGroupCount() - 1;
group.setPadding(0, 0, 0, addPadding ? listBottomPadding : 0);
adjustIndicator(app, groupPosition, isExpanded, group, nightMode); adjustIndicator(app, groupPosition, isExpanded, group, nightMode);
AndroidUiHelper.updateVisibility(group.findViewById(R.id.divider), isExpanded); AndroidUiHelper.updateVisibility(group.findViewById(R.id.divider), isExpanded);
AndroidUiHelper.updateVisibility(group.findViewById(R.id.card_top_divider), true); AndroidUiHelper.updateVisibility(group.findViewById(R.id.card_top_divider), true);
@ -125,8 +133,7 @@ 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(childViewHeight);
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);
@ -162,7 +169,7 @@ public class ExportSettingsAdapter extends OsmandBaseExpandableListAdapter {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (listener != null) { if (listener != null) {
listener.onTypeClicked(category, type); listener.onTypeClicked(type);
} }
} }
}); });
@ -179,7 +186,8 @@ public class ExportSettingsAdapter extends OsmandBaseExpandableListAdapter {
notifyDataSetChanged(); notifyDataSetChanged();
} }
}); });
boolean addPadding = isLastChild && groupPosition == getGroupCount() - 1;
child.setPadding(0, 0, 0, addPadding ? listBottomPadding : 0);
AndroidUiHelper.updateVisibility(child.findViewById(R.id.card_bottom_divider), isLastChild); AndroidUiHelper.updateVisibility(child.findViewById(R.id.card_bottom_divider), isLastChild);
return child; return child;
@ -337,7 +345,7 @@ public class ExportSettingsAdapter extends OsmandBaseExpandableListAdapter {
void onCategorySelected(ExportSettingsCategory type, boolean selected); void onCategorySelected(ExportSettingsCategory type, boolean selected);
void onTypeClicked(ExportSettingsCategory category, ExportSettingsType type); void onTypeClicked(ExportSettingsType type);
} }
} }

View file

@ -75,6 +75,7 @@ public class ExportSettingsFragment extends BaseSettingsListFragment {
progressMax = savedInstanceState.getInt(PROGRESS_MAX_KEY); progressMax = savedInstanceState.getInt(PROGRESS_MAX_KEY);
progressValue = savedInstanceState.getInt(PROGRESS_VALUE_KEY); progressValue = savedInstanceState.getInt(PROGRESS_VALUE_KEY);
} }
exportMode = true;
dataList = app.getSettingsHelper().getAdditionalData(globalExport); dataList = app.getSettingsHelper().getAdditionalData(globalExport);
} }

View file

@ -100,6 +100,7 @@ public class ImportSettingsFragment extends BaseSettingsListFragment {
if (savedInstanceState != null) { if (savedInstanceState != null) {
duplicateStartTime = savedInstanceState.getLong(DUPLICATES_START_TIME_KEY); duplicateStartTime = savedInstanceState.getLong(DUPLICATES_START_TIME_KEY);
} }
exportMode = false;
settingsHelper = app.getSettingsHelper(); settingsHelper = app.getSettingsHelper();
ImportAsyncTask importTask = settingsHelper.getImportTask(); ImportAsyncTask importTask = settingsHelper.getImportTask();