diff --git a/app.apk b/app.apk index d469710..3515ff2 100644 Binary files a/app.apk and b/app.apk differ diff --git a/main/AndroidManifest.xml b/main/AndroidManifest.xml index 20365d0..7a871dd 100644 --- a/main/AndroidManifest.xml +++ b/main/AndroidManifest.xml @@ -2,7 +2,7 @@ + android:versionName="4.19"> - - - - - - - + + + + -


海天鹰浏览器 V4.17

+


海天鹰浏览器 V4.18

内置扩展的浏览器。

扩展:链接关键字过滤,链接关键字高亮,图片自定义过滤,视频独立播放。

作者:海天鹰

@@ -23,6 +23,8 @@ p { text-indent:2em; }

获取网页图标

字符串转Bitmap

更新日志:

+

V4.19 (2021-06-27)

  1. 增加请求电脑版网页。
+

V4.18 (2021-06-01)

  1. 增加动态权限请求。

V4.17 (2021-03-02)

  1. 允许HTTPS、HTTP混合内容,解决微信网页视频无法播放的问题。

V4.16 (2020-10-14)

  1. 取消引起崩溃的复制图片。

V4.15 (2020-10-01)

  1. 优化猜测下载文件名。
diff --git a/main/java/com/hty/browser/MainActivity.java b/main/java/com/hty/browser/MainActivity.java index 7db489e..3144ae8 100644 --- a/main/java/com/hty/browser/MainActivity.java +++ b/main/java/com/hty/browser/MainActivity.java @@ -21,6 +21,7 @@ import java.util.Arrays; import java.util.Date; import java.util.List; +import android.Manifest; import android.app.Activity; import android.app.AlertDialog; import android.app.DownloadManager; @@ -103,7 +104,6 @@ public class MainActivity extends Activity { TextView textView_searchCount, textView_filesize; EditText editText_url, editText_search, editText_download_path; ImageButton button_back, button_forward, button_menu, button_go, button_search_prev, button_search_next, button_search_close, button_info, button_play; - // RelativeLayout RelativeLayout1; LinearLayout LinearLayout1, LinearLayout2; FrameLayout webViewLayout, videoLayout, searchBar; InputMethodManager IMM; @@ -121,10 +121,21 @@ public class MainActivity extends Activity { int currentPage; int FILECHOOSER_DOWNLOAD_PATH = 3; DownloadCompleteReceiver receiver; + private static String[] PERMISSIONS = { + Manifest.permission.READ_EXTERNAL_STORAGE, + Manifest.permission.WRITE_EXTERNAL_STORAGE }; + private static int REQUEST_PERMISSION_CODE = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + //Log.e(Thread.currentThread().getStackTrace()[2] + "", "checkSelfPermission: " + checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)); + if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED && checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { + requestPermissions(PERMISSIONS, REQUEST_PERMISSION_CODE); + } + } + sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); IMM = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE); String path = Environment.getExternalStorageDirectory().getPath() + File.separator + "HTYBrowser"; @@ -132,33 +143,17 @@ public class MainActivity extends Activity { if (!dir.exists()) { dir.mkdirs(); } + setContentView(R.layout.activity_main); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); LinearLayout1 = (LinearLayout) findViewById(R.id.LinearLayout1); LinearLayout2 = (LinearLayout) findViewById(R.id.LinearLayout2); - // RelativeLayout1 = (RelativeLayout) findViewById(R.id.RelativeLayout1); webViewLayout = (FrameLayout) findViewById(R.id.webViewLayout); videoLayout = (FrameLayout) findViewById(R.id.videoLayout); searchBar = (FrameLayout) findViewById(R.id.searchBar); searchBar.setVisibility(View.GONE); pgb1 = (ProgressBar) findViewById(R.id.progressBar1); - // if (VERSION.SDK_INT > 18) { - // getWindow().addFlags( - // WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); - // getWindow().addFlags( - // WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); - // LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) - // LinearLayout1 - // .getLayoutParams(); - // lp.topMargin = 45; - // LinearLayout1.setLayoutParams(lp); - // // RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) - // // RelativeLayout1 - // // .getLayoutParams(); - // // lp.topMargin = 45; - // // RelativeLayout1.setLayoutParams(lp); - // } button_go = (ImageButton) findViewById(R.id.button_go); button_back = (ImageButton) findViewById(R.id.button_back); button_forward = (ImageButton) findViewById(R.id.button_forward); @@ -1177,12 +1172,12 @@ public class MainActivity extends Activity { long downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1); Log.e(Thread.currentThread().getStackTrace()[2] + "", downloadId + ""); DownloadManager downloadManager = (DownloadManager) context.getSystemService(DOWNLOAD_SERVICE); - if(downloadId == downloadIdUpdate){ + if (downloadId == downloadIdUpdate) { Uri uri = downloadManager.getUriForDownloadedFile(downloadId); Log.e(Thread.currentThread().getStackTrace()[2] + "", uri.toString()); - Intent intentn = new Intent(Intent.ACTION_VIEW); - intentn.setDataAndType(uri, "application/vnd.android.package-archive"); - startActivity(intentn); + Intent intent1 = new Intent(Intent.ACTION_VIEW); + intent1.setDataAndType(uri, "application/vnd.android.package-archive"); + startActivity(intent1); } } } @@ -1203,7 +1198,9 @@ public class MainActivity extends Activity { void settingWebView(WebView webView) { registerForContextMenu(webView); // 注册菜单 webView.requestFocusFromTouch(); // 请求触摸焦点 - webView.setWebContentsDebuggingEnabled(true); // 允许调试 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + webView.setWebContentsDebuggingEnabled(true); // 允许调试 + } WebSettings webSettings = webView.getSettings(); webSettings.setJavaScriptEnabled(true); // 开启JS @@ -1224,6 +1221,9 @@ public class MainActivity extends Activity { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); // 允许HTTPS、HTTP混合内容 } + if (sharedPreferences.getBoolean("switch_pcmode", false)) { + webSettings.setUserAgentString("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36"); + } webView.setWebViewClient(new WebViewClient() { @Override diff --git a/main/java/com/hty/browser/SettingsActivity.java b/main/java/com/hty/browser/SettingsActivity.java index 126c351..14629ce 100644 --- a/main/java/com/hty/browser/SettingsActivity.java +++ b/main/java/com/hty/browser/SettingsActivity.java @@ -23,8 +23,8 @@ public class SettingsActivity extends PreferenceActivity implements OnSharedPref SP.registerOnSharedPreferenceChangeListener(this); } - @Override // 启动时显示 + @Override protected void onResume() { super.onResume(); ETP_homepage.setSummary(SP.getString("homepage", "http://www.baidu.com")); @@ -32,8 +32,8 @@ public class SettingsActivity extends PreferenceActivity implements OnSharedPref ETP_highlight.setSummary(SP.getString("highlight", "")); } - @Override // 修改后显示 + @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Log.e(Thread.currentThread().getStackTrace()[2] + "", key); if (key.equals("homepage")) { diff --git a/main/res/xml/preference.xml b/main/res/xml/preference.xml index 6bfd1a5..91983c6 100644 --- a/main/res/xml/preference.xml +++ b/main/res/xml/preference.xml @@ -8,6 +8,11 @@ android:title="主页" android:textColor="@android:color/holo_blue_dark"/> + + - - \ No newline at end of file diff --git a/version b/version index c1e1d90..1ae015e 100644 --- a/version +++ b/version @@ -1 +1 @@ -4.17 \ No newline at end of file +4.19 \ No newline at end of file