|
1 | 1 | package org.schabi.newpipe.util;
|
2 | 2 |
|
3 |
| -import static org.schabi.newpipe.util.external_communication.ShareUtils.installApp; |
| 3 | +import static org.schabi.newpipe.util.ListHelper.getUrlAndNonTorrentStreams; |
4 | 4 |
|
5 | 5 | import android.annotation.SuppressLint;
|
6 | 6 | import android.app.Activity;
|
|
50 | 50 | import org.schabi.newpipe.local.playlist.LocalPlaylistFragment;
|
51 | 51 | import org.schabi.newpipe.local.subscription.SubscriptionFragment;
|
52 | 52 | import org.schabi.newpipe.local.subscription.SubscriptionsImportFragment;
|
53 |
| -import org.schabi.newpipe.player.PlayerService; |
54 | 53 | import org.schabi.newpipe.player.PlayQueueActivity;
|
55 | 54 | import org.schabi.newpipe.player.Player;
|
| 55 | +import org.schabi.newpipe.player.PlayerService; |
56 | 56 | import org.schabi.newpipe.player.PlayerType;
|
57 | 57 | import org.schabi.newpipe.player.helper.PlayerHelper;
|
58 | 58 | import org.schabi.newpipe.player.helper.PlayerHolder;
|
|
63 | 63 |
|
64 | 64 | import java.util.List;
|
65 | 65 |
|
66 |
| -import static org.schabi.newpipe.util.ListHelper.getUrlAndNonTorrentStreams; |
67 |
| - |
68 | 66 | public final class NavigationHelper {
|
69 | 67 | public static final String MAIN_FRAGMENT_TAG = "main_fragment_tag";
|
70 | 68 | public static final String SEARCH_FRAGMENT_TAG = "search_fragment_tag";
|
@@ -323,15 +321,13 @@ public static void playOnExternalPlayer(@NonNull final Context context,
|
323 | 321 |
|
324 | 322 | public static void resolveActivityOrAskToInstall(@NonNull final Context context,
|
325 | 323 | @NonNull final Intent intent) {
|
326 |
| - if (intent.resolveActivity(context.getPackageManager()) != null) { |
327 |
| - ShareUtils.openIntentInApp(context, intent, false); |
328 |
| - } else { |
| 324 | + if (!ShareUtils.tryOpenIntentInApp(context, intent)) { |
329 | 325 | if (context instanceof Activity) {
|
330 | 326 | new AlertDialog.Builder(context)
|
331 | 327 | .setMessage(R.string.no_player_found)
|
332 | 328 | .setPositiveButton(R.string.install,
|
333 |
| - (dialog, which) -> ShareUtils.openUrlInBrowser(context, |
334 |
| - context.getString(R.string.fdroid_vlc_url), false)) |
| 329 | + (dialog, which) -> ShareUtils.installApp(context, |
| 330 | + context.getString(R.string.vlc_package))) |
335 | 331 | .setNegativeButton(R.string.cancel, (dialog, which)
|
336 | 332 | -> Log.i("NavigationHelper", "You unlocked a secret unicorn."))
|
337 | 333 | .show();
|
@@ -684,34 +680,6 @@ public static Intent getChannelIntent(final Context context,
|
684 | 680 | return getOpenIntent(context, url, serviceId, StreamingService.LinkType.CHANNEL);
|
685 | 681 | }
|
686 | 682 |
|
687 |
| - /** |
688 |
| - * Start an activity to install Kore. |
689 |
| - * |
690 |
| - * @param context the context |
691 |
| - */ |
692 |
| - public static void installKore(final Context context) { |
693 |
| - installApp(context, context.getString(R.string.kore_package)); |
694 |
| - } |
695 |
| - |
696 |
| - /** |
697 |
| - * Start Kore app to show a video on Kodi. |
698 |
| - * <p> |
699 |
| - * For a list of supported urls see the |
700 |
| - * <a href="https://github.com/xbmc/Kore/blob/master/app/src/main/AndroidManifest.xml"> |
701 |
| - * Kore source code |
702 |
| - * </a>. |
703 |
| - * |
704 |
| - * @param context the context to use |
705 |
| - * @param videoURL the url to the video |
706 |
| - */ |
707 |
| - public static void playWithKore(final Context context, final Uri videoURL) { |
708 |
| - final Intent intent = new Intent(Intent.ACTION_VIEW); |
709 |
| - intent.setPackage(context.getString(R.string.kore_package)); |
710 |
| - intent.setData(videoURL); |
711 |
| - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
712 |
| - context.startActivity(intent); |
713 |
| - } |
714 |
| - |
715 | 683 | /**
|
716 | 684 | * Finish this <code>Activity</code> as well as all <code>Activities</code> running below it
|
717 | 685 | * and then start <code>MainActivity</code>.
|
|
0 commit comments