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 30142157e..602e418a0 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 @@ -40,7 +40,7 @@ public class ImportConfirmationDialog extends DialogFragment { @Override public Dialog onCreateDialog(@Nullable final Bundle savedInstanceState) { assureCorrectAppLanguage(getContext()); - return new AlertDialog.Builder(getContext()) + return new AlertDialog.Builder(requireContext()) .setMessage(R.string.import_network_expensive_warning) .setCancelable(true) .setNegativeButton(R.string.cancel, null) 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 b7629fac3..610f9f852 100644 --- a/app/src/main/java/org/schabi/newpipe/util/StreamDialogEntry.java +++ b/app/src/main/java/org/schabi/newpipe/util/StreamDialogEntry.java @@ -26,7 +26,8 @@ public enum StreamDialogEntry { show_channel_details(R.string.show_channel_details, (fragment, item) -> // For some reason `getParentFragmentManager()` doesn't work, but this does. - NavigationHelper.openChannelFragment(fragment.getActivity().getSupportFragmentManager(), + NavigationHelper.openChannelFragment( + fragment.requireActivity().getSupportFragmentManager(), item.getServiceId(), item.getUploaderUrl(), item.getUploaderName()) ), @@ -80,7 +81,7 @@ public enum StreamDialogEntry { play_with_kodi(R.string.play_with_kodi_title, (fragment, item) -> { final Uri videoUrl = Uri.parse(item.getUrl()); try { - NavigationHelper.playWithKore(fragment.getContext(), videoUrl); + NavigationHelper.playWithKore(fragment.requireContext(), videoUrl); } catch (final Exception e) { KoreUtil.showInstallKoreDialog(fragment.getActivity()); } diff --git a/app/src/main/java/us/shandian/giga/io/StoredFileHelper.java b/app/src/main/java/us/shandian/giga/io/StoredFileHelper.java index eba9437e1..21f6f2296 100644 --- a/app/src/main/java/us/shandian/giga/io/StoredFileHelper.java +++ b/app/src/main/java/us/shandian/giga/io/StoredFileHelper.java @@ -275,7 +275,7 @@ public class StoredFileHelper implements Serializable { if (!docTree.canRead() || !docTree.canWrite()) return false; try { docFile = createSAF(context, srcType, srcName); - if (docFile == null || docFile.getName() == null) return false; + if (docFile.getName() == null) return false; result = true; } catch (IOException e) { return false; diff --git a/app/src/test/java/org/schabi/newpipe/local/subscription/services/ImportExportJsonHelperTest.java b/app/src/test/java/org/schabi/newpipe/local/subscription/services/ImportExportJsonHelperTest.java index d3d1fa419..679c9da1d 100644 --- a/app/src/test/java/org/schabi/newpipe/local/subscription/services/ImportExportJsonHelperTest.java +++ b/app/src/test/java/org/schabi/newpipe/local/subscription/services/ImportExportJsonHelperTest.java @@ -91,7 +91,7 @@ public class ImportExportJsonHelperTest { final List itemsFromFile = ImportExportJsonHelper.readFrom( inputStream, null); - if (itemsFromFile == null || itemsFromFile.isEmpty()) { + if (itemsFromFile.isEmpty()) { fail("ImportExportJsonHelper.readFrom(input) returned a null or empty list"); } @@ -116,7 +116,7 @@ public class ImportExportJsonHelperTest { final List secondReadItems = ImportExportJsonHelper.readFrom( inputStream, null); - if (secondReadItems == null || secondReadItems.isEmpty()) { + if (secondReadItems.isEmpty()) { fail("second call to readFrom returned an empty list"); }