Commit ca76bcc9 authored by kenan's avatar kenan

Fix search of link

parent 8d1b81c3
...@@ -83,7 +83,7 @@ dependencies { ...@@ -83,7 +83,7 @@ dependencies {
implementation 'com.tubb.smrv:swipemenu-recyclerview:5.4.0' implementation 'com.tubb.smrv:swipemenu-recyclerview:5.4.0'
// //
implementation(name: 'libWindbot', ext: 'aar') implementation(name: 'libWindbot', ext: 'aar')
//mycardImplementation(name: 'xwalk_core_library-22.52.561.4', ext: 'aar')
implementation 'com.nightonke:boommenu:2.1.0' implementation 'com.nightonke:boommenu:2.1.0'
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
......
package cn.garymb.ygomobile.ui.plus;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.View;
import com.tencent.smtt.sdk.WebSettings;
import com.tencent.smtt.sdk.WebView;
import com.tencent.smtt.sdk.WebViewClient;
public class X5WebView extends WebView {
private WebViewClient client = new WebViewClient() {
/**
* 防止加载网页时调起系统浏览器
*/
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
};
@SuppressLint("SetJavaScriptEnabled")
public X5WebView(Context arg0, AttributeSet arg1) {
super(arg0, arg1);
this.setWebViewClient(client);
// this.setWebChromeClient(chromeClient);
// WebStorage webStorage = WebStorage.getInstance();
initWebViewSettings();
this.getView().setClickable(true);
}
private void initWebViewSettings() {
WebSettings webSetting = this.getSettings();
webSetting.setJavaScriptEnabled(true);
webSetting.setJavaScriptCanOpenWindowsAutomatically(true);
webSetting.setAllowFileAccess(true);
//webSetting.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
webSetting.setSupportZoom(true);
webSetting.setBuiltInZoomControls(true);
webSetting.setUseWideViewPort(true);
//禁止多窗口
webSetting.setSupportMultipleWindows(false);
// webSetting.setLoadWithOverviewMode(true);
webSetting.setAppCacheEnabled(true);
// webSetting.setDatabaseEnabled(true);
webSetting.setDomStorageEnabled(true);
webSetting.setGeolocationEnabled(true);
webSetting.setAppCacheMaxSize(Long.MAX_VALUE);
// webSetting.setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);
webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND);
// webSetting.setRenderPriority(WebSettings.RenderPriority.HIGH);
webSetting.setCacheMode(WebSettings.LOAD_NO_CACHE);
// this.getSettingsExtension().setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);//extension
// settings 的设计
webSetting.setSaveFormData(true);
webSetting.setDatabaseEnabled(true);
webSetting.setJavaScriptCanOpenWindowsAutomatically(true);
setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
setHorizontalScrollBarEnabled(false);
webSetting.setAllowContentAccess(true);
webSetting.setMixedContentMode(WebSettings.LOAD_NORMAL);
}
@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
/*boolean ret = super.drawChild(canvas, child, drawingTime);
canvas.save();
Paint paint = new Paint();
paint.setColor(0x7fff0000);
paint.setTextSize(24.f);
paint.setAntiAlias(true);
if (getX5WebViewExtension() != null) {
canvas.drawText(this.getContext().getPackageName() + "-pid:"
+ android.os.Process.myPid(), 10, 50, paint);
canvas.drawText(
"X5 Core:" + QbSdk.getTbsVersion(this.getContext()), 10,
100, paint);
} else {
canvas.drawText(this.getContext().getPackageName() + "-pid:"
+ android.os.Process.myPid(), 10, 50, paint);
canvas.drawText("Sys Core", 10, 100, paint);
}
canvas.drawText(Build.MANUFACTURER, 10, 150, paint);
canvas.drawText(Build.MODEL, 10, 200, paint);
canvas.restore();
return ret;*/
return super.drawChild(canvas,child,drawingTime);
}
public X5WebView(Context arg0) {
super(arg0);
setBackgroundColor(85621);
}
}
package cn.garymb.ygomobile.ui.plus;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.util.AttributeSet;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.DownloadListener;
import android.webkit.WebSettings;
import android.webkit.WebView;
public class XWebView extends WebView {
private Context context;
public XWebView(Context context) {
this(context, null);
}
public XWebView(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
init(context);
}
public XWebView(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs);
}
private void init(Context context) {
getSettings().setJavaScriptEnabled(true);
getSettings().setLoadsImagesAutomatically(true);
getSettings().setUseWideViewPort(true);
getSettings().setLoadWithOverviewMode(true);
getSettings().setSupportZoom(true);
getSettings().setDisplayZoomControls(false);
getSettings().setBuiltInZoomControls(true);
getSettings().setSupportMultipleWindows(false);
getSettings().setEnableSmoothTransition(true);
getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
}
public void enableHtml5() {
getSettings().setGeolocationEnabled(true);
getSettings().setPluginState(WebSettings.PluginState.ON_DEMAND);
getSettings().setSaveFormData(true);
getSettings().setSavePassword(true);
// HTML5 API flags
getSettings().setAppCacheEnabled(true);
getSettings().setDatabaseEnabled(true);
getSettings().setDomStorageEnabled(true);
// HTML5 configuration settings.
getSettings().setAppCacheMaxSize(Long.MAX_VALUE);
getSettings().setAppCachePath(context.getDir("appcache", Context.MODE_PRIVATE).getPath());
getSettings().setDatabasePath(context.getDir("databases", Context.MODE_PRIVATE).getPath());
getSettings().setGeolocationDatabasePath(context.getDir("geolocation", 0).getPath());
//
getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
setHorizontalScrollBarEnabled(false);
setHorizontalScrollbarOverlay(true);
getSettings().setAllowContentAccess(true);
getSettings().setAllowFileAccess(true);
CookieSyncManager.createInstance(context);
CookieManager.getInstance().setAcceptCookie(true);
if (Build.VERSION.SDK_INT >= 21) {
CookieManager.getInstance().setAcceptThirdPartyCookies(this, true);
getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
}
setDownloadListener(new DownloadListener() {
@Override
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype,
long contentLength) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
context.startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
}
});
setWebViewClient(new DefWebViewClient());
}
public void onDestroy() {
super.destroy();
}
public void onShow() {
super.onResume();
}
public void onHide() {
super.onPause();
}
}
...@@ -69,7 +69,7 @@ public class CardSearcher implements View.OnClickListener { ...@@ -69,7 +69,7 @@ public class CardSearcher implements View.OnClickListener {
protected LimitManager mLimitManager; protected LimitManager mLimitManager;
protected AppsSettings mSettings; protected AppsSettings mSettings;
final String[] BtnVals = new String[8]; final String[] BtnVals = new String[9];
int lineKey; int lineKey;
public CardSearcher(View view, ICardLoader dataLoader) { public CardSearcher(View view, ICardLoader dataLoader) {
...@@ -141,6 +141,28 @@ public class CardSearcher implements View.OnClickListener { ...@@ -141,6 +141,28 @@ public class CardSearcher implements View.OnClickListener {
R.id.button_8, R.id.button_8,
R.id.button_9, R.id.button_9,
}; };
int[] enImgs=new int[]{
R.drawable.left_bottom_1,
R.drawable.bottom_1,
R.drawable.right_bottom_1,
R.drawable.left_1,
0,
R.drawable.right_1,
R.drawable.left_top_1,
R.drawable.top_1,
R.drawable.right_top_1,
};
int[] disImgs=new int[]{
R.drawable.left_bottom_0,
R.drawable.bottom_0,
R.drawable.right_bottom_0,
R.drawable.left_0,
0,
R.drawable.right_0,
R.drawable.left_top_0,
R.drawable.top_0,
R.drawable.right_top_0,
};
for (int i = 0; i < ids.length; i++) { for (int i = 0; i < ids.length; i++) {
final int index = i; final int index = i;
viewDialog.findViewById(ids[index]).setOnClickListener((btn) -> { viewDialog.findViewById(ids[index]).setOnClickListener((btn) -> {
...@@ -148,13 +170,15 @@ public class CardSearcher implements View.OnClickListener { ...@@ -148,13 +170,15 @@ public class CardSearcher implements View.OnClickListener {
String mLinkStr = BtnVals[8] + BtnVals[7] + BtnVals[6] + BtnVals[5] + "0" String mLinkStr = BtnVals[8] + BtnVals[7] + BtnVals[6] + BtnVals[5] + "0"
+ BtnVals[3] + BtnVals[2] + BtnVals[1] + BtnVals[0]; + BtnVals[3] + BtnVals[2] + BtnVals[1] + BtnVals[0];
lineKey = Integer.parseInt(mLinkStr, 2); lineKey = Integer.parseInt(mLinkStr, 2);
builder.dismiss(); if(builder.isShowing()) {
builder.dismiss();
}
}else { }else {
if ("0".equals(BtnVals[index])) { if ("0".equals(BtnVals[index])) {
btn.setBackgroundResource(R.drawable.left_bottom_1); btn.setBackgroundResource(enImgs[index]);
BtnVals[index] = "1"; BtnVals[index] = "1";
} else { } else {
btn.setBackgroundResource(R.drawable.left_bottom_0); btn.setBackgroundResource(disImgs[index]);
BtnVals[index] = "0"; BtnVals[index] = "0";
} }
} }
......
...@@ -328,7 +328,11 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> { ...@@ -328,7 +328,11 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
public void checkWindbot() { public void checkWindbot() {
Log.i("路径", mContext.getFilesDir().getPath()); Log.i("路径", mContext.getFilesDir().getPath());
Log.i("路径2", mSettings.getDataBasePath() + "/" + DATABASE_NAME); Log.i("路径2", mSettings.getDataBasePath() + "/" + DATABASE_NAME);
WindBot.initAndroid(mContext.getFilesDir().getPath(), mSettings.getDataBasePath() + "/" + DATABASE_NAME); try {
WindBot.initAndroid(mContext.getFilesDir().getPath(), mSettings.getDataBasePath() + "/" + DATABASE_NAME);
}catch (Throwable e){
e.printStackTrace();
}
ResCheckTask.MessageReceiver mReceiver = new ResCheckTask.MessageReceiver(); ResCheckTask.MessageReceiver mReceiver = new ResCheckTask.MessageReceiver();
IntentFilter filter = new IntentFilter(); IntentFilter filter = new IntentFilter();
filter.addAction("RUN_WINDBOT"); filter.addAction("RUN_WINDBOT");
...@@ -346,8 +350,6 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> { ...@@ -346,8 +350,6 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
} }
} }
;
Handler han = new Handler() { Handler han = new Handler() {
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment