|
- package com.nsgk.ruralWeb;
-
- import android.annotation.SuppressLint;
- import android.content.Intent;
- import android.os.Bundle;
- import android.view.KeyEvent;
- import android.view.ViewGroup;
- import android.widget.LinearLayout;
- import android.widget.RelativeLayout;
-
- import com.just.agentweb.AgentWeb;
- import com.just.agentweb.DefaultWebClient;
-
- import androidx.annotation.Nullable;
- import androidx.appcompat.app.AppCompatActivity;
-
-
- /**
- * An example full-screen activity that shows and hides the system UI (i.e.
- * status bar and navigation/system bar) with user interaction.
- */
- public class FullscreenActivity extends AppCompatActivity {
-
-
- private AgentWeb mAgentWeb;
-
- @SuppressLint("SetJavaScriptEnabled")
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- setContentView(R.layout.activity_fullscreen);
- // init();
- mAgentWeb = AgentWeb.with(this)//
- .setAgentWebParent((RelativeLayout) findViewById(R.id.ll), -1, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))//传入AgentWeb的父控件。
- .useDefaultIndicator(-1, 3)//设置进度条颜色与高度,-1为默认值,高度为2,单位为dp。
- .setWebViewClient(new com.just.agentweb.WebViewClient() {
-
- })//WebViewClient , 与 WebView 使用一致 ,但是请勿获取WebView调用setWebViewClient(xx)方法了,会覆盖AgentWeb DefaultWebClient,同时相应的中间件也会失效。
- .setSecurityType(AgentWeb.SecurityType.STRICT_CHECK) //严格模式 Android 4.2.2 以下会放弃注入对象 ,使用AgentWebView没影响。
- .setMainFrameErrorView(R.layout.agentweb_error_page, -1) //参数1是错误显示的布局,参数2点击刷新控件ID -1表示点击整个布局都刷新, AgentWeb 3.0.0 加入。
- .setOpenOtherPageWays(DefaultWebClient.OpenOtherPageWays.ASK)//打开其他页面时,弹窗质询用户前往其他应用 AgentWeb 3.0.0 加入。
- .interceptUnkownUrl() //拦截找不到相关页面的Url AgentWeb 3.0.0 加入。
- .createAgentWeb()//创建AgentWeb。
- .ready()//设置 WebSettings。
- .go("http://218.59.175.43:84/index"); //WebView载入该url地址的页面并显示。
-
- /* 上边url是各个APP项目的入口地址
- 事项审批 http://116.255.223.226:82/yinnongLogin 图标 ic_launcher_sxsp 或者 ic_launcher_yhzl
- 阳光村务(村级事项) http://116.255.223.226:82/sunVillage_info/login 图标 ic_launcher_ygcw
- 大托管 http://218.59.175.43:96/agriculturalTrusteeship/index 图标 ic_launcher_dtg
- 产权交易 http://116.255.223.226:82/index 图标 ic_launcher_cqjy
- 农业执法 http://116.255.223.226:82/lawEnforcement/login 图标 ic_launcher_nyzf
- 宅基地审批(乌市版) https://36.134.89.93:82/zjdLogin 图标 ic_launcher_zjd
- 宅基地调查 http://116.255.223.226:82/homesteadLogin 图标 ic_launcher_zjddc
- 两清三化 http://116.255.223.226:89/homestead/login 图标 ic_launcher_2q3h
- 网上家园(废) http://116.255.223.226:82/onlineHomeLogin 图标 ic_launcher_white
- 确权调查 http://116.255.223.226:82/contracted/login 图标 ic_launcher_qqdc
- */
-
- }
-
- @Override
- protected void onPause() {
- mAgentWeb.getWebLifeCycle().onPause();
- super.onPause();
- }
-
- @Override
- protected void onResume() {
- mAgentWeb.getWebLifeCycle().onResume();
- super.onResume();
- }
-
- @Override
- protected void onDestroy() {
- mAgentWeb.getWebLifeCycle().onDestroy();
- super.onDestroy();
- }
-
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- // if (keyCode == KeyEvent.KEYCODE_BACK && mWebView.canGoBack()) {
- // mWebView.goBack();
- // return true;
- // }
- if (mAgentWeb.handleKeyEvent(keyCode, event)) {
- return true;
- }
- return super.onKeyDown(keyCode, event);
- }
-
-
- @Override
- protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- }
- }
|