com.google.android.exoplayer2.scheduler.Scheduler Java Examples

The following examples show how to use com.google.android.exoplayer2.scheduler.Scheduler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DownloadService.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
private DownloadManagerHelper(
    Context context,
    DownloadManager downloadManager,
    @Nullable Scheduler scheduler,
    Class<? extends DownloadService> serviceClass) {
  this.context = context;
  this.downloadManager = downloadManager;
  this.scheduler = scheduler;
  this.serviceClass = serviceClass;
  downloadManager.addListener(this);
  if (scheduler != null) {
    Requirements requirements = downloadManager.getRequirements();
    setSchedulerEnabled(
        scheduler, /* enabled= */ !requirements.checkRequirements(context), requirements);
  }
}
 
Example #2
Source File: DownloadService.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
private void setSchedulerEnabled(
    Scheduler scheduler, boolean enabled, Requirements requirements) {
  if (!enabled) {
    scheduler.cancel();
  } else {
    String servicePackage = context.getPackageName();
    boolean success = scheduler.schedule(requirements, servicePackage, ACTION_RESTART);
    if (!success) {
      Log.e(TAG, "Scheduling downloads failed.");
    }
  }
}
 
Example #3
Source File: DownloadService.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private RequirementsHelper(
    Context context,
    Requirements requirements,
    @Nullable Scheduler scheduler,
    Class<? extends DownloadService> serviceClass) {
  this.context = context;
  this.requirements = requirements;
  this.scheduler = scheduler;
  this.serviceClass = serviceClass;
  requirementsWatcher = new RequirementsWatcher(context, this, requirements);
}
 
Example #4
Source File: DownloadService.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private RequirementsHelper(
    Context context,
    Requirements requirements,
    @Nullable Scheduler scheduler,
    Class<? extends DownloadService> serviceClass) {
  this.context = context;
  this.requirements = requirements;
  this.scheduler = scheduler;
  this.serviceClass = serviceClass;
  requirementsWatcher = new RequirementsWatcher(context, this, requirements);
}
 
Example #5
Source File: DownloadService.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private DownloadManagerHelper(
    Context context,
    DownloadManager downloadManager,
    @Nullable Scheduler scheduler,
    Class<? extends DownloadService> serviceClass) {
  this.context = context;
  this.downloadManager = downloadManager;
  this.scheduler = scheduler;
  this.serviceClass = serviceClass;
  downloadManager.addListener(this);
  if (scheduler != null) {
    Requirements requirements = downloadManager.getRequirements();
    setSchedulerEnabled(/* enabled= */ !requirements.checkRequirements(context), requirements);
  }
}
 
Example #6
Source File: DownloadService.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private DownloadManagerHelper(
    Context context,
    DownloadManager downloadManager,
    @Nullable Scheduler scheduler,
    Class<? extends DownloadService> serviceClass) {
  this.context = context;
  this.downloadManager = downloadManager;
  this.scheduler = scheduler;
  this.serviceClass = serviceClass;
  downloadManager.addListener(this);
  if (scheduler != null) {
    Requirements requirements = downloadManager.getRequirements();
    setSchedulerEnabled(/* enabled= */ !requirements.checkRequirements(context), requirements);
  }
}
 
Example #7
Source File: DownloadService.java    From MediaSDK with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a {@link Scheduler} to restart the service when requirements allowing downloads to take
 * place are met. If {@code null}, the service will only be restarted if the process is still in
 * memory when the requirements are met.
 */
protected abstract @Nullable Scheduler getScheduler();
 
Example #8
Source File: DownloadService.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a {@link Scheduler} to restart the service when requirements allowing downloads to take
 * place are met. If {@code null}, the service will only be restarted if the process is still in
 * memory when the requirements are met.
 */
protected abstract @Nullable Scheduler getScheduler();
 
Example #9
Source File: DownloadService.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a {@link Scheduler} to restart the service when requirements allowing downloads to take
 * place are met. If {@code null}, the service will only be restarted if the process is still in
 * memory when the requirements are met.
 */
protected abstract @Nullable Scheduler getScheduler();
 
Example #10
Source File: DownloadService.java    From Telegram-FOSS with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a {@link Scheduler} to restart the service when requirements allowing downloads to take
 * place are met. If {@code null}, the service will only be restarted if the process is still in
 * memory when the requirements are met.
 */
protected abstract @Nullable Scheduler getScheduler();
 
Example #11
Source File: DownloadService.java    From Telegram with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a {@link Scheduler} to restart the service when requirements allowing downloads to take
 * place are met. If {@code null}, the service will only be restarted if the process is still in
 * memory when the requirements are met.
 */
protected abstract @Nullable Scheduler getScheduler();