Skip to content

Instantly share code, notes, and snippets.

View Pooh3Mobi's full-sized avatar

Pooh3Mobi Pooh3Mobi

View GitHub Profile
@Pooh3Mobi
Pooh3Mobi / (:app)build.gradle
Last active May 8, 2022 23:21
RecyclerView Sample in 2022 (for my memo)
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
}
android {
compileSdk 32
package com.example.composegraphicslayerplayground
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.animation.core.CubicBezierEasing
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.animateFloatAsState
@Pooh3Mobi
Pooh3Mobi / CircleAnimDemo.kt
Created February 5, 2023 11:51
Compose InfiniteTransition demo
import androidx.compose.animation.core.LinearOutSlowInEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.requiredSize
import androidx.compose.runtime.Composable
@Pooh3Mobi
Pooh3Mobi / CircleAnimDemo2.kt
Created February 5, 2023 14:55
Compose InfiniteTransition demo
package com.example.composecoolcircleanim.ui.demo
import androidx.compose.animation.core.CubicBezierEasing
import androidx.compose.animation.core.Easing
import androidx.compose.animation.core.LinearOutSlowInEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.tween
@Pooh3Mobi
Pooh3Mobi / RotationState.kt
Created April 12, 2023 01:49
observing Device rotation Jetpack Compose.
data class RotationState(val pitch: Float, val roll: Float)
@Composable
fun observeDeviceRotation(): RotationState {
val rotationState = remember { mutableStateOf(RotationState(0f, 0f)) }
val sensorManager = LocalContext.current.getSystemService(Context.SENSOR_SERVICE) as SensorManager
val accelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER)
val magnetometer = sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD)
val rotationMatrix = FloatArray(9)
val orientationAngles = FloatArray(3)
@Pooh3Mobi
Pooh3Mobi / HalfCircleProgressBar.kt
Created July 8, 2023 09:24
Half-Circle Progress Example in Compose
package com.example.halfcircleprogresscompose
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size