This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import kotlinx.serialization.ExperimentalSerializationApi | |
| import kotlinx.serialization.KSerializer | |
| import kotlinx.serialization.builtins.serializer | |
| import kotlinx.serialization.descriptors.SerialDescriptor | |
| import kotlinx.serialization.descriptors.buildClassSerialDescriptor | |
| import kotlinx.serialization.descriptors.element | |
| import kotlinx.serialization.encoding.CompositeDecoder | |
| import kotlinx.serialization.encoding.Decoder | |
| import kotlinx.serialization.encoding.Encoder | |
| import kotlinx.serialization.encoding.decodeStructure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ext.getChangeLog = { lastCommitsCount = 10 -> | |
| return formatGitLog(getGitLogUntilCommitNumber(lastCommitsCount)) | |
| } | |
| ext.getReleaseChangeLog = { | |
| def lastTag = getLastTag() | |
| return formatGitLog(getGitLogUntilTag(lastTag)) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val activityManager = (context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager) | |
| val memoryInfo = ActivityManager.MemoryInfo() | |
| activityManager.getMemoryInfo(memoryInfo) | |
| val totalMemory = memoryInfo.totalMem |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import androidx.paging.ExperimentalPagingApi | |
| import androidx.paging.LoadType | |
| import androidx.paging.PagingState | |
| import androidx.paging.RemoteMediator | |
| import com.github.michaelbull.result.Result | |
| import com.github.michaelbull.result.get | |
| import com.github.michaelbull.result.onFailure | |
| import kotlinx.coroutines.Dispatchers | |
| import kotlinx.coroutines.withContext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private const val PREFS_REQUEST_RATE_LIMITER = "request-rate-preferences" | |
| private const val KEY_LAST_URL = "lastUrl" | |
| private const val KEY_LAST_REQUEST_TIME = "lastRequestTime" | |
| class RequestRateLimiterInterceptor(context: Context) : Interceptor { | |
| private val preferences = | |
| context.getSharedPreferences(PREFS_REQUEST_RATE_LIMITER, Context.MODE_PRIVATE) | |
| override fun intercept(chain: Interceptor.Chain): Response { | |
| val baseRequest = chain.request() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import androidx.room.TypeConverter | |
| import java.time.Instant | |
| import java.time.LocalDateTime | |
| import java.time.ZoneId | |
| import java.time.ZoneOffset | |
| class Converters { | |
| @TypeConverter | |
| fun fromLocalDatetime(value: LocalDateTime?): Long? { | |
| return value?.atZone(ZoneId.of(ZoneOffset.systemDefault().id))?.toInstant()?.toEpochMilli() |
NewerOlder