adding controls to exit pip or switch to background audio

This commit is contained in:
dhk2 2020-07-03 15:47:20 -07:00
parent 71bc325d49
commit 76b3ddcf69

View File

@ -74,14 +74,16 @@ public class VideoPlayActivity extends AppCompatActivity {
private static boolean floatMode = false; private static boolean floatMode = false;
private static final int REQUEST_CODE = 101; private static final int REQUEST_CODE = 101;
private BroadcastReceiver receiver; private BroadcastReceiver receiver;
//This can only be called when in entering pip mode which can only happen on a high enough level to support pip mode.
@SuppressLint("NewApi")
public void setActions(String actionCommand) { public void setActions(String actionCommand) {
ArrayList<RemoteAction> actions = new ArrayList<>(); ArrayList<RemoteAction> actions = new ArrayList<>();
Intent actionIntent = new Intent(BACKGROUND_AUDIO); Intent actionIntent = new Intent(BACKGROUND_AUDIO);
PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), REQUEST_CODE, actionIntent, 0); PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), REQUEST_CODE, actionIntent, 0);
Icon icon = Icon.createWithResource(getApplicationContext(), android.R.drawable.stat_sys_speakerphone); @SuppressLint("NewApi") Icon icon = Icon.createWithResource(getApplicationContext(), android.R.drawable.stat_sys_speakerphone);
RemoteAction remoteAction = new RemoteAction(icon, "close pip", "from pip window custom command", pendingIntent); @SuppressLint("NewApi") RemoteAction remoteAction = new RemoteAction(icon, "close pip", "from pip window custom command", pendingIntent);
actions.add(remoteAction); actions.add(remoteAction);
actionIntent = new Intent(ACTION_STOP); actionIntent = new Intent(ACTION_STOP);