Skip to content

Instantly share code, notes, and snippets.

View rylexr's full-sized avatar
💭
Working on Memorigi Web!

R rylexr

💭
Working on Memorigi Web!
View GitHub Profile
@Composable
fun SpringRelease() {
val offsetY = remember { Animatable(0f) }
val scope = rememberCoroutineScope()
Box(
modifier = Modifier
.fillMaxSize()
.padding(20.dp),
contentAlignment = Alignment.TopCenter
import androidx.compose.animation.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.window.Popup
@Composable
fun AniJinPopup(
expanded: Boolean,
@virendersran01
virendersran01 / ReorderableList.kt
Created September 3, 2021 01:59 — forked from surajsau/DragDropList.kt
Drag-n-Drop implementation in Jetpack Compose
@Composable
fun ReorderableList(
items: List<ReorderItem>,
onMove: (Int, Int) -> Unit,
modifier: Modifier = Modifier
) {
val scope = rememberCoroutineScope()
var overscrollJob by remember { mutableStateOf<Job?>(null) }
@dovahkiin98
dovahkiin98 / FadingEdge.kt
Last active April 29, 2024 14:57
A Jetpack Compose implementation of the `fadingEdge` effect.
import androidx.compose.foundation.ScrollState
import androidx.compose.material.MaterialTheme
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
import androidx.compose.ui.draw.drawWithContent
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.debugInspectorInfo
@loloof64
loloof64 / SimpleDragAndDrop.kt
Last active April 19, 2022 01:23
A simple Drag and Drop in Jetpack compose 1.0.0-alpha07 (needing adding imports automatically from Android Studio - Canary channel)
@Preview
@Composable
fun DragNDropComponent() {
Column(modifier = Modifier.size(100.dp).background(Color.Red)) {
// The updatable Drag and Drop data
var x by remember{ mutableStateOf(0f)}
var y by remember { mutableStateOf(0f)}
// The offsets that is always update, that place the component to be dragged
val offsetX = with(DensityAmbient.current) {
@probonopd
probonopd / Wayland.md
Last active May 28, 2024 21:50
Think twice about Wayland. It breaks everything!

Think twice before abandoning Xorg. Wayland breaks everything!

Hence, if you are interested in existing applications to "just work" without the need for adjustments, then you may be better off avoiding Wayland.

Wayland solves no issues I have but breaks almost everything I need. Even the most basic, most simple things (like xkill) - in this case with no obvious replacement. And usually it stays broken, because the Wayland folks mostly seem to care about Automotive, Gnome, maybe KDE - and alienating everyone else (e.g., people using just an X11 window manager or something like GNUstep) in the process.

Wayland proponents make it seem like Wayland is "the successor" of Xorg, when in fact it is not. It is merely an incompatible alternative, and not even one that has (nor wants to have) feature parity (missing features). And unlike X11 (the X Window System), Wayland protocol designers actively avoid the concept of "windows" (making up incompr

@joaocruz04
joaocruz04 / android_room_fts4.md
Last active May 21, 2024 04:40
Enabling FTS4 on an Android + Room project

Enabling FTS4 on an Android project with Room

You can do a SQL text query by using the LIKE operator. The issue is that using it requires a lot of computation, as a complete string query is done. Also if you want to have more search options (more fields), your query will grow a lot in complexity. To solve this issue, there's a concept of virtual tables for full text search (FTS).

We will build our solution using Room (already set in the project). We're using version 2.2.0-rc01 for that.

Step 1 - Create new Virtual Table

With Room, the only thing we need is to create the new class with @FTS4 notation. By specifying contentEntity to be the Route class, it means that it will reuse the values from the Route table instead of populating this one with copies. The fields in question should match the ones from the Route table. In this example we only need the title.

package com.geekorum.geekdroid.navigation
import android.content.Context
import android.os.Bundle
import android.util.AttributeSet
import androidx.core.content.res.use
import androidx.core.os.bundleOf
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
@yubing24
yubing24 / account.component.html
Created August 9, 2018 05:51
Angular Material Side Navigation with Expandable Menus
<mat-toolbar color="accent">
<button mat-icon-button matTooltip="Application Menu" (click)="sidenav.toggle()">
<mat-icon>settings</mat-icon>
</button>
Account Settings
<span style="flex: 1 1 auto;"></span>
<div>
<button mat-icon-button matTooltip="Switch Apps">
<mat-icon>apps</mat-icon>
</button>

In terminal:

    nano ~/.bash_profile

Place the following in the opened file:

    # Open Xcode workspace from terminal.
    alias workspace='open -a "/Applications/Xcode.app" *.xcworkspace'
    alias project='open -a "/Applications/Xcode.app" *.xcodeproj'