mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-27 04:07:10 +00:00
lint
This commit is contained in:
parent
eea2dd4ee8
commit
bd453c26cd
3 changed files with 16 additions and 2 deletions
|
@ -7,6 +7,8 @@
|
||||||
package helium314.keyboard.accessibility
|
package helium314.keyboard.accessibility
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.media.AudioDeviceInfo
|
||||||
|
import android.media.AudioDeviceInfo.*
|
||||||
import android.media.AudioManager
|
import android.media.AudioManager
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
|
@ -72,7 +74,19 @@ class AccessibilityUtils private constructor() {
|
||||||
if (speakPassword) return false
|
if (speakPassword) return false
|
||||||
}
|
}
|
||||||
// Always speak if the user is listening through headphones.
|
// Always speak if the user is listening through headphones.
|
||||||
return if (mAudioManager.isWiredHeadsetOn || mAudioManager.isBluetoothA2dpOn) {
|
val listeningThroughHeadphones = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||||
|
@Suppress("deprecation") // no replacement available
|
||||||
|
mAudioManager.isWiredHeadsetOn || mAudioManager.isBluetoothA2dpOn
|
||||||
|
} else {
|
||||||
|
// try the same as the deprecated thing above, for what we can assume to be headphones
|
||||||
|
mAudioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS).any {
|
||||||
|
when (it.type) {
|
||||||
|
TYPE_WIRED_HEADSET, TYPE_WIRED_HEADPHONES, TYPE_BLUETOOTH_SCO, TYPE_BLUETOOTH_A2DP, TYPE_USB_HEADSET, TYPE_HEARING_AID, TYPE_BLE_HEADSET -> true
|
||||||
|
else -> false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return if (listeningThroughHeadphones) {
|
||||||
false
|
false
|
||||||
} else InputTypeUtils.isPasswordInputType(editorInfo.inputType)
|
} else InputTypeUtils.isPasswordInputType(editorInfo.inputType)
|
||||||
// Don't speak if the IME is connected to a password field.
|
// Don't speak if the IME is connected to a password field.
|
||||||
|
|
|
@ -795,7 +795,6 @@ abstract class KeyboardParser(private val params: KeyboardParams, private val co
|
||||||
// currently always holo is applied in readAttributes
|
// currently always holo is applied in readAttributes
|
||||||
private fun layoutInfos(params: KeyboardParams): LayoutInfos {
|
private fun layoutInfos(params: KeyboardParams): LayoutInfos {
|
||||||
val layout = params.mId.mSubtype.keyboardLayoutSetName
|
val layout = params.mId.mSubtype.keyboardLayoutSetName
|
||||||
val language = params.mId.locale.language
|
|
||||||
// only for alphabet, but some exceptions for shift layouts
|
// only for alphabet, but some exceptions for shift layouts
|
||||||
val enableProximityCharsCorrection = params.mId.isAlphabetKeyboard && when (layout) {
|
val enableProximityCharsCorrection = params.mId.isAlphabetKeyboard && when (layout) {
|
||||||
"bengali_akkhor", "georgian", "hindi", "lao", "nepali_romanized", "nepali_traditional", "sinhala", "thai" ->
|
"bengali_akkhor", "georgian", "hindi", "lao", "nepali_romanized", "nepali_traditional", "sinhala", "thai" ->
|
||||||
|
|
|
@ -195,6 +195,7 @@ private fun getDefaultEnabledSubtypes(): List<InputMethodSubtype> {
|
||||||
/** string for for identifying a subtype, does not contain all necessary information to actually create it */
|
/** string for for identifying a subtype, does not contain all necessary information to actually create it */
|
||||||
private fun InputMethodSubtype.prefString(): String {
|
private fun InputMethodSubtype.prefString(): String {
|
||||||
if (DebugFlags.DEBUG_ENABLED && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && locale().toLanguageTag() == "und") {
|
if (DebugFlags.DEBUG_ENABLED && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && locale().toLanguageTag() == "und") {
|
||||||
|
@Suppress("deprecation") // it's debug logging, better get all information
|
||||||
Log.e(TAG, "unknown language, should not happen ${locale}, $languageTag, $extraValue, ${hashCode()}, $nameResId")
|
Log.e(TAG, "unknown language, should not happen ${locale}, $languageTag, $extraValue, ${hashCode()}, $nameResId")
|
||||||
}
|
}
|
||||||
return locale().toLanguageTag() + LOCALE_LAYOUT_SEPARATOR + SubtypeLocaleUtils.getKeyboardLayoutSetName(this)
|
return locale().toLanguageTag() + LOCALE_LAYOUT_SEPARATOR + SubtypeLocaleUtils.getKeyboardLayoutSetName(this)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue