Skip to content

Commit 0d2a0db

Browse files
committed
Use theme to migrate deprecated SOFT_INPUT_ADJUST_RESIZE
LayoutParams.SOFT_INPUT_ADJUST_RESIZE was deprecated in API level 30. A theme added to the dialog to keep the same behavior.
1 parent e56f841 commit 0d2a0db

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ import android.view.LayoutInflater
4949
import android.view.MotionEvent
5050
import android.view.View
5151
import android.view.View.OnLongClickListener
52-
import android.view.WindowManager
5352
import android.view.inputmethod.BaseInputConnection
5453
import android.view.inputmethod.EditorInfo
5554
import android.view.inputmethod.InputConnection
@@ -2099,7 +2098,7 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
20992098

21002099
@SuppressLint("InflateParams")
21012100
fun showBlockEditorDialog(unknownHtmlSpan: UnknownHtmlSpan, html: String = "") {
2102-
val builder = AlertDialog.Builder(context)
2101+
val builder = AlertDialog.Builder(context, R.style.ResizableDialogTheme)
21032102

21042103
val dialogView = LayoutInflater.from(context).inflate(R.layout.dialog_block_editor, null)
21052104
val source = dialogView.findViewById<SourceViewEditText>(R.id.source)
@@ -2145,8 +2144,6 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
21452144

21462145
unknownBlockSpanStart = text.getSpanStart(unknownHtmlSpan)
21472146
blockEditorDialog = builder.create()
2148-
@Suppress("DEPRECATION")
2149-
blockEditorDialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
21502147
blockEditorDialog?.show()
21512148
}
21522149

aztec/src/main/res/values/styles.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,7 @@
119119
<item name="android:layout_alignParentLeft">true</item>
120120
</style>
121121

122+
<style name="ResizableDialogTheme" parent="Theme.AppCompat.Dialog.Alert">
123+
<item name="android:windowSoftInputMode">adjustResize</item>
124+
</style>
122125
</resources>

0 commit comments

Comments
 (0)