├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── libraries │ ├── BigImageViewer_1_2_7.xml │ ├── FrescoImageLoader_1_2_7.xml │ ├── GlideImageLoader_1_2_7.xml │ ├── ProgressPieIndicator_1_2_7.xml │ ├── animated_base_1_1_0.xml │ ├── animated_base_support_1_1_0.xml │ ├── animated_gif_1_1_0.xml │ ├── animated_vector_drawable_25_3_0.xml │ ├── animated_webp_1_1_0.xml │ ├── appcompat_v7_25_3_0.xml │ ├── bolts_tasks_1_4_0.xml │ ├── commons_io_2_5.xml │ ├── constraint_layout_1_0_0_alpha8.xml │ ├── constraint_layout_solver_1_0_0_alpha8.xml │ ├── drawee_1_1_0.xml │ ├── espresso_core_2_2_2.xml │ ├── espresso_idling_resource_2_2_2.xml │ ├── exposed_instrumentation_api_publish_0_5.xml │ ├── fbcore_1_1_0.xml │ ├── fresco_1_1_0.xml │ ├── fresco_processors_2_0_0.xml │ ├── glide_3_7_0.xml │ ├── glide_transformations_2_0_1.xml │ ├── hamcrest_core_1_3.xml │ ├── hamcrest_integration_1_3.xml │ ├── hamcrest_library_1_3.xml │ ├── imageloader_unspecified.xml │ ├── imagepipeline_1_1_0.xml │ ├── imagepipeline_base_1_1_0.xml │ ├── imagepipeline_okhttp3_0_12_0.xml │ ├── javawriter_2_1_1.xml │ ├── javax_annotation_api_1_2.xml │ ├── javax_inject_1.xml │ ├── jsr305_2_0_1.xml │ ├── junit_4_12.xml │ ├── library_1_0_4.xml │ ├── library_2_4_0.xml │ ├── logger_1_15.xml │ ├── multidex_1_0_1.xml │ ├── multidex_instrumentation_1_0_1.xml │ ├── okhttp3_integration_1_4_0.xml │ ├── okhttp_3_6_0.xml │ ├── okio_1_11_0.xml │ ├── recyclerview_v7_25_3_0.xml │ ├── rules_0_5.xml │ ├── runner_0_5.xml │ ├── subsampling_scale_image_view_3_6_0.xml │ ├── support_annotations_25_3_0.xml │ ├── support_compat_25_3_0.xml │ ├── support_core_ui_25_3_0.xml │ ├── support_core_utils_25_3_0.xml │ ├── support_fragment_25_3_0.xml │ ├── support_media_compat_25_3_0.xml │ ├── support_v4_25_3_0.xml │ ├── support_vector_drawable_25_3_0.xml │ └── webpsupport_1_1_0.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── ImageLoaderDemo ├── .gitignore ├── .idea │ ├── compiler.xml │ ├── copyright │ │ └── profiles_settings.xml │ ├── encodings.xml │ ├── gradle.xml │ ├── inspectionProfiles │ │ ├── Project_Default.xml │ │ └── profiles_settings.xml │ ├── misc.xml │ ├── modules.xml │ ├── runConfigurations.xml │ └── vcs.xml ├── ImageLoader │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── imageloader │ │ │ └── libin │ │ │ └── com │ │ │ └── images │ │ │ └── ExampleInstrumentedTest.java │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── imageloader │ │ │ └── libin │ │ │ └── com │ │ │ └── images │ │ │ ├── config │ │ │ ├── AnimationMode.java │ │ │ ├── Contants.java │ │ │ ├── GlobalConfig.java │ │ │ ├── PriorityMode.java │ │ │ ├── ScaleMode.java │ │ │ ├── ShapeMode.java │ │ │ └── SingleConfig.java │ │ │ ├── imagei │ │ │ └── ImageDownLoadCallBack.java │ │ │ ├── loader │ │ │ ├── GlideLoader.java │ │ │ ├── ILoader.java │ │ │ └── ImageLoader.java │ │ │ └── utils │ │ │ ├── DownLoadImageService.java │ │ │ ├── ImageUtil.java │ │ │ └── MultiView.java │ │ └── res │ │ └── values │ │ ├── strings.xml │ │ └── style.xml ├── app │ ├── .gitignore │ ├── CMakeLists.txt │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── imageloader │ │ │ └── libin │ │ │ └── com │ │ │ └── imageloaderdemo │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── assets │ │ │ └── jpeg_test.jpeg │ │ ├── cpp │ │ │ └── native-lib.cpp │ │ ├── java │ │ │ └── imageloader │ │ │ │ └── libin │ │ │ │ └── com │ │ │ │ └── imageloaderdemo │ │ │ │ ├── MainApplication.java │ │ │ │ ├── activity │ │ │ │ ├── BigImageActivity.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── SimpleActivity.java │ │ │ │ └── ViewpagerActivity.java │ │ │ │ └── config │ │ │ │ └── imageconfig.java │ │ └── res │ │ │ ├── drawable-hdpi │ │ │ ├── b000.webp │ │ │ ├── gif_test.gif │ │ │ ├── jpeg_test.jpeg │ │ │ └── webp_test.webp │ │ │ ├── drawable │ │ │ └── ads.gif │ │ │ ├── layout │ │ │ ├── activity_big_image.xml │ │ │ ├── activity_main.xml │ │ │ ├── activity_sample.xml │ │ │ └── activity_viewpager.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 │ │ │ └── jpeg_test.jpeg │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── test │ │ └── java │ │ └── imageloader │ │ └── libin │ │ └── com │ │ └── imageloaderdemo │ │ └── ExampleUnitTest.java ├── build.gradle ├── codeiris │ └── codeIrisExport.json ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # Intellij 36 | *.iml 37 | .idea/workspace.xml 38 | 39 | # Keystore files 40 | *.jks 41 | 42 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/libraries/BigImageViewer_1_2_7.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/FrescoImageLoader_1_2_7.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/GlideImageLoader_1_2_7.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/ProgressPieIndicator_1_2_7.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/animated_base_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/animated_base_support_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/animated_gif_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/animated_vector_drawable_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/animated_webp_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/appcompat_v7_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/bolts_tasks_1_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/commons_io_2_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/constraint_layout_1_0_0_alpha8.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/constraint_layout_solver_1_0_0_alpha8.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/drawee_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/espresso_core_2_2_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/espresso_idling_resource_2_2_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/exposed_instrumentation_api_publish_0_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/fbcore_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/fresco_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/fresco_processors_2_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/glide_3_7_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/glide_transformations_2_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/hamcrest_integration_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/hamcrest_library_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/imageloader_unspecified.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/imagepipeline_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/imagepipeline_base_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/imagepipeline_okhttp3_0_12_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/javawriter_2_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/javax_annotation_api_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/javax_inject_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/jsr305_2_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/junit_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/library_1_0_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/library_2_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/logger_1_15.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/multidex_1_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/multidex_instrumentation_1_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/okhttp3_integration_1_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/okhttp_3_6_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/okio_1_11_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/recyclerview_v7_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/rules_0_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/runner_0_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/subsampling_scale_image_view_3_6_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/support_annotations_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/support_compat_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/support_core_ui_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/support_core_utils_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/support_fragment_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/support_media_compat_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/support_v4_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/support_vector_drawable_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/webpsupport_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 36 | 37 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 78 | 79 | 80 | 92 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 119 | 120 | 121 | 122 | 123 | 1.8 124 | 125 | 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ImageLoaderDemo/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /ImageLoaderDemo/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /ImageLoaderDemo/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /ImageLoaderDemo/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ImageLoaderDemo/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /ImageLoaderDemo/.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | -------------------------------------------------------------------------------- /ImageLoaderDemo/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /ImageLoaderDemo/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 36 | 37 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 78 | 79 | 80 | 92 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 119 | 120 | 121 | 122 | 123 | 1.8 124 | 125 | 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /ImageLoaderDemo/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /ImageLoaderDemo/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /ImageLoaderDemo/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.dcendents.android-maven' 3 | apply plugin: 'com.jfrog.bintray' 4 | 5 | android { 6 | compileSdkVersion 25 7 | buildToolsVersion "25.0.2" 8 | 9 | defaultConfig { 10 | minSdkVersion 11 11 | targetSdkVersion 25 12 | versionCode 1 13 | versionName "1.0" 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | lintOptions { 23 | abortOnError false 24 | } 25 | 26 | } 27 | 28 | dependencies { 29 | compile fileTree(include: ['*.jar'], dir: 'libs') 30 | compile 'com.android.support:appcompat-v7:25.3.1' 31 | //gradle 32 | compile 'com.github.bumptech.glide:glide:3.7.0' 33 | compile 'com.android.support:support-v4:25.3.1' 34 | compile 'com.squareup.okhttp3:okhttp:3.7.0' 35 | compile 'jp.wasabeef:glide-transformations:2.0.2' 36 | compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1' 37 | } 38 | 39 | def siteUrl = 'https://github.com/libin7278/ImageLoader' // 项目的主页 40 | def gitUrl = 'https://github.com/libin7278/ImageLoader.git' // Git仓库的url 41 | group = "com.libin.imageloader" // Maven Group ID for the artifact,一般填你唯一的包名 发布到组织名称名字,必须填写 42 | //发布到JCenter上的项目名字,必须填写 43 | def libName = "AndroidFastDevFrame" 44 | // 版本号,下次更新是只需要更改版本号即可 45 | version = "1.0.3" 46 | install { 47 | repositories.mavenInstaller { 48 | // This generates POM.xml with proper parameters 49 | pom { 50 | project { 51 | packaging 'aar' 52 | // Add your description here 53 | name '图片加载集成glide' //项目的描述 你可以多写一点 54 | url siteUrl 55 | // Set your license 56 | licenses { 57 | license { 58 | name '图片加载集成glide 并添加多种滤镜,本地多边形图片加载' 59 | url 'https://github.com/libin7278/ImageLoader' 60 | } 61 | } 62 | developers { 63 | developer { 64 | id 'libin' //填写的一些基本信息 65 | name 'Jason' 66 | email 'Jasonlibin2@gmail.com' 67 | } 68 | } 69 | scm { 70 | connection gitUrl 71 | developerConnection gitUrl 72 | url siteUrl 73 | } 74 | } 75 | } 76 | } 77 | } 78 | task sourcesJar(type: Jar) { 79 | from android.sourceSets.main.java.srcDirs 80 | classifier = 'sources' 81 | } 82 | task javadoc(type: Javadoc) { 83 | source = android.sourceSets.main.java.srcDirs 84 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 85 | } 86 | task javadocJar(type: Jar, dependsOn: javadoc) { 87 | classifier = 'javadoc' 88 | from javadoc.destinationDir 89 | } 90 | artifacts { 91 | archives javadocJar 92 | archives sourcesJar 93 | } 94 | Properties properties = new Properties() 95 | properties.load(project.rootProject.file('local.properties').newDataInputStream()) 96 | bintray { 97 | user = "libin7278jc" 98 | key = "3e1fb10e4e7d850e068********16a8f121" 99 | configurations = ['archives'] 100 | pkg { 101 | userOrg="jasonp" 102 | repo = "ImageLoader" 103 | name = "ImageLoader" //发布到JCenter上的项目名字 104 | websiteUrl = siteUrl 105 | vcsUrl = gitUrl 106 | licenses = ["Apache-2.0"] 107 | publish = true 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Applications/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/src/androidTest/java/imageloader/libin/com/images/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.images; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("imageloader.libin.com.images.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/config/AnimationMode.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.images.config; 2 | 3 | /** 4 | * Created by doudou on 2017/4/24. 5 | */ 6 | 7 | public interface AnimationMode { 8 | int ANIMATIONID = 1; 9 | 10 | int ANIMATION = 2; 11 | 12 | int ANIMATOR = 3; 13 | } 14 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/config/Contants.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.images.config; 2 | 3 | /** 4 | * Created by doudou on 2017/5/3. 5 | */ 6 | 7 | public interface Contants { 8 | String FOREWARD_SLASH = "/"; 9 | String ASSERTS_PATH ="file:///android_asset/" ; 10 | String ANDROID_RESOURCE ="android.resource://" ; 11 | String RAW ="/raw/" ; 12 | } 13 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/config/GlobalConfig.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.images.config; 2 | 3 | import android.content.Context; 4 | import android.content.res.Configuration; 5 | import android.os.Handler; 6 | import android.os.Looper; 7 | import android.view.WindowManager; 8 | 9 | import com.bumptech.glide.MemoryCategory; 10 | 11 | import imageloader.libin.com.images.loader.GlideLoader; 12 | import imageloader.libin.com.images.loader.ILoader; 13 | 14 | /** 15 | * Created by doudou on 2017/4/10. 16 | */ 17 | 18 | public class GlobalConfig { 19 | 20 | public static String baseUrl; 21 | public static Context context; 22 | 23 | /** 24 | * 屏幕高度 25 | */ 26 | private static int winHeight; 27 | 28 | /** 29 | * 屏幕宽度 30 | */ 31 | private static int winWidth; 32 | 33 | /** 34 | * lrucache 最大值 35 | */ 36 | public static int cacheMaxSize; 37 | 38 | /** 39 | * https是否忽略校验,默认不忽略 40 | */ 41 | public static boolean ignoreCertificateVerify = false; 42 | 43 | public static void init(Context context, int cacheSizeInM, MemoryCategory memoryCategory, boolean isInternalCD) { 44 | 45 | GlobalConfig.context = context; 46 | GlobalConfig.cacheMaxSize = cacheSizeInM; 47 | WindowManager wm = (WindowManager) context 48 | .getSystemService(Context.WINDOW_SERVICE); 49 | 50 | GlobalConfig.winWidth = wm.getDefaultDisplay().getWidth(); 51 | GlobalConfig.winHeight = wm.getDefaultDisplay().getHeight(); 52 | getLoader().init(context, cacheSizeInM, memoryCategory, isInternalCD); 53 | 54 | } 55 | 56 | private static Handler mainHandler; 57 | 58 | public static Handler getMainHandler() { 59 | if (mainHandler == null) { 60 | mainHandler = new Handler(Looper.getMainLooper()); 61 | } 62 | return mainHandler; 63 | } 64 | 65 | private static ILoader loader; 66 | 67 | public static ILoader getLoader() { 68 | 69 | if (loader == null) { 70 | loader = new GlideLoader(); 71 | } 72 | 73 | return loader; 74 | } 75 | 76 | 77 | public static int getWinHeight() { 78 | if (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { 79 | return winHeight < winWidth ? winHeight : winWidth; 80 | } else if (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { 81 | return winHeight > winWidth ? winHeight : winWidth; 82 | } 83 | return winHeight; 84 | } 85 | 86 | public static int getWinWidth() { 87 | if (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { 88 | return winHeight > winWidth ? winHeight : winWidth; 89 | } else if (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { 90 | return winHeight < winWidth ? winHeight : winWidth; 91 | } 92 | return winWidth; 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/config/PriorityMode.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.images.config; 2 | 3 | /** 4 | * Created by doudou on 2017/4/25. 5 | */ 6 | 7 | public interface PriorityMode { 8 | int PRIORITY_LOW = 1 ; 9 | 10 | int PRIORITY_NORMAL = 2 ; 11 | 12 | int PRIORITY_HIGH = 3 ; 13 | 14 | int PRIORITY_IMMEDIATE = 4 ; 15 | } 16 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/config/ScaleMode.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.images.config; 2 | 3 | /** 4 | * Created by doudou on 2017/4/10. 5 | */ 6 | 7 | public interface ScaleMode { 8 | /** 9 | * 等比例缩放图片,直到图片的狂高都大于等于ImageView的宽度,然后截取中间的显示 10 | */ 11 | int CENTER_CROP = 1; 12 | /** 13 | * 等比例缩放图片,宽或者是高等于ImageView的宽或者是高 14 | */ 15 | int FIT_CENTER = 2; 16 | } 17 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/config/ShapeMode.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.images.config; 2 | 3 | /** 4 | * Created by doudou on 2017/4/10. 5 | */ 6 | 7 | public interface ShapeMode { 8 | /** 9 | * 直角矩形 10 | */ 11 | int RECT = 0; 12 | 13 | /** 14 | * 圆角矩形 15 | */ 16 | int RECT_ROUND = 1; 17 | 18 | /** 19 | * 椭圆/圆 20 | */ 21 | int OVAL = 2; 22 | 23 | /** 24 | *正方形 25 | */ 26 | int SQUARE = 3; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/imagei/ImageDownLoadCallBack.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.images.imagei; 2 | 3 | import android.graphics.Bitmap; 4 | 5 | /** 6 | * Created by doudou on 2017/5/2. 7 | */ 8 | 9 | public interface ImageDownLoadCallBack { 10 | 11 | void onDownLoadSuccess(Bitmap bitmap); 12 | 13 | void onDownLoadFailed(); 14 | } 15 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/loader/GlideLoader.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.images.loader; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.PointF; 6 | import android.net.Uri; 7 | import android.support.annotation.Nullable; 8 | import android.text.TextUtils; 9 | import android.util.Log; 10 | import android.view.View; 11 | import android.widget.ImageView; 12 | 13 | import com.bumptech.glide.DrawableTypeRequest; 14 | import com.bumptech.glide.Glide; 15 | import com.bumptech.glide.GlideBuilder; 16 | import com.bumptech.glide.MemoryCategory; 17 | import com.bumptech.glide.Priority; 18 | import com.bumptech.glide.RequestManager; 19 | import com.bumptech.glide.load.Transformation; 20 | import com.bumptech.glide.load.engine.cache.ExternalCacheDiskCacheFactory; 21 | import com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory; 22 | import com.bumptech.glide.request.animation.GlideAnimation; 23 | import com.bumptech.glide.request.target.SimpleTarget; 24 | 25 | import imageloader.libin.com.images.config.AnimationMode; 26 | import imageloader.libin.com.images.config.GlobalConfig; 27 | import imageloader.libin.com.images.config.PriorityMode; 28 | import imageloader.libin.com.images.config.ScaleMode; 29 | import imageloader.libin.com.images.config.ShapeMode; 30 | import imageloader.libin.com.images.config.SingleConfig; 31 | import imageloader.libin.com.images.utils.DownLoadImageService; 32 | import imageloader.libin.com.images.utils.ImageUtil; 33 | import jp.wasabeef.glide.transformations.BlurTransformation; 34 | import jp.wasabeef.glide.transformations.ColorFilterTransformation; 35 | import jp.wasabeef.glide.transformations.CropCircleTransformation; 36 | import jp.wasabeef.glide.transformations.CropSquareTransformation; 37 | import jp.wasabeef.glide.transformations.GrayscaleTransformation; 38 | import jp.wasabeef.glide.transformations.RoundedCornersTransformation; 39 | import jp.wasabeef.glide.transformations.gpu.BrightnessFilterTransformation; 40 | import jp.wasabeef.glide.transformations.gpu.ContrastFilterTransformation; 41 | import jp.wasabeef.glide.transformations.gpu.InvertFilterTransformation; 42 | import jp.wasabeef.glide.transformations.gpu.PixelationFilterTransformation; 43 | import jp.wasabeef.glide.transformations.gpu.SepiaFilterTransformation; 44 | import jp.wasabeef.glide.transformations.gpu.SketchFilterTransformation; 45 | import jp.wasabeef.glide.transformations.gpu.SwirlFilterTransformation; 46 | import jp.wasabeef.glide.transformations.gpu.ToonFilterTransformation; 47 | import jp.wasabeef.glide.transformations.gpu.VignetteFilterTransformation; 48 | 49 | 50 | /** 51 | * Created by doudou on 2017/4/10. 52 | * 参考: 53 | * https://mrfu.me/2016/02/28/Glide_Sries_Roundup/ 54 | */ 55 | 56 | public class GlideLoader implements ILoader { 57 | 58 | /** 59 | * @param context 上下文 60 | * @param cacheSizeInM Glide默认磁盘缓存最大容量250MB 61 | * @param memoryCategory 调整内存缓存的大小 LOW(0.5f) / NORMAL(1f) / HIGH(1.5f); 62 | * @param isInternalCD true 磁盘缓存到应用的内部目录 / false 磁盘缓存到外部存 63 | */ 64 | @Override 65 | public void init(Context context, int cacheSizeInM, MemoryCategory memoryCategory, boolean isInternalCD) { 66 | Glide.get(context).setMemoryCategory(memoryCategory); //如果在应用当中想要调整内存缓存的大小,开发者可以通过如下方式: 67 | GlideBuilder builder = new GlideBuilder(context); 68 | if (isInternalCD) { 69 | builder.setDiskCache(new InternalCacheDiskCacheFactory(context, cacheSizeInM * 1024 * 1024)); 70 | } else { 71 | builder.setDiskCache(new ExternalCacheDiskCacheFactory(context, cacheSizeInM * 1024 * 1024)); 72 | } 73 | } 74 | 75 | @Override 76 | public void request(final SingleConfig config) { 77 | RequestManager requestManager = Glide.with(config.getContext()); 78 | DrawableTypeRequest request = getDrawableTypeRequest(config, requestManager); 79 | 80 | if (config.isAsBitmap()) { 81 | SimpleTarget target = new SimpleTarget(config.getWidth(), config.getHeight()) { 82 | @Override 83 | public void onResourceReady(Bitmap bitmap, GlideAnimation glideAnimation) { 84 | config.getBitmapListener().onSuccess(bitmap); 85 | } 86 | }; 87 | 88 | setShapeModeAndBlur(config, request); 89 | 90 | if (config.getDiskCacheStrategy() != null) { 91 | request.diskCacheStrategy(config.getDiskCacheStrategy()); 92 | } 93 | 94 | request.asBitmap().into(target); 95 | 96 | } else { 97 | 98 | if (request == null) { 99 | return; 100 | } 101 | 102 | if (ImageUtil.shouldSetPlaceHolder(config)) { 103 | request.placeholder(config.getPlaceHolderResId()); 104 | } 105 | 106 | int scaleMode = config.getScaleMode(); 107 | 108 | switch (scaleMode) { 109 | case ScaleMode.CENTER_CROP: 110 | request.centerCrop(); 111 | break; 112 | case ScaleMode.FIT_CENTER: 113 | request.fitCenter(); 114 | break; 115 | default: 116 | request.fitCenter(); 117 | break; 118 | } 119 | 120 | setShapeModeAndBlur(config, request); 121 | 122 | //设置缩略图 123 | if (config.getThumbnail() != 0) { 124 | request.thumbnail(config.getThumbnail()); 125 | } 126 | 127 | //设置图片加载的分辨 sp 128 | if (config.getoWidth() != 0 && config.getoHeight() != 0) { 129 | request.override(config.getoWidth(), config.getoHeight()); 130 | } 131 | 132 | //是否跳过磁盘存储 133 | if (config.getDiskCacheStrategy() != null) { 134 | request.diskCacheStrategy(config.getDiskCacheStrategy()); 135 | } 136 | 137 | //设置图片加载动画 138 | setAnimator(config, request); 139 | 140 | //设置图片加载优先级 141 | setPriority(config, request); 142 | 143 | if (config.getErrorResId() > 0) { 144 | request.error(config.getErrorResId()); 145 | } 146 | 147 | if(config.isGif()){ 148 | request.asGif(); 149 | } 150 | 151 | if (config.getTarget() instanceof ImageView) { 152 | request.into((ImageView) config.getTarget()); 153 | 154 | } 155 | } 156 | 157 | } 158 | 159 | /** 160 | * 设置加载优先级 161 | * 162 | * @param config 163 | * @param request 164 | */ 165 | private void setPriority(SingleConfig config, DrawableTypeRequest request) { 166 | switch (config.getPriority()) { 167 | case PriorityMode.PRIORITY_LOW: 168 | request.priority(Priority.LOW); 169 | break; 170 | case PriorityMode.PRIORITY_NORMAL: 171 | request.priority(Priority.NORMAL); 172 | break; 173 | case PriorityMode.PRIORITY_HIGH: 174 | request.priority(Priority.HIGH); 175 | break; 176 | case PriorityMode.PRIORITY_IMMEDIATE: 177 | request.priority(Priority.IMMEDIATE); 178 | break; 179 | default: 180 | request.priority(Priority.IMMEDIATE); 181 | break; 182 | } 183 | } 184 | 185 | /** 186 | * 设置加载进入动画 187 | * 188 | * @param config 189 | * @param request 190 | */ 191 | private void setAnimator(SingleConfig config, DrawableTypeRequest request) { 192 | if (config.getAnimationType() == AnimationMode.ANIMATIONID) { 193 | request.animate(config.getAnimationId()); 194 | } else if (config.getAnimationType() == AnimationMode.ANIMATOR) { 195 | request.animate(config.getAnimator()); 196 | } else if (config.getAnimationType() == AnimationMode.ANIMATION) { 197 | request.animate(config.getAnimation()); 198 | } 199 | } 200 | 201 | @Nullable 202 | private DrawableTypeRequest getDrawableTypeRequest(SingleConfig config, RequestManager requestManager) { 203 | DrawableTypeRequest request = null; 204 | if (!TextUtils.isEmpty(config.getUrl())) { 205 | request = requestManager.load(ImageUtil.appendUrl(config.getUrl())); 206 | Log.e("TAG","getUrl : "+config.getUrl()); 207 | } else if (!TextUtils.isEmpty(config.getFilePath())) { 208 | request = requestManager.load(ImageUtil.appendUrl(config.getFilePath())); 209 | Log.e("TAG","getFilePath : "+config.getFilePath()); 210 | } else if (!TextUtils.isEmpty(config.getContentProvider())) { 211 | request = requestManager.loadFromMediaStore(Uri.parse(config.getContentProvider())); 212 | Log.e("TAG","getContentProvider : "+config.getContentProvider()); 213 | } else if (config.getResId() > 0) { 214 | request = requestManager.load(config.getResId()); 215 | Log.e("TAG","getResId : "+config.getResId()); 216 | } else if(config.getFile() != null){ 217 | request = requestManager.load(config.getFile()); 218 | Log.e("TAG","getFile : "+config.getFile()); 219 | } else if(!TextUtils.isEmpty(config.getAssertspath())){ 220 | request = requestManager.load(config.getAssertspath()); 221 | Log.e("TAG","getAssertspath : "+config.getAssertspath()); 222 | } else if(!TextUtils.isEmpty(config.getRawPath())){ 223 | request = requestManager.load(config.getRawPath()); 224 | Log.e("TAG","getRawPath : "+config.getRawPath()); 225 | } 226 | return request; 227 | } 228 | 229 | /** 230 | * 设置图片滤镜和形状 231 | * 232 | * @param config 233 | * @param request 234 | */ 235 | private void setShapeModeAndBlur(SingleConfig config, DrawableTypeRequest request) { 236 | 237 | int count = 0; 238 | 239 | Transformation[] transformation = new Transformation[statisticsCount(config)]; 240 | 241 | if (config.isNeedBlur()) { 242 | transformation[count] = new BlurTransformation(config.getContext(), config.getBlurRadius()); 243 | count++; 244 | } 245 | 246 | if (config.isNeedBrightness()) { 247 | transformation[count] = new BrightnessFilterTransformation(config.getContext(), config.getBrightnessLeve()); //亮度 248 | count++; 249 | } 250 | 251 | if (config.isNeedGrayscale()) { 252 | transformation[count] = new GrayscaleTransformation(config.getContext()); //黑白效果 253 | count++; 254 | } 255 | 256 | if (config.isNeedFilteColor()) { 257 | transformation[count] = new ColorFilterTransformation(config.getContext(), config.getFilteColor()); 258 | count++; 259 | } 260 | 261 | if (config.isNeedSwirl()) { 262 | transformation[count] = new SwirlFilterTransformation(config.getContext(), 0.5f, 1.0f, new PointF(0.5f, 0.5f)); //漩涡 263 | count++; 264 | } 265 | 266 | if (config.isNeedToon()) { 267 | transformation[count] = new ToonFilterTransformation(config.getContext()); //油画 268 | count++; 269 | } 270 | 271 | if (config.isNeedSepia()) { 272 | transformation[count] = new SepiaFilterTransformation(config.getContext()); //墨画 273 | count++; 274 | } 275 | 276 | if (config.isNeedContrast()) { 277 | transformation[count] = new ContrastFilterTransformation(config.getContext(), config.getContrastLevel()); //锐化 278 | count++; 279 | } 280 | 281 | if (config.isNeedInvert()) { 282 | transformation[count] = new InvertFilterTransformation(config.getContext()); //胶片 283 | count++; 284 | } 285 | 286 | if (config.isNeedPixelation()) { 287 | transformation[count] =new PixelationFilterTransformation(config.getContext(), config.getPixelationLevel()); //马赛克 288 | count++; 289 | } 290 | 291 | if (config.isNeedSketch()) { 292 | transformation[count] =new SketchFilterTransformation(config.getContext()); //素描 293 | count++; 294 | } 295 | 296 | if (config.isNeedVignette()) { 297 | transformation[count] =new VignetteFilterTransformation(config.getContext(), new PointF(0.5f, 0.5f), 298 | new float[] { 0.0f, 0.0f, 0.0f }, 0f, 0.75f);//晕映 299 | count++; 300 | } 301 | 302 | switch (config.getShapeMode()) { 303 | case ShapeMode.RECT: 304 | 305 | break; 306 | case ShapeMode.RECT_ROUND: 307 | transformation[count] = new RoundedCornersTransformation 308 | (config.getContext(), config.getRectRoundRadius(), 0, RoundedCornersTransformation.CornerType.ALL); 309 | count++; 310 | break; 311 | case ShapeMode.OVAL: 312 | transformation[count] = new CropCircleTransformation(config.getContext()); 313 | count++; 314 | break; 315 | 316 | case ShapeMode.SQUARE: 317 | transformation[count] = new CropSquareTransformation(config.getContext()); 318 | count++; 319 | break; 320 | } 321 | 322 | if (transformation.length != 0) { 323 | request.bitmapTransform(transformation); 324 | 325 | } 326 | 327 | } 328 | 329 | private int statisticsCount(SingleConfig config) { 330 | int count = 0; 331 | 332 | if (config.getShapeMode() == ShapeMode.OVAL || config.getShapeMode() == ShapeMode.RECT_ROUND || config.getShapeMode() == ShapeMode.SQUARE) { 333 | count++; 334 | } 335 | 336 | if (config.isNeedBlur()) { 337 | count++; 338 | } 339 | 340 | if (config.isNeedFilteColor()) { 341 | count++; 342 | } 343 | 344 | if (config.isNeedBrightness()) { 345 | count++; 346 | } 347 | 348 | if (config.isNeedGrayscale()) { 349 | count++; 350 | } 351 | 352 | if (config.isNeedSwirl()) { 353 | count++; 354 | } 355 | 356 | if (config.isNeedToon()) { 357 | count++; 358 | } 359 | 360 | if (config.isNeedSepia()) { 361 | count++; 362 | } 363 | 364 | if (config.isNeedContrast()) { 365 | count++; 366 | } 367 | 368 | if (config.isNeedInvert()) { 369 | count++; 370 | } 371 | 372 | if (config.isNeedPixelation()) { 373 | count++; 374 | } 375 | 376 | if (config.isNeedSketch()) { 377 | count++; 378 | } 379 | 380 | if (config.isNeedVignette()) { 381 | count++; 382 | } 383 | 384 | return count; 385 | } 386 | 387 | @Override 388 | public void pause() { 389 | Glide.with(GlobalConfig.context).pauseRequestsRecursive(); 390 | 391 | } 392 | 393 | @Override 394 | public void resume() { 395 | Glide.with(GlobalConfig.context).resumeRequestsRecursive(); 396 | } 397 | 398 | @Override 399 | public void clearDiskCache() { 400 | Glide.get(GlobalConfig.context).clearDiskCache(); 401 | } 402 | 403 | @Override 404 | public void clearMomoryCache(View view) { 405 | Glide.clear(view); 406 | } 407 | 408 | @Override 409 | public void clearMomory() { 410 | Glide.get(GlobalConfig.context).clearMemory(); 411 | } 412 | 413 | @Override 414 | public boolean isCached(String url) { 415 | return false; 416 | } 417 | 418 | @Override 419 | public void trimMemory(int level) { 420 | Glide.with(GlobalConfig.context).onTrimMemory(level); 421 | } 422 | 423 | @Override 424 | public void clearAllMemoryCaches() { 425 | Glide.with(GlobalConfig.context).onLowMemory(); 426 | } 427 | 428 | @Override 429 | public void saveImageIntoGallery(DownLoadImageService downLoadImageService) { 430 | new Thread(downLoadImageService).start(); 431 | } 432 | 433 | } 434 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/loader/ILoader.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.images.loader; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | 6 | import com.bumptech.glide.MemoryCategory; 7 | 8 | import imageloader.libin.com.images.config.SingleConfig; 9 | import imageloader.libin.com.images.utils.DownLoadImageService; 10 | 11 | /** 12 | * Created by doudou on 2017/4/10. 13 | */ 14 | 15 | public interface ILoader { 16 | 17 | void init(Context context, int cacheSizeInM, MemoryCategory memoryCategory, boolean isInternalCD); 18 | 19 | void request(SingleConfig config); 20 | 21 | void pause(); 22 | 23 | void resume(); 24 | 25 | void clearDiskCache(); 26 | 27 | void clearMomoryCache(View view); 28 | 29 | void clearMomory(); 30 | 31 | boolean isCached(String url); 32 | 33 | void trimMemory(int level); 34 | 35 | void clearAllMemoryCaches(); 36 | 37 | void saveImageIntoGallery(DownLoadImageService downLoadImageService); 38 | } 39 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/loader/ImageLoader.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.images.loader; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | 6 | import com.bumptech.glide.Glide; 7 | import com.bumptech.glide.MemoryCategory; 8 | 9 | import imageloader.libin.com.images.config.GlobalConfig; 10 | import imageloader.libin.com.images.config.SingleConfig; 11 | import imageloader.libin.com.images.utils.DownLoadImageService; 12 | 13 | /** 14 | * Created by doudou on 2017/4/19. 15 | */ 16 | 17 | public class ImageLoader { 18 | public static Context context; 19 | /** 20 | * 默认最大缓存 21 | */ 22 | public static int CACHE_IMAGE_SIZE = 250; 23 | 24 | public static void init(final Context context) { 25 | init(context, CACHE_IMAGE_SIZE); 26 | } 27 | 28 | public static void init(final Context context, int cacheSizeInM) { 29 | init(context, cacheSizeInM, MemoryCategory.NORMAL); 30 | } 31 | 32 | public static void init(final Context context, int cacheSizeInM, MemoryCategory memoryCategory) { 33 | init(context, cacheSizeInM, memoryCategory, true); 34 | } 35 | 36 | /** 37 | * @param context 上下文 38 | * @param cacheSizeInM Glide默认磁盘缓存最大容量250MB 39 | * @param memoryCategory 调整内存缓存的大小 LOW(0.5f) / NORMAL(1f) / HIGH(1.5f); 40 | * @param isInternalCD true 磁盘缓存到应用的内部目录 / false 磁盘缓存到外部存 41 | */ 42 | public static void init(final Context context, int cacheSizeInM, MemoryCategory memoryCategory, boolean isInternalCD) { 43 | ImageLoader.context = context; 44 | GlobalConfig.init(context, cacheSizeInM, memoryCategory, isInternalCD); 45 | } 46 | 47 | /** 48 | * 获取当前的Loader 49 | * @return 50 | */ 51 | public static ILoader getActualLoader() { 52 | return GlobalConfig.getLoader(); 53 | } 54 | 55 | /** 56 | * 加载普通图片 57 | * 58 | * @param context 59 | * @return 60 | */ 61 | public static SingleConfig.ConfigBuilder with(Context context) { 62 | return new SingleConfig.ConfigBuilder(context); 63 | } 64 | 65 | public static void trimMemory(int level) { 66 | getActualLoader().trimMemory(level); 67 | } 68 | 69 | public static void clearAllMemoryCaches() { 70 | getActualLoader().clearAllMemoryCaches(); 71 | } 72 | 73 | public static void pauseRequests() { 74 | getActualLoader().pause(); 75 | 76 | } 77 | 78 | public static void resumeRequests() { 79 | getActualLoader().resume(); 80 | } 81 | 82 | /** 83 | *Cancel any pending loads Glide may have for the view and free any resources that may have been loaded for the view. 84 | * @param view 85 | */ 86 | public static void clearMomoryCache(View view) { 87 | getActualLoader().clearMomoryCache(view); 88 | } 89 | 90 | 91 | /** 92 | * Clears disk cache. 93 | * 94 | *

