use of com.quran.labs.androidquran.dao.audio.AudioRequest in project quran_android by quran.
the class PagerActivity method updatePlayOptions.
public boolean updatePlayOptions(int rangeRepeat, int verseRepeat, boolean enforceRange) {
if (lastAudioRequest != null) {
final AudioRequest updatedAudioRequest = new AudioRequest(lastAudioRequest.getStart(), lastAudioRequest.getEnd(), lastAudioRequest.getQari(), verseRepeat, rangeRepeat, enforceRange, lastAudioRequest.getShouldStream(), lastAudioRequest.getAudioPathInfo());
Intent i = new Intent(this, AudioService.class);
i.setAction(AudioService.ACTION_UPDATE_REPEAT);
i.putExtra(AudioService.EXTRA_PLAY_INFO, updatedAudioRequest);
startService(i);
lastAudioRequest = updatedAudioRequest;
audioStatusBar.setRepeatCount(verseRepeat);
return true;
} else {
return false;
}
}
use of com.quran.labs.androidquran.dao.audio.AudioRequest in project quran_android by quran.
the class PagerActivity method setRepeatCount.
@Override
public void setRepeatCount(int repeatCount) {
if (lastAudioRequest != null) {
final AudioRequest updatedAudioRequest = new AudioRequest(lastAudioRequest.getStart(), lastAudioRequest.getEnd(), lastAudioRequest.getQari(), repeatCount, lastAudioRequest.getRangeRepeatInfo(), lastAudioRequest.getEnforceBounds(), lastAudioRequest.getShouldStream(), lastAudioRequest.getAudioPathInfo());
Intent i = new Intent(this, AudioService.class);
i.setAction(AudioService.ACTION_UPDATE_REPEAT);
i.putExtra(AudioService.EXTRA_PLAY_INFO, updatedAudioRequest);
startService(i);
lastAudioRequest = updatedAudioRequest;
}
}
use of com.quran.labs.androidquran.dao.audio.AudioRequest in project quran_android by quran.
the class AudioService method handleIntent.
private void handleIntent(Intent intent) {
final String action = intent.getAction();
if (ACTION_CONNECT.equals(action)) {
if (State.Stopped == state) {
processStopRequest(true);
} else {
int sura = -1;
int ayah = -1;
int repeatCount = -200;
int state = AudioUpdateIntent.PLAYING;
if (State.Paused == this.state) {
state = AudioUpdateIntent.PAUSED;
}
if (audioQueue != null && audioRequest != null) {
sura = audioQueue.getCurrentSura();
ayah = audioQueue.getCurrentAyah();
repeatCount = audioRequest.getRepeatInfo();
}
Intent updateIntent = new Intent(AudioUpdateIntent.INTENT_NAME);
updateIntent.putExtra(AudioUpdateIntent.STATUS, state);
updateIntent.putExtra(AudioUpdateIntent.SURA, sura);
updateIntent.putExtra(AudioUpdateIntent.AYAH, ayah);
updateIntent.putExtra(AudioUpdateIntent.REPEAT_COUNT, repeatCount);
updateIntent.putExtra(AudioUpdateIntent.REQUEST, audioRequest);
broadcastManager.sendBroadcast(updateIntent);
}
} else if (ACTION_PLAYBACK.equals(action)) {
AudioRequest playInfo = intent.getParcelableExtra(EXTRA_PLAY_INFO);
if (playInfo != null) {
audioRequest = playInfo;
final SuraAyah start = audioRequest.getStart();
audioEventPresenter.onAyahPlayback(start);
final boolean basmallah = !playInfo.isGapless() && SuraAyahExtensionKt.requiresBasmallah(start);
audioQueue = new AudioQueue(quranInfo, audioRequest, new AudioPlaybackInfo(start, 1, 1, basmallah));
Timber.d("audio request has changed...");
if (player != null) {
player.stop();
}
state = State.Stopped;
Timber.d("stop if playing...");
}
processTogglePlaybackRequest();
} else if (ACTION_PLAY.equals(action)) {
processPlayRequest();
} else if (ACTION_PAUSE.equals(action)) {
processPauseRequest();
} else if (ACTION_SKIP.equals(action)) {
processSkipRequest();
} else if (ACTION_STOP.equals(action)) {
processStopRequest();
} else if (ACTION_REWIND.equals(action)) {
processRewindRequest();
} else if (ACTION_UPDATE_REPEAT.equals(action)) {
final AudioRequest playInfo = intent.getParcelableExtra(EXTRA_PLAY_INFO);
if (playInfo != null && audioQueue != null) {
audioQueue = audioQueue.withUpdatedAudioRequest(playInfo);
audioRequest = playInfo;
}
} else {
MediaButtonReceiver.handleIntent(mediaSession, intent);
}
}
Aggregations