Skip to content

Instantly share code, notes, and snippets.

View kotoMJ's full-sized avatar
:octocat:
Coding from the Middle-earth

Michal Jenicek kotoMJ

:octocat:
Coding from the Middle-earth
View GitHub Profile
package com.example.myapp.animation
import androidx.compose.animation.core.*
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.size
@micHar
micHar / annotatedStringResource.kt
Last active May 12, 2023 10:33
Helper function loading annotated strings from strings.xml (might require further optimization)
import android.text.Annotation
import android.text.SpannedString
import androidx.annotation.StringRes
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.SpanStyle
import androidx.core.text.getSpans
@Composable
import timber.log.Timber
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty
class MyClass {
// This will automatically have the TAG "MyClass"
private val log by timber()
fun logSomething() {
log.i("Hello")
@ErikHellman
ErikHellman / MarkdownComposer.kt
Last active November 22, 2023 12:16
A simple rendered for Markdown text parsed using CommonMarks
package se.hellsoft.markdowncomposer
import android.util.Log
import androidx.compose.foundation.Box
import androidx.compose.foundation.ContentGravity
import androidx.compose.foundation.Text
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.text.InlineTextContent
import androidx.compose.foundation.text.appendInlineContent
import androidx.compose.material.Colors
@Zhuinden
Zhuinden / FragmentViewBindingDelegate.kt
Last active February 24, 2024 20:13
Fragment view binding delegate
// https://github.com/Zhuinden/fragmentviewbindingdelegate-kt
import android.view.View
import androidx.fragment.app.Fragment
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.Observer
import androidx.viewbinding.ViewBinding
import kotlin.properties.ReadOnlyProperty
@sonvp
sonvp / gist:7873060a99895f483ca48fdc030c71ad
Last active October 25, 2022 11:11
DrawableLeft to top or DrawableRight to top in TextView multiline.
1. Create Custom TextView.
public class TextViewDrawable extends android.support.v7.widget.AppCompatTextView {
public TextViewDrawable(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
/**
@cmelchior
cmelchior / BarListParcelConverter.java
Last active August 29, 2019 09:46
Using Parceler 1.0.3 with Realm
// Specific class for a RealmList<Bar> field
public class BarListParcelConverter extends RealmListParcelConverter<Bar> {
@Override
public void itemToParcel(Bar input, Parcel parcel) {
parcel.writeParcelable(Parcels.wrap(input), 0);
}
@Override
public Bar itemFromParcel(Parcel parcel) {
@lukehedger
lukehedger / ffmpeg-compress-mp4
Last active May 6, 2024 08:32
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
# sleepy flower girl
(◡ ‿ ◡ ✿)
# y u no
ლ(ಠ益ಠლ)
# smiling breasts
(^人^)
# flipping tables