Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Fix/ime iob fix" #882

Merged
merged 2 commits into from
Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

46 changes: 0 additions & 46 deletions aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ import android.view.MotionEvent
import android.view.View
import android.view.WindowManager
import android.view.inputmethod.BaseInputConnection
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputConnection
import android.widget.CheckBox
import android.widget.EditText
import android.widget.Toast
Expand All @@ -73,7 +71,6 @@ import org.wordpress.aztec.handlers.ListHandler
import org.wordpress.aztec.handlers.ListItemHandler
import org.wordpress.aztec.handlers.PreformatHandler
import org.wordpress.aztec.handlers.QuoteHandler
import org.wordpress.aztec.ime.EditorInfoUtils
import org.wordpress.aztec.plugins.IAztecPlugin
import org.wordpress.aztec.plugins.IToolbarButton
import org.wordpress.aztec.source.Format
Expand Down Expand Up @@ -122,7 +119,6 @@ import org.wordpress.aztec.watchers.event.text.BeforeTextChangedEventData
import org.wordpress.aztec.watchers.event.text.OnTextChangedEventData
import org.wordpress.aztec.watchers.event.text.TextWatcherEvent
import org.xml.sax.Attributes
import java.lang.ref.WeakReference
import java.security.MessageDigest
import java.security.NoSuchAlgorithmException
import java.util.ArrayList
Expand Down Expand Up @@ -297,9 +293,6 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown

private var focusOnVisible = true

var inputConnectionRef: WeakReference<InputConnection>? = null
var inputConnectionEditorInfo: EditorInfo? = null

interface OnSelectionChangedListener {
fun onSelectionChanged(selStart: Int, selEnd: Int)
}
Expand Down Expand Up @@ -671,45 +664,6 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
}
}

override fun onCreateInputConnection(outAttrs: EditorInfo) : InputConnection {
// limiting the reuseInputConnection fix for Anroid 8.0.0 for now
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.O) {
return handleReuseInputConnection(outAttrs)
}

return super.onCreateInputConnection(outAttrs)
}

private fun handleReuseInputConnection(outAttrs: EditorInfo) : InputConnection {
// initialize inputConnectionEditorInfo
if (inputConnectionEditorInfo == null) {
inputConnectionEditorInfo = outAttrs
}

// now init the InputConnection, or replace if EditorInfo contains anything different
if (inputConnectionRef?.get() == null || !EditorInfoUtils.areEditorInfosTheSame(outAttrs, inputConnectionEditorInfo!!)) {
// we have a new InputConnection to create, save the new EditorInfo data and create it
// we make a copy of the parameters being received, because super.onCreateInputConnection may make changes
// to EditorInfo params being sent to it, and we want to preserve the same data we received in order
// to compare.
// (see https://android.googlesource.com/platform/frameworks/base/+/jb-mr0-release/core/java/android/widget/
// TextView.java#5404)
inputConnectionEditorInfo = EditorInfoUtils.copyEditorInfo(outAttrs)
val localInputConnection = super.onCreateInputConnection(outAttrs)
if (localInputConnection == null) {
// in case super returns null, let's just observe the base implementation, no need to make
// an InputConnectionWrapper of a null target
return localInputConnection
}
// if non null, wrap the new InputConnection around our wrapper (used for logging purposes only)
//inputConnection = AztecTextInputConnectionWrapper(localInputConnection, this)
inputConnectionRef = WeakReference(localInputConnection)
}

// return the existing inputConnection
return inputConnectionRef?.get()!!
}

// We are exposing this method in order to allow subclasses to set their own alpha value
// for preformatted background
open fun getPreformatBackgroundAlpha(styles: TypedArray): Float {
Expand Down
55 changes: 0 additions & 55 deletions aztec/src/main/kotlin/org/wordpress/aztec/ime/EditorInfoUtils.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ class CssUnderlinePlugin : ISpanPostprocessor, ISpanPreprocessor {
if (hiddenSpan.TAG == SPAN_TAG) {
val parentStyle = hiddenSpan.attributes.getValue(CssStyleFormatter.STYLE_ATTRIBUTE)
val childStyle = calypsoUnderlineSpan.attributes.getValue(CssStyleFormatter.STYLE_ATTRIBUTE)
if (parentStyle != null && childStyle != null) {
hiddenSpan.attributes.setValue(CssStyleFormatter.STYLE_ATTRIBUTE, CssStyleFormatter.mergeStyleAttributes(parentStyle, childStyle))
}
hiddenSpan.attributes.setValue(CssStyleFormatter.STYLE_ATTRIBUTE, CssStyleFormatter.mergeStyleAttributes(parentStyle, childStyle))

// remove the extra child span
spannable.removeSpan(calypsoUnderlineSpan)
Expand Down