Adding Classes to retrieve weather infos from API
This commit is contained in:
parent
88101f58ca
commit
49871926bd
@ -40,4 +40,7 @@ dependencies {
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
implementation "androidx.room:room-runtime:2.2.5"
|
||||
annotationProcessor "androidx.room:room-compiler:2.2.5"
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package fr.romanet.vj.apps.myweather.network;
|
||||
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public class ApiClient {
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("https://api.github.com/")
|
||||
.build();
|
||||
|
||||
GitHubService service = retrofit.create(GitHubService.class);
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package fr.romanet.vj.apps.myweather.network;
|
||||
|
||||
public class Get {
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package fr.romanet.vj.apps.myweather.weather;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Coord {
|
||||
|
||||
@SerializedName("lon")
|
||||
private String _lon;
|
||||
@SerializedName("lat")
|
||||
private String _lat;
|
||||
|
||||
public Coord(String lon, String lat){
|
||||
_lon = lon;
|
||||
_lat = lat;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package fr.romanet.vj.apps.myweather.weather;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Temps {
|
||||
|
||||
@SerializedName("temp")
|
||||
private String _temp;
|
||||
@SerializedName("feels_like")
|
||||
private String _temp_feels_like;
|
||||
@SerializedName("temp_min")
|
||||
private String _temp_min;
|
||||
@SerializedName("temp_max")
|
||||
private String _temp_max;
|
||||
|
||||
public Temps(String temp, String temp_feels_like, String temp_min, String temp_max) {
|
||||
_temp = temp;
|
||||
_temp_feels_like = temp_feels_like;
|
||||
_temp_min = temp_min;
|
||||
_temp_max = temp_max;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package fr.romanet.vj.apps.myweather.weather;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Weather {
|
||||
|
||||
@SerializedName("coord")
|
||||
private Coord _coord;
|
||||
@SerializedName("main")
|
||||
private Temps _temps;
|
||||
@SerializedName("weather")
|
||||
private WeatherDescription _weatherDescription;
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package fr.romanet.vj.apps.myweather.weather;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class WeatherDescription {
|
||||
|
||||
@SerializedName("description")
|
||||
private String _description;
|
||||
@SerializedName("icon")
|
||||
private String _icon;
|
||||
|
||||
public WeatherDescription(String description, String icon){
|
||||
_description = description;
|
||||
_icon = icon;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user