Bug 1290467 - part8 : rename 'ACTION_PLAY' to 'ACTION_RESUME'. r=sebastian

'ACTION_RESUME' should be more suit for its operation.

MozReview-Commit-ID: 4FRHaydVKu5

--HG--
extra : rebase_source : 76b405bf0b7a27f2ea7f27283230df146b71ccfc
This commit is contained in:
Alastor Wu 2016-09-09 09:51:08 +08:00
Родитель 48bbee4b31
Коммит b9bcdbf114
2 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -71,7 +71,7 @@ public class AudioFocusAgent {
} }
Log.d(LOGTAG, "onAudioFocusChange, AUDIOFOCUS_GAIN"); Log.d(LOGTAG, "onAudioFocusChange, AUDIOFOCUS_GAIN");
notifyObservers("AudioFocusChanged", "gainAudioFocus"); notifyObservers("AudioFocusChanged", "gainAudioFocus");
notifyMediaControlService(MediaControlService.ACTION_PLAY); notifyMediaControlService(MediaControlService.ACTION_RESUME);
mAudioFocusState = OWN_FOCUS; mAudioFocusState = OWN_FOCUS;
break; break;
default: default:

Просмотреть файл

@ -34,7 +34,7 @@ public class MediaControlService extends Service implements Tabs.OnTabsChangedLi
public static final String ACTION_INIT = "action_init"; public static final String ACTION_INIT = "action_init";
public static final String ACTION_START = "action_start"; public static final String ACTION_START = "action_start";
public static final String ACTION_PLAY = "action_play"; public static final String ACTION_RESUME = "action_resume";
public static final String ACTION_PAUSE = "action_pause"; public static final String ACTION_PAUSE = "action_pause";
public static final String ACTION_STOP = "action_stop"; public static final String ACTION_STOP = "action_stop";
public static final String ACTION_REMOVE_CONTROL = "action_remove_control"; public static final String ACTION_REMOVE_CONTROL = "action_remove_control";
@ -163,14 +163,14 @@ public class MediaControlService extends Service implements Tabs.OnTabsChangedLi
case ACTION_START : case ACTION_START :
mController.getTransportControls().sendCustomAction(ACTION_START, null); mController.getTransportControls().sendCustomAction(ACTION_START, null);
break; break;
case ACTION_PLAY : case ACTION_RESUME :
mController.getTransportControls().play(); mController.getTransportControls().play();
break; break;
case ACTION_PAUSE : case ACTION_PAUSE :
mController.getTransportControls().pause(); mController.getTransportControls().pause();
break; break;
case ACTION_STOP : case ACTION_STOP :
if (!mActionState.equals(ACTION_PLAY)) { if (!mActionState.equals(ACTION_RESUME)) {
return; return;
} }
mController.getTransportControls().stop(); mController.getTransportControls().stop();
@ -190,7 +190,7 @@ public class MediaControlService extends Service implements Tabs.OnTabsChangedLi
// If media is playing, we just need to create or remove // If media is playing, we just need to create or remove
// the media control interface. // the media control interface.
if (mActionState.equals(ACTION_PLAY)) { if (mActionState.equals(ACTION_RESUME)) {
notifyControlInterfaceChanged(mIsMediaControlPrefOn ? notifyControlInterfaceChanged(mIsMediaControlPrefOn ?
ACTION_PAUSE : ACTION_REMOVE_CONTROL); ACTION_PAUSE : ACTION_REMOVE_CONTROL);
} }
@ -223,7 +223,7 @@ public class MediaControlService extends Service implements Tabs.OnTabsChangedLi
if (action.equals(ACTION_START)) { if (action.equals(ACTION_START)) {
Log.d(LOGTAG, "Controller, onStart"); Log.d(LOGTAG, "Controller, onStart");
notifyControlInterfaceChanged(ACTION_PAUSE); notifyControlInterfaceChanged(ACTION_PAUSE);
mActionState = ACTION_PLAY; mActionState = ACTION_RESUME;
} }
} }
@ -233,14 +233,14 @@ public class MediaControlService extends Service implements Tabs.OnTabsChangedLi
super.onPlay(); super.onPlay();
notifyControlInterfaceChanged(ACTION_PAUSE); notifyControlInterfaceChanged(ACTION_PAUSE);
notifyObservers("MediaControl", "resumeMedia"); notifyObservers("MediaControl", "resumeMedia");
mActionState = ACTION_PLAY; mActionState = ACTION_RESUME;
} }
@Override @Override
public void onPause() { public void onPause() {
Log.d(LOGTAG, "Controller, onPause"); Log.d(LOGTAG, "Controller, onPause");
super.onPause(); super.onPause();
notifyControlInterfaceChanged(ACTION_PLAY); notifyControlInterfaceChanged(ACTION_RESUME);
notifyObservers("MediaControl", "mediaControlPaused"); notifyObservers("MediaControl", "mediaControlPaused");
mActionState = ACTION_PAUSE; mActionState = ACTION_PAUSE;
} }
@ -338,7 +338,7 @@ public class MediaControlService extends Service implements Tabs.OnTabsChangedLi
} }
private Notification.Action createNotificationAction(String action) { private Notification.Action createNotificationAction(String action) {
boolean isPlayAction = action.equals(ACTION_PLAY); boolean isPlayAction = action.equals(ACTION_RESUME);
int icon = isPlayAction ? R.drawable.ic_media_play : R.drawable.ic_media_pause; int icon = isPlayAction ? R.drawable.ic_media_play : R.drawable.ic_media_pause;
String title = getString(isPlayAction ? R.string.media_play : R.string.media_pause); String title = getString(isPlayAction ? R.string.media_play : R.string.media_pause);