Skip to content

Instantly share code, notes, and snippets.

View Thomas-Bagnolati's full-sized avatar

Thomas Bagnolati Thomas-Bagnolati

View GitHub Profile
@Maxim-Kolmogorov
Maxim-Kolmogorov / mask.kt
Last active April 17, 2024 12:47
Phone mask for Android Jetpack Compose
package my.app.android
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.input.OffsetMapping
import androidx.compose.ui.text.input.TransformedText
import androidx.compose.ui.text.input.VisualTransformation
import kotlin.math.absoluteValue
class MaskVisualTransformation(private val mask: String): VisualTransformation {
private val specialSymbolsIndices = mask.indices.filter { mask[it] != '#' }
@msomu
msomu / DateVisualTransformation.kt
Created June 30, 2021 17:26
UseVisualTransformation to Create Date TextField in Jetpack Compose
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.input.OffsetMapping
import androidx.compose.ui.text.input.TransformedText
import androidx.compose.ui.text.input.VisualTransformation
class DateVisualTransformation : VisualTransformation {
override fun filter(text: AnnotatedString): TransformedText {
// Make the string DD-MM-YYYY
val trimmed = if (text.text.length >= 8) text.text.substring(0..7) else text.text
var output = ""
@DavidIbrahim
DavidIbrahim / DashedBorder.kt
Last active May 14, 2024 15:13
dashedBorder modifier for android compose
import androidx.compose.foundation.BorderStroke
/*
* Copyright 2020 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
*
* http://www.apache.org/licenses/LICENSE-2.0
@eis6aer
eis6aer / SampleCastingPlayerActivity.kt
Created December 12, 2020 05:46 — forked from stefan-zh/SampleCastingPlayerActivity.kt
Create Cast-enabled Activity with ExoPlayer
package com.exoplayer.cast
import android.net.Uri
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import androidx.appcompat.app.AppCompatActivity
import com.google.android.exoplayer2.Player
import com.google.android.exoplayer2.SimpleExoPlayer
import com.google.android.exoplayer2.ext.cast.CastPlayer
@cham11ng
cham11ng / git-ssh-configuration.md
Last active October 22, 2023 13:01
Configuring SSH for Git

Git Installation and SSH Configuration

By: Sagar Chamling

Installation

For Linux (Debian/Ubuntu):

sudo apt install git
@RobertAudi
RobertAudi / ideavimrc
Created July 28, 2014 08:46
System clipboard support in IdeaVim
nnoremap yy "+yy
vnoremap y "+y
nnoremap p "+p
vnoremap p "+p
nnoremap P "+P
vnoremap P "+P