|
|
@@ -18,7 +18,6 @@ import android.util.TypedValue;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
import android.view.ViewTreeObserver;
|
|
|
-import android.webkit.DownloadListener;
|
|
|
import android.webkit.WebView;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
@@ -1014,9 +1013,11 @@ public class CommonUtil {
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
.subscribe(observer);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 微信支付
|
|
|
* apk签名:c69316882eada62ae560c31076740400
|
|
|
+ *
|
|
|
* @param payInfo
|
|
|
*/
|
|
|
public void wxpay(IWXAPI api, final JSONObject payInfo) {
|
|
|
@@ -1725,7 +1726,7 @@ public class CommonUtil {
|
|
|
int fillCount = Math.min(5, count);//一屏的个数
|
|
|
|
|
|
int tabWidth = tabLayout.getWidth();
|
|
|
- if(tabWidth == 0){
|
|
|
+ if (tabWidth == 0) {
|
|
|
tabWidth = G.WIDTH;
|
|
|
}
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
@@ -2299,9 +2300,10 @@ public class CommonUtil {
|
|
|
*
|
|
|
* @param i -1:不限制 否者限制tag 个数
|
|
|
*/
|
|
|
- public void paintLineaLayout( GameEntity gameEntity, LinearLayout ll_game_tag, int i, int color, int drawable) {
|
|
|
- paintLineaLayout(gameEntity.getApp(),ll_game_tag, i, color, drawable);
|
|
|
+ public void paintLineaLayout(GameEntity gameEntity, LinearLayout ll_game_tag, int i, int color, int drawable) {
|
|
|
+ paintLineaLayout(gameEntity.getApp(), ll_game_tag, i, color, drawable);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* tag 标签绘制
|
|
|
* R.drawable.shape_blue_stroke_rectangle_no_lb
|
|
|
@@ -2309,7 +2311,7 @@ public class CommonUtil {
|
|
|
* @param i -1:不限制 否者限制tag 个数
|
|
|
*/
|
|
|
public void paintLineaLayout(Applications app, LinearLayout ll_game_tag, int i, int color, int drawable) {
|
|
|
- if(app == null){
|
|
|
+ if (app == null) {
|
|
|
ll_game_tag.removeAllViews();
|
|
|
return;
|
|
|
}
|
|
|
@@ -2371,7 +2373,7 @@ public class CommonUtil {
|
|
|
}
|
|
|
} else {
|
|
|
releaseEty.getDownloadHelper().updateDownloadTaskView(showSimpleText, taskEty, detail_task_tv_center, o -> {
|
|
|
- if(o instanceof Integer){//下载游戏时判断是否领取了任务
|
|
|
+ if (o instanceof Integer) {//下载游戏时判断是否领取了任务
|
|
|
CommonUtil.getInstance().receiveAward(gameEntity, new Action1<Integer>() {
|
|
|
@Override
|
|
|
public void call(Integer integer) {
|
|
|
@@ -2554,24 +2556,18 @@ public class CommonUtil {
|
|
|
|
|
|
//使webView支持下载文件
|
|
|
public void setDownloadListener(final Context context, WebView webView) {
|
|
|
- webView.setDownloadListener(new DownloadListener() {
|
|
|
- @Override
|
|
|
- public void onDownloadStart(final String url, String userAgent, String contentDisposition, String mimeType, long contentLength) {
|
|
|
- LogUtil.println("setDownloadListener", "setDownloadListener", "onDownloadStart", url, userAgent, contentDisposition, mimeType);
|
|
|
- showDownloadDialog(context, url);
|
|
|
- }
|
|
|
+ webView.setDownloadListener((url, userAgent, contentDisposition, mimeType, contentLength) -> {
|
|
|
+ LogUtil.println("setDownloadListener", "setDownloadListener", "onDownloadStart", url, userAgent, contentDisposition, mimeType);
|
|
|
+ showDownloadDialog(context, url);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//使webView支持下载文件
|
|
|
public void setDownloadListener(final Activity activity, com.tencent.smtt.sdk.WebView webView) {
|
|
|
- webView.setDownloadListener(new com.tencent.smtt.sdk.DownloadListener() {
|
|
|
- @Override
|
|
|
- public void onDownloadStart(final String url, String userAgent, String contentDisposition, String mimeType, long contentLength) {
|
|
|
- LogUtil.println("setDownloadListener", "setDownloadListener", "onDownloadStart", url, userAgent, contentDisposition, mimeType);
|
|
|
- showDownloadDialog(activity, url);
|
|
|
+ webView.setDownloadListener((url, userAgent, contentDisposition, mimeType, contentLength) -> {
|
|
|
+ LogUtil.println("setDownloadListener", "setDownloadListener", "onDownloadStart", url, userAgent, contentDisposition, mimeType);
|
|
|
+ showDownloadDialog(activity, url);
|
|
|
|
|
|
- }
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -2582,14 +2578,54 @@ public class CommonUtil {
|
|
|
final boolean exists = saveFile.exists();
|
|
|
ViewUtil.showMsgDialog(context, new DialogConfig().setTitle("下载提示")
|
|
|
.setMsg((exists ? "是否重新下载文件:" : "是否下载文件:") + saveFile.getAbsolutePath()).setBtnLeftText("取消下载").setBtnRightText("确认下载")
|
|
|
- .setBtnRightOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View view) {
|
|
|
- if (exists && saveFile.delete()) {
|
|
|
- LogUtil.println("setDownloadListener", "setDownloadListener", "onDownloadStart", url, saveFile.getAbsolutePath(), "成功删除原来的文件");
|
|
|
- }
|
|
|
- DownloadService.sysDownload(context, url, fileName, "来自小绵羊的下载:" + fileName, fileName, "系统开始下载apk");
|
|
|
+ .setBtnRightOnClickListener(view -> {
|
|
|
+ if (exists && saveFile.delete()) {
|
|
|
+ LogUtil.println("setDownloadListener", "setDownloadListener", "onDownloadStart", url, saveFile.getAbsolutePath(), "成功删除原来的文件");
|
|
|
}
|
|
|
+ DownloadService.sysDownload(context, url, fileName, "来自小绵羊的下载:" + fileName, fileName, "系统开始下载apk");
|
|
|
}));
|
|
|
}
|
|
|
+
|
|
|
+ //检查粘贴板
|
|
|
+ public void checkCopyText() {
|
|
|
+ boolean enableCheckCopyText = DataUtil.getAsBoolean(Config.KEY_ENABLE_CHECK_COPY_TEXT, Config.dvbEnableCheckCopyText());
|
|
|
+ if(!enableCheckCopyText){
|
|
|
+ LogUtil.println("checkCopyText", "closed");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ CharSequence text = StringUtils.getCopyText();
|
|
|
+ String used = DataUtil.getAsString(Config.KEY_USED_COPY_TEXT, null);
|
|
|
+ LogUtil.println("checkCopyText", "\ntext\t", text, "\nused\t", used);
|
|
|
+ if (!TextUtils.isEmpty(text) && !TextUtils.equals(text.toString(), used)) {//内容不为空时或者与上次记录的内容不相同时
|
|
|
+ String textString = text.toString();
|
|
|
+ View.OnClickListener closeListener = view -> DataUtil.putAsString(Config.KEY_USED_COPY_TEXT, textString);
|
|
|
+ DialogConfig dialogConfig = new DialogConfig().setTitle("小绵羊提示").setBtnCloseOnClickListener(closeListener);
|
|
|
+ if (textString.startsWith("http://") || textString.startsWith("https://")) {//如果是链接,直接跳转外部浏览器
|
|
|
+ dialogConfig.setMsg("已经复制如下内容:\n" + textString + "\n,是否访问该链接?")
|
|
|
+ .setBtnLeftText("仅一次").setBtnLeftOnClickListener(view -> {
|
|
|
+ closeListener.onClick(view);
|
|
|
+ Jump2View.getInstance().goWeb(SheepApp.getInstance().getCurrentActivity(), textString);
|
|
|
+ })
|
|
|
+ .setBtnRightText("确定").setBtnRightOnClickListener(view -> Jump2View.getInstance().goWeb(SheepApp.getInstance().getCurrentActivity(), textString));
|
|
|
+ ViewUtil.showMsgDialog(SheepApp.getInstance().getCurrentActivity(), dialogConfig);
|
|
|
+ } else if (textString.contains("://")) {
|
|
|
+ dialogConfig.setMsg("已经复制如下内容:\n" + textString + "\n,是否尝试跳转?")
|
|
|
+ .setBtnLeftText("仅一次").setBtnLeftOnClickListener(view -> {
|
|
|
+ closeListener.onClick(view);
|
|
|
+ Jump2View.getInstance().tryGotoDeepLink(textString);
|
|
|
+ })
|
|
|
+ .setBtnRightText("确定").setBtnRightOnClickListener(view -> Jump2View.getInstance().tryGotoDeepLink(textString));
|
|
|
+ ViewUtil.showMsgDialog(SheepApp.getInstance().getCurrentActivity(), dialogConfig);
|
|
|
+ } else if(TestUtil.isDev()){
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|