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