androidx.work.WorkerParameters Java Examples

The following examples show how to use androidx.work.WorkerParameters. 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: GndWorkerFactory.java    From ground-android with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public ListenableWorker createWorker(
    @NonNull Context appContext,
    @NonNull String workerClassName,
    @NonNull WorkerParameters params) {
  // There are more generic and robust ways of doing this, but individual constructors are
  // hard-coded for simplicity. If and when github.com/google/dagger/issues/1183 is implemented
  // this class can be removed in favor of DI.
  if (workerClassName.equals(LocalMutationSyncWorker.class.getName())) {
    return new LocalMutationSyncWorker(
        appContext, params, localDataStore, remoteDataStore, notificationManager);
  } else if (workerClassName.equals(TileDownloadWorker.class.getName())) {
    return new TileDownloadWorker(appContext, params, localDataStore, notificationManager);
  } else if (workerClassName.equals(PhotoSyncWorker.class.getName())) {
    return new PhotoSyncWorker(appContext, params, remoteStorageManager, notificationManager);
  } else {
    throw new IllegalArgumentException("Unknown worker class " + workerClassName);
  }
}
 
Example #2
Source File: AsyncUpdateWorker.java    From GeometricWeather with GNU Lesser General Public License v3.0 5 votes vote down vote up
public AsyncUpdateWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
    super(context, workerParams);

    locationList = DatabaseHelper.getInstance(context).readLocationList();

    helper = new PollingUpdateHelper(context, locationList);
    helper.setOnPollingUpdateListener(this);
}
 
Example #3
Source File: DownloadWorker.java    From flutter_downloader with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public DownloadWorker(@NonNull final Context context,
                      @NonNull WorkerParameters params) {
    super(context, params);

    new Handler(context.getMainLooper()).post(new Runnable() {
        @Override
        public void run() {
            startBackgroundIsolate(context);
        }
    });
}
 
Example #4
Source File: BaseWorker.java    From ground-android with Apache License 2.0 5 votes vote down vote up
BaseWorker(
    @NonNull Context context,
    @NonNull WorkerParameters workerParams,
    NotificationManager notificationManager,
    int notificationId) {
  super(context, workerParams);
  this.notificationManager = notificationManager;
  this.notificationId = notificationId;
}
 
Example #5
Source File: LocalMutationSyncWorker.java    From ground-android with Apache License 2.0 5 votes vote down vote up
public LocalMutationSyncWorker(
    @NonNull Context context,
    @NonNull WorkerParameters params,
    LocalDataStore localDataStore,
    RemoteDataStore remoteDataStore,
    NotificationManager notificationManager) {
  super(context, params, notificationManager, LocalMutationSyncWorker.class.hashCode());
  this.localDataStore = localDataStore;
  this.remoteDataStore = remoteDataStore;
  this.featureId = params.getInputData().getString(FEATURE_ID_PARAM_KEY);
}
 
Example #6
Source File: PhotoSyncWorker.java    From ground-android with Apache License 2.0 5 votes vote down vote up
public PhotoSyncWorker(
    @NonNull Context context,
    @NonNull WorkerParameters workerParams,
    RemoteStorageManager remoteStorageManager,
    NotificationManager notificationManager) {
  super(context, workerParams, notificationManager, PhotoSyncWorker.class.hashCode());
  this.remoteStorageManager = remoteStorageManager;
  this.localSourcePath = workerParams.getInputData().getString(SOURCE_FILE_PATH_PARAM_KEY);
  this.remoteDestinationPath = workerParams.getInputData().getString(DESTINATION_PATH_PARAM_KEY);
}
 
Example #7
Source File: TileDownloadWorker.java    From ground-android with Apache License 2.0 5 votes vote down vote up
public TileDownloadWorker(
    @NonNull Context context,
    @NonNull WorkerParameters params,
    LocalDataStore localDataStore,
    NotificationManager notificationManager) {
  super(context, params, notificationManager, TileDownloadWorker.class.hashCode());
  this.context = context;
  this.localDataStore = localDataStore;
}
 
Example #8
Source File: AbstractCreateEmailWorker.java    From lttrs-android with Apache License 2.0 5 votes vote down vote up
AbstractCreateEmailWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
    super(context, workerParams);
    final Data data = workerParams.getInputData();
    this.identity = data.getString(IDENTITY_KEY);
    final String to = data.getString(TO_KEY);
    this.to = to == null ? Collections.emptyList() : EmailAddressUtil.parse(to);
    final String cc = data.getString(CC_KEY);
    this.cc = cc == null ? Collections.emptyList() : EmailAddressUtil.parse(cc);
    this.subject = data.getString(SUBJECT_KEY);
    this.body = data.getString(BODY_KEY);
    final String[] inReplyTo = data.getStringArray(IN_REPLY_TO_KEY);
    this.inReplyTo = inReplyTo == null ? Collections.emptyList() : Arrays.asList(inReplyTo);
}
 
Example #9
Source File: AbstractMuaWorker.java    From lttrs-android with Apache License 2.0 5 votes vote down vote up
AbstractMuaWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
    super(context, workerParams);
    final Data data = getInputData();
    if (data.hasKeyWithValueOfType(ACCOUNT_KEY, Long.class)) {
        this.account = data.getLong(ACCOUNT_KEY, 0L);
    } else {
        throw new IllegalStateException("Missing required account");
    }
}
 
