本文整理汇总了Java中io.reactivex.observers.DisposableMaybeObserver类的典型用法代码示例。如果您正苦于以下问题:Java DisposableMaybeObserver类的具体用法?Java DisposableMaybeObserver怎么用?Java DisposableMaybeObserver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DisposableMaybeObserver类属于io.reactivex.observers包,在下文中一共展示了DisposableMaybeObserver类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getUser
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
public void getUser() {
disposableSubscriptions.add(auth.getUser()
.subscribeOn(schedulerProvider.io())
.observeOn(schedulerProvider.ui())
.subscribeWith(new DisposableMaybeObserver<User>() {
@Override
public void onComplete() {
//TODO handle this as an issue
view.showProgressIndicator(false);
}
@Override
public void onSuccess(User user) {
addUserProfileToDatabase(user.getEmail(), user.getUserId());
}
@Override
public void onError(Throwable e) {
view.showProgressIndicator(false);
view.makeToast(e.getMessage());
}
})
);
}
开发者ID:BracketCove,项目名称:Profiler,代码行数:26,代码来源:CreateAccountPresenter.java
示例2: getActiveUser
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
private void getActiveUser(){
subscriptions.add(auth.getUser()
.subscribeOn(schedulerProvider.io())
.observeOn(schedulerProvider.ui())
.subscribeWith(new DisposableMaybeObserver<User>() {
@Override
public void onSuccess(User user) {
getUserProfile(user.getUserId());
}
@Override
public void onError(Throwable e) {
view.makeToast(R.string.error_no_data_found);
}
@Override
public void onComplete() {
view.startProfilePageActivity();
}
})
);
}
开发者ID:BracketCove,项目名称:Profiler,代码行数:24,代码来源:ProfileDetailPresenter.java
示例3: getUserProfile
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
private void getUserProfile(String uid) {
subscriptions.add(database.getProfile(uid)
.subscribeOn(schedulerProvider.io())
.observeOn(schedulerProvider.ui())
.subscribeWith(new DisposableMaybeObserver<Profile>() {
@Override
public void onSuccess(Profile profile) {
ProfileDetailPresenter.this.currentProfile = profile;
view.setBioText(profile.getBio());
view.setInterestsText(profile.getInterests());
}
@Override
public void onError(Throwable e) {
view.makeToast(R.string.error_no_data_found);
}
@Override
public void onComplete() {
view.startProfilePageActivity();
}
})
);
}
开发者ID:BracketCove,项目名称:Profiler,代码行数:26,代码来源:ProfileDetailPresenter.java
示例4: loadImageURLsIfAvailable
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
private void loadImageURLsIfAvailable(){
view.showProgressIndicator(true);
subscriptions.add(photoSource.getThumbnails(resolver)
.subscribeOn(schedulerProvider.io())
.observeOn(schedulerProvider.ui())
.subscribeWith(new DisposableMaybeObserver<List<Photo>>() {
@Override
public void onSuccess(List<Photo> photos) {
view.showProgressIndicator(false);
PhotoGalleryPresenter.this.photos = photos;
view.setAdapterData(photos);
}
@Override
public void onError(Throwable e) {
view.makeToast(e.getMessage());
}
@Override
public void onComplete() {
view.setNoListDataFound();
}
})
);
}
开发者ID:BracketCove,项目名称:Profiler,代码行数:27,代码来源:PhotoGalleryPresenter.java
示例5: getCurrentUser
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
private void getCurrentUser() {
view.showProgressIndicator(true);
subscriptions.add(auth.getUser()
.subscribeOn(schedulerProvider.io())
.observeOn(schedulerProvider.ui())
.subscribeWith(new DisposableMaybeObserver<User>() {
@Override
public void onComplete() {
view.startPhotoGalleryActivity();
}
@Override
public void onSuccess(User user) {
getCurrentProfile(user.getUserId());
}
@Override
public void onError(Throwable e) {
view.startPhotoGalleryActivity();
view.makeToast(e.getMessage());
}
})
);
}
开发者ID:BracketCove,项目名称:Profiler,代码行数:26,代码来源:PhotoDetailPresenter.java
示例6: parseIntentUri
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
private void parseIntentUri(final Uri uri) {
getBookmarkDataObservable(parseUri(uri))
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new DisposableMaybeObserver<BookmarkData>() {
@Override
public void onSuccess(BookmarkData bookmarkData) {
if (mCurrentActivity != null) {
mCurrentActivity.showImportConfirmationDialog(bookmarkData);
}
}
@Override
public void onError(Throwable e) {
if (mCurrentActivity != null) {
handleExternalStorageFile(uri);
}
}
@Override
public void onComplete() {
if (mCurrentActivity != null) {
handleExternalStorageFile(uri);
}
}
});
}
开发者ID:Elias33,项目名称:Quran,代码行数:27,代码来源:QuranImportPresenter.java
示例7: handleExternalStorageFileInternal
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
private void handleExternalStorageFileInternal(Uri uri) {
getBookmarkDataObservable(parseExternalFile(uri))
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new DisposableMaybeObserver<BookmarkData>() {
@Override
public void onSuccess(BookmarkData bookmarkData) {
if (mCurrentActivity != null) {
mCurrentActivity.showImportConfirmationDialog(bookmarkData);
}
}
@Override
public void onError(Throwable e) {
if (mCurrentActivity != null) {
mCurrentActivity.showError();
}
}
@Override
public void onComplete() {
if (mCurrentActivity != null) {
mCurrentActivity.showError();
}
}
});
}
开发者ID:Elias33,项目名称:Quran,代码行数:27,代码来源:QuranImportPresenter.java
示例8: rx2MaybeWithSubscriber
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
public void rx2MaybeWithSubscriber() {
io.reactivex.Maybe.just("test").subscribeWith(new DisposableMaybeObserver<String>() {
@Override
public void onSuccess(String s) {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
}
开发者ID:IlyaGulya,项目名称:rxlint,代码行数:19,代码来源:SubscriberTest.java
示例9: deleteFavorite
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
@Override
public void deleteFavorite(Long id) {
mSubscriptions.add(mStripRepository.deleteFavorite(id).subscribeWith(
new DisposableMaybeObserver<Integer>() {
@Override
public void onSuccess(Integer numberRow) {}
@Override
public void onError(Throwable e) {
Log.e(TAG, "Could not delete in favorite", e);
mListStripView.displayErrorAddFavorite();
}
@Override
public void onComplete() {}
}));
}
开发者ID:DevHugo,项目名称:commitstrip-reader,代码行数:21,代码来源:ListStripAbstractPresenter.java
示例10: getUserData
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
private void getUserData() {
view.setThumbnailLoadingIndicator(true);
view.setDetailLoadingIndicators(true);
disposableSubscriptions.add(
auth.getUser().subscribeOn(schedulerProvider.io())
.observeOn(schedulerProvider.ui())
.subscribeWith(
new DisposableMaybeObserver<User>() {
@Override
public void onError(Throwable e) {
view.makeToast(R.string.error_retrieving_data);
view.startLoginActivity();
}
@Override
public void onComplete() {
view.makeToast(R.string.error_retrieving_data);
view.startLoginActivity();
}
@Override
public void onSuccess(User user) {
ProfilePagePresenter.this.currentUser = user;
getUserProfileFromDatabase();
}
}
)
);
}
开发者ID:BracketCove,项目名称:Profiler,代码行数:31,代码来源:ProfilePagePresenter.java
示例11: getUserProfileFromDatabase
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
private void getUserProfileFromDatabase() {
disposableSubscriptions.add(database.getProfile(currentUser.getUserId())
.subscribeOn(schedulerProvider.io())
.observeOn(schedulerProvider.ui())
.subscribeWith(new DisposableMaybeObserver<Profile>() {
@Override
public void onSuccess(Profile profile) {
view.setBio(profile.getBio());
view.setInterests(profile.getInterests());
view.setName(profile.getName());
view.setEmail(profile.getEmail());
view.setDetailLoadingIndicators(false);
String photoURL = profile.getPhotoURL();
if (photoURL.equals("")){
view.setDefaultProfilePhoto();
} else {
view.setProfilePhotoURL(profile.getPhotoURL());
}
}
@Override
public void onError(Throwable e) {
view.makeToast(e.getMessage());
view.startLoginActivity();
}
@Override
public void onComplete() {
view.startLoginActivity();
}
})
);
}
开发者ID:BracketCove,项目名称:Profiler,代码行数:37,代码来源:ProfilePagePresenter.java
示例12: getUser
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
/**
* When this Activity first starts, check and see if there is a currently logged in user.
* If so, send the user to their Profile Page.
*/
public void getUser() {
view.showProgressIndicator(true);
compositeDisposable.add(
authSource.getUser()
.subscribeOn(schedulerProvider.io())
.observeOn(schedulerProvider.ui())
.subscribeWith(new DisposableMaybeObserver<User>() {
/**
* If a uses is found, send them straight to their profile
* @param user
*/
@Override
public void onSuccess(User user) {
view.startProfileActivity();
}
@Override
public void onError(Throwable e) {
view.showProgressIndicator(false);
view.makeToast(e.getMessage());
}
/**
* This method fires, when we don't find a user in the Auth Database.
* This is not considered an error!!!
*/
@Override
public void onComplete() {
view.showProgressIndicator(false);
}
})
);
}
开发者ID:BracketCove,项目名称:Profiler,代码行数:38,代码来源:LoginPresenter.java
示例13: getCurrentUser
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
private void getCurrentUser() {
view.showProgressIndicator(true);
disposableSubscriptions.add(
auth.getUser()
.subscribeOn(schedulerProvider.io())
.observeOn(schedulerProvider.ui())
.subscribeWith(
new DisposableMaybeObserver<User>() {
@Override
public void onError(Throwable e) {
view.makeToast(R.string.error_retrieving_data);
view.startLogInActivity();
}
@Override
public void onComplete() {
view.showProgressIndicator(false);
}
@Override
public void onSuccess(User user) {
view.showProgressIndicator(false);
ProfileSettingsPresenter.this.uid = user.getUserId();
}
}
)
);
}
开发者ID:BracketCove,项目名称:Profiler,代码行数:30,代码来源:ProfileSettingsPresenter.java
示例14: getCurrentProfile
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
private void getCurrentProfile(String uid) {
subscriptions.add(database.getProfile(uid)
.subscribeOn(schedulerProvider.io())
.observeOn(schedulerProvider.ui())
.subscribeWith(new DisposableMaybeObserver<Profile>() {
@Override
public void onComplete() {
view.startProfilePageActivity();
}
@Override
public void onSuccess(Profile profile) {
PhotoDetailPresenter.this.currentProfile = profile;
view.setBitmap();
view.showProgressIndicator(true);
}
@Override
public void onError(Throwable e) {
view.showProgressIndicator(false);
view.makeToast(e.getMessage());
}
})
);
}
开发者ID:BracketCove,项目名称:Profiler,代码行数:28,代码来源:PhotoDetailPresenter.java
示例15: viewsAreNotCalledWhenLifecycleDestroyedWithMaybe
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
@Test
public void viewsAreNotCalledWhenLifecycleDestroyedWithMaybe() throws Exception {
Maybe.just("test")
.compose(LifecycleBinder.bind(lifecycleOwner, new DisposableMaybeObserver<String>() {
@Override
public void onSuccess(final String value) {
LifecycleTest.this.methodOnViewCalled = true;
}
@Override
public void onError(final Throwable e) {
LifecycleTest.this.onErrorCalled = true;
}
@Override
public void onComplete() {
LifecycleTest.this.onCompleteCalled = true;
}
}));
lifecycleOwner.handleLifecycleEvent(Lifecycle.Event.ON_START);
TimeUnit.MILLISECONDS.sleep(100);
assertEquals(true, methodOnViewCalled);
lifecycleOwner.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY);
methodOnViewCalled = false; // Make sure there's a fresh state just as LifecycleOwner hits destroy
onCompleteCalled = false;
onErrorCalled = false;
// Need to wait to give it time to potentially fail
TimeUnit.MILLISECONDS.sleep(100);
assertEquals(false, methodOnViewCalled);
assertEquals(false, onCompleteCalled);
assertEquals(false, onErrorCalled);
}
开发者ID:WaylonBrown,项目名称:LifecycleAwareRx,代码行数:36,代码来源:LifecycleTest.java
示例16: viewsAreOnlyCalledWhenLifecycleActiveWithMaybe
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
@Test
public void viewsAreOnlyCalledWhenLifecycleActiveWithMaybe() throws Exception {
Maybe.just("test")
.compose(LifecycleBinder.bind(lifecycleOwner, new DisposableMaybeObserver<String>() {
@Override
public void onSuccess(final String value) {
LifecycleTest.this.methodOnViewCalled = true;
}
@Override
public void onError(final Throwable e) {
}
@Override
public void onComplete() {
}
}));
// Need to wait to give it time to potentially fail
TimeUnit.MILLISECONDS.sleep(100);
assertEquals(false, methodOnViewCalled);
lifecycleOwner.handleLifecycleEvent(Lifecycle.Event.ON_CREATE);
TimeUnit.MILLISECONDS.sleep(100);
assertEquals(false, methodOnViewCalled);
lifecycleOwner.handleLifecycleEvent(Lifecycle.Event.ON_START);
TimeUnit.MILLISECONDS.sleep(100);
// At this point the views should now be called since the lifecycle is active
assertEquals(true, methodOnViewCalled);
}
开发者ID:WaylonBrown,项目名称:LifecycleAwareRx,代码行数:32,代码来源:LifecycleTest.java
示例17: loadLastForecast
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
/**
* Loads the last forecast ({@link Channel}) that was retrieved when the activity first starts.
*/
public void loadLastForecast() {
lastForecastStore.get()
.subscribeOn(schedulerProvider.io())
.observeOn(schedulerProvider.ui())
.subscribe(new DisposableMaybeObserver<Channel>() {
@Override
public void onSuccess(Channel channel) {
setChannel(channel);
if (isViewAttached()) {
String location = channel.getLocation().toString();
getView().setLocationInputText(location);
}
}
@Override
public void onError(Throwable e) {
if (isViewAttached()) {
getView().showError(e, false);
}
}
@Override
public void onComplete() {
if (isViewAttached()) {
getView().showContent();
}
}
});
}
开发者ID:tobyhs,项目名称:WeatherWeight,代码行数:33,代码来源:ForecastPresenter.java
示例18: deleteFavorite
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
@Override
public void deleteFavorite() {
if (mCurrentStrip != null && mCurrentStrip.getId() != null) {
mSubscriptions.add(
mStripRepository
.deleteFavorite(mCurrentStrip.getId())
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribeWith(new DisposableMaybeObserver<Integer>() {
@Override
public void onSuccess(Integer numberRowAffected) {
if (numberRowAffected > 0) {
mStripView.displayIconIsFavorite(false);
}
}
@Override
public void onError(Throwable e) {
mStripView.displayErrorAddFavorite();
Log.e(TAG, "Could not delete favorite: ", e);
}
@Override
public void onComplete() {}
}));
} else {
mStripView.displayErrorAddFavorite();
}
}
开发者ID:DevHugo,项目名称:commitstrip-reader,代码行数:35,代码来源:DisplayStripAbstractPresenter.java
示例19: getTranslationsList
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
public void getTranslationsList(boolean forceDownload) {
Observable.concat(
getCachedTranslationListObservable(forceDownload), getRemoteTranslationListObservable())
.filter(translationList -> translationList.translations != null)
.firstElement()
.filter(translationList -> !translationList.translations.isEmpty())
.map(translationList -> mergeWithServerTranslations(translationList.translations))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new DisposableMaybeObserver<List<TranslationItem>>() {
@Override
public void onSuccess(List<TranslationItem> translationItems) {
if (currentActivity != null) {
currentActivity.onTranslationsUpdated(translationItems);
}
// used for marking upgrades, irrespective of whether or not there is a bound activity
boolean updatedTranslations = false;
for (TranslationItem item : translationItems) {
if (item.needsUpgrade()) {
updatedTranslations = true;
break;
}
}
quranSettings.setHaveUpdatedTranslations(updatedTranslations);
}
@Override
public void onError(Throwable e) {
if (currentActivity != null) {
currentActivity.onErrorDownloadTranslations();
}
}
@Override
public void onComplete() {
if (currentActivity != null) {
currentActivity.onErrorDownloadTranslations();
}
}
});
}
开发者ID:Elias33,项目名称:Quran,代码行数:43,代码来源:TranslationManagerPresenter.java
示例20: fetchStrip
import io.reactivex.observers.DisposableMaybeObserver; //导入依赖的package包/类
@Override
public void fetchStrip(Long id) {
if (Configuration.isIdCorrect(id)) {
mSubscriptions.add (
mStripRepository.fetchStrip(id, false)
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribeWith(new DisposableMaybeObserver<StripDto>() {
@Override
public void onSuccess(StripDto strip) {
// Display image
mFullScreenStripView.askForDisplayImage(strip);
// Update current strip
mCurrentStrip = strip;
// If we were reading strip in from 0 mode,update last read id and date.
long lastReadDate
= mStripRepository.fetchLastReadDateFromTheBeginningMode();
if (mReadFrom0Mode && strip.getReleaseDate().getTime() > lastReadDate) {
mStripRepository.saveLastReadIdFromTheBeginningMode(strip.getId());
Long date = strip.getReleaseDate().getTime();
mStripRepository.saveLastReadDateFromTheBeginningMode(date);
}
}
@Override
public void onError(Throwable e) {
Log.e(TAG, "Could not fetch strip: ", e);
}
@Override
public void onComplete() {}
}));
}
}
开发者ID:DevHugo,项目名称:commitstrip-reader,代码行数:42,代码来源:FullScreenStripPresenter.java
注:本文中的io.reactivex.observers.DisposableMaybeObserver类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论