Skip to content

Instantly share code, notes, and snippets.

View slaviboy's full-sized avatar
🏠
Remote work

Stanislav Krasimirov Georgiev slaviboy

🏠
Remote work
View GitHub Profile
package com.slaviboy.universaldictionarybg
import android.content.Context
import android.graphics.*
import android.util.AttributeSet
import android.view.Gravity
import android.widget.TextView
import androidx.appcompat.widget.AppCompatTextView
class ApostropheTextView : AppCompatTextView {
@slaviboy
slaviboy / MainActivity.kt
Created January 19, 2022 07:45
Android Jetpack Compose set values as Percentage (dw-display width, dh-display height)
import android.content.res.Resources
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.material.Text
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.*
@slaviboy
slaviboy / Units.kt
Created March 13, 2022 14:35
Use device width and height as percentage units for Jetpack Compose
package com.slaviboy.e_commerce_app_ui_compose.ui.theme
import android.app.Activity
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.ExperimentalUnitApi
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.TextUnitType
import androidx.window.layout.WindowMetricsCalculator
import com.slaviboy.e_commerce_app_ui_compose.MainActivity
@slaviboy
slaviboy / Highlight.kt
Created September 16, 2022 21:27
Jetpack Compose Text hyperlink some section of the text
data class Highlight(
val text: String,
val data: String,
val onClick: (data: String) -> Unit
)
@slaviboy
slaviboy / ToolbarComposable.kt
Last active March 17, 2023 21:59
Scrollable Collapsing Toolbar in Compose
package com.slaviboy.features.weather.home.composables
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
@slaviboy
slaviboy / MainActivity.kt
Last active September 9, 2023 16:55
How to position selected element at the middle of a Row
package com.slaviboy.test
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.clickable
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
@slaviboy
slaviboy / MainActivity.kt
Last active October 24, 2024 15:28
Infinite Circular List using Jetpack Compose using Kotlin (Scroll Wheel in Jetpack Compose)
package com.slaviboy.test
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.gestures.snapping.rememberSnapFlingBehavior
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
@slaviboy
slaviboy / MainActivity.kt
Created October 19, 2023 19:49
Scroll to TextField, when it gets focused
package com.slaviboy.test
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
@slaviboy
slaviboy / Description.txt
Created January 2, 2024 23:52
Convert 'pdf' files into 'drawables'
1) Download repo:
> https://github.com/jalios/pdf2svg-windows
2) Make sure to place the pdf flags in dir:
> "C:\Users\Slaviboy\Desktop\Images.xcassets\Flags"
3) Run PowerShell command:
> convert_pdf_to_svg.ps1
4) All flags will be converted into svg files, inside the "..\Flags\output\" directory