From 6b3ecf37da4bf8706494aa25008ed37e888b1d15 Mon Sep 17 00:00:00 2001 From: HuanCheng65 <609486518@qq.com> Date: Fri, 3 Jun 2022 20:57:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=97=AA=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/huanchengfly/tieba/post/BaseApplication.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/huanchengfly/tieba/post/BaseApplication.kt b/app/src/main/java/com/huanchengfly/tieba/post/BaseApplication.kt index 9336095e..e86347f6 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/BaseApplication.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/BaseApplication.kt @@ -145,11 +145,12 @@ class BaseApplication : Application(), IApp { } override fun onActivityResumed(activity: Activity) { - if (clipBoardHash != getClipBoardHash()) { + val clipBoardText = clipBoard + if (clipBoardHash != getClipBoardHash() && clipBoardText != null) { @RegExp val regex = "((http|https)://)(([a-zA-Z0-9._-]+\\.[a-zA-Z]{2,6})|([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}))(:[0-9]{1,4})*(/[a-zA-Z0-9&%_./-~-]*)?" val pattern = Pattern.compile(regex) - val matcher = pattern.matcher(clipBoard) + val matcher = pattern.matcher(clipBoardText) if (matcher.find()) { val url = matcher.group() val uri = Uri.parse(url)