mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Fix issue where incognito mode was not enabled in text story creation.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package org.thoughtcrime.securesms.util
|
||||
|
||||
import android.widget.EditText
|
||||
|
||||
/**
|
||||
* Since this value is only supported on API26+ we hard-code it here
|
||||
* to avoid issues with older versions. This mirrors the approach
|
||||
* taken by [org.thoughtcrime.securesms.components.ComposeText].
|
||||
*/
|
||||
private const val INCOGNITO_KEYBOARD = 16777216
|
||||
|
||||
/**
|
||||
* Enables or disables incognito-mode for the keyboard. Note that this might not
|
||||
* be respected by all IMEs.
|
||||
*/
|
||||
fun EditText.setIncognitoKeyboardEnabled(isIncognitoKeyboardEnabled: Boolean) {
|
||||
imeOptions = if (isIncognitoKeyboardEnabled) {
|
||||
imeOptions or INCOGNITO_KEYBOARD
|
||||
} else {
|
||||
imeOptions and INCOGNITO_KEYBOARD.inv()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user