├── .gradle ├── 6.5 │ ├── executionHistory │ │ ├── executionHistory.bin │ │ └── executionHistory.lock │ ├── fileChanges │ │ └── last-build.bin │ ├── fileContent │ │ └── fileContent.lock │ ├── fileHashes │ │ ├── fileHashes.bin │ │ ├── fileHashes.lock │ │ └── resourceHashesCache.bin │ ├── gc.properties │ └── javaCompile │ │ ├── classAnalysis.bin │ │ ├── jarAnalysis.bin │ │ ├── javaCompile.lock │ │ └── taskHistory.bin ├── buildOutputCleanup │ ├── buildOutputCleanup.lock │ ├── cache.properties │ └── outputFiles.bin ├── checksums │ ├── checksums.lock │ ├── md5-checksums.bin │ └── sha1-checksums.bin └── vcs-1 │ └── gc.properties ├── .idea ├── .gitignore ├── codeStyles │ └── Project.xml ├── compiler.xml ├── dictionaries │ └── fishforest.xml ├── gradle.xml ├── jarRepositories.xml ├── libraries │ ├── Gradle__androidx_activity_activity_1_0_0_aar.xml │ ├── Gradle__androidx_annotation_annotation_1_1_0.xml │ ├── Gradle__androidx_annotation_annotation_experimental_1_0_0_aar.xml │ ├── Gradle__androidx_appcompat_appcompat_1_1_0_aar.xml │ ├── Gradle__androidx_appcompat_appcompat_1_2_0_aar.xml │ ├── Gradle__androidx_appcompat_appcompat_resources_1_1_0_aar.xml │ ├── Gradle__androidx_appcompat_appcompat_resources_1_2_0_aar.xml │ ├── Gradle__androidx_arch_core_core_common_2_1_0.xml │ ├── Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml │ ├── Gradle__androidx_cardview_cardview_1_0_0_aar.xml │ ├── Gradle__androidx_collection_collection_1_1_0.xml │ ├── Gradle__androidx_constraintlayout_constraintlayout_1_1_3_aar.xml │ ├── Gradle__androidx_constraintlayout_constraintlayout_2_0_1_aar.xml │ ├── Gradle__androidx_constraintlayout_constraintlayout_solver_1_1_3.xml │ ├── Gradle__androidx_constraintlayout_constraintlayout_solver_2_0_1.xml │ ├── Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_aar.xml │ ├── Gradle__androidx_core_core_1_1_0_aar.xml │ ├── Gradle__androidx_core_core_1_3_1_aar.xml │ ├── Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml │ ├── Gradle__androidx_customview_customview_1_0_0_aar.xml │ ├── Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml │ ├── Gradle__androidx_fragment_fragment_1_1_0_aar.xml │ ├── Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_common_2_1_0.xml │ ├── Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_livedata_core_2_0_0_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_runtime_2_1_0_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_viewmodel_2_1_0_aar.xml │ ├── Gradle__androidx_loader_loader_1_0_0_aar.xml │ ├── Gradle__androidx_recyclerview_recyclerview_1_1_0_aar.xml │ ├── Gradle__androidx_savedstate_savedstate_1_0_0_aar.xml │ ├── Gradle__androidx_test_core_1_2_0_aar.xml │ ├── Gradle__androidx_test_core_1_3_0_aar.xml │ ├── Gradle__androidx_test_espresso_espresso_core_3_2_0_aar.xml │ ├── Gradle__androidx_test_espresso_espresso_core_3_3_0_aar.xml │ ├── Gradle__androidx_test_espresso_espresso_idling_resource_3_2_0_aar.xml │ ├── Gradle__androidx_test_espresso_espresso_idling_resource_3_3_0_aar.xml │ ├── Gradle__androidx_test_ext_junit_1_1_1_aar.xml │ ├── Gradle__androidx_test_ext_junit_1_1_2_aar.xml │ ├── Gradle__androidx_test_monitor_1_2_0_aar.xml │ ├── Gradle__androidx_test_monitor_1_3_0_aar.xml │ ├── Gradle__androidx_test_runner_1_2_0_aar.xml │ ├── Gradle__androidx_test_runner_1_3_0_aar.xml │ ├── Gradle__androidx_transition_transition_1_2_0_aar.xml │ ├── Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml │ ├── Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml │ ├── Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml │ ├── Gradle__androidx_viewpager2_viewpager2_1_0_0_aar.xml │ ├── Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml │ ├── Gradle__com_google_android_material_material_1_1_0_aar.xml │ ├── Gradle__com_google_android_material_material_1_2_1_aar.xml │ ├── Gradle__com_google_code_findbugs_jsr305_2_0_1.xml │ ├── Gradle__com_squareup_javawriter_2_1_1.xml │ ├── Gradle__javax_inject_javax_inject_1.xml │ ├── Gradle__junit_junit_4_12.xml │ ├── Gradle__junit_junit_4_13_2.xml │ ├── Gradle__net_sf_kxml_kxml2_2_3_0.xml │ ├── Gradle__org_hamcrest_hamcrest_core_1_3.xml │ ├── Gradle__org_hamcrest_hamcrest_integration_1_3.xml │ └── Gradle__org_hamcrest_hamcrest_library_1_3.xml ├── misc.xml ├── modules.xml ├── modules │ ├── app │ │ └── AndroidDemo.app.iml │ ├── ipcserver │ │ └── AndroidDemo.ipcserver.iml │ ├── sslclient │ │ └── AndroidDemo.sslclient.iml │ └── sslserver │ │ └── AndroidDemo.sslserver.iml ├── runConfigurations.xml └── vcs.xml ├── AndroidDemo.iml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── example │ │ └── androiddemo │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── aidl │ │ └── com │ │ │ └── fish │ │ │ └── ipcserver │ │ │ ├── IStudentInfo.aidl │ │ │ ├── RemoteCallback.aidl │ │ │ └── Student.aidl │ ├── assets │ │ └── js.html │ ├── java │ │ └── com │ │ │ ├── example │ │ │ └── androiddemo │ │ │ │ ├── Application │ │ │ │ └── App.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── ams │ │ │ │ ├── AMSActivity.java │ │ │ │ ├── AMSTargetActivity.java │ │ │ │ ├── AMSTargetBroadcast.java │ │ │ │ ├── AMSTargetProvider.java │ │ │ │ └── AMSTargetService.java │ │ │ │ ├── clipchildren │ │ │ │ ├── ClipChildrenActivity.java │ │ │ │ ├── ClipViewGroup.java │ │ │ │ └── SimpleTouchDelegate.java │ │ │ │ ├── clippadding │ │ │ │ ├── ClipPaddingActivity.java │ │ │ │ ├── ClipPaddingView.java │ │ │ │ └── ClipPaddingViewGroup.java │ │ │ │ ├── edittext │ │ │ │ ├── EditTextActivity.java │ │ │ │ └── MyEditText.java │ │ │ │ ├── fileprovider │ │ │ │ ├── FileProviderActivity.java │ │ │ │ └── MyFileProvider.java │ │ │ │ ├── fragment │ │ │ │ ├── FragmentActivity.java │ │ │ │ ├── MyFragment.java │ │ │ │ ├── MyFrameLayout.java │ │ │ │ └── StaticFragmentActivity.java │ │ │ │ ├── ipc │ │ │ │ ├── ExtraData.java │ │ │ │ ├── IPCActivity.java │ │ │ │ └── MyRemoteCallback.java │ │ │ │ ├── motionevent │ │ │ │ ├── MotionEventActivity.java │ │ │ │ ├── MotionView.java │ │ │ │ └── MotionViewGroup.java │ │ │ │ ├── ssl │ │ │ │ ├── MyTrustManager.java │ │ │ │ └── SSLTestActivity.java │ │ │ │ ├── storagepermission │ │ │ │ └── StorageActivity.java │ │ │ │ ├── util │ │ │ │ └── LogTag.java │ │ │ │ ├── webview │ │ │ │ ├── Android2Js.java │ │ │ │ └── WebviewActivity.java │ │ │ │ └── window │ │ │ │ ├── WindowActivity.java │ │ │ │ ├── WindowView.java │ │ │ │ └── WindowViewGroup.java │ │ │ └── fish │ │ │ └── ipcserver │ │ │ └── Student.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_ams.xml │ │ ├── activity_ams_target.xml │ │ ├── activity_clip_children.xml │ │ ├── activity_clip_padding.xml │ │ ├── activity_edit_text.xml │ │ ├── activity_fileprovider.xml │ │ ├── activity_fragment.xml │ │ ├── activity_ipc.xml │ │ ├── activity_main.xml │ │ ├── activity_motion_event.xml │ │ ├── activity_ssl.xml │ │ ├── activity_static_fragment.xml │ │ ├── activity_storage.xml │ │ ├── activity_webview.xml │ │ └── activity_window.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values-night │ │ └── themes.xml │ │ ├── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ ├── styles.xml │ │ └── themes.xml │ │ └── xml │ │ └── file_path.xml │ └── test │ └── java │ └── com │ └── example │ └── androiddemo │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── ipcserver ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── fish │ │ └── ipcserver │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── aidl │ │ └── com │ │ │ └── fish │ │ │ └── ipcserver │ │ │ ├── IStudentInfo.aidl │ │ │ ├── RemoteCallback.aidl │ │ │ └── Student.aidl │ ├── java │ │ └── com │ │ │ └── fish │ │ │ ├── fileprovider │ │ │ └── ReceiveActivity.java │ │ │ └── ipcserver │ │ │ ├── AMSTargetProvider.java │ │ │ ├── MainActivity.java │ │ │ ├── Student.java │ │ │ └── StudentService.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_fileprovider.xml │ │ └── activity_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values-night │ │ └── themes.xml │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── themes.xml │ └── test │ └── java │ └── com │ └── fish │ └── ipcserver │ └── ExampleUnitTest.java ├── local.properties ├── settings.gradle ├── sslclient ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── fish │ │ └── sslclient │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── fish │ │ │ └── sslclient │ │ │ └── MainActivity.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── raw │ │ ├── client.bks │ │ └── clienttrust.bks │ │ ├── values-night │ │ └── themes.xml │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── themes.xml │ └── test │ └── java │ └── com │ └── fish │ └── sslclient │ └── ExampleUnitTest.java └── sslserver ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src ├── androidTest └── java │ └── com │ └── fish │ └── sslserver │ └── ExampleInstrumentedTest.java ├── main ├── AndroidManifest.xml ├── java │ └── com │ │ └── fish │ │ └── sslserver │ │ ├── CreateThread.class │ │ ├── MainActivity.java │ │ ├── MySSLClient$1.class │ │ ├── MySSLClient$SSLDouble1.class │ │ ├── MySSLClient.class │ │ ├── MySSLClient.java │ │ ├── MySSLServer.class │ │ ├── MySSLServer.java │ │ ├── SSLDouble.class │ │ ├── SSLDouble.java │ │ ├── SSLDouble1.class │ │ ├── SSLKey │ │ ├── bcprov-jdk16-1.46.jar │ │ ├── client.bks │ │ ├── client.cer │ │ ├── client.jks │ │ ├── clienttrust.bks │ │ ├── clienttrust.jks │ │ ├── server.bks │ │ ├── server.cer │ │ ├── server.jks │ │ ├── server.p12 │ │ ├── servertrust.bks │ │ ├── servertrust.jks │ │ ├── toolserver.bks │ │ └── toolservertrust.bks └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ └── ic_launcher_background.xml │ ├── layout │ └── activity_main.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── raw │ ├── server.bks │ ├── servertrust.bks │ ├── toolserver.bks │ └── toolservertrust.bks │ ├── values-night │ └── themes.xml │ └── values │ ├── colors.xml │ ├── strings.xml │ └── themes.xml └── test └── java └── com └── fish └── sslserver └── ExampleUnitTest.java /.gradle/6.5/executionHistory/executionHistory.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/.gradle/6.5/executionHistory/executionHistory.bin -------------------------------------------------------------------------------- /.gradle/6.5/executionHistory/executionHistory.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/.gradle/6.5/executionHistory/executionHistory.lock -------------------------------------------------------------------------------- /.gradle/6.5/fileChanges/last-build.bin: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gradle/6.5/fileContent/fileContent.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/.gradle/6.5/fileContent/fileContent.lock -------------------------------------------------------------------------------- /.gradle/6.5/fileHashes/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/.gradle/6.5/fileHashes/fileHashes.bin -------------------------------------------------------------------------------- /.gradle/6.5/fileHashes/fileHashes.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/.gradle/6.5/fileHashes/fileHashes.lock -------------------------------------------------------------------------------- /.gradle/6.5/fileHashes/resourceHashesCache.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/.gradle/6.5/fileHashes/resourceHashesCache.bin -------------------------------------------------------------------------------- /.gradle/6.5/gc.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/.gradle/6.5/gc.properties -------------------------------------------------------------------------------- /.gradle/6.5/javaCompile/classAnalysis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/.gradle/6.5/javaCompile/classAnalysis.bin -------------------------------------------------------------------------------- /.gradle/6.5/javaCompile/jarAnalysis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/.gradle/6.5/javaCompile/jarAnalysis.bin -------------------------------------------------------------------------------- /.gradle/6.5/javaCompile/javaCompile.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/.gradle/6.5/javaCompile/javaCompile.lock -------------------------------------------------------------------------------- /.gradle/6.5/javaCompile/taskHistory.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/.gradle/6.5/javaCompile/taskHistory.bin -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/buildOutputCleanup.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/.gradle/buildOutputCleanup/buildOutputCleanup.lock -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/cache.properties: -------------------------------------------------------------------------------- 1 | #Wed May 05 09:54:31 CST 2021 2 | gradle.version=6.5 3 | -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/outputFiles.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/.gradle/buildOutputCleanup/outputFiles.bin -------------------------------------------------------------------------------- /.gradle/checksums/checksums.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/.gradle/checksums/checksums.lock -------------------------------------------------------------------------------- /.gradle/checksums/md5-checksums.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/.gradle/checksums/md5-checksums.bin -------------------------------------------------------------------------------- /.gradle/checksums/sha1-checksums.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/.gradle/checksums/sha1-checksums.bin -------------------------------------------------------------------------------- /.gradle/vcs-1/gc.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/.gradle/vcs-1/gc.properties -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/dictionaries/fishforest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 24 | 25 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_activity_activity_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_annotation_annotation_experimental_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_appcompat_appcompat_1_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_appcompat_appcompat_1_2_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_2_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_cardview_cardview_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_collection_collection_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_1_1_3_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_2_0_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_solver_1_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_solver_2_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_core_core_1_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_core_core_1_3_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_fragment_fragment_1_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_recyclerview_recyclerview_1_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_savedstate_savedstate_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_test_core_1_2_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_test_core_1_3_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_test_espresso_espresso_core_3_2_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_test_espresso_espresso_core_3_3_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_test_espresso_espresso_idling_resource_3_2_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_test_espresso_espresso_idling_resource_3_3_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_test_ext_junit_1_1_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_test_ext_junit_1_1_2_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_test_monitor_1_2_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_test_monitor_1_3_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_test_runner_1_2_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_test_runner_1_3_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_transition_transition_1_2_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_viewpager2_viewpager2_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_material_material_1_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_material_material_1_2_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_code_findbugs_jsr305_2_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_squareup_javawriter_2_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__javax_inject_javax_inject_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__junit_junit_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__junit_junit_4_13_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_hamcrest_hamcrest_integration_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_hamcrest_hamcrest_library_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /AndroidDemo.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AndroidDemo 2 | # 简书主页 3 | https://www.jianshu.com/u/c3187f5a9eb1 4 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | } 4 | 5 | android { 6 | compileSdkVersion 29 7 | buildToolsVersion "30.0.3" 8 | 9 | defaultConfig { 10 | applicationId "com.example.androiddemo" 11 | minSdkVersion 22 12 | targetSdkVersion 30 13 | versionCode 1 14 | versionName "1.0" 15 | 16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 17 | } 18 | 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | compileOptions { 26 | sourceCompatibility JavaVersion.VERSION_1_8 27 | targetCompatibility JavaVersion.VERSION_1_8 28 | } 29 | } 30 | 31 | dependencies { 32 | 33 | implementation 'androidx.appcompat:appcompat:1.1.0' 34 | implementation 'com.google.android.material:material:1.1.0' 35 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 36 | testImplementation 'junit:junit:4.+' 37 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 38 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 39 | } -------------------------------------------------------------------------------- /app/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 -------------------------------------------------------------------------------- /app/src/androidTest/java/com/example/androiddemo/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | assertEquals("com.example.androiddemo", appContext.getPackageName()); 25 | } 26 | } -------------------------------------------------------------------------------- /app/src/main/aidl/com/fish/ipcserver/IStudentInfo.aidl: -------------------------------------------------------------------------------- 1 | // IStudentInfo.aidl 2 | package com.fish.ipcserver; 3 | 4 | import com.fish.ipcserver.Student; 5 | import com.fish.ipcserver.RemoteCallback; 6 | 7 | interface IStudentInfo { 8 | //主动获取 9 | Student getStudentInfo(); 10 | //注册回调 11 | oneway void register(in RemoteCallback callback); 12 | } -------------------------------------------------------------------------------- /app/src/main/aidl/com/fish/ipcserver/RemoteCallback.aidl: -------------------------------------------------------------------------------- 1 | // RemoteCallback.aidl 2 | package com.fish.ipcserver; 3 | 4 | import com.fish.ipcserver.Student; 5 | interface RemoteCallback { 6 | //回调 7 | oneway void onCallback(in Student student); 8 | } -------------------------------------------------------------------------------- /app/src/main/aidl/com/fish/ipcserver/Student.aidl: -------------------------------------------------------------------------------- 1 | // Student.aidl 2 | package com.fish.ipcserver; 3 | 4 | parcelable Student; -------------------------------------------------------------------------------- /app/src/main/assets/js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Android调用 JS 代码demo 6 | // JS代码似懂非懂 7 | 18 | 19 | 20 | 21 |

