mirror of
https://github.com/hmalik144/Weather-apps.git
synced 2026-03-18 15:36:04 +00:00
Playstore permissions declaration (#12)
* Declaration builder created Took 2 hours 34 minutes Took 2 minutes * - Fixed android S issues - Dialog box completed - Widget creation activity UI test added Took 1 hour 53 minutes * - Popup for google playstore permissions added - UI tests with stubbing added - linting clean ups - changes to fragments and base fragment Took 3 hours 57 minutes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.appttude.h_mal.atlas_weather.application
|
||||
|
||||
import androidx.room.RoomDatabase
|
||||
import com.appttude.h_mal.atlas_weather.data.location.LocationProvider
|
||||
import com.appttude.h_mal.atlas_weather.data.location.LocationProviderImpl
|
||||
import com.appttude.h_mal.atlas_weather.data.network.Api
|
||||
@@ -26,14 +27,16 @@ const val LOCATION_PERMISSION_REQUEST = 505
|
||||
|
||||
class AppClass : BaseAppClass() {
|
||||
|
||||
override fun createNetworkModule(): Api {
|
||||
override fun createNetworkModule(): WeatherApi {
|
||||
return NetworkModule().invoke<WeatherApi>(
|
||||
NetworkConnectionInterceptor(this),
|
||||
QueryParamsInterceptor(),
|
||||
loggingInterceptor
|
||||
)
|
||||
) as WeatherApi
|
||||
}
|
||||
|
||||
override fun createLocationModule() = LocationProviderImpl(this)
|
||||
|
||||
override fun createRoomDatabase(): AppDatabase = AppDatabase(this)
|
||||
|
||||
}
|
||||
@@ -1,15 +1,8 @@
|
||||
package com.appttude.h_mal.atlas_weather.application
|
||||
|
||||
import android.app.Application
|
||||
import androidx.test.espresso.idling.CountingIdlingResource
|
||||
import com.appttude.h_mal.atlas_weather.data.location.LocationProvider
|
||||
import com.appttude.h_mal.atlas_weather.data.location.LocationProviderImpl
|
||||
import com.appttude.h_mal.atlas_weather.data.network.Api
|
||||
import com.appttude.h_mal.atlas_weather.data.network.NetworkModule
|
||||
import com.appttude.h_mal.atlas_weather.data.network.WeatherApi
|
||||
import com.appttude.h_mal.atlas_weather.data.network.interceptors.NetworkConnectionInterceptor
|
||||
import com.appttude.h_mal.atlas_weather.data.network.interceptors.QueryParamsInterceptor
|
||||
import com.appttude.h_mal.atlas_weather.data.network.networkUtils.loggingInterceptor
|
||||
import com.appttude.h_mal.atlas_weather.data.prefs.PreferenceProvider
|
||||
import com.appttude.h_mal.atlas_weather.data.repository.RepositoryImpl
|
||||
import com.appttude.h_mal.atlas_weather.data.repository.SettingsRepositoryImpl
|
||||
@@ -31,11 +24,11 @@ abstract class BaseAppClass : Application(), KodeinAware {
|
||||
override val kodein = Kodein.lazy {
|
||||
import(androidXModule(this@BaseAppClass))
|
||||
|
||||
bind() from singleton { createNetworkModule() as WeatherApi}
|
||||
bind() from singleton { createNetworkModule() }
|
||||
bind() from singleton { createLocationModule() }
|
||||
|
||||
bind() from singleton { Gson() }
|
||||
bind() from singleton { AppDatabase(instance()) }
|
||||
bind() from singleton { createRoomDatabase() }
|
||||
bind() from singleton { PreferenceProvider(instance()) }
|
||||
bind() from singleton { RepositoryImpl(instance(), instance(), instance()) }
|
||||
bind() from singleton { SettingsRepositoryImpl(instance()) }
|
||||
@@ -43,7 +36,8 @@ abstract class BaseAppClass : Application(), KodeinAware {
|
||||
bind() from provider { ApplicationViewModelFactory(instance(), instance()) }
|
||||
}
|
||||
|
||||
abstract fun createNetworkModule() : Api
|
||||
abstract fun createLocationModule() : LocationProvider
|
||||
abstract fun createNetworkModule(): WeatherApi
|
||||
abstract fun createLocationModule(): LocationProvider
|
||||
abstract fun createRoomDatabase(): AppDatabase
|
||||
|
||||
}
|
||||
@@ -10,19 +10,18 @@ import org.kodein.di.android.kodein
|
||||
import org.kodein.di.generic.instance
|
||||
|
||||
@ProvidedTypeConverter
|
||||
class Converter(context: Context): KodeinAware{
|
||||
class Converter(context: Context) : KodeinAware {
|
||||
override val kodein by kodein(context)
|
||||
private val gson by instance<Gson>()
|
||||
|
||||
@TypeConverter
|
||||
fun fullWeatherToString(fullWeather: FullWeather): String{
|
||||
fun fullWeatherToString(fullWeather: FullWeather): String {
|
||||
return gson.toJson(fullWeather)
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun stringToFullWeather(string: String): FullWeather{
|
||||
fun stringToFullWeather(string: String): FullWeather {
|
||||
return gson.fromJson(string, FullWeather::class.java)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:layout_width="wrap_content"
|
||||
@@ -13,6 +14,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/forecast_listview"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/db_list_item">
|
||||
</androidx.recyclerview.widget.RecyclerView>
|
||||
|
||||
|
||||
@@ -14,4 +14,6 @@
|
||||
<string name="min">Min:</string>
|
||||
<string name="max">Max:</string>
|
||||
<string name="average">Average:</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="ok">OK</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user