mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-11-20 09:01:33 -08:00
Merge branch 'develop' into feature/Stream_Binaries
This commit is contained in:
commit
8e0fae62f3
4 files changed
+17
-6
No files matched your search
@@ -1,3 +1,6 @@
|
||||
KeepassDX (2.5.0.0beta26)
|
||||
* Fix crash when clearing clipboard
|
||||
|
||||
KeepassDX (2.5.0.0beta25)
|
||||
* Setting for Recycle Bin
|
||||
* Fix Recycle bin issues
|
||||
|
||||
@@ -37,10 +37,16 @@ import java.util.*
|
||||
|
||||
class ClipboardHelper(private val context: Context) {
|
||||
|
||||
private val clipboardManager: ClipboardManager =
|
||||
context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
private var mClipboardManager: ClipboardManager? = null
|
||||
|
||||
private val mTimer = Timer()
|
||||
|
||||
private fun getClipboardManager(): ClipboardManager? {
|
||||
if (mClipboardManager == null)
|
||||
mClipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager?
|
||||
return mClipboardManager
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun timeoutCopyToClipboard(text: String, toastString: String = "") {
|
||||
if (toastString.isNotEmpty())
|
||||
@@ -64,8 +70,8 @@ class ClipboardHelper(private val context: Context) {
|
||||
}
|
||||
|
||||
fun getClipboard(context: Context): CharSequence {
|
||||
if (clipboardManager.hasPrimaryClip()) {
|
||||
val data = clipboardManager.primaryClip
|
||||
if (getClipboardManager()?.hasPrimaryClip() == true) {
|
||||
val data = getClipboardManager()?.primaryClip
|
||||
if (data!!.itemCount > 0) {
|
||||
val text = data.getItemAt(0).coerceToText(context)
|
||||
if (text != null) {
|
||||
@@ -84,7 +90,7 @@ class ClipboardHelper(private val context: Context) {
|
||||
@Throws(ClipboardException::class)
|
||||
fun copyToClipboard(label: String, value: String) {
|
||||
try {
|
||||
clipboardManager.primaryClip = ClipData.newPlainText(label, value)
|
||||
getClipboardManager()?.primaryClip = ClipData.newPlainText(label, value)
|
||||
} catch (e: Exception) {
|
||||
throw ClipboardException(e)
|
||||
}
|
||||
@@ -95,7 +101,7 @@ class ClipboardHelper(private val context: Context) {
|
||||
@JvmOverloads
|
||||
fun cleanClipboard(label: String = "") {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
clipboardManager.clearPrimaryClip()
|
||||
getClipboardManager()?.clearPrimaryClip()
|
||||
} else {
|
||||
copyToClipboard(label, "")
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
* Fix crash when clearing clipboard
|
||||
@@ -0,0 +1 @@
|
||||
* Correction du crash pendant le vidage du presse-papiers
|
||||
Reference in new issue
Block a user