Example #10
Source File: ModifyKeywordWorker.java    From lttrs-android with Apache License 2.0 5 votes vote down vote up
public ModifyKeywordWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
    super(context, workerParams);
    final Data data = getInputData();
    this.threadId = data.getString(THREAD_ID_KEY);
    this.keyword = data.getString(KEYWORD_KEY);
    this.target = data.getBoolean(TARGET_STATE_KEY, false);
}
 
Example #11
Source File: CapabilitiesWorker.java    From nextcloud-notes with GNU General Public License v3.0 4 votes vote down vote up
public CapabilitiesWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
    super(context, workerParams);
}
 
Example #12
Source File: WorkerB.java    From service with Apache License 2.0 4 votes vote down vote up
public WorkerB(@NonNull Context context, @NonNull WorkerParameters workerParams) {
    super(context, workerParams);
}
 
Example #13
Source File: PlatformWorker.java    From android-job with Apache License 2.0 4 votes vote down vote up
public PlatformWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
    super(context, workerParams);
}
 
Example #14
Source File: SearchCalendarEventsWorker.java    From PhoneProfilesPlus with Apache License 2.0 4 votes vote down vote up
public SearchCalendarEventsWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
    super(context, workerParams);

    this.context = context;
}
 
Example #15
Source File: GeofenceScanWorker.java    From PhoneProfilesPlus with Apache License 2.0 4 votes vote down vote up
public GeofenceScanWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
    super(context, workerParams);

    this.context = context;
}
 
Example #16
Source File: WorkerC.java    From service with Apache License 2.0 4 votes vote down vote up
public WorkerC(@NonNull Context context, @NonNull WorkerParameters workerParams) {
    super(context, workerParams);
}
 
Example #17
Source File: DisableScreenTimeoutInternalChangeWorker.java    From PhoneProfilesPlus with Apache License 2.0 4 votes vote down vote up
public DisableScreenTimeoutInternalChangeWorker(
        @NonNull Context context,
        @NonNull WorkerParameters params) {
    super(context, params);
}
 
Example #18
Source File: DelayedWorksWorker.java    From PhoneProfilesPlus with Apache License 2.0 4 votes vote down vote up
public DelayedWorksWorker(
        @NonNull Context context,
        @NonNull WorkerParameters params) {
    super(context, params);
    //this.context = context;
}
 
Example #19
Source File: AutomaticBackup.java    From trackworktime with GNU General Public License v3.0 4 votes vote down vote up
public AutomaticBackup(@NonNull Context context, @NonNull WorkerParameters workerParams) {
    super(context, workerParams);
    this.context = context;
}
 
Example #20
Source File: PeriodicEventsHandlerWorker.java    From PhoneProfilesPlus with Apache License 2.0 4 votes vote down vote up
public PeriodicEventsHandlerWorker(
        @NonNull Context context,
        @NonNull WorkerParameters params) {
    super(context, params);
    this.context = context;
}
 
Example #21
Source File: SyncWorker.java    From nextcloud-notes with GNU General Public License v3.0 4 votes vote down vote up
public SyncWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
    super(context, workerParams);
}
 
Example #22
Source File: FetchWorker.java    From deltachat-android with GNU General Public License v3.0 4 votes vote down vote up
public FetchWorker(
        @NonNull Context context,
        @NonNull WorkerParameters params) {
    super(context, params);
    this.context = context;
}
 
Example #23
Source File: MysplashMuzeiWorker.java    From Mysplash with GNU Lesser General Public License v3.0 4 votes vote down vote up
public MysplashMuzeiWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
    super(context, workerParams);
    DaggerNetworkServiceComponent.create().inject(this);
}
 
Example #24
Source File: AttachmentHandler.java    From tindroid with Apache License 2.0 4 votes vote down vote up
public AttachmentHandler(@NonNull Context context, @NonNull WorkerParameters params) {
    super(context, params);
}
 
Example #25
Source File: NormalUpdateWorker.java    From GeometricWeather with GNU Lesser General Public License v3.0 4 votes vote down vote up
public NormalUpdateWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
    super(context, workerParams);
}
 
Example #26
Source File: AsyncWorker.java    From GeometricWeather with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Keep
@SuppressLint("BanKeepAnnotation")
public AsyncWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
    super(context, workerParams);
}
 
Example #27
Source File: CandyBarArtWorker.java    From candybar with Apache License 2.0 4 votes vote down vote up
public CandyBarArtWorker(@NonNull Context context, @NonNull WorkerParameters params) {
    super(context, params);
}
 
Example #28
Source File: TomorrowForecastUpdateWorker.java    From GeometricWeather with GNU Lesser General Public License v3.0 4 votes vote down vote up
public TomorrowForecastUpdateWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
    super(context, workerParams);
}
 
Example #29
Source File: TodayForecastUpdateWorker.java    From GeometricWeather with GNU Lesser General Public License v3.0 4 votes vote down vote up
public TodayForecastUpdateWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
    super(context, workerParams);
}
 
Example #30
Source File: RestartEventsWithDelayWorker.java    From PhoneProfilesPlus with Apache License 2.0 4 votes vote down vote up
public RestartEventsWithDelayWorker(
        @NonNull Context context,
        @NonNull WorkerParameters params) {
    super(context, params);
    this.context = context;
}