Search in sources :

Example 1 with QQUser

use of com.yydcdut.note.entity.user.QQUser in project PhotoNoter by yydcdut.

the class RxUser method getQQ.

public Observable<IUser> getQQ() {
    return Observable.create(new Observable.OnSubscribe<IUser>() {

        @Override
        public void call(Subscriber<? super IUser> subscriber) {
            if (mQQUser == null) {
                String name = mSharedPreferences.getString(Q_NAME, NAME_DEFAULT);
                String netImagePath = mSharedPreferences.getString(Q_NET_IMAGE_PATH, Q_NET_IMAGE_PATH_DEFAULT);
                if (TextUtils.isEmpty(name) || TextUtils.isEmpty(netImagePath)) {
                    subscriber.onError(new RxException("没有登录!!!"));
                    return;
                } else {
                    mQQUser = new QQUser(name, netImagePath);
                }
            }
            subscriber.onNext(mQQUser);
            subscriber.onCompleted();
        }
    }).subscribeOn(Schedulers.io());
}
Also used : Subscriber(rx.Subscriber) IUser(com.yydcdut.note.entity.user.IUser) RxException(com.yydcdut.note.model.rx.exception.RxException) QQUser(com.yydcdut.note.entity.user.QQUser)

Example 2 with QQUser

use of com.yydcdut.note.entity.user.QQUser in project PhotoNoter by yydcdut.

the class RxUser method getQQQQ.

private IUser getQQQQ() {
    if (mQQUser == null) {
        String name = mSharedPreferences.getString(Q_NAME, NAME_DEFAULT);
        String netImagePath = mSharedPreferences.getString(Q_NET_IMAGE_PATH, Q_NET_IMAGE_PATH_DEFAULT);
        if (TextUtils.isEmpty(name) || TextUtils.isEmpty(netImagePath)) {
            return null;
        } else {
            mQQUser = new QQUser(name, netImagePath);
        }
    }
    return mQQUser;
}
Also used : QQUser(com.yydcdut.note.entity.user.QQUser)

Aggregations

QQUser (com.yydcdut.note.entity.user.QQUser)2 IUser (com.yydcdut.note.entity.user.IUser)1 RxException (com.yydcdut.note.model.rx.exception.RxException)1 Subscriber (rx.Subscriber)1