设置默认浏览器类型接口
This commit is contained in:
parent
d66d9373ff
commit
fde4b275f7
@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Tue Jun 10 06:38:52 GMT 2025
|
||||
#Tue Jun 10 07:12:46 GMT 2025
|
||||
stageCount=0
|
||||
libraryProject=
|
||||
baseVersion=15.0
|
||||
publishVersion=15.0.0
|
||||
buildCount=6
|
||||
buildCount=11
|
||||
baseBetaVersion=15.0.1
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
<!-- 修改或删除您共享存储空间中的内容 -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
|
||||
|
||||
<application
|
||||
android:name=".App"
|
||||
android:allowBackup="true"
|
||||
@ -22,7 +22,6 @@
|
||||
android:resizeableActivity="true"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:networkSecurityConfig="@xml/network_security_config">
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/app_name"
|
||||
@ -30,16 +29,42 @@
|
||||
android:exported="true">
|
||||
|
||||
<intent-filter>
|
||||
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
</intent-filter>
|
||||
|
||||
<!-- 以下是设置为默认浏览器的关键配置 -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:mimeType="text/html" />
|
||||
<data android:mimeType="application/xhtml+xml" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="about" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="javascript" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".activities.AboutActivity"
|
||||
<activity
|
||||
android:name=".activities.AboutActivity"
|
||||
android:label="AboutActivity"/>
|
||||
|
||||
<meta-data
|
||||
|
@ -0,0 +1,22 @@
|
||||
package cc.winboll.studio.webpagesources;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen<zhangsken@188.com>
|
||||
* @Date 2025/06/10 15:04
|
||||
* @Describe 外部数据接口主窗口类
|
||||
*/
|
||||
public abstract class Main2Activity extends MainActivity {
|
||||
|
||||
// public static final String TAG = "Main2Activity";
|
||||
//
|
||||
// @Override
|
||||
// protected void onCreate(Bundle savedInstanceState) {
|
||||
// super.onCreate(savedInstanceState);
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
}
|
@ -67,6 +67,35 @@ public class MainActivity extends AppCompatActivity implements IWinBoLLActivity
|
||||
ft.add(R.id.activitymainFrameLayout1, mWebFragment, WebFragment.TAG);
|
||||
ft.show(mWebFragment);
|
||||
ft.commit();
|
||||
|
||||
// 处理 onCreate 时的 Intent
|
||||
handleIntent(getIntent());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
// 处理 onNewIntent 时的 Intent(Activity 已存在时调用)
|
||||
handleIntent(intent);
|
||||
}
|
||||
|
||||
private void handleIntent(Intent intent) {
|
||||
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
|
||||
Uri data = intent.getData();
|
||||
if (data != null) {
|
||||
String url = data.toString(); // 获取完整 URL
|
||||
String host = data.getHost(); // 获取主机名(如 "www.example.com")
|
||||
String path = data.getPath(); // 获取路径(如 "/page")
|
||||
|
||||
// 在界面显示 URL
|
||||
//tvUrl.setText("接收到的 URL:\n" + url);
|
||||
mWebFragment.loadUrl(url);
|
||||
|
||||
// 示例:打开系统浏览器访问该 URL
|
||||
// Intent browserIntent = new Intent(Intent.ACTION_VIEW, data);
|
||||
// startActivity(browserIntent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user