|
@@ -2602,17 +2602,20 @@ public class CommonUtil {
|
|
|
String textString = text.toString();
|
|
String textString = text.toString();
|
|
|
View.OnClickListener closeListener = view -> DataUtil.putAsString(Config.KEY_USED_COPY_TEXT, textString);
|
|
View.OnClickListener closeListener = view -> DataUtil.putAsString(Config.KEY_USED_COPY_TEXT, textString);
|
|
|
DialogConfig dialogConfig = new DialogConfig().setTitle("小绵羊提示").setBtnCloseOnClickListener(closeListener);
|
|
DialogConfig dialogConfig = new DialogConfig().setTitle("小绵羊提示").setBtnCloseOnClickListener(closeListener);
|
|
|
- Matcher matcher = Patterns.WEB_URL.matcher(text);
|
|
|
|
|
- if (matcher.find()) {//如果是链接,直接跳转外部浏览器
|
|
|
|
|
- shoGoWebDialog(dialogConfig, closeListener, textString, matcher.group());
|
|
|
|
|
- } else if (textString.contains("://")) {
|
|
|
|
|
- dialogConfig.setMsg("已经复制如下内容:\n" + textString + "\n,是否尝试跳转?")
|
|
|
|
|
- .setBtnLeftText("确定").setBtnLeftOnClickListener(view -> Jump2View.getInstance().tryGotoDeepLink(textString))
|
|
|
|
|
- .setBtnRightText("仅一次").setBtnRightOnClickListener(view -> {
|
|
|
|
|
- closeListener.onClick(view);
|
|
|
|
|
- Jump2View.getInstance().tryGotoDeepLink(textString);
|
|
|
|
|
- });
|
|
|
|
|
- ViewUtil.showMsgDialog(SheepApp.getInstance().getCurrentActivity(), dialogConfig);
|
|
|
|
|
|
|
+ String url;
|
|
|
|
|
+ if ((url = StringUtils.findUrl(text)) != null) {//如果是链接,直接跳转外部浏览器
|
|
|
|
|
+ LogUtil.println("checkCopyText", url);
|
|
|
|
|
+ if(StringUtils.isHttpUrl(url)) {
|
|
|
|
|
+ showGoWebDialog(dialogConfig, closeListener, textString, url);
|
|
|
|
|
+ } else{
|
|
|
|
|
+ dialogConfig.setMsg("已经复制如下内容:\n" + textString + "\n,是否尝试跳转?")
|
|
|
|
|
+ .setBtnLeftText("确定").setBtnLeftOnClickListener(view -> Jump2View.getInstance().tryGotoDeepLink(textString))
|
|
|
|
|
+ .setBtnRightText("仅一次").setBtnRightOnClickListener(view -> {
|
|
|
|
|
+ closeListener.onClick(view);
|
|
|
|
|
+ Jump2View.getInstance().tryGotoDeepLink(textString);
|
|
|
|
|
+ });
|
|
|
|
|
+ ViewUtil.showMsgDialog(SheepApp.getInstance().getCurrentActivity(), dialogConfig);
|
|
|
|
|
+ }
|
|
|
} else if (TestUtil.isDev()) {
|
|
} else if (TestUtil.isDev()) {
|
|
|
TestUtil.testFunction(SheepApp.getInstance().getCurrentActivity(), textString);
|
|
TestUtil.testFunction(SheepApp.getInstance().getCurrentActivity(), textString);
|
|
|
// } else {
|
|
// } else {
|
|
@@ -2628,7 +2631,10 @@ public class CommonUtil {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void shoGoWebDialog(DialogConfig dialogConfig, View.OnClickListener closeListener, String textString, String url) {
|
|
|
|
|
|
|
+ private void showGoWebDialog(DialogConfig dialogConfig, View.OnClickListener closeListener, String textString, String url) {
|
|
|
|
|
+ if(checkShouYouShare(closeListener, url)){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
dialogConfig.setMsg("已经复制如下内容:\n" + textString + "\n,是否访问该链接?")
|
|
dialogConfig.setMsg("已经复制如下内容:\n" + textString + "\n,是否访问该链接?")
|
|
|
.setBtnLeftText("确定").setBtnLeftOnClickListener(view -> Jump2View.getInstance().goWeb(SheepApp.getInstance().getCurrentActivity(), url))
|
|
.setBtnLeftText("确定").setBtnLeftOnClickListener(view -> Jump2View.getInstance().goWeb(SheepApp.getInstance().getCurrentActivity(), url))
|
|
|
.setBtnRightText("仅一次").setBtnRightOnClickListener(view -> {
|
|
.setBtnRightText("仅一次").setBtnRightOnClickListener(view -> {
|
|
@@ -2637,4 +2643,29 @@ public class CommonUtil {
|
|
|
});
|
|
});
|
|
|
ViewUtil.showMsgDialog(SheepApp.getInstance().getCurrentActivity(), dialogConfig);
|
|
ViewUtil.showMsgDialog(SheepApp.getInstance().getCurrentActivity(), dialogConfig);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private boolean checkShouYouShare(View.OnClickListener closeListener, String url) {
|
|
|
|
|
+ if(url.contains("/shou_you_share/index.html")) {
|
|
|
|
|
+ String gameId = StringUtils.getQueryParameter(url, "game_id");
|
|
|
|
|
+ if(!TextUtils.isEmpty(gameId)){
|
|
|
|
|
+ SheepApp.getInstance().getNetComponent().getApiService().getAppId(gameId)//http://10.8.220.229:8800/shou_you_share/index.html?invitation_code=12799442&game_id=1553
|
|
|
|
|
+ .subscribeOn(Schedulers.io())
|
|
|
|
|
+ .observeOn(AndroidSchedulers.mainThread())
|
|
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onNext(BaseMessage baseMessage) {
|
|
|
|
|
+ Applications applications = baseMessage.getData(Applications.class);
|
|
|
|
|
+ ViewUtil.showGameDialog(applications, closeListener);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
|
|
+ G.showToast(baseMessage);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|