mirror of
https://github.com/hmalik144/Weather-apps.git
synced 2026-03-18 07:26:04 +00:00
latest mono release (#42)
* Imperial units (#24) * Update build.gradle (#26) * - fix db bug (#28) - upgrade application to android 34 * Api fix (#38) * Playstore review fix (#41)
This commit is contained in:
@@ -12,8 +12,8 @@ data class CurrentConditions(
|
||||
@SerializedName("dew") var dew: Double? = null,
|
||||
@SerializedName("precip") var precip: Double? = null,
|
||||
@SerializedName("precipprob") var precipprob: Double? = null,
|
||||
@SerializedName("snow") var snow: Int? = null,
|
||||
@SerializedName("snowdepth") var snowdepth: Int? = null,
|
||||
@SerializedName("snow") var snow: Double? = null,
|
||||
@SerializedName("snowdepth") var snowdepth: Double? = null,
|
||||
@SerializedName("preciptype") var preciptype: ArrayList<String> = arrayListOf(),
|
||||
@SerializedName("windgust") var windgust: Double? = null,
|
||||
@SerializedName("windspeed") var windspeed: Double? = null,
|
||||
@@ -23,7 +23,7 @@ data class CurrentConditions(
|
||||
@SerializedName("cloudcover") var cloudcover: Double? = null,
|
||||
@SerializedName("solarradiation") var solarradiation: Double? = null,
|
||||
@SerializedName("solarenergy") var solarenergy: Double? = null,
|
||||
@SerializedName("uvindex") var uvindex: Int? = null,
|
||||
@SerializedName("uvindex") var uvindex: Double? = null,
|
||||
@SerializedName("conditions") var conditions: String? = null,
|
||||
@SerializedName("icon") var icon: String? = null,
|
||||
@SerializedName("stations") var stations: ArrayList<String> = arrayListOf(),
|
||||
|
||||
@@ -14,12 +14,12 @@ data class Days(
|
||||
@SerializedName("feelslike") var feelslike: Double? = null,
|
||||
@SerializedName("dew") var dew: Double? = null,
|
||||
@SerializedName("humidity") var humidity: Double? = null,
|
||||
@SerializedName("precip") var precip: Number? = null,
|
||||
@SerializedName("precip") var precip: Double? = null,
|
||||
@SerializedName("precipprob") var precipprob: Double? = null,
|
||||
@SerializedName("precipcover") var precipcover: Double? = null,
|
||||
@SerializedName("preciptype") var preciptype: ArrayList<String> = arrayListOf(),
|
||||
@SerializedName("snow") var snow: Int? = null,
|
||||
@SerializedName("snowdepth") var snowdepth: Int? = null,
|
||||
@SerializedName("snow") var snow: Double? = null,
|
||||
@SerializedName("snowdepth") var snowdepth: Double? = null,
|
||||
@SerializedName("windgust") var windgust: Double? = null,
|
||||
@SerializedName("windspeed") var windspeed: Double? = null,
|
||||
@SerializedName("winddir") var winddir: Double? = null,
|
||||
@@ -28,8 +28,8 @@ data class Days(
|
||||
@SerializedName("visibility") var visibility: Double? = null,
|
||||
@SerializedName("solarradiation") var solarradiation: Double? = null,
|
||||
@SerializedName("solarenergy") var solarenergy: Double? = null,
|
||||
@SerializedName("uvindex") var uvindex: Int? = null,
|
||||
@SerializedName("severerisk") var severerisk: Int? = null,
|
||||
@SerializedName("uvindex") var uvindex: Double? = null,
|
||||
@SerializedName("severerisk") var severerisk: Double? = null,
|
||||
@SerializedName("sunrise") var sunrise: String? = null,
|
||||
@SerializedName("sunriseEpoch") var sunriseEpoch: Int? = null,
|
||||
@SerializedName("sunset") var sunset: String? = null,
|
||||
|
||||
@@ -10,10 +10,10 @@ data class Hours(
|
||||
@SerializedName("feelslike") var feelslike: Double? = null,
|
||||
@SerializedName("humidity") var humidity: Double? = null,
|
||||
@SerializedName("dew") var dew: Double? = null,
|
||||
@SerializedName("precip") var precip: Number? = null,
|
||||
@SerializedName("precip") var precip: Double? = null,
|
||||
@SerializedName("precipprob") var precipprob: Double? = null,
|
||||
@SerializedName("snow") var snow: Int? = null,
|
||||
@SerializedName("snowdepth") var snowdepth: Int? = null,
|
||||
@SerializedName("snow") var snow: Double? = null,
|
||||
@SerializedName("snowdepth") var snowdepth: Double? = null,
|
||||
@SerializedName("preciptype") var preciptype: ArrayList<String> = arrayListOf(),
|
||||
@SerializedName("windgust") var windgust: Double? = null,
|
||||
@SerializedName("windspeed") var windspeed: Double? = null,
|
||||
@@ -23,8 +23,8 @@ data class Hours(
|
||||
@SerializedName("cloudcover") var cloudcover: Double? = null,
|
||||
@SerializedName("solarradiation") var solarradiation: Double? = null,
|
||||
@SerializedName("solarenergy") var solarenergy: Double? = null,
|
||||
@SerializedName("uvindex") var uvindex: Int? = null,
|
||||
@SerializedName("severerisk") var severerisk: Int? = null,
|
||||
@SerializedName("uvindex") var uvindex: Double? = null,
|
||||
@SerializedName("severerisk") var severerisk: Double? = null,
|
||||
@SerializedName("conditions") var conditions: String? = null,
|
||||
@SerializedName("icon") var icon: String? = null,
|
||||
@SerializedName("stations") var stations: ArrayList<String> = arrayListOf(),
|
||||
|
||||
@@ -15,7 +15,7 @@ data class WeatherApiResponse(
|
||||
@SerializedName("resolvedAddress") var resolvedAddress: String? = null,
|
||||
@SerializedName("address") var address: String? = null,
|
||||
@SerializedName("timezone") var timezone: String? = null,
|
||||
@SerializedName("tzoffset") var tzoffset: Int? = null,
|
||||
@SerializedName("tzoffset") var tzoffset: Double? = null,
|
||||
@SerializedName("description") var description: String? = null,
|
||||
@SerializedName("days") var days: ArrayList<Days> = arrayListOf(),
|
||||
@SerializedName("alerts") var alerts: ArrayList<Alerts> = arrayListOf(),
|
||||
@@ -28,7 +28,7 @@ data class WeatherApiResponse(
|
||||
return FullWeather(
|
||||
current = Current(currentConditions),
|
||||
timezone = timezone,
|
||||
timezoneOffset = tzoffset,
|
||||
timezoneOffset = tzoffset?.toInt(),
|
||||
hourly = hours,
|
||||
daily = collectedDays,
|
||||
lat = latitude,
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.appttude.h_mal.atlas_weather.data.repository.SettingsRepository
|
||||
import com.appttude.h_mal.atlas_weather.data.room.entity.CURRENT_LOCATION
|
||||
import com.appttude.h_mal.atlas_weather.data.room.entity.EntityItem
|
||||
import com.appttude.h_mal.atlas_weather.model.widget.InnerWidgetCellData
|
||||
import com.appttude.h_mal.atlas_weather.model.widget.InnerWidgetData
|
||||
import com.appttude.h_mal.atlas_weather.model.widget.WidgetData
|
||||
import com.appttude.h_mal.atlas_weather.model.widget.WidgetError
|
||||
import com.appttude.h_mal.atlas_weather.model.widget.WidgetState
|
||||
@@ -21,8 +20,6 @@ import com.appttude.h_mal.atlas_weather.utils.getSymbol
|
||||
import com.appttude.h_mal.atlas_weather.utils.toSmallDayName
|
||||
import com.squareup.picasso.Picasso
|
||||
import com.squareup.picasso.Target
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.io.IOException
|
||||
import kotlin.coroutines.resume
|
||||
import kotlin.coroutines.suspendCoroutine
|
||||
@@ -137,44 +134,6 @@ class ServicesHelper(
|
||||
return WidgetState.HasData(data)
|
||||
}
|
||||
|
||||
suspend fun getWidgetWeather(): WidgetData? {
|
||||
return try {
|
||||
val result = repository.loadSingleCurrentWeatherFromRoom(CURRENT_LOCATION)
|
||||
val epoc = System.currentTimeMillis()
|
||||
|
||||
result.weather.let {
|
||||
val bitmap = it.current?.icon
|
||||
val location = locationProvider.getLocationNameFromLatLong(it.lat!!, it.lon!!)
|
||||
val temp = it.current?.temp?.toInt().toString()
|
||||
|
||||
WidgetData(location, bitmap, temp, epoc)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getWidgetInnerWeather(): List<InnerWidgetData>? {
|
||||
return try {
|
||||
val result = repository.loadSingleCurrentWeatherFromRoom(CURRENT_LOCATION)
|
||||
val list = mutableListOf<InnerWidgetData>()
|
||||
|
||||
result.weather.daily?.drop(1)?.dropLast(2)?.forEach { dailyWeather ->
|
||||
val day = dailyWeather.dt?.toSmallDayName()
|
||||
val bitmap = withContext(Dispatchers.Main) {
|
||||
getBitmapFromUrl(dailyWeather.icon)
|
||||
}
|
||||
val temp = dailyWeather.max?.toInt().toString()
|
||||
|
||||
val item = InnerWidgetData(day, bitmap, temp)
|
||||
list.add(item)
|
||||
}
|
||||
list.toList()
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getWidgetWeatherCollection(): WidgetWeatherCollection? {
|
||||
return try {
|
||||
val result = repository.loadSingleCurrentWeatherFromRoom(CURRENT_LOCATION)
|
||||
|
||||
@@ -49,8 +49,8 @@ data class DailyWeather(
|
||||
days.datetimeEpoch,
|
||||
days.cloudcover?.toInt(),
|
||||
days.precipprob,
|
||||
days.uvindex?.toDouble(),
|
||||
days.precip?.toDouble()
|
||||
days.uvindex,
|
||||
days.precipprob
|
||||
)
|
||||
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.appttude.h_mal.monoWeather.ui.world
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
Reference in New Issue
Block a user