Skip to content

Commit

Permalink
deleted unused parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
oguzcetinbas committed Apr 26, 2023
1 parent 118666d commit 14a0800
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,5 @@ class CustomOkHttpClient() : OkHttpClient() {
.cache(cache)
.addInterceptor(MyCustomInterceptor())
.build()

}


}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import okhttp3.Response
class MyCustomInterceptor: Interceptor {

override fun intercept(chain: Interceptor.Chain): Response {
val MyRequest = chain.request().newBuilder()
val myRequest = chain.request().newBuilder()
.addHeader("Authorization","adadagkljlkasdjklahflasd")
.build()
return chain.proceed(MyRequest)
return chain.proceed(myRequest)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ import java.util.concurrent.TimeUnit

interface WeatherApiService {

@GET("v1/forecast?latitude=52.52&longitude=13.41&current_weather=true&daily=weathercode,apparent_temperature_max,apparent_temperature_min&timezone=auto&temperature_unit=celsius&forecast_days=14")
@GET("v1/forecast?latitude=41.0&longitude=28.9375&current_weather=true&daily=weathercode,apparent_temperature_max,apparent_temperature_min&timezone=auto&temperature_unit=celsius&forecast_days=14")
fun getWeatherResult() : Call<WeatherResponse>

companion object{

fun create() : WeatherApiService {

val retrofit = Retrofit.Builder()
.baseUrl(Consts.BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class WeatherDataAdapter(weatherResponse: WeatherResponse) :

private val currentWeather = weatherResponse.currentWeather
private val times = weatherResponse.daily?.time
private val weatherCodes = weatherResponse.daily?.weathercode
private val maxTemps = weatherResponse.daily?.apparentTemperatureMax
private val minTemps = weatherResponse.daily?.apparentTemperatureMin
private val icons = weatherResponse.icons
Expand All @@ -41,7 +40,8 @@ class WeatherDataAdapter(weatherResponse: WeatherResponse) :
)

Consts.VIEW_TYPE_NEXTDAYS -> layoutInflater.inflate(
R.layout.next_days_item, parent,
R.layout.next_days_item,
parent,
false
)

Expand All @@ -53,18 +53,18 @@ class WeatherDataAdapter(weatherResponse: WeatherResponse) :
override fun onBindViewHolder(holder: WeatherDataAdapter.WeatherDataViewHolder, position: Int) {
holder.bind(
time = times?.get(position),
weatherCode = weatherCodes?.get(position),
maxTemp = maxTemps?.get(position),
minTemp = minTemps?.get(position),
icon = icons[position]

)
}

override fun getItemCount(): Int {
return times?.size ?: 0
}

override fun getItemViewType(position: Int): Int {

return if (position == 0) {
Consts.VIEW_TYPE_CURRENT_DAY
} else
Expand All @@ -74,7 +74,6 @@ class WeatherDataAdapter(weatherResponse: WeatherResponse) :
inner class WeatherDataViewHolder(itemView: View) : ViewHolder(itemView) {
fun bind(
time: String?,
weatherCode: Int?,
maxTemp: Double?,
minTemp: Double?,
icon: Int
Expand Down

0 comments on commit 14a0800

Please sign in to comment.