Skip to content

Instantly share code, notes, and snippets.

View imandaliya's full-sized avatar
🐢

Rahul Mandaliya imandaliya

🐢
View GitHub Profile
import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.Path
import android.util.AttributeSet
import android.view.View
class TransparentGridRectView @JvmOverloads constructor(
import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.util.AttributeSet
import android.view.View
class TransparentGridLinesView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyle: Int = 0
import com.google.gson.Gson
import com.google.gson.JsonSyntaxException
import java.io.BufferedReader
import java.io.File
import java.io.FileReader
import java.io.IOException
class GsonEx {
companion object {
# refrence from https://stackoverflow.com/questions/76439814/android-using-new-version-catalog-to-add-local-modules
# settings.gradle
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
rootProject.name = "MyApplication"
include(":app")
include(":library_module")
# build.gradle of project where you add
// Samsung, MI devices has extra navigation-bar
// to remove this bar
Usage:
onCreate() {
super.onCreate()
setConte......
edgeToEdge...
// https://medium.com/@mirzahssn/create-aar-file-in-android-e1ff009ba899
To create AAR
you need to Rebuild Project using android studio OR
just type command in terminal
./gradlew build
./gradlew assemble
// Original Thread
// https://medium.com/@simon.gerges/solving-android-multiple-clicks-problem-kotlin-b99c06135da0
import android.os.SystemClock
import android.view.View
fun View.setSafeOnClickListener(onSafeClick: (View) -> Unit) {
val safeClickListener = SafeClickListener {
onSafeClick(it)
https://stackoverflow.com/a/77778973/829034
Preferences
--> search for kotlin compiler
--> update kotlin compiler version to desired versoin
android {
buildFeatures {
buildConfig true
}
}
private fun getAdsId() {
CoroutineScope(Dispatchers.IO).launch {
var idInfo: AdvertisingIdClient.Info? = null
try {
idInfo = AdvertisingIdClient.getAdvertisingIdInfo(applicationContext)
} catch (e: GooglePlayServicesNotAvailableException) {
e.printStackTrace()
} catch (e: GooglePlayServicesRepairableException) {
e.printStackTrace()