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


Java RxLogObservable类代码示例

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


RxLogObservable类属于com.fernandocejas.frodo.annotation包,在下文中一共展示了RxLogObservable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDevicesAndPositions

import com.fernandocejas.frodo.annotation.RxLogObservable; //导入依赖的package包/类
@RxLogObservable
public Observable<Pair<List<Device>, List<Position>>> getDevicesAndPositions() {
    return mStorageService.getDevicesList()
            .flatMap(new Func1<List<Device>, Observable<Pair<List<Device>, List<Position>>>>() {
                @Override
                public Observable<Pair<List<Device>, List<Position>>> call(List<Device> devices) {
                    List<Long> ids = new ArrayList<>();
                    for (Device device: devices) {
                        if (device.getPositionId() != null && device.getPositionId() > 0) {
                            ids.add(device.getPositionId());
                        }
                    }
                    return mStorageService.getPositions(ids)
                           .map(positions -> Pair.create(devices, positions));
                }
            })
            .compose(Utils.applySchedulers())
            .doOnError(Timber::w);
}
 
开发者ID:erlymon,项目名称:erlymon-monitor-android,代码行数:20,代码来源:MainService.java

示例2: getPositions

import com.fernandocejas.frodo.annotation.RxLogObservable; //导入依赖的package包/类
@RxLogObservable
public Observable<List<Position>> getPositions(List<Long> ids) {
    StringBuilder builder = new StringBuilder();
    for (int i = 0; i < ids.size(); i ++) {
        builder.append("_id = ?");
        if (i != ids.size() - 1) {
            builder.append(" OR ");
        }
    }

    return storIOSQLite
            .get()
            .listOfObjects(Position.class)
            .withQuery(Query.builder().table(PositionsTable.TABLE)
                    .where(builder.toString())
                    .whereArgs(ids)
                    .build()
            )
            .prepare()
            .asRxObservable();
}
 
开发者ID:erlymon,项目名称:erlymon-monitor-android,代码行数:22,代码来源:StorageService.java

示例3: getUsers

import com.fernandocejas.frodo.annotation.RxLogObservable; //导入依赖的package包/类
@RxLogObservable
public Observable<List<User>> getUsers(Integer lastIdQueried, final boolean refresh) {
    lastIdQueried = lastIdQueried == null ? FIRST_ID_QUERIED : lastIdQueried;

    Observable<List<User>> loader = restApi.getUsers(lastIdQueried, USERS_PER_PAGE).map(response -> {
        handleError(response);
        return response.body();
    });


    if (lastIdQueried == FIRST_ID_QUERIED) {
        loader = rxProviders.getUsers(loader, new DynamicKey(lastIdQueried), new EvictProvider(refresh));
    }

    return loader;
}
 
开发者ID:FuckBoilerplate,项目名称:base_app_android,代码行数:17,代码来源:UserRepository.java

示例4: call

import com.fernandocejas.frodo.annotation.RxLogObservable; //导入依赖的package包/类
/**
 * 获取启动页图片
 */
@RxLogObservable
Observable<Bitmap> getStartImage() {
    return Observable.fromCallable(new Callable<Bitmap>() {
        @Override
        public Bitmap call() throws Exception {
            File dir = context.getFilesDir();
            mImageFile = new File(dir, SPLASH_IMAGE_FILEPATH);
            if (mImageFile.exists()) {
                return BitmapFactory.decodeFile(mImageFile.getAbsolutePath());
            } else {
                return BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_launch_bg);
            }
        }
    });
}
 
开发者ID:wl9739,项目名称:DuDian,代码行数:19,代码来源:DiskRepository.java

示例5: userEntityList

import com.fernandocejas.frodo.annotation.RxLogObservable; //导入依赖的package包/类
@RxLogObservable
@Override public Observable<List<UserEntity>> userEntityList() {
  return Observable.create(subscriber -> {
    Log.i("AAA","INSIDE CALL:"+Thread.currentThread().getName());  // inside call---> same thread
    if (isThereInternetConnection()) {
      try {
        String responseUserEntities = getUserEntitiesFromApi();
        if (responseUserEntities != null) {
          subscriber.onNext(userEntityJsonMapper.transformUserEntityCollection(
              responseUserEntities));
          subscriber.onCompleted();
        } else {
          subscriber.onError(new NetworkConnectionException());
        }
      } catch (Exception e) {
        subscriber.onError(new NetworkConnectionException(e.getCause()));
      }
    } else {
      subscriber.onError(new NetworkConnectionException());
    }
  });
}
 
开发者ID:nanyi5452,项目名称:cleanDemo,代码行数:23,代码来源:RestApiImpl.java

示例6: userEntityById

import com.fernandocejas.frodo.annotation.RxLogObservable; //导入依赖的package包/类
@RxLogObservable
@Override public Observable<UserEntity> userEntityById(final int userId) {
  return Observable.create(subscriber -> {
    if (isThereInternetConnection()) {
      try {
        String responseUserDetails = getUserDetailsFromApi(userId);
        if (responseUserDetails != null) {
          subscriber.onNext(userEntityJsonMapper.transformUserEntity(responseUserDetails));
          subscriber.onCompleted();
        } else {
          subscriber.onError(new NetworkConnectionException());
        }
      } catch (Exception e) {
        subscriber.onError(new NetworkConnectionException(e.getCause()));
      }
    } else {
      subscriber.onError(new NetworkConnectionException());
    }
  });
}
 
开发者ID:nanyi5452,项目名称:cleanDemo,代码行数:21,代码来源:RestApiImpl.java

示例7: call

import com.fernandocejas.frodo.annotation.RxLogObservable; //导入依赖的package包/类
@RxLogObservable @Override public Observable<Beer> call(Beer beer) {
  return Observable.create(new Observable.OnSubscribe<Beer>() {
    @Override public void call(Subscriber<? super Beer> subscriber) {
      try {
        Beer createdBeer = mBeerDao.create(beer);
        if (!subscriber.isUnsubscribed()) {
          subscriber.onNext(createdBeer);
        }
        subscriber.onCompleted();
      } catch (DBOperationException e) {
        e.printStackTrace();
        Observable.error(new Throwable("Error occurs when adding beer"));
      }
    }
  });
}
 
开发者ID:ChunyuanCai,项目名称:PocketBeer,代码行数:17,代码来源:AddBeerUseCaseImpl.java

示例8: getAllApplications

import com.fernandocejas.frodo.annotation.RxLogObservable; //导入依赖的package包/类
@RxLogObservable private Observable<List<ApplicationInfo>> getAllApplications() {
  return Observable.from(
      context.getPackageManager().getInstalledApplications(PackageManager.GET_META_DATA))
      .observeOn(Schedulers.computation())
      .filter(Utils.removeSelfPackage(context))
      .filter(Utils.removeLaunchers(context))
      .filter(Utils.removeSystemApps())
      .toSortedList(Utils.getApplicationSortFunction(context))
      .observeOn(AndroidSchedulers.mainThread())
      .cache();
}
 
开发者ID:aashrairavooru,项目名称:GET-TO-WORK,代码行数:12,代码来源:ApplicationInfoFetcher.java

示例9: signOut

import com.fernandocejas.frodo.annotation.RxLogObservable; //导入依赖的package包/类
@RxLogObservable
public Observable<Void> signOut() {
    return mNetworkService.deleteSession()
            .flatMap(new Func1<Void, Observable<Void>>() {
                @Override
                public Observable<Void> call(Void aVoid) {
                    return mStorageService.drop();
                }
            })
            .compose(Utils.applySchedulers())
            .doOnError(Timber::w);
}
 
开发者ID:erlymon,项目名称:erlymon-monitor-android,代码行数:13,代码来源:MainService.java

示例10: getServer

import com.fernandocejas.frodo.annotation.RxLogObservable; //导入依赖的package包/类
@RxLogObservable
public Observable<Server> getServer() {
    return mNetworkService.getServer()
            .flatMap(new Func1<Server, Observable<Server>>() {
                @Override
                public Observable<Server> call(Server server) {
                    return mStorageService.saveServer(server);
                }
            })
            .compose(Utils.applySchedulers())
            .doOnError(Timber::w);
}
 
开发者ID:erlymon,项目名称:erlymon-monitor-android,代码行数:13,代码来源:MainService.java

示例11: getDevices

import com.fernandocejas.frodo.annotation.RxLogObservable; //导入依赖的package包/类
@RxLogObservable
public Observable<Pair<List<Device>, List<Device>>> getDevices(boolean admin, long userId) {
    return Observable.zip(
            mNetworkService.getDevices(admin),
            mNetworkService.getDevices(userId),
            Pair::new)
            .compose(Utils.applySchedulers())
            .doOnError(Timber::w);
}
 
开发者ID:erlymon,项目名称:erlymon-monitor-android,代码行数:10,代码来源:MainService.java

示例12: deleteUser

import com.fernandocejas.frodo.annotation.RxLogObservable; //导入依赖的package包/类
@RxLogObservable
public Observable<Void> deleteUser(long id) {
    return mNetworkService.deleteUser(id)
            .flatMap(new Func1<Void, Observable<Void>>() {
                @Override
                public Observable<Void> call(Void avoid) {
                    return mStorageService.deleteUser(id);
                }
            })
            .compose(Utils.applySchedulers())
            .doOnError(Timber::w);
}
 
开发者ID:erlymon,项目名称:erlymon-monitor-android,代码行数:13,代码来源:MainService.java

示例13: createDevice

import com.fernandocejas.frodo.annotation.RxLogObservable; //导入依赖的package包/类
@RxLogObservable
public Observable<Device> createDevice(Device device) {
    return mNetworkService.createDevice(device)
            .flatMap(new Func1<Device, Observable<Device>>() {
                @Override
                public Observable<Device> call(Device result) {
                    return mStorageService.saveDevice(result);
                }
            })
            .compose(Utils.applySchedulers())
            .doOnError(Timber::w);
}
 
开发者ID:erlymon,项目名称:erlymon-monitor-android,代码行数:13,代码来源:MainService.java

示例14: updateDevice

import com.fernandocejas.frodo.annotation.RxLogObservable; //导入依赖的package包/类
@RxLogObservable
public Observable<Device> updateDevice(Device device) {
    return mNetworkService.updateDevice(device)
            .flatMap(new Func1<Device, Observable<Device>>() {
                @Override
                public Observable<Device> call(Device result) {
                    return mStorageService.saveDevice(result);
                }
            })
            .compose(Utils.applySchedulers())
            .doOnError(Timber::w);
}
 
开发者ID:erlymon,项目名称:erlymon-monitor-android,代码行数:13,代码来源:MainService.java

示例15: deleteDevice

import com.fernandocejas.frodo.annotation.RxLogObservable; //导入依赖的package包/类
@RxLogObservable
public Observable<Void> deleteDevice(long id) {
    return mNetworkService.deleteDevice(id)
            .flatMap(new Func1<Void, Observable<Void>>() {
                @Override
                public Observable<Void> call(Void avoid) {
                    return mStorageService.deleteDevice(id);
                }
            })
            .compose(Utils.applySchedulers())
            .doOnError(Timber::w);
}
 
开发者ID:erlymon,项目名称:erlymon-monitor-android,代码行数:13,代码来源:MainService.java


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