diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index f6d5f5c287..0bf4bb55fb 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -317,7 +317,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { } } - private String formatDateTime(Context ctx, long dateTime) { + public static String formatDateTime(Context ctx, long dateTime) { DateFormat dateFormat = android.text.format.DateFormat.getMediumDateFormat(ctx); DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(ctx); return dateFormat.format(dateTime) + " " + timeFormat.format(dateTime); diff --git a/OsmAnd/src/net/osmand/plus/base/bottomsheetmenu/SimpleBottomSheetItem.java b/OsmAnd/src/net/osmand/plus/base/bottomsheetmenu/SimpleBottomSheetItem.java index bb93494214..b1cdaa6963 100644 --- a/OsmAnd/src/net/osmand/plus/base/bottomsheetmenu/SimpleBottomSheetItem.java +++ b/OsmAnd/src/net/osmand/plus/base/bottomsheetmenu/SimpleBottomSheetItem.java @@ -49,7 +49,7 @@ public class SimpleBottomSheetItem extends BaseBottomSheetItem { } - public void setTitle(String title) { + public void setTitle(CharSequence title) { this.title = title; titleTv.setText(title); } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/EnumStringPreference.java b/OsmAnd/src/net/osmand/plus/settings/backend/EnumStringPreference.java index a88a17fed3..662c773172 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/EnumStringPreference.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/EnumStringPreference.java @@ -30,7 +30,7 @@ public class EnumStringPreference> extends CommonPreference @Override protected String toString(E o) { - return o.name(); + return o == null ? null : o.name(); } @Override diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java index 0e3b9612cc..61a429f05f 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java @@ -900,11 +900,11 @@ public class SettingsHelper { List tileSourceTemplates = new ArrayList<>(); List routingFilesList = new ArrayList<>(); List renderFilesList = new ArrayList<>(); - List multimediaFilesList = new ArrayList<>(); List ttsVoiceFilesList = new ArrayList<>(); List voiceFilesList = new ArrayList<>(); List mapFilesList = new ArrayList<>(); List tracksFilesList = new ArrayList<>(); + List multimediaFilesList = new ArrayList<>(); List avoidRoads = new ArrayList<>(); List globalSettingsItems = new ArrayList<>(); List notesPointList = new ArrayList<>(); @@ -927,7 +927,7 @@ public class SettingsHelper { } else if (fileItem.getSubtype() == FileSubtype.ROUTING_CONFIG) { routingFilesList.add(fileItem.getFile()); } else if (fileItem.getSubtype() == FileSubtype.MULTIMEDIA_NOTES) { - multimediaFilesList.add(fileItem.getFile()); + multimediaFilesList.add(fileItem); } else if (fileItem.getSubtype() == FileSubtype.GPX) { tracksFilesList.add(fileItem); } else if (fileItem.getSubtype().isMap()) { diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsListFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsListFragment.java index 70cc3e95e0..6e2129deab 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsListFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsListFragment.java @@ -6,8 +6,10 @@ import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.AbsListView; import android.widget.ExpandableListView; import android.widget.LinearLayout; +import android.widget.ListView; import androidx.activity.OnBackPressedCallback; import androidx.annotation.NonNull; @@ -18,6 +20,8 @@ import androidx.core.view.ViewCompat; import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; +import com.github.ksoichiro.android.observablescrollview.ScrollUtils; + import net.osmand.AndroidUtils; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; @@ -129,6 +133,7 @@ public abstract class BaseSettingsListFragment extends BaseOsmAndFragment implem adapter = new ExportSettingsAdapter(app, exportMode, this, nightMode); adapter.updateSettingsItems(dataList, selectedItemsMap); expandableList.setAdapter(adapter); + setupListView(expandableList); updateAvailableSpace(); return root; @@ -195,6 +200,22 @@ public abstract class BaseSettingsListFragment extends BaseOsmAndFragment implem }); } + private void setupListView(@NonNull final ListView listView) { + if (listView.getFooterViewsCount() == 0) { + int padding = getResources().getDimensionPixelSize(R.dimen.toolbar_height_expanded); + + View emptyView = new View(listView.getContext()); + emptyView.setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, padding)); + listView.addFooterView(emptyView); + ScrollUtils.addOnGlobalLayoutListener(listView, new Runnable() { + @Override + public void run() { + listView.requestLayout(); + } + }); + } + } + protected void updateAvailableSpace() { long calculatedSize = ExportSettingsAdapter.calculateItemsSize(adapter.getData()); if (calculatedSize != 0) { diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java b/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java index 4b8e40f1a0..12a046339a 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java @@ -6,6 +6,10 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; +import androidx.recyclerview.widget.RecyclerView; + import net.osmand.AndroidUtils; import net.osmand.IndexConstants; import net.osmand.PlatformUtil; @@ -15,6 +19,7 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; import net.osmand.plus.audionotes.AudioVideoNotesPlugin; +import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording; import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo; import net.osmand.plus.helpers.FileNameTranslationHelper; import net.osmand.plus.helpers.GpxUiHelper; @@ -36,10 +41,6 @@ import org.apache.commons.logging.Log; import java.io.File; import java.util.List; -import androidx.annotation.NonNull; -import androidx.core.content.ContextCompat; -import androidx.recyclerview.widget.RecyclerView; - import static net.osmand.plus.settings.backend.backup.FileSettingsItem.FileSubtype; public class DuplicatesSettingsAdapter extends RecyclerView.Adapter { @@ -154,6 +155,7 @@ public class DuplicatesSettingsAdapter extends RecyclerView.Adapter