mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 16:40:32 +00:00
Use reqireContext(), requireActivity() instead of getters
This commit is contained in:
parent
79efffe12f
commit
abc354f516
@ -40,7 +40,7 @@ public class ImportConfirmationDialog extends DialogFragment {
|
|||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(@Nullable final Bundle savedInstanceState) {
|
public Dialog onCreateDialog(@Nullable final Bundle savedInstanceState) {
|
||||||
assureCorrectAppLanguage(getContext());
|
assureCorrectAppLanguage(getContext());
|
||||||
return new AlertDialog.Builder(getContext())
|
return new AlertDialog.Builder(requireContext())
|
||||||
.setMessage(R.string.import_network_expensive_warning)
|
.setMessage(R.string.import_network_expensive_warning)
|
||||||
.setCancelable(true)
|
.setCancelable(true)
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(R.string.cancel, null)
|
||||||
|
@ -26,7 +26,8 @@ public enum StreamDialogEntry {
|
|||||||
|
|
||||||
show_channel_details(R.string.show_channel_details, (fragment, item) ->
|
show_channel_details(R.string.show_channel_details, (fragment, item) ->
|
||||||
// For some reason `getParentFragmentManager()` doesn't work, but this does.
|
// 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())
|
item.getServiceId(), item.getUploaderUrl(), item.getUploaderName())
|
||||||
),
|
),
|
||||||
|
|
||||||
@ -80,7 +81,7 @@ public enum StreamDialogEntry {
|
|||||||
play_with_kodi(R.string.play_with_kodi_title, (fragment, item) -> {
|
play_with_kodi(R.string.play_with_kodi_title, (fragment, item) -> {
|
||||||
final Uri videoUrl = Uri.parse(item.getUrl());
|
final Uri videoUrl = Uri.parse(item.getUrl());
|
||||||
try {
|
try {
|
||||||
NavigationHelper.playWithKore(fragment.getContext(), videoUrl);
|
NavigationHelper.playWithKore(fragment.requireContext(), videoUrl);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
KoreUtil.showInstallKoreDialog(fragment.getActivity());
|
KoreUtil.showInstallKoreDialog(fragment.getActivity());
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,7 @@ public class StoredFileHelper implements Serializable {
|
|||||||
if (!docTree.canRead() || !docTree.canWrite()) return false;
|
if (!docTree.canRead() || !docTree.canWrite()) return false;
|
||||||
try {
|
try {
|
||||||
docFile = createSAF(context, srcType, srcName);
|
docFile = createSAF(context, srcType, srcName);
|
||||||
if (docFile == null || docFile.getName() == null) return false;
|
if (docFile.getName() == null) return false;
|
||||||
result = true;
|
result = true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -91,7 +91,7 @@ public class ImportExportJsonHelperTest {
|
|||||||
final List<SubscriptionItem> itemsFromFile = ImportExportJsonHelper.readFrom(
|
final List<SubscriptionItem> itemsFromFile = ImportExportJsonHelper.readFrom(
|
||||||
inputStream, null);
|
inputStream, null);
|
||||||
|
|
||||||
if (itemsFromFile == null || itemsFromFile.isEmpty()) {
|
if (itemsFromFile.isEmpty()) {
|
||||||
fail("ImportExportJsonHelper.readFrom(input) returned a null or empty list");
|
fail("ImportExportJsonHelper.readFrom(input) returned a null or empty list");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ public class ImportExportJsonHelperTest {
|
|||||||
final List<SubscriptionItem> secondReadItems = ImportExportJsonHelper.readFrom(
|
final List<SubscriptionItem> secondReadItems = ImportExportJsonHelper.readFrom(
|
||||||
inputStream, null);
|
inputStream, null);
|
||||||
|
|
||||||
if (secondReadItems == null || secondReadItems.isEmpty()) {
|
if (secondReadItems.isEmpty()) {
|
||||||
fail("second call to readFrom returned an empty list");
|
fail("second call to readFrom returned an empty list");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user