| | |
| | | import android.view.ViewGroup; |
| | | import android.webkit.DownloadListener; |
| | | import android.webkit.SslErrorHandler; |
| | | import android.webkit.WebChromeClient; |
| | | import android.webkit.WebSettings; |
| | | import android.webkit.WebView; |
| | | import android.webkit.WebViewClient; |
| | |
| | | |
| | | import com.lcjian.library.util.ManifestDataUtil; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.ui.BaseActivity; |
| | | import com.weikou.beibeivideo.ui.media.VideoDetailActivity; |
| | | import com.weikou.beibeivideo.util.downutil.DownFiles; |
| | | import com.weikou.beibeivideo.util.downutil.DownFiles.IProgress; |
| | | import com.weikou.beibeivideo.widget.CustomWebView; |
| | | import com.yeshi.buwanshequ.R; |
| | | |
| | | public class FXBrowserActivity extends BaseActivity implements OnClickListener { |
| | | |
| | | private TextView tv_top_bar_left; |
| | | private TextView tv_top_bar_left2; |
| | | private TextView tv_top_bar_middle; |
| | | private TextView tv_top_bar_right; |
| | | private TextView tv_url; |
| | | private TextView tv_title; |
| | | private TextView tv_right; |
| | | private CustomWebView webview; |
| | | private FrameLayout fl_webview, fl_full_play; |
| | | ProgressBar progressBar; |
| | |
| | | findViewById(R.id.v_status_bar).setVisibility(View.GONE); |
| | | } |
| | | |
| | | // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { |
| | | // SystemBarTintManager tintManager = new SystemBarTintManager(this); |
| | | // tintManager.setStatusBarTintEnabled(true); |
| | | // //此处可以重新指定状态栏颜色 |
| | | // tintManager.setStatusBarTintResource(R.color.blue1); |
| | | // } |
| | | tv_top_bar_left = findViewById(R.id.tv_top_bar_left); |
| | | tv_url = findViewById(R.id.tv_url); |
| | | tv_title = findViewById(R.id.tv_title); |
| | | tv_right = findViewById(R.id.tv_right); |
| | | tv_right.setOnClickListener(this); |
| | | |
| | | tv_top_bar_left = (TextView) findViewById(R.id.tv_top_bar_left); |
| | | tv_top_bar_left2 = (TextView) findViewById(R.id.tv_top_bar_left2); |
| | | tv_top_bar_left2.setVisibility(View.VISIBLE); |
| | | tv_top_bar_middle = (TextView) findViewById(R.id.tv_top_bar_middle); |
| | | tv_top_bar_right = (TextView) findViewById(R.id.tv_top_bar_right); |
| | | fl_webview = (FrameLayout) findViewById(R.id.fl_webview); |
| | | fl_full_play = (FrameLayout) findViewById(R.id.fl_full_play); |
| | | tv_top_bar_left2.setText("关闭"); |
| | | tv_top_bar_right.setText("横屏"); |
| | | tv_top_bar_right.setOnClickListener(this); |
| | | |
| | | fl_webview = findViewById(R.id.fl_webview); |
| | | fl_full_play = findViewById(R.id.fl_full_play); |
| | | tv_top_bar_left.setOnClickListener(this); |
| | | tv_top_bar_left2.setOnClickListener(this); |
| | | tv_top_bar_right.setOnClickListener(this); |
| | | webview = new CustomWebView(FXBrowserActivity.this); |
| | | fl_webview.addView(webview, new FrameLayout.LayoutParams( |
| | | FrameLayout.LayoutParams.MATCH_PARENT, |
| | |
| | | webview.setWebViewClient(new WebViewClient() { |
| | | @Override |
| | | public boolean shouldOverrideUrlLoading(WebView view, String url) { |
| | | // Toast.makeText(FXBrowserActivity.this, "请求路劲----" + url, Toast.LENGTH_LONG).show(); |
| | | if (url != null && url.startsWith("buwanprotocol://")) { |
| | | String murl = url.split("buwanprotocol://")[1]; |
| | | String[] params = murl.split("#"); |
| | |
| | | return true; |
| | | } |
| | | return super.shouldOverrideUrlLoading(view, url); |
| | | // return true; |
| | | } |
| | | |
| | | // @Override |
| | | // public WebResourceResponse shouldInterceptRequest(WebView view, String url) { |
| | | // if (url != null && (url.startsWith("tbopen://") || url.contains("intent"))) { |
| | | // url = ""; |
| | | // Toast.makeText(FXBrowserActivity.this, "请求路劲----" + url, Toast.LENGTH_LONG).show(); |
| | | // } |
| | | // return super.shouldInterceptRequest(view, url); |
| | | // } |
| | | |
| | | @Override |
| | | public void onPageFinished(WebView webView, String s) { |
| | |
| | | handler.proceed(); |
| | | } |
| | | }); |
| | | progressBar = (ProgressBar) findViewById(R.id.myProgressBar); |
| | | |
| | | webview.setWebChromeClient(new WebChromeClient() { |
| | | @Override |
| | | public void onReceivedTitle(WebView view, String title) { |
| | | super.onReceivedTitle(view, title); |
| | | tv_title.setText(title); |
| | | } |
| | | }); |
| | | progressBar = findViewById(R.id.myProgressBar); |
| | | progressBar.setMax(100); |
| | | progressBar.setProgressDrawable(this.getResources() |
| | | .getDrawable(R.drawable.color_progressbar)); |
| | |
| | | super.handleMessage(msg); |
| | | String url = getIntent().getStringExtra("url"); |
| | | webview.loadUrl(url); |
| | | tv_url.setText(url); |
| | | } |
| | | }; |
| | | |
| | |
| | | mChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}); |
| | | manager.createNotificationChannel(mChannel); |
| | | oBuilder = new Notification.Builder(FXBrowserActivity.this, id); |
| | | oBuilder.setContentTitle("布丸影视大全") |
| | | oBuilder.setContentTitle("影视大全") |
| | | .setSmallIcon(R.drawable.ic_launcher) |
| | | .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher)) |
| | | .setContentText("热门应用下载") |
| | |
| | | .build(); |
| | | } else { |
| | | builder = new NotificationCompat.Builder(FXBrowserActivity.this); |
| | | builder.setContentTitle("布丸影视大全") |
| | | builder.setContentTitle("影视大全") |
| | | .setContentText("热门应用下载") |
| | | .setSmallIcon(R.drawable.ic_launcher) |
| | | .setOngoing(true);//无效 |
| | |
| | | finish(); |
| | | } |
| | | break; |
| | | case R.id.tv_top_bar_right: { |
| | | case R.id.tv_right: { |
| | | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); |
| | | findViewById(R.id.v_status_bar).setVisibility(View.GONE); |
| | | findViewById(R.id.top).setVisibility(View.GONE); |