Skip to content

Instantly share code, notes, and snippets.

View PetkevichPavel's full-sized avatar
💭
🚀 Never Stop 🚀

Pavel Petkevich PetkevichPavel

💭
🚀 Never Stop 🚀
View GitHub Profile
@PetkevichPavel
PetkevichPavel / Generic.kt
Created May 3, 2020 22:03
SharedPreferences under Delegated properties - generic type class.
class Generic<T : Any>(val c: Class<T>) {
companion object {
/**
* Returns generic's argument class.
*/
inline operator fun <reified T : Any> invoke() = Generic(T::class.java)
}
/**
* Check if value is instance of desired class.
@PetkevichPavel
PetkevichPavel / SomeRepository.kt
Last active May 3, 2020 22:36
SharedPreferences under Delegated properties - SomeRepository for test the pattern.
class SomeRepository(
private val someManager: SomeManager
) : ISomeRepository, BaseRepository() {
override val userId: Long?
get() = someManager.userId
override fun testSet(userId: Long) {
someManager.userId = userId
}
package com.berider.app.common.utils
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.os.Parcelable
import android.view.inputmethod.InputMethodManager
import androidx.activity.OnBackPressedCallback
import androidx.appcompat.app.ActionBar
import androidx.appcompat.app.AppCompatActivity
@PetkevichPavel
PetkevichPavel / common-android-library.gradle
Created February 27, 2023 21:22
common-android-library.gradle
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply from: "$rootDir/gradle/dependencies.gradle"
def ext = rootProject.ext
android {
compileSdkVersion ext.compileSdkVersion