| | |
| | | import android.app.Notification; |
| | | import android.app.NotificationChannel; |
| | | import android.app.NotificationManager; |
| | | import android.content.ClipData; |
| | | import android.content.DialogInterface; |
| | | import android.content.Intent; |
| | | import android.graphics.BitmapFactory; |
| | |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | | import android.view.ViewGroup; |
| | | import android.webkit.ValueCallback; |
| | | import android.widget.ProgressBar; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.ali.auth.third.ui.context.CallbackContext; |
| | | import com.lcjian.library.permission.PermissionHelper; |
| | | import com.lcjian.library.permission.PermissionInterface; |
| | | import com.lcjian.library.util.ManifestDataUtil; |
| | |
| | | import com.tencent.smtt.export.external.interfaces.WebResourceRequest; |
| | | import com.tencent.smtt.export.external.interfaces.WebResourceResponse; |
| | | import com.tencent.smtt.sdk.DownloadListener; |
| | | import com.tencent.smtt.sdk.QbSdk; |
| | | import com.tencent.smtt.sdk.WebChromeClient; |
| | | import com.tencent.smtt.sdk.WebSettings; |
| | | import com.tencent.smtt.sdk.WebView; |
| | | import com.tencent.smtt.sdk.WebViewClient; |
| | | import com.umeng.socialize.UMShareAPI; |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.ui.BaseActivity; |
| | | import com.weikou.beibeivideo.ui.media.VideoDetailActivity2; |
| | |
| | | private PermissionHelper mPermissionsChecker; // 权限检测器 检测是否有储存卡写入读取权限 |
| | | |
| | | private Set<String> webSpeedUpHost; |
| | | |
| | | private ValueCallback<Uri[]> uploadMessageAboveL; |
| | | int FILE_CHOOSER_RESULT_CODE = 20001; |
| | | |
| | | private WebResourceResponse replaceLocalResource(String url) throws IOException { |
| | | if (url == null) |
| | |
| | | Log.i(TAG, consoleMessage.message()); |
| | | return super.onConsoleMessage(consoleMessage); |
| | | } |
| | | |
| | | @Override |
| | | public boolean onShowFileChooser(WebView webView, com.tencent.smtt.sdk.ValueCallback<Uri[]> valueCallback, FileChooserParams fileChooserParams) { |
| | | uploadMessageAboveL = valueCallback; |
| | | openImageChooserActivity(); |
| | | return true; |
| | | } |
| | | |
| | | |
| | | }); |
| | | |
| | | |
| | | WebSettings webSetting = webview.getSettings(); |
| | | webSetting.setJavaScriptEnabled(true); |
| | | webSetting.setTextZoom(100); |
| | | webview.addJavascriptInterface(new BWJavaInterface(this, webview), "yestv"); |
| | | } |
| | | |
| | | |
| | | private void openImageChooserActivity() { |
| | | //调用自己的图库 |
| | | Intent i = new Intent(Intent.ACTION_GET_CONTENT); |
| | | i.addCategory(Intent.CATEGORY_OPENABLE); |
| | | i.setType("image/*"); |
| | | startActivityForResult(Intent.createChooser(i, "Image Chooser"), FILE_CHOOSER_RESULT_CODE); |
| | | } |
| | | |
| | | private boolean needSetResult = false; |
| | |
| | | super.onCreate(savedInstanceState); |
| | | getWindow().setFormat(PixelFormat.TRANSLUCENT); |
| | | setContentView(R.layout.browser_activity); |
| | | |
| | | TopStatusSettings.setStatusViewAndDeepColor(this); |
| | | tv_top_bar_left = findViewById(R.id.tv_top_bar_left); |
| | | tv_top_bar_left2 = findViewById(R.id.tv_top_bar_left2); |
| | |
| | | } |
| | | |
| | | @Override |
| | | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| | | CallbackContext.onActivityResult(requestCode, resultCode, data); |
| | | UMShareAPI.get(this).onActivityResult(requestCode, resultCode, data); |
| | | |
| | | if (requestCode == FILE_CHOOSER_RESULT_CODE) { //处理返回的图片,并进行上传 |
| | | if (null == uploadMessageAboveL) return; |
| | | Uri result = data == null || resultCode != RESULT_OK ? null : data.getData(); |
| | | if (uploadMessageAboveL != null) { |
| | | onActivityResultAboveL(requestCode, resultCode, data); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | private void onActivityResultAboveL(int requestCode, int resultCode, Intent intent) { |
| | | if (requestCode != FILE_CHOOSER_RESULT_CODE || uploadMessageAboveL == null) |
| | | return; |
| | | Uri[] results = null; |
| | | if (resultCode == Activity.RESULT_OK) { |
| | | if (intent != null) { |
| | | String dataString = intent.getDataString(); |
| | | ClipData clipData = intent.getClipData(); |
| | | if (clipData != null) { |
| | | results = new Uri[clipData.getItemCount()]; |
| | | for (int i = 0; i < clipData.getItemCount(); i++) { |
| | | ClipData.Item item = clipData.getItemAt(i); |
| | | results[i] = item.getUri(); |
| | | } |
| | | } |
| | | if (dataString != null) |
| | | results = new Uri[]{Uri.parse(dataString)}; |
| | | } |
| | | } |
| | | uploadMessageAboveL.onReceiveValue(results); |
| | | uploadMessageAboveL = null; |
| | | } |
| | | |
| | | @Override |
| | | public void onClick(View v) { |
| | | switch (v.getId()) { |
| | | case R.id.tv_top_bar_left: { |