當前位置: 首頁>>代碼示例>>Java>>正文


Java Completable.complete方法代碼示例

本文整理匯總了Java中io.reactivex.Completable.complete方法的典型用法代碼示例。如果您正苦於以下問題:Java Completable.complete方法的具體用法?Java Completable.complete怎麽用?Java Completable.complete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.reactivex.Completable的用法示例。


在下文中一共展示了Completable.complete方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testRegistrationOfNamedSink

import io.reactivex.Completable; //導入方法依賴的package包/類
@Test
public void testRegistrationOfNamedSink() {
  Sink<String> source = new Sink<String>() {

    @Override
    public Completable dispatch(Data<String> data) {
      return Completable.complete();
    }

    @Override
    public String name() {
      return "my-sink";
    }
  };

  FluidRegistry.register(source);
  assertThat(FluidRegistry.sink("my-sink")).isSameAs(source);
}
 
開發者ID:cescoffier,項目名稱:fluid,代碼行數:19,代碼來源:FluidRegistryTest.java

示例2: refreshChangedDialogs

import io.reactivex.Completable; //導入方法依賴的package包/類
private Completable refreshChangedDialogs(TmpResult result) {
    Set<Integer> peers = new HashSet<>();

    for (TmpResult.Msg msg : result.getData()) {
        VKApiMessage dto = msg.getDto();
        if (nonNull(dto)) {
            peers.add(dto.peer_id);
        }
    }

    Completable completable = Completable.complete();
    for (int peerId : peers) {
        completable = completable.andThen(messagesInteractor.fixDialogs(result.getAccountId(), peerId));
    }

    return completable;
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:18,代碼來源:RealtimeMessagesProcessor.java

示例3: identifyMissingObjectsGetAndStore

import io.reactivex.Completable; //導入方法依賴的package包/類
private Completable identifyMissingObjectsGetAndStore(TmpResult result) {
    final VKOwnIds ownIds = getOwnIds(result);
    final Collection<Integer> chatIds = getChatIds(result);
    final int accountId = result.getAccountId();

    Completable completable = Completable.complete();
    if (ownIds.nonEmpty()) {
        // проверяем на недостающих пользователей и групп
        completable = completable.andThen(findMissingOwnersGetAndStore(accountId, ownIds));
    }

    if (nonEmpty(chatIds)) {
        // проверяем на отсутствие чатов
        completable = completable.andThen(findMissingChatsGetAndStore(accountId, chatIds));
    }

    return completable;
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:19,代碼來源:RealtimeMessagesProcessor.java

示例4: inflatePublishers

import io.reactivex.Completable; //導入方法依賴的package包/類
private Completable inflatePublishers(Iterable<DeviceAccess> deviceAccesss, DeviceAccessQuery query) {
    // Return as complete if publisher is not a requested field
    if (query.getInflationPolicy() == null || !query.getInflationPolicy().hasChildField(DeviceAccessQuery.PUBLISHER_FIELD)) {
        return Completable.complete();
    }

    Multimap<Long, DeviceAccess> deviceAccesssByPublisherId = HashMultimap.create();

    return Observable.fromIterable(deviceAccesss)
            // Filter out publisher sessions with no publisher
            .filter((deviceAccess) -> deviceAccess.getPublisher() != null && deviceAccess.getPublisher().getId() != null)

            // Collect all of the publisher sessions and their publisher IDs into a map
            .collectInto(deviceAccesssByPublisherId, (map, deviceAccess) -> map.put(deviceAccess.getPublisher().getId(), deviceAccess))

            // Fetch all of the publishers for those publisher IDs
            .flatMapObservable((map) -> map.keySet().isEmpty()? Observable.empty() : publisherFacade.filter(new PublisherQuery().ids(map.keySet())))

            // For each publisher returned, map it to each publisher session that had its ID
            .flatMapCompletable((publisher) ->
                    Observable.fromIterable(deviceAccesssByPublisherId.get(publisher.getId()))
                            .flatMapCompletable((deviceAccess) ->
                                    Completable.fromAction(() -> deviceAccess.setPublisher(publisher))
                            )
            );
}
 
開發者ID:Atypon-OpenSource,項目名稱:wayf-cloud,代碼行數:27,代碼來源:DeviceAccessFacadeImpl.java

示例5: addProduct

import io.reactivex.Completable; //導入方法依賴的package包/類
/**
 * Adds a product to the shopping cart
 */
public Completable addProduct(Product product) {
  List<Product> updatedShoppingCart = new ArrayList<>();
  updatedShoppingCart.addAll(itemsInShoppingCart.getValue());
  updatedShoppingCart.add(product);
  itemsInShoppingCart.onNext(updatedShoppingCart);
  return Completable.complete();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:11,代碼來源:ShoppingCart.java

示例6: removeProduct

import io.reactivex.Completable; //導入方法依賴的package包/類
/**
 * Remove a product to the shopping cart
 */
public Completable removeProduct(Product product) {
  List<Product> updatedShoppingCart = new ArrayList<>();
  updatedShoppingCart.addAll(itemsInShoppingCart.getValue());
  updatedShoppingCart.remove(product);
  itemsInShoppingCart.onNext(updatedShoppingCart);
  return Completable.complete();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:11,代碼來源:ShoppingCart.java

示例7: buildAndLogError

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable buildAndLogError(int statusCode, Throwable t) {
    this.statusCode = statusCode;
    this.exception = t;

    return Completable.complete();
}
 
開發者ID:Atypon-OpenSource,項目名稱:wayf-cloud,代碼行數:8,代碼來源:ErrorLoggerFacadeMockImpl.java

示例8: removeProducts

import io.reactivex.Completable; //導入方法依賴的package包/類
/**
 * Remove a list of Products from the shopping cart
 */
public Completable removeProducts(List<Product> products) {
  List<Product> updatedShoppingCart = new ArrayList<>();
  updatedShoppingCart.addAll(itemsInShoppingCart.getValue());
  updatedShoppingCart.removeAll(products);
  itemsInShoppingCart.onNext(updatedShoppingCart);
  return Completable.complete();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:11,代碼來源:ShoppingCart.java

示例9: inflateDevices

import io.reactivex.Completable; //導入方法依賴的package包/類
private Completable inflateDevices(Iterable<DeviceAccess> deviceAccesss, DeviceAccessQuery query) {
    // Return as complete if device is not a requested field
    if (query.getInflationPolicy() == null || !query.getInflationPolicy().hasChildField(DeviceAccessQuery.DEVICE)) {
        return Completable.complete();
    }

    Multimap<Long, DeviceAccess> deviceAccesssByDeviceId = HashMultimap.create();

    return Observable.fromIterable(deviceAccesss)
            // Filter out publisher sessions with no publisher
            .filter((deviceAccess) -> deviceAccess.getDevice() != null && deviceAccess.getDevice().getId() != null)

            // Collect all of the publisher sessions and their device IDs into a map
            .collectInto(deviceAccesssByDeviceId, (map, deviceAccess) -> map.put(deviceAccess.getDevice().getId(), deviceAccess))

            // Fetch all of the publishers for those publisher IDs
            .flatMapObservable((map) -> map.keySet().isEmpty()? Observable.empty() : deviceFacade.filter(new DeviceQuery().setIds(map.keySet())))

            // For each identity provider returned, map it to each publisher session that had its ID
            .flatMapCompletable((device) ->
                    Observable.fromIterable(deviceAccesssByDeviceId.get(device.getId()))
                            .flatMapCompletable((deviceAccess) ->
                                    Completable.fromAction(() -> deviceAccess.setDevice(device))
                            )

            );
}
 
開發者ID:Atypon-OpenSource,項目名稱:wayf-cloud,代碼行數:28,代碼來源:DeviceAccessFacadeImpl.java

示例10: tapSpin

import io.reactivex.Completable; //導入方法依賴的package包/類
public void tapSpin() {
        Completable complete = Completable.complete();
        complete.delay(0, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(() -> {
            removePayLines();
            bigWinContainer.setVisibility(View.INVISIBLE);
        });
        complete.delay(0, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(() -> spin(0));
        complete.delay(200, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(() -> spin(1));
        complete.delay(400, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(() -> spin(2));
        complete.delay(600, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(() -> spin(3));
        complete.delay(800, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(() -> spin(4));

//        complete.delay(2000, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(() -> drawResult(7, 0.1));
    }
 
開發者ID:SlotNSlot,項目名稱:SlotNSlot_Android,代碼行數:15,代碼來源:AbsSlotFragment.java

示例11: cancelAlarm

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable cancelAlarm(Alarm alarm) {

    Intent intent = new Intent(applicationContext, AlarmReceiverActivity.class);

    PendingIntent alarmIntent = PendingIntent.getActivity(applicationContext,
            Integer.parseInt(alarm.getAlarmId()),
            intent,
            PendingIntent.FLAG_UPDATE_CURRENT);

    alarmManager.cancel(alarmIntent);

    return Completable.complete();
}
 
開發者ID:BracketCove,項目名稱:PosTrainer,代碼行數:15,代碼來源:AlarmService.java

示例12: inflateHistory

import io.reactivex.Completable; //導入方法依賴的package包/類
private Completable inflateHistory(Device device, DeviceQuery query) {
    // Return as complete if authenticatedBy is not a requested field
    if (query.getInflationPolicy() == null || !query.getInflationPolicy().hasChildField(DeviceQuery.HISTORY)) {
        return Completable.complete();
    }

    return Completable.fromAction(() -> {
        List<IdentityProviderUsage> history = identityProviderUsageFacade.buildRecentHistory(device);
        device.setHistory(history);
    });
}
 
開發者ID:Atypon-OpenSource,項目名稱:wayf-cloud,代碼行數:12,代碼來源:DeviceFacadeImpl.java

示例13: tapStop

import io.reactivex.Completable; //導入方法依賴的package包/類
protected void tapStop(boolean isDelay) {
    int delay = isDelay ? 2000 : 0;

    Completable complete = Completable.complete();
    complete.delay(delay, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(() -> stop(0));
    complete.delay(delay + 200, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(() -> stop(1));
    complete.delay(delay + 400, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(() -> stop(2));
    complete.delay(delay + 600, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(() -> stop(3));
    complete.delay(delay + 800, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(() -> stop(4));
}
 
開發者ID:SlotNSlot,項目名稱:SlotNSlot_Android,代碼行數:11,代碼來源:AbsSlotFragment.java

示例14: createAccount

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable createAccount(Credentials cred) {
    if (returnFailure){
       return Completable.error(new Exception());
    }
    return Completable.complete();
}
 
開發者ID:BracketCove,項目名稱:Profiler,代碼行數:8,代碼來源:FakeAuthService.java

示例15: setAlarm

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable setAlarm(Alarm reminder) {
    Calendar alarm = Calendar.getInstance();
    alarm.setTimeInMillis(System.currentTimeMillis());
    alarm.set(Calendar.HOUR_OF_DAY, reminder.getHourOfDay());
    alarm.set(Calendar.MINUTE, reminder.getMinute());

    //make sure you aren't setting an alarm for earlier today
    checkAlarm(alarm);

    Intent intent = new Intent(applicationContext, AlarmReceiverActivity.class);
    intent.putExtra(ALARM_ID, reminder.getAlarmId());
    PendingIntent alarmIntent = PendingIntent.getActivity(
            applicationContext,
            Integer.parseInt(reminder.getAlarmId()),
            intent,
            PendingIntent.FLAG_UPDATE_CURRENT);

    if (reminder.isRenewAutomatically()) {
        alarmManager.setInexactRepeating(android.app.AlarmManager.RTC_WAKEUP, alarm.getTimeInMillis(),
                android.app.AlarmManager.INTERVAL_DAY, alarmIntent);
    } else {
        alarmManager.set(android.app.AlarmManager.RTC_WAKEUP, alarm.getTimeInMillis(),
                alarmIntent);
    }

    return Completable.complete();
}
 
開發者ID:BracketCove,項目名稱:PosTrainer,代碼行數:29,代碼來源:AlarmService.java


注:本文中的io.reactivex.Completable.complete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。