That fuck shit the fascists are using
1package org.tm.archive.util
2
3import android.widget.EditText
4
5/**
6 * Since this value is only supported on API26+ we hard-code it here
7 * to avoid issues with older versions. This mirrors the approach
8 * taken by [org.tm.archive.components.ComposeText].
9 */
10private const val INCOGNITO_KEYBOARD = 16777216
11
12/**
13 * Enables or disables incognito-mode for the keyboard. Note that this might not
14 * be respected by all IMEs.
15 */
16fun EditText.setIncognitoKeyboardEnabled(isIncognitoKeyboardEnabled: Boolean) {
17 imeOptions = if (isIncognitoKeyboardEnabled) {
18 imeOptions or INCOGNITO_KEYBOARD
19 } else {
20 imeOptions and INCOGNITO_KEYBOARD.inv()
21 }
22}