Skip to content

Commit

Permalink
Feat: search for modpacks more often (#5461)
Browse files Browse the repository at this point in the history
  • Loading branch information
MovTery authored May 20, 2024
1 parent 1647398 commit f872f11
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
mRecyclerview.addOnScrollListener(mOverlayPositionListener);

mSearchEditText.setOnEditorActionListener((v, actionId, event) -> {
mSearchProgressBar.setVisibility(View.VISIBLE);
mSearchFilters.name = mSearchEditText.getText().toString();
mModItemAdapter.performSearchQuery(mSearchFilters);
searchMods(mSearchEditText.getText().toString());
mSearchEditText.clearFocus();
return false;
});
Expand All @@ -101,6 +99,8 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
mRecyclerview.getPaddingBottom());
});
mFilterButton.setOnClickListener(v -> displayFilterDialog());

searchMods(null);
}

@Override
Expand Down Expand Up @@ -132,6 +132,12 @@ public void onSearchError(int error) {
}
}

private void searchMods(String name) {
mSearchProgressBar.setVisibility(View.VISIBLE);
mSearchFilters.name = name == null ? "" : name;
mModItemAdapter.performSearchQuery(mSearchFilters);
}

private void displayFilterDialog() {
AlertDialog dialog = new AlertDialog.Builder(requireContext())
.setView(R.layout.dialog_mod_filters)
Expand All @@ -156,6 +162,7 @@ private void displayFilterDialog() {
// Apply the new settings
mApplyButton.setOnClickListener(v -> {
mSearchFilters.mcVersion = mSelectedVersion.getText().toString();
searchMods(mSearchEditText.getText().toString());
dialogInterface.dismiss();
});
});
Expand Down

0 comments on commit f872f11

Please sign in to comment.