增加请求电脑版网页
This commit is contained in:
parent
f3287f3ac7
commit
df3f62afed
|
@ -2,7 +2,7 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.hty.browser"
|
package="com.hty.browser"
|
||||||
android:versionCode="4"
|
android:versionCode="4"
|
||||||
android:versionName="4.17">
|
android:versionName="4.19">
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
|
@ -21,18 +21,15 @@
|
||||||
<action android:name="android.intent.action.VIEW"/>
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
<category android:name="android.intent.category.BROWSABLE"/>
|
<category android:name="android.intent.category.BROWSABLE"/>
|
||||||
<data android:scheme="https"/>
|
|
||||||
<data android:scheme="http"/>
|
|
||||||
</intent-filter>
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.VIEW"/>
|
|
||||||
<action android:name="android.intent.action.SEARCH"/>
|
<action android:name="android.intent.action.SEARCH"/>
|
||||||
<action android:name="android.intent.action.WEB_SEARCH"/>
|
<action android:name="android.intent.action.WEB_SEARCH"/>
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
|
||||||
<category android:name="android.intent.category.BROWSABLE"/>
|
|
||||||
<data android:scheme="file"/>
|
<data android:scheme="file"/>
|
||||||
|
<data android:scheme="content"/>
|
||||||
|
<data android:scheme="https"/>
|
||||||
|
<data android:scheme="http"/>
|
||||||
<data android:mimeType="text/html"/>
|
<data android:mimeType="text/html"/>
|
||||||
<data android:mimeType="text/plain"/>
|
<data android:mimeType="text/plain"/>
|
||||||
|
<data android:host="*"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
|
|
|
@ -9,7 +9,7 @@ p { text-indent:2em; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h2 align=center><img src=logo.png><br>海天鹰浏览器 V4.17</h2>
|
<h2 align=center><img src=logo.png><br>海天鹰浏览器 V4.18</h2>
|
||||||
<p>内置扩展的浏览器。</p>
|
<p>内置扩展的浏览器。</p>
|
||||||
<p>扩展:链接关键字过滤,链接关键字高亮,图片自定义过滤,视频独立播放。</p>
|
<p>扩展:链接关键字过滤,链接关键字高亮,图片自定义过滤,视频独立播放。</p>
|
||||||
<p>作者:海天鹰</p>
|
<p>作者:海天鹰</p>
|
||||||
|
@ -23,6 +23,8 @@ p { text-indent:2em; }
|
||||||
<p><a href="https://stackoverflow.com/questions/3462582/display-the-android-webviews-favicon" target="_blank">获取网页图标</a></p>
|
<p><a href="https://stackoverflow.com/questions/3462582/display-the-android-webviews-favicon" target="_blank">获取网页图标</a></p>
|
||||||
<p><a href="https://www.jianshu.com/p/c9a18050a249" target="_blank">字符串转Bitmap</a></p>
|
<p><a href="https://www.jianshu.com/p/c9a18050a249" target="_blank">字符串转Bitmap</a></p>
|
||||||
<h3>更新日志:</h3>
|
<h3>更新日志:</h3>
|
||||||
|
<h3>V4.19 (2021-06-27)</h3><ol><li>增加请求电脑版网页。</li></ol>
|
||||||
|
<h3>V4.18 (2021-06-01)</h3><ol><li>增加动态权限请求。</li></ol>
|
||||||
<h3>V4.17 (2021-03-02)</h3><ol><li>允许HTTPS、HTTP混合内容,解决微信网页视频无法播放的问题。</li></ol>
|
<h3>V4.17 (2021-03-02)</h3><ol><li>允许HTTPS、HTTP混合内容,解决微信网页视频无法播放的问题。</li></ol>
|
||||||
<h3>V4.16 (2020-10-14)</h3><ol><li>取消引起崩溃的复制图片。</li></ol>
|
<h3>V4.16 (2020-10-14)</h3><ol><li>取消引起崩溃的复制图片。</li></ol>
|
||||||
<h3>V4.15 (2020-10-01)</h3><ol><li>优化猜测下载文件名。</li></ol>
|
<h3>V4.15 (2020-10-01)</h3><ol><li>优化猜测下载文件名。</li></ol>
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.DownloadManager;
|
import android.app.DownloadManager;
|
||||||
|
@ -103,7 +104,6 @@ public class MainActivity extends Activity {
|
||||||
TextView textView_searchCount, textView_filesize;
|
TextView textView_searchCount, textView_filesize;
|
||||||
EditText editText_url, editText_search, editText_download_path;
|
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;
|
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;
|
LinearLayout LinearLayout1, LinearLayout2;
|
||||||
FrameLayout webViewLayout, videoLayout, searchBar;
|
FrameLayout webViewLayout, videoLayout, searchBar;
|
||||||
InputMethodManager IMM;
|
InputMethodManager IMM;
|
||||||
|
@ -121,10 +121,21 @@ public class MainActivity extends Activity {
|
||||||
int currentPage;
|
int currentPage;
|
||||||
int FILECHOOSER_DOWNLOAD_PATH = 3;
|
int FILECHOOSER_DOWNLOAD_PATH = 3;
|
||||||
DownloadCompleteReceiver receiver;
|
DownloadCompleteReceiver receiver;
|
||||||
|
private static String[] PERMISSIONS = {
|
||||||
|
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||||
|
Manifest.permission.WRITE_EXTERNAL_STORAGE };
|
||||||
|
private static int REQUEST_PERMISSION_CODE = 1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(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);
|
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
IMM = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
IMM = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
String path = Environment.getExternalStorageDirectory().getPath() + File.separator + "HTYBrowser";
|
String path = Environment.getExternalStorageDirectory().getPath() + File.separator + "HTYBrowser";
|
||||||
|
@ -132,33 +143,17 @@ public class MainActivity extends Activity {
|
||||||
if (!dir.exists()) {
|
if (!dir.exists()) {
|
||||||
dir.mkdirs();
|
dir.mkdirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
|
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
|
||||||
|
|
||||||
LinearLayout1 = (LinearLayout) findViewById(R.id.LinearLayout1);
|
LinearLayout1 = (LinearLayout) findViewById(R.id.LinearLayout1);
|
||||||
LinearLayout2 = (LinearLayout) findViewById(R.id.LinearLayout2);
|
LinearLayout2 = (LinearLayout) findViewById(R.id.LinearLayout2);
|
||||||
// RelativeLayout1 = (RelativeLayout) findViewById(R.id.RelativeLayout1);
|
|
||||||
webViewLayout = (FrameLayout) findViewById(R.id.webViewLayout);
|
webViewLayout = (FrameLayout) findViewById(R.id.webViewLayout);
|
||||||
videoLayout = (FrameLayout) findViewById(R.id.videoLayout);
|
videoLayout = (FrameLayout) findViewById(R.id.videoLayout);
|
||||||
searchBar = (FrameLayout) findViewById(R.id.searchBar);
|
searchBar = (FrameLayout) findViewById(R.id.searchBar);
|
||||||
searchBar.setVisibility(View.GONE);
|
searchBar.setVisibility(View.GONE);
|
||||||
pgb1 = (ProgressBar) findViewById(R.id.progressBar1);
|
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_go = (ImageButton) findViewById(R.id.button_go);
|
||||||
button_back = (ImageButton) findViewById(R.id.button_back);
|
button_back = (ImageButton) findViewById(R.id.button_back);
|
||||||
button_forward = (ImageButton) findViewById(R.id.button_forward);
|
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);
|
long downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);
|
||||||
Log.e(Thread.currentThread().getStackTrace()[2] + "", downloadId + "");
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", downloadId + "");
|
||||||
DownloadManager downloadManager = (DownloadManager) context.getSystemService(DOWNLOAD_SERVICE);
|
DownloadManager downloadManager = (DownloadManager) context.getSystemService(DOWNLOAD_SERVICE);
|
||||||
if(downloadId == downloadIdUpdate){
|
if (downloadId == downloadIdUpdate) {
|
||||||
Uri uri = downloadManager.getUriForDownloadedFile(downloadId);
|
Uri uri = downloadManager.getUriForDownloadedFile(downloadId);
|
||||||
Log.e(Thread.currentThread().getStackTrace()[2] + "", uri.toString());
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", uri.toString());
|
||||||
Intent intentn = new Intent(Intent.ACTION_VIEW);
|
Intent intent1 = new Intent(Intent.ACTION_VIEW);
|
||||||
intentn.setDataAndType(uri, "application/vnd.android.package-archive");
|
intent1.setDataAndType(uri, "application/vnd.android.package-archive");
|
||||||
startActivity(intentn);
|
startActivity(intent1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1203,7 +1198,9 @@ public class MainActivity extends Activity {
|
||||||
void settingWebView(WebView webView) {
|
void settingWebView(WebView webView) {
|
||||||
registerForContextMenu(webView); // 注册菜单
|
registerForContextMenu(webView); // 注册菜单
|
||||||
webView.requestFocusFromTouch(); // 请求触摸焦点
|
webView.requestFocusFromTouch(); // 请求触摸焦点
|
||||||
webView.setWebContentsDebuggingEnabled(true); // 允许调试
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||||
|
webView.setWebContentsDebuggingEnabled(true); // 允许调试
|
||||||
|
}
|
||||||
|
|
||||||
WebSettings webSettings = webView.getSettings();
|
WebSettings webSettings = webView.getSettings();
|
||||||
webSettings.setJavaScriptEnabled(true); // 开启JS
|
webSettings.setJavaScriptEnabled(true); // 开启JS
|
||||||
|
@ -1224,6 +1221,9 @@ public class MainActivity extends Activity {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); // 允许HTTPS、HTTP混合内容
|
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() {
|
webView.setWebViewClient(new WebViewClient() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -23,8 +23,8 @@ public class SettingsActivity extends PreferenceActivity implements OnSharedPref
|
||||||
SP.registerOnSharedPreferenceChangeListener(this);
|
SP.registerOnSharedPreferenceChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
// 启动时显示
|
// 启动时显示
|
||||||
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
ETP_homepage.setSummary(SP.getString("homepage", "http://www.baidu.com"));
|
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", ""));
|
ETP_highlight.setSummary(SP.getString("highlight", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
// 修改后显示
|
// 修改后显示
|
||||||
|
@Override
|
||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||||
Log.e(Thread.currentThread().getStackTrace()[2] + "", key);
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", key);
|
||||||
if (key.equals("homepage")) {
|
if (key.equals("homepage")) {
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
android:title="主页"
|
android:title="主页"
|
||||||
android:textColor="@android:color/holo_blue_dark"/>
|
android:textColor="@android:color/holo_blue_dark"/>
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="switch_pcmode"
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:title="电脑模式"/>
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="switch_adBlock"
|
android:key="switch_adBlock"
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
|
@ -60,11 +65,4 @@
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<!--
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="switch_pasueVideoOnPause"
|
|
||||||
android:defaultValue="true"
|
|
||||||
android:title="后台暂停播放视频"/>
|
|
||||||
-->
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
Loading…
Reference in New Issue