forked from len0rd/rockbox
Android: Remove notification item on pausing too.
Technically, the difference between stop and pause isn't important enough to keep it when no music is playing. This is how other media apps also act. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29405 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
eb01664804
commit
e6ae867206
2 changed files with 10 additions and 7 deletions
|
@ -79,22 +79,25 @@ public class RockboxPCM extends AudioTrack
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private void play_pause(boolean pause) {
|
private void play_pause(boolean pause)
|
||||||
|
{
|
||||||
|
RockboxService service = RockboxService.get_instance();
|
||||||
if (pause)
|
if (pause)
|
||||||
{
|
{
|
||||||
Intent widgetUpdate = new Intent("org.rockbox.UpdateState");
|
Intent widgetUpdate = new Intent("org.rockbox.UpdateState");
|
||||||
widgetUpdate.putExtra("state", "pause");
|
widgetUpdate.putExtra("state", "pause");
|
||||||
RockboxService.get_instance().sendBroadcast(widgetUpdate);
|
service.sendBroadcast(widgetUpdate);
|
||||||
|
service.stopForeground();
|
||||||
pause();
|
pause();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Intent widgetUpdate = new Intent("org.rockbox.UpdateState");
|
Intent widgetUpdate = new Intent("org.rockbox.UpdateState");
|
||||||
widgetUpdate.putExtra("state", "play");
|
widgetUpdate.putExtra("state", "play");
|
||||||
RockboxService.get_instance().sendBroadcast(widgetUpdate);
|
service.sendBroadcast(widgetUpdate);
|
||||||
|
service.startForeground();
|
||||||
if (getPlayState() == AudioTrack.PLAYSTATE_STOPPED)
|
if (getPlayState() == AudioTrack.PLAYSTATE_STOPPED)
|
||||||
{
|
{
|
||||||
RockboxService.get_instance().startForeground();
|
|
||||||
if (getState() == AudioTrack.STATE_INITIALIZED)
|
if (getState() == AudioTrack.STATE_INITIALIZED)
|
||||||
{
|
{
|
||||||
if (h == null)
|
if (h == null)
|
||||||
|
@ -121,10 +124,10 @@ public class RockboxPCM extends AudioTrack
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
throw new IllegalStateException(e);
|
throw new IllegalStateException(e);
|
||||||
}
|
}
|
||||||
RockboxService.get_instance().stopForeground();
|
|
||||||
Intent widgetUpdate = new Intent("org.rockbox.UpdateState");
|
Intent widgetUpdate = new Intent("org.rockbox.UpdateState");
|
||||||
widgetUpdate.putExtra("state", "stop");
|
widgetUpdate.putExtra("state", "stop");
|
||||||
RockboxService.get_instance().sendBroadcast(widgetUpdate);
|
RockboxService.get_instance().sendBroadcast(widgetUpdate);
|
||||||
|
RockboxService.get_instance().stopForeground();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
|
|
@ -309,12 +309,12 @@ public class RockboxService extends Service
|
||||||
registerReceiver(batt_monitor, itf);
|
registerReceiver(batt_monitor, itf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startForeground()
|
void startForeground()
|
||||||
{
|
{
|
||||||
fg_runner.startForeground();
|
fg_runner.startForeground();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopForeground()
|
void stopForeground()
|
||||||
{
|
{
|
||||||
fg_runner.stopForeground();
|
fg_runner.stopForeground();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue