f
This commit is contained in:
parent
1dbc27b283
commit
372db5e78d
1 changed files with 6 additions and 11 deletions
|
@ -71,7 +71,6 @@ public class VideoPlayer extends AppCompatActivity {
|
||||||
private PlayerNotificationManager playerNotificationManager;
|
private PlayerNotificationManager playerNotificationManager;
|
||||||
private int notificationId = 1234;
|
private int notificationId = 1234;
|
||||||
Intent playerIntent;
|
Intent playerIntent;
|
||||||
TaskStackBuilder stackBuilder;
|
|
||||||
PendingIntent playerPendingIntent;
|
PendingIntent playerPendingIntent;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -86,15 +85,11 @@ public class VideoPlayer extends AppCompatActivity {
|
||||||
manager.createNotificationChannel(channel);
|
manager.createNotificationChannel(channel);
|
||||||
}
|
}
|
||||||
// Create an Intent for the activity you want to start
|
// Create an Intent for the activity you want to start
|
||||||
playerIntent = new Intent(this, VideoPlayer.class);
|
playerIntent = new Intent(getApplicationContext(), VideoPlayer.class);
|
||||||
// Create the TaskStackBuilder and add the intent, which inflates the back stack
|
playerIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
stackBuilder = TaskStackBuilder.create(this);
|
|
||||||
stackBuilder.addNextIntentWithParentStack(playerIntent);
|
|
||||||
// Get the PendingIntent containing the entire back stack
|
// Get the PendingIntent containing the entire back stack
|
||||||
playerPendingIntent =
|
playerPendingIntent = PendingIntent.getActivity
|
||||||
stackBuilder.getPendingIntent(0,
|
(getApplicationContext(), 0, playerIntent, PendingIntent.FLAG_IMMUTABLE);
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
|
|
||||||
appOpsManager = (AppOpsManager)getSystemService(Context.APP_OPS_SERVICE);
|
|
||||||
mediaSession = new MediaSessionCompat(this, getPackageName());
|
mediaSession = new MediaSessionCompat(this, getPackageName());
|
||||||
mediaSessionConnector = new MediaSessionConnector(mediaSession);
|
mediaSessionConnector = new MediaSessionConnector(mediaSession);
|
||||||
hideSystemBars();
|
hideSystemBars();
|
||||||
|
@ -321,7 +316,7 @@ public class VideoPlayer extends AppCompatActivity {
|
||||||
simpleCache.release();
|
simpleCache.release();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
super.onStop();
|
super.onStop();
|
||||||
|
@ -354,7 +349,7 @@ public class VideoPlayer extends AppCompatActivity {
|
||||||
} else {
|
} else {
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue