Skip to content

Instantly share code, notes, and snippets.

View aritra-tech's full-sized avatar
💪
Focusing

Aritra Das aritra-tech

💪
Focusing
View GitHub Profile
@luisenricke
luisenricke / sha_aes_utility.kt
Created October 9, 2019 05:25 — forked from reuniware/sha_aes_utility.kt
Android Kotlin : SHA-1 Hash and AES Encryption/Decryption and Storing password, secretKey, IV and Hash in Shared Preferences
fun hashAndSavePasswordHash(context: Context, clearPassword: String) {
val digest = MessageDigest.getInstance("SHA-1")
val result = digest.digest(clearPassword.toByteArray(Charsets.UTF_8))
val sb = StringBuilder()
for (b in result) {
sb.append(String.format("%02X", b))
}
val hashedPassword = sb.toString()
val sharedPref = PreferenceManager.getDefaultSharedPreferences(context)
val editor = sharedPref.edit()
@riggaroo
riggaroo / GradientAlongPathAnimation.kt
Last active May 29, 2024 19:11
Gradient along a path using path.flatten in Compose, Inspired by William Candillon https://youtu.be/7SCzL-XnfUU, this uses Jetpack Compose to draw a gradient along a path https://github.com/wcandillon/can-it-be-done-in-react-native/tree/master/bonuses/skia-examples/src/PathGradient
package androidx.compose.samples.animationfactory
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
@sagar-viradiya
sagar-viradiya / ThreadLikePathAnimation.kt
Last active June 2, 2024 14:50
An attampt to implement Threads app like path animation on pull to refresh in Jetpack Compose
@OptIn(ExperimentalMaterialApi::class)
@Composable
fun PullToRefreshAnimation() {
val path = remember {
GitHubLogoPath.path.toPath()
}
val lines = remember {
path.asAndroidPath().flatten(error = 0.5f).toList()
}
@KlassenKonstantin
KlassenKonstantin / Pull2Refresh.kt
Created March 26, 2024 11:23
Fitbit style Pull 2 Refresh
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
WindowCompat.setDecorFitsSystemWindows(window, false)
super.onCreate(savedInstanceState)
setContent {
P2RTheme {
// A surface container using the 'background' color from the theme
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) {
CompositionLocalProvider(
LocalOverscrollConfiguration provides null // Disable overscroll otherwise it consumes the drag before we get the chance
@Rahkeen
Rahkeen / ContainerTransformExample.kt
Created April 11, 2024 05:22
A really simple grid-to-full-screen transition using Shared Elements
enum class Scene {
Grid,
Closeup;
fun toggle() = if (this == Grid) Closeup else Grid
}
data class ColorItemState(
val id: Int,
val color: Color,
@KlassenKonstantin
KlassenKonstantin / ContainerTransformExample.kt
Created April 11, 2024 06:00 — forked from Rahkeen/ContainerTransformExample.kt
A really simple grid-to-full-screen transition using Shared Elements
data class ColorItemState(
val id: Int,
val color: Color,
val name: String,
)
val CoolColors = listOf(
ColorItemState(
id = 1,
color = Color(0xFFEF4444),
@ChathuraHettiarachchi
ChathuraHettiarachchi / MotionLayoutTry.kt
Last active May 7, 2024 14:36
This is a sample implementation of AirBnB search bar transition on Android usin Jetpack Compose MotionLayout, MotionScene with DSL. You need to replace the images on `destinations` to work this. FInd the video link https://twitter.com/i/status/1778640663086829622
package com.chootadev.composetryout
import androidx.annotation.DrawableRes
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.keyframes
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable