adding a null check
This commit is contained in:
parent
febd62164d
commit
d2c3116173
|
@ -65,7 +65,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:d5a26c4d27'
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:d1ed742806'
|
||||
implementation 'androidx.emoji2:emoji2-bundled:1.2.0'
|
||||
|
||||
kapt 'androidx.room:room-compiler:2.5.1'
|
||||
|
|
|
@ -749,12 +749,12 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||
}
|
||||
|
||||
private fun clearClipboardContent() {
|
||||
val clipboardManager = (context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager)
|
||||
val clipboardManager = (context.getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager)
|
||||
if (isPiePlus()) {
|
||||
clipboardManager.clearPrimaryClip()
|
||||
clipboardManager?.clearPrimaryClip()
|
||||
} else {
|
||||
val clip = ClipData.newPlainText("", "")
|
||||
clipboardManager.setPrimaryClip(clip)
|
||||
clipboardManager?.setPrimaryClip(clip)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue