进一步区分启动、打开、分享(2种类型)

This commit is contained in:
sonichy 2024-06-22 19:55:06 +08:00
parent 318ae0d64b
commit fb276cc4b0
5 changed files with 30 additions and 11 deletions

BIN
app.apk

Binary file not shown.

View File

@ -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.39"> android:versionName="4.40">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 查询网络状态权限 --> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 查询网络状态权限 -->

View File

@ -9,7 +9,7 @@ p { text-indent:2em; }
</style> </style>
</head> </head>
<body> <body>
<h2 align=center><img src=logo.png><br>海天鹰浏览器 V4.39</h2> <h2 align=center><img src=logo.png><br>海天鹰浏览器 V4.40</h2>
<p>内置扩展的浏览器。</p> <p>内置扩展的浏览器。</p>
<p>扩展:链接关键字过滤,链接关键字高亮,图片自定义过滤,视频独立播放。</p> <p>扩展:链接关键字过滤,链接关键字高亮,图片自定义过滤,视频独立播放。</p>
<p>作者:海天鹰</p> <p>作者:海天鹰</p>
@ -24,6 +24,7 @@ p { text-indent:2em; }
<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>
<p><a href="https://blog.51cto.com/u_16175498/8811197" target="_blank">添加网址到桌面</a></p> <p><a href="https://blog.51cto.com/u_16175498/8811197" target="_blank">添加网址到桌面</a></p>
<h3>更新日志:</h3> <h3>更新日志:</h3>
<h3>V4.40 (2024-06-22)</h3><ol><li>进一步区分启动、打开、分享2种类型</li></ol>
<h3>V4.39 (2024-06-01)</h3><ol><li>解决接收不到分享网址的问题。</li></ol> <h3>V4.39 (2024-06-01)</h3><ol><li>解决接收不到分享网址的问题。</li></ol>
<h3>V4.38 (2024-04-30)</h3><ol><li>增加添加网址到桌面。</li></ol> <h3>V4.38 (2024-04-30)</h3><ol><li>增加添加网址到桌面。</li></ol>
<h3>V4.37 (2024-03-27)</h3><ol><li>修复保存网址规则前面有1个空格的问题。</li><li>增加点击规则查看详情。</li></ol> <h3>V4.37 (2024-03-27)</h3><ol><li>修复保存网址规则前面有1个空格的问题。</li><li>增加点击规则查看详情。</li></ol>

View File

@ -16,6 +16,7 @@ import java.net.HttpURLConnection;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.net.URLDecoder;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -1578,15 +1579,32 @@ public class MainActivity extends Activity {
} }
void getDataFromIntent(Intent intent) { void getDataFromIntent(Intent intent) {
String type = intent.getType(); if (intent.getAction().equals(Intent.ACTION_VIEW)) {
if (type != null && type.startsWith("text/") && intent.getAction().equals(Intent.ACTION_SEND)) { urln = intent.getDataString();
urln = intent.getStringExtra(Intent.EXTRA_TEXT); if (urln != null) {
if (urln.contains("\n")) if (urln.contains("\n"))
urln = urln.substring(urln.indexOf("\n") + 1); urln = urln.substring(urln.indexOf("\n") + 1);
newWindow(urln); newWindow(urln);
} else if (list_webView.size() == 0){ }
} else if (intent.getAction().equals(Intent.ACTION_SEND)) {
Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
if (uri != null) {
try {
urln = URLDecoder.decode(uri.toString(), "UTF-8");
} catch (Exception e) {
Log.e(Thread.currentThread().getStackTrace()[2] + "", e.toString());
}
} else {
urln = intent.getStringExtra(Intent.EXTRA_TEXT);
}
if (urln != null) {
if (urln.contains("\n"))
urln = urln.substring(urln.indexOf("\n") + 1);
newWindow(urln);
}
} else if (intent.getCategories().contains(Intent.CATEGORY_LAUNCHER) && list_webView.isEmpty()) {
String surl = sharedPreferences.getString("homepage", "file:///android_asset/home.htm"); String surl = sharedPreferences.getString("homepage", "file:///android_asset/home.htm");
if (surl.equals("")) if (surl.isEmpty())
surl = "file:///android_asset/home.htm"; surl = "file:///android_asset/home.htm";
newWindow(surl); newWindow(surl);
} }

View File

@ -1 +1 @@
{4.39} {4.40}