mirror of
https://github.com/hmalik144/Weather-apps.git
synced 2026-03-18 15:36:04 +00:00
Ci integration upgrade (#14)
- Circleci setup - gradle version updated - snapshots added - separated test files by flavour
This commit is contained in:
@@ -12,24 +12,24 @@ import com.appttude.h_mal.atlas_weather.data.room.entity.EntityItem
|
||||
interface WeatherDao {
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun upsertFullWeather(item: EntityItem)
|
||||
fun upsertFullWeather(item: EntityItem)
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun upsertListOfFullWeather(items: List<EntityItem>)
|
||||
fun upsertListOfFullWeather(items: List<EntityItem>)
|
||||
|
||||
@Query("SELECT * FROM EntityItem WHERE id = :userId LIMIT 1")
|
||||
fun getCurrentFullWeather(userId: String) : LiveData<EntityItem>
|
||||
|
||||
@Query("SELECT * FROM EntityItem WHERE id = :userId LIMIT 1")
|
||||
suspend fun getCurrentFullWeatherSingle(userId: String) : EntityItem
|
||||
fun getCurrentFullWeatherSingle(userId: String) : EntityItem
|
||||
|
||||
@Query("SELECT * FROM EntityItem WHERE id != :id")
|
||||
fun getAllFullWeatherWithoutCurrent(id: String = CURRENT_LOCATION) : LiveData<List<EntityItem>>
|
||||
|
||||
@Query("SELECT * FROM EntityItem WHERE id != :id")
|
||||
suspend fun getWeatherListWithoutCurrent(id: String = CURRENT_LOCATION) : List<EntityItem>
|
||||
fun getWeatherListWithoutCurrent(id: String = CURRENT_LOCATION) : List<EntityItem>
|
||||
|
||||
@Query("DELETE FROM EntityItem WHERE id = :userId")
|
||||
suspend fun deleteEntry(userId: String): Int
|
||||
fun deleteEntry(userId: String): Int
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.appttude.h_mal.atlas_weather.helper
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import java.lang.reflect.ParameterizedType
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
object GenericsHelper {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun <CLASS : Any> Any.getGenericClassAt(position: Int): KClass<CLASS> =
|
||||
((javaClass.genericSuperclass as? ParameterizedType)
|
||||
?.actualTypeArguments?.getOrNull(position) as? Class<CLASS>)
|
||||
?.kotlin
|
||||
?: throw IllegalStateException("Can not find class from generic argument")
|
||||
|
||||
// /**
|
||||
// * Create a view binding out of the the generic [VB]
|
||||
// *
|
||||
// * @sample inflateBindingByType(getGenericClassAt(0), layoutInflater)
|
||||
// */
|
||||
// fun <VB: ViewBinding> inflateBindingByType(
|
||||
// genericClassAt: KClass<VB>,
|
||||
// layoutInflater: LayoutInflater
|
||||
// ): VB = try {
|
||||
// @Suppress("UNCHECKED_CAST")
|
||||
//
|
||||
// genericClassAt.java.methods.first { viewBinding ->
|
||||
// viewBinding.parameterTypes.size == 1
|
||||
// && viewBinding.parameterTypes.getOrNull(0) == LayoutInflater::class.java
|
||||
// }.invoke(null, layoutInflater) as VB
|
||||
// } catch (exception: Exception) {
|
||||
// println ("generic class failed at = $genericClassAt")
|
||||
// exception.printStackTrace()
|
||||
// throw IllegalStateException("Can not inflate binding from generic")
|
||||
// }
|
||||
//
|
||||
// fun <VB: ViewBinding> LayoutInflater.inflateBindingByType(
|
||||
// container: ViewGroup?,
|
||||
// genericClassAt: KClass<VB>
|
||||
// ): VB = try {
|
||||
// @Suppress("UNCHECKED_CAST")
|
||||
// genericClassAt.java.methods.first { inflateFun ->
|
||||
// inflateFun.parameterTypes.size == 3
|
||||
// && inflateFun.parameterTypes.getOrNull(0) == LayoutInflater::class.java
|
||||
// && inflateFun.parameterTypes.getOrNull(1) == ViewGroup::class.java
|
||||
// && inflateFun.parameterTypes.getOrNull(2) == Boolean::class.java
|
||||
// }.invoke(null, this, container, false) as VB
|
||||
// } catch (exception: Exception) {
|
||||
// throw IllegalStateException("Can not inflate binding from generic")
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user