update categories screen on custom filters deletion
This commit is contained in:
parent
d1ad2096d2
commit
e75b4046c1
3 changed files with 20 additions and 11 deletions
|
@ -175,13 +175,6 @@ public class PoiFiltersHelper {
|
|||
helper.close();
|
||||
}
|
||||
|
||||
public void updateCachedFilter(PoiUIFilter poiFilter) {
|
||||
int i = cacheTopStandardFilters.indexOf(poiFilter);
|
||||
if (i != -1) {
|
||||
cacheTopStandardFilters.set(i, poiFilter);
|
||||
}
|
||||
}
|
||||
|
||||
private PoiUIFilter getFilterById(String filterId, PoiUIFilter... filters) {
|
||||
for (PoiUIFilter pf : filters) {
|
||||
if (pf != null && pf.getFilterId() != null && filterId != null && pf.getFilterId().equals(filterId)) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus.poi;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.os.Build;
|
||||
|
@ -217,6 +218,14 @@ public class RearrangePoiFiltersFragment extends DialogFragment implements Selec
|
|||
return mainView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
if (isChanged && !orderModified && !activationModified && resultCallback != null) {
|
||||
resultCallback.onCustomFiltersDeleted();
|
||||
}
|
||||
super.onDismiss(dialog);
|
||||
}
|
||||
|
||||
private void createToolbar(View mainView, boolean nightMode) {
|
||||
AppBarLayout appbar = mainView.findViewById(R.id.appbar);
|
||||
View toolbar = UiUtilities.getInflater(getContext(), nightMode).inflate(R.layout.profile_preference_toolbar_with_icon, appbar, false);
|
||||
|
@ -628,8 +637,7 @@ public class RearrangePoiFiltersFragment extends DialogFragment implements Selec
|
|||
PoiUIFilter filter = poiHelper.getFilterById(poiInfo.filterId);
|
||||
if (filter != null && poiHelper.removePoiFilter(filter)) {
|
||||
filter.setDeleted(true);
|
||||
poiHelper.updateCachedFilter(filter);
|
||||
app.getSearchUICore().refreshCustomPoiFilters();
|
||||
isChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -854,5 +862,7 @@ public class RearrangePoiFiltersFragment extends DialogFragment implements Selec
|
|||
|
||||
public interface OnApplyPoiFiltersState {
|
||||
void onApplyPoiFiltersState(ApplicationMode mode, boolean stateChanged);
|
||||
|
||||
void onCustomFiltersDeleted();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1281,9 +1281,15 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
UiUtilities.setupSnackbarVerticalLayout(snackbar);
|
||||
UiUtilities.setupSnackbar(snackbar, nightMode);
|
||||
snackbar.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
public void onCustomFiltersDeleted() {
|
||||
searchHelper.refreshCustomPoiFilters();
|
||||
reloadCategoriesInternal();
|
||||
}
|
||||
});
|
||||
}
|
||||
}));
|
||||
if (categoriesSearchFragment != null) {
|
||||
|
|
Loading…
Reference in a new issue