├── BitmapCanary ├── settings.gradle ├── app │ ├── src │ │ └── main │ │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── drawable-hdpi │ │ │ │ └── printlogo.png │ │ │ ├── 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 │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── layout │ │ │ │ ├── activity_demo2.xml │ │ │ │ └── activity_demo.xml │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ └── drawable │ │ │ │ └── ic_launcher_background.xml │ │ │ ├── java │ │ │ └── smallnew │ │ │ │ └── bitmapcanary │ │ │ │ ├── DemoActivity2.java │ │ │ │ ├── DemoApplication.java │ │ │ │ └── DemoActivity.java │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── proguard-rules.pro │ └── app.iml ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── androidbitmapcanary │ ├── src │ │ └── main │ │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ └── hexin │ │ │ └── androidbitmapcanary │ │ │ ├── DetectorFactory.java │ │ │ ├── ImagesrcDetector.java │ │ │ ├── BackgroundDetecotor.java │ │ │ ├── Detector.java │ │ │ ├── ActivityDrawableWatcher.java │ │ │ └── DrawableDetectUtil.java │ ├── build.gradle │ ├── proguard-rules.pro │ └── androidbitmapcanary.iml ├── local.properties ├── build.gradle ├── gradle.properties ├── BitmapCanary.iml ├── gradlew.bat └── gradlew ├── detect_demo.png └── README.md /BitmapCanary/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':androidbitmapcanary' 2 | -------------------------------------------------------------------------------- /detect_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smallnew/BitmapCanary/HEAD/detect_demo.png -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | BitmapCanary 3 | 4 | -------------------------------------------------------------------------------- /BitmapCanary/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smallnew/BitmapCanary/HEAD/BitmapCanary/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /BitmapCanary/androidbitmapcanary/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AndroidBitmapCanary 3 | 4 | -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/res/drawable-hdpi/printlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smallnew/BitmapCanary/HEAD/BitmapCanary/app/src/main/res/drawable-hdpi/printlogo.png -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smallnew/BitmapCanary/HEAD/BitmapCanary/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smallnew/BitmapCanary/HEAD/BitmapCanary/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smallnew/BitmapCanary/HEAD/BitmapCanary/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smallnew/BitmapCanary/HEAD/BitmapCanary/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smallnew/BitmapCanary/HEAD/BitmapCanary/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /BitmapCanary/androidbitmapcanary/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smallnew/BitmapCanary/HEAD/BitmapCanary/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smallnew/BitmapCanary/HEAD/BitmapCanary/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smallnew/BitmapCanary/HEAD/BitmapCanary/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smallnew/BitmapCanary/HEAD/BitmapCanary/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smallnew/BitmapCanary/HEAD/BitmapCanary/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /BitmapCanary/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed May 02 17:31:08 CST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/java/smallnew/bitmapcanary/DemoActivity2.java: -------------------------------------------------------------------------------- 1 | package smallnew.bitmapcanary; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | 6 | public class DemoActivity2 extends Activity { 7 | 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | setContentView(R.layout.activity_demo2); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/java/smallnew/bitmapcanary/DemoApplication.java: -------------------------------------------------------------------------------- 1 | package smallnew.bitmapcanary; 2 | 3 | import android.app.Application; 4 | 5 | import hexin.androidbitmapcanary.ActivityDrawableWatcher; 6 | 7 | /** 8 | * Created by smallnew on 2018/5/3. 9 | */ 10 | 11 | public class DemoApplication extends Application { 12 | @Override 13 | public void onCreate() { 14 | super.onCreate(); 15 | ActivityDrawableWatcher.watchDrawable(this); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BitmapCanary/local.properties: -------------------------------------------------------------------------------- 1 | ## This file is automatically generated by Android Studio. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must *NOT* be checked into Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | # 7 | # Location of the SDK. This is only used by Gradle. 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | #Sat May 05 20:35:15 CST 2018 11 | sdk.dir=D\:\\Android\\sdk 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BitmapCanary 2 | Detect Android bitmap size when app runing,检查安卓运行时使用的bitmap大小,检查出过大的位图并展示 3 | 4 |    介绍: 5 |    Android工程中会使用大量的图片,但是如果图片放置的drawable目录位置不正确,可能会导致图片占用的内存过大,可能导致cpu使用更多时间分配更多内存,可能导致内存溢出 6 |    现在可以使用BitmapCanary来方便开发者检查工程中过大的图片,可视化展示,一句代码即可接入该功能 7 |     8 | 9 | 使用方法: 10 | 11 | 下载并依赖androidbitmapcanary 12 | 13 | ActivityDrawableWatcher.watchDrawable(this);//这样就ok啦 14 | 15 |    app界面会有蒙层来表示该图片的位图已经超过了视图的1.5倍(长宽)大小,并有白色数字标明倍数 16 |     17 | 18 | ![image](https://github.com/smallnew/BitmapCanary/raw/master/detect_demo.png) 19 | -------------------------------------------------------------------------------- /BitmapCanary/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.0.0' 11 | 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /BitmapCanary/androidbitmapcanary/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 26 5 | 6 | 7 | 8 | defaultConfig { 9 | minSdkVersion 16 10 | targetSdkVersion 26 11 | versionCode 1 12 | versionName "1.0" 13 | 14 | 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | 24 | } 25 | 26 | dependencies { 27 | implementation fileTree(dir: 'libs', include: ['*.jar']) 28 | 29 | implementation 'com.android.support:appcompat-v7:26.1.0' 30 | } 31 | -------------------------------------------------------------------------------- /BitmapCanary/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 26 5 | defaultConfig { 6 | applicationId "smallnew.bitmapcanary" 7 | minSdkVersion 16 8 | targetSdkVersion 26 9 | versionCode 1 10 | versionName "1.0" 11 | } 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 16 | } 17 | } 18 | } 19 | 20 | dependencies { 21 | implementation fileTree(include: ['*.jar'], dir: 'libs') 22 | implementation 'com.android.support.constraint:constraint-layout:1.1.0' 23 | implementation project(':androidbitmapcanary') 24 | } 25 | -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/java/smallnew/bitmapcanary/DemoActivity.java: -------------------------------------------------------------------------------- 1 | package smallnew.bitmapcanary; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.view.View; 7 | 8 | public class DemoActivity extends Activity { 9 | 10 | @Override 11 | protected void onCreate(Bundle savedInstanceState) { 12 | super.onCreate(savedInstanceState); 13 | setContentView(R.layout.activity_demo); 14 | findViewById(R.id.iv_go2).setOnClickListener(new View.OnClickListener() { 15 | @Override 16 | public void onClick(View view) { 17 | startActivity(new Intent(DemoActivity.this,DemoActivity2.class)); 18 | } 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BitmapCanary/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1024m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /BitmapCanary/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /BitmapCanary/androidbitmapcanary/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /BitmapCanary/BitmapCanary.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/res/layout/activity_demo2.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 16 | 17 | 22 | 23 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /BitmapCanary/app/src/main/res/layout/activity_demo.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 |