├── jitpack.yml ├── agentweb-core ├── .gitignore ├── providedLibs │ └── alipaySdk-20180601.jar ├── src │ ├── main │ │ ├── res │ │ │ ├── xml │ │ │ │ └── web_files_public.xml │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ ├── ids.xml │ │ │ │ ├── style.xml │ │ │ │ └── strings.xml │ │ │ ├── layout │ │ │ │ └── agentweb_error_page.xml │ │ │ └── values-zh │ │ │ │ └── strings.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── just │ │ │ │ └── agentweb │ │ │ │ ├── WebChromeClient.java │ │ │ │ ├── WebViewClient.java │ │ │ │ ├── WebSecurityController.java │ │ │ │ ├── Provider.java │ │ │ │ ├── EventInterceptor.java │ │ │ │ ├── PermissionInterceptor.java │ │ │ │ ├── IWebIndicator.java │ │ │ │ ├── WebLifeCycle.java │ │ │ │ ├── JsInterfaceObjectException.java │ │ │ │ ├── LayoutParamsOffer.java │ │ │ │ ├── IEventHandler.java │ │ │ │ ├── BaseIndicatorSpec.java │ │ │ │ ├── UrlCommonException.java │ │ │ │ ├── JsAccessEntrace.java │ │ │ │ ├── IAgentWebSettings.java │ │ │ │ ├── WebSecurityCheckLogic.java │ │ │ │ ├── JsInterfaceHolder.java │ │ │ │ ├── WebCreator.java │ │ │ │ ├── IVideo.java │ │ │ │ ├── HookManager.java │ │ │ │ ├── IndicatorController.java │ │ │ │ ├── AgentWebFileProvider.java │ │ │ │ ├── QuickCallJs.java │ │ │ │ ├── WebListenerManager.java │ │ │ │ ├── IWebLayout.java │ │ │ │ ├── IUrlLoader.java │ │ │ │ ├── WebSecurityControllerImpl.java │ │ │ │ ├── BaseIndicatorView.java │ │ │ │ ├── MiddlewareWebChromeBase.java │ │ │ │ ├── LollipopFixedWebView.java │ │ │ │ ├── DefaultWebLifeCycleImpl.java │ │ │ │ ├── LogUtils.java │ │ │ │ ├── MiddlewareWebClientBase.java │ │ │ │ ├── EventHandlerImpl.java │ │ │ │ ├── JsAccessEntraceImpl.java │ │ │ │ ├── AgentWebSettingsImpl.java │ │ │ │ ├── AgentWebPermissions.java │ │ │ │ ├── IndicatorHandler.java │ │ │ │ ├── WebSecurityLogicImpl.java │ │ │ │ ├── AgentWebJsInterfaceCompat.java │ │ │ │ ├── JsBaseInterfaceHolder.java │ │ │ │ ├── ProcessUtils.java │ │ │ │ ├── JsInterfaceHolderImpl.java │ │ │ │ ├── BaseJsAccessEntrace.java │ │ │ │ └── AgentWebCompat.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── just │ │ │ └── agentweb │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── just │ │ └── agentweb │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── sample ├── .gitignore ├── keystore.jks ├── keystore │ └── keystore.jks ├── libs │ └── alipaySdk-20180601.jar ├── src │ ├── main │ │ ├── assets │ │ │ ├── upload_file │ │ │ │ ├── id.png │ │ │ │ ├── upload.css │ │ │ │ └── event.js │ │ │ ├── sms │ │ │ │ └── sms.html │ │ │ └── js_interaction │ │ │ │ ├── button.css │ │ │ │ └── hello.html │ │ ├── res │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── back.png │ │ │ │ ├── cha.png │ │ │ │ ├── more.png │ │ │ │ └── app_logo.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── app_logo.png │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── app_logo.png │ │ │ ├── drawable-v21 │ │ │ │ ├── selector_drawable_for_btn.xml │ │ │ │ └── ripple_for_btn.xml │ │ │ ├── drawable │ │ │ │ ├── indicator_shape.xml │ │ │ │ ├── selector_drawable_for_btn.xml │ │ │ │ ├── btn_shape_s.xml │ │ │ │ ├── btn_shape.xml │ │ │ │ ├── iv_back_selector.xml │ │ │ │ └── ic_baseline_search_24.xml │ │ │ ├── layout │ │ │ │ ├── activity_common.xml │ │ │ │ ├── fragment_agentweb.xml │ │ │ │ ├── listview_main.xml │ │ │ │ ├── markdown_view.xml │ │ │ │ ├── fragment_twk_web.xml │ │ │ │ ├── activity_main.xml │ │ │ │ ├── activity_web.xml │ │ │ │ ├── fragment_srl_web.xml │ │ │ │ ├── activity_native_download.xml │ │ │ │ ├── recyclerview_item_download.xml │ │ │ │ ├── fragment_js.xml │ │ │ │ ├── activity_auto_hiden_toolbar.xml │ │ │ │ └── toorbar_main.xml │ │ │ ├── xml │ │ │ │ └── network_security_config.xml │ │ │ └── menu │ │ │ │ └── toolbar_menu.xml │ │ └── java │ │ │ └── com │ │ │ └── just │ │ │ └── agentweb │ │ │ └── sample │ │ │ ├── api │ │ │ └── Api.java │ │ │ ├── provider │ │ │ ├── ServiceProvider.java │ │ │ └── WebServiceProvider.java │ │ │ ├── base │ │ │ └── FragmentKeyDown.java │ │ │ ├── common │ │ │ ├── FragmentKeyDown.java │ │ │ ├── CommonWebChromeClient.java │ │ │ ├── AndroidInterface.java │ │ │ ├── GuideItemEntity.java │ │ │ ├── CustomSettings.java │ │ │ └── UIController.java │ │ │ ├── utils │ │ │ ├── FileUtils.java │ │ │ └── ProcessUtils.java │ │ │ ├── activity │ │ │ ├── ExternalActivity.java │ │ │ ├── ContainerActivity.java │ │ │ ├── WebActivity.java │ │ │ ├── RemoteWebViewlActivity.java │ │ │ └── EasyWebActivity.java │ │ │ ├── fragment │ │ │ ├── CustomSettingsFragment.java │ │ │ ├── CustomIndicatorFragment.java │ │ │ ├── VasSonicFragment.java │ │ │ ├── SmartRefreshWebFragment.java │ │ │ ├── BounceWebFragment.java │ │ │ └── CustomWebViewFragment.java │ │ │ ├── client │ │ │ ├── MiddlewareChromeClient.java │ │ │ ├── SonicWebViewClient.java │ │ │ └── MiddlewareWebViewClient.java │ │ │ ├── service │ │ │ └── WebService.java │ │ │ ├── widget │ │ │ ├── CommonIndicator.java │ │ │ ├── SmartRefreshWebLayout.java │ │ │ ├── WebLayout.java │ │ │ └── CoolIndicatorLayout.java │ │ │ ├── sonic │ │ │ ├── SonicWebViewClient.java │ │ │ ├── SonicSessionClientImpl.java │ │ │ └── SonicImpl.java │ │ │ ├── app │ │ │ └── App.java │ │ │ └── behavior │ │ │ └── BottomNavigationViewBehavior.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── just │ │ │ └── agentweb │ │ │ └── sample │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── just │ │ └── agentweb │ │ └── sample │ │ └── ExampleInstrumentedTest.java └── build.gradle ├── agentweb-filechooser ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── just │ │ │ └── agentweb │ │ │ └── filechooser │ │ │ ├── FileCompressor.java │ │ │ └── FileParcel.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── just │ │ │ └── agentweb │ │ │ └── filechooser │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── just │ │ └── agentweb │ │ └── filechooser │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── img ├── jd.png ├── js.png ├── logo.png ├── video.png ├── alipay.jpg ├── alipay.png ├── upload.png ├── agentweb结构.png ├── img-bounce.png ├── img-scheme.png ├── img-sonic.png ├── wechat pay.png ├── wechat_pay.jpg ├── img-download.png ├── custom setting.png ├── img-permission.png └── img-function-list.png ├── agentweb.apk ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .github └── FUNDING.yml ├── .gitignore ├── gradle.properties ├── releasenote.md ├── gradlew.bat └── README.md /jitpack.yml: -------------------------------------------------------------------------------- 1 | jdk: 2 | - openjdk17 -------------------------------------------------------------------------------- /agentweb-core/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | map.txt -------------------------------------------------------------------------------- /agentweb-filechooser/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /img/jd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/img/jd.png -------------------------------------------------------------------------------- /img/js.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/img/js.png -------------------------------------------------------------------------------- /agentweb.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/agentweb.apk -------------------------------------------------------------------------------- /img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/img/logo.png -------------------------------------------------------------------------------- /img/video.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/img/video.png -------------------------------------------------------------------------------- /img/alipay.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/img/alipay.jpg -------------------------------------------------------------------------------- /img/alipay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/img/alipay.png -------------------------------------------------------------------------------- /img/upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/img/upload.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':sample', ':agentweb-core', ':agentweb-filechooser' 2 | -------------------------------------------------------------------------------- /agentweb-filechooser/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /img/agentweb结构.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/img/agentweb结构.png -------------------------------------------------------------------------------- /img/img-bounce.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/img/img-bounce.png -------------------------------------------------------------------------------- /img/img-scheme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/img/img-scheme.png -------------------------------------------------------------------------------- /img/img-sonic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/img/img-sonic.png -------------------------------------------------------------------------------- /img/wechat pay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/img/wechat pay.png -------------------------------------------------------------------------------- /img/wechat_pay.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/img/wechat_pay.jpg -------------------------------------------------------------------------------- /img/img-download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/img/img-download.png -------------------------------------------------------------------------------- /sample/keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/sample/keystore.jks -------------------------------------------------------------------------------- /img/custom setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/img/custom setting.png -------------------------------------------------------------------------------- /img/img-permission.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/img/img-permission.png -------------------------------------------------------------------------------- /img/img-function-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/img/img-function-list.png -------------------------------------------------------------------------------- /sample/keystore/keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/sample/keystore/keystore.jks -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /sample/libs/alipaySdk-20180601.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/sample/libs/alipaySdk-20180601.jar -------------------------------------------------------------------------------- /sample/src/main/assets/upload_file/id.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/sample/src/main/assets/upload_file/id.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/sample/src/main/res/mipmap-xxxhdpi/back.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/cha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/sample/src/main/res/mipmap-xxxhdpi/cha.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/sample/src/main/res/mipmap-xxxhdpi/more.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/app_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/sample/src/main/res/mipmap-xhdpi/app_logo.png -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AgentWeb 3 | 4 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/app_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/sample/src/main/res/mipmap-xxhdpi/app_logo.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/app_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/sample/src/main/res/mipmap-xxxhdpi/app_logo.png -------------------------------------------------------------------------------- /agentweb-core/providedLibs/alipaySdk-20180601.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Justson/AgentWeb/HEAD/agentweb-core/providedLibs/alipaySdk-20180601.jar -------------------------------------------------------------------------------- /agentweb-core/src/main/res/xml/web_files_public.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /agentweb-core/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #000000 4 | #ffffff 5 | #2e2e32 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/api/Api.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.api; 2 | 3 | /** 4 | * @author xiaozhongcen 5 | * @date 20-8-18 6 | * @since 1.0.0 7 | */ 8 | public interface Api { 9 | 10 | void onReady(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/WebChromeClient.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb; 2 | 3 | /** 4 | * @author cenxiaozhong 5 | * @date 2019/4/13 6 | * @since 1.0.0 7 | */ 8 | public class WebChromeClient extends MiddlewareWebChromeBase{ 9 | public WebChromeClient() { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/WebViewClient.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb; 2 | 3 | /** 4 | * @author cenxiaozhong 5 | * @date 2019/4/13 6 | * @since 1.0.0 7 | */ 8 | public class WebViewClient extends MiddlewareWebClientBase { 9 | public WebViewClient() { 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable-v21/selector_drawable_for_btn.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 7 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable/indicator_shape.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable/selector_drawable_for_btn.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable/btn_shape_s.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable/btn_shape.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_common.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/provider/ServiceProvider.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.provider; 2 | 3 | import com.flyingpigeon.library.ServiceContentProvider; 4 | 5 | /** 6 | * @author xiaozhongcen 7 | * @date 20-8-18 8 | * @since 1.0.0 9 | */ 10 | public class ServiceProvider extends ServiceContentProvider { 11 | } 12 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable-v21/ripple_for_btn.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /agentweb-core/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/provider/WebServiceProvider.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.provider; 2 | 3 | import com.flyingpigeon.library.ServiceContentProvider; 4 | 5 | /** 6 | * @author xiaozhongcen 7 | * @date 20-8-18 8 | * @since 1.0.0 9 | */ 10 | public class WebServiceProvider extends ServiceContentProvider { 11 | } 12 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable/iv_back_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /sample/src/main/res/xml/network_security_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /agentweb-core/src/main/res/values/style.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/base/FragmentKeyDown.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.base; 2 | 3 | import android.view.KeyEvent; 4 | 5 | /** 6 | * Created by cenxiaozhong 7 | * source code https://github.com/Justson/AgentWeb 8 | */ 9 | 10 | public interface FragmentKeyDown { 11 | 12 | boolean onFragmentKeyDown(int keyCode, KeyEvent event); 13 | } 14 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/common/FragmentKeyDown.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.common; 2 | 3 | import android.view.KeyEvent; 4 | 5 | /** 6 | * Created by cenxiaozhong on 2017/5/23. 7 | * source code https://github.com/Justson/AgentWeb 8 | */ 9 | 10 | public interface FragmentKeyDown { 11 | 12 | boolean onFragmentKeyDown(int keyCode, KeyEvent event); 13 | } 14 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | custom: # Replace with a single custom sponsorship URL 9 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/fragment_agentweb.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /agentweb-core/src/test/java/com/just/agentweb/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /sample/src/test/java/com/just/agentweb/sample/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /agentweb-filechooser/src/test/java/com/just/agentweb/filechooser/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.filechooser; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/utils/FileUtils.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.utils; 2 | 3 | /** 4 | * @author cenxiaozhong 5 | * @date 2021/11/27 6 | * @since 1.0.0 7 | */ 8 | public class FileUtils { 9 | 10 | public static String getExtensionByFilePath(String filePath){ 11 | String fe = ""; 12 | int i = filePath.lastIndexOf('.'); 13 | if (i > 0) { 14 | fe = filePath.substring(i+1); 15 | } 16 | System.out.println("File extension is : "+fe); 17 | return fe; 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #393a3f 4 | #303135 5 | #1aad19 6 | 7 | #1B9AF7 8 | #58b2f2 9 | #2e2e32 10 | #000000 11 | #ffffff 12 | #7b393a3f 13 | 14 | -------------------------------------------------------------------------------- /agentweb-filechooser/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /agentweb-core/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/common/CommonWebChromeClient.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.common; 2 | 3 | import android.util.Log; 4 | import android.webkit.WebView; 5 | 6 | import com.just.agentweb.WebChromeClient; 7 | 8 | /** 9 | * @author cenxiaozhong 10 | * @date 2019/2/19 11 | * @since 1.0.0 12 | */ 13 | public class CommonWebChromeClient extends WebChromeClient { 14 | @Override 15 | public void onProgressChanged(WebView view, int newProgress) { 16 | super.onProgressChanged(view, newProgress); 17 | Log.i("CommonWebChromeClient", "onProgressChanged:" + newProgress + " view:" + view); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable/ic_baseline_search_24.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /sample/src/main/assets/upload_file/upload.css: -------------------------------------------------------------------------------- 1 | .file { 2 | position: relative; 3 | display: inline-block; 4 | background: #D0EEFF; 5 | border: 1px solid #99D3F5; 6 | border-radius: 4px; 7 | padding: 4px 12px; 8 | overflow: hidden; 9 | color: #1E88C7; 10 | text-decoration: none; 11 | text-indent: 0; 12 | line-height: 20px; 13 | } 14 | .file input { 15 | position: absolute; 16 | font-size: 100px; 17 | right: 0; 18 | top: 0; 19 | opacity: 0; 20 | } 21 | .file:hover { 22 | background: #AADFFD; 23 | border-color: #78C3F3; 24 | color: #004974; 25 | text-decoration: none; 26 | } 27 | -------------------------------------------------------------------------------- /agentweb-core/src/main/res/layout/agentweb_error_page.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/listview_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/activity/ExternalActivity.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.activity; 2 | 3 | import android.os.Bundle; 4 | import androidx.annotation.Nullable; 5 | import android.util.Log; 6 | 7 | /** 8 | * @author cenxiaozhong 9 | * @date 2019-05-19 10 | * @since 1.0.0 11 | */ 12 | public class ExternalActivity extends WebActivity { 13 | 14 | public static final String TAG = ExternalActivity.class.getSimpleName(); 15 | 16 | @Override 17 | protected void onCreate(@Nullable Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | } 20 | 21 | @Override 22 | public String getUrl() { 23 | String url = getIntent().getData().getQueryParameter("url"); 24 | Log.e(TAG, " url:" + url); 25 | return url; 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/markdown_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/fragment_twk_web.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 18 | 19 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/WebSecurityController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | /** 20 | * @author cenxiaozhong 21 | */ 22 | public interface WebSecurityController { 23 | void check(T t); 24 | } 25 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/Provider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | /** 20 | * @author cenxiaozhong 21 | * @date 2017/7/5 22 | * @since 1.0.0 23 | */ 24 | public interface Provider { 25 | T provide(); 26 | } 27 | -------------------------------------------------------------------------------- /agentweb-core/src/androidTest/java/com/just/agentweb/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb; 2 | 3 | import android.content.Context; 4 | import androidx.test.platform.app.InstrumentationRegistry; 5 | import androidx.test.ext.junit.runners.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.just.library.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /sample/src/androidTest/java/com/just/agentweb/sample/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample; 2 | 3 | import android.content.Context; 4 | import androidx.test.platform.app.InstrumentationRegistry; 5 | import androidx.test.ext.junit.runners.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.just.library.agentweb", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/EventInterceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | /** 20 | * @author cenxiaozhong 21 | * @date 2017/6/3 22 | * @since 1.0.0 23 | */ 24 | public interface EventInterceptor { 25 | boolean event(); 26 | } 27 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/fragment/CustomSettingsFragment.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.fragment; 2 | 3 | import android.os.Bundle; 4 | 5 | import com.just.agentweb.IAgentWebSettings; 6 | import com.just.agentweb.sample.common.CustomSettings; 7 | 8 | /** 9 | * Created by cenxiaozhong on 2017/5/26. 10 | * source code https://github.com/Justson/AgentWeb 11 | */ 12 | 13 | public class CustomSettingsFragment extends AgentWebFragment { 14 | 15 | public static AgentWebFragment getInstance(Bundle bundle) { 16 | 17 | CustomSettingsFragment mCustomSettingsFragment = new CustomSettingsFragment(); 18 | if (bundle != null){ 19 | mCustomSettingsFragment.setArguments(bundle); 20 | } 21 | return mCustomSettingsFragment; 22 | 23 | } 24 | 25 | @Override 26 | public IAgentWebSettings getSettings() { 27 | return new CustomSettings(getActivity()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /agentweb-filechooser/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -keep class com.just.agentweb.** { 23 | *; 24 | } 25 | -dontwarn com.just.agentweb.** -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | .idea 4 | /local.properties 5 | .DS_Store 6 | /build 7 | /captures 8 | .externalNativeBuild 9 | 10 | # Built application files 11 | # *.apk 12 | *.ap_ 13 | 14 | # Files for the ART/Dalvik VM 15 | *.dex 16 | 17 | # Java class files 18 | *.class 19 | 20 | # Generated files 21 | bin/ 22 | gen/ 23 | out/ 24 | 25 | # Gradle files 26 | .gradle/ 27 | build/ 28 | 29 | # Local configuration file (sdk path, etc) 30 | local.properties 31 | 32 | # Proguard folder generated by Eclipse 33 | proguard/ 34 | 35 | # Log Files 36 | *.log 37 | 38 | # Android Studio Navigation editor temp files 39 | .navigation/ 40 | 41 | # Android Studio captures folder 42 | captures/ 43 | 44 | # Intellij 45 | *.iml 46 | .idea/workspace.xml 47 | 48 | local.properties 49 | # Keystore files 50 | #*.jks 51 | app/keystore/ 52 | #sample/keystore/ 53 | library/src/main/res/mipmap-xxhdpi/ 54 | sample/sampledata/ 55 | node_modules 56 | package-lock.json 57 | package.json 58 | 59 | -------------------------------------------------------------------------------- /agentweb-filechooser/src/androidTest/java/com/just/agentweb/filechooser/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.filechooser; 2 | 3 | import android.content.Context; 4 | import androidx.test.platform.app.InstrumentationRegistry; 5 | import androidx.test.ext.junit.runners.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.just.agentweb.filechooser.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/PermissionInterceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | /** 20 | * @author cenxiaozhong 21 | * @since 3.0.0 22 | */ 23 | public interface PermissionInterceptor { 24 | boolean intercept(String url, String[] permissions, String action); 25 | } 26 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/IWebIndicator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | /** 20 | * @author cenxiaozhong 21 | * @since 1.0.0 22 | */ 23 | 24 | 25 | public interface IWebIndicator { 26 | 27 | 28 | T offer(); 29 | } 30 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/WebLifeCycle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | /** 20 | * @author cenxiaozhong 21 | * @date 2017/5/30 22 | * @since 1.0.0 23 | */ 24 | public interface WebLifeCycle { 25 | void onResume(); 26 | void onPause(); 27 | void onDestroy(); 28 | } 29 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/client/MiddlewareChromeClient.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.client; 2 | 3 | import android.util.Log; 4 | import android.webkit.JsResult; 5 | import android.webkit.WebView; 6 | 7 | import com.just.agentweb.MiddlewareWebChromeBase; 8 | 9 | /** 10 | * Created by cenxiaozhong on 2017/12/16. 11 | * After agentweb 3.0.0 , allow dev to custom self WebChromeClient's MiddleWare . 12 | */ 13 | public class MiddlewareChromeClient extends MiddlewareWebChromeBase { 14 | public MiddlewareChromeClient() { 15 | } 16 | @Override 17 | public boolean onJsAlert(WebView view, String url, String message, JsResult result) { 18 | Log.i("Info","onJsAlert:"+url); 19 | return super.onJsAlert(view, url, message, result); 20 | } 21 | 22 | @Override 23 | public void onProgressChanged(WebView view, int newProgress) { 24 | super.onProgressChanged(view, newProgress); 25 | Log.i("Info","onProgressChanged:"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/service/WebService.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.service; 2 | 3 | import android.app.Service; 4 | import android.content.Intent; 5 | import android.os.IBinder; 6 | import androidx.annotation.Nullable; 7 | import android.util.Log; 8 | import android.webkit.WebView; 9 | 10 | /** 11 | * @author xiaozhongcen 12 | * @date 20-8-18 13 | * @since 1.0.0 14 | * 提前初始化进程减少白屏 15 | */ 16 | public class WebService extends Service { 17 | 18 | private static final String TAG = WebService.class.getSimpleName(); 19 | 20 | @Override 21 | public void onCreate() { 22 | super.onCreate(); 23 | Log.e(TAG, "init process"); 24 | try { 25 | new WebView(this.getApplicationContext()); 26 | }catch (Throwable throwable){ 27 | throwable.printStackTrace(); 28 | } 29 | } 30 | 31 | @Nullable 32 | @Override 33 | public IBinder onBind(Intent intent) { 34 | return null; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/JsInterfaceObjectException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | 20 | /** 21 | * @author cenxiaozhong 22 | * @date 2017/5/13 23 | * @since 1.0.0 24 | */ 25 | public class JsInterfaceObjectException extends RuntimeException { 26 | JsInterfaceObjectException(String msg){ 27 | super(msg); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/LayoutParamsOffer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import android.widget.FrameLayout; 20 | 21 | /** 22 | * @author cenxiaozhong 23 | * @date 2017/5/12 24 | * @since 1.0.0 25 | */ 26 | public interface LayoutParamsOffer { 27 | 28 | T offerLayoutParams(); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/IEventHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import android.view.KeyEvent; 20 | 21 | /** 22 | * @author cenxiaozhong 23 | * @since 1.0.0 24 | */ 25 | public interface IEventHandler { 26 | 27 | boolean onKeyDown(int keyCode, KeyEvent event); 28 | 29 | boolean back(); 30 | } 31 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/activity/ContainerActivity.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.activity; 2 | 3 | import android.os.Bundle; 4 | import androidx.annotation.Nullable; 5 | import androidx.fragment.app.Fragment; 6 | import androidx.appcompat.app.AppCompatActivity; 7 | 8 | import com.just.agentweb.sample.R; 9 | import com.just.agentweb.sample.fragment.EasyWebFragment; 10 | 11 | /** 12 | * Created by cenxiaozhong on 2017/7/22. 13 | */ 14 | 15 | public class ContainerActivity extends AppCompatActivity { 16 | 17 | @Override 18 | protected void onCreate(@Nullable Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | 21 | setContentView(R.layout.activity_common); 22 | 23 | Fragment mFragment=null; 24 | getSupportFragmentManager() 25 | .beginTransaction() 26 | .add(R.id.container_framelayout,mFragment= EasyWebFragment.getInstance(new Bundle()),EasyWebFragment.class.getName()) 27 | .show(mFragment) 28 | .commit(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/BaseIndicatorSpec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | 20 | 21 | /** 22 | * @author cenxiaozhong 23 | * @since 1.0.0 24 | */ 25 | public interface BaseIndicatorSpec { 26 | 27 | void show(); 28 | 29 | void hide(); 30 | 31 | void reset(); 32 | 33 | void setProgress(int newProgress); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/UrlCommonException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | /** 19 | * @author cenxiaozhong 20 | * @since 1.0.0 21 | */ 22 | public class UrlCommonException extends RuntimeException { 23 | 24 | public UrlCommonException() { 25 | } 26 | 27 | public UrlCommonException(String msg) { 28 | super(msg); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /sample/src/main/res/menu/toolbar_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 14 | 19 | 20 | 25 | 26 | 31 | 32 | 33 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/JsAccessEntrace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import android.webkit.ValueCallback; 20 | 21 | /** 22 | * @author cenxiaozhong 23 | * @date 2017/5/14 24 | * @since 1.0.0 25 | */ 26 | public interface JsAccessEntrace extends QuickCallJs { 27 | 28 | 29 | void callJs(String js, ValueCallback callback); 30 | 31 | void callJs(String js); 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/IAgentWebSettings.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import android.webkit.WebView; 20 | 21 | /** 22 | * @author cenxiaozhong 23 | * @since 1.0.0 24 | */ 25 | 26 | public interface IAgentWebSettings { 27 | 28 | IAgentWebSettings toSetting(WebView webView); 29 | 30 | T getWebSettings(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/WebSecurityCheckLogic.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import androidx.collection.ArrayMap; 20 | import android.webkit.WebView; 21 | 22 | 23 | /** 24 | * @author cenxiaozhong 25 | */ 26 | public interface WebSecurityCheckLogic { 27 | void dealHoneyComb(WebView view); 28 | void dealJsInterface(ArrayMap objects,AgentWeb.SecurityType securityType); 29 | } 30 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/JsInterfaceHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import java.util.Map; 20 | 21 | /** 22 | * @author cenxiaozhong 23 | * @date 2017/5/13 24 | * @since 1.0.0 25 | */ 26 | public interface JsInterfaceHolder { 27 | 28 | JsInterfaceHolder addJavaObjects(Map maps); 29 | 30 | JsInterfaceHolder addJavaObject(String k, Object v); 31 | 32 | boolean checkObject(Object v); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /agentweb-core/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/cenxiaozhong/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.create.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -keep class com.just.agentweb.** { 27 | *; 28 | } 29 | -dontwarn com.just.agentweb.** -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/WebCreator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import android.webkit.WebView; 20 | import android.widget.FrameLayout; 21 | /** 22 | * @author cenxiaozhong 23 | * @since 1.0.0 24 | */ 25 | public interface WebCreator extends IWebIndicator { 26 | WebCreator create(); 27 | 28 | WebView getWebView(); 29 | 30 | FrameLayout getWebParentLayout(); 31 | 32 | int getWebViewType(); 33 | } 34 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/IVideo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import android.view.View; 20 | import android.webkit.WebChromeClient; 21 | 22 | 23 | /** 24 | * @author cenxiaozhong 25 | * @date 2017/6/10 26 | * @since 2.0.0 27 | */ 28 | public interface IVideo { 29 | 30 | 31 | void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback); 32 | 33 | 34 | void onHideCustomView(); 35 | 36 | 37 | boolean isVideoState(); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/HookManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | 20 | /** 21 | * @author cenxiaozhong 22 | * @since 1.0.0 23 | */ 24 | public class HookManager { 25 | 26 | public static AgentWeb hookAgentWeb(AgentWeb agentWeb, AgentWeb.AgentBuilder agentBuilder) { 27 | return agentWeb; 28 | } 29 | 30 | public static boolean permissionHook(String url,String[]permissions){ 31 | return true; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 14 | 18 | 19 | 25 | 26 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/widget/CommonIndicator.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.widget; 2 | 3 | import android.content.Context; 4 | import androidx.annotation.Nullable; 5 | import android.util.AttributeSet; 6 | import android.view.View; 7 | import android.widget.FrameLayout; 8 | 9 | import com.just.agentweb.BaseIndicatorView; 10 | 11 | /** 12 | * Created by cenxiaozhong on 2017/5/26. 13 | * source code https://github.com/Justson/AgentWeb 14 | */ 15 | 16 | public class CommonIndicator extends BaseIndicatorView { 17 | public CommonIndicator(Context context) { 18 | super(context); 19 | } 20 | 21 | public CommonIndicator(Context context, @Nullable AttributeSet attrs) { 22 | super(context, attrs); 23 | } 24 | 25 | public CommonIndicator(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 26 | super(context, attrs, defStyleAttr); 27 | } 28 | 29 | 30 | @Override 31 | public void show() { 32 | this.setVisibility(View.VISIBLE); 33 | } 34 | 35 | @Override 36 | public void hide() { 37 | this.setVisibility(View.GONE); 38 | } 39 | 40 | 41 | @Override 42 | public LayoutParams offerLayoutParams() { 43 | return new FrameLayout.LayoutParams(-1, -1); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/IndicatorController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import android.webkit.WebView; 20 | /** 21 | * @author cenxiaozhong 22 | * @update 4.0.0 23 | * @since 1.0.0 24 | */ 25 | 26 | public interface IndicatorController { 27 | 28 | void progress(WebView v, int newProgress); 29 | 30 | BaseIndicatorSpec offerIndicator(); 31 | 32 | void showIndicator(); 33 | 34 | void setProgress(int newProgress); 35 | 36 | void finish(); 37 | } 38 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/AgentWebFileProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import android.content.Context; 20 | import android.content.pm.ProviderInfo; 21 | import androidx.annotation.NonNull; 22 | import androidx.core.content.FileProvider; 23 | 24 | /** 25 | * @since 2.0.0 26 | * @author cenxiaozhong 27 | */ 28 | public class AgentWebFileProvider extends FileProvider { 29 | 30 | @Override 31 | public void attachInfo(@NonNull Context context, @NonNull ProviderInfo info) { 32 | super.attachInfo(context, info); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/QuickCallJs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import android.os.Build; 20 | import androidx.annotation.RequiresApi; 21 | import android.webkit.ValueCallback; 22 | 23 | 24 | /** 25 | * @author cenxiaozhong 26 | * @date 2017/5/29 27 | * @since 1.0.0 28 | */ 29 | public interface QuickCallJs { 30 | @RequiresApi(Build.VERSION_CODES.KITKAT) 31 | void quickCallJs(String method, ValueCallback callback, String... params); 32 | 33 | void quickCallJs(String method, String... params); 34 | 35 | void quickCallJs(String method); 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | COMPILE_SDK_VERSION=34 14 | BUILD_TOOL_VERSION=34.0.0 15 | SUPPORT_LIB_VERSION=34.0.0 16 | TARGET_SDK_VERSION=34 17 | VERSION_NAME="5.0.8" 18 | android.useAndroidX=true 19 | android.enableJetifier=true 20 | # When configured, Gradle will run in incubating parallel mode. 21 | # This option should only be used with decoupled projects. More details, visit 22 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 23 | # org.gradle.parallel=true 24 | #systemProp.http.proxyHost=127.0.0.1 25 | #systemProp.http.proxyPort=1087 26 | #systemProp.https.proxyHost=127.0.0.1 27 | #systemProp.https.proxyPort=1087 28 | android.injected.testOnly=false 29 | android.nonFinalResIds=false 30 | #org.gradle.java.home=/Applications/Android\ Studio.app/Contents/jbr/Contents/Home/ -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/common/AndroidInterface.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.common; 2 | 3 | import android.content.Context; 4 | import android.os.Handler; 5 | import android.os.Looper; 6 | import android.util.Log; 7 | import android.webkit.JavascriptInterface; 8 | import android.widget.Toast; 9 | 10 | import com.just.agentweb.AgentWeb; 11 | 12 | /** 13 | * Created by cenxiaozhong on 2017/5/14. 14 | * source code https://github.com/Justson/AgentWeb 15 | */ 16 | 17 | public class AndroidInterface { 18 | 19 | private Handler deliver = new Handler(Looper.getMainLooper()); 20 | private AgentWeb agent; 21 | private Context context; 22 | 23 | public AndroidInterface(AgentWeb agent, Context context) { 24 | this.agent = agent; 25 | this.context = context; 26 | } 27 | 28 | 29 | 30 | @JavascriptInterface 31 | public void callAndroid(final String msg) { 32 | 33 | deliver.post(new Runnable() { 34 | @Override 35 | public void run() { 36 | 37 | Log.i("Info", "main Thread:" + Thread.currentThread()); 38 | Toast.makeText(context.getApplicationContext(), "" + msg, Toast.LENGTH_LONG).show(); 39 | } 40 | }); 41 | 42 | 43 | Log.i("Info", "Thread:" + Thread.currentThread()); 44 | 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/WebListenerManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import android.webkit.DownloadListener; 20 | import android.webkit.WebChromeClient; 21 | import android.webkit.WebView; 22 | import android.webkit.WebViewClient; 23 | 24 | /** 25 | * @author cenxiaozhong 26 | * @date 2017/5/13 27 | * @since 1.0.0 28 | */ 29 | public interface WebListenerManager { 30 | WebListenerManager setWebChromeClient(WebView webview, WebChromeClient webChromeClient); 31 | WebListenerManager setWebViewClient(WebView webView, WebViewClient webViewClient); 32 | WebListenerManager setDownloader(WebView webView, DownloadListener downloadListener); 33 | } 34 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/widget/SmartRefreshWebLayout.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.widget; 2 | 3 | import android.app.Activity; 4 | import androidx.annotation.NonNull; 5 | import androidx.annotation.Nullable; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.webkit.WebView; 9 | 10 | import com.just.agentweb.IWebLayout; 11 | import com.just.agentweb.sample.R; 12 | import com.scwang.smartrefresh.layout.SmartRefreshLayout; 13 | 14 | /** 15 | * Created by cenxiaozhong on 2017/8/14. 16 | */ 17 | 18 | public class SmartRefreshWebLayout implements IWebLayout { 19 | 20 | private final SmartRefreshLayout mSmartRefreshLayout; 21 | private final WebView mWebView; 22 | 23 | public SmartRefreshWebLayout(Activity activity){ 24 | 25 | View mView=activity.getLayoutInflater().inflate(R.layout.fragment_srl_web,null); 26 | View smarkView = mView.findViewById(R.id.smarkLayout); 27 | mSmartRefreshLayout = (SmartRefreshLayout) smarkView; 28 | mWebView = (WebView) mSmartRefreshLayout.findViewById(R.id.webView); 29 | 30 | } 31 | 32 | @NonNull 33 | @Override 34 | public ViewGroup getLayout() { 35 | return mSmartRefreshLayout; 36 | } 37 | 38 | @Nullable 39 | @Override 40 | public WebView getWebView() { 41 | return mWebView; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | 19 | 27 | 28 | 29 | 30 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_web.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 21 | 22 | 23 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/fragment_srl_web.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | 29 | 30 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/IWebLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import androidx.annotation.NonNull; 20 | import androidx.annotation.Nullable; 21 | import android.view.ViewGroup; 22 | import android.webkit.WebView; 23 | 24 | /** 25 | * Created by cenxiaozhong on 2017/7/1. 26 | */ 27 | /** 28 | * @author cenxiaozhong 29 | * @date 2017/7/1 30 | * @update 4.0.0 31 | * @since 1.0.0 32 | */ 33 | public interface IWebLayout { 34 | 35 | /** 36 | * 37 | * @return WebView 的父控件 38 | */ 39 | @NonNull V getLayout(); 40 | 41 | /** 42 | * 43 | * @return 返回 WebView 或 WebView 的子View ,返回null AgentWeb 内部会创建适当 WebView 44 | */ 45 | @Nullable T getWebView(); 46 | } 47 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_native_download.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | 19 | 27 | 28 | 29 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/IUrlLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import java.util.Map; 20 | 21 | /** 22 | * @author cenxiaozhong 23 | * @date 2017/6/3 24 | * @update 4.0.0 25 | * @since 2.0.0 26 | */ 27 | public interface IUrlLoader { 28 | 29 | 30 | void loadUrl(String url); 31 | 32 | void loadUrl(String url, Map headers); 33 | 34 | void reload(); 35 | 36 | void loadData(String data, String mimeType, String encoding); 37 | 38 | void stopLoading(); 39 | 40 | void loadDataWithBaseURL(String baseUrl, String data, 41 | String mimeType, String encoding, String historyUrl); 42 | 43 | void postUrl(String url, byte[] params); 44 | 45 | HttpHeaders getHttpHeaders(); 46 | } 47 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/widget/WebLayout.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.widget; 2 | 3 | import android.app.Activity; 4 | import androidx.annotation.NonNull; 5 | import androidx.annotation.Nullable; 6 | import android.view.LayoutInflater; 7 | import android.view.ViewGroup; 8 | import android.webkit.WebView; 9 | 10 | import com.just.agentweb.IWebLayout; 11 | import com.just.agentweb.sample.R; 12 | import com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout; 13 | 14 | /** 15 | * Created by cenxiaozhong on 2017/7/1. 16 | * source code https://github.com/Justson/AgentWeb 17 | */ 18 | 19 | public class WebLayout implements IWebLayout { 20 | 21 | private Activity mActivity; 22 | private final TwinklingRefreshLayout mTwinklingRefreshLayout; 23 | private WebView mWebView = null; 24 | 25 | public WebLayout(Activity activity) { 26 | this.mActivity = activity; 27 | mTwinklingRefreshLayout = (TwinklingRefreshLayout) LayoutInflater.from(activity).inflate(R.layout.fragment_twk_web, null); 28 | mTwinklingRefreshLayout.setPureScrollModeOn(); 29 | mWebView = (WebView) mTwinklingRefreshLayout.findViewById(R.id.webView); 30 | } 31 | 32 | @NonNull 33 | @Override 34 | public ViewGroup getLayout() { 35 | return mTwinklingRefreshLayout; 36 | } 37 | 38 | @Nullable 39 | @Override 40 | public WebView getWebView() { 41 | return mWebView; 42 | } 43 | 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/client/SonicWebViewClient.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.client; 2 | 3 | import android.annotation.TargetApi; 4 | import android.webkit.WebResourceRequest; 5 | import android.webkit.WebResourceResponse; 6 | import android.webkit.WebView; 7 | 8 | import com.just.agentweb.MiddlewareWebClientBase; 9 | import com.tencent.sonic.sdk.SonicSession; 10 | 11 | /** 12 | * Created by cenxiaozhong on 2017/12/17. 13 | */ 14 | 15 | public class SonicWebViewClient extends MiddlewareWebClientBase { 16 | 17 | private SonicSession sonicSession; 18 | 19 | public SonicWebViewClient(SonicSession sonicSession) { 20 | this.sonicSession=sonicSession; 21 | } 22 | 23 | @Override 24 | public void onPageFinished(WebView view, String url) { 25 | super.onPageFinished(view, url); 26 | if (sonicSession != null) { 27 | sonicSession.getSessionClient().pageFinish(url); 28 | } 29 | } 30 | 31 | @TargetApi(21) 32 | @Override 33 | public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) { 34 | return shouldInterceptRequest(view, request.getUrl().toString()); 35 | } 36 | @Override 37 | public WebResourceResponse shouldInterceptRequest(WebView view, String url) { 38 | if (sonicSession != null) { 39 | return (WebResourceResponse) sonicSession.getSessionClient().requestResource(url); 40 | } 41 | return null; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/sonic/SonicWebViewClient.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.sonic; 2 | 3 | import android.annotation.TargetApi; 4 | import android.webkit.WebResourceRequest; 5 | import android.webkit.WebResourceResponse; 6 | import android.webkit.WebView; 7 | 8 | import com.just.agentweb.MiddlewareWebClientBase; 9 | import com.tencent.sonic.sdk.SonicSession; 10 | 11 | /** 12 | * Created by cenxiaozhong on 2017/12/17. 13 | */ 14 | 15 | public class SonicWebViewClient extends MiddlewareWebClientBase { 16 | 17 | private SonicSession sonicSession; 18 | 19 | public SonicWebViewClient(SonicSession sonicSession) { 20 | this.sonicSession=sonicSession; 21 | } 22 | 23 | @Override 24 | public void onPageFinished(WebView view, String url) { 25 | super.onPageFinished(view, url); 26 | if (sonicSession != null) { 27 | sonicSession.getSessionClient().pageFinish(url); 28 | } 29 | } 30 | 31 | @TargetApi(21) 32 | @Override 33 | public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) { 34 | return shouldInterceptRequest(view, request.getUrl().toString()); 35 | } 36 | 37 | @Override 38 | public WebResourceResponse shouldInterceptRequest(WebView view, String url) { 39 | if (sonicSession != null) { 40 | return (WebResourceResponse) sonicSession.getSessionClient().requestResource(url); 41 | } 42 | return null; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/common/GuideItemEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb.sample.common; 18 | 19 | /** 20 | * @author cenxiaozhong 21 | * @date 2018/7/15 22 | * @since 1.0.0 23 | */ 24 | public class GuideItemEntity { 25 | 26 | private String guideTitle; 27 | private int guideDictionary; 28 | private int extra; 29 | 30 | public GuideItemEntity(String guideTitle, int guideDictionary) { 31 | this.guideTitle = guideTitle; 32 | this.guideDictionary = guideDictionary; 33 | } 34 | 35 | 36 | public String getGuideTitle() { 37 | return guideTitle; 38 | } 39 | 40 | public void setGuideTitle(String guideTitle) { 41 | this.guideTitle = guideTitle; 42 | } 43 | 44 | public int getGuideDictionary() { 45 | return guideDictionary; 46 | } 47 | 48 | public void setGuideDictionary(int guideDictionary) { 49 | this.guideDictionary = guideDictionary; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /sample/src/main/assets/upload_file/event.js: -------------------------------------------------------------------------------- 1 | // ---------- 事件绑定与删除绑定 ---------- // 2 | function bindEvent(element, eventName, func) { 3 | var events = element['the'+eventName]; //用于保存某个事件序列 4 | if(!events) { //如果不存在一个序列,则创建它,并加入HTML标记当中的onEvent = function(){}形式的绑定 5 | events = element['the'+eventName] = []; 6 | if (element['on'+eventName]) { events.push(element['on'+eventName]); } 7 | } 8 | 9 | //检测是否为重复绑定 10 | for(var i=0; i= events.length) { events.push(func); } 16 | 17 | // 重新定义这个事件的执行方式 18 | element['on'+eventName] = function(event) { 19 | event = event || (function() { //修复IE的事件对象 20 | var e = window.event; 21 | e.preventDefault = function() { e.returnValue = false; } 22 | e.stopPropagation = function() { e.cancelBubble = true; } 23 | //根据需要继续修复 24 | return e; 25 | })(); 26 | //顺序执行这些函数 27 | for(var i=0; i callback) { 42 | if (mFileCompressEngine == null) { 43 | callback.onReceiveValue(uri); 44 | } else { 45 | mFileCompressEngine.compressFile(type, uri, callback); 46 | } 47 | } 48 | 49 | public interface FileCompressEngine { 50 | void compressFile(String type, Uri[] uri, ValueCallback callback); 51 | } 52 | 53 | 54 | } 55 | 56 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/activity/WebActivity.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.activity; 2 | 3 | /** 4 | * Created by cenxiaozhong on 2017/5/22. 5 | *

