├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── gradle.xml ├── inspectionProfiles │ ├── Project_Default.xml │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── example │ │ └── identityimageview │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── identityimageview │ │ │ └── MainActivity.java │ └── res │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ ├── biaoshi.gif │ │ ├── guojia.jpg │ │ ├── ic_launcher.png │ │ ├── red.jpg │ │ ├── testimage.jpg │ │ ├── text.jpg │ │ ├── v.jpg │ │ └── v2.jpg │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── example │ └── identityimageview │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── imagelib ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── exampleenen │ │ └── ruedy │ │ └── imagelib │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── exampleenen │ │ │ └── ruedy │ │ │ └── imagelib │ │ │ └── widget │ │ │ ├── CircleImageView.java │ │ │ └── IdentityImageView.java │ └── res │ │ └── values │ │ ├── attrs.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── exampleenen │ └── ruedy │ └── imagelib │ └── ExampleUnitTest.java └── settings.gradle /.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 | -------------------------------------------------------------------------------- /.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/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # IdentityImageView 3 | 一个能带进度条的图片框架,同时有身份标识动能,简单易用 4 | 5 | ## 效果图: 6 | ![效果图](https://github.com/385841539/IdentityImageView/blob/master/app/src/main/res/mipmap-xhdpi/biaoshi.gif) 7 | 8 | 9 | # 博客介绍 10 | 11 | CSDN:[http://blog.csdn.net/iamdingruihaha/article/details/69895266](http://blog.csdn.net/iamdingruihaha/article/details/69895266) 12 | 13 | 14 | 15 | ## Download 16 | 17 | 简单的两个类:IdentityImageView,CircleImageView,下载下来 放到项目里面 18 | 19 | #### OR 20 | >> 1.先在 build.gradle(Project:XXXX) 的 repositories 添加:
21 | ``` 22 | allprojects { 23 | repositories { 24 | ... 25 | maven { url 'https://jitpack.io' } 26 | } 27 | } 28 | ``` 29 | 30 | >> 2.然后在 build.gradle(Module:app) 的 dependencies 添加:
31 | 32 | ``` 33 | dependencies { 34 | 35 | 36 | compile 'com.github.385841539:IdentityImageView:1.5.0' 37 | } 38 | ``` 39 | # Usage 40 | 41 | ### 基本使用: 42 | 43 | 44 | ```xml 45 | 52 | ``` 53 | 54 | 55 | ### 自定义(均设有默认值,可不使用): 56 | 57 | 58 | | 属性          |   参数类型           | 说明 | 59 | | ------------------------- |------------------ | --------------------- | 60 | | iciv_bigimage | reference |大图片| 61 | | iciv_smallimage | reference         | 小图片(标识)| 62 | | iciv_angle | float     | 标识的角度,默认为45度| 63 | | iciv_radiusscale | float |大小图片比例,默认为0.2| 64 | | iciv_isprogress|boolean flag | 是否有进度条,默认为false,如果要用,必须设置为true| 65 | |iciv_progress_collor|Color Or reference| 进度条颜色| 66 | | iciv_border_color |Color Or reference| 边框颜色 | 67 | |  iciv_border_width |integer | 边框和进度条宽度 | 68 | |iciv_hint_smallimageview | boolean| 是否隐藏小图片| 69 | 70 | 71 |   72 | ### 动态 设置属性值: 73 | ```java 74 | 75 | identityImageView = ((IdentityImageView) findViewById(R.id.iiv)); 76 | 77 |               //填充大图片 78 | identityImageView.getBigCircleImageView().setImageResource(R.mipmap.guojia); 79 | 80 | //改变图片比例大小, 81 | identityImageView.setRadiusScale(0.1f); 82 | 83 | 84 | //增加边框 85 | identityImageView.setBorderWidth(100); 86 | identityImageView.setBorderColor(R.color.colorTest); 87 | 88 | //增加进度条,以及改变的角度 89 | identityImageView.setIsprogress(true); 90 | identityImageView.setProgressColor(R.color.colorAccent); 91 | identityImageView.setProgress(120); 92 | 93 | 94 | ``` 95 | 96 | ## Tips: 97 | 原理很简单,献丑了,方便大家调用,为了节省大家时间。 98 |   99 | 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.2" 6 | defaultConfig { 7 | applicationId "com.example.identityimageview" 8 | minSdkVersion 15 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(include: ['*.jar'], dir: 'libs') 24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 25 | exclude group: 'com.android.support', module: 'support-annotations' 26 | }) 27 | compile 'com.android.support:appcompat-v7:25.2.0' 28 | testCompile 'junit:junit:4.12' 29 | compile project(':imagelib') 30 | } 31 | -------------------------------------------------------------------------------- /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 D:\studio\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 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/example/identityimageview/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.example.identityimageview; 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("com.example.identityimageview", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/identityimageview/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.identityimageview; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | import android.util.Log; 6 | import android.view.View; 7 | import android.widget.Button; 8 | 9 | import com.exampleenen.ruedy.imagelib.widget.IdentityImageView; 10 | 11 | 12 | public class MainActivity extends AppCompatActivity { 13 | 14 | private IdentityImageView identityImageView; 15 | private Button bt1; 16 | private Button bt2; 17 | private Button bt4; 18 | private Button bt3; 19 | private Button bt5; 20 | private int i = 10; 21 | private int angle = 30; 22 | private boolean flag;//文字是否出现 23 | 24 | 25 | @Override 26 | protected void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | setContentView(R.layout.activity_main); 29 | initViews(); 30 | } 31 | 32 | private void initViews() { 33 | identityImageView = ((IdentityImageView) findViewById(R.id.iiv)); 34 | bt1 = ((Button) findViewById(R.id.bt1)); 35 | bt2 = ((Button) findViewById(R.id.bt2)); 36 | bt3 = ((Button) findViewById(R.id.bt3)); 37 | bt4 = ((Button) findViewById(R.id.bt4)); 38 | bt5 = ((Button) findViewById(R.id.bt5)); 39 | } 40 | 41 | public void click(View view) { 42 | switch (view.getId()) { 43 | case R.id.bt1://填充头像 44 | identityImageView.getBigCircleImageView().setImageResource(R.mipmap.guojia); 45 | 46 | break; 47 | case R.id.bt2: 48 | //改变图片比例大小, 49 | identityImageView.setRadiusScale(0.1f); 50 | break; 51 | case R.id.bt3: 52 | //增加边框 53 | identityImageView.setBorderWidth(50); 54 | identityImageView.setBorderColor(R.color.colorTest); 55 | 56 | break; 57 | case R.id.bt4: 58 | //增加进度条,没按一次加10,以及改变的角度 59 | identityImageView.setIsprogress(true); 60 | identityImageView.setProgressColor(R.color.colorAccent); 61 | 62 | identityImageView.setProgress(i += 10); 63 | 64 | break; 65 | case R.id.bt5: 66 | identityImageView.getSmallCircleImageView().setImageResource(R.mipmap.v); 67 | break; 68 | 69 | case R.id.bt6: 70 | identityImageView.setAngle(angle += 7); 71 | break; 72 | default: 73 | break; 74 | 75 | 76 | } 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 13 | 14 |