这世界不好看

22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/Application/App.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.Application; 2 | 3 | import android.app.Application; 4 | 5 | public class App extends Application { 6 | 7 | private static volatile App ins; 8 | 9 | @Override 10 | public void onCreate() { 11 | super.onCreate(); 12 | ins = this; 13 | } 14 | 15 | public static Application getApplication() { 16 | return ins; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/ams/AMSTargetActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.ams; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.os.PersistableBundle; 7 | 8 | import com.example.androiddemo.R; 9 | 10 | import androidx.annotation.Nullable; 11 | import androidx.appcompat.app.AppCompatActivity; 12 | 13 | public class AMSTargetActivity extends AppCompatActivity { 14 | public static void start(Context context) { 15 | Intent intent = new Intent(context, AMSTargetActivity.class); 16 | context.startActivity(intent); 17 | } 18 | 19 | @Override 20 | protected void onCreate(Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | setContentView(R.layout.activity_ams_target); 23 | 24 | } 25 | 26 | @Override 27 | public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) { 28 | super.onCreate(savedInstanceState, persistentState); 29 | } 30 | 31 | @Override 32 | protected void onStart() { 33 | super.onStart(); 34 | } 35 | 36 | @Override 37 | protected void onResume() { 38 | super.onResume(); 39 | } 40 | 41 | @Override 42 | protected void onPause() { 43 | super.onPause(); 44 | } 45 | 46 | @Override 47 | protected void onStop() { 48 | super.onStop(); 49 | } 50 | 51 | @Override 52 | protected void onDestroy() { 53 | super.onDestroy(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/ams/AMSTargetBroadcast.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.ams; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | 7 | public class AMSTargetBroadcast extends BroadcastReceiver { 8 | 9 | public static String MY_ACTION = "my_action"; 10 | 11 | public AMSTargetBroadcast() { 12 | super(); 13 | } 14 | 15 | @Override 16 | public void onReceive(Context context, Intent intent) { 17 | String action = intent.getAction(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/ams/AMSTargetProvider.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.ams; 2 | 3 | import android.content.ContentProvider; 4 | import android.content.ContentValues; 5 | import android.content.UriMatcher; 6 | import android.database.Cursor; 7 | import android.net.Uri; 8 | 9 | import androidx.annotation.NonNull; 10 | import androidx.annotation.Nullable; 11 | 12 | public class AMSTargetProvider extends ContentProvider { 13 | public static String AUTHORITY = "com.fish.AMSTargetProvider"; 14 | private static int MATCH_CODE = 1000; 15 | private static UriMatcher uriMatcher; 16 | static { 17 | uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); 18 | uriMatcher.addURI(AUTHORITY, "ams", MATCH_CODE); 19 | } 20 | 21 | @Override 22 | public boolean onCreate() { 23 | return false; 24 | } 25 | 26 | @Nullable 27 | @Override 28 | public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) { 29 | if (uriMatcher.match(uri) == MATCH_CODE) { 30 | int a = 5; 31 | } 32 | return null; 33 | } 34 | 35 | @Nullable 36 | @Override 37 | public String getType(@NonNull Uri uri) { 38 | return null; 39 | } 40 | 41 | @Nullable 42 | @Override 43 | public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) { 44 | if (uriMatcher.match(uri) == MATCH_CODE) { 45 | notifyChange(); 46 | } 47 | return null; 48 | } 49 | 50 | @Override 51 | public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) { 52 | return 0; 53 | } 54 | 55 | @Override 56 | public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) { 57 | return 0; 58 | } 59 | 60 | private void notifyChange() { 61 | Uri notifyUri = Uri.parse("content://" + AUTHORITY + "/ams"); 62 | getContext().getContentResolver().notifyChange(notifyUri, null); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/ams/AMSTargetService.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.ams; 2 | 3 | import android.app.Service; 4 | import android.content.Intent; 5 | import android.os.Binder; 6 | import android.os.IBinder; 7 | 8 | import androidx.annotation.Nullable; 9 | 10 | public class AMSTargetService extends Service { 11 | 12 | class MyBinder extends Binder { 13 | public MyBinder(){} 14 | } 15 | 16 | @Nullable 17 | @Override 18 | public IBinder onBind(Intent intent) { 19 | return new MyBinder(); 20 | } 21 | 22 | @Override 23 | public void onCreate() { 24 | super.onCreate(); 25 | } 26 | 27 | @Override 28 | public int onStartCommand(Intent intent, int flags, int startId) { 29 | return super.onStartCommand(intent, flags, startId); 30 | } 31 | 32 | @Override 33 | public void onDestroy() { 34 | super.onDestroy(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/clipchildren/ClipViewGroup.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.clipchildren; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.MotionEvent; 6 | import android.view.View; 7 | import android.widget.LinearLayout; 8 | 9 | import androidx.annotation.Nullable; 10 | 11 | public class ClipViewGroup extends LinearLayout { 12 | public ClipViewGroup(Context context) { 13 | super(context); 14 | } 15 | 16 | public ClipViewGroup(Context context, @Nullable AttributeSet attrs) { 17 | super(context, attrs); 18 | } 19 | 20 | @Override 21 | public boolean onTouchEvent(MotionEvent event) { 22 | //获取坐标相对屏幕的位置 23 | float rawX = event.getRawX(); 24 | float rawY = event.getRawY(); 25 | View child; 26 | //检测坐标是否落在对应的子布局内 27 | if ((child = checkChildTouch(rawX, rawY)) != null) { 28 | //若是将坐标值修改为子布局中心点 29 | event.setLocation(child.getWidth() / 2, child.getHeight() / 2); 30 | //分发事件给子布局 31 | return child.dispatchTouchEvent(event); 32 | } 33 | return super.onTouchEvent(event); 34 | } 35 | 36 | private View checkChildTouch(float x, float y) { 37 | int outLocation[] = new int[2]; 38 | for (int i = 0; i < getChildCount(); i++) { 39 | View child = getChildAt(i); 40 | if (child.getVisibility() == VISIBLE) { 41 | //获取View 在屏幕上的可见坐标 42 | child.getLocationOnScreen(outLocation); 43 | //点击坐标是否落在View 的可见区域,若是则将事件分发给它 44 | boolean hit = (x >= outLocation[0] && y > outLocation[1] 45 | && x <= outLocation[0] + child.getWidth() && y <= outLocation[1] + child.getHeight()); 46 | if (hit) 47 | return child; 48 | } 49 | } 50 | return null; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/clippadding/ClipPaddingActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.clippadding; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.graphics.Color; 6 | import android.os.Bundle; 7 | import android.util.TypedValue; 8 | import android.view.Gravity; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.TextView; 12 | 13 | import androidx.annotation.NonNull; 14 | import androidx.annotation.Nullable; 15 | import androidx.appcompat.app.AppCompatActivity; 16 | import androidx.recyclerview.widget.LinearLayoutManager; 17 | import androidx.recyclerview.widget.RecyclerView; 18 | 19 | import com.example.androiddemo.R; 20 | 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | public class ClipPaddingActivity extends AppCompatActivity { 25 | 26 | private RecyclerView recyclerView; 27 | private List srcList = new ArrayList<>(); 28 | 29 | public static void start(Context context) { 30 | Intent intent = new Intent(context, ClipPaddingActivity.class); 31 | context.startActivity(intent); 32 | } 33 | 34 | @Override 35 | protected void onCreate(@Nullable Bundle savedInstanceState) { 36 | super.onCreate(savedInstanceState); 37 | setContentView(R.layout.activity_clip_padding); 38 | 39 | for (int i = 0; i < 100; i++) { 40 | srcList.add(i + ""); 41 | } 42 | 43 | recyclerView = findViewById(R.id.rv); 44 | RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this); 45 | recyclerView.setLayoutManager(layoutManager); 46 | recyclerView.setAdapter(new ClipAdapter()); 47 | } 48 | 49 | class ClipAdapter extends RecyclerView.Adapter { 50 | @NonNull 51 | @Override 52 | public ClipHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 53 | TextView textView = new TextView(parent.getContext()); 54 | textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20); 55 | textView.setTextColor(Color.RED); 56 | textView.setGravity(Gravity.CENTER); 57 | textView.setBackgroundColor(Color.GREEN); 58 | RecyclerView.LayoutParams layoutParams = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 80); 59 | layoutParams.bottomMargin = 10; 60 | textView.setLayoutParams(layoutParams); 61 | ClipHolder clipHolder = new ClipHolder(textView); 62 | return clipHolder; 63 | } 64 | 65 | @Override 66 | public void onBindViewHolder(@NonNull ClipHolder holder, int position) { 67 | String name = srcList.get(position); 68 | ((TextView) holder.itemView).setText(name); 69 | 70 | } 71 | 72 | @Override 73 | public int getItemCount() { 74 | return srcList.size(); 75 | } 76 | } 77 | 78 | class ClipHolder extends RecyclerView.ViewHolder { 79 | public ClipHolder(@NonNull View itemView) { 80 | super(itemView); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/clippadding/ClipPaddingView.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.clippadding; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.Color; 6 | import android.util.AttributeSet; 7 | import android.util.Log; 8 | import android.view.MotionEvent; 9 | import android.view.View; 10 | import android.view.ViewConfiguration; 11 | 12 | import androidx.annotation.Nullable; 13 | 14 | public class ClipPaddingView extends View { 15 | 16 | private float lastY; 17 | private float lastX; 18 | 19 | public ClipPaddingView(Context context) { 20 | super(context); 21 | } 22 | 23 | public ClipPaddingView(Context context, @Nullable AttributeSet attrs) { 24 | super(context, attrs); 25 | } 26 | 27 | @Override 28 | protected void onDraw(Canvas canvas) { 29 | canvas.drawColor(Color.BLUE); 30 | } 31 | 32 | @Override 33 | public boolean onTouchEvent(MotionEvent event) { 34 | switch (event.getActionMasked()) { 35 | case MotionEvent.ACTION_DOWN: 36 | lastY = event.getRawY(); 37 | lastX = event.getRawX(); 38 | break; 39 | case MotionEvent.ACTION_MOVE: 40 | float curY = event.getRawY(); 41 | float curX = event.getRawX(); 42 | Log.d("fish", curY + " " + lastY); 43 | Log.d("fish", (curY - lastY) + ""); 44 | if (Math.abs(curY - lastY) >= ViewConfiguration.getTouchSlop()) 45 | setTranslationY(curY - lastY); 46 | 47 | if (Math.abs(curX - lastX) >= ViewConfiguration.getTouchSlop()) 48 | setTranslationX(curX - lastX); 49 | // lastY = curY; 50 | break; 51 | } 52 | return super.onTouchEvent(event); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/clippadding/ClipPaddingViewGroup.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.clippadding; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.util.AttributeSet; 6 | import android.widget.FrameLayout; 7 | 8 | import androidx.annotation.NonNull; 9 | import androidx.annotation.Nullable; 10 | 11 | public class ClipPaddingViewGroup extends FrameLayout { 12 | public ClipPaddingViewGroup(@NonNull Context context) { 13 | super(context); 14 | } 15 | 16 | public ClipPaddingViewGroup(@NonNull Context context, @Nullable AttributeSet attrs) { 17 | super(context, attrs); 18 | } 19 | 20 | @Override 21 | protected void dispatchDraw(Canvas canvas) { 22 | super.dispatchDraw(canvas); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/edittext/EditTextActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.edittext; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.graphics.Canvas; 6 | import android.os.Bundle; 7 | import android.widget.EditText; 8 | 9 | import com.example.androiddemo.R; 10 | 11 | import androidx.annotation.Nullable; 12 | import androidx.appcompat.app.AppCompatActivity; 13 | 14 | public class EditTextActivity extends AppCompatActivity { 15 | public static void start(Context context) { 16 | Intent intent = new Intent(context, EditTextActivity.class); 17 | context.startActivity(intent); 18 | } 19 | 20 | @Override 21 | protected void onCreate(@Nullable Bundle savedInstanceState) { 22 | super.onCreate(savedInstanceState); 23 | setContentView(R.layout.activity_edit_text); 24 | EditText editText = findViewById(R.id.edit); 25 | editText.setFocusable(true); 26 | editText.setFocusableInTouchMode(true); 27 | editText.requestFocus(); 28 | String hint = "myname"; 29 | editText.setText(hint); 30 | editText.setSelectAllOnFocus(true); 31 | 32 | editText.setSelection(0, hint.length()); 33 | } 34 | 35 | @Override 36 | public void onWindowFocusChanged(boolean hasFocus) { 37 | super.onWindowFocusChanged(hasFocus); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/edittext/MyEditText.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.edittext; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.Rect; 6 | import android.os.Looper; 7 | import android.util.AttributeSet; 8 | import android.view.View; 9 | import android.view.inputmethod.InputMethodManager; 10 | 11 | import java.util.logging.Handler; 12 | 13 | import androidx.appcompat.widget.AppCompatEditText; 14 | 15 | import static android.view.inputmethod.InputMethod.SHOW_FORCED; 16 | 17 | public class MyEditText extends AppCompatEditText { 18 | public MyEditText(Context context) { 19 | super(context); 20 | } 21 | 22 | public MyEditText(Context context, AttributeSet attrs) { 23 | super(context, attrs); 24 | } 25 | 26 | @Override 27 | public View focusSearch(int direction) { 28 | return super.focusSearch(direction); 29 | } 30 | 31 | @Override 32 | protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { 33 | super.onFocusChanged(focused, direction, previouslyFocusedRect); 34 | if (focused) { 35 | 36 | } 37 | } 38 | 39 | @Override 40 | public void onWindowFocusChanged(boolean hasWindowFocus) { 41 | super.onWindowFocusChanged(hasWindowFocus); 42 | if (hasWindowFocus) { 43 | InputMethodManager methodManager = (InputMethodManager)getContext().getSystemService(Context.INPUT_METHOD_SERVICE); 44 | methodManager.showSoftInput(this, SHOW_FORCED); 45 | } 46 | } 47 | 48 | @Override 49 | protected void onAttachedToWindow() { 50 | super.onAttachedToWindow(); 51 | } 52 | 53 | @Override 54 | protected void onDraw(Canvas canvas) { 55 | super.onDraw(canvas); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/fileprovider/MyFileProvider.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.fileprovider; 2 | 3 | import androidx.core.content.FileProvider; 4 | 5 | public class MyFileProvider extends FileProvider { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/fragment/MyFragment.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.fragment; 2 | 3 | import android.app.Dialog; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.os.Bundle; 7 | import android.text.TextUtils; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.TextView; 12 | 13 | import com.example.androiddemo.R; 14 | 15 | import androidx.annotation.NonNull; 16 | import androidx.annotation.Nullable; 17 | import androidx.fragment.app.Fragment; 18 | 19 | public class MyFragment extends Fragment { 20 | 21 | String desc; 22 | 23 | public MyFragment(){ 24 | super(); 25 | } 26 | 27 | 28 | public MyFragment(String desc) { 29 | this.desc = desc; 30 | } 31 | 32 | 33 | @Override 34 | public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { 35 | TextView textView = new TextView(getContext()); 36 | if (TextUtils.isEmpty(desc)) 37 | desc = "静态fragment"; 38 | textView.setText(desc); 39 | textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 40 | return textView; 41 | } 42 | 43 | @Override 44 | public void onAttach(Context context) { 45 | super.onAttach(context); 46 | } 47 | 48 | @Override 49 | public void onCreate(Bundle savedInstanceState) { 50 | super.onCreate(savedInstanceState); 51 | } 52 | 53 | @Override 54 | public void onViewCreated(View view, Bundle savedInstanceState) { 55 | super.onViewCreated(view, savedInstanceState); 56 | } 57 | 58 | @Override 59 | public void onActivityCreated(Bundle savedInstanceState) { 60 | super.onActivityCreated(savedInstanceState); 61 | } 62 | 63 | @Override 64 | public void onActivityResult(int requestCode, int resultCode, Intent data) { 65 | super.onActivityResult(requestCode, resultCode, data); 66 | } 67 | 68 | @Override 69 | public void onStart() { 70 | super.onStart(); 71 | } 72 | 73 | @Override 74 | public void onResume() { 75 | super.onResume(); 76 | } 77 | 78 | @Override 79 | public void onPause() { 80 | super.onPause(); 81 | } 82 | 83 | @Override 84 | public void onStop() { 85 | super.onStop(); 86 | } 87 | 88 | @Override 89 | public void onDestroyView() { 90 | super.onDestroyView(); 91 | } 92 | 93 | @Override 94 | public void onDestroy() { 95 | super.onDestroy(); 96 | } 97 | 98 | @Override 99 | public void onDetach() { 100 | super.onDetach(); 101 | } 102 | 103 | @Override 104 | public void setUserVisibleHint(boolean isVisibleToUser) { 105 | super.setUserVisibleHint(isVisibleToUser); 106 | } 107 | 108 | @Override 109 | public void onViewStateRestored(Bundle savedInstanceState) { 110 | super.onViewStateRestored(savedInstanceState); 111 | } 112 | 113 | @Override 114 | public void onSaveInstanceState(Bundle outState) { 115 | super.onSaveInstanceState(outState); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/fragment/MyFrameLayout.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.fragment; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.widget.FrameLayout; 6 | 7 | import com.example.androiddemo.motionevent.MotionEventActivity; 8 | 9 | import androidx.annotation.NonNull; 10 | import androidx.annotation.Nullable; 11 | 12 | public class MyFrameLayout extends FrameLayout { 13 | public MyFrameLayout(@NonNull Context context) { 14 | super(context); 15 | } 16 | 17 | public MyFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs) { 18 | super(context, attrs); 19 | setOnClickListener((v)-> { 20 | MotionEventActivity.startForResult(v.getContext()); 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/fragment/StaticFragmentActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.fragment; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.os.Bundle; 7 | import android.util.Log; 8 | 9 | import com.example.androiddemo.R; 10 | import com.example.androiddemo.motionevent.MotionEventActivity; 11 | 12 | import androidx.annotation.NonNull; 13 | import androidx.annotation.Nullable; 14 | import androidx.appcompat.app.AppCompatActivity; 15 | import androidx.lifecycle.Lifecycle; 16 | 17 | public class StaticFragmentActivity extends AppCompatActivity { 18 | public static void start(Context context) { 19 | Intent intent = new Intent(context, StaticFragmentActivity.class); 20 | context.startActivity(intent); 21 | } 22 | 23 | @Override 24 | protected void onCreate(@Nullable Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | setContentView(R.layout.activity_static_fragment); 27 | getWindow().getDecorView().setOnClickListener((v)->{ 28 | MotionEventActivity.start(v.getContext()); 29 | }); 30 | } 31 | 32 | @Override 33 | protected void onRestart() { 34 | super.onRestart(); 35 | } 36 | 37 | @Override 38 | protected void onRestoreInstanceState(Bundle savedInstanceState) { 39 | super.onRestoreInstanceState(savedInstanceState); 40 | } 41 | 42 | @Override 43 | protected void onSaveInstanceState(Bundle outState) { 44 | super.onSaveInstanceState(outState); 45 | outState.putString("wo", "nihao"); 46 | } 47 | 48 | @Override 49 | protected void onNewIntent(Intent intent) { 50 | super.onNewIntent(intent); 51 | } 52 | 53 | @Override 54 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { 55 | super.onActivityResult(requestCode, resultCode, data); 56 | } 57 | 58 | @Override 59 | protected void onStart() { 60 | super.onStart(); 61 | } 62 | 63 | @Override 64 | protected void onStop() { 65 | super.onStop(); 66 | } 67 | 68 | @Override 69 | protected void onResume() { 70 | super.onResume(); 71 | } 72 | 73 | @Override 74 | protected void onPause() { 75 | super.onPause(); 76 | } 77 | 78 | @Override 79 | protected void onDestroy() { 80 | super.onDestroy(); 81 | } 82 | 83 | @Override 84 | public void finish() { 85 | super.finish(); 86 | } 87 | 88 | @Override 89 | public void onBackPressed() { 90 | super.onBackPressed(); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/ipc/ExtraData.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.ipc; 2 | 3 | public class ExtraData { 4 | private String extra; 5 | } 6 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/ipc/MyRemoteCallback.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.ipc; 2 | 3 | import android.app.Activity; 4 | import android.os.RemoteException; 5 | import android.util.Log; 6 | import android.widget.Toast; 7 | 8 | import com.fish.ipcserver.RemoteCallback; 9 | import com.fish.ipcserver.Student; 10 | 11 | public class MyRemoteCallback extends RemoteCallback.Stub { 12 | Activity activity; 13 | ExtraData extraData; 14 | 15 | public MyRemoteCallback(Activity activity, ExtraData extraData) { 16 | this.activity = activity; 17 | this.extraData = extraData; 18 | } 19 | @Override 20 | public void onCallback(Student student) throws RemoteException { 21 | Log.d("fish", "call back student:" + student); 22 | activity.runOnUiThread(new Runnable() { 23 | @Override 24 | public void run() { 25 | Toast.makeText(activity, "client receive change:" + student.toString(), Toast.LENGTH_SHORT).show(); 26 | } 27 | }); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/motionevent/MotionEventActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.motionevent; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.os.Bundle; 7 | import android.view.ViewGroup; 8 | 9 | import androidx.annotation.Nullable; 10 | import androidx.appcompat.app.AppCompatActivity; 11 | 12 | import com.example.androiddemo.R; 13 | 14 | public class MotionEventActivity extends AppCompatActivity { 15 | 16 | private ViewGroup viewGroup; 17 | 18 | public static void start(Context context) { 19 | Intent intent = new Intent(context, MotionEventActivity.class); 20 | context.startActivity(intent); 21 | } 22 | 23 | public static void startForResult(Context context) { 24 | Intent intent = new Intent(context, MotionEventActivity.class); 25 | ((Activity)context).startActivityForResult(intent, 100); 26 | } 27 | 28 | @Override 29 | protected void onCreate(@Nullable Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | setContentView(R.layout.activity_motion_event); 32 | 33 | viewGroup = findViewById(R.id.motion_group); 34 | viewGroup.postDelayed(new Runnable() { 35 | @Override 36 | public void run() { 37 | viewGroup.removeAllViews(); 38 | // getWindowManager().removeView(getWindow().getDecorView()); 39 | } 40 | }, 3000); 41 | } 42 | 43 | @Override 44 | protected void onDestroy() { 45 | super.onDestroy(); 46 | } 47 | 48 | @Override 49 | public void finish() { 50 | super.finish(); 51 | setResult(200); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/motionevent/MotionView.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.motionevent; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.util.Log; 6 | import android.view.MotionEvent; 7 | import android.view.View; 8 | 9 | import androidx.annotation.Nullable; 10 | 11 | import com.example.androiddemo.util.LogTag; 12 | 13 | public class MotionView extends View { 14 | public MotionView(Context context) { 15 | super(context); 16 | } 17 | 18 | public MotionView(Context context, @Nullable AttributeSet attrs) { 19 | super(context, attrs); 20 | } 21 | 22 | @Override 23 | public boolean dispatchTouchEvent(MotionEvent event) { 24 | // Log.d(LogTag.TAG, "MotionView dispatchTouchEvent:" + MotionEvent.actionToString(event.getAction())); 25 | return super.dispatchTouchEvent(event); 26 | } 27 | 28 | @Override 29 | public boolean onTouchEvent(MotionEvent event) { 30 | Log.d(LogTag.TAG, "MotionView onTouchEvent:" + MotionEvent.actionToString(event.getAction()) + event.getPointerCount()); 31 | return true; 32 | } 33 | 34 | @Override 35 | protected void onAttachedToWindow() { 36 | super.onAttachedToWindow(); 37 | } 38 | 39 | 40 | @Override 41 | protected void onDetachedFromWindow() { 42 | Log.d(LogTag.TAG, "MotionView onDetachedFromWindow"); 43 | super.onDetachedFromWindow(); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/motionevent/MotionViewGroup.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.motionevent; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.util.Log; 6 | import android.view.MotionEvent; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.FrameLayout; 10 | 11 | import androidx.annotation.NonNull; 12 | import androidx.annotation.Nullable; 13 | 14 | import com.example.androiddemo.util.LogTag; 15 | 16 | public class MotionViewGroup extends FrameLayout { 17 | public MotionViewGroup(@NonNull Context context) { 18 | super(context); 19 | } 20 | 21 | public MotionViewGroup(@NonNull Context context, @Nullable AttributeSet attrs) { 22 | super(context, attrs); 23 | } 24 | 25 | @Override 26 | public boolean dispatchTouchEvent(MotionEvent ev) { 27 | Log.d(LogTag.TAG, "MotionViewGroup dispatchTouchEvent:" + MotionEvent.actionToString(ev.getAction())); 28 | return super.dispatchTouchEvent(ev); 29 | } 30 | 31 | @Override 32 | public boolean onTouchEvent(MotionEvent event) { 33 | Log.d(LogTag.TAG, "MotionViewGroup onTouchEvent:" + MotionEvent.actionToString(event.getAction())); 34 | return super.onTouchEvent(event); 35 | } 36 | 37 | @Override 38 | public boolean onInterceptTouchEvent(MotionEvent ev) { 39 | Log.d(LogTag.TAG, "MotionViewGroup onInterceptTouchEvent:" + MotionEvent.actionToString(ev.getAction())); 40 | // if (ev.getAction() == MotionEvent.ACTION_MOVE) { 41 | // return true; 42 | // } 43 | return false; 44 | } 45 | 46 | @Override 47 | protected void onAttachedToWindow() { 48 | super.onAttachedToWindow(); 49 | } 50 | 51 | @Override 52 | protected void onDetachedFromWindow() { 53 | Log.d(LogTag.TAG, "MotionViewGroup onDetachedFromWindow"); 54 | super.onDetachedFromWindow(); 55 | } 56 | 57 | @Override 58 | public void onViewRemoved(View child) { 59 | Log.d(LogTag.TAG, "MotionViewGroup onViewRemoved"); 60 | super.onViewRemoved(child); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/ssl/MyTrustManager.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.ssl; 2 | 3 | import java.security.cert.CertificateException; 4 | import java.security.cert.X509Certificate; 5 | 6 | import javax.net.ssl.X509TrustManager; 7 | 8 | class MyTrustManager implements X509TrustManager { 9 | @Override 10 | public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { 11 | 12 | } 13 | 14 | @Override 15 | public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { 16 | 17 | } 18 | 19 | @Override 20 | public X509Certificate[] getAcceptedIssuers() { 21 | return new X509Certificate[0]; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/util/LogTag.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.util; 2 | 3 | public class LogTag { 4 | public static final String TAG = "fishforest"; 5 | } 6 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/webview/Android2Js.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.webview; 2 | 3 | import android.util.Log; 4 | import android.webkit.JavascriptInterface; 5 | 6 | public class Android2Js extends Object{ 7 | @JavascriptInterface 8 | public void say() { 9 | Log.d("fish", "nihao"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/window/WindowView.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.window; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.View; 6 | 7 | import androidx.annotation.Nullable; 8 | 9 | public class WindowView extends View { 10 | public WindowView(Context context) { 11 | super(context); 12 | } 13 | 14 | public WindowView(Context context, @Nullable AttributeSet attrs) { 15 | super(context, attrs); 16 | } 17 | 18 | public WindowView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 19 | super(context, attrs, defStyleAttr); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/androiddemo/window/WindowViewGroup.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo.window; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.util.Log; 6 | import android.view.MotionEvent; 7 | import android.widget.FrameLayout; 8 | 9 | import androidx.annotation.NonNull; 10 | import androidx.annotation.Nullable; 11 | 12 | import com.example.androiddemo.util.LogTag; 13 | 14 | public class WindowViewGroup extends FrameLayout { 15 | public WindowViewGroup(@NonNull Context context) { 16 | super(context); 17 | } 18 | 19 | public WindowViewGroup(@NonNull Context context, @Nullable AttributeSet attrs) { 20 | super(context, attrs); 21 | } 22 | 23 | public WindowViewGroup(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 24 | super(context, attrs, defStyleAttr); 25 | } 26 | 27 | @Override 28 | public boolean onTouchEvent(MotionEvent event) { 29 | Log.d(LogTag.TAG, "onTouchEvent action:" + MotionEvent.actionToString(event.getAction())); 30 | return super.onTouchEvent(event); 31 | } 32 | 33 | @Override 34 | public boolean dispatchTouchEvent(MotionEvent ev) { 35 | Log.d(LogTag.TAG, "dispatchTouchEvent action:" + MotionEvent.actionToString(ev.getAction())); 36 | return super.dispatchTouchEvent(ev); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/fish/ipcserver/Student.java: -------------------------------------------------------------------------------- 1 | package com.fish.ipcserver; 2 | 3 | import android.os.Parcel; 4 | import android.os.Parcelable; 5 | 6 | public class Student implements Parcelable { 7 | private String name; 8 | private int age; 9 | private float score; 10 | 11 | @Override 12 | public int describeContents() { 13 | return 0; 14 | } 15 | 16 | @Override 17 | public void writeToParcel(Parcel dest, int flags) { 18 | dest.writeString(this.name); 19 | dest.writeInt(this.age); 20 | dest.writeFloat(this.score); 21 | } 22 | 23 | public void readFromParcel(Parcel source) { 24 | this.name = source.readString(); 25 | this.age = source.readInt(); 26 | this.score = source.readFloat(); 27 | } 28 | 29 | public Student() { 30 | } 31 | 32 | protected Student(Parcel in) { 33 | this.name = in.readString(); 34 | this.age = in.readInt(); 35 | this.score = in.readFloat(); 36 | } 37 | 38 | public static final Creator CREATOR = new Creator() { 39 | @Override 40 | public Student createFromParcel(Parcel source) { 41 | return new Student(source); 42 | } 43 | 44 | @Override 45 | public Student[] newArray(int size) { 46 | return new Student[size]; 47 | } 48 | }; 49 | 50 | public String getName() { 51 | return name; 52 | } 53 | 54 | public void setName(String name) { 55 | this.name = name; 56 | } 57 | 58 | public int getAge() { 59 | return age; 60 | } 61 | 62 | public void setAge(int age) { 63 | this.age = age; 64 | } 65 | 66 | public float getScore() { 67 | return score; 68 | } 69 | 70 | public void setScore(float score) { 71 | this.score = score; 72 | } 73 | 74 | @Override 75 | public String toString() { 76 | return "Student{" + 77 | "name='" + name + '\'' + 78 | ", age=" + age + 79 | ", score=" + score + 80 | '}'; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_ams.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 22 | 23 | 35 | 36 | 48 | 49 | 61 | 62 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_ams_target.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_clip_children.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 17 | 18 | 26 | 27 | 35 | 36 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_clip_padding.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 18 | 23 | 24 | 25 | 26 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_edit_text.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 15 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_fileprovider.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 22 | 23 | 35 | 36 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 16 | 17 | 18 | 22 | 23 | 29 | 30 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_ipc.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_motion_event.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 16 | 17 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_ssl.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 16 | 17 | 18 | 22 | 23 | 29 | 30 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_static_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | 15 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_storage.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_webview.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | 14 | 18 | 19 | 20 | 27 | 28 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_window.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #E91E25 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | #1ACA55 11 | #CA1A34 12 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AndroidDemo 3 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/xml/file_path.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/test/java/com/example/androiddemo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.example.androiddemo; 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() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath "com.android.tools.build:gradle:4.1.2" 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | google() 18 | jcenter() 19 | } 20 | } 21 | 22 | task clean(type: Delete) { 23 | delete rootProject.buildDir 24 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishforest/AndroidDemo/8d80f3542c94490bf415fc9c069899dad51edb90/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Apr 09 10:59:08 CST 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https://downloads.gradle-dn.com/distributions/gradle-6.5-bin.zip -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /ipcserver/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /ipcserver/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | } 4 | 5 | android { 6 | compileSdkVersion 29 7 | buildToolsVersion "30.0.3" 8 | 9 | defaultConfig { 10 | applicationId "com.fish.ipcserver" 11 | minSdkVersion 19 12 | targetSdkVersion 29 13 | versionCode 1 14 | versionName "1.0" 15 | 16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 17 | } 18 | 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | compileOptions { 26 | sourceCompatibility JavaVersion.VERSION_1_8 27 | targetCompatibility JavaVersion.VERSION_1_8 28 | } 29 | } 30 | 31 | dependencies { 32 | 33 | implementation 'androidx.appcompat:appcompat:1.2.0' 34 | implementation 'com.google.android.material:material:1.2.1' 35 | implementation 'androidx.constraintlayout:constraintlayout:2.0.1' 36 | testImplementation 'junit:junit:4.+' 37 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 38 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 39 | 40 | } -------------------------------------------------------------------------------- /ipcserver/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 -------------------------------------------------------------------------------- /ipcserver/src/androidTest/java/com/fish/ipcserver/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.fish.ipcserver; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | assertEquals("com.fish.ipcserver", appContext.getPackageName()); 25 | } 26 | } -------------------------------------------------------------------------------- /ipcserver/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /ipcserver/src/main/aidl/com/fish/ipcserver/IStudentInfo.aidl: -------------------------------------------------------------------------------- 1 | // IStudentInfo.aidl 2 | package com.fish.ipcserver; 3 | 4 | import com.fish.ipcserver.Student; 5 | import com.fish.ipcserver.RemoteCallback; 6 | 7 | interface IStudentInfo { 8 | //主动获取 9 | Student getStudentInfo(); 10 | //注册回调 11 | oneway void register(in RemoteCallback callback); 12 | } -------------------------------------------------------------------------------- /ipcserver/src/main/aidl/com/fish/ipcserver/RemoteCallback.aidl: -------------------------------------------------------------------------------- 1 | // RemoteCallback.aidl 2 | package com.fish.ipcserver; 3 | 4 | import com.fish.ipcserver.Student; 5 | interface RemoteCallback { 6 | //回调 7 | oneway void onCallback(in Student student); 8 | } -------------------------------------------------------------------------------- /ipcserver/src/main/aidl/com/fish/ipcserver/Student.aidl: -------------------------------------------------------------------------------- 1 | // Student.aidl 2 | package com.fish.ipcserver; 3 | 4 | parcelable Student; -------------------------------------------------------------------------------- /ipcserver/src/main/java/com/fish/ipcserver/AMSTargetProvider.java: -------------------------------------------------------------------------------- 1 | package com.fish.ipcserver; 2 | 3 | import android.content.ContentProvider; 4 | import android.content.ContentValues; 5 | import android.content.UriMatcher; 6 | import android.database.Cursor; 7 | import android.net.Uri; 8 | 9 | import androidx.annotation.NonNull; 10 | import androidx.annotation.Nullable; 11 | 12 | public class AMSTargetProvider extends ContentProvider { 13 | public static String AUTHORITY = "com.fish.AMSTargetProvider"; 14 | private static int MATCH_CODE = 1000; 15 | private static UriMatcher uriMatcher; 16 | static { 17 | uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); 18 | uriMatcher.addURI(AUTHORITY, "ams", MATCH_CODE); 19 | } 20 | 21 | @Override 22 | public boolean onCreate() { 23 | return false; 24 | } 25 | 26 | @Nullable 27 | @Override 28 | public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) { 29 | if (uriMatcher.match(uri) == MATCH_CODE) { 30 | int a = 5; 31 | } 32 | return null; 33 | } 34 | 35 | @Nullable 36 | @Override 37 | public String getType(@NonNull Uri uri) { 38 | return null; 39 | } 40 | 41 | @Nullable 42 | @Override 43 | public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) { 44 | if (uriMatcher.match(uri) == MATCH_CODE) { 45 | notifyChange(); 46 | } 47 | return null; 48 | } 49 | 50 | @Override 51 | public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) { 52 | return 0; 53 | } 54 | 55 | @Override 56 | public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) { 57 | return 0; 58 | } 59 | 60 | private void notifyChange() { 61 | Uri notifyUri = Uri.parse("content://" + AUTHORITY + "/ams"); 62 | getContext().getContentResolver().notifyChange(notifyUri, null); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /ipcserver/src/main/java/com/fish/ipcserver/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.fish.ipcserver; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | 5 | import android.content.ComponentName; 6 | import android.content.Context; 7 | import android.content.Intent; 8 | import android.content.ServiceConnection; 9 | import android.os.Bundle; 10 | import android.os.IBinder; 11 | import android.view.View; 12 | 13 | public class MainActivity extends AppCompatActivity { 14 | 15 | StudentService.MyStudent myStudent; 16 | private boolean isConnected = false; 17 | 18 | private ServiceConnection serviceConnection = new ServiceConnection() { 19 | @Override 20 | public void onServiceConnected(ComponentName componentName, IBinder iBinder) { 21 | myStudent = (StudentService.MyStudent)IStudentInfo.Stub.asInterface(iBinder); 22 | isConnected = true; 23 | } 24 | 25 | @Override 26 | public void onServiceDisconnected(ComponentName componentName) { 27 | isConnected = false; 28 | } 29 | }; 30 | 31 | @Override 32 | protected void onCreate(Bundle savedInstanceState) { 33 | super.onCreate(savedInstanceState); 34 | setContentView(R.layout.activity_main); 35 | 36 | findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() { 37 | @Override 38 | public void onClick(View view) { 39 | if (isConnected && myStudent != null) { 40 | myStudent.changeScore(); 41 | } else { 42 | Intent intent = new Intent(MainActivity.this, StudentService.class); 43 | view.getContext().bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE); 44 | } 45 | } 46 | }); 47 | } 48 | } -------------------------------------------------------------------------------- /ipcserver/src/main/java/com/fish/ipcserver/Student.java: -------------------------------------------------------------------------------- 1 | package com.fish.ipcserver; 2 | 3 | import android.os.Parcel; 4 | import android.os.Parcelable; 5 | 6 | public class Student implements Parcelable { 7 | private String name; 8 | private int age; 9 | private float score; 10 | 11 | @Override 12 | public int describeContents() { 13 | return 0; 14 | } 15 | 16 | @Override 17 | public void writeToParcel(Parcel dest, int flags) { 18 | dest.writeString(this.name); 19 | dest.writeInt(this.age); 20 | dest.writeFloat(this.score); 21 | } 22 | 23 | public void readFromParcel(Parcel source) { 24 | this.name = source.readString(); 25 | this.age = source.readInt(); 26 | this.score = source.readFloat(); 27 | } 28 | 29 | public Student() { 30 | } 31 | 32 | protected Student(Parcel in) { 33 | this.name = in.readString(); 34 | this.age = in.readInt(); 35 | this.score = in.readFloat(); 36 | } 37 | 38 | public static final Creator CREATOR = new Creator() { 39 | @Override 40 | public Student createFromParcel(Parcel source) { 41 | return new Student(source); 42 | } 43 | 44 | @Override 45 | public Student[] newArray(int size) { 46 | return new Student[size]; 47 | } 48 | }; 49 | 50 | public String getName() { 51 | return name; 52 | } 53 | 54 | public void setName(String name) { 55 | this.name = name; 56 | } 57 | 58 | public int getAge() { 59 | return age; 60 | } 61 | 62 | public void setAge(int age) { 63 | this.age = age; 64 | } 65 | 66 | public float getScore() { 67 | return score; 68 | } 69 | 70 | public void setScore(float score) { 71 | this.score = score; 72 | } 73 | 74 | @Override 75 | public String toString() { 76 | return "Student{" + 77 | "name='" + name + '\'' + 78 | ", age=" + age + 79 | ", score=" + score + 80 | '}'; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /ipcserver/src/main/java/com/fish/ipcserver/StudentService.java: -------------------------------------------------------------------------------- 1 | package com.fish.ipcserver; 2 | 3 | import android.app.Service; 4 | import android.content.Intent; 5 | import android.os.IBinder; 6 | import android.os.RemoteException; 7 | import android.widget.Toast; 8 | 9 | import androidx.annotation.Nullable; 10 | 11 | public class StudentService extends Service { 12 | 13 | private Student student; 14 | private RemoteCallback remoteCallback; 15 | private MyStudent myStudent; 16 | 17 | @Override 18 | public void onCreate() { 19 | super.onCreate(); 20 | student = new Student(); 21 | student.setAge(19); 22 | student.setName("小明"); 23 | myStudent = new MyStudent(); 24 | } 25 | 26 | class MyStudent extends IStudentInfo.Stub { 27 | @Override 28 | public Student getStudentInfo() throws RemoteException { 29 | return student; 30 | } 31 | 32 | @Override 33 | public void register(RemoteCallback callback) throws RemoteException { 34 | //客户端注册的回调实例保存到成员变量 remoteCallback 35 | remoteCallback = callback; 36 | } 37 | 38 | public void changeScore() { 39 | //学生成绩发生改变 40 | student.setScore((float)(Math.random() * 100)); 41 | try { 42 | if (remoteCallback != null) 43 | //调用回调实例方法,将变化后的学生信息传递给客户端 44 | remoteCallback.onCallback(student); 45 | } catch (RemoteException e) { 46 | e.printStackTrace(); 47 | } 48 | } 49 | } 50 | 51 | @Nullable 52 | @Override 53 | public IBinder onBind(Intent intent) { 54 | //将Stub 返回给客户端 55 | Toast.makeText(StudentService.this, "收到客户端连接请求", Toast.LENGTH_SHORT).show(); 56 | return myStudent.asBinder(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /ipcserver/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /ipcserver/src/main/res/layout/activity_fileprovider.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 18 | 19 |