Skip to content

Instantly share code, notes, and snippets.

@67Samuel
67Samuel / DetectSoftKeyboardExample.kt
Last active August 2, 2023 07:41
Detect Soft Keyboard
fun Activity.handleKeyboardVisibility(isInitialKeyboardVisible: Boolean = true, onOpen: () -> Unit, onClose: () -> Unit) {
var isKeyboardVisible = isInitialKeyboardVisible
val listener = OnGlobalLayoutListener {
window.decorView.apply {
val r = Rect()
getWindowVisibleDisplayFrame(r)
val isKeyboardCurrentlyVisible = height - r.bottom > height * 0.1399
if (!isKeyboardVisible && isKeyboardCurrentlyVisible) {
// Keyboard is open
@67Samuel
67Samuel / basic_algos.md
Last active October 16, 2022 11:12
Basic sorting and searching algorithms
@67Samuel
67Samuel / protecting-secrets-in-gradle.md
Last active September 21, 2022 05:39
Protecting secrets in .gradle files

In order to protect secrets related to signing in build.gradle, I did the following:

This is just a more step-by-step/expanded version of this gist and this commit. You should be able to do similar things for any other secrets!

Step 1

Make a .properties file (in this case I called it signing.properties) where the secrets will be stored.

RELEASE_STORE_PASSWORD=acbd123
RELEASE_KEY_PASSWORD=qwerty7890
RELEASE_KEY_ALIAS=key0