-
Notifications
You must be signed in to change notification settings - Fork 0
Code Documentation
Maël Drapier edited this page Nov 18, 2018
·
6 revisions
Happy Niglo is an Imgur client android app.
It's written in Java/Kotlin on Android Studio, and is built with gradle.
We are using CircleImageView, Retrofit and Glide.
In the app/build.gradle file:
dependencies {
...
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
...
}Here are the Imgur API calls we are using (thanks to Retrofit)
In ImgurApi.java:
- GET calls:
@GET("account/{user}/avatar")
Call<Avatar> getAvatar(@Path("user") String user);
@GET("account/{user}/images")
Call<ImageList> getUserImages(@Path("user") String user);
@GET("account/{user}/favorites")
Call<AlbumList> getUserFavorites(@Path("user") String user);
@GET("gallery/search/{sort}/{window}/{page}")
Call<AlbumList> getSearchedImages(@Path("sort") Sort sort, @Path("window") Window window, @Path("page") int page, @Query("q") String query);- POST calls:
@POST("{type}/{imageHash}/favorite")
Call<Response> switchFavorites(@Path("type") String type, @Path("imageHash") String hash);
@FormUrlEncoded
@POST("image/{imageHash}")
Call<Response> updateImageInfos(@Path("imageHash") String hash, @Field("title") String title, @Field("description") String desc);
@POST("image")
Call<ResponseBody> getUploadResponse(@Body RequestBody body);
@POST("gallery/{Hash}/vote/{vote}")
Call<Response> toogleLike(@Path("Hash") String hash, @Path("vote") Vote vote);- DELETE calls:
@DELETE("image/{imageHash}")
Call<Response> deleteImage(@Path("imageHash") String hash);