mirror of
https://github.com/hmalik144/Weather-apps.git
synced 2025-12-10 02:05:20 +00:00
- Changed package layout
- added black background feature to Widget - Update to MyWidgetRemoteViewsFactory.kt
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.utils
|
package com.appttude.h_mal.atlas_weather.utils
|
||||||
|
|
||||||
import org.junit.Assert.assertEquals
|
import org.junit.Assert.assertEquals
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@@ -16,14 +16,14 @@
|
|||||||
android:required="true" />
|
android:required="true" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".mvvm.application.AppClass"
|
android:name="com.appttude.h_mal.atlas_weather.application.AppClass"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/ic_launcher"
|
android:roundIcon="@mipmap/ic_launcher"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity android:name=".mvvm.ui.MainActivity"
|
<activity android:name="com.appttude.h_mal.atlas_weather.ui.MainActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:theme="@style/AppTheme.NoActionBar">
|
android:theme="@style/AppTheme.NoActionBar">
|
||||||
@@ -35,8 +35,12 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.appttude.h_mal.atlas_weather.ui.settings.UnitSettingsActivity"
|
||||||
|
android:label="Settings" />
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".notifcation.NotificationReceiver"
|
android:name=".notification.NotificationReceiver"
|
||||||
android:parentActivityName="com.appttude.h_mal.atlas_weather.MainActivity" />
|
android:parentActivityName="com.appttude.h_mal.atlas_weather.MainActivity" />
|
||||||
|
|
||||||
<receiver android:name=".widget.NewAppWidget">
|
<receiver android:name=".widget.NewAppWidget">
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.application
|
package com.appttude.h_mal.atlas_weather.application
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import androidx.test.espresso.idling.CountingIdlingResource
|
import androidx.test.espresso.idling.CountingIdlingResource
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.location.LocationProvider
|
import com.appttude.h_mal.atlas_weather.data.location.LocationProvider
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.network.WeatherApi
|
import com.appttude.h_mal.atlas_weather.data.network.WeatherApi
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.network.interceptors.NetworkConnectionInterceptor
|
import com.appttude.h_mal.atlas_weather.data.network.interceptors.NetworkConnectionInterceptor
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.network.interceptors.QueryParamsInterceptor
|
import com.appttude.h_mal.atlas_weather.data.network.interceptors.QueryParamsInterceptor
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.prefs.PreferenceProvider
|
import com.appttude.h_mal.atlas_weather.data.prefs.PreferenceProvider
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.repository.RepositoryImpl
|
import com.appttude.h_mal.atlas_weather.data.repository.RepositoryImpl
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.repository.SettingsRepositoryImpl
|
import com.appttude.h_mal.atlas_weather.data.repository.SettingsRepositoryImpl
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.room.AppDatabase
|
import com.appttude.h_mal.atlas_weather.data.room.AppDatabase
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.viewmodel.ApplicationViewModelFactory
|
import com.appttude.h_mal.atlas_weather.viewmodel.ApplicationViewModelFactory
|
||||||
import com.appttude.h_mal.atlas_weather.notifcation.ServicesHelper
|
import com.appttude.h_mal.atlas_weather.notification.ServicesHelper
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import org.kodein.di.Kodein
|
import org.kodein.di.Kodein
|
||||||
import org.kodein.di.KodeinAware
|
import org.kodein.di.KodeinAware
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.location
|
package com.appttude.h_mal.atlas_weather.data.location
|
||||||
|
|
||||||
import android.Manifest.permission.ACCESS_FINE_LOCATION
|
import android.Manifest.permission.ACCESS_FINE_LOCATION
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.network
|
package com.appttude.h_mal.atlas_weather.data.network
|
||||||
|
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.network
|
package com.appttude.h_mal.atlas_weather.data.network
|
||||||
|
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.network.interceptors.NetworkConnectionInterceptor
|
import com.appttude.h_mal.atlas_weather.data.network.interceptors.NetworkConnectionInterceptor
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.network.interceptors.QueryParamsInterceptor
|
import com.appttude.h_mal.atlas_weather.data.network.interceptors.QueryParamsInterceptor
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.network.response.forecast.WeatherResponse
|
import com.appttude.h_mal.atlas_weather.data.network.response.forecast.WeatherResponse
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
import retrofit2.Retrofit
|
import retrofit2.Retrofit
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.network.interceptors
|
package com.appttude.h_mal.atlas_weather.data.network.interceptors
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.net.ConnectivityManager
|
import android.net.ConnectivityManager
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.network.interceptors
|
package com.appttude.h_mal.atlas_weather.data.network.interceptors
|
||||||
|
|
||||||
import com.appttude.h_mal.atlas_weather.BuildConfig
|
import com.appttude.h_mal.atlas_weather.BuildConfig
|
||||||
import okhttp3.Interceptor
|
import okhttp3.Interceptor
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.network.response.forecast
|
package com.appttude.h_mal.atlas_weather.data.network.response.forecast
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.network.response.forecast
|
package com.appttude.h_mal.atlas_weather.data.network.response.forecast
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.network.response.forecast
|
package com.appttude.h_mal.atlas_weather.data.network.response.forecast
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.network.response.forecast
|
package com.appttude.h_mal.atlas_weather.data.network.response.forecast
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.network.response.forecast
|
package com.appttude.h_mal.atlas_weather.data.network.response.forecast
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.network.response.forecast
|
package com.appttude.h_mal.atlas_weather.data.network.response.forecast
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.network.response.forecast
|
package com.appttude.h_mal.atlas_weather.data.network.response.forecast
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.prefs
|
package com.appttude.h_mal.atlas_weather.data.prefs
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.room.entity.CURRENT_LOCATION
|
import com.appttude.h_mal.atlas_weather.data.room.entity.CURRENT_LOCATION
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shared preferences to save & load last timestamp
|
* Shared preferences to save & load last timestamp
|
||||||
@@ -43,4 +43,8 @@ class PreferenceProvider(
|
|||||||
preference.edit().putBoolean("FIRST_TIME_RUN", false).apply()
|
preference.edit().putBoolean("FIRST_TIME_RUN", false).apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isWidgetBlackground(): Boolean {
|
||||||
|
return preference.getBoolean("widget_black_background", false)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.repository
|
package com.appttude.h_mal.atlas_weather.data.repository
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.network.response.forecast.WeatherResponse
|
import com.appttude.h_mal.atlas_weather.data.network.response.forecast.WeatherResponse
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.room.entity.EntityItem
|
import com.appttude.h_mal.atlas_weather.data.room.entity.EntityItem
|
||||||
|
|
||||||
interface Repository {
|
interface Repository {
|
||||||
|
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.repository
|
package com.appttude.h_mal.atlas_weather.data.repository
|
||||||
|
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.network.ResponseUnwrap
|
import com.appttude.h_mal.atlas_weather.data.network.ResponseUnwrap
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.network.WeatherApi
|
import com.appttude.h_mal.atlas_weather.data.network.WeatherApi
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.network.response.forecast.WeatherResponse
|
import com.appttude.h_mal.atlas_weather.data.network.response.forecast.WeatherResponse
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.prefs.LOCATION_CONST
|
import com.appttude.h_mal.atlas_weather.data.prefs.LOCATION_CONST
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.prefs.PreferenceProvider
|
import com.appttude.h_mal.atlas_weather.data.prefs.PreferenceProvider
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.room.AppDatabase
|
import com.appttude.h_mal.atlas_weather.data.room.AppDatabase
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.room.entity.EntityItem
|
import com.appttude.h_mal.atlas_weather.data.room.entity.EntityItem
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.model.weather.FullWeather
|
import com.appttude.h_mal.atlas_weather.model.weather.FullWeather
|
||||||
|
|
||||||
private const val FIVE_MINS = 300000L
|
private const val FIVE_MINS = 300000L
|
||||||
class RepositoryImpl(
|
class RepositoryImpl(
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.repository
|
package com.appttude.h_mal.atlas_weather.data.repository
|
||||||
|
|
||||||
interface SettingsRepository {
|
interface SettingsRepository {
|
||||||
fun isNotificationsEnabled(): Boolean
|
fun isNotificationsEnabled(): Boolean
|
||||||
fun setFirstTime()
|
fun setFirstTime()
|
||||||
|
fun isBlackBackground(): Boolean
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.repository
|
package com.appttude.h_mal.atlas_weather.data.repository
|
||||||
|
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.prefs.PreferenceProvider
|
import com.appttude.h_mal.atlas_weather.data.prefs.PreferenceProvider
|
||||||
|
|
||||||
class SettingsRepositoryImpl(
|
class SettingsRepositoryImpl(
|
||||||
val prefs: PreferenceProvider
|
val prefs: PreferenceProvider
|
||||||
@@ -9,4 +9,6 @@ class SettingsRepositoryImpl(
|
|||||||
override fun isNotificationsEnabled(): Boolean = prefs.isNotificationsEnabled()
|
override fun isNotificationsEnabled(): Boolean = prefs.isNotificationsEnabled()
|
||||||
|
|
||||||
override fun setFirstTime() = prefs.setFirstTimeRun()
|
override fun setFirstTime() = prefs.setFirstTimeRun()
|
||||||
|
|
||||||
|
override fun isBlackBackground() = prefs.isWidgetBlackground()
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,16 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.room
|
package com.appttude.h_mal.atlas_weather.data.room
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.room.Database
|
import androidx.room.Database
|
||||||
import androidx.room.Room
|
import androidx.room.Room
|
||||||
import androidx.room.RoomDatabase
|
import androidx.room.RoomDatabase
|
||||||
import androidx.room.TypeConverters
|
import androidx.room.TypeConverters
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.room.entity.EntityItem
|
import com.appttude.h_mal.atlas_weather.data.room.entity.EntityItem
|
||||||
|
|
||||||
@Database(
|
@Database(
|
||||||
entities = [EntityItem::class],
|
entities = [EntityItem::class],
|
||||||
version = 1
|
version = 1,
|
||||||
|
exportSchema = false
|
||||||
)
|
)
|
||||||
@TypeConverters(Converter::class)
|
@TypeConverters(Converter::class)
|
||||||
abstract class AppDatabase : RoomDatabase() {
|
abstract class AppDatabase : RoomDatabase() {
|
||||||
@@ -30,12 +31,12 @@ abstract class AppDatabase : RoomDatabase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun buildDatabase(context: Context) =
|
private fun buildDatabase(context: Context) =
|
||||||
Room.databaseBuilder(
|
Room.databaseBuilder(
|
||||||
context.applicationContext,
|
context.applicationContext,
|
||||||
AppDatabase::class.java,
|
AppDatabase::class.java,
|
||||||
"MyDatabase.db"
|
"MyDatabase.db"
|
||||||
).addTypeConverter(Converter(context))
|
).addTypeConverter(Converter(context))
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.room
|
package com.appttude.h_mal.atlas_weather.data.room
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.room.ProvidedTypeConverter
|
import androidx.room.ProvidedTypeConverter
|
||||||
import androidx.room.TypeConverter
|
import androidx.room.TypeConverter
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.model.weather.FullWeather
|
import com.appttude.h_mal.atlas_weather.model.weather.FullWeather
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import org.kodein.di.KodeinAware
|
import org.kodein.di.KodeinAware
|
||||||
import org.kodein.di.android.kodein
|
import org.kodein.di.android.kodein
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.room
|
package com.appttude.h_mal.atlas_weather.data.room
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.room.Dao
|
import androidx.room.Dao
|
||||||
import androidx.room.Insert
|
import androidx.room.Insert
|
||||||
import androidx.room.OnConflictStrategy
|
import androidx.room.OnConflictStrategy
|
||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.room.entity.CURRENT_LOCATION
|
import com.appttude.h_mal.atlas_weather.data.room.entity.CURRENT_LOCATION
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.room.entity.EntityItem
|
import com.appttude.h_mal.atlas_weather.data.room.entity.EntityItem
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
interface WeatherDao {
|
interface WeatherDao {
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.room.entity
|
package com.appttude.h_mal.atlas_weather.data.room.entity
|
||||||
|
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.model.weather.FullWeather
|
import com.appttude.h_mal.atlas_weather.model.weather.FullWeather
|
||||||
|
|
||||||
|
|
||||||
const val CURRENT_LOCATION = "CurrentLocation"
|
const val CURRENT_LOCATION = "CurrentLocation"
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.model.forecast
|
package com.appttude.h_mal.atlas_weather.model.forecast
|
||||||
|
|
||||||
import android.os.Parcel
|
import android.os.Parcel
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.model.weather.DailyWeather
|
import com.appttude.h_mal.atlas_weather.model.weather.DailyWeather
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.toDayName
|
import com.appttude.h_mal.atlas_weather.utils.toDayName
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.toDayString
|
import com.appttude.h_mal.atlas_weather.utils.toDayString
|
||||||
|
import com.appttude.h_mal.atlas_weather.utils.toTime
|
||||||
|
|
||||||
data class Forecast(
|
data class Forecast(
|
||||||
val date: String?,
|
val date: String?,
|
||||||
@@ -34,10 +35,12 @@ data class Forecast(
|
|||||||
(dailyWeather.pop?.times(100)).toString(),
|
(dailyWeather.pop?.times(100)).toString(),
|
||||||
dailyWeather.humidity?.toString(),
|
dailyWeather.humidity?.toString(),
|
||||||
dailyWeather.uvi?.toInt().toString(),
|
dailyWeather.uvi?.toInt().toString(),
|
||||||
dailyWeather.sunrise?.toString(),
|
dailyWeather.sunrise?.toTime(),
|
||||||
dailyWeather.sunset?.toString()
|
dailyWeather.sunset?.toTime()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
constructor(parcel: Parcel) : this(
|
constructor(parcel: Parcel) : this(
|
||||||
parcel.readString(),
|
parcel.readString(),
|
||||||
parcel.readString(),
|
parcel.readString(),
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.model.forecast
|
package com.appttude.h_mal.atlas_weather.model.forecast
|
||||||
|
|
||||||
import android.os.Parcel
|
import android.os.Parcel
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.model.weather.FullWeather
|
import com.appttude.h_mal.atlas_weather.model.weather.FullWeather
|
||||||
|
|
||||||
|
|
||||||
data class WeatherDisplay(
|
data class WeatherDisplay(
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.model.weather
|
package com.appttude.h_mal.atlas_weather.model.weather
|
||||||
|
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.network.response.forecast.Current
|
import com.appttude.h_mal.atlas_weather.data.network.response.forecast.Current
|
||||||
|
|
||||||
data class Current(
|
data class Current(
|
||||||
val dt: Int? = null,
|
val dt: Int? = null,
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.model.weather
|
package com.appttude.h_mal.atlas_weather.model.weather
|
||||||
|
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.network.response.forecast.DailyItem
|
import com.appttude.h_mal.atlas_weather.data.network.response.forecast.DailyItem
|
||||||
|
|
||||||
|
|
||||||
data class DailyWeather(
|
data class DailyWeather(
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.model.weather
|
package com.appttude.h_mal.atlas_weather.model.weather
|
||||||
|
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.network.response.forecast.WeatherResponse
|
import com.appttude.h_mal.atlas_weather.data.network.response.forecast.WeatherResponse
|
||||||
|
|
||||||
data class FullWeather(
|
data class FullWeather(
|
||||||
val current: Current? = null,
|
val current: Current? = null,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.notifcation
|
package com.appttude.h_mal.atlas_weather.model.widget
|
||||||
|
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.os.Parcel
|
import android.os.Parcel
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.utils
|
|
||||||
|
|
||||||
|
|
||||||
import android.os.Build
|
|
||||||
import java.text.SimpleDateFormat
|
|
||||||
import java.time.LocalDate
|
|
||||||
import java.time.format.DateTimeFormatter
|
|
||||||
import java.time.temporal.ChronoUnit
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
fun Int.toDayString(): String {
|
|
||||||
return try {
|
|
||||||
val date = Date(this.makeMilliseconds())
|
|
||||||
val format = SimpleDateFormat("MMM d", Locale.getDefault())
|
|
||||||
format.format(date)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
"Unable to parse date"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Int.makeMilliseconds(): Long = this * 1000L
|
|
||||||
|
|
||||||
fun Int.toDayName(): String {
|
|
||||||
return try {
|
|
||||||
val date = Date(this.makeMilliseconds())
|
|
||||||
val format = SimpleDateFormat("EEEE", Locale.getDefault())
|
|
||||||
format.format(date)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
"Unable to parse date"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Int.toSmallDayName(): String {
|
|
||||||
return try {
|
|
||||||
val date = Date(this.makeMilliseconds())
|
|
||||||
val format = SimpleDateFormat("EEE", Locale.getDefault())
|
|
||||||
format.format(date)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
"Unable to parse date"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun String.changeDateFormat(): String {
|
|
||||||
return try {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
val formatter = DateTimeFormatter.ofPattern("dd MMMM, yyyy")
|
|
||||||
val date = LocalDate.parse(this)
|
|
||||||
date.format(formatter)
|
|
||||||
} else {
|
|
||||||
var format = SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH)
|
|
||||||
val date = format.parse(this)
|
|
||||||
format = SimpleDateFormat("dd MMMM, yyyy", Locale.ENGLISH)
|
|
||||||
format.format(date)
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
"Unable to parse date"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun String.transformDateTimeString(): String {
|
|
||||||
return try {
|
|
||||||
val inputFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm", Locale.ENGLISH)
|
|
||||||
val outputFormat = SimpleDateFormat("EEE, dd MMM yyyy HH:mm", Locale.ENGLISH)
|
|
||||||
val dateIn = inputFormat.parse(substringBeforeLast(":"))
|
|
||||||
outputFormat.format(dateIn)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
this
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun String.transformDateString(): String {
|
|
||||||
return try {
|
|
||||||
val inputFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm", Locale.ENGLISH)
|
|
||||||
val outputFormat = SimpleDateFormat("EEE, dd MMM yyyy", Locale.ENGLISH)
|
|
||||||
val dateIn = inputFormat.parse(substringBeforeLast(":"))
|
|
||||||
outputFormat.format(dateIn)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
this
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun String.transformPassportData(): String {
|
|
||||||
return try {
|
|
||||||
val formatIn = SimpleDateFormat("yyMMdd", Locale.ENGLISH)
|
|
||||||
val formatOut = SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH)
|
|
||||||
val dateIn = formatIn.parse(this)
|
|
||||||
formatOut.format(dateIn)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
this
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun String.getYearsSinceNow(): String? {
|
|
||||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
val formatter = DateTimeFormatter.ofPattern("dd MMMM, yyyy")
|
|
||||||
val now = LocalDate.now()
|
|
||||||
val date = LocalDate.parse(this, formatter)
|
|
||||||
ChronoUnit.YEARS.between(date, now).toString()
|
|
||||||
} else {
|
|
||||||
val now = Calendar.getInstance()
|
|
||||||
|
|
||||||
val date = Calendar.getInstance()
|
|
||||||
val simpleDateFormat = SimpleDateFormat("dd MMMM, yyyy", Locale.ENGLISH)
|
|
||||||
date.time = simpleDateFormat.parse(this)
|
|
||||||
val years = now.get(Calendar.YEAR) - date.get(Calendar.YEAR)
|
|
||||||
years.toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun String?.changeDateToSeconds(): Long {
|
|
||||||
// if (isNullOrBlank()){
|
|
||||||
// val time = System.currentTimeMillis() / 1000
|
|
||||||
// return time + 2592000
|
|
||||||
// }
|
|
||||||
|
|
||||||
return try {
|
|
||||||
val sdf = SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH)
|
|
||||||
val convertedCurrentDate = sdf.parse(this)
|
|
||||||
convertedCurrentDate.time / 1000
|
|
||||||
} catch (e: Exception) {
|
|
||||||
val time = System.currentTimeMillis() / 1000
|
|
||||||
time + 2592000
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.notifcation
|
package com.appttude.h_mal.atlas_weather.notification
|
||||||
|
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
|
|
||||||
@@ -1,16 +1,18 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.notifcation
|
package com.appttude.h_mal.atlas_weather.notification
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.graphics.BitmapFactory
|
import android.graphics.BitmapFactory
|
||||||
|
import android.graphics.Color
|
||||||
import androidx.annotation.RequiresPermission
|
import androidx.annotation.RequiresPermission
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.location.LocationProvider
|
import com.appttude.h_mal.atlas_weather.data.location.LocationProvider
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.repository.Repository
|
import com.appttude.h_mal.atlas_weather.data.repository.Repository
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.repository.SettingsRepository
|
import com.appttude.h_mal.atlas_weather.data.repository.SettingsRepository
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.room.entity.CURRENT_LOCATION
|
import com.appttude.h_mal.atlas_weather.data.room.entity.CURRENT_LOCATION
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.model.weather.FullWeather
|
import com.appttude.h_mal.atlas_weather.model.weather.FullWeather
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.toDayName
|
import com.appttude.h_mal.atlas_weather.model.widget.InnerWidgetData
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.toSmallDayName
|
import com.appttude.h_mal.atlas_weather.model.widget.WidgetData
|
||||||
|
import com.appttude.h_mal.atlas_weather.utils.toSmallDayName
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
|
|
||||||
@@ -87,34 +89,6 @@ class ServicesHelper(
|
|||||||
} catch (e: Exception) { null }
|
} catch (e: Exception) { null }
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermission(Manifest.permission.ACCESS_FINE_LOCATION)
|
|
||||||
suspend fun getWidgetData(): WidgetData? {
|
|
||||||
return try {
|
|
||||||
val latLon = locationProvider.getLatLong()
|
|
||||||
val result =
|
|
||||||
repository.getWeatherFromApi(
|
|
||||||
latLon.first.toString(),
|
|
||||||
latLon.second.toString()
|
|
||||||
)
|
|
||||||
val list = result.daily?.drop(0)?.map {
|
|
||||||
InnerWidgetData(
|
|
||||||
it.dt?.toDayName(),
|
|
||||||
getBitmapFromUrl(it.weather?.get(0)?.icon),
|
|
||||||
it.temp?.max?.toInt().toString()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
WidgetData(
|
|
||||||
locationProvider.getLocationName(latLon.first, latLon.second),
|
|
||||||
getBitmapFromUrl(result.current?.weather?.get(0)?.icon),
|
|
||||||
result.current?.temp?.toInt().toString(),
|
|
||||||
list
|
|
||||||
)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getBitmapFromUrl(imageAddress: String?): Bitmap? {
|
fun getBitmapFromUrl(imageAddress: String?): Bitmap? {
|
||||||
return try {
|
return try {
|
||||||
@@ -128,5 +102,14 @@ class ServicesHelper(
|
|||||||
|
|
||||||
fun isEnabled() = settingsRepository.isNotificationsEnabled()
|
fun isEnabled() = settingsRepository.isNotificationsEnabled()
|
||||||
|
|
||||||
|
fun getWidgetBackground(): Int {
|
||||||
|
return if (settingsRepository.isBlackBackground()){
|
||||||
|
Color.BLACK
|
||||||
|
}else{
|
||||||
|
Color.TRANSPARENT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fun setFirstTimer() = settingsRepository.setFirstTime()
|
fun setFirstTimer() = settingsRepository.setFirstTime()
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.ui
|
package com.appttude.h_mal.atlas_weather.ui
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
@@ -6,10 +6,10 @@ import android.view.View
|
|||||||
import androidx.core.app.ActivityCompat
|
import androidx.core.app.ActivityCompat
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.Event
|
import com.appttude.h_mal.atlas_weather.utils.Event
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.displayToast
|
import com.appttude.h_mal.atlas_weather.utils.displayToast
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.hide
|
import com.appttude.h_mal.atlas_weather.utils.hide
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.show
|
import com.appttude.h_mal.atlas_weather.utils.show
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.ui
|
package com.appttude.h_mal.atlas_weather.ui
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
@@ -10,8 +10,8 @@ import androidx.navigation.ui.AppBarConfiguration
|
|||||||
import androidx.navigation.ui.setupActionBarWithNavController
|
import androidx.navigation.ui.setupActionBarWithNavController
|
||||||
import androidx.navigation.ui.setupWithNavController
|
import androidx.navigation.ui.setupWithNavController
|
||||||
import com.appttude.h_mal.atlas_weather.R
|
import com.appttude.h_mal.atlas_weather.R
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.ui.home.BaseActivity
|
import com.appttude.h_mal.atlas_weather.ui.home.BaseActivity
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.ui.settings.UnitSettingsActivity
|
import com.appttude.h_mal.atlas_weather.ui.settings.UnitSettingsActivity
|
||||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||||
import kotlinx.android.synthetic.main.activity_main_navigation.*
|
import kotlinx.android.synthetic.main.activity_main_navigation.*
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.ui
|
package com.appttude.h_mal.atlas_weather.ui
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -6,10 +6,10 @@ import android.widget.ImageView
|
|||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.appttude.h_mal.atlas_weather.R
|
import com.appttude.h_mal.atlas_weather.R
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.model.forecast.Forecast
|
import com.appttude.h_mal.atlas_weather.model.forecast.Forecast
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.model.forecast.WeatherDisplay
|
import com.appttude.h_mal.atlas_weather.model.forecast.WeatherDisplay
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.generateView
|
import com.appttude.h_mal.atlas_weather.utils.generateView
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.loadImage
|
import com.appttude.h_mal.atlas_weather.utils.loadImage
|
||||||
|
|
||||||
class WeatherRecyclerAdapter(
|
class WeatherRecyclerAdapter(
|
||||||
val itemClick: (Forecast) -> Unit
|
val itemClick: (Forecast) -> Unit
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.ui
|
package com.appttude.h_mal.atlas_weather.ui
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
@@ -7,8 +7,8 @@ import android.view.ViewGroup
|
|||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.appttude.h_mal.atlas_weather.R
|
import com.appttude.h_mal.atlas_weather.R
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.model.forecast.WeatherDisplay
|
import com.appttude.h_mal.atlas_weather.model.forecast.WeatherDisplay
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.navigateTo
|
import com.appttude.h_mal.atlas_weather.utils.navigateTo
|
||||||
import kotlinx.android.synthetic.main.fragment_main.*
|
import kotlinx.android.synthetic.main.fragment_main.*
|
||||||
|
|
||||||
|
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.ui.details
|
package com.appttude.h_mal.atlas_weather.ui.details
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Parcelable
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import com.appttude.h_mal.atlas_weather.R
|
import com.appttude.h_mal.atlas_weather.R
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.model.forecast.Forecast
|
import com.appttude.h_mal.atlas_weather.model.forecast.Forecast
|
||||||
import kotlinx.android.synthetic.main.activity_further_info.*
|
import kotlinx.android.synthetic.main.activity_further_info.*
|
||||||
|
|
||||||
|
|
||||||
@@ -42,21 +41,4 @@ class FurtherInfoFragment : Fragment() {
|
|||||||
sunrisetext.text = param1?.sunrise
|
sunrisetext.text = param1?.sunrise
|
||||||
sunsettext.text = param1?.sunset
|
sunsettext.text = param1?.sunset
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
|
||||||
/**
|
|
||||||
* Use this factory method to create a new instance of
|
|
||||||
* this fragment using the provided parameters.
|
|
||||||
*
|
|
||||||
* @param param1 Parameter 1.
|
|
||||||
* @return A new instance of fragment FurtherInfoFragment.
|
|
||||||
*/
|
|
||||||
@JvmStatic
|
|
||||||
fun newInstance(param1: Parcelable) =
|
|
||||||
FurtherInfoFragment().apply {
|
|
||||||
arguments = Bundle().apply {
|
|
||||||
putParcelable(WEATHER, param1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.ui.home
|
package com.appttude.h_mal.atlas_weather.ui.home
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.ui.home
|
package com.appttude.h_mal.atlas_weather.ui.home
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
@@ -12,13 +12,13 @@ import androidx.fragment.app.activityViewModels
|
|||||||
import androidx.lifecycle.observe
|
import androidx.lifecycle.observe
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.appttude.h_mal.atlas_weather.R
|
import com.appttude.h_mal.atlas_weather.R
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.application.LOCATION_PERMISSION_REQUEST
|
import com.appttude.h_mal.atlas_weather.application.LOCATION_PERMISSION_REQUEST
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.ui.BaseFragment
|
import com.appttude.h_mal.atlas_weather.ui.BaseFragment
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.ui.WeatherRecyclerAdapter
|
import com.appttude.h_mal.atlas_weather.ui.WeatherRecyclerAdapter
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.displayToast
|
import com.appttude.h_mal.atlas_weather.utils.displayToast
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.navigateTo
|
import com.appttude.h_mal.atlas_weather.utils.navigateTo
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.viewmodel.ApplicationViewModelFactory
|
import com.appttude.h_mal.atlas_weather.viewmodel.ApplicationViewModelFactory
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.viewmodel.MainViewModel
|
import com.appttude.h_mal.atlas_weather.viewmodel.MainViewModel
|
||||||
import kotlinx.android.synthetic.main.activity_add_forecast.*
|
import kotlinx.android.synthetic.main.activity_add_forecast.*
|
||||||
import kotlinx.android.synthetic.main.fragment_main.*
|
import kotlinx.android.synthetic.main.fragment_main.*
|
||||||
import org.kodein.di.KodeinAware
|
import org.kodein.di.KodeinAware
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.ui.settings
|
package com.appttude.h_mal.atlas_weather.ui.settings
|
||||||
|
|
||||||
import android.app.AlarmManager
|
import android.app.AlarmManager
|
||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
@@ -10,9 +10,9 @@ import android.content.SharedPreferences.OnSharedPreferenceChangeListener
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.preference.PreferenceActivity
|
import android.preference.PreferenceActivity
|
||||||
import android.preference.PreferenceFragment
|
import android.preference.PreferenceFragment
|
||||||
import android.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import com.appttude.h_mal.atlas_weather.R
|
import com.appttude.h_mal.atlas_weather.R
|
||||||
import com.appttude.h_mal.atlas_weather.notifcation.NotificationReceiver
|
import com.appttude.h_mal.atlas_weather.notification.NotificationReceiver
|
||||||
import com.appttude.h_mal.atlas_weather.widget.NewAppWidget
|
import com.appttude.h_mal.atlas_weather.widget.NewAppWidget
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ class UnitSettingsActivity : PreferenceActivity() {
|
|||||||
|
|
||||||
//listener on changed sort order preference:
|
//listener on changed sort order preference:
|
||||||
val prefs = PreferenceManager.getDefaultSharedPreferences(applicationContext)
|
val prefs = PreferenceManager.getDefaultSharedPreferences(applicationContext)
|
||||||
prefListener = OnSharedPreferenceChangeListener { prefs, key ->
|
prefListener = OnSharedPreferenceChangeListener { _, key ->
|
||||||
if (key == "temp_units") {
|
if (key == "temp_units") {
|
||||||
val intent = Intent(baseContext, NewAppWidget::class.java)
|
val intent = Intent(baseContext, NewAppWidget::class.java)
|
||||||
intent.action = AppWidgetManager.ACTION_APPWIDGET_UPDATE
|
intent.action = AppWidgetManager.ACTION_APPWIDGET_UPDATE
|
||||||
@@ -38,6 +38,15 @@ class UnitSettingsActivity : PreferenceActivity() {
|
|||||||
if (key == "notif_boolean") {
|
if (key == "notif_boolean") {
|
||||||
setupNotificationBroadcaster(baseContext)
|
setupNotificationBroadcaster(baseContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key == "widget_black_background"){
|
||||||
|
val intent = Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE)
|
||||||
|
val widgetManager = AppWidgetManager.getInstance(this)
|
||||||
|
val ids = widgetManager.getAppWidgetIds(ComponentName(this, NewAppWidget::class.java))
|
||||||
|
AppWidgetManager.getInstance(this).notifyAppWidgetViewDataChanged(ids, R.id.whole_widget_view)
|
||||||
|
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids)
|
||||||
|
sendBroadcast(intent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
prefs.registerOnSharedPreferenceChangeListener(prefListener)
|
prefs.registerOnSharedPreferenceChangeListener(prefListener)
|
||||||
}
|
}
|
||||||
@@ -51,7 +60,7 @@ class UnitSettingsActivity : PreferenceActivity() {
|
|||||||
cal.set(Calendar.HOUR_OF_DAY, 6)
|
cal.set(Calendar.HOUR_OF_DAY, 6)
|
||||||
cal.set(Calendar.MINUTE, 8)
|
cal.set(Calendar.MINUTE, 8)
|
||||||
cal.set(Calendar.SECOND, 5)
|
cal.set(Calendar.SECOND, 5)
|
||||||
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), AlarmManager.INTERVAL_DAY, broadcast)
|
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, cal.timeInMillis, AlarmManager.INTERVAL_DAY, broadcast)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.ui.world
|
package com.appttude.h_mal.atlas_weather.ui.world
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
@@ -7,11 +7,11 @@ import android.view.ViewGroup
|
|||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.lifecycle.observe
|
import androidx.lifecycle.observe
|
||||||
import com.appttude.h_mal.atlas_weather.R
|
import com.appttude.h_mal.atlas_weather.R
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.ui.BaseFragment
|
import com.appttude.h_mal.atlas_weather.ui.BaseFragment
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.displayToast
|
import com.appttude.h_mal.atlas_weather.utils.displayToast
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.goBack
|
import com.appttude.h_mal.atlas_weather.utils.goBack
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.viewmodel.ApplicationViewModelFactory
|
import com.appttude.h_mal.atlas_weather.viewmodel.ApplicationViewModelFactory
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.viewmodel.WorldViewModel
|
import com.appttude.h_mal.atlas_weather.viewmodel.WorldViewModel
|
||||||
import kotlinx.android.synthetic.main.activity_add_forecast.*
|
import kotlinx.android.synthetic.main.activity_add_forecast.*
|
||||||
import org.kodein.di.KodeinAware
|
import org.kodein.di.KodeinAware
|
||||||
import org.kodein.di.android.x.kodein
|
import org.kodein.di.android.x.kodein
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.ui.world
|
package com.appttude.h_mal.atlas_weather.ui.world
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
@@ -9,10 +9,10 @@ import androidx.fragment.app.viewModels
|
|||||||
import androidx.lifecycle.observe
|
import androidx.lifecycle.observe
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.appttude.h_mal.atlas_weather.R
|
import com.appttude.h_mal.atlas_weather.R
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.ui.BaseFragment
|
import com.appttude.h_mal.atlas_weather.ui.BaseFragment
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.navigateTo
|
import com.appttude.h_mal.atlas_weather.utils.navigateTo
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.viewmodel.ApplicationViewModelFactory
|
import com.appttude.h_mal.atlas_weather.viewmodel.ApplicationViewModelFactory
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.viewmodel.WorldViewModel
|
import com.appttude.h_mal.atlas_weather.viewmodel.WorldViewModel
|
||||||
import kotlinx.android.synthetic.main.fragment_add_location.*
|
import kotlinx.android.synthetic.main.fragment_add_location.*
|
||||||
import org.kodein.di.KodeinAware
|
import org.kodein.di.KodeinAware
|
||||||
import org.kodein.di.android.x.kodein
|
import org.kodein.di.android.x.kodein
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.ui.world
|
package com.appttude.h_mal.atlas_weather.ui.world
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -6,9 +6,9 @@ import android.widget.ImageView
|
|||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.appttude.h_mal.atlas_weather.R
|
import com.appttude.h_mal.atlas_weather.R
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.model.forecast.WeatherDisplay
|
import com.appttude.h_mal.atlas_weather.model.forecast.WeatherDisplay
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.generateView
|
import com.appttude.h_mal.atlas_weather.utils.generateView
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.loadImage
|
import com.appttude.h_mal.atlas_weather.utils.loadImage
|
||||||
|
|
||||||
class WorldRecyclerAdapter(
|
class WorldRecyclerAdapter(
|
||||||
val itemClick: (WeatherDisplay) -> Unit
|
val itemClick: (WeatherDisplay) -> Unit
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.utils
|
package com.appttude.h_mal.atlas_weather.utils
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used with livedata<T> to make observation lifecycle aware
|
* Used with livedata<T> to make observation lifecycle aware
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.utils
|
package com.appttude.h_mal.atlas_weather.utils
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.appttude.h_mal.atlas_weather.utils
|
||||||
|
|
||||||
|
|
||||||
|
import android.os.Build
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.time.Instant
|
||||||
|
import java.time.LocalDate
|
||||||
|
import java.time.OffsetTime
|
||||||
|
import java.time.ZoneOffset
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
import java.time.temporal.ChronoUnit
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
fun Int.toDayString(): String {
|
||||||
|
return try {
|
||||||
|
val date = Date(this.makeMilliseconds())
|
||||||
|
val format = SimpleDateFormat("MMM d", Locale.getDefault())
|
||||||
|
format.format(date)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
"Unable to parse date"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Int.makeMilliseconds(): Long = this * 1000L
|
||||||
|
|
||||||
|
fun Int.toDayName(): String {
|
||||||
|
return try {
|
||||||
|
val date = Date(this.makeMilliseconds())
|
||||||
|
val format = SimpleDateFormat("EEEE", Locale.getDefault())
|
||||||
|
format.format(date)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
"Unable to parse date"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Int.toSmallDayName(): String {
|
||||||
|
return try {
|
||||||
|
val date = Date(this.makeMilliseconds())
|
||||||
|
val format = SimpleDateFormat("EEE", Locale.getDefault())
|
||||||
|
format.format(date)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
"Unable to parse date"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Int?.toTime(): String? {
|
||||||
|
return this?.makeMilliseconds()?.let {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
OffsetTime.ofInstant(Instant.ofEpochMilli(it), ZoneOffset.UTC).format(DateTimeFormatter.ofPattern("HH:mm"))
|
||||||
|
} else {
|
||||||
|
val date = Date(it)
|
||||||
|
val format = SimpleDateFormat("HH:mm", Locale.getDefault())
|
||||||
|
format.format(date)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.utils
|
package com.appttude.h_mal.atlas_weather.utils
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.viewmodel
|
package com.appttude.h_mal.atlas_weather.viewmodel
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.location.LocationProvider
|
import com.appttude.h_mal.atlas_weather.data.location.LocationProvider
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.repository.RepositoryImpl
|
import com.appttude.h_mal.atlas_weather.data.repository.RepositoryImpl
|
||||||
|
|
||||||
class ApplicationViewModelFactory(
|
class ApplicationViewModelFactory(
|
||||||
private val locationProvider: LocationProvider,
|
private val locationProvider: LocationProvider,
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.viewmodel
|
package com.appttude.h_mal.atlas_weather.viewmodel
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import androidx.annotation.RequiresPermission
|
import androidx.annotation.RequiresPermission
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.location.LocationProvider
|
import com.appttude.h_mal.atlas_weather.data.location.LocationProvider
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.repository.Repository
|
import com.appttude.h_mal.atlas_weather.data.repository.Repository
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.room.entity.CURRENT_LOCATION
|
import com.appttude.h_mal.atlas_weather.data.room.entity.CURRENT_LOCATION
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.model.forecast.WeatherDisplay
|
import com.appttude.h_mal.atlas_weather.model.forecast.WeatherDisplay
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.model.weather.Current
|
import com.appttude.h_mal.atlas_weather.model.weather.Current
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.Event
|
import com.appttude.h_mal.atlas_weather.utils.Event
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.viewmodel
|
package com.appttude.h_mal.atlas_weather.viewmodel
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.location.LocationProvider
|
import com.appttude.h_mal.atlas_weather.data.location.LocationProvider
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.repository.RepositoryImpl
|
import com.appttude.h_mal.atlas_weather.data.repository.RepositoryImpl
|
||||||
|
|
||||||
class MainViewModelFactory(
|
class MainViewModelFactory(
|
||||||
private val locationProvider: LocationProvider,
|
private val locationProvider: LocationProvider,
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.viewmodel
|
package com.appttude.h_mal.atlas_weather.viewmodel
|
||||||
|
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.location.LocationProvider
|
import com.appttude.h_mal.atlas_weather.data.location.LocationProvider
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.repository.Repository
|
import com.appttude.h_mal.atlas_weather.data.repository.Repository
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.room.entity.EntityItem
|
import com.appttude.h_mal.atlas_weather.data.room.entity.EntityItem
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.model.forecast.WeatherDisplay
|
import com.appttude.h_mal.atlas_weather.model.forecast.WeatherDisplay
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.model.weather.FullWeather
|
import com.appttude.h_mal.atlas_weather.model.weather.FullWeather
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.Event
|
import com.appttude.h_mal.atlas_weather.utils.Event
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.viewmodel
|
package com.appttude.h_mal.atlas_weather.viewmodel
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.location.LocationProvider
|
import com.appttude.h_mal.atlas_weather.data.location.LocationProvider
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.repository.RepositoryImpl
|
import com.appttude.h_mal.atlas_weather.data.repository.RepositoryImpl
|
||||||
|
|
||||||
class WorldViewModelFactory(
|
class WorldViewModelFactory(
|
||||||
private val locationProvider: LocationProvider,
|
private val locationProvider: LocationProvider,
|
||||||
@@ -3,8 +3,7 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
tools:context=".legacy.ui.FurtherInfoActivity">
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@@ -14,14 +13,16 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ImageView
|
<FrameLayout
|
||||||
android:id="@+id/thermom"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="12dp"
|
android:layout_margin="12dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1">
|
||||||
android:tint="@color/colour_five"
|
|
||||||
app:srcCompat="@drawable/somethingnew" />
|
<ImageView
|
||||||
|
android:src="@drawable/somethingnew"
|
||||||
|
style="@style/icon_style__further_deatils" />
|
||||||
|
</FrameLayout>
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@@ -30,10 +31,6 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true">
|
android:layout_centerInParent="true">
|
||||||
<View
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
@@ -48,14 +45,14 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="2"
|
||||||
android:text="Maximum: " />
|
android:text="Maximum: " />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/maxtemp"
|
android:id="@+id/maxtemp"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="3"
|
||||||
android:text="85%"
|
android:text="85%"
|
||||||
android:textColor="#000000" />
|
android:textColor="#000000" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -66,14 +63,14 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="2"
|
||||||
android:text="Average: " />
|
android:text="Average: " />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/averagetemp"
|
android:id="@+id/averagetemp"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="3"
|
||||||
android:text="11mm"
|
android:text="11mm"
|
||||||
android:textColor="#000000" />
|
android:textColor="#000000" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -84,14 +81,14 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="2"
|
||||||
android:text="Minimum: " />
|
android:text="Minimum: " />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/minimumtemp"
|
android:id="@+id/minimumtemp"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="3"
|
||||||
android:text="11mm"
|
android:text="11mm"
|
||||||
android:textColor="#000000" />
|
android:textColor="#000000" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -106,14 +103,16 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<ImageView
|
<FrameLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="12dp"
|
android:layout_margin="12dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1">
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:src="@drawable/breeze"
|
<ImageView
|
||||||
android:tint="@color/colour_five" />
|
android:src="@drawable/breeze"
|
||||||
|
style="@style/icon_style__further_deatils" />
|
||||||
|
</FrameLayout>
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_weight="2"
|
android:layout_weight="2"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
@@ -123,10 +122,6 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true">
|
android:layout_centerInParent="true">
|
||||||
<View
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
@@ -137,14 +132,14 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="2"
|
||||||
android:text="Wind: " />
|
android:text="Wind: " />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/windtext"
|
android:id="@+id/windtext"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="3"
|
||||||
android:text="7mph"
|
android:text="7mph"
|
||||||
android:textColor="#000000" />
|
android:textColor="#000000" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -155,14 +150,16 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<ImageView
|
<FrameLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="12dp"
|
android:layout_margin="12dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1">
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:src="@drawable/water_drop"
|
<ImageView
|
||||||
android:tint="@color/colour_five" />
|
android:src="@drawable/water_drop"
|
||||||
|
style="@style/icon_style__further_deatils" />
|
||||||
|
</FrameLayout>
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_weight="2"
|
android:layout_weight="2"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
@@ -171,10 +168,6 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true">
|
android:layout_centerInParent="true">
|
||||||
<View
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
@@ -189,14 +182,14 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="2"
|
||||||
android:text="Humidity: " />
|
android:text="Humidity: " />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/humiditytext"
|
android:id="@+id/humiditytext"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="3"
|
||||||
android:text="85%"
|
android:text="85%"
|
||||||
android:textColor="#000000" />
|
android:textColor="#000000" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -207,14 +200,14 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="2"
|
||||||
android:text="Precipitation: " />
|
android:text="Precipitation: " />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/preciptext"
|
android:id="@+id/preciptext"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="3"
|
||||||
android:text="11mm"
|
android:text="11mm"
|
||||||
android:textColor="#000000" />
|
android:textColor="#000000" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -229,14 +222,16 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<ImageView
|
<FrameLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="12dp"
|
android:layout_margin="12dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1">
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:src="@drawable/sunrise"
|
<ImageView
|
||||||
android:tint="@color/colour_five" />
|
android:src="@drawable/sunrise"
|
||||||
|
style="@style/icon_style__further_deatils" />
|
||||||
|
</FrameLayout>
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_weight="2"
|
android:layout_weight="2"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
@@ -245,10 +240,6 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true">
|
android:layout_centerInParent="true">
|
||||||
<View
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
@@ -263,14 +254,14 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="2"
|
||||||
android:text="UV: " />
|
android:text="UV: " />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/uvtext"
|
android:id="@+id/uvtext"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="3"
|
||||||
android:text="7"
|
android:text="7"
|
||||||
android:textColor="#000000" />
|
android:textColor="#000000" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -282,14 +273,14 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="2"
|
||||||
android:text="Sunrise:" />
|
android:text="Sunrise:" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/sunrisetext"
|
android:id="@+id/sunrisetext"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="3"
|
||||||
android:text="05:30am"
|
android:text="05:30am"
|
||||||
android:textColor="#000000" />
|
android:textColor="#000000" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -300,14 +291,14 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="2"
|
||||||
android:text="Sunset:" />
|
android:text="Sunset:" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/sunsettext"
|
android:id="@+id/sunsettext"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="3"
|
||||||
android:text="06:12pm"
|
android:text="06:12pm"
|
||||||
android:textColor="#000000" />
|
android:textColor="#000000" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -15,11 +15,8 @@
|
|||||||
android:layout_weight="1">
|
android:layout_weight="1">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:src="@drawable/breeze"
|
android:src="@drawable/breeze"
|
||||||
android:tint="@color/colour_five" />
|
style="@style/icon_style__further_deatils" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
@@ -32,51 +29,47 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true">
|
android:layout_centerInParent="true">
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="3"
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="2"
|
||||||
android:text="Speed:" />
|
android:text="Speed:" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/windspeed"
|
android:id="@+id/windspeed"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="3"
|
||||||
android:text="11kmp"
|
android:text="11kmp"
|
||||||
android:textColor="#000000" />
|
android:textColor="#000000" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="2"
|
||||||
android:text="Direction:" />
|
android:text="Direction:" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/winddirection"
|
android:id="@+id/winddirection"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="3"
|
||||||
android:text="SW"
|
android:text="SW"
|
||||||
android:textColor="#000000" />
|
android:textColor="#000000" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -99,11 +92,8 @@
|
|||||||
android:layout_weight="1">
|
android:layout_weight="1">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="wrap_content"
|
style="@style/icon_style__further_deatils"
|
||||||
android:layout_height="match_parent"
|
android:src="@drawable/water_drop" />
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:src="@drawable/water_drop"
|
|
||||||
android:tint="@color/colour_five" />
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
@@ -116,15 +106,9 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true">
|
android:layout_centerInParent="true">
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="3"
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -134,14 +118,14 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="2"
|
||||||
android:text="Humidity: " />
|
android:text="Humidity: " />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/humidity_"
|
android:id="@+id/humidity_"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="3"
|
||||||
android:text="85%"
|
android:text="85%"
|
||||||
android:textColor="#000000" />
|
android:textColor="#000000" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -153,14 +137,14 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="2"
|
||||||
android:text="Precipitation: " />
|
android:text="Precipitation: " />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/precip_"
|
android:id="@+id/precip_"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="3"
|
||||||
android:text="11mm"
|
android:text="11mm"
|
||||||
android:textColor="#000000" />
|
android:textColor="#000000" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -183,12 +167,8 @@
|
|||||||
android:layout_weight="1">
|
android:layout_weight="1">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="wrap_content"
|
style="@style/icon_style__further_deatils"
|
||||||
android:layout_height="match_parent"
|
android:src="@drawable/cloud_symbol" />
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:backgroundTint="#000000"
|
|
||||||
android:src="@drawable/cloud_symbol"
|
|
||||||
android:tint="@color/colour_five" />
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
@@ -201,11 +181,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true">
|
android:layout_centerInParent="true">
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -219,14 +194,14 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="2"
|
||||||
android:text="Clouds: " />
|
android:text="Clouds: " />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/clouds_"
|
android:id="@+id/clouds_"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="3"
|
||||||
android:text="85%"
|
android:text="85%"
|
||||||
android:textColor="#000000" />
|
android:textColor="#000000" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:textColor="@color/colour_five"
|
android:textColor="@color/colour_five"
|
||||||
android:textSize="28sp"
|
android:textSize="22sp"
|
||||||
tools:text="Brisbane" />
|
tools:text="Brisbane" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -6,5 +6,6 @@
|
|||||||
android:id="@+id/action_settings"
|
android:id="@+id/action_settings"
|
||||||
android:orderInCategory="100"
|
android:orderInCategory="100"
|
||||||
android:title="@string/action_settings"
|
android:title="@string/action_settings"
|
||||||
|
android:icon="@android:drawable/ic_menu_preferences"
|
||||||
app:showAsAction="ifRoom" />
|
app:showAsAction="ifRoom" />
|
||||||
</menu>
|
</menu>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/nav_home"
|
android:id="@+id/nav_home"
|
||||||
android:name="com.appttude.h_mal.atlas_weather.mvvm.ui.home.HomeFragment"
|
android:name="com.appttude.h_mal.atlas_weather.ui.home.HomeFragment"
|
||||||
android:label="Home"
|
android:label="Home"
|
||||||
tools:layout="@layout/fragment_home">
|
tools:layout="@layout/fragment_home">
|
||||||
<action
|
<action
|
||||||
@@ -22,16 +22,16 @@
|
|||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/furtherDetailsFragment"
|
android:id="@+id/furtherDetailsFragment"
|
||||||
android:name="com.appttude.h_mal.atlas_weather.mvvm.ui.details.FurtherInfoFragment"
|
android:name="com.appttude.h_mal.atlas_weather.ui.details.FurtherInfoFragment"
|
||||||
android:label="Further Details">
|
android:label="Further Details">
|
||||||
<argument
|
<argument
|
||||||
android:name="forecast"
|
android:name="forecast"
|
||||||
app:argType="com.appttude.h_mal.atlas_weather.mvvm.model.forecast.Forecast" />
|
app:argType="com.appttude.h_mal.atlas_weather.model.forecast.Forecast" />
|
||||||
</fragment>
|
</fragment>
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/nav_world"
|
android:id="@+id/nav_world"
|
||||||
android:name="com.appttude.h_mal.atlas_weather.mvvm.ui.world.WorldFragment"
|
android:name="com.appttude.h_mal.atlas_weather.ui.world.WorldFragment"
|
||||||
android:label="World"
|
android:label="World"
|
||||||
tools:layout="@layout/fragment__two">
|
tools:layout="@layout/fragment__two">
|
||||||
<action
|
<action
|
||||||
@@ -51,12 +51,12 @@
|
|||||||
</fragment>
|
</fragment>
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/addLocationFragment"
|
android:id="@+id/addLocationFragment"
|
||||||
android:name="com.appttude.h_mal.atlas_weather.mvvm.ui.world.AddLocationFragment"
|
android:name="com.appttude.h_mal.atlas_weather.ui.world.AddLocationFragment"
|
||||||
android:label="Add Weather Location"
|
android:label="Add Weather Location"
|
||||||
tools:layout="@layout/activity_add_forecast" />
|
tools:layout="@layout/activity_add_forecast" />
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/worldItemFragment"
|
android:id="@+id/worldItemFragment"
|
||||||
android:name="com.appttude.h_mal.atlas_weather.mvvm.ui.WorldItemFragment"
|
android:name="com.appttude.h_mal.atlas_weather.ui.WorldItemFragment"
|
||||||
android:label="Overview"
|
android:label="Overview"
|
||||||
tools:layout="@layout/fragment_home">
|
tools:layout="@layout/fragment_home">
|
||||||
<action
|
<action
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
app:popExitAnim="@anim/fragment_open_exit" />
|
app:popExitAnim="@anim/fragment_open_exit" />
|
||||||
<argument
|
<argument
|
||||||
android:name="weatherDisplay"
|
android:name="weatherDisplay"
|
||||||
app:argType="com.appttude.h_mal.atlas_weather.mvvm.model.forecast.WeatherDisplay" />
|
app:argType="com.appttude.h_mal.atlas_weather.model.forecast.WeatherDisplay" />
|
||||||
</fragment>
|
</fragment>
|
||||||
|
|
||||||
</navigation>
|
</navigation>
|
||||||
@@ -45,4 +45,12 @@
|
|||||||
<item name="android:textSize">32sp</item>
|
<item name="android:textSize">32sp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="icon_style__further_deatils">
|
||||||
|
<item name="android:layout_width">64dp</item>
|
||||||
|
<item name="android:layout_height">64dp</item>
|
||||||
|
<item name="android:adjustViewBounds">true</item>
|
||||||
|
<item name="android:layout_gravity">center</item>
|
||||||
|
<item name="android:tint">@color/colour_five</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -33,4 +33,10 @@
|
|||||||
android:key="notif_boolean"
|
android:key="notif_boolean"
|
||||||
android:title="Notification" />
|
android:title="Notification" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
<PreferenceCategory android:title="Widget Settings">
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="widget_black_background"
|
||||||
|
android:title="Set widget background black" />
|
||||||
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.data.repository
|
package com.appttude.h_mal.atlas_weather.data.repository
|
||||||
|
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.network.WeatherApi
|
import com.appttude.h_mal.atlas_weather.data.network.WeatherApi
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.prefs.PreferenceProvider
|
import com.appttude.h_mal.atlas_weather.data.prefs.PreferenceProvider
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.room.AppDatabase
|
import com.appttude.h_mal.atlas_weather.data.room.AppDatabase
|
||||||
import io.mockk.MockKAnnotations
|
import io.mockk.MockKAnnotations
|
||||||
import io.mockk.every
|
import io.mockk.every
|
||||||
import io.mockk.impl.annotations.MockK
|
import io.mockk.impl.annotations.MockK
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package com.appttude.h_mal.atlas_weather.mvvm.viewmodel
|
package com.appttude.h_mal.atlas_weather.viewmodel
|
||||||
|
|
||||||
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
|
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.location.LocationProvider
|
import com.appttude.h_mal.atlas_weather.data.location.LocationProvider
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.network.response.forecast.WeatherResponse
|
import com.appttude.h_mal.atlas_weather.data.network.response.forecast.WeatherResponse
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.repository.Repository
|
import com.appttude.h_mal.atlas_weather.data.repository.Repository
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.data.room.entity.EntityItem
|
import com.appttude.h_mal.atlas_weather.data.room.entity.EntityItem
|
||||||
import com.appttude.h_mal.atlas_weather.mvvm.utils.Event
|
import com.appttude.h_mal.atlas_weather.utils.Event
|
||||||
import io.mockk.MockKAnnotations
|
import io.mockk.MockKAnnotations
|
||||||
import io.mockk.coEvery
|
import io.mockk.coEvery
|
||||||
import io.mockk.every
|
import io.mockk.every
|
||||||
Reference in New Issue
Block a user