small refactor
This commit is contained in:
parent
f5e2cd20de
commit
52ac6ad4ba
2 changed files with 7 additions and 8 deletions
|
@ -570,7 +570,7 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
|||
@NonNull PoiCategory poiCategory,
|
||||
boolean selectAll) {
|
||||
Set<String> acceptedCategories = filter.getAcceptedSubtypes(poiCategory);
|
||||
QuickSearchSubCategoriesFragment.showInstance(fm, poiCategory, acceptedCategories, selectAll, getFiltersSelectedListener());
|
||||
QuickSearchSubCategoriesFragment.showInstance(fm, this, poiCategory, acceptedCategories, selectAll, getFiltersSelectedListener());
|
||||
}
|
||||
|
||||
public QuickSearchSubCategoriesFragment.OnFiltersSelectedListener getFiltersSelectedListener() {
|
||||
|
|
|
@ -63,6 +63,7 @@ public class QuickSearchSubCategoriesFragment extends BaseOsmAndDialogFragment {
|
|||
private boolean nightMode;
|
||||
|
||||
public static void showInstance(@NonNull FragmentManager fm,
|
||||
@Nullable Fragment targetFragment,
|
||||
@NonNull PoiCategory poiCategory,
|
||||
@Nullable Set<String> acceptedCategories,
|
||||
boolean selectAll,
|
||||
|
@ -72,6 +73,7 @@ public class QuickSearchSubCategoriesFragment extends BaseOsmAndDialogFragment {
|
|||
fragment.setSelectAll(selectAll);
|
||||
fragment.setAcceptedCategories(acceptedCategories);
|
||||
fragment.setListener(listener);
|
||||
fragment.setTargetFragment(targetFragment, 0);
|
||||
fragment.show(fm, TAG);
|
||||
}
|
||||
|
||||
|
@ -257,13 +259,10 @@ public class QuickSearchSubCategoriesFragment extends BaseOsmAndDialogFragment {
|
|||
if (listener != null) {
|
||||
listener.onFiltersSelected(poiCategory, list);
|
||||
} else {
|
||||
FragmentManager fm = getFragmentManager();
|
||||
if (fm != null) {
|
||||
Fragment fragment = fm.findFragmentByTag(QuickSearchCustomPoiFragment.TAG);
|
||||
if (fragment instanceof QuickSearchCustomPoiFragment) {
|
||||
listener = ((QuickSearchCustomPoiFragment) fragment).getFiltersSelectedListener();
|
||||
listener.onFiltersSelected(poiCategory, list);
|
||||
}
|
||||
Fragment fragment = getTargetFragment();
|
||||
if (fragment instanceof QuickSearchCustomPoiFragment) {
|
||||
listener = ((QuickSearchCustomPoiFragment) fragment).getFiltersSelectedListener();
|
||||
listener.onFiltersSelected(poiCategory, list);
|
||||
}
|
||||
}
|
||||
dismiss();
|
||||
|
|
Loading…
Reference in a new issue