// Path: app/src/main/java/com/travelersdiary/interfaces/PicasaService.java
// public interface PicasaService {
// 
//     @GET("feed/api/user/{username}")
//     Call<PicasaFeed> feed(@Path("username") String username);
// 
//     @Headers("Content-Type: application/atom+xml")
//     @POST("feed/api/user/{username}")
//     Call<PicasaAlbum> createAlbum(@Path("username") String username, @Body PicasaAlbum album);
// 
//     @POST("feed/api/user/{username}/albumid/{albumId}")
//     Call<PicasaPhoto> uploadPhoto(@Path("username") String username,
//                                   @Path("albumId") String albumId,
//                                   @Body RequestBody file);
// 
// }


import com.travelersdiary.interfaces.PicasaService;
import java.io.IOException;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.simplexml.SimpleXmlConverterFactory;
                if (localInstance == null) {
                    instance = localInstance = new PicasaClient();
                }
            }
        }
        return localInstance;
    }

    public void createService(final String authToken) {
        HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
        interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);

        OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
        httpClient.addInterceptor(interceptor);

        if (authToken != null) {
            httpClient.addInterceptor(new Interceptor() {
                @Override
                public Response intercept(Interceptor.Chain chain) throws IOException {
                    Request original = chain.request();

                    // Request customization: add request headers
                    Request.Builder requestBuilder = original.newBuilder()
                            .header("Accept", "application/atom+xml")
                            .header("Authorization", "Bearer " + authToken)
                            .method(original.method(), original.body());

                    Request request = requestBuilder.build();
                    return chain.proceed(request);
                }
// Path: app/src/main/java/com/travelersdiary/interfaces/PicasaService.java
// public interface PicasaService {
// 
//     @GET("feed/api/user/{username}")
//     Call<PicasaFeed> feed(@Path("username") String username);
// 
//     @Headers("Content-Type: application/atom+xml")
//     @POST("feed/api/user/{username}")
//     Call<PicasaAlbum> createAlbum(@Path("username") String username, @Body PicasaAlbum album);
// 
//     @POST("feed/api/user/{username}/albumid/{albumId}")
//     Call<PicasaPhoto> uploadPhoto(@Path("username") String username,
//                                   @Path("albumId") String albumId,
//                                   @Body RequestBody file);
// 
// }


// Path: app/src/main/java/com/travelersdiary/PicasaClient.java
import com.travelersdiary.interfaces.PicasaService;
import java.io.IOException;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.simplexml.SimpleXmlConverterFactory;

                if (localInstance == null) {
                    instance = localInstance = new PicasaClient();
                }
            }
        }
        return localInstance;
    }

    public void createService(final String authToken) {
        HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
        interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);

        OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
        httpClient.addInterceptor(interceptor);

        if (authToken != null) {
            httpClient.addInterceptor(new Interceptor() {
                @Override
                public Response intercept(Interceptor.Chain chain) throws IOException {
                    Request original = chain.request();

                    // Request customization: add request headers
                    Request.Builder requestBuilder = original.newBuilder()
                            .header("Accept", "application/atom+xml")
                            .header("Authorization", "Bearer " + authToken)
                            .method(original.method(), original.body());

                    Request request = requestBuilder.build();
                    return chain.proceed(request);
                }
            });