本文整理匯總了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);
}
示例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;
}
示例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;
}
示例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))
)
);
}
示例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();
}
示例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();
}
示例7: buildAndLogError
import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable buildAndLogError(int statusCode, Throwable t) {
this.statusCode = statusCode;
this.exception = t;
return Completable.complete();
}
示例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();
}
示例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))
)
);
}
示例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));
}
示例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();
}
示例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);
});
}
示例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));
}
示例14: createAccount
import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable createAccount(Credentials cred) {
if (returnFailure){
return Completable.error(new Exception());
}
return Completable.complete();
}
示例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();
}