mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-14 22:50:06 +08:00
opt: java
This commit is contained in:
@@ -111,7 +111,7 @@ public final class AndroidHelper {
|
||||
}
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
} catch (Throwable ignored) {
|
||||
} catch (Exception ignored) {
|
||||
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, uri);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
@@ -139,7 +139,7 @@ public final class AndroidHelper {
|
||||
context.startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
} catch (Throwable ignored) {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -148,7 +148,7 @@ public final class AndroidHelper {
|
||||
context.startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
} catch (Throwable ignored) {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -185,23 +185,23 @@ public final class AndroidHelper {
|
||||
private static void setPipActions(Activity activity, PictureInPictureParams.Builder builder, boolean isLive, boolean isPlaying) {
|
||||
ComponentName mbrComponent = MediaHelper.getMediaButtonReceiverComponent(activity);
|
||||
if (mbrComponent == null) return;
|
||||
ArrayList<RemoteAction> actionList = new ArrayList<>();
|
||||
ArrayList<RemoteAction> actionList = new ArrayList<>(3);
|
||||
if (!isLive) {
|
||||
actionList.add(getRemoteAction(mbrComponent, activity, R.drawable.ic_baseline_replay_10_24, "ACTION_REWIND", PlaybackState.ACTION_REWIND));
|
||||
actionList.add(getRemoteAction(mbrComponent, activity, R.drawable.ic_baseline_replay_10_24, "ACTION_REWIND", (int) PlaybackState.ACTION_REWIND));
|
||||
}
|
||||
if (isPlaying) {
|
||||
actionList.add(getRemoteAction(mbrComponent, activity, android.R.drawable.ic_media_pause, "ACTION_PAUSE", PlaybackState.ACTION_PAUSE));
|
||||
actionList.add(getRemoteAction(mbrComponent, activity, android.R.drawable.ic_media_pause, "ACTION_PAUSE", (int) PlaybackState.ACTION_PAUSE));
|
||||
} else {
|
||||
actionList.add(getRemoteAction(mbrComponent, activity, android.R.drawable.ic_media_play, "ACTION_PLAY", PlaybackState.ACTION_PLAY));
|
||||
actionList.add(getRemoteAction(mbrComponent, activity, android.R.drawable.ic_media_play, "ACTION_PLAY", (int) PlaybackState.ACTION_PLAY));
|
||||
}
|
||||
if (!isLive) {
|
||||
actionList.add(getRemoteAction(mbrComponent, activity, R.drawable.ic_baseline_forward_10_24, "ACTION_FAST_FORWARD", PlaybackState.ACTION_FAST_FORWARD));
|
||||
actionList.add(getRemoteAction(mbrComponent, activity, R.drawable.ic_baseline_forward_10_24, "ACTION_FAST_FORWARD", (int) PlaybackState.ACTION_FAST_FORWARD));
|
||||
}
|
||||
builder.setActions(actionList);
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
private static RemoteAction getRemoteAction(@NonNull ComponentName mbrComponent, Activity activity, @DrawableRes int resId, String title, long action) {
|
||||
private static RemoteAction getRemoteAction(@NonNull ComponentName mbrComponent, Activity activity, @DrawableRes int resId, String title, int action) {
|
||||
return new RemoteAction(
|
||||
Icon.createWithResource(activity, resId),
|
||||
title,
|
||||
@@ -235,7 +235,7 @@ public final class AndroidHelper {
|
||||
wm.getDefaultDisplay().getRealSize(realSize);
|
||||
return new int[]{Math.round(realSize.x / density), Math.round(realSize.y / density)};
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user