当前位置: 首页>>代码示例>>Java>>正文


Java DisposableMaybeObserver类代码示例

本文整理汇总了Java中io.reactivex.observers.DisposableMaybeObserver的典型用法代码示例。如果您正苦于以下问题:Java DisposableMaybeObserver类的具体用法?Java DisposableMaybeObserver怎么用?Java DisposableMaybeObserver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DisposableMaybeObserver类属于io.reactivex.observers包,在下文中一共展示了DisposableMaybeObserver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的io.reactivex.observers.DisposableMaybeObserver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。