Ci integration upgrade (#14)

- Circleci setup
 - gradle version updated
 - snapshots added
 - separated test files by flavour
This commit is contained in:
2023-07-26 22:54:08 +01:00
committed by GitHub
parent 3d5cb4e9fe
commit 4a37b724a6
28 changed files with 920 additions and 158 deletions

View File

@@ -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
}

View File

@@ -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")
// }
}