|
|
@@ -17,6 +17,7 @@ import android.view.MotionEvent;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
import android.view.WindowManager;
|
|
|
+import android.webkit.DownloadListener;
|
|
|
import android.webkit.WebChromeClient;
|
|
|
import android.webkit.WebSettings;
|
|
|
import android.webkit.WebView;
|
|
|
@@ -30,12 +31,14 @@ import com.sheep.gamegroup.event.BigEvent;
|
|
|
import com.sheep.gamegroup.greendao.download.DownLoadInfo;
|
|
|
import com.sheep.gamegroup.helper.TaskHelper;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
+import com.sheep.gamegroup.model.entity.DialogConfig;
|
|
|
import com.sheep.gamegroup.model.entity.FindApp;
|
|
|
import com.sheep.gamegroup.model.entity.FindItem;
|
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
import com.sheep.gamegroup.util.CommonUtil;
|
|
|
import com.sheep.gamegroup.util.DataUtil;
|
|
|
import com.sheep.gamegroup.util.DownloadUtil;
|
|
|
+import com.sheep.gamegroup.util.FileUtil;
|
|
|
import com.sheep.gamegroup.util.GlideImageLoader;
|
|
|
import com.sheep.gamegroup.util.Jump2View;
|
|
|
import com.sheep.gamegroup.util.ListUtil;
|
|
|
@@ -47,6 +50,7 @@ import com.sheep.gamegroup.util.ViewUtil;
|
|
|
import com.sheep.gamegroup.view.adapter.AdbCommonRecycler;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
+import com.sheep.jiuyan.samllsheep.service.DownloadService;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
|
|
|
@@ -55,6 +59,7 @@ import org.afinal.simplecache.ApiKey;
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
import org.greenrobot.eventbus.Subscribe;
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Locale;
|
|
|
@@ -68,6 +73,7 @@ import rx.schedulers.Schedulers;
|
|
|
import static android.content.Intent.ACTION_PACKAGE_ADDED;
|
|
|
import static android.content.Intent.ACTION_PACKAGE_REMOVED;
|
|
|
import static com.sheep.gamegroup.util.UMConfigUtils.Event.FIND_SHARE;
|
|
|
+import static com.sheep.jiuyan.samllsheep.utils.ClassFileHelper.DIR;
|
|
|
|
|
|
/**
|
|
|
* Created by realicing on 2018/5/10.
|
|
|
@@ -162,10 +168,6 @@ public class ActFindInformation extends BaseActivity implements Action1<Integer>
|
|
|
|
|
|
|
|
|
public void initWebView() {
|
|
|
-// getWindow().setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
|
|
|
-// WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
|
|
|
-
|
|
|
- WebChromeClient wvcc = new WebChromeClient();
|
|
|
WebSettings webSetting = webView.getSettings();
|
|
|
webSetting.setJavaScriptEnabled(true);
|
|
|
webSetting.setJavaScriptCanOpenWindowsAutomatically(true);
|
|
|
@@ -174,7 +176,8 @@ public class ActFindInformation extends BaseActivity implements Action1<Integer>
|
|
|
webSetting.setSupportZoom(true);
|
|
|
webSetting.setBuiltInZoomControls(true);
|
|
|
webSetting.setUseWideViewPort(true);
|
|
|
- webSetting.setSupportMultipleWindows(true);
|
|
|
+ //下面这行会影响setDownloadListener,暂时注释掉,等有空研究一下
|
|
|
+// webSetting.setSupportMultipleWindows(true);
|
|
|
webSetting.setAppCacheEnabled(true);
|
|
|
webSetting.setDatabaseEnabled(true);
|
|
|
webSetting.setDomStorageEnabled(true);
|
|
|
@@ -188,19 +191,6 @@ public class ActFindInformation extends BaseActivity implements Action1<Integer>
|
|
|
webSetting.setCacheMode(android.webkit.WebSettings.LOAD_DEFAULT);
|
|
|
webSetting.setLoadWithOverviewMode(true);
|
|
|
getWindow().setFormat(PixelFormat.TRANSLUCENT);
|
|
|
- webView.setWebChromeClient(wvcc);
|
|
|
- WebViewClient wvc = new WebViewClient() {
|
|
|
- @Override
|
|
|
- public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
|
|
- //Android8.0以下的需要返回true 并且需要loadUrl;8.0之后效果相反
|
|
|
- if (Build.VERSION.SDK_INT < 26) {
|
|
|
- webView.loadUrl(url);
|
|
|
- Jump2View.getInstance().goWeb(ActFindInformation.this, url);
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- };
|
|
|
webView.setWebChromeClient(new WebChromeClient() {
|
|
|
|
|
|
/**视频播放相关的方法*
|
|
|
@@ -229,7 +219,18 @@ public class ActFindInformation extends BaseActivity implements Action1<Integer>
|
|
|
super.onHideCustomView();
|
|
|
}
|
|
|
});
|
|
|
- webView.setWebViewClient(wvc);
|
|
|
+ webView.setWebViewClient(new WebViewClient() {
|
|
|
+ @Override
|
|
|
+ public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
|
|
+ LogUtil.println(getClass().getSimpleName(), "shouldOverrideUrlLoading", url);
|
|
|
+ //Android8.0以下的需要返回true 并且需要loadUrl;8.0之后效果相反
|
|
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ webView.loadUrl(url);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -332,17 +333,8 @@ public class ActFindInformation extends BaseActivity implements Action1<Integer>
|
|
|
|
|
|
webView = itemView.findViewById(R.id.find_information_content_wb);
|
|
|
initWebView();
|
|
|
-
|
|
|
-
|
|
|
+ CommonUtil.getInstance().setDownloadListener(ActFindInformation.this, webView);
|
|
|
ViewUtil.loadDataWithBaseURL(webView, findItem.getContent());
|
|
|
- LogUtil.logI("结果为——-----" + findItem.getContent());
|
|
|
- /* webView.setWebViewClient(new WebViewClient() {
|
|
|
- @Override
|
|
|
- public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
|
|
- Jump2View.getInstance().goWeb(ActFindInformation.this, url);
|
|
|
- return true;
|
|
|
- }
|
|
|
- });*/
|
|
|
|
|
|
|
|
|
}
|