Skip to content

Instantly share code, notes, and snippets.

View nirbhayph's full-sized avatar

Nirbhay Pherwani nirbhayph

View GitHub Profile
@nirbhayph
nirbhayph / Circles.kt
Last active December 11, 2023 21:06
Google Maps and Jetpack Compose
@Composable
fun CircleMap() {
// Define the coordinates for circle centers and their associated information
val circleData = listOf(
CircleInfo("Park A", LatLng(37.7749, -122.4194), "This is Park A"),
CircleInfo("Park B", LatLng(36.7783, -119.4179), "This is Park B"),
CircleInfo("Park C", LatLng(34.0522, -118.2437), "This is Park C")
)
// Create a mutable state to track the selected circle
@nirbhayph
nirbhayph / AbstractArtText.kt
Created September 6, 2023 20:01
Composing AnnotatedString -  Poetry, Music, Code, Blogs, Expandables and Beyond
@Composable
fun AbstractArtText(){
val abstractArtText = buildAnnotatedString {
withStyle(style = SpanStyle(fontSize = 42.sp, brush = Brush.horizontalGradient(listOf(Color.Red, Color.Blue, Color.Green)))) {
append("Colors in Motion")
}
append("\n\n")
append("Vivid shades of ")
withStyle(style = SpanStyle(brush = Brush.verticalGradient(listOf(Color.Magenta, Color.Yellow)))) {
append("passion")
@nirbhayph
nirbhayph / BarChart.kt
Last active April 14, 2024 19:20
Delving into Canvas for Custom Graphics and Animations with Jetpack Compose
@Composable
fun Chart(){
val temperatureData = listOf(
DataPoint(20f, SampleColors.lighterPink),
DataPoint(45f, SampleColors.lightBlue),
DataPoint(130f, SampleColors.darkPink),
DataPoint(80f, SampleColors.lightPink),
DataPoint(65f, Color.Cyan)
)
@nirbhayph
nirbhayph / CustomModifiers.kt
Last active August 24, 2023 17:13
Unleashing Creativity with Custom Modifiers in Android Jetpack Compose
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.keyframes
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
import androidx.compose.ui.draw.drawWithContent
import androidx.compose.ui.graphics.Brush
@nirbhayph
nirbhayph / Data.kt
Last active August 27, 2023 15:43
Kotlin's Flow API -  Combining and Merging Flows for Reactive Programming
/**
* Created by Nirbhay Pherwani on 8/14/2023.
* Linktree - https://linktree.com/nirbhaypherwani
*/
data class Like(val userName: String, val postTitle: String, val reactionName: String)
data class Comment(val userName: String, val postTitle: String, val commentText: String)
data class Post(val userName: String, val postTitle: String)
@nirbhayph
nirbhayph / DragDrop.kt
Last active August 8, 2023 19:56
Implementing Drag and Drop Across Multiple Screens in Your Android App with Jetpack Compose
/**
* Author - Nirbhay Pherwani
* Medium - https://medium.com/@pherwani37
* LinkedIn - https://linkedin.com/in/nirbhaypherwani
* Medium Article Title - Seamless Play of D&D — Implementing Drag and Drop Across Multiple Screens in Your Android App with Jetpack Compose
*/
import android.content.Context
import androidx.compose.animation.core.tween
import androidx.compose.foundation.ExperimentalFoundationApi