code refactor

This commit is contained in:
h4h13 2018-08-05 22:00:57 +05:30
parent 058b6bf32a
commit a15d00a80a
2 changed files with 7 additions and 7 deletions

View file

@ -31,7 +31,7 @@ public class KogouClient {
this(createDefaultOkHttpClientBuilder().build());
}
public KogouClient(@NonNull Call.Factory client) {
private KogouClient(@NonNull Call.Factory client) {
Retrofit restAdapter = new Retrofit.Builder()
.baseUrl(BASE_URL)
.callFactory(client)
@ -43,7 +43,7 @@ public class KogouClient {
}
@Nullable
public static Cache createDefaultCache(Context context) {
private static Cache createDefaultCache(Context context) {
File cacheDir = new File(context.getCacheDir().getAbsolutePath(), "/okhttp-lastfm/");
if (cacheDir.mkdirs() || cacheDir.isDirectory()) {
return new Cache(cacheDir, 1024 * 1024 * 10);
@ -51,7 +51,7 @@ public class KogouClient {
return null;
}
public static Interceptor createCacheControlInterceptor() {
private static Interceptor createCacheControlInterceptor() {
return chain -> {
Request modifiedRequest = chain.request().newBuilder()
.addHeader("Cache-Control", String.format("max-age=%d, max-stale=%d", 31536000, 31536000))
@ -60,7 +60,7 @@ public class KogouClient {
};
}
public static OkHttpClient.Builder createDefaultOkHttpClientBuilder() {
private static OkHttpClient.Builder createDefaultOkHttpClientBuilder() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);

View file

@ -17,7 +17,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
public class LastFMRestClient {
public static final String BASE_URL = "http://ws.audioscrobbler.com/2.0/";
private static final String BASE_URL = "http://ws.audioscrobbler.com/2.0/";
private LastFMService apiService;
@ -37,7 +37,7 @@ public class LastFMRestClient {
}
@Nullable
public static Cache createDefaultCache(Context context) {
private static Cache createDefaultCache(Context context) {
File cacheDir = new File(context.getCacheDir().getAbsolutePath(), "/okhttp-lastfm/");
if (cacheDir.mkdirs() || cacheDir.isDirectory()) {
return new Cache(cacheDir, 1024 * 1024 * 10);
@ -45,7 +45,7 @@ public class LastFMRestClient {
return null;
}
public static Interceptor createCacheControlInterceptor() {
private static Interceptor createCacheControlInterceptor() {
return chain -> {
Request modifiedRequest = chain.request().newBuilder()
.addHeader("Cache-Control", String.format("max-age=%d, max-stale=%d", 31536000, 31536000))