95 | * This method should always be called on a background thread, since it is a blocking call. 96 | *

97 | */ 98 | public static void clearDiskCache() { 99 | getActualLoader().clearDiskCache(); 100 | } 101 | 102 | /** 103 | * Clears as much memory as possible. 104 | */ 105 | public static void clearMomory() { 106 | getActualLoader().clearMomory(); 107 | } 108 | 109 | /** 110 | * 图片保存到相册 111 | * 112 | * @param downLoadImageService 113 | */ 114 | public static void saveImageIntoGallery(DownLoadImageService downLoadImageService) { 115 | getActualLoader().saveImageIntoGallery(downLoadImageService); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/utils/DownLoadImageService.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.images.utils; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.graphics.Bitmap; 6 | import android.net.Uri; 7 | import android.os.Environment; 8 | import android.provider.MediaStore; 9 | 10 | import com.bumptech.glide.Glide; 11 | import com.bumptech.glide.request.target.Target; 12 | 13 | import java.io.File; 14 | import java.io.FileNotFoundException; 15 | import java.io.FileOutputStream; 16 | import java.io.IOException; 17 | 18 | import imageloader.libin.com.images.imagei.ImageDownLoadCallBack; 19 | 20 | /** 21 | * 图片下载 22 | * Created by doudou on 2017/5/2. 23 | */ 24 | 25 | 26 | public class DownLoadImageService implements Runnable { 27 | private String url; 28 | private Context context; 29 | private ImageDownLoadCallBack callBack; 30 | private File currentFile; 31 | private String fileName; 32 | 33 | private boolean isSetMediaStore; 34 | 35 | public DownLoadImageService(Context context, String url,boolean isSetMediaStore , String fileName, ImageDownLoadCallBack callBack) { 36 | this.url = url; 37 | this.callBack = callBack; 38 | this.context = context; 39 | this.isSetMediaStore = isSetMediaStore; 40 | this.fileName = fileName; 41 | } 42 | 43 | @Override 44 | public void run() { 45 | 46 | Bitmap bitmap = null; 47 | try { 48 | bitmap = Glide.with(context) 49 | .load(url) 50 | .asBitmap() 51 | .into(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL) 52 | .get(); 53 | if (bitmap != null){ 54 | // 在这里执行图片保存方法 55 | saveImageToGallery(context,bitmap); 56 | } 57 | } catch (Exception e) { 58 | e.printStackTrace(); 59 | } finally { 60 | if (bitmap != null && currentFile.exists()) { 61 | callBack.onDownLoadSuccess(bitmap); 62 | } else { 63 | callBack.onDownLoadFailed(); 64 | } 65 | } 66 | } 67 | 68 | public void saveImageToGallery(Context context, Bitmap bmp) { 69 | // 首先保存图片 70 | File file = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsoluteFile();//注意小米手机必须这样获得public绝对路径 71 | 72 | File appDir = new File(file ,fileName); 73 | if (!appDir.exists()) { 74 | appDir.mkdirs(); 75 | } 76 | fileName = System.currentTimeMillis() + ".jpg"; 77 | currentFile = new File(appDir, fileName); 78 | 79 | FileOutputStream fos = null; 80 | try { 81 | fos = new FileOutputStream(currentFile); 82 | bmp.compress(Bitmap.CompressFormat.JPEG, 100, fos); 83 | fos.flush(); 84 | } catch (FileNotFoundException e) { 85 | e.printStackTrace(); 86 | } catch (IOException e) { 87 | e.printStackTrace(); 88 | } finally { 89 | try { 90 | if (fos != null) { 91 | fos.close(); 92 | } 93 | } catch (IOException e) { 94 | e.printStackTrace(); 95 | } 96 | } 97 | 98 | if(isSetMediaStore){ 99 | setMediaDtore(fileName); 100 | } 101 | 102 | // 最后通知图库更新 103 | context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, 104 | Uri.fromFile(new File(currentFile.getPath())))); 105 | } 106 | 107 | /** 108 | * 加入到系统图库 109 | * @param fileName 110 | */ 111 | public void setMediaDtore(String fileName){ 112 | try { 113 | MediaStore.Images.Media.insertImage(context.getContentResolver(), 114 | currentFile.getAbsolutePath(), fileName, null); 115 | } catch (FileNotFoundException e) { 116 | e.printStackTrace(); 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/utils/ImageUtil.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.images.utils; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.Matrix; 6 | import android.net.Uri; 7 | import android.text.TextUtils; 8 | import android.util.Log; 9 | 10 | import java.io.File; 11 | import java.io.FileInputStream; 12 | import java.io.IOException; 13 | import java.lang.reflect.InvocationHandler; 14 | import java.lang.reflect.InvocationTargetException; 15 | import java.lang.reflect.Method; 16 | import java.lang.reflect.Proxy; 17 | import java.security.KeyManagementException; 18 | import java.security.NoSuchAlgorithmException; 19 | import java.security.SecureRandom; 20 | import java.security.cert.X509Certificate; 21 | import java.util.concurrent.TimeUnit; 22 | 23 | import javax.net.ssl.HostnameVerifier; 24 | import javax.net.ssl.SSLContext; 25 | import javax.net.ssl.SSLSession; 26 | import javax.net.ssl.TrustManager; 27 | import javax.net.ssl.X509TrustManager; 28 | 29 | import imageloader.libin.com.images.config.GlobalConfig; 30 | import imageloader.libin.com.images.config.SingleConfig; 31 | import okhttp3.OkHttpClient; 32 | 33 | import static imageloader.libin.com.images.config.Contants.ANDROID_RESOURCE; 34 | import static imageloader.libin.com.images.config.Contants.FOREWARD_SLASH; 35 | 36 | /** 37 | * Created by doudou on 2017/4/10. 38 | */ 39 | 40 | public class ImageUtil { 41 | 42 | public static SingleConfig.BitmapListener getBitmapListenerProxy(final SingleConfig.BitmapListener listener) { 43 | return (SingleConfig.BitmapListener) Proxy.newProxyInstance(SingleConfig.class.getClassLoader(), 44 | listener.getClass().getInterfaces(), new InvocationHandler() { 45 | @Override 46 | public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable { 47 | 48 | runOnUIThread(new Runnable() { 49 | @Override 50 | public void run() { 51 | try { 52 | Object object = method.invoke(listener, args); 53 | } catch (IllegalAccessException e) { 54 | e.printStackTrace(); 55 | } catch (InvocationTargetException e) { 56 | e.printStackTrace(); 57 | } 58 | } 59 | }); 60 | return null; 61 | } 62 | }); 63 | } 64 | 65 | 66 | public static void runOnUIThread(Runnable runnable) { 67 | GlobalConfig.getMainHandler().post(runnable); 68 | } 69 | 70 | public static boolean shouldSetPlaceHolder(SingleConfig config) { 71 | if (config.getPlaceHolderResId() <= 0) { 72 | return false; 73 | } 74 | 75 | if (config.getResId() > 0 || !TextUtils.isEmpty(config.getFilePath()) || GlobalConfig.getLoader().isCached(config.getUrl())) { 76 | return false; 77 | } else {//只有在图片源为网络图片,并且图片没有缓存到本地时,才给显示placeholder 78 | return true; 79 | } 80 | } 81 | 82 | 83 | public static int dip2px(float dipValue) { 84 | final float scale = GlobalConfig.context.getResources().getDisplayMetrics().density; 85 | return (int) (dipValue * scale + 0.5f); 86 | } 87 | 88 | 89 | /** 90 | * 等比压缩(宽高等比缩放) 91 | * 92 | * @param bitmap 93 | * @param needRecycle 94 | * @param targetWidth 95 | * @param targeHeight 96 | * @return 97 | */ 98 | public static Bitmap compressBitmap(Bitmap bitmap, boolean needRecycle, int targetWidth, int targeHeight) { 99 | float sourceWidth = bitmap.getWidth(); 100 | float sourceHeight = bitmap.getHeight(); 101 | 102 | float scaleWidth = targetWidth / sourceWidth; 103 | float scaleHeight = targeHeight / sourceHeight; 104 | 105 | Matrix matrix = new Matrix(); 106 | matrix.postScale(scaleWidth, scaleHeight); //长和宽放大缩小的比例 107 | Bitmap bm = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); 108 | if (needRecycle) { 109 | bitmap.recycle(); 110 | } 111 | bitmap = bm; 112 | return bitmap; 113 | } 114 | 115 | 116 | public static String getRealType(File file) { 117 | FileInputStream is = null; 118 | try { 119 | is = new FileInputStream(file); 120 | byte[] b = new byte[4]; 121 | try { 122 | is.read(b, 0, b.length); 123 | } catch (IOException e) { 124 | e.printStackTrace(); 125 | return ""; 126 | } 127 | String type = bytesToHexString(b).toUpperCase(); 128 | if (type.contains("FFD8FF")) { 129 | return "jpg"; 130 | } else if (type.contains("89504E47")) { 131 | return "png"; 132 | } else if (type.contains("47494638")) { 133 | return "gif"; 134 | } else if (type.contains("49492A00")) { 135 | return "tif"; 136 | } else if (type.contains("424D")) { 137 | return "bmp"; 138 | } 139 | return type; 140 | } catch (Exception e) { 141 | e.printStackTrace(); 142 | return ""; 143 | } finally { 144 | try { 145 | is.close(); 146 | } catch (IOException e) { 147 | e.printStackTrace(); 148 | } 149 | } 150 | 151 | 152 | } 153 | 154 | public static String bytesToHexString(byte[] src) { 155 | StringBuilder stringBuilder = new StringBuilder(); 156 | if (src == null || src.length <= 0) { 157 | return null; 158 | } 159 | for (int i = 0; i < src.length; i++) { 160 | int v = src[i] & 0xFF; 161 | String hv = Integer.toHexString(v); 162 | if (hv.length() < 2) { 163 | stringBuilder.append(0); 164 | } 165 | stringBuilder.append(hv); 166 | } 167 | return stringBuilder.toString(); 168 | } 169 | 170 | 171 | /** 172 | * 类型 SCHEME 示例 173 | * 远程图片 http://, https:// HttpURLConnection 或者参考 使用其他网络加载方案 174 | * 本地文件 file:// FileInputStream 175 | * Content provider content:// ContentResolver 176 | * asset目录下的资源 asset:// AssetManager 177 | * res目录下的资源 res:// Resources.openRawResource 178 | * Uri中指定图片数据 data:mime/type;base64, 数据类型必须符合 rfc2397规定 (仅支持 UTF-8) 179 | * 180 | * @param config 181 | * @return 182 | */ 183 | public static Uri buildUriByType(SingleConfig config) { 184 | 185 | Log.e("builduri:", "url: " + config.getUrl() + " ---filepath:" + config.getFilePath() + "--content:" + config.getContentProvider()); 186 | 187 | if (!TextUtils.isEmpty(config.getUrl())) { 188 | String url = ImageUtil.appendUrl(config.getUrl()); 189 | return Uri.parse(url); 190 | } 191 | 192 | if (config.getResId() > 0) { 193 | return Uri.parse("res://imageloader/" + config.getResId()); 194 | } 195 | 196 | if (!TextUtils.isEmpty(config.getFilePath())) { 197 | 198 | File file = new File(config.getFilePath()); 199 | if (file.exists()) { 200 | return Uri.fromFile(file); 201 | } 202 | } 203 | 204 | if (!TextUtils.isEmpty(config.getContentProvider())) { 205 | String content = config.getContentProvider(); 206 | if (!content.startsWith("content")) { 207 | content = "content://" + content; 208 | } 209 | return Uri.parse(content); 210 | } 211 | 212 | 213 | return null; 214 | } 215 | 216 | 217 | public static String appendUrl(String url) { 218 | String newUrl = url; 219 | if (TextUtils.isEmpty(newUrl)) { 220 | return newUrl; 221 | } 222 | boolean hasHost = url.contains("http:") || url.contains("https:"); 223 | if (!hasHost) { 224 | if (!TextUtils.isEmpty(GlobalConfig.baseUrl)) { 225 | newUrl = GlobalConfig.baseUrl + url; 226 | } 227 | } 228 | 229 | return newUrl; 230 | } 231 | 232 | 233 | public static OkHttpClient getClient(boolean ignoreCertificateVerify) { 234 | if (ignoreCertificateVerify) { 235 | return getAllPassClient(); 236 | } else { 237 | return getNormalClient(); 238 | } 239 | } 240 | 241 | /** 242 | * 不校验证书 243 | * 244 | * @return 245 | */ 246 | private static OkHttpClient getAllPassClient() { 247 | 248 | X509TrustManager xtm = new X509TrustManager() { 249 | @Override 250 | public void checkClientTrusted(X509Certificate[] chain, String authType) { 251 | } 252 | 253 | @Override 254 | public void checkServerTrusted(X509Certificate[] chain, String authType) { 255 | } 256 | 257 | @Override 258 | public X509Certificate[] getAcceptedIssuers() { 259 | X509Certificate[] x509Certificates = new X509Certificate[]{}; 260 | return x509Certificates; 261 | // return null; 262 | } 263 | }; 264 | 265 | SSLContext sslContext = null; 266 | try { 267 | sslContext = SSLContext.getInstance("SSL"); 268 | 269 | sslContext.init(null, new TrustManager[]{xtm}, new SecureRandom()); 270 | 271 | } catch (NoSuchAlgorithmException e) { 272 | e.printStackTrace(); 273 | } catch (KeyManagementException e) { 274 | e.printStackTrace(); 275 | } 276 | 277 | 278 | HostnameVerifier DO_NOT_VERIFY = new HostnameVerifier() { 279 | @Override 280 | public boolean verify(String hostname, SSLSession session) { 281 | return true; 282 | } 283 | }; 284 | 285 | OkHttpClient client = new OkHttpClient.Builder() 286 | .sslSocketFactory(sslContext.getSocketFactory()) 287 | .hostnameVerifier(DO_NOT_VERIFY) 288 | .readTimeout(0, TimeUnit.SECONDS) 289 | .connectTimeout(30, TimeUnit.SECONDS).writeTimeout(0, TimeUnit.SECONDS) //设置超时 290 | .build(); 291 | 292 | return client; 293 | } 294 | 295 | private static OkHttpClient getNormalClient() { 296 | OkHttpClient client = new OkHttpClient.Builder() 297 | //.sslSocketFactory(sslContext.getSocketFactory()) 298 | //.hostnameVerifier(DO_NOT_VERIFY) 299 | .readTimeout(0, TimeUnit.SECONDS) 300 | .connectTimeout(30, TimeUnit.SECONDS).writeTimeout(0, TimeUnit.SECONDS) //设置超时 301 | .build(); 302 | return client; 303 | } 304 | 305 | private static Uri resourceIdToUri(Context context, int resourceId) { 306 | return Uri.parse(ANDROID_RESOURCE + context.getPackageName() + FOREWARD_SLASH + resourceId); 307 | } 308 | } 309 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/utils/MultiView.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.images.utils; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.graphics.Bitmap; 6 | import android.graphics.BitmapShader; 7 | import android.graphics.Canvas; 8 | import android.graphics.Matrix; 9 | import android.graphics.Paint; 10 | import android.graphics.Path; 11 | import android.graphics.PointF; 12 | import android.graphics.RectF; 13 | import android.graphics.Shader; 14 | import android.graphics.drawable.BitmapDrawable; 15 | import android.graphics.drawable.Drawable; 16 | import android.os.Bundle; 17 | import android.os.Parcelable; 18 | import android.support.annotation.Nullable; 19 | import android.util.AttributeSet; 20 | import android.util.TypedValue; 21 | import android.widget.ImageView; 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | import imageloader.libin.com.images.R; 26 | 27 | /** 28 | * Created by doudou on 2017/5/3. 29 | */ 30 | 31 | public class MultiView extends ImageView { 32 | /** 33 | * 图片的类型,圆形or圆角or多边形 34 | */ 35 | private Context mContext; 36 | 37 | /** 38 | * 传输类型 39 | */ 40 | private int type; 41 | 42 | /** 43 | * 圆形 44 | */ 45 | public static final int TYPE_CIRCLE = 0; 46 | 47 | /** 48 | * 圆角 49 | */ 50 | public static final int TYPE_ROUND = 1; 51 | 52 | /** 53 | * 多边形 54 | */ 55 | public static final int TYPE_MULTI = 3; 56 | 57 | /** 58 | *默认多边形角的个数 59 | */ 60 | public static final int ANGLECOUNT = 5; 61 | 62 | /** 63 | * 默认开始绘制的角度 64 | */ 65 | public static final int CURRENTANGLE = 180; 66 | 67 | /** 68 | * 多边形的半径 69 | */ 70 | private int startRadius; 71 | 72 | /** 73 | * 多边形角的个数 74 | */ 75 | private int angleCount ; 76 | 77 | private int[] angles; 78 | 79 | /** 80 | * 开始绘制的角度 81 | */ 82 | private int currentAngle; 83 | 84 | /** 85 | * 存储角位置的集合 86 | */ 87 | private List pointFList = new ArrayList<>(); 88 | 89 | /** 90 | * 圆角大小的默认值 91 | */ 92 | private static final int BODER_RADIUS_DEFAULT = 10; 93 | 94 | /** 95 | * 圆角的大小 96 | */ 97 | private int mBorderRadius; 98 | 99 | /** 100 | * 绘图的Paint 101 | */ 102 | private Paint mBitmapPaint; 103 | 104 | /** 105 | * 圆角的半径 106 | */ 107 | private int mRadius; 108 | 109 | /** 110 | * 3x3 矩阵,主要用于缩小放大 111 | */ 112 | private Matrix mMatrix; 113 | 114 | /** 115 | * 渲染图像,使用图像为绘制图形着色 116 | */ 117 | private BitmapShader mBitmapShader; 118 | 119 | /** 120 | * view的宽度 121 | */ 122 | private int mWidth; 123 | private RectF mRoundRect; 124 | 125 | public MultiView(Context context) { 126 | this(context, null); 127 | } 128 | 129 | public MultiView(Context context, AttributeSet attrs) { 130 | 131 | this(context, attrs, 0); 132 | 133 | } 134 | 135 | public MultiView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 136 | super(context, attrs, defStyleAttr); 137 | 138 | this.mContext = context; 139 | 140 | init(context, attrs); 141 | 142 | } 143 | 144 | public void init(Context context, AttributeSet attrs) { 145 | mMatrix = new Matrix(); 146 | mBitmapPaint = new Paint(); 147 | mBitmapPaint.setAntiAlias(true); 148 | 149 | TypedArray typedArray = context.obtainStyledAttributes(attrs, 150 | R.styleable.RoundImageView); 151 | 152 | mBorderRadius = typedArray.getDimensionPixelSize( 153 | R.styleable.RoundImageView_borderRadius, (int) TypedValue 154 | .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 155 | BODER_RADIUS_DEFAULT, getResources() 156 | .getDisplayMetrics()));// 默认为10dp 157 | type = typedArray.getInt(R.styleable.RoundImageView_type, TYPE_CIRCLE);// 默认为Circle 158 | angleCount = typedArray.getInt(R.styleable.RoundImageView_angleCount, ANGLECOUNT); 159 | currentAngle = typedArray.getInt(R.styleable.RoundImageView_currentAngle, currentAngle); 160 | 161 | typedArray.recycle(); //回收之后对象可以重用 162 | } 163 | 164 | 165 | @Override 166 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 167 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 168 | 169 | /** 170 | * 如果类型是圆形或多边形,则强制改变view的宽高一致,以小值为准 171 | */ 172 | if (type == TYPE_CIRCLE) { 173 | mWidth = Math.min(getMeasuredWidth(), getMeasuredHeight()); 174 | mRadius = mWidth / 2; 175 | setMeasuredDimension(mWidth, mWidth); 176 | } 177 | 178 | if (type == TYPE_MULTI) { 179 | mWidth = Math.min(getMeasuredWidth(), getMeasuredHeight()); 180 | 181 | setMeasuredDimension(mWidth, mWidth); 182 | 183 | angles = new int[angleCount]; 184 | 185 | for (int i = 0; i < angleCount; i++) { 186 | int partOfAngle = 360 / angleCount; //每个顶点的角度 187 | angles[i] = currentAngle + partOfAngle * i; 188 | 189 | startRadius = mWidth / 2; 190 | float x = (float) (Math.sin(Math.toRadians(angles[i])) * startRadius); 191 | float y = (float) (Math.cos(Math.toRadians(angles[i])) * startRadius); 192 | pointFList.add(new PointF(x, y)); 193 | } 194 | } 195 | 196 | } 197 | 198 | /** 199 | * 初始化BitmapShader 200 | */ 201 | private void setUpShader() { 202 | Drawable drawable = getDrawable(); 203 | if (drawable == null) { 204 | return; 205 | } 206 | 207 | Bitmap bmp = drawableToBitamp(drawable); 208 | // 将bmp作为着色器,就是在指定区域内绘制bmp 209 | mBitmapShader = new BitmapShader(bmp, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT); 210 | float scale = 1.0f; 211 | if (type == TYPE_CIRCLE) { 212 | // 拿到bitmap宽或高的小值 213 | int bSize = Math.min(bmp.getWidth(), bmp.getHeight()); 214 | scale = mWidth * 1.0f / bSize; 215 | 216 | } else if (type == TYPE_ROUND) { 217 | if (!(bmp.getWidth() == getWidth() && bmp.getHeight() == getHeight())) { 218 | // 如果图片的宽或者高与view的宽高不匹配,计算出需要缩放的比例;缩放后的图片的宽高,一定要大于我们view的宽高;所以我们这里取大值; 219 | scale = Math.max(getWidth() * 1.0f / bmp.getWidth(), getHeight() * 1.0f / bmp.getHeight()); 220 | } 221 | 222 | } else if (type == TYPE_MULTI) { 223 | // 拿到bitmap宽或高的小值 224 | int bSize = Math.min(bmp.getWidth(), bmp.getHeight()); 225 | scale = mWidth * 1.0f / bSize; 226 | } 227 | // shader的变换矩阵,我们这里主要用于放大或者缩小 228 | mMatrix.setScale(scale, scale); 229 | 230 | // 设置变换矩阵 231 | mBitmapShader.setLocalMatrix(mMatrix); 232 | // 设置shader 233 | mBitmapPaint.setShader(mBitmapShader); 234 | } 235 | 236 | @Override 237 | protected void onDraw(Canvas canvas) { 238 | if (getDrawable() == null) { 239 | return; 240 | } 241 | setUpShader(); 242 | 243 | if (type == TYPE_ROUND) { 244 | canvas.drawRoundRect(mRoundRect, mBorderRadius, mBorderRadius, 245 | mBitmapPaint); 246 | } else if (type == TYPE_MULTI) { 247 | //canvas.translate(startRadius,startRadius); 248 | 249 | Path mPath = drawPath(); 250 | 251 | canvas.drawPath(mPath, mBitmapPaint); 252 | } else { 253 | canvas.drawCircle(mRadius, mRadius, mRadius, mBitmapPaint); 254 | } 255 | } 256 | 257 | /** 258 | * @return 多边形路径 259 | */ 260 | private Path drawPath() { 261 | Path mPath = new Path(); 262 | mPath.moveTo(pointFList.get(0).x, pointFList.get(0).y); 263 | for (int i = 2; i < angleCount; i++) { 264 | if (i % 2 == 0) {// 除以二取余数,余数为0则为偶数,否则奇数 265 | mPath.lineTo(pointFList.get(i).x, pointFList.get(i).y); 266 | } 267 | 268 | } 269 | 270 | if (angleCount % 2 == 0) { //偶数,moveTo 271 | mPath.moveTo(pointFList.get(1).x, pointFList.get(1).y); 272 | } else { //奇数,lineTo 273 | mPath.lineTo(pointFList.get(1).x, pointFList.get(1).y); 274 | } 275 | 276 | for (int i = 3; i < angleCount; i++) { 277 | if (i % 2 != 0) { 278 | mPath.lineTo(pointFList.get(i).x, pointFList.get(i).y); 279 | } 280 | } 281 | 282 | mPath.offset(startRadius, startRadius); 283 | return mPath; 284 | } 285 | 286 | @Override 287 | protected void onSizeChanged(int w, int h, int oldw, int oldh) { 288 | super.onSizeChanged(w, h, oldw, oldh); 289 | 290 | // 圆角图片的范围 291 | if (type == TYPE_ROUND) 292 | mRoundRect = new RectF(0, 0, w, h); 293 | } 294 | 295 | /** 296 | * drawable转bitmap 297 | * 298 | * @param drawable 299 | * @return 300 | */ 301 | private Bitmap drawableToBitamp(Drawable drawable) { 302 | if (drawable instanceof BitmapDrawable) { 303 | BitmapDrawable bd = (BitmapDrawable) drawable; 304 | return bd.getBitmap(); 305 | } 306 | int w = drawable.getIntrinsicWidth(); 307 | int h = drawable.getIntrinsicHeight(); 308 | Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); 309 | Canvas canvas = new Canvas(bitmap); 310 | drawable.setBounds(0, 0, w, h); 311 | drawable.draw(canvas); 312 | return bitmap; 313 | } 314 | 315 | private static final String STATE_INSTANCE = "state_instance"; 316 | private static final String STATE_TYPE = "state_type"; 317 | private static final String STATE_BORDER_RADIUS = "state_border_radius"; 318 | 319 | @Override 320 | protected Parcelable onSaveInstanceState() { 321 | Bundle bundle = new Bundle(); 322 | bundle.putParcelable(STATE_INSTANCE, super.onSaveInstanceState()); 323 | bundle.putInt(STATE_TYPE, type); 324 | bundle.putInt(STATE_BORDER_RADIUS, mBorderRadius); 325 | return bundle; 326 | } 327 | 328 | @Override 329 | protected void onRestoreInstanceState(Parcelable state) { 330 | if (state instanceof Bundle) { 331 | Bundle bundle = (Bundle) state; 332 | super.onRestoreInstanceState(((Bundle) state) 333 | .getParcelable(STATE_INSTANCE)); 334 | this.type = bundle.getInt(STATE_TYPE); 335 | this.mBorderRadius = bundle.getInt(STATE_BORDER_RADIUS); 336 | } else { 337 | super.onRestoreInstanceState(state); 338 | } 339 | 340 | } 341 | 342 | public void setType(int type) { 343 | if (this.type != type) { 344 | this.type = type; 345 | if (this.type != TYPE_ROUND && this.type != TYPE_CIRCLE && this.type != TYPE_MULTI) { 346 | this.type = TYPE_CIRCLE; 347 | } 348 | requestLayout(); 349 | } 350 | 351 | } 352 | 353 | } 354 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | images 3 | 4 | -------------------------------------------------------------------------------- /ImageLoaderDemo/ImageLoader/src/main/res/values/style.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /ImageLoaderDemo/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /ImageLoaderDemo/app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # For more information about using CMake with Android Studio, read the 2 | # documentation: https://d.android.com/studio/projects/add-native-code.html 3 | 4 | # Sets the minimum version of CMake required to build the native library. 5 | 6 | cmake_minimum_required(VERSION 3.4.1) 7 | 8 | # Creates and names a library, sets it as either STATIC 9 | # or SHARED, and provides the relative paths to its source code. 10 | # You can define multiple libraries, and CMake builds them for you. 11 | # Gradle automatically packages shared libraries with your APK. 12 | 13 | add_library( # Sets the name of the library. 14 | native-lib 15 | 16 | # Sets the library as a shared library. 17 | SHARED 18 | 19 | # Provides a relative path to your source file(s). 20 | src/main/cpp/native-lib.cpp ) 21 | 22 | # Searches for a specified prebuilt library and stores the path as a 23 | # variable. Because CMake includes system libraries in the search path by 24 | # default, you only need to specify the name of the public NDK library 25 | # you want to add. CMake verifies that the library exists before 26 | # completing its build. 27 | 28 | find_library( # Sets the name of the path variable. 29 | log-lib # 依赖的系统so库 30 | 31 | # Specifies the name of the NDK library that 32 | # you want CMake to locate. 33 | log ) 34 | 35 | # Specifies libraries CMake should link to your target library. You 36 | # can link multiple libraries, such as libraries you define in this 37 | # build script, prebuilt third-party libraries, or system libraries. 38 | 39 | target_link_libraries( # Specifies the target library. 40 | native-lib 41 | 42 | # Links the target library to the log library 43 | # included in the NDK. 44 | ${log-lib} ) -------------------------------------------------------------------------------- /ImageLoaderDemo/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.2" 6 | defaultConfig { 7 | applicationId "imageloader.libin.com.imageloaderdemo" 8 | minSdkVersion 11 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | multiDexEnabled true 13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 14 | externalNativeBuild { 15 | cmake { 16 | cppFlags "" 17 | } 18 | } 19 | 20 | } 21 | buildTypes { 22 | release { 23 | minifyEnabled false 24 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 25 | } 26 | 27 | debug { 28 | minifyEnabled false 29 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 30 | 31 | } 32 | } 33 | 34 | lintOptions { 35 | abortOnError false 36 | } 37 | 38 | externalNativeBuild { 39 | cmake { 40 | path 'CMakeLists.txt' 41 | } 42 | } 43 | sourceSets { main { jni.srcDirs = ['src/main/jni', 'src/main/cpp/'] } } 44 | } 45 | 46 | dependencies { 47 | compile fileTree(include: ['*.jar'], dir: 'libs') 48 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 49 | exclude group: 'com.android.support', module: 'support-annotations' 50 | }) 51 | compile project(':ImageLoader') 52 | compile 'com.android.support:appcompat-v7:25.3.0' 53 | compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8' 54 | compile 'com.orhanobut:logger:1.15' 55 | testCompile 'junit:junit:4.12' 56 | } 57 | -------------------------------------------------------------------------------- /ImageLoaderDemo/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Applications/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /ImageLoaderDemo/app/src/androidTest/java/imageloader/libin/com/imageloaderdemo/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.imageloaderdemo; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("imageloader.libin.com.imageloaderdemo", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ImageLoaderDemo/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /ImageLoaderDemo/app/src/main/assets/jpeg_test.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libin7278/ImageLoader/b868deb9966a547e3026d214b084c59683c775a7/ImageLoaderDemo/app/src/main/assets/jpeg_test.jpeg -------------------------------------------------------------------------------- /ImageLoaderDemo/app/src/main/cpp/native-lib.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern "C" 5 | JNIEXPORT jstring JNICALL 6 | Java_pressure_libin_com_pressure_MainActivity_stringFromJNI( 7 | JNIEnv *env, 8 | jobject /* this */) { 9 | std::string hello = "Hello from C++"; 10 | return env->NewStringUTF(hello.c_str()); 11 | } 12 | -------------------------------------------------------------------------------- /ImageLoaderDemo/app/src/main/java/imageloader/libin/com/imageloaderdemo/MainApplication.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.imageloaderdemo; 2 | 3 | import android.app.Application; 4 | 5 | import imageloader.libin.com.images.loader.ImageLoader; 6 | 7 | /** 8 | * Created by doudou on 2017/4/10. 9 | */ 10 | 11 | public class MainApplication extends Application { 12 | 13 | @Override 14 | public void onCreate() { 15 | super.onCreate(); 16 | 17 | ImageLoader.init(getApplicationContext()); 18 | 19 | } 20 | 21 | @Override 22 | public void onTrimMemory(int level) { 23 | super.onTrimMemory(level); 24 | 25 | ImageLoader.trimMemory(level); 26 | } 27 | 28 | @Override 29 | public void onLowMemory() { 30 | super.onLowMemory(); 31 | 32 | ImageLoader.clearAllMemoryCaches(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ImageLoaderDemo/app/src/main/java/imageloader/libin/com/imageloaderdemo/activity/BigImageActivity.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.imageloaderdemo.activity; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | 6 | import imageloader.libin.com.imageloaderdemo.R; 7 | 8 | 9 | public class BigImageActivity extends AppCompatActivity { 10 | 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.activity_big_image); 16 | 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /ImageLoaderDemo/app/src/main/java/imageloader/libin/com/imageloaderdemo/activity/MainActivity.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.imageloaderdemo.activity; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.view.View; 7 | import android.widget.Button; 8 | import android.widget.Toast; 9 | 10 | import java.io.File; 11 | import java.io.FileOutputStream; 12 | import java.io.IOException; 13 | import java.io.InputStream; 14 | 15 | import imageloader.libin.com.imageloaderdemo.R; 16 | 17 | import static imageloader.libin.com.imageloaderdemo.config.imageconfig.IMG_NAME_C; 18 | 19 | public class MainActivity extends AppCompatActivity { 20 | Button btn_big_img ; 21 | Button btn_viewpager ; 22 | Button btn_round ; 23 | 24 | static { 25 | System.loadLibrary("native-lib"); 26 | } 27 | 28 | @Override 29 | protected void onCreate(Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | setContentView(R.layout.activity_main); 32 | 33 | btn_big_img = (Button) findViewById(R.id.btn_big_img); 34 | btn_viewpager = (Button) findViewById(R.id.btn_viewpager); 35 | btn_round = (Button) findViewById(R.id.btn_round); 36 | 37 | copyFile(); 38 | 39 | setonClick(); 40 | } 41 | 42 | private void setonClick() { 43 | btn_big_img.setOnClickListener(new View.OnClickListener() { 44 | @Override 45 | public void onClick(View v) { 46 | startActivity(new Intent(MainActivity.this, BigImageActivity.class)); 47 | } 48 | }); 49 | 50 | btn_viewpager.setOnClickListener(new View.OnClickListener() { 51 | @Override 52 | public void onClick(View v) { 53 | startActivity(new Intent(MainActivity.this, ViewpagerActivity.class)); 54 | } 55 | }); 56 | 57 | btn_round.setOnClickListener(new View.OnClickListener() { 58 | @Override 59 | public void onClick(View v) { 60 | startActivity(new Intent(MainActivity.this, SimpleActivity.class)); 61 | } 62 | }); 63 | 64 | } 65 | 66 | private void copyFile() { 67 | InputStream is; 68 | try { 69 | is = getAssets().open(IMG_NAME_C); 70 | FileOutputStream fos = new FileOutputStream(new File(getFilesDir(), IMG_NAME_C)); 71 | byte[] buffer = new byte[1024]; 72 | int byteCount; 73 | while ((byteCount = is.read(buffer)) != -1) { 74 | fos.write(buffer, 0, byteCount); 75 | } 76 | fos.flush(); 77 | is.close(); 78 | fos.close(); 79 | } catch (IOException e) { 80 | Toast.makeText(MainActivity.this,"图片存储失败",Toast.LENGTH_SHORT).show(); 81 | } 82 | } 83 | 84 | public native String stringFromJNI(); 85 | } 86 | -------------------------------------------------------------------------------- /ImageLoaderDemo/app/src/main/java/imageloader/libin/com/imageloaderdemo/activity/SimpleActivity.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.imageloaderdemo.activity; 2 | 3 | import android.animation.ObjectAnimator; 4 | import android.database.Cursor; 5 | import android.graphics.Bitmap; 6 | import android.os.Bundle; 7 | import android.os.Environment; 8 | import android.provider.ContactsContract; 9 | import android.provider.MediaStore; 10 | import android.support.v7.app.AppCompatActivity; 11 | import android.util.Log; 12 | import android.view.View; 13 | import android.widget.ImageView; 14 | 15 | import com.bumptech.glide.Glide; 16 | import com.bumptech.glide.load.engine.DiskCacheStrategy; 17 | import com.bumptech.glide.request.animation.ViewPropertyAnimation; 18 | 19 | import java.io.File; 20 | 21 | import imageloader.libin.com.imageloaderdemo.R; 22 | import imageloader.libin.com.images.config.PriorityMode; 23 | import imageloader.libin.com.images.config.ScaleMode; 24 | import imageloader.libin.com.images.imagei.ImageDownLoadCallBack; 25 | import imageloader.libin.com.images.loader.ImageLoader; 26 | import imageloader.libin.com.images.utils.DownLoadImageService; 27 | 28 | import static imageloader.libin.com.imageloaderdemo.config.imageconfig.IMG_NAME; 29 | import static imageloader.libin.com.imageloaderdemo.config.imageconfig.IMG_NAME_C; 30 | import static imageloader.libin.com.imageloaderdemo.config.imageconfig.URL1; 31 | import static imageloader.libin.com.imageloaderdemo.config.imageconfig.URL3; 32 | import static imageloader.libin.com.imageloaderdemo.config.imageconfig.URL4; 33 | import static imageloader.libin.com.imageloaderdemo.config.imageconfig.URL5; 34 | import static imageloader.libin.com.images.config.Contants.ANDROID_RESOURCE; 35 | import static imageloader.libin.com.images.config.Contants.ASSERTS_PATH; 36 | import static imageloader.libin.com.images.config.Contants.FOREWARD_SLASH; 37 | import static imageloader.libin.com.images.config.Contants.RAW; 38 | 39 | public class SimpleActivity extends AppCompatActivity { 40 | 41 | private ImageView iv_test1; 42 | private ImageView iv_test2; 43 | private ImageView iv_test3; 44 | private ImageView iv_test4; 45 | private ImageView iv_test5; 46 | private ImageView iv_test6; 47 | private ImageView iv_test7; 48 | private ImageView iv_test8; 49 | private ImageView iv_test9; 50 | private ImageView iv_test10; 51 | private ImageView iv_test11; 52 | private ImageView iv_test12; 53 | private ImageView iv_test13; 54 | private ImageView iv_test14; 55 | private ImageView iv_test15; 56 | 57 | private static final String TAG = SimpleActivity.class.getSimpleName(); 58 | 59 | @Override 60 | protected void onCreate(Bundle savedInstanceState) { 61 | super.onCreate(savedInstanceState); 62 | setContentView(R.layout.activity_sample); 63 | 64 | findview(); 65 | 66 | load(); 67 | } 68 | 69 | private void findview() { 70 | iv_test1 = (ImageView) findViewById(R.id.iv_test1); 71 | iv_test2 = (ImageView) findViewById(R.id.iv_test2); 72 | iv_test3 = (ImageView) findViewById(R.id.iv_test3); 73 | iv_test4 = (ImageView) findViewById(R.id.iv_test4); 74 | iv_test5 = (ImageView) findViewById(R.id.iv_test5); 75 | iv_test6 = (ImageView) findViewById(R.id.iv_test6); 76 | iv_test7 = (ImageView) findViewById(R.id.iv_test7); 77 | iv_test8 = (ImageView) findViewById(R.id.iv_test8); 78 | iv_test9 = (ImageView) findViewById(R.id.iv_test9); 79 | iv_test10 = (ImageView) findViewById(R.id.iv_test10); 80 | iv_test11 = (ImageView) findViewById(R.id.iv_test11); 81 | iv_test12 = (ImageView) findViewById(R.id.iv_test12); 82 | iv_test13 = (ImageView) findViewById(R.id.iv_test13); 83 | iv_test14 = (ImageView) findViewById(R.id.iv_test14); 84 | iv_test15 = (ImageView) findViewById(R.id.iv_test15); 85 | } 86 | 87 | private void load() { 88 | ViewPropertyAnimation.Animator animationObject = new ViewPropertyAnimation.Animator() { 89 | @Override 90 | public void animate(View view) { 91 | view.setAlpha( 0f ); 92 | 93 | ObjectAnimator fadeAnim = ObjectAnimator.ofFloat( view, "alpha", 0f, 1f ); 94 | fadeAnim.setDuration( 2500 ); 95 | fadeAnim.start(); 96 | } 97 | }; 98 | 99 | ImageLoader.with(this) 100 | .url(URL1) 101 | .animate(animationObject) 102 | .placeHolder(R.mipmap.ic_launcher) 103 | .scale(ScaleMode.CENTER_CROP) 104 | .into(iv_test1); 105 | 106 | ImageLoader.with(this) 107 | .url(URL1) 108 | .placeHolder(R.mipmap.ic_launcher) 109 | .scale(ScaleMode.FIT_CENTER) 110 | .into(iv_test2); 111 | 112 | // ImageLoader.with(this) 113 | // .url(URL2) 114 | // .placeHolder(R.mipmap.ic_launcher) 115 | // .scale(ScaleMode.FIT_CENTER) 116 | // .into(iv_test3); 117 | 118 | Glide.with(this).load(URL4).asGif().diskCacheStrategy(DiskCacheStrategy.SOURCE) 119 | .into(iv_test3); 120 | 121 | ImageLoader.with(this) 122 | .url(URL4) 123 | .placeHolder(R.mipmap.ic_launcher) 124 | .diskCacheStrategy(DiskCacheStrategy.SOURCE) 125 | .scale(ScaleMode.FIT_CENTER) 126 | .into(iv_test4); 127 | 128 | ImageLoader.with(this) 129 | .url(URL3) 130 | .placeHolder(R.mipmap.ic_launcher) 131 | .scale(ScaleMode.FIT_CENTER) 132 | .into(iv_test5); 133 | 134 | ImageLoader.with(this) 135 | .url(URL5) 136 | .placeHolder(R.mipmap.ic_launcher) 137 | .scale(ScaleMode.FIT_CENTER) 138 | .into(iv_test6); 139 | 140 | ImageLoader.with(this) 141 | .res(R.drawable.gif_test) 142 | .diskCacheStrategy(DiskCacheStrategy.SOURCE) 143 | .placeHolder(R.mipmap.ic_launcher) 144 | .scale(ScaleMode.FIT_CENTER) 145 | .into(iv_test7); 146 | 147 | ImageLoader.with(this) 148 | .res(R.drawable.jpeg_test) 149 | .placeHolder(R.mipmap.ic_launcher) 150 | .scale(ScaleMode.FIT_CENTER) 151 | .into(iv_test8); 152 | 153 | ImageLoader.with(this) 154 | .res(R.drawable.b000) 155 | .vignetteFilter() 156 | .priority(PriorityMode.PRIORITY_NORMAL) 157 | .placeHolder(R.mipmap.ic_launcher) 158 | .scale(ScaleMode.FIT_CENTER) 159 | // .ignoreCertificateVerify() 160 | .into(iv_test9); 161 | 162 | ImageLoader.with(this) 163 | .res(R.drawable.b000) 164 | .sketchFilter() 165 | .placeHolder(R.mipmap.ic_launcher) 166 | .scale(ScaleMode.FIT_CENTER) 167 | .into(iv_test10); 168 | 169 | // ImageLoader.with(this) 170 | // .content("content://media/external/images/media/"+getContentId()) 171 | // .placeHolder(R.mipmap.ic_launcher) 172 | // .scale(ScaleMode.FIT_CENTER) 173 | // .into(iv_test10); 174 | 175 | ImageLoader.with(this) 176 | .file("file://"+ Environment.getExternalStorageDirectory().getPath()+FOREWARD_SLASH+IMG_NAME) 177 | .placeHolder(R.mipmap.ic_launcher) 178 | .scale(ScaleMode.FIT_CENTER) 179 | .into(iv_test11); 180 | 181 | 182 | ImageLoader.with(this) 183 | .file(new File(getFilesDir(), IMG_NAME_C)) 184 | .placeHolder(R.mipmap.ic_launcher) 185 | .scale(ScaleMode.FIT_CENTER) 186 | .into(iv_test12); 187 | 188 | ImageLoader.with(this) 189 | .asserts(ASSERTS_PATH+IMG_NAME_C) 190 | .placeHolder(R.mipmap.ic_launcher) 191 | .scale(ScaleMode.FIT_CENTER) 192 | .rectRoundCorner(50) 193 | .into(iv_test13); 194 | 195 | ImageLoader.with(this) 196 | .raw(ANDROID_RESOURCE+getPackageName()+RAW+R.raw.jpeg_test) 197 | .placeHolder(R.mipmap.ic_launcher) 198 | .scale(ScaleMode.FIT_CENTER) 199 | .asCircle() 200 | .into(iv_test14); 201 | 202 | ImageLoader.with(this) 203 | .raw(ANDROID_RESOURCE+getPackageName()+RAW+R.raw.jpeg_test) 204 | .placeHolder(R.mipmap.ic_launcher) 205 | .scale(ScaleMode.FIT_CENTER) 206 | .diskCacheStrategy(DiskCacheStrategy.NONE) 207 | .asSquare() 208 | .into(iv_test15); 209 | 210 | ImageLoader.saveImageIntoGallery(new DownLoadImageService(SimpleActivity.this, URL3, true, "lala", new ImageDownLoadCallBack() { 211 | 212 | @Override 213 | public void onDownLoadSuccess(Bitmap bitmap) { 214 | Log.e(TAG, "下载图片成功 bitmap"); 215 | } 216 | 217 | @Override 218 | public void onDownLoadFailed() { 219 | Log.e(TAG, "下载图片失败"); 220 | } 221 | 222 | })); 223 | } 224 | 225 | public long getContentId(){ 226 | Cursor cursor = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, null, null, null, null); 227 | long aLong = 0; 228 | if (cursor != null && cursor.moveToFirst()) { 229 | aLong = cursor.getLong(cursor.getColumnIndex(ContactsContract.Contacts._ID)); 230 | } 231 | 232 | return aLong; 233 | } 234 | 235 | 236 | } 237 | -------------------------------------------------------------------------------- /ImageLoaderDemo/app/src/main/java/imageloader/libin/com/imageloaderdemo/activity/ViewpagerActivity.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.imageloaderdemo.activity; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.support.v4.view.ViewPager; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | import imageloader.libin.com.imageloaderdemo.R; 11 | 12 | 13 | public class ViewpagerActivity extends Activity { 14 | ViewPager viewPager; 15 | 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | setContentView(R.layout.activity_viewpager); 20 | 21 | viewPager = (ViewPager) findViewById(R.id.viewpager); 22 | List urls = new ArrayList<>(); 23 | /* urls.add("/storage/emulated/0/DCIM/家里有用图/IMG_20170222_221249_HHT.jpg"); 24 | urls.add("/storage/emulated/0/DCIM/家里有用图/IMG_20161114_231649.jpg"); 25 | urls.add("/storage/emulated/0/DCIM/家里有用图/IMG_20161229_221023.jpg"); 26 | urls.add("/storage/emulated/0/DCIM/家里有用图/DSC_0051.JPG");*/ 27 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490359324536&di=f1c2dfd6b0ebe0043f089d933d5d9e10&imgtype=0&src=http%3A%2F%2Fyouimg1.c-ctrip.com%2Ftarget%2Ffd%2Ftg%2Fg1%2FM02%2FFE%2FB5%2FCghzfFSrqqCATzfcACG0aD33PsY070.jpg"); 28 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490359343773&di=9fc5478b63f369090613c1c27d56f237&imgtype=0&src=http%3A%2F%2Fimg4.duitang.com%2Fuploads%2Fitem%2F201510%2F04%2F20151004210446_usmze.jpeg"); 29 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490359365740&di=f02eadaa956bef73d64cf9fb86969228&imgtype=0&src=http%3A%2F%2Fupload4.hlgnet.com%2Fbbsupfile%2F2012%2F2012-07-17%2F20120717003503_80.jpg"); 30 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490359415501&di=2457a1060f3ccde0bd7f7b5d0891918d&imgtype=0&src=http%3A%2F%2Fdimg09.c-ctrip.com%2Fimages%2Ffd%2Ftg%2Fg2%2FM03%2FCB%2F19%2FCghzf1UualCAdMmaABQVh70n7_g185.jpg"); 31 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490359451818&di=b3031652757061d8d9a681e824c8a9e5&imgtype=0&src=http%3A%2F%2Flvyou.panjin.net%2Ffjpic%2F1299485962.jpg"); 32 | 33 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490954196&di=9d3311b40886fc2c670a31f7ba1edb68&imgtype=jpg&er=1&src=http%3A%2F%2Fdimg05.c-ctrip.com%2Fimages%2Ffd%2Ftg%2Fg2%2FM0B%2FCB%2F14%2FCghzgFUuapGABMHyACKrkXeB1zo976.jpg"); 34 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490359527096&di=ec923d22df64850456fa01de50540ed3&imgtype=0&src=http%3A%2F%2Ffile28.mafengwo.net%2FM00%2F38%2FEB%2FwKgB6lTHUrKAMiRNABF8ZlX_qGY71.jpeg"); 35 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490954377&di=c037874ec1de4ad2528708b89123ffb9&imgtype=jpg&er=1&src=http%3A%2F%2Ffile27.mafengwo.net%2FM00%2F44%2FFA%2FwKgB6lTHYfuAGx8tAAyTEuzr7rQ63.jpeg"); 36 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490359641404&di=f0e34cfcfd8789ad6fdddf28ad7dc49b&imgtype=0&src=http%3A%2F%2Ffile27.mafengwo.net%2FM00%2F23%2FFC%2FwKgB6lSBlHCAa62UAAt4XAl0sUc50.jpeg"); 37 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490359621573&di=fe03f67cb5b06f8961ceb8e21ca07db7&imgtype=0&src=http%3A%2F%2Ffile21.mafengwo.net%2FM00%2F7B%2F55%2FwKgB3FDF162Afrj8ACtU8-OAkZ484.jpeg"); 38 | 39 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490971670&di=d810318cdd61531a5d1d3861d00c2d9e&imgtype=jpg&er=1&src=http%3A%2F%2Fpic1.win4000.com%2Fwallpaper%2Fc%2F570cc782c8312.jpg"); 40 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490377045881&di=0f13095a141036c21225c377dd7749a9&imgtype=0&src=http%3A%2F%2Ftpic.home.news.cn%2FxhCloudNewsPic%2Fxhpic1501%2FM09%2F3B%2F9F%2FwKhTlFjGSD-EBUVnAAAAADRqVbw103.jpg"); 41 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490377064336&di=887d8cb3473ac568fca9e4e7914039f7&imgtype=0&src=http%3A%2F%2Ftpic.home.news.cn%2FxhCloudNewsPic%2Fxhpic1501%2FM02%2F3B%2F36%2FwKhTlFi8xGiESf0ZAAAAAKAbE3k190.JPG"); 42 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490377078620&di=e151b087ab39e1a630a4b233d2ae1b3c&imgtype=0&src=http%3A%2F%2Ftpic.home.news.cn%2FxhCloudNewsPic%2Fxhpic1501%2FM0B%2F3A%2FEA%2FwKhTlFi2HTqEQqC7AAAAABGsE-A602.jpg"); 43 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490377147917&di=ebd07f2123fd27bfd6ab721ef5bc10be&imgtype=0&src=http%3A%2F%2Ftpic.home.news.cn%2FxhCloudNewsPic%2Fxhpic1501%2FM07%2F3A%2FEA%2FwKhTlFi2HTmEd_tPAAAAAAAmh48401.jpg"); 44 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490377163830&di=3b35cedcc3fe72fa6d446de5f658e37a&imgtype=0&src=http%3A%2F%2Ftpic.home.news.cn%2FxhCloudNewsPic%2Fxhpic1501%2FM04%2F24%2FF8%2FwKhTlVfWBNaEfokmAAAAAIa_flU883.JPG"); 45 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490377184956&di=358135e6e95914ac85483fb127f2f61c&imgtype=0&src=http%3A%2F%2Fbbs11.djicdn.com%2Fdata%2Fattachment%2Fforum%2F201605%2F11%2F200721bvbrtifzgczc7xqc.jpg"); 46 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490971909&di=4e376f64ea228a1360759339b183bb0f&imgtype=jpg&er=1&src=http%3A%2F%2Fwww.wulong9.com%2Fuploads%2Fallimg%2F160901%2F2339441392-8.jpg"); 47 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490377224967&di=7916a9c76cfd76540b3ed41f970c8b05&imgtype=0&src=http%3A%2F%2Fbbs11.djicdn.com%2Fdata%2Fattachment%2Fforum%2F201511%2F22%2F200600doo6tz2zqx6jdz5d.jpg"); 48 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490377243693&di=5471e90a84737494794986fe81833f9f&imgtype=0&src=http%3A%2F%2Fnews.cpd.com.cn%2Fn203193%2Fc29879991%2Fpart%2F29880124.jpg"); 49 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490377264171&di=6e8aa952f387588e9dce20ce6da70b90&imgtype=0&src=http%3A%2F%2Fimg2.xiangshu.com%2FDay_130214%2F102_721302_a48bffc61d51fcf.jpg"); 50 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490377296064&di=88b89e2b139e540e321dfeac8b1e45c5&imgtype=0&src=http%3A%2F%2Fwww.liuzhou.gov.cn%2Fxwzx%2Fqxdt%2Frax%2F201607%2FW020160729407716095395.jpg"); 51 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490377327685&di=b2630926b28c9eb55845fb070cdd873a&imgtype=0&src=http%3A%2F%2Fimg.meyet.com%2Fforum%2F201509%2F13%2F161505r4lp1l9x93hsrxj9.jpg"); 52 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490377349229&di=e756188f5130990ddcf2026b4c0653f2&imgtype=0&src=http%3A%2F%2Fimg.zhongguowangshi.com%2FxwSceneReport%2F201408%2F20140806201621_2568.jpg"); 53 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490377365522&di=03b5ca67a2b928a81755c71d3234960b&imgtype=0&src=http%3A%2F%2Fpicture.youth.cn%2Fqtdb%2F201604%2FW020160401504554381405.jpg"); 54 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490377388544&di=23710a64289c9e642a0938a208f5c001&imgtype=0&src=http%3A%2F%2Fnews.cpd.com.cn%2Fn203193%2Fc30062120%2Fpart%2F30062148.jpg"); 55 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490377446523&di=881526f14e32deac9bf6135b0fcd9607&imgtype=0&src=http%3A%2F%2Fimg.xiangshu.com%2FDay_160923%2F170_626871_adcb95228d97079.jpg"); 56 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490972194&di=e447e1da8606c77991bbad5a5e31259f&imgtype=jpg&er=1&src=http%3A%2F%2Fww1.sinaimg.cn%2Flarge%2F005CX4pyjw1erxh54tsawj32531lr4qp.jpg"); 57 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490972241&di=eff2b007af75130d6646646f56332bf2&imgtype=jpg&er=1&src=http%3A%2F%2Ftpic.home.news.cn%2FxhCloudNewsPic%2Fxhpic1501%2FM02%2F3B%2F36%2FwKhTlFi8xGiESf0ZAAAAAKAbE3k190.JPG"); 58 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490377550943&di=44e2f1358062eb16e7b5922e8abe0823&imgtype=0&src=http%3A%2F%2Fimage97.360doc.com%2FDownloadImg%2F2016%2F06%2F1500%2F73937627_2.jpg"); 59 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490377590254&di=a794edea83b41bfc8f116b4568c89194&imgtype=0&src=http%3A%2F%2Fww2.sinaimg.cn%2Flarge%2F6e4b60cegw1f1td78f79aj23341qiu0y.jpg"); 60 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490972384&di=3cafec5973c15688726cec59e1d9085e&imgtype=jpg&er=1&src=http%3A%2F%2Fbbs11.djicdn.com%2Fdata%2Fattachment%2Fforum%2F201604%2F01%2F133253wg01kxggh8o215gc.jpg"); 61 | urls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490972455&di=53778e44f17970656d0dc2e0a9ce4ee9&imgtype=jpg&er=1&src=http%3A%2F%2Fwww.7695556.com%2Fdata%2Fattachment%2Fforum%2F201609%2F28%2F201212dpyqwo0aam49owpa.jpg"); 62 | 63 | // PagerAdapterForBigImage adapter = new PagerAdapterForBigImage(urls); 64 | // viewPager.setAdapter(adapter); 65 | //ImageLoader.loadBigImages(viewPager,urls); 66 | } 67 | 68 | @Override 69 | protected void onDestroy() { 70 | super.onDestroy(); 71 | 72 | //viewPager.destroyDrawingCache(); 73 | // ImageLoader.clearAllMemoryCaches();//调了没用,也不需要调,下次进来自动会刷新内存 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /ImageLoaderDemo/app/src/main/java/imageloader/libin/com/imageloaderdemo/config/imageconfig.java: -------------------------------------------------------------------------------- 1 | package imageloader.libin.com.imageloaderdemo.config; 2 | 3 | /** 4 | * Created by doudou on 2017/5/3. 5 | */ 6 | 7 | public interface imageconfig { 8 | String URL1 = "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490944508&di=671845045c66356487c1a539c4ed0717&imgtype=jpg&er=1&src=http%3A%2F%2Fattach.bbs.letv.com%2Fforum%2F201606%2F27%2F185306g84m4gsxztvzxjt5.jpg"; 9 | String URL2 = "http://s1.dwstatic.com/group1/M00/86/4A/81beb00a44bc52b4fdd46285de8f8f00.png"; 10 | String URL3 = "https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=2796659031,1466769776&fm=80&w=179&h=119&img.JPEG"; 11 | String URL4 = "https://isparta.github.io/compare-webp/image/gif_webp/gif/1.gif"; 12 | String URL5 = "https://p.upyun.com/docs/cloud/demo.jpg!/format/webp"; 13 | 14 | String IMG_NAME = "SHARE_IMG2.PNG"; 15 | String IMG_NAME_C = "jpeg_test.jpeg"; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /ImageLoaderDemo/app/src/main/res/drawable-hdpi/b000.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libin7278/ImageLoader/b868deb9966a547e3026d214b084c59683c775a7/ImageLoaderDemo/app/src/main/res/drawable-hdpi/b000.webp -------------------------------------------------------------------------------- /ImageLoaderDemo/app/src/main/res/drawable-hdpi/gif_test.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libin7278/ImageLoader/b868deb9966a547e3026d214b084c59683c775a7/ImageLoaderDemo/app/src/main/res/drawable-hdpi/gif_test.gif -------------------------------------------------------------------------------- /ImageLoaderDemo/app/src/main/res/drawable-hdpi/jpeg_test.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libin7278/ImageLoader/b868deb9966a547e3026d214b084c59683c775a7/ImageLoaderDemo/app/src/main/res/drawable-hdpi/jpeg_test.jpeg -------------------------------------------------------------------------------- /ImageLoaderDemo/app/src/main/res/drawable-hdpi/webp_test.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libin7278/ImageLoader/b868deb9966a547e3026d214b084c59683c775a7/ImageLoaderDemo/app/src/main/res/drawable-hdpi/webp_test.webp -------------------------------------------------------------------------------- /ImageLoaderDemo/app/src/main/res/drawable/ads.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libin7278/ImageLoader/b868deb9966a547e3026d214b084c59683c775a7/ImageLoaderDemo/app/src/main/res/drawable/ads.gif -------------------------------------------------------------------------------- /ImageLoaderDemo/app/src/main/res/layout/activity_big_image.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ImageLoaderDemo/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 |