6 | * 7 | */ 8 | 9 | public class WebActivity extends BaseWebActivity { 10 | 11 | @Override 12 | public String getUrl() { 13 | return super.getUrl(); 14 | } 15 | 16 | @Override 17 | protected void onStart() { 18 | super.onStart(); 19 | } 20 | 21 | @Override 22 | protected void onResume() { 23 | super.onResume(); 24 | 25 | //测试Cookies 26 | /*try { 27 | 28 | String targetUrl=""; 29 | Log.i("Info","cookies:"+ AgentWebConfig.getCookiesByUrl(targetUrl="http://www.jd.com")); 30 | AgentWebConfig.removeAllCookies(new ValueCallback() { 31 | @Override 32 | public void onReceiveValue(Boolean value) { 33 | Log.i("Info","onResume():"+value); 34 | } 35 | }); 36 | 37 | String tagInfo=AgentWebConfig.getCookiesByUrl(targetUrl); 38 | Log.i("Info","tag:"+tagInfo); 39 | AgentWebConfig.syncCookie("http://www.jd.com","ID=IDHl3NVU0N3ltZm9OWHhubHVQZW1BRThLdGhLaFc5TnVtQWd1S2g1REcwNVhTS3RXQVFBQEBFDA984906B62C444931EA0"); 40 | String tag=AgentWebConfig.getCookiesByUrl(targetUrl); 41 | Log.i("Info","tag:"+tag); 42 | AgentWebConfig.removeSessionCookies(); 43 | Log.i("Info","removeSessionCookies:"+AgentWebConfig.getCookiesByUrl(targetUrl)); 44 | } catch (Exception e){ 45 | e.printStackTrace(); 46 | }*/ 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /sample/src/main/assets/sms/sms.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 电话短信邮件 9 | 10 | 32 | 33 | 34 |

35 | 电话短信邮件跳转 36 |
37 |
38 | 39 |
40 |
41 | 42 | 43 | 44 | 45 | 46 | 54 |

电话 55 | 短信 56 | 邮件 57 | 打开应用内部页面 58 | 打开微信 59 |

60 |
61 |
62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/WebSecurityControllerImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import android.os.Build; 20 | import androidx.collection.ArrayMap; 21 | import android.webkit.WebView; 22 | 23 | 24 | /** 25 | * @author cenxiaozhong 26 | */ 27 | public class WebSecurityControllerImpl implements WebSecurityController { 28 | 29 | private WebView mWebView; 30 | private ArrayMap mMap; 31 | private AgentWeb.SecurityType mSecurityType; 32 | 33 | public WebSecurityControllerImpl(WebView view, ArrayMap map, AgentWeb.SecurityType securityType) { 34 | this.mWebView = view; 35 | this.mMap = map; 36 | this.mSecurityType = securityType; 37 | } 38 | 39 | @Override 40 | public void check(WebSecurityCheckLogic webSecurityCheckLogic) { 41 | if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) { 42 | webSecurityCheckLogic.dealHoneyComb(mWebView); 43 | } 44 | if (mMap != null && mSecurityType == AgentWeb.SecurityType.STRICT_CHECK && !mMap.isEmpty()) { 45 | webSecurityCheckLogic.dealJsInterface(mMap, mSecurityType); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/BaseIndicatorView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import android.content.Context; 20 | import androidx.annotation.Nullable; 21 | import android.util.AttributeSet; 22 | import android.widget.FrameLayout; 23 | 24 | 25 | /** 26 | * @author cenxiaozhong 27 | * @date 2017/5/12 28 | * @since 1.0.0 29 | */ 30 | public abstract class BaseIndicatorView extends FrameLayout implements BaseIndicatorSpec,LayoutParamsOffer{ 31 | public BaseIndicatorView(Context context) { 32 | super(context); 33 | } 34 | 35 | public BaseIndicatorView(Context context, @Nullable AttributeSet attrs) { 36 | super(context, attrs); 37 | } 38 | 39 | public BaseIndicatorView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 40 | super(context, attrs, defStyleAttr); 41 | } 42 | 43 | @Override 44 | public void reset() { 45 | } 46 | 47 | @Override 48 | public void setProgress(int newProgress) { 49 | } 50 | 51 | @Override 52 | public void show() { 53 | } 54 | 55 | @Override 56 | public void hide() { 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/MiddlewareWebChromeBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import android.webkit.WebChromeClient; 20 | 21 | /** 22 | * @author cenxiaozhong 23 | * @date 2017/12/16 24 | * @since 3.0.0 25 | */ 26 | public class MiddlewareWebChromeBase extends WebChromeClientDelegate { 27 | 28 | private MiddlewareWebChromeBase mMiddlewareWebChromeBase; 29 | 30 | protected MiddlewareWebChromeBase(WebChromeClient webChromeClient) { 31 | super(webChromeClient); 32 | } 33 | 34 | protected MiddlewareWebChromeBase() { 35 | super(null); 36 | } 37 | 38 | @Override 39 | final void setDelegate(WebChromeClient delegate) { 40 | super.setDelegate(delegate); 41 | } 42 | 43 | final MiddlewareWebChromeBase enq(MiddlewareWebChromeBase middlewareWebChromeBase) { 44 | setDelegate(middlewareWebChromeBase); 45 | this.mMiddlewareWebChromeBase = middlewareWebChromeBase; 46 | return this.mMiddlewareWebChromeBase; 47 | } 48 | 49 | 50 | final MiddlewareWebChromeBase next() { 51 | return this.mMiddlewareWebChromeBase; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/LollipopFixedWebView.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.content.res.Configuration; 6 | import android.os.Build; 7 | import android.util.AttributeSet; 8 | import android.webkit.WebView; 9 | 10 | /** 11 | * 修复 Android 5.0 & 5.1 打开 WebView 闪退问题: 12 | * 参阅 https://stackoverflow.com/questions/41025200/android-view-inflateexception-error-inflating-class-android-webkit-webview 13 | */ 14 | @SuppressWarnings("unused") 15 | public class LollipopFixedWebView extends WebView { 16 | public LollipopFixedWebView(Context context) { 17 | super(getFixedContext(context)); 18 | } 19 | 20 | public LollipopFixedWebView(Context context, AttributeSet attrs) { 21 | super(getFixedContext(context), attrs); 22 | } 23 | 24 | public LollipopFixedWebView(Context context, AttributeSet attrs, int defStyleAttr) { 25 | super(getFixedContext(context), attrs, defStyleAttr); 26 | } 27 | 28 | @TargetApi(Build.VERSION_CODES.LOLLIPOP) 29 | public LollipopFixedWebView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 30 | super(getFixedContext(context), attrs, defStyleAttr, defStyleRes); 31 | } 32 | 33 | public LollipopFixedWebView(Context context, AttributeSet attrs, int defStyleAttr, boolean privateBrowsing) { 34 | super(getFixedContext(context), attrs, defStyleAttr, privateBrowsing); 35 | } 36 | 37 | public static Context getFixedContext(Context context) { 38 | if (Build.VERSION.SDK_INT >= 21 && Build.VERSION.SDK_INT < 23) { 39 | // Avoid crashing on Android 5 and 6 (API level 21 to 23) 40 | return context.createConfigurationContext(new Configuration()); 41 | } 42 | return context; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /agentweb-filechooser/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'maven-publish' 3 | 4 | android { 5 | compileSdk COMPILE_SDK_VERSION.toInteger() 6 | 7 | defaultConfig { 8 | minSdkVersion 14 9 | namespace 'com.just.agentweb.filechooser' 10 | targetSdkVersion TARGET_SDK_VERSION.toInteger() 11 | versionCode 2 12 | versionName VERSION_NAME 13 | 14 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' 15 | 16 | } 17 | 18 | compileOptions { 19 | sourceCompatibility JavaVersion.VERSION_1_8 20 | targetCompatibility JavaVersion.VERSION_1_8 21 | } 22 | 23 | buildTypes { 24 | release { 25 | minifyEnabled false 26 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 27 | } 28 | } 29 | lintOptions{ 30 | abortOnError false 31 | } 32 | 33 | } 34 | 35 | dependencies { 36 | implementation fileTree(include: ['*.jar'], dir: 'libs') 37 | testImplementation 'junit:junit:4.12' 38 | androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', { 39 | exclude group: 'com.android.support', module: 'support-annotations' 40 | }) 41 | testImplementation 'junit:junit:4.12' 42 | compileOnly 'com.google.android.material:material:1.0.0' 43 | compileOnly 'androidx.legacy:legacy-support-v4:1.0.0' 44 | implementation project(':agentweb-core') 45 | } 46 | 47 | afterEvaluate { 48 | publishing { 49 | publications { 50 | // Creates a Maven publication called "release". 51 | release(MavenPublication) { 52 | groupId = 'com.github.Justson.AgentWeb' 53 | artifactId = 'agentweb-filechooser' 54 | version = 'v5.0.7-androidx' 55 | } 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /agentweb-core/src/main/res/values-zh/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 该任务已经存在 , 请勿重复点击下载! 3 | 提示 4 | 您正在使用手机流量 , 继续下载该文件吗? 5 | 下载 6 | 取消 7 | 下载失败! 8 | 当前进度:%s 9 | 已下载:%s 10 | 您有一条新通知 11 | 文件下载 12 | 点击打开 13 | 即将开始下载文件 14 | 相机 15 | 文件 16 | 加载中 ... 17 | 您需要离开%s前往其他应用吗? 18 | 离开 19 | 证书颁发机构不受信任, 20 | 选择的文件不能大于%sMB 21 | 出错啦! 点击空白处刷新 ~ 22 | 证书已过期, 23 | 证书主机名不匹配, 24 | 该证书尚未生效, 25 | SSL 认证错误, 26 | 你确定要访问该网页吗? 27 | SSL 认证错误 28 | 确定 29 | 30 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/DefaultWebLifeCycleImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import android.os.Build; 20 | import android.webkit.WebView; 21 | 22 | /** 23 | * @author cenxiaozhong 24 | * @date 2017/6/3 25 | * @since 2.0.0 26 | */ 27 | public class DefaultWebLifeCycleImpl implements WebLifeCycle { 28 | private WebView mWebView; 29 | DefaultWebLifeCycleImpl(WebView webView) { 30 | this.mWebView = webView; 31 | } 32 | 33 | @Override 34 | public void onResume() { 35 | if (this.mWebView != null) { 36 | if (Build.VERSION.SDK_INT >= 11){ 37 | this.mWebView.onResume(); 38 | } 39 | this.mWebView.resumeTimers(); 40 | } 41 | } 42 | 43 | @Override 44 | public void onPause() { 45 | if (this.mWebView != null) { 46 | if (Build.VERSION.SDK_INT >= 11){ 47 | this.mWebView.onPause(); 48 | } 49 | this.mWebView.pauseTimers(); 50 | } 51 | } 52 | 53 | @Override 54 | public void onDestroy() { 55 | if(this.mWebView!=null){ 56 | this.mWebView.resumeTimers(); 57 | } 58 | AgentWebUtils.clearWebView(this.mWebView); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/client/MiddlewareWebViewClient.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.client; 2 | 3 | import android.util.Log; 4 | import android.webkit.WebResourceRequest; 5 | import android.webkit.WebView; 6 | 7 | import com.just.agentweb.MiddlewareWebClientBase; 8 | 9 | /** 10 | * Created by cenxiaozhong on 2017/12/16. 11 | * 12 | * 13 | * 方法的执行顺序,例如下面用了7个中间件一个 WebViewClient 14 | * 15 | * .useMiddlewareWebClient(getMiddlewareWebClient()) // 1 16 | * .useMiddlewareWebClient(getMiddlewareWebClient()) // 2 17 | * .useMiddlewareWebClient(getMiddlewareWebClient()) // 3 18 | * .useMiddlewareWebClient(getMiddlewareWebClient()) // 4 19 | * .useMiddlewareWebClient(getMiddlewareWebClient()) // 5 20 | * .useMiddlewareWebClient(getMiddlewareWebClient()) // 6 21 | * .useMiddlewareWebClient(getMiddlewareWebClient()) // 7 22 | * DefaultWebClient // 8 23 | * .setWebViewClient(mWebViewClient) // 9 24 | * 25 | * 26 | * 典型的洋葱模型 27 | * 对象内部的方法执行顺序: 1->2->3->4->5->6->7->8->9->8->7->6->5->4->3->2->1 28 | * 29 | * 30 | * 中断中间件的执行, 删除super.methodName(...) 这行即可 31 | * 32 | */ 33 | 34 | public class MiddlewareWebViewClient extends MiddlewareWebClientBase { 35 | 36 | public MiddlewareWebViewClient() { 37 | } 38 | 39 | private static int count = 1; 40 | 41 | @Override 42 | public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) { 43 | Log.i("Info", "MiddlewareWebViewClient -- > shouldOverrideUrlLoading:" + request.getUrl().toString() + " c:" + (count++)); 44 | return super.shouldOverrideUrlLoading(view, request); 45 | 46 | } 47 | 48 | @Override 49 | public boolean shouldOverrideUrlLoading(WebView view, String url) { 50 | Log.i("Info", "MiddlewareWebViewClient -- > shouldOverrideUrlLoading:" + url + " c:" + (count++)); 51 | return super.shouldOverrideUrlLoading(view, url); 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /sample/src/main/java/com/just/agentweb/sample/app/App.java: -------------------------------------------------------------------------------- 1 | package com.just.agentweb.sample.app; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | 7 | import com.just.agentweb.AgentWebCompat; 8 | import com.just.agentweb.sample.service.WebService; 9 | import com.queue.library.GlobalQueue; 10 | 11 | /** 12 | * Created by cenxiaozhong on 2017/5/23. 13 | * source code https://github.com/Justson/AgentWeb 14 | */ 15 | 16 | public class App extends Application { 17 | 18 | @Override 19 | public void onCreate() { 20 | super.onCreate(); 21 | 22 | /** 23 | * 说明, WebView 初处初始化耗时 250ms 左右。 24 | * 提前初始化WebView ,好处可以提升页面初始化速度,减少白屏时间, 25 | * 坏处,拖慢了App 冷启动速度,如果 WebView 配合 VasSonic 使用, 26 | * 建议不要在此处提前初始化 WebView 。 27 | */ 28 | // WebView mWebView=new WebView(new MutableContextWrapper(this)); 29 | 30 | // if (LeakCanary.isInAnalyzerProcess(this)) { 31 | // // This process is dedicated to LeakCanary for heap analysis. 32 | // // You should not init your app in this process. 33 | // return; 34 | // } 35 | // LeakCanary.install(this); 36 | // Normal app init code... 37 | 38 | //implementation 'com.github.Justson:dispatch-queue:v1.0.5' 39 | GlobalQueue.getMainQueue().postRunnableInIdleRunning(new Runnable() { 40 | @Override 41 | public void run() { 42 | try { 43 | startService(new Intent(App.this, WebService.class)); 44 | } catch (Throwable throwable) { 45 | 46 | } 47 | } 48 | }); 49 | } 50 | 51 | public static Context mContext; 52 | 53 | @Override 54 | protected void attachBaseContext(Context base) { 55 | super.attachBaseContext(base); 56 | mContext = base; 57 | AgentWebCompat.setDataDirectorySuffix(base); 58 | } 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/LogUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import android.util.Log; 20 | 21 | /** 22 | * @author cenxiaozhong 23 | * @date 2017/5/28 24 | * @since 1.0.0 25 | */ 26 | class LogUtils { 27 | 28 | private static final String PREFIX = "agentweb-"; 29 | 30 | static boolean isDebug() { 31 | return AgentWebConfig.DEBUG; 32 | } 33 | 34 | static void i(String tag, String message) { 35 | 36 | if (isDebug()) { 37 | Log.i(PREFIX.concat(tag), message); 38 | } 39 | } 40 | 41 | static void v(String tag, String message) { 42 | 43 | if (isDebug()) { 44 | Log.v(PREFIX.concat(tag), message); 45 | } 46 | 47 | } 48 | 49 | static void safeCheckCrash(String tag, String msg, Throwable tr) { 50 | if (isDebug()) { 51 | throw new RuntimeException(PREFIX.concat(tag) + " " + msg, tr); 52 | } else { 53 | Log.e(PREFIX.concat(tag), msg, tr); 54 | } 55 | } 56 | 57 | static void e(String tag, String msg, Throwable tr) { 58 | Log.e(tag, msg, tr); 59 | } 60 | 61 | static void e(String tag, String message) { 62 | 63 | if (isDebug()) { 64 | Log.e(PREFIX.concat(tag), message); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /sample/src/main/assets/js_interaction/button.css: -------------------------------------------------------------------------------- 1 | 2 | .button { 3 | color: #666; 4 | background-color: #EEE; 5 | border-color: #EEE; 6 | font-weight: 300; 7 | font-size: 16px; 8 | font-family: "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; 9 | text-decoration: none; 10 | text-align: center; 11 | line-height: 40px; 12 | height: 40px; 13 | padding: 0 40px; 14 | margin: 0; 15 | display: inline-block; 16 | appearance: none; 17 | cursor: pointer; 18 | border: none; 19 | -webkit-box-sizing: border-box; 20 | -moz-box-sizing: border-box; 21 | box-sizing: border-box; 22 | -webkit-transition-property: all; 23 | transition-property: all; 24 | -webkit-transition-duration: .3s; 25 | transition-duration: .3s; 26 | /* 27 | * Disabled State 28 | * 29 | * The disabled state uses the class .disabled, is-disabled, 30 | * and the form attribute disabled="disabled". 31 | * The use of !important is only added because this is a state 32 | * that must be applied to all buttons when in a disabled state. 33 | */ } 34 | 35 | .button-glow { 36 | -webkit-animation-duration: 3s; 37 | animation-duration: 3s; 38 | -webkit-animation-iteration-count: infinite; 39 | animation-iteration-count: infinite; 40 | -webkit-animation-name: glowing; 41 | animation-name: glowing; } 42 | 43 | .button-rounded { 44 | border-radius: 4px; } 45 | 46 | /* 47 | * Base Colors 48 | * 49 | * Create colors for buttons 50 | * (.button-primary, .button-secondary, etc.) 51 | */ 52 | .button-primary, 53 | .button-primary-flat { 54 | background-color: #1B9AF7; 55 | border-color: #1B9AF7; 56 | color: #FFF; } 57 | 58 | /* 59 | * Border Buttons 60 | * 61 | * These buttons have no fill they only have a 62 | * border to define their hit target. 63 | */ 64 | .button-border, .button-border-thin, .button-border-thick { 65 | background: none; 66 | border-width: 2px; 67 | border-style: solid; 68 | line-height: 36px; } 69 | 70 | -------------------------------------------------------------------------------- /agentweb-core/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'maven-publish' 3 | 4 | android { 5 | compileSdk COMPILE_SDK_VERSION.toInteger() 6 | 7 | 8 | defaultConfig { 9 | minSdkVersion 14 10 | targetSdkVersion TARGET_SDK_VERSION.toInteger() 11 | namespace 'com.just.agentweb' 12 | versionCode 3 13 | versionName VERSION_NAME 14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 15 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' 16 | 17 | } 18 | 19 | buildTypes { 20 | release { 21 | minifyEnabled true 22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | lintOptions { 26 | abortOnError false 27 | } 28 | repositories { 29 | flatDir { 30 | dirs 'libs', 'providedLibs' 31 | } 32 | } 33 | compileOptions { 34 | sourceCompatibility JavaVersion.VERSION_1_8 35 | targetCompatibility JavaVersion.VERSION_1_8 36 | } 37 | // defaultPublishConfig "debug" 38 | } 39 | 40 | dependencies { 41 | compileOnly fileTree(include: ['*.jar'], dir: 'libs') 42 | androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', { 43 | exclude group: 'com.android.support', module: 'support-annotations' 44 | }) 45 | testImplementation 'junit:junit:4.12' 46 | compileOnly 'com.github.Justson:Downloader:v5.0.4-androidx' 47 | compileOnly 'com.google.android.material:material:1.0.0' 48 | compileOnly 'androidx.legacy:legacy-support-v4:1.0.0' 49 | compileOnly fileTree(include: ['*.jar'], dir: 'providedLibs') 50 | } 51 | 52 | publishing { 53 | publications { 54 | // Creates a Maven publication called "release". 55 | release(MavenPublication) { 56 | groupId = 'com.github.Justson.AgentWeb' 57 | artifactId = 'agentweb-core' 58 | version = 'v5.0.7-androidx' 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/MiddlewareWebClientBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import android.webkit.WebViewClient; 20 | 21 | /** 22 | * @author cenxiaozhong 23 | * @date 2017/12/15 24 | * @since 3.0.0 25 | */ 26 | public class MiddlewareWebClientBase extends WebViewClientDelegate { 27 | private MiddlewareWebClientBase mMiddleWrareWebClientBase; 28 | private static String TAG = MiddlewareWebClientBase.class.getSimpleName(); 29 | 30 | MiddlewareWebClientBase(MiddlewareWebClientBase client) { 31 | super(client); 32 | this.mMiddleWrareWebClientBase = client; 33 | } 34 | 35 | protected MiddlewareWebClientBase(WebViewClient client) { 36 | super(client); 37 | } 38 | 39 | protected MiddlewareWebClientBase() { 40 | super(null); 41 | } 42 | 43 | final MiddlewareWebClientBase next() { 44 | return this.mMiddleWrareWebClientBase; 45 | } 46 | 47 | @Override 48 | final void setDelegate(WebViewClient delegate) { 49 | super.setDelegate(delegate); 50 | 51 | } 52 | 53 | final MiddlewareWebClientBase enq(MiddlewareWebClientBase middleWrareWebClientBase) { 54 | setDelegate(middleWrareWebClientBase); 55 | this.mMiddleWrareWebClientBase = middleWrareWebClientBase; 56 | return middleWrareWebClientBase; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/EventHandlerImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import android.view.KeyEvent; 20 | import android.webkit.WebView; 21 | 22 | /** 23 | * IEventHandler 对事件的处理,主要是针对 24 | * 视屏状态进行了处理 , 如果当前状态为 视频状态 25 | * 则先退出视频。 26 | * 27 | * @author cenxiaozhong 28 | * @date 2017/6/3 29 | * @since 2.0.0 30 | */ 31 | public class EventHandlerImpl implements IEventHandler { 32 | private WebView mWebView; 33 | private EventInterceptor mEventInterceptor; 34 | 35 | public static final EventHandlerImpl getInstantce(WebView view, EventInterceptor eventInterceptor) { 36 | return new EventHandlerImpl(view, eventInterceptor); 37 | } 38 | 39 | public EventHandlerImpl(WebView webView, EventInterceptor eventInterceptor) { 40 | this.mWebView = webView; 41 | this.mEventInterceptor = eventInterceptor; 42 | } 43 | 44 | @Override 45 | public boolean onKeyDown(int keyCode, KeyEvent event) { 46 | if (keyCode == KeyEvent.KEYCODE_BACK) { 47 | return back(); 48 | } 49 | return false; 50 | } 51 | 52 | @Override 53 | public boolean back() { 54 | if (this.mEventInterceptor != null && this.mEventInterceptor.event()) { 55 | return true; 56 | } 57 | if (mWebView != null && mWebView.canGoBack()) { 58 | mWebView.goBack(); 59 | return true; 60 | } 61 | return false; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /agentweb-core/src/main/java/com/just/agentweb/JsAccessEntraceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Justson(https://github.com/Justson/AgentWeb) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.just.agentweb; 18 | 19 | import android.os.Handler; 20 | import android.os.Looper; 21 | import android.webkit.ValueCallback; 22 | import android.webkit.WebView; 23 | 24 | 25 | /** 26 | * @author cenxiaozhong 27 | * @date 2017/6/3 28 | * @since 1.0.0 29 | */ 30 | public class JsAccessEntraceImpl extends BaseJsAccessEntrace { 31 | 32 | private WebView mWebView; 33 | private Handler mHandler = new Handler(Looper.getMainLooper()); 34 | 35 | public static JsAccessEntraceImpl getInstance(WebView webView) { 36 | return new JsAccessEntraceImpl(webView); 37 | } 38 | 39 | private JsAccessEntraceImpl(WebView webView) { 40 | super(webView); 41 | this.mWebView = webView; 42 | } 43 | 44 | private void safeCallJs(final String s, final ValueCallback valueCallback) { 45 | mHandler.post(new Runnable() { 46 | @Override 47 | public void run() { 48 | callJs(s, valueCallback); 49 | } 50 | }); 51 | } 52 | 53 | @Override 54 | public void callJs(String params, final ValueCallback callback) { 55 | if (Thread.currentThread() != Looper.getMainLooper().getThread()) { 56 | safeCallJs(params, callback); 57 | return; 58 | } 59 | super.callJs(params,callback); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/recyclerview_item_download.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | 18 | 26 | 27 | 35 | 36 | 46 | 47 | 48 | 49 |