|
@@ -14,6 +14,7 @@ import android.support.design.widget.TabLayout;
|
|
|
import android.support.v7.app.AlertDialog;
|
|
import android.support.v7.app.AlertDialog;
|
|
|
import android.text.Html;
|
|
import android.text.Html;
|
|
|
import android.text.TextUtils;
|
|
import android.text.TextUtils;
|
|
|
|
|
+import android.util.Patterns;
|
|
|
import android.util.TypedValue;
|
|
import android.util.TypedValue;
|
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewGroup;
|
|
@@ -103,6 +104,7 @@ import java.util.List;
|
|
|
import java.util.Locale;
|
|
import java.util.Locale;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
import java.util.Set;
|
|
|
|
|
+import java.util.regex.Matcher;
|
|
|
|
|
|
|
|
import io.reactivex.Observable;
|
|
import io.reactivex.Observable;
|
|
|
import io.reactivex.ObservableEmitter;
|
|
import io.reactivex.ObservableEmitter;
|
|
@@ -2600,14 +2602,9 @@ 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);
|
|
|
- if (textString.startsWith("http://") || textString.startsWith("https://")) {//如果是链接,直接跳转外部浏览器
|
|
|
|
|
- dialogConfig.setMsg("已经复制如下内容:\n" + textString + "\n,是否访问该链接?")
|
|
|
|
|
- .setBtnLeftText("确定").setBtnLeftOnClickListener(view -> Jump2View.getInstance().goWeb(SheepApp.getInstance().getCurrentActivity(), textString))
|
|
|
|
|
- .setBtnRightText("仅一次").setBtnRightOnClickListener(view -> {
|
|
|
|
|
- closeListener.onClick(view);
|
|
|
|
|
- Jump2View.getInstance().goWeb(SheepApp.getInstance().getCurrentActivity(), textString);
|
|
|
|
|
- });
|
|
|
|
|
- ViewUtil.showMsgDialog(SheepApp.getInstance().getCurrentActivity(), dialogConfig);
|
|
|
|
|
|
|
+ Matcher matcher = Patterns.WEB_URL.matcher(text);
|
|
|
|
|
+ if (matcher.find()) {//如果是链接,直接跳转外部浏览器
|
|
|
|
|
+ shoGoWebDialog(dialogConfig, closeListener, textString, matcher.group());
|
|
|
} else if (textString.contains("://")) {
|
|
} else if (textString.contains("://")) {
|
|
|
dialogConfig.setMsg("已经复制如下内容:\n" + textString + "\n,是否尝试跳转?")
|
|
dialogConfig.setMsg("已经复制如下内容:\n" + textString + "\n,是否尝试跳转?")
|
|
|
.setBtnLeftText("确定").setBtnLeftOnClickListener(view -> Jump2View.getInstance().tryGotoDeepLink(textString))
|
|
.setBtnLeftText("确定").setBtnLeftOnClickListener(view -> Jump2View.getInstance().tryGotoDeepLink(textString))
|
|
@@ -2630,4 +2627,14 @@ public class CommonUtil {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private void shoGoWebDialog(DialogConfig dialogConfig, View.OnClickListener closeListener, String textString, String url) {
|
|
|
|
|
+ dialogConfig.setMsg("已经复制如下内容:\n" + textString + "\n,是否访问该链接?")
|
|
|
|
|
+ .setBtnLeftText("确定").setBtnLeftOnClickListener(view -> Jump2View.getInstance().goWeb(SheepApp.getInstance().getCurrentActivity(), url))
|
|
|
|
|
+ .setBtnRightText("仅一次").setBtnRightOnClickListener(view -> {
|
|
|
|
|
+ closeListener.onClick(view);
|
|
|
|
|
+ Jump2View.getInstance().goWeb(SheepApp.getInstance().getCurrentActivity(), url);
|
|
|
|
|
+ });
|
|
|
|
|
+ ViewUtil.showMsgDialog(SheepApp.getInstance().getCurrentActivity(), dialogConfig);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|