commit
a3355cefd7
10 changed files with 163 additions and 102 deletions
|
@ -279,6 +279,19 @@ public class Amenity extends MapObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTagContent(String tag, String lang) {
|
public String getTagContent(String tag, String lang) {
|
||||||
|
String translateName = getStrictTagContent(tag, lang);
|
||||||
|
if (translateName != null) {
|
||||||
|
return translateName;
|
||||||
|
}
|
||||||
|
for (String nm : getAdditionalInfoKeys()) {
|
||||||
|
if (nm.startsWith(tag + ":")) {
|
||||||
|
return getAdditionalInfo(nm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStrictTagContent(String tag, String lang) {
|
||||||
if (lang != null) {
|
if (lang != null) {
|
||||||
String translateName = getAdditionalInfo(tag + ":" + lang);
|
String translateName = getAdditionalInfo(tag + ":" + lang);
|
||||||
if (!Algorithms.isEmpty(translateName)) {
|
if (!Algorithms.isEmpty(translateName)) {
|
||||||
|
@ -293,11 +306,6 @@ public class Amenity extends MapObject {
|
||||||
if (!Algorithms.isEmpty(enName)) {
|
if (!Algorithms.isEmpty(enName)) {
|
||||||
return enName;
|
return enName;
|
||||||
}
|
}
|
||||||
for (String nm : getAdditionalInfoKeys()) {
|
|
||||||
if (nm.startsWith(tag + ":")) {
|
|
||||||
return getAdditionalInfo(nm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
android:id="@+id/name_edit_text"
|
android:id="@+id/name_edit_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="textCapSentences"
|
||||||
android:lineSpacingMultiplier="@dimen/bottom_sheet_text_spacing_multiplier" />
|
android:lineSpacingMultiplier="@dimen/bottom_sheet_text_spacing_multiplier" />
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
|
@ -39,6 +39,8 @@ import net.osmand.plus.base.bottomsheetmenu.HorizontalRecyclerBottomSheetItem;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem;
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
|
||||||
import net.osmand.plus.measurementtool.adapter.FolderListAdapter;
|
import net.osmand.plus.measurementtool.adapter.FolderListAdapter;
|
||||||
|
import net.osmand.plus.myplaces.AddNewTrackFolderBottomSheet;
|
||||||
|
import net.osmand.plus.myplaces.AddNewTrackFolderBottomSheet.OnTrackFolderAddListener;
|
||||||
import net.osmand.plus.myplaces.MoveGpxFileBottomSheet;
|
import net.osmand.plus.myplaces.MoveGpxFileBottomSheet;
|
||||||
import net.osmand.plus.myplaces.MoveGpxFileBottomSheet.OnTrackFileMoveListener;
|
import net.osmand.plus.myplaces.MoveGpxFileBottomSheet.OnTrackFileMoveListener;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -49,7 +51,8 @@ import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDialogFragment implements OnTrackFileMoveListener {
|
public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDialogFragment
|
||||||
|
implements OnTrackFileMoveListener, OnTrackFolderAddListener {
|
||||||
|
|
||||||
public static final String TAG = SaveAsNewTrackBottomSheetDialogFragment.class.getSimpleName();
|
public static final String TAG = SaveAsNewTrackBottomSheetDialogFragment.class.getSimpleName();
|
||||||
private static final Log LOG = PlatformUtil.getLog(SaveAsNewTrackBottomSheetDialogFragment.class);
|
private static final Log LOG = PlatformUtil.getLog(SaveAsNewTrackBottomSheetDialogFragment.class);
|
||||||
|
@ -127,6 +130,8 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
|
||||||
.create();
|
.create();
|
||||||
this.items.add(editFileName);
|
this.items.add(editFileName);
|
||||||
|
|
||||||
|
updateFileNameFromEditText(fileName);
|
||||||
|
|
||||||
int contentPaddingSmall = app.getResources().getDimensionPixelSize(R.dimen.content_padding_small);
|
int contentPaddingSmall = app.getResources().getDimensionPixelSize(R.dimen.content_padding_small);
|
||||||
int contentPaddingHalf = app.getResources().getDimensionPixelSize(R.dimen.content_padding_half);
|
int contentPaddingHalf = app.getResources().getDimensionPixelSize(R.dimen.content_padding_half);
|
||||||
|
|
||||||
|
@ -140,7 +145,7 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
File dest = getFile(app, folderName, fileName);
|
File dest = getFile(app, folderName, fileName);
|
||||||
MoveGpxFileBottomSheet.showInstance(activity.getSupportFragmentManager(),
|
MoveGpxFileBottomSheet.showInstance(activity.getSupportFragmentManager(),
|
||||||
SaveAsNewTrackBottomSheetDialogFragment.this, dest.getAbsolutePath(), usedOnMap);
|
SaveAsNewTrackBottomSheetDialogFragment.this, dest.getAbsolutePath(), usedOnMap, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -250,6 +255,15 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
|
||||||
updateFileNameFromEditText(editText.getText().toString());
|
updateFileNameFromEditText(editText.getText().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAddNewItemSelected() {
|
||||||
|
FragmentActivity activity = getActivity();
|
||||||
|
if (activity != null) {
|
||||||
|
AddNewTrackFolderBottomSheet.showInstance(activity.getSupportFragmentManager(),
|
||||||
|
SaveAsNewTrackBottomSheetDialogFragment.this, usedOnMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,9 +362,10 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
|
||||||
nameTextBox.setError(getString(R.string.file_with_name_already_exist));
|
nameTextBox.setError(getString(R.string.file_with_name_already_exist));
|
||||||
} else {
|
} else {
|
||||||
nameTextBox.setError(null);
|
nameTextBox.setError(null);
|
||||||
fileName = text;
|
nameTextBox.setErrorEnabled(false);
|
||||||
rightButtonEnabled = true;
|
rightButtonEnabled = true;
|
||||||
}
|
}
|
||||||
|
fileName = text;
|
||||||
updateBottomButtons();
|
updateBottomButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,6 +407,7 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
|
||||||
if (position != -1) {
|
if (position != -1) {
|
||||||
recyclerView.scrollToPosition(position);
|
recyclerView.scrollToPosition(position);
|
||||||
}
|
}
|
||||||
|
updateFileNameFromEditText(Algorithms.getFileNameWithoutExtension(dest.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,6 +416,13 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
|
||||||
return nightMode ? R.color.activity_background_color_dark : R.color.list_background_color_light;
|
return nightMode ? R.color.activity_background_color_dark : R.color.list_background_color_light;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTrackFolderAdd(String folderName) {
|
||||||
|
File file = getFile(app, this.folderName, fileName);
|
||||||
|
File destFolder = new File(app.getAppPath(IndexConstants.GPX_INDEX_DIR), folderName);
|
||||||
|
this.onFileMove(file, new File(destFolder, file.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
public interface SaveAsNewTrackFragmentListener {
|
public interface SaveAsNewTrackFragmentListener {
|
||||||
|
|
||||||
void onSaveAsNewTrack(String folderName, String fileName, boolean showOnMap, boolean simplifiedTrack);
|
void onSaveAsNewTrack(String folderName, String fileName, boolean showOnMap, boolean simplifiedTrack);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.osmand.plus.measurementtool.adapter;
|
package net.osmand.plus.measurementtool.adapter;
|
||||||
|
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
import android.graphics.drawable.GradientDrawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
@ -24,12 +25,14 @@ import java.util.List;
|
||||||
|
|
||||||
public class FolderListAdapter extends RecyclerView.Adapter<FolderListAdapter.GroupsViewHolder> {
|
public class FolderListAdapter extends RecyclerView.Adapter<FolderListAdapter.GroupsViewHolder> {
|
||||||
|
|
||||||
List<String> items = new ArrayList<>();
|
private static final int VIEW_TYPE_FOOTER = 1;
|
||||||
|
private static final int VIEW_TYPE_CELL = 0;
|
||||||
|
private final List<String> items = new ArrayList<>();
|
||||||
|
|
||||||
String selectedItemName;
|
private String selectedItemName;
|
||||||
OsmandApplication app;
|
private final OsmandApplication app;
|
||||||
boolean nightMode;
|
private final boolean nightMode;
|
||||||
FolderListAdapterListener listener;
|
private FolderListAdapterListener listener;
|
||||||
|
|
||||||
public FolderListAdapter(OsmandApplication app, boolean nightMode, String folderName) {
|
public FolderListAdapter(OsmandApplication app, boolean nightMode, String folderName) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
@ -59,12 +62,37 @@ public class FolderListAdapter extends RecyclerView.Adapter<FolderListAdapter.Gr
|
||||||
groupName.setMaxLines(1);
|
groupName.setMaxLines(1);
|
||||||
groupName.setEllipsize(TextUtils.TruncateAt.END);
|
groupName.setEllipsize(TextUtils.TruncateAt.END);
|
||||||
groupName.setTextColor(ContextCompat.getColor(app, activeColorRes));
|
groupName.setTextColor(ContextCompat.getColor(app, activeColorRes));
|
||||||
|
if (viewType != VIEW_TYPE_CELL) {
|
||||||
|
groupName.setText(R.string.add_new_folder);
|
||||||
|
int activeColorResId = nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light;
|
||||||
|
Drawable iconAdd = app.getUIUtilities().getIcon(R.drawable.ic_action_add, activeColorResId);
|
||||||
|
ImageView groupIcon = view.findViewById(R.id.groupIcon);
|
||||||
|
groupIcon.setImageDrawable(iconAdd);
|
||||||
|
GradientDrawable rectContourDrawable = (GradientDrawable) AppCompatResources.getDrawable(app,
|
||||||
|
R.drawable.bg_select_group_button_outline);
|
||||||
|
if (rectContourDrawable != null) {
|
||||||
|
int strokeColor = ContextCompat.getColor(app, nightMode ? R.color.stroked_buttons_and_links_outline_dark
|
||||||
|
: R.color.stroked_buttons_and_links_outline_light);
|
||||||
|
rectContourDrawable.setStroke(AndroidUtils.dpToPx(app, 1), strokeColor);
|
||||||
|
((ImageView) view.findViewById(R.id.outlineRect)).setImageDrawable(rectContourDrawable);
|
||||||
|
}
|
||||||
|
((TextView) view.findViewById(R.id.groupName)).setTextColor(app.getResources().getColor(activeColorResId));
|
||||||
|
}
|
||||||
return new FolderListAdapter.GroupsViewHolder(view);
|
return new FolderListAdapter.GroupsViewHolder(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull final GroupsViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull final GroupsViewHolder holder, int position) {
|
||||||
|
if (position == items.size()) {
|
||||||
|
holder.groupButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onAddNewItemSelected();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
holder.groupButton.setOnClickListener(new View.OnClickListener() {
|
holder.groupButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
@ -99,15 +127,21 @@ public class FolderListAdapter extends RecyclerView.Adapter<FolderListAdapter.Gr
|
||||||
int iconID;
|
int iconID;
|
||||||
iconID = R.drawable.ic_action_folder;
|
iconID = R.drawable.ic_action_folder;
|
||||||
holder.groupIcon.setImageDrawable(app.getUIUtilities().getIcon(iconID, activeColorRes));
|
holder.groupIcon.setImageDrawable(app.getUIUtilities().getIcon(iconID, activeColorRes));
|
||||||
|
}
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
AndroidUtils.setBackground(app, holder.groupButton, nightMode, R.drawable.ripple_solid_light_6dp,
|
AndroidUtils.setBackground(app, holder.groupButton, nightMode, R.drawable.ripple_solid_light_6dp,
|
||||||
R.drawable.ripple_solid_dark_6dp);
|
R.drawable.ripple_solid_dark_6dp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemViewType(int position) {
|
||||||
|
return (position == items.size()) ? VIEW_TYPE_FOOTER : VIEW_TYPE_CELL;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return items == null ? 0 : items.size();
|
return items == null ? 0 : items.size() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getItemPosition(String name) {
|
int getItemPosition(String name) {
|
||||||
|
@ -135,5 +169,7 @@ public class FolderListAdapter extends RecyclerView.Adapter<FolderListAdapter.Gr
|
||||||
public interface FolderListAdapterListener {
|
public interface FolderListAdapterListener {
|
||||||
|
|
||||||
void onItemSelected(String item);
|
void onItemSelected(String item);
|
||||||
|
|
||||||
|
void onAddNewItemSelected();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,8 +51,6 @@ public class AddNewTrackFolderBottomSheet extends MenuBottomSheetDialogFragment
|
||||||
app = requiredMyApplication();
|
app = requiredMyApplication();
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
folderName = savedInstanceState.getString(FOLDER_NAME_KEY);
|
folderName = savedInstanceState.getString(FOLDER_NAME_KEY);
|
||||||
} else if (Algorithms.isEmpty(folderName)) {
|
|
||||||
folderName = app.getAppPath(IndexConstants.GPX_INDEX_DIR).getName();
|
|
||||||
}
|
}
|
||||||
items.add(new TitleItem(getString(R.string.add_new_folder)));
|
items.add(new TitleItem(getString(R.string.add_new_folder)));
|
||||||
|
|
||||||
|
@ -92,20 +90,23 @@ public class AddNewTrackFolderBottomSheet extends MenuBottomSheetDialogFragment
|
||||||
|
|
||||||
private void updateFileNameFromEditText(String name) {
|
private void updateFileNameFromEditText(String name) {
|
||||||
rightButtonEnabled = false;
|
rightButtonEnabled = false;
|
||||||
|
if (Algorithms.isBlank(name)) {
|
||||||
|
nameTextBox.setError(getString(R.string.empty_filename));
|
||||||
|
} else {
|
||||||
if (ILLEGAL_PATH_NAME_CHARACTERS.matcher(name).find()) {
|
if (ILLEGAL_PATH_NAME_CHARACTERS.matcher(name).find()) {
|
||||||
nameTextBox.setError(getString(R.string.file_name_containes_illegal_char));
|
nameTextBox.setError(getString(R.string.file_name_containes_illegal_char));
|
||||||
} else if (Algorithms.isEmpty(name.trim())) {
|
|
||||||
nameTextBox.setError(getString(R.string.empty_filename));
|
|
||||||
} else {
|
} else {
|
||||||
File destFolder = new File(app.getAppPath(IndexConstants.GPX_INDEX_DIR), name);
|
File destFolder = new File(app.getAppPath(IndexConstants.GPX_INDEX_DIR), name);
|
||||||
if (destFolder.exists()) {
|
if (destFolder.exists()) {
|
||||||
nameTextBox.setError(getString(R.string.file_with_name_already_exist));
|
nameTextBox.setError(getString(R.string.file_with_name_already_exist));
|
||||||
} else {
|
} else {
|
||||||
nameTextBox.setError(null);
|
nameTextBox.setError(null);
|
||||||
folderName = name;
|
nameTextBox.setErrorEnabled(false);
|
||||||
rightButtonEnabled = true;
|
rightButtonEnabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
folderName = name;
|
||||||
updateBottomButtons();
|
updateBottomButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,11 +120,15 @@ public class AddNewTrackFolderBottomSheet extends MenuBottomSheetDialogFragment
|
||||||
protected void onRightBottomButtonClick() {
|
protected void onRightBottomButtonClick() {
|
||||||
AndroidUtils.hideSoftKeyboard(requireActivity(), editText);
|
AndroidUtils.hideSoftKeyboard(requireActivity(), editText);
|
||||||
Fragment fragment = getTargetFragment();
|
Fragment fragment = getTargetFragment();
|
||||||
|
if (!Algorithms.isBlank(folderName)) {
|
||||||
if (fragment instanceof OnTrackFolderAddListener) {
|
if (fragment instanceof OnTrackFolderAddListener) {
|
||||||
OnTrackFolderAddListener listener = (OnTrackFolderAddListener) fragment;
|
OnTrackFolderAddListener listener = (OnTrackFolderAddListener) fragment;
|
||||||
listener.onTrackFolderAdd(folderName);
|
listener.onTrackFolderAdd(folderName);
|
||||||
}
|
}
|
||||||
dismiss();
|
dismiss();
|
||||||
|
} else {
|
||||||
|
updateFileNameFromEditText(folderName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -141,12 +146,10 @@ public class AddNewTrackFolderBottomSheet extends MenuBottomSheetDialogFragment
|
||||||
void onTrackFolderAdd(String folderName);
|
void onTrackFolderAdd(String folderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showInstance(@NonNull FragmentManager fragmentManager, @Nullable Fragment target,
|
public static void showInstance(@NonNull FragmentManager fragmentManager, @Nullable Fragment target, boolean usedOnMap) {
|
||||||
@NonNull String folderName, boolean usedOnMap) {
|
|
||||||
try {
|
try {
|
||||||
if (!fragmentManager.isStateSaved() && fragmentManager.findFragmentByTag(AddNewTrackFolderBottomSheet.TAG) == null) {
|
if (!fragmentManager.isStateSaved() && fragmentManager.findFragmentByTag(AddNewTrackFolderBottomSheet.TAG) == null) {
|
||||||
AddNewTrackFolderBottomSheet fragment = new AddNewTrackFolderBottomSheet();
|
AddNewTrackFolderBottomSheet fragment = new AddNewTrackFolderBottomSheet();
|
||||||
fragment.folderName = folderName;
|
|
||||||
fragment.setUsedOnMap(usedOnMap);
|
fragment.setUsedOnMap(usedOnMap);
|
||||||
fragment.setTargetFragment(target, 0);
|
fragment.setTargetFragment(target, 0);
|
||||||
fragment.show(fragmentManager, AddNewTrackFolderBottomSheet.TAG);
|
fragment.show(fragmentManager, AddNewTrackFolderBottomSheet.TAG);
|
||||||
|
|
|
@ -780,7 +780,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
|
||||||
private void moveGpx(final GpxInfo info) {
|
private void moveGpx(final GpxInfo info) {
|
||||||
FragmentActivity activity = getActivity();
|
FragmentActivity activity = getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
MoveGpxFileBottomSheet.showInstance(activity.getSupportFragmentManager(), this, info.file.getAbsolutePath(), false);
|
MoveGpxFileBottomSheet.showInstance(activity.getSupportFragmentManager(), this, info.file.getAbsolutePath(), false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,15 +38,18 @@ public class MoveGpxFileBottomSheet extends MenuBottomSheetDialogFragment implem
|
||||||
public static final String TAG = MoveGpxFileBottomSheet.class.getSimpleName();
|
public static final String TAG = MoveGpxFileBottomSheet.class.getSimpleName();
|
||||||
private static final Log LOG = PlatformUtil.getLog(MoveGpxFileBottomSheet.class);
|
private static final Log LOG = PlatformUtil.getLog(MoveGpxFileBottomSheet.class);
|
||||||
private static final String FILE_PATH_KEY = "file_path_key";
|
private static final String FILE_PATH_KEY = "file_path_key";
|
||||||
|
private static final String SHOW_ALL_FOLDERS_KEY = "show_all_folders_key";
|
||||||
|
|
||||||
private OsmandApplication app;
|
private OsmandApplication app;
|
||||||
private String filePath;
|
private String filePath;
|
||||||
|
private boolean showAllFolders = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createMenuItems(Bundle savedInstanceState) {
|
public void createMenuItems(Bundle savedInstanceState) {
|
||||||
app = requiredMyApplication();
|
app = requiredMyApplication();
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
filePath = savedInstanceState.getString(FILE_PATH_KEY);
|
filePath = savedInstanceState.getString(FILE_PATH_KEY);
|
||||||
|
showAllFolders = savedInstanceState.getBoolean(SHOW_ALL_FOLDERS_KEY);
|
||||||
}
|
}
|
||||||
if (filePath == null) {
|
if (filePath == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -74,7 +77,7 @@ public class MoveGpxFileBottomSheet extends MenuBottomSheetDialogFragment implem
|
||||||
FragmentActivity activity = getActivity();
|
FragmentActivity activity = getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
AddNewTrackFolderBottomSheet.showInstance(activity.getSupportFragmentManager(),
|
AddNewTrackFolderBottomSheet.showInstance(activity.getSupportFragmentManager(),
|
||||||
MoveGpxFileBottomSheet.this, fileDir.getName(), usedOnMap);
|
MoveGpxFileBottomSheet.this, usedOnMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -87,8 +90,8 @@ public class MoveGpxFileBottomSheet extends MenuBottomSheetDialogFragment implem
|
||||||
items.add(dividerItem);
|
items.add(dividerItem);
|
||||||
|
|
||||||
final List<File> dirs = new ArrayList<>();
|
final List<File> dirs = new ArrayList<>();
|
||||||
collectDirs(app.getAppPath(IndexConstants.GPX_INDEX_DIR), dirs, fileDir);
|
collectDirs(app.getAppPath(IndexConstants.GPX_INDEX_DIR), dirs, showAllFolders ? null : fileDir);
|
||||||
if (!Algorithms.objectEquals(fileDir, app.getAppPath(IndexConstants.GPX_INDEX_DIR))) {
|
if (showAllFolders || !Algorithms.objectEquals(fileDir, app.getAppPath(IndexConstants.GPX_INDEX_DIR))) {
|
||||||
dirs.add(0, app.getAppPath(IndexConstants.GPX_INDEX_DIR));
|
dirs.add(0, app.getAppPath(IndexConstants.GPX_INDEX_DIR));
|
||||||
}
|
}
|
||||||
String gpxDir = app.getAppPath(IndexConstants.GPX_INDEX_DIR).getPath();
|
String gpxDir = app.getAppPath(IndexConstants.GPX_INDEX_DIR).getPath();
|
||||||
|
@ -135,6 +138,7 @@ public class MoveGpxFileBottomSheet extends MenuBottomSheetDialogFragment implem
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
outState.putString(FILE_PATH_KEY, filePath);
|
outState.putString(FILE_PATH_KEY, filePath);
|
||||||
|
outState.putBoolean(SHOW_ALL_FOLDERS_KEY, showAllFolders);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -163,12 +167,13 @@ public class MoveGpxFileBottomSheet extends MenuBottomSheetDialogFragment implem
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showInstance(@NonNull FragmentManager fragmentManager, @Nullable Fragment target,
|
public static void showInstance(@NonNull FragmentManager fragmentManager, @Nullable Fragment target,
|
||||||
@NonNull String filePath, boolean usedOnMap) {
|
@NonNull String filePath, boolean usedOnMap, boolean showAllFolders) {
|
||||||
try {
|
try {
|
||||||
if (!fragmentManager.isStateSaved() && fragmentManager.findFragmentByTag(MoveGpxFileBottomSheet.TAG) == null) {
|
if (!fragmentManager.isStateSaved() && fragmentManager.findFragmentByTag(MoveGpxFileBottomSheet.TAG) == null) {
|
||||||
MoveGpxFileBottomSheet fragment = new MoveGpxFileBottomSheet();
|
MoveGpxFileBottomSheet fragment = new MoveGpxFileBottomSheet();
|
||||||
fragment.filePath = filePath;
|
fragment.filePath = filePath;
|
||||||
fragment.setUsedOnMap(usedOnMap);
|
fragment.setUsedOnMap(usedOnMap);
|
||||||
|
fragment.showAllFolders = showAllFolders;
|
||||||
fragment.setTargetFragment(target, 0);
|
fragment.setTargetFragment(target, 0);
|
||||||
fragment.show(fragmentManager, MoveGpxFileBottomSheet.TAG);
|
fragment.show(fragmentManager, MoveGpxFileBottomSheet.TAG);
|
||||||
}
|
}
|
||||||
|
|
|
@ -846,7 +846,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
FileUtils.renameFile(mapActivity, new File(gpxFile.path), this, true);
|
FileUtils.renameFile(mapActivity, new File(gpxFile.path), this, true);
|
||||||
} else if (buttonIndex == CHANGE_FOLDER_BUTTON_INDEX) {
|
} else if (buttonIndex == CHANGE_FOLDER_BUTTON_INDEX) {
|
||||||
FragmentManager fragmentManager = mapActivity.getSupportFragmentManager();
|
FragmentManager fragmentManager = mapActivity.getSupportFragmentManager();
|
||||||
MoveGpxFileBottomSheet.showInstance(fragmentManager, this, gpxFile.path, true);
|
MoveGpxFileBottomSheet.showInstance(fragmentManager, this, gpxFile.path, true, false);
|
||||||
} else if (buttonIndex == DELETE_BUTTON_INDEX) {
|
} else if (buttonIndex == DELETE_BUTTON_INDEX) {
|
||||||
String fileName = Algorithms.getFileWithoutDirs(gpxFile.path);
|
String fileName = Algorithms.getFileWithoutDirs(gpxFile.path);
|
||||||
|
|
||||||
|
|
|
@ -33,23 +33,11 @@ public class WikivoyageShowPicturesDialogFragment extends BottomSheetDialogFragm
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
nightMode=!getMyApplication().getSettings().isLightContent();
|
nightMode = !getMyApplication().getSettings().isLightContent();
|
||||||
View view = inflater.inflate(R.layout.fragment_wikivoyage_show_images_first_time, container, false);
|
View view = inflater.inflate(R.layout.fragment_wikivoyage_show_images_first_time, container, false);
|
||||||
view.findViewById(R.id.button_no).setOnClickListener(new View.OnClickListener() {
|
TextView buttonNo = view.findViewById(R.id.button_no);
|
||||||
@Override
|
buttonNo.setText(R.string.shared_string_only_with_wifi);
|
||||||
public void onClick(View v) {
|
buttonNo.setOnClickListener(new View.OnClickListener() {
|
||||||
OsmandApplication app = getMyApplication();
|
|
||||||
if (app != null) {
|
|
||||||
app.getSettings().WIKI_ARTICLE_SHOW_IMAGES.set(WikiArticleShowImages.OFF);
|
|
||||||
}
|
|
||||||
sendResult();
|
|
||||||
dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
TextView buttonDownload = view.findViewById(R.id.button_download);
|
|
||||||
if (getMyApplication().getSettings().isWifiConnected()) {
|
|
||||||
buttonDownload.setText(R.string.shared_string_only_with_wifi);
|
|
||||||
buttonDownload.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
OsmandApplication app = getMyApplication();
|
OsmandApplication app = getMyApplication();
|
||||||
|
@ -60,8 +48,8 @@ public class WikivoyageShowPicturesDialogFragment extends BottomSheetDialogFragm
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
TextView buttonDownload = view.findViewById(R.id.button_download);
|
||||||
buttonDownload.setText(R.string.shared_string_show);
|
buttonDownload.setText(R.string.shared_string_always);
|
||||||
buttonDownload.setOnClickListener(new View.OnClickListener() {
|
buttonDownload.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -73,10 +61,7 @@ public class WikivoyageShowPicturesDialogFragment extends BottomSheetDialogFragm
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
setupHeightAndBackground(view);
|
setupHeightAndBackground(view);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,7 +280,7 @@ public class TravelObfHelper implements TravelHelper {
|
||||||
res.originalId = 0;
|
res.originalId = 0;
|
||||||
res.lang = lang;
|
res.lang = lang;
|
||||||
res.contentsJson = Algorithms.emptyIfNull(amenity.getTagContent(Amenity.CONTENT_JSON, lang));
|
res.contentsJson = Algorithms.emptyIfNull(amenity.getTagContent(Amenity.CONTENT_JSON, lang));
|
||||||
res.aggregatedPartOf = Algorithms.emptyIfNull(amenity.getTagContent(Amenity.IS_AGGR_PART, lang));
|
res.aggregatedPartOf = Algorithms.emptyIfNull(amenity.getStrictTagContent(Amenity.IS_AGGR_PART, lang));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue