io.victoralbertos.jolyglot.GsonSpeaker Java Examples

The following examples show how to use io.victoralbertos.jolyglot.GsonSpeaker. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: MVPArms   Author: JessYanCoding   File: ClientModule.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 提供 {@link RxCache}
 *
 * @param application    {@link Application}
 * @param configuration  {@link RxCacheConfiguration}
 * @param cacheDirectory RxCache 缓存路径
 * @param gson           {@link Gson}
 * @return {@link RxCache}
 */
@Singleton
@Provides
static RxCache provideRxCache(Application application, @Nullable RxCacheConfiguration configuration
        , @Named("RxCacheDirectory") File cacheDirectory, Gson gson) {
    RxCache.Builder builder = new RxCache.Builder();
    RxCache rxCache = null;
    if (configuration != null) {
        rxCache = configuration.configRxCache(application, builder);
    }
    if (rxCache != null) {
        return rxCache;
    }
    return builder
            .persistence(cacheDirectory, new GsonSpeaker(gson));
}
 
Example #2
Source Project: v9porn   Author: ForLovelj   File: ApplicationModule.java    License: MIT License 5 votes vote down vote up
@Singleton
@Provides
static CacheProviders providesCacheProviders(@ApplicationContext Context context) {
    File cacheDir = AppCacheUtils.getRxCacheDir(context);
    return new RxCache.Builder()
            .persistence(cacheDir, new GsonSpeaker())
            .using(CacheProviders.class);
}
 
Example #3
Source Project: AcgClub   Author: Rabtman   File: ClientModule.java    License: MIT License 5 votes vote down vote up
/**
 * 提供RXCache客户端
 *
 * @param cacheDirectory RxCache缓存路径
 */
@Singleton
@Provides
RxCache provideRxCache(@Named("RxCacheDirectory") File cacheDirectory, Gson gson) {
  return new RxCache
      .Builder()
      .persistence(cacheDirectory, new GsonSpeaker(gson));
}
 
Example #4
Source Project: v9porn   Author: techGay   File: ApplicationModule.java    License: MIT License 5 votes vote down vote up
@Singleton
@Provides
static CacheProviders providesCacheProviders(@ApplicationContext Context context) {
    File cacheDir = AppCacheUtils.getRxCacheDir(context);
    return new RxCache.Builder()
            .persistence(cacheDir, new GsonSpeaker())
            .using(CacheProviders.class);
}
 
Example #5
Source Project: POCenter   Author: ittianyu   File: Repertories.java    License: MIT License 5 votes vote down vote up
public Repertories(File cacheDir) {
    // create apis
    cacheApi = new RxCache.Builder()
            .useExpiredDataIfLoaderNotAvailable(true)
            .persistence(cacheDir, new GsonSpeaker())
            .using(CacheApi.class);

    remoteApi = new Retrofit.Builder()
            .baseUrl(URL_BASE)
            .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
            .addConverterFactory(GsonConverterFactory.create())
            .client(UnsafeOkHttpUtils.getClient())
            .build()
            .create(RemoteApi.class);

    // add types
    Context context = BaseApplication.getContext();
    types.add(context.getString(R.string.type_other));
    types.add(context.getString(R.string.type_web));
    types.add(context.getString(R.string.type_we_chat));
    types.add(context.getString(R.string.type_html5));
    types.add(context.getString(R.string.type_app));
    types.add(context.getString(R.string.type_intelligent_hardware));
    types.add(context.getString(R.string.type_desktop_app));
    types.add(context.getString(R.string.type_big_data));
    types.add(context.getString(R.string.type_system));
    types.add(context.getString(R.string.type_sdk_api));
    types.add(context.getString(R.string.type_art));
}
 
Example #6
Source Project: Aurora   Author: Zweihui   File: ClientModule.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 提供 {@link RxCache}
 *
 * @param cacheDirectory RxCache缓存路径
 * @return
 */
@Singleton
@Provides
RxCache provideRxCache(Application application, @Nullable RxCacheConfiguration configuration, @Named("RxCacheDirectory") File cacheDirectory) {
    RxCache.Builder builder = new RxCache.Builder();
    RxCache rxCache = null;
    if (configuration != null) {
        rxCache = configuration.configRxCache(application, builder);
    }
    if (rxCache != null) return rxCache;
    return builder
            .persistence(cacheDirectory, new GsonSpeaker());
}
 
Example #7
Source Project: MVVMArms   Author: xiaobailong24   File: ClientModule.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 提供 {@link RxCache}
 *
 * @param cacheDirectory RxCache 缓存路径
 * @return RxCache
 */
@Singleton
@Provides
RxCache provideRxCache(@Nullable RxCacheConfiguration configuration, @Named("RxCacheDirectory") File cacheDirectory) {
    RxCache.Builder builder = new RxCache.Builder();
    RxCache rxCache = null;
    if (configuration != null) {
        rxCache = configuration.configRxCache(mApplication, builder);
    }
    if (rxCache != null) {
        return rxCache;
    }
    return builder.persistence(cacheDirectory, new GsonSpeaker());
}
 
Example #8
Source Project: RxGpsService   Author: miguelbcr   File: BaseApp.java    License: Apache License 2.0 4 votes vote down vote up
private void initReactiveCache() {
    reactiveCache = new ReactiveCache.Builder()
            .using(getFilesDir(), new GsonSpeaker());
}