Requirements:
-
Device should be a rooted (simulator’s are rooted by default)
-
adbd should be started as root. (Rub command:
adb root
)
Now, send local push message using command:
fun <T> unsafeLazy(initializer: () -> T) = lazy(LazyThreadSafetyMode.NONE, initializer) | |
@JvmOverloads @Dimension(unit = Dimension.PX) fun Number.dpToPx( | |
metrics: DisplayMetrics = Resources.getSystem().displayMetrics | |
): Float { | |
return toFloat() * metrics.density | |
} | |
@JvmOverloads @Dimension(unit = Dimension.DP) fun Number.pxToDp( | |
metrics: DisplayMetrics = Resources.getSystem().displayMetrics |
Requirements:
Device should be a rooted (simulator’s are rooted by default)
adbd should be started as root. (Rub command: adb root
)
Now, send local push message using command:
//app build.gradle | |
apply plugin: 'kotlin-kapt' | |
... | |
dependencies { | |
{ | |
//Moshi Core | |
implementation "com.squareup.moshi:moshi:1.8.0" | |
//Moshi Codegen |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.Job | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.launch | |
/* | |
This is free and unencumbered software released into the public domain. | |
Anyone is free to copy, modify, publish, use, compile, sell, or | |
distribute this software, either in source code form or as a compiled |
import android.os.Bundle | |
import androidx.fragment.app.Fragment | |
import androidx.fragment.app.activityViewModels | |
import androidx.fragment.app.viewModels | |
import androidx.lifecycle.AbstractSavedStateViewModelFactory | |
import androidx.lifecycle.SavedStateHandle | |
import androidx.lifecycle.ViewModel | |
import androidx.lifecycle.ViewModelProvider | |
import androidx.savedstate.SavedStateRegistryOwner |
apply plugin: 'maven-publish' | |
apply plugin: 'signing' | |
task androidSourcesJar(type: Jar) { | |
archiveClassifier.set('sources') | |
if (project.plugins.findPlugin("com.android.library")) { | |
from android.sourceSets.main.java.srcDirs | |
from android.sourceSets.main.kotlin.srcDirs | |
} else { | |
from sourceSets.main.java.srcDirs |
import android.graphics.Typeface | |
import androidx.compose.foundation.Canvas | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.layout.BoxWithConstraints | |
import androidx.compose.foundation.layout.Column | |
import androidx.compose.foundation.layout.Row | |
import androidx.compose.foundation.layout.RowScope | |
import androidx.compose.foundation.layout.fillMaxHeight | |
import androidx.compose.foundation.layout.fillMaxWidth | |
import androidx.compose.runtime.Composable |
@Composable | |
fun ParallaxScreen(modifier: Modifier = Modifier) { | |
val context = LocalContext.current | |
val scope = rememberCoroutineScope() | |
var data by remember { mutableStateOf<SensorData?>(null) } | |
DisposableEffect(Unit) { | |
val dataManager = SensorDataManager(context) | |
dataManager.init() |
import org.json.JSONObject | |
import java.io.File | |
const val tinyPngApiKey = "<YOUR-API-KEY-GOES-HERE>" | |
val projectDir = File("<PATH-TOPROJECT-ROOT>") | |
val supportedExtensions = listOf("png", "jpg") | |
fun main() { | |
projectDir.walk().forEach { srcFile -> | |
if (supportedExtensions.contains(srcFile.extension)) { |
import android.os.Bundle | |
import androidx.activity.ComponentActivity | |
import androidx.activity.compose.setContent | |
import androidx.compose.animation.core.Animatable | |
import androidx.compose.animation.core.Spring | |
import androidx.compose.animation.core.VectorConverter | |
import androidx.compose.animation.core.spring | |
import androidx.compose.foundation.BorderStroke | |
import androidx.compose.foundation.gestures.awaitFirstDown | |
import androidx.compose.foundation.gestures.forEachGesture |