Quellcode durchsuchen

add pop short link address feature

billyyoyo vor 5 Jahren
Ursprung
Commit
9b509a83a5

+ 7 - 11
app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java

@@ -3125,8 +3125,11 @@ public class CommonUtil {
             String url;
             if ((url = StringUtils.findUrl(text)) != null) {//如果是链接,直接跳转外部浏览器
                 LogUtil.println("checkCopyText", url);
-                if (StringUtils.isHttpUrl(url)) {
-                    showGoWebDialog(dialogConfig, closeListener, textString, url);
+                if (url.startsWith("http://9yan.io")) {
+                    dialogConfig.setMsg("将跳转:" + url + "\n您确定吗?")
+                            .setBtnLeftText("确定").setBtnLeftOnClickListener(view -> Jump2View.getInstance().goWeb(SheepApp.getInstance().getCurrentActivity(), url, SheepApp.getInstance().getString(R.string.app_name)))
+                            .setBtnRightText("取消").setBtnRightOnClickListener(view -> closeListener.onClick(view));
+                    ViewUtil.showMsgDialog(SheepApp.getInstance().getCurrentActivity(), dialogConfig);
                 } else if (TestUtil.isTest()) {//下面的功能暂不提供给用户
                     dialogConfig.setMsg("已经复制如下内容:\n" + textString + "\n,是否尝试跳转?")
                             .setBtnLeftText("确定").setBtnLeftOnClickListener(view -> Jump2View.getInstance().tryGotoDeepLink(textString))
@@ -3135,18 +3138,11 @@ public class CommonUtil {
                         Jump2View.getInstance().tryGotoDeepLink(textString);
                     });
                     ViewUtil.showMsgDialog(SheepApp.getInstance().getCurrentActivity(), dialogConfig);
+                } else if (StringUtils.isHttpUrl(url)) {
+                    showGoWebDialog(dialogConfig, closeListener, textString, url);
                 }
             } else if (TestUtil.isDev()) {
                 TestUtil.testFunction(SheepApp.getInstance().getCurrentActivity(), textString);
-//            } else {
-//                String msg = textString.length() > 100 ? textString.substring(0, 100) + "..." : textString;
-//                dialogConfig.setMsg("已经复制如下内容:\n" + msg + "\n,是否查看详情?")
-//                        .setBtnLeftText("仅一次").setBtnLeftOnClickListener(view -> {
-//                    closeListener.onClick(view);
-//                    Jump2View.getInstance().goLoadH5(SheepApp.getInstance().getCurrentActivity(), "来自粘贴板", textString);
-//                })
-//                        .setBtnRightText("确定").setBtnRightOnClickListener(view -> Jump2View.getInstance().goLoadH5(SheepApp.getInstance().getCurrentActivity(), "来自粘贴板", textString));
-//                ViewUtil.showMsgDialog(SheepApp.getInstance().getCurrentActivity(), dialogConfig);
             }
         }
     }

+ 3 - 1
app/src/main/java/com/sheep/gamegroup/util/StringUtils.java

@@ -414,7 +414,9 @@ public class StringUtils {
             ClipData clipData = clipboard.getPrimaryClip();
             if (clipData != null && clipData.getItemCount() > 0) {
                 // 从数据集中获取(粘贴)第一条文本数据
-                return clipData.getItemAt(0).getText();
+                CharSequence text = clipData.getItemAt(0).getText();
+                clipboard.setPrimaryClip(ClipData.newPlainText("", ""));
+                return text;
             }
         }
         return null;