Merge pull request #5944 from Stypox/fix-search-menu
Fix some random NullPointerExceptions
This commit is contained in:
commit
43f85408be
|
@ -423,8 +423,10 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
|
|||
@Override
|
||||
public void setTitle(final String title) {
|
||||
super.setTitle(title);
|
||||
if (headerBinding != null) {
|
||||
headerBinding.playlistTitleView.setText(title);
|
||||
}
|
||||
}
|
||||
|
||||
private void onBookmarkClicked() {
|
||||
if (isBookmarkButtonReady == null || !isBookmarkButtonReady.get()
|
||||
|
|
|
@ -139,7 +139,7 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
|
|||
@State
|
||||
boolean wasSearchFocused = false;
|
||||
|
||||
private Map<Integer, String> menuItemToFilterName;
|
||||
@Nullable private Map<Integer, String> menuItemToFilterName = null;
|
||||
private StreamingService service;
|
||||
private Page nextPage;
|
||||
private boolean isSuggestionsEnabled = true;
|
||||
|
@ -455,11 +455,12 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
public boolean onOptionsItemSelected(@NonNull final MenuItem item) {
|
||||
if (menuItemToFilterName != null) {
|
||||
final List<String> cf = new ArrayList<>(1);
|
||||
cf.add(menuItemToFilterName.get(item.getItemId()));
|
||||
changeContentFilter(item, cf);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import android.widget.TextView;
|
|||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
|
@ -41,9 +42,8 @@ public class NotificationActionsPreference extends Preference {
|
|||
}
|
||||
|
||||
|
||||
private NotificationSlot[] notificationSlots;
|
||||
|
||||
private List<Integer> compactSlots;
|
||||
@Nullable private NotificationSlot[] notificationSlots = null;
|
||||
@Nullable private List<Integer> compactSlots = null;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Lifecycle
|
||||
|
@ -85,10 +85,12 @@ public class NotificationActionsPreference extends Preference {
|
|||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void saveChanges() {
|
||||
if (compactSlots != null && notificationSlots != null) {
|
||||
final SharedPreferences.Editor editor = getSharedPreferences().edit();
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
editor.putInt(getContext().getString(NotificationConstants.SLOT_COMPACT_PREF_KEYS[i]),
|
||||
editor.putInt(getContext().getString(
|
||||
NotificationConstants.SLOT_COMPACT_PREF_KEYS[i]),
|
||||
(i < compactSlots.size() ? compactSlots.get(i) : -1));
|
||||
}
|
||||
|
||||
|
@ -99,6 +101,7 @@ public class NotificationActionsPreference extends Preference {
|
|||
|
||||
editor.apply();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue