Skip to content

Commit

Permalink
Merge branch 'trunk' into fix/improve-loading-time
Browse files Browse the repository at this point in the history
  • Loading branch information
planarvoid committed Nov 2, 2023
2 parents cabe5ba + 2b3694c commit 67f767f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 194 deletions.
2 changes: 2 additions & 0 deletions aztec/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinCoroutinesVersion"

implementation 'org.apache.commons:commons-lang3:3.8.1'

lintChecks "org.wordpress:lint:$wordpressLintVersion"
}

project.afterEvaluate {
Expand Down
16 changes: 9 additions & 7 deletions aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import android.os.Parcelable
import android.provider.Settings
import android.text.Editable
import android.text.InputFilter
import android.text.InputType
import android.text.Spannable
import android.text.SpannableStringBuilder
import android.text.Spanned
Expand Down Expand Up @@ -695,13 +696,14 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
}

override fun onCreateInputConnection(outAttrs: EditorInfo): InputConnection {
val baseInputConnection = requireNotNull(super.onCreateInputConnection(outAttrs)).wrapWithBackSpaceHandler()
return if (shouldOverridePredictiveTextBehavior()) {
AppLog.d(AppLog.T.EDITOR, "Overriding predictive text behavior on Samsung device with Samsung Keyboard with API 33")
SamsungInputConnection(this, baseInputConnection)
} else {
baseInputConnection
val inputConnection = requireNotNull(super.onCreateInputConnection(outAttrs)).wrapWithBackSpaceHandler()

if (shouldOverridePredictiveTextBehavior()) {
AppLog.d(AppLog.T.EDITOR, "Disabling autocorrect on Samsung device with Samsung Keyboard with API 33")
outAttrs.inputType = outAttrs.inputType or InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
}

return inputConnection
}

private fun InputConnection.wrapWithBackSpaceHandler(): InputConnection {
Expand Down Expand Up @@ -1838,7 +1840,7 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
bypassMediaDeletedListener = false
}

// removes Grammarly suggestions from default keyboard on Samsung devices on Android 13 (API 33)
// removes auto-correct from default keyboard on Samsung devices on Android 13 (API 33)
// Grammarly implementation is often messing spans and cursor position, as described here:
// https://github.com/wordpress-mobile/AztecEditor-Android/issues/1023
fun enableSamsungPredictiveBehaviorOverride() {
Expand Down
187 changes: 0 additions & 187 deletions aztec/src/main/kotlin/org/wordpress/aztec/SamsungInputConnection.kt

This file was deleted.

5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ ext {
}

ext {
// mixed
gradlePluginVersion = '3.3.1'
kotlinCoroutinesVersion = '1.6.4'
tagSoupVersion = '1.2.1'
Expand All @@ -80,5 +81,9 @@ ext {
wordpressUtilsVersion = '3.5.0'
espressoVersion = '3.0.1'

// other
wordpressLintVersion = '2.0.0'

// project
aztecProjectDependency = project.hasProperty("aztecVersion") ? "org.wordpress:aztec:${project.getProperty("aztecVersion")}" : project(":aztec")
}

0 comments on commit 67f767f

Please sign in to comment.