From e4885e3c521650e3e41f9b65044955492e6ce4af Mon Sep 17 00:00:00 2001 From: TacoTheDank Date: Tue, 15 Jun 2021 22:08:25 -0400 Subject: [PATCH] Fix some older deprecations from previous Fragment versions --- .../subscription/ImportConfirmationDialog.java | 6 +----- .../local/subscription/SubscriptionFragment.kt | 2 +- .../settings/tabs/ChooseTabsFragment.java | 6 +++--- .../schabi/newpipe/util/StreamDialogEntry.java | 16 +++++++--------- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/ImportConfirmationDialog.java b/app/src/main/java/org/schabi/newpipe/local/subscription/ImportConfirmationDialog.java index 602e418a0..5ab0699eb 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/ImportConfirmationDialog.java +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/ImportConfirmationDialog.java @@ -23,13 +23,9 @@ public class ImportConfirmationDialog extends DialogFragment { public static void show(@NonNull final Fragment fragment, @NonNull final Intent resultServiceIntent) { - if (fragment.getFragmentManager() == null) { - return; - } - final ImportConfirmationDialog confirmationDialog = new ImportConfirmationDialog(); confirmationDialog.setResultServiceIntent(resultServiceIntent); - confirmationDialog.show(fragment.getFragmentManager(), null); + confirmationDialog.show(fragment.getParentFragmentManager(), null); } public void setResultServiceIntent(final Intent resultServiceIntent) { diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt index 095c8dbc7..88203b69e 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt @@ -198,7 +198,7 @@ class SubscriptionFragment : BaseStateFragment() { } private fun openReorderDialog() { - FeedGroupReorderDialog().show(requireFragmentManager(), null) + FeedGroupReorderDialog().show(parentFragmentManager, null) } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { diff --git a/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java index 9c1a9bdd7..26cfda329 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java @@ -192,13 +192,13 @@ public class ChooseTabsFragment extends Fragment { final SelectKioskFragment selectKioskFragment = new SelectKioskFragment(); selectKioskFragment.setOnSelectedListener((serviceId, kioskId, kioskName) -> addTab(new Tab.KioskTab(serviceId, kioskId))); - selectKioskFragment.show(requireFragmentManager(), "select_kiosk"); + selectKioskFragment.show(getParentFragmentManager(), "select_kiosk"); return; case CHANNEL: final SelectChannelFragment selectChannelFragment = new SelectChannelFragment(); selectChannelFragment.setOnSelectedListener((serviceId, url, name) -> addTab(new Tab.ChannelTab(serviceId, url, name))); - selectChannelFragment.show(requireFragmentManager(), "select_channel"); + selectChannelFragment.show(getParentFragmentManager(), "select_channel"); return; case PLAYLIST: final SelectPlaylistFragment selectPlaylistFragment = new SelectPlaylistFragment(); @@ -215,7 +215,7 @@ public class ChooseTabsFragment extends Fragment { addTab(new Tab.PlaylistTab(serviceId, url, name)); } }); - selectPlaylistFragment.show(requireFragmentManager(), "select_playlist"); + selectPlaylistFragment.show(getParentFragmentManager(), "select_playlist"); return; default: addTab(type.getTab()); diff --git a/app/src/main/java/org/schabi/newpipe/util/StreamDialogEntry.java b/app/src/main/java/org/schabi/newpipe/util/StreamDialogEntry.java index 610f9f852..5a080bc21 100644 --- a/app/src/main/java/org/schabi/newpipe/util/StreamDialogEntry.java +++ b/app/src/main/java/org/schabi/newpipe/util/StreamDialogEntry.java @@ -66,16 +66,14 @@ public enum StreamDialogEntry { }), // has to be set manually append_playlist(R.string.append_playlist, (fragment, item) -> { - if (fragment.getFragmentManager() != null) { - final PlaylistAppendDialog d = PlaylistAppendDialog - .fromStreamInfoItems(Collections.singletonList(item)); + final PlaylistAppendDialog d = PlaylistAppendDialog + .fromStreamInfoItems(Collections.singletonList(item)); - PlaylistAppendDialog.onPlaylistFound(fragment.getContext(), - () -> d.show(fragment.getFragmentManager(), "StreamDialogEntry@append_playlist"), - () -> PlaylistCreationDialog.newInstance(d) - .show(fragment.getFragmentManager(), "StreamDialogEntry@create_playlist") - ); - } + PlaylistAppendDialog.onPlaylistFound(fragment.getContext(), + () -> d.show(fragment.getParentFragmentManager(), "StreamDialogEntry@append_playlist"), + () -> PlaylistCreationDialog.newInstance(d) + .show(fragment.getParentFragmentManager(), "StreamDialogEntry@create_playlist") + ); }), play_with_kodi(R.string.play_with_kodi_title, (fragment, item) -> {