Skip to content

Commit c6e555b

Browse files
committed
Resolve "Val cannot be reassigned" for primaryClip
"primaryClip" was converted to val after API 28.
1 parent cf421f2 commit c6e555b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,8 +1926,8 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
19261926

19271927
val html = Format.removeSourceEditorFormatting(parser.toHtml(output), isInCalypsoMode, isInGutenbergMode)
19281928

1929-
val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as android.content.ClipboardManager
1930-
clipboard.primaryClip = ClipData.newHtmlText("aztec", output.toString(), html)
1929+
val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
1930+
clipboard.setPrimaryClip(ClipData.newHtmlText("aztec", output.toString(), html))
19311931
}
19321932

19331933
// copied from TextView with some changes

aztec/src/test/kotlin/org/wordpress/aztec/ClipboardTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ class ClipboardTest {
346346

347347
editText.setSelection(0)
348348
val clipboard = editText.context.getSystemService(Context.CLIPBOARD_SERVICE) as android.content.ClipboardManager
349-
clipboard.primaryClip = ClipData.newPlainText("aztec", "Heading")
349+
clipboard.setPrimaryClip(ClipData.newPlainText("aztec", "Heading"))
350350

351351
TestUtils.pasteFromClipboard(editText)
352352

0 commit comments

Comments
 (0)