Generic Recycler Adapter

Generic adapters for Android based on https://github.com/MaximeJallu/retrofit_factory

Лицензия

Лицензия

The Code Project Open License (CPOL) 1.02
Группа

Группа

com.github.maximejallu
Идентификатор

Идентификатор

factory
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

aar
Описание

Описание

Generic Recycler Adapter
Generic adapters for Android based on https://github.com/MaximeJallu/retrofit_factory
Ссылка на сайт

Ссылка на сайт

https://github.com/MaximeJallu/retrofit_factory
Система контроля версий

Система контроля версий

https://github.com/MaximeJallu/retrofit_factory

Скачать factory

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.maximejallu/factory/ -->
<dependency>
    <groupId>com.github.maximejallu</groupId>
    <artifactId>factory</artifactId>
    <version>1.0.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.maximejallu/factory/
implementation 'com.github.maximejallu:factory:1.0.0'
// https://jarcasting.com/artifacts/com.github.maximejallu/factory/
implementation ("com.github.maximejallu:factory:1.0.0")
'com.github.maximejallu:factory:aar:1.0.0'
<dependency org="com.github.maximejallu" name="factory" rev="1.0.0">
  <artifact name="factory" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.github.maximejallu', module='factory', version='1.0.0')
)
libraryDependencies += "com.github.maximejallu" % "factory" % "1.0.0"
[com.github.maximejallu/factory "1.0.0"]

Зависимости

compile (6)

Идентификатор библиотеки Тип Версия
com.squareup.okhttp3 : okhttp jar 3.9.0
com.squareup.okhttp3 : logging-interceptor jar 3.9.0
com.squareup.retrofit2 : retrofit jar 2.0.2
com.squareup.retrofit2 : converter-gson jar 2.0.2
com.squareup.retrofit2 : adapter-rxjava jar 2.0.2
com.android.support » appcompat-v7 jar 27.1.1

Модули Проекта

Данный проект не имеет модулей.

Status

alt text API

Generic-Factory for Retrofit:

This tool allows you to no longer worry about adapters. Now you will only create your ViewHolder. Communication management between your Views and your ViewHolders is possible. Creating sections is now very easily. Enjoy.

Download Maven Central

buildtool used is 27 use {exclude group: 'com.android.support'} only if you have problems

dependencies {
    ...
    implementation ('com.github.maximejallu:factory:{version}')
    ...
}

Init Factory

class ProviderModule {

    @Provides
    Gson provideTestGson() {
        return new GsonBuilder()
                .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
                .create();
    }

    @Provides
    OkHttpClient providesClientDefault(Gson gson){
        return new OkHttpBuilder().loggingLevel(BuildConfig.DEBUG).build();
    }

    @Provides
    OkHttpConfiguration providesClientHttpHelper(OkHttpClient client, Gson gson) {
        return new OkHttpConfiguration.Builder(client, GsonConverterFactory.create(gson))
                .registerCallAdapter(RxAdapterFactory.create(), "proxy_v3")
                .addApiKey("apiKey1", "fail111c-dc6d-4f4c-8adc-2fg9a90z249z")
                .addUrlConfiguration("proxy_v3", "https://apiproxy-v3.preprod.marque.net/")
                .build();
    }

    @Provides
    ApiFactory providesApiFactory(OkHttpConfiguration configuration) {
        return new ApiFactory(configuration);
    }
}

1- Create yours Services Interface with @nnotation

@ApiKeyService("apiKey1", "proxy_v3")
interface GeoDataService{
    @POST("...")
    Observable<Response> postObject(...);
}

@ApiKeyService("apiKey1", "http://base-url-service.net/api/")
interface GeoDataService2{
    @POST("...")
    Observable<Response> postObject(...);
}

Or Create yours Services Interface without annotation

interface GeoDataService3{
    @GET("...")
    Observable<Result> getObject(...);
}

2 - Provides Services

    @Provides
    @Singleton
    GeoDataService provideGeoDataService(ApiFactory factory) {
    /*if GeoDataService with annotation*/
    return factory.create(GeoDataService.class);    
    /*else create manually*/
    return factory.create(GeoDataService.class, /*tag: http client*/ "proxy_v3", "apiKey1");
    }

Версии библиотеки

Версия
1.0.0