Skip to content

Instantly share code, notes, and snippets.

@MachFour
MachFour / IntrinsicCrash.kt
Created December 21, 2023 02:23
Jetpack Compose crash
import androidx.compose.foundation.layout.*
import androidx.compose.material.DropdownMenu
import androidx.compose.material.DropdownMenuItem
import androidx.compose.material.OutlinedTextField
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@MachFour
MachFour / ActionMenu.kt
Last active January 22, 2024 14:39
Jetpack Compose Material3 ActionMenu
import androidx.annotation.StringRes
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Call
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.Email
import androidx.compose.material.icons.filled.Menu
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
@MachFour
MachFour / CustomAutoCompleteTextView.kt
Last active April 10, 2024 19:41
A (Material) AutoCompleteTextView that automatically hides the keyboard when scrolling the dropdown list. Uses reflection and is very hacky.
package com.machfour.example.app
import android.content.Context
import android.os.Build
import android.util.AttributeSet
import android.util.Log
import android.view.inputmethod.InputMethodManager
import android.widget.AbsListView
import android.widget.AutoCompleteTextView
import android.widget.ListPopupWindow