Merge pull request #10227 from osmandapp/SearchHistoryFixes
Search history fixes
This commit is contained in:
commit
07353a0efc
5 changed files with 19 additions and 13 deletions
|
@ -259,6 +259,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
final MapActivity mapActivity = getMapActivity();
|
||||
final UiUtilities iconsCache = app.getUIUtilities();
|
||||
final View view = inflater.inflate(R.layout.search_dialog_fragment, container, false);
|
||||
|
||||
toolbarController = new QuickSearchToolbarController();
|
||||
|
@ -325,9 +326,9 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
|
||||
buttonToolbarView = view.findViewById(R.id.button_toolbar_layout);
|
||||
buttonToolbarImage = (ImageView) view.findViewById(R.id.buttonToolbarImage);
|
||||
buttonToolbarImage.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_marker_dark));
|
||||
buttonToolbarImage.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_marker_dark));
|
||||
buttonToolbarFilter = (ImageButton) view.findViewById(R.id.filterButton);
|
||||
buttonToolbarFilter.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_filter));
|
||||
buttonToolbarFilter.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_filter));
|
||||
buttonToolbarFilter.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -474,7 +475,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
if (!app.getSettings().isLightContent()) {
|
||||
toolbar.setBackgroundColor(ContextCompat.getColor(mapActivity, R.color.app_bar_color_dark));
|
||||
}
|
||||
Drawable icBack = app.getUIUtilities().getThemedIcon(AndroidUtils.getNavigationIconResId(app));
|
||||
Drawable icBack = iconsCache.getThemedIcon(AndroidUtils.getNavigationIconResId(app));
|
||||
toolbar.setNavigationIcon(icBack);
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(
|
||||
|
@ -489,7 +490,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
);
|
||||
|
||||
toolbarEdit = (Toolbar) view.findViewById(R.id.toolbar_edit);
|
||||
toolbarEdit.setNavigationIcon(app.getUIUtilities().getIcon(R.drawable.ic_action_remove_dark));
|
||||
toolbarEdit.setNavigationIcon(iconsCache.getIcon(R.drawable.ic_action_remove_dark));
|
||||
toolbarEdit.setNavigationContentDescription(R.string.shared_string_cancel);
|
||||
toolbarEdit.setNavigationOnClickListener(
|
||||
new OnClickListener() {
|
||||
|
@ -501,8 +502,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
);
|
||||
|
||||
titleEdit = (TextView) view.findViewById(R.id.titleEdit);
|
||||
Drawable shareIcon = app.getUIUtilities().getIcon(R.drawable.ic_action_gshare_dark,
|
||||
nightMode ? R.color.text_color_secondary_dark : R.color.text_color_secondary_light);
|
||||
Drawable shareIcon = iconsCache.getIcon(R.drawable.ic_action_gshare_dark, R.color.color_white);
|
||||
shareIcon = AndroidUtils.getDrawableForDirection(app, shareIcon);
|
||||
ImageView shareButton = (ImageView) view.findViewById(R.id.shareButton);
|
||||
shareButton.setImageDrawable(shareIcon);
|
||||
|
@ -644,7 +644,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
|
||||
progressBar = (ProgressBar) view.findViewById(R.id.searchProgressBar);
|
||||
clearButton = (ImageButton) view.findViewById(R.id.clearButton);
|
||||
clearButton.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_remove_dark));
|
||||
clearButton.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_remove_dark));
|
||||
clearButton.setOnClickListener(
|
||||
new OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -68,6 +68,10 @@ public abstract class CollectionSettingsItem<T> extends SettingsItem {
|
|||
return res;
|
||||
}
|
||||
|
||||
public boolean shouldShowDuplicates() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract boolean isDuplicate(@NonNull T item);
|
||||
|
||||
@NonNull
|
||||
|
|
|
@ -143,6 +143,11 @@ public class SearchHistorySettingsItem extends CollectionSettingsItem<HistoryEnt
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldShowDuplicates() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldReadOnCollecting() {
|
||||
return true;
|
||||
|
|
|
@ -431,8 +431,9 @@ public class SettingsHelper {
|
|||
duplicateItems.add(((ProfileSettingsItem) item).getModeBean());
|
||||
}
|
||||
} else if (item instanceof CollectionSettingsItem<?>) {
|
||||
List<?> duplicates = ((CollectionSettingsItem<?>) item).processDuplicateItems();
|
||||
if (!duplicates.isEmpty()) {
|
||||
CollectionSettingsItem settingsItem = (CollectionSettingsItem) item;
|
||||
List<?> duplicates = settingsItem.processDuplicateItems();
|
||||
if (!duplicates.isEmpty() && settingsItem.shouldShowDuplicates()) {
|
||||
duplicateItems.addAll(duplicates);
|
||||
}
|
||||
} else if (item instanceof FileSettingsItem) {
|
||||
|
|
|
@ -321,10 +321,6 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment {
|
|||
duplicates.add(getString(R.string.markers_history));
|
||||
duplicates.addAll(markersHistoryGroups);
|
||||
}
|
||||
if (!historyEntries.isEmpty()) {
|
||||
duplicates.add(getString(R.string.shared_string_search_history));
|
||||
duplicates.addAll(historyEntries);
|
||||
}
|
||||
return duplicates;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue