Java Code Examples for com.google.android.exoplayer2.scheduler.Requirements#RequirementFlags
The following examples show how to use
com.google.android.exoplayer2.scheduler.Requirements#RequirementFlags .
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 |
@Override public void onRequirementsStateChanged( DownloadManager downloadManager, Requirements requirements, @Requirements.RequirementFlags int notMetRequirements) { boolean requirementsMet = notMetRequirements == 0; if (downloadService == null && requirementsMet) { try { Intent intent = getIntent(context, serviceClass, DownloadService.ACTION_INIT); context.startService(intent); } catch (IllegalStateException e) { /* startService fails if the app is in the background then don't stop the scheduler. */ return; } } if (scheduler != null) { setSchedulerEnabled(scheduler, /* enabled= */ !requirementsMet, requirements); } }
Example 2
Source File: DownloadManager.java From MediaSDK with Apache License 2.0 | 6 votes |
private void onRequirementsStateChanged( RequirementsWatcher requirementsWatcher, @Requirements.RequirementFlags int notMetRequirements) { Requirements requirements = requirementsWatcher.getRequirements(); for (Listener listener : listeners) { listener.onRequirementsStateChanged(this, requirements, notMetRequirements); } if (this.notMetRequirements == notMetRequirements) { return; } this.notMetRequirements = notMetRequirements; pendingMessages++; internalHandler .obtainMessage(MSG_SET_NOT_MET_REQUIREMENTS, notMetRequirements, /* unused */ 0) .sendToTarget(); }
Example 3
Source File: DownloadService.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public void onRequirementsStateChanged( DownloadManager downloadManager, Requirements requirements, @Requirements.RequirementFlags int notMetRequirements) { boolean requirementsMet = notMetRequirements == 0; if (downloadService == null && requirementsMet) { try { Intent intent = getIntent(context, serviceClass, DownloadService.ACTION_INIT); context.startService(intent); } catch (IllegalStateException e) { /* startService fails if the app is in the background then don't stop the scheduler. */ return; } } if (scheduler != null) { setSchedulerEnabled(/* enabled= */ !requirementsMet, requirements); } }
Example 4
Source File: DownloadManager.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
private void onRequirementsStateChanged( RequirementsWatcher requirementsWatcher, @Requirements.RequirementFlags int notMetRequirements) { Requirements requirements = requirementsWatcher.getRequirements(); for (Listener listener : listeners) { listener.onRequirementsStateChanged(this, requirements, notMetRequirements); } if (this.notMetRequirements == notMetRequirements) { return; } this.notMetRequirements = notMetRequirements; pendingMessages++; internalHandler .obtainMessage(MSG_SET_NOT_MET_REQUIREMENTS, notMetRequirements, /* unused */ 0) .sendToTarget(); }
Example 5
Source File: DownloadService.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public void onRequirementsStateChanged( DownloadManager downloadManager, Requirements requirements, @Requirements.RequirementFlags int notMetRequirements) { boolean requirementsMet = notMetRequirements == 0; if (downloadService == null && requirementsMet) { try { Intent intent = getIntent(context, serviceClass, DownloadService.ACTION_INIT); context.startService(intent); } catch (IllegalStateException e) { /* startService fails if the app is in the background then don't stop the scheduler. */ return; } } if (scheduler != null) { setSchedulerEnabled(/* enabled= */ !requirementsMet, requirements); } }
Example 6
Source File: DownloadManager.java From Telegram with GNU General Public License v2.0 | 6 votes |
private void onRequirementsStateChanged( RequirementsWatcher requirementsWatcher, @Requirements.RequirementFlags int notMetRequirements) { Requirements requirements = requirementsWatcher.getRequirements(); for (Listener listener : listeners) { listener.onRequirementsStateChanged(this, requirements, notMetRequirements); } if (this.notMetRequirements == notMetRequirements) { return; } this.notMetRequirements = notMetRequirements; pendingMessages++; internalHandler .obtainMessage(MSG_SET_NOT_MET_REQUIREMENTS, notMetRequirements, /* unused */ 0) .sendToTarget(); }
Example 7
Source File: DownloadManager.java From MediaSDK with Apache License 2.0 | 4 votes |
private void setNotMetRequirements(@Requirements.RequirementFlags int notMetRequirements) { this.notMetRequirements = notMetRequirements; syncTasks(); }
Example 8
Source File: DownloadManager.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
private void setNotMetRequirements(@Requirements.RequirementFlags int notMetRequirements) { this.notMetRequirements = notMetRequirements; syncTasks(); }
Example 9
Source File: DownloadManager.java From Telegram with GNU General Public License v2.0 | 4 votes |
private void setNotMetRequirements(@Requirements.RequirementFlags int notMetRequirements) { this.notMetRequirements = notMetRequirements; syncTasks(); }
Example 10
Source File: DownloadManager.java From MediaSDK with Apache License 2.0 | 2 votes |
/** * Called when the download requirements state changed. * * @param downloadManager The reporting instance. * @param requirements Requirements needed to be met to start downloads. * @param notMetRequirements {@link Requirements.RequirementFlags RequirementFlags} that are not * met, or 0. */ default void onRequirementsStateChanged( DownloadManager downloadManager, Requirements requirements, @Requirements.RequirementFlags int notMetRequirements) {}
Example 11
Source File: DownloadManager.java From MediaSDK with Apache License 2.0 | 2 votes |
/** * Returns the requirements needed for downloads to progress that are not currently met. * * @return The not met {@link Requirements.RequirementFlags}, or 0 if all requirements are met. */ @Requirements.RequirementFlags public int getNotMetRequirements() { return getRequirements().getNotMetRequirements(context); }
Example 12
Source File: DownloadManager.java From Telegram-FOSS with GNU General Public License v2.0 | 2 votes |
/** * Called when the download requirements state changed. * * @param downloadManager The reporting instance. * @param requirements Requirements needed to be met to start downloads. * @param notMetRequirements {@link Requirements.RequirementFlags RequirementFlags} that are not * met, or 0. */ default void onRequirementsStateChanged( DownloadManager downloadManager, Requirements requirements, @Requirements.RequirementFlags int notMetRequirements) {}
Example 13
Source File: DownloadManager.java From Telegram-FOSS with GNU General Public License v2.0 | 2 votes |
/** * Returns the requirements needed for downloads to progress that are not currently met. * * @return The not met {@link Requirements.RequirementFlags}, or 0 if all requirements are met. */ @Requirements.RequirementFlags public int getNotMetRequirements() { return getRequirements().getNotMetRequirements(context); }
Example 14
Source File: DownloadManager.java From Telegram with GNU General Public License v2.0 | 2 votes |
/** * Called when the download requirements state changed. * * @param downloadManager The reporting instance. * @param requirements Requirements needed to be met to start downloads. * @param notMetRequirements {@link Requirements.RequirementFlags RequirementFlags} that are not * met, or 0. */ default void onRequirementsStateChanged( DownloadManager downloadManager, Requirements requirements, @Requirements.RequirementFlags int notMetRequirements) {}
Example 15
Source File: DownloadManager.java From Telegram with GNU General Public License v2.0 | 2 votes |
/** * Returns the requirements needed for downloads to progress that are not currently met. * * @return The not met {@link Requirements.RequirementFlags}, or 0 if all requirements are met. */ @Requirements.RequirementFlags public int getNotMetRequirements() { return getRequirements().getNotMetRequirements(context); }