Skip to content

Instantly share code, notes, and snippets.

View AtriTripathi's full-sized avatar
🌐
Available

Atri Tripathi AtriTripathi

🌐
Available
View GitHub Profile
@KlassenKonstantin
KlassenKonstantin / EmojiBg.kt
Created November 16, 2024 10:07
EmojiBg in KMP
@Composable
fun EmojiFont() = FontFamily(
Font(Res.font.noto_emoji_light, FontWeight.Light),
Font(Res.font.noto_emoji_reg, FontWeight.Normal),
Font(Res.font.noto_emoji_med, FontWeight.Medium),
)
val testEmojis =
persistentListOf("🍇", "🍅", "🥬", "🍞", "🧀", "🥚", "🥩", "🍫", "🍕", "🍷", "🧃", "🧼", "🧻", "🧴", "🍏")
@phlummox
phlummox / android-cl-cheatsheet.md
Last active July 19, 2023 10:29
Android development - command-line cheatsheet
@mxalbert1996
mxalbert1996 / Scrollbar.kt
Last active October 24, 2025 08:06
Modifiers to draw scrollbars in Jetpack Compose
/*
* MIT License
*
* Copyright (c) 2022 Albert Chang
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
fun Modifier.swipeableTopBottom(onTop: () -> Unit, onBottom: () -> Unit): Modifier = composed {
var width by rememberSaveable { mutableStateOf(0f) }
val swipeableState = rememberSwipeableState(
SwipeDirection.Initial,
animationSpec = snap()
)
val anchorWidth = remember(width) {
if (width == 0f) {
1f
} else {
@oneSIX
oneSIX / ExampleAdapter.kt
Created December 6, 2020 01:53
This gist can be used as an example of a multi-item RecyclerView adapter using ViewBinding and a Sealed Class to represent the ViewHolder types.
package com.mobile.devpackage.bll.adapters
import android.content.Context
import android.view.LayoutInflater
import android.view.View.*
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.mobile.devname.R
import com.mobile.devname.databinding.GenericTransactionRowFooterLayoutBinding
import com.mobile.devname.databinding.GenericTransactionRowHeaderLayoutBinding
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}#end
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.AsyncListDiffer
import androidx.recyclerview.widget.DiffUtil
#parse("File Header.java")
@sockeqwe
sockeqwe / AdapterDelegateDslExample.kt
Created July 22, 2019 08:19
AdapterDelegates Kotlin DSL
/**
* Let's say we want to display a list of Animals in a RecyclerView.
* The list can contain items of type Dog, Cat and Snake.
*/
// AdapterDelegate for Dog.
fun dogAdapterDelegate(picasso : Picasso) = adapterDelegate<Dog, Animal>(R.layout.item_dog){ // Generics Types means this AdapterDelegate is used if item is instanceof Dog (whole list is List<Anmial>)
// this block is run once in onCreateViewHolder. Think of it as an intializer for a ViewHolder.
val name = findViewById(R.id.name)
val image = findViewById(R.id.image)
@Giladx
Giladx / her-os1-loading.markdown
Created July 18, 2019 01:07
Her - OS1 Loading

Her - OS1 Loading

Loading animation based on movie "Her" - OS1.

  • Mouse or Finger press on the page to finish loading action.

A Pen by gilad on CodePen.

License.

@objcode
objcode / ConcurrencyHelpers.kt
Last active September 22, 2025 10:56
Helpers to control concurrency for one shot requests using Kotlin coroutines.
/* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@mileskrell
mileskrell / build.gradle.kts
Created April 19, 2019 04:26
Example of declaring Android signing configs using Gradle Kotlin DSL
android {
signingConfigs {
getByName("debug") {
keyAlias = "debug"
keyPassword = "my debug key password"
storeFile = file("/home/miles/keystore.jks")
storePassword = "my keystore password"
}
create("release") {
keyAlias = "release"