├── .idea ├── .name ├── copyright │ └── profiles_settings.xml ├── dictionaries │ └── Administrator.xml ├── encodings.xml ├── modules.xml ├── runConfigurations.xml ├── compiler.xml ├── gradle.xml └── misc.xml ├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── icon_31.jpg │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── itheima │ │ │ │ └── roundedimagedemo │ │ │ │ └── roundedimageview │ │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── itheima │ │ │ └── roundedimagedemo │ │ │ └── roundedimageview │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── itheima │ │ └── roundedimagedemo │ │ └── roundedimageview │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── library ├── build │ ├── intermediates │ │ ├── incremental │ │ │ ├── compileDebugAidl │ │ │ │ └── dependency.store │ │ │ ├── compileReleaseAidl │ │ │ │ └── dependency.store │ │ │ ├── compileDebugAndroidTestAidl │ │ │ │ └── dependency.store │ │ │ ├── mergeDebugAndroidTestShaders │ │ │ │ └── merger.xml │ │ │ ├── mergeDebugShaders │ │ │ │ └── merger.xml │ │ │ ├── mergeDebugJniLibFolders │ │ │ │ └── merger.xml │ │ │ ├── mergeReleaseShaders │ │ │ │ └── merger.xml │ │ │ ├── mergeReleaseJniLibFolders │ │ │ │ └── merger.xml │ │ │ ├── mergeDebugAssets │ │ │ │ └── merger.xml │ │ │ ├── mergeReleaseAssets │ │ │ │ └── merger.xml │ │ │ ├── mergeDebugAndroidTestAssets │ │ │ │ └── merger.xml │ │ │ ├── mergeDebugAndroidTestResources │ │ │ │ └── merger.xml │ │ │ ├── packageDebugResources │ │ │ │ └── merger.xml │ │ │ └── packageReleaseResources │ │ │ │ └── merger.xml │ │ ├── incremental-safeguard │ │ │ ├── debug │ │ │ │ └── tag.txt │ │ │ └── release │ │ │ │ └── tag.txt │ │ ├── bundles │ │ │ ├── debug │ │ │ │ ├── classes.jar │ │ │ │ ├── proguard.txt │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── aapt │ │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── res │ │ │ │ │ └── values │ │ │ │ │ │ └── values.xml │ │ │ │ └── R.txt │ │ │ └── release │ │ │ │ ├── classes.jar │ │ │ │ ├── proguard.txt │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── aapt │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── res │ │ │ │ └── values │ │ │ │ │ └── values.xml │ │ │ │ └── R.txt │ │ ├── annotations │ │ │ ├── debug │ │ │ │ └── annotations.zip │ │ │ └── release │ │ │ │ └── annotations.zip │ │ ├── res │ │ │ ├── resources-debug-androidTest.ap_ │ │ │ └── merged │ │ │ │ └── androidTest │ │ │ │ └── debug │ │ │ │ └── values │ │ │ │ └── values.xml │ │ ├── classes │ │ │ ├── debug │ │ │ │ └── com │ │ │ │ │ └── itheima │ │ │ │ │ └── roundedimageview │ │ │ │ │ ├── R.class │ │ │ │ │ ├── R$id.class │ │ │ │ │ ├── Corner.class │ │ │ │ │ ├── R$attr.class │ │ │ │ │ ├── R$string.class │ │ │ │ │ ├── BuildConfig.class │ │ │ │ │ ├── R$styleable.class │ │ │ │ │ ├── RoundedDrawable$1.class │ │ │ │ │ ├── RoundedDrawable.class │ │ │ │ │ ├── RoundedImageView.class │ │ │ │ │ ├── RoundedImageView$1.class │ │ │ │ │ ├── RoundedTransformationBuilder.class │ │ │ │ │ └── RoundedTransformationBuilder$1.class │ │ │ └── release │ │ │ │ └── com │ │ │ │ └── itheima │ │ │ │ └── roundedimageview │ │ │ │ ├── R.class │ │ │ │ ├── R$id.class │ │ │ │ ├── Corner.class │ │ │ │ ├── R$attr.class │ │ │ │ ├── R$string.class │ │ │ │ ├── BuildConfig.class │ │ │ │ ├── R$styleable.class │ │ │ │ ├── RoundedDrawable.class │ │ │ │ ├── RoundedDrawable$1.class │ │ │ │ ├── RoundedImageView.class │ │ │ │ ├── RoundedImageView$1.class │ │ │ │ ├── RoundedTransformationBuilder$1.class │ │ │ │ └── RoundedTransformationBuilder.class │ │ ├── manifest │ │ │ └── androidTest │ │ │ │ └── debug │ │ │ │ └── AndroidManifest.xml │ │ ├── symbols │ │ │ └── androidTest │ │ │ │ └── debug │ │ │ │ └── R.txt │ │ └── blame │ │ │ └── res │ │ │ └── androidTest │ │ │ └── debug │ │ │ └── multi │ │ │ └── values.json │ ├── outputs │ │ └── aar │ │ │ ├── library-debug.aar │ │ │ └── library-release.aar │ └── generated │ │ └── source │ │ ├── buildConfig │ │ ├── release │ │ │ └── com │ │ │ │ └── itheima │ │ │ │ └── roundedimageview │ │ │ │ └── BuildConfig.java │ │ ├── debug │ │ │ └── com │ │ │ │ └── itheima │ │ │ │ └── roundedimageview │ │ │ │ └── BuildConfig.java │ │ └── androidTest │ │ │ └── debug │ │ │ └── com │ │ │ └── itheima │ │ │ └── roundedimageview │ │ │ └── test │ │ │ └── BuildConfig.java │ │ └── r │ │ ├── androidTest │ │ └── debug │ │ │ └── com │ │ │ └── itheima │ │ │ └── roundedimageview │ │ │ ├── R.java │ │ │ └── test │ │ │ └── R.java │ │ ├── debug │ │ └── com │ │ │ └── itheima │ │ │ └── roundedimageview │ │ │ └── R.java │ │ └── release │ │ └── com │ │ └── itheima │ │ └── roundedimageview │ │ └── R.java ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── itheima │ │ │ └── roundedimageview │ │ │ ├── Corner.java │ │ │ ├── RoundedTransformationBuilder.java │ │ │ ├── RoundedImageView.java │ │ │ └── RoundedDrawable.java │ │ └── res │ │ └── values │ │ ├── about_libraries_def.xml │ │ └── attrs.xml ├── release-proguard.cfg └── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── README.md └── gradlew /.idea/.name: -------------------------------------------------------------------------------- 1 | RoundedImageView -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':library' 2 | -------------------------------------------------------------------------------- /library/build/intermediates/incremental/compileDebugAidl/dependency.store: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /library/build/intermediates/incremental/compileReleaseAidl/dependency.store: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /library/build/intermediates/incremental-safeguard/debug/tag.txt: -------------------------------------------------------------------------------- 1 | incremental task execution -------------------------------------------------------------------------------- /library/build/intermediates/incremental-safeguard/release/tag.txt: -------------------------------------------------------------------------------- 1 | incremental task execution -------------------------------------------------------------------------------- /library/build/intermediates/incremental/compileDebugAndroidTestAidl/dependency.store: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | RoundedImageView 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.idea/dictionaries/Administrator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/icon_31.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/app/src/main/res/mipmap-hdpi/icon_31.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /library/build/outputs/aar/library-debug.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/outputs/aar/library-debug.aar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /library/build/outputs/aar/library-release.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/outputs/aar/library-release.aar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /library/build/intermediates/bundles/debug/classes.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/bundles/debug/classes.jar -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /library/build/intermediates/bundles/release/classes.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/bundles/release/classes.jar -------------------------------------------------------------------------------- /library/build/intermediates/annotations/debug/annotations.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/annotations/debug/annotations.zip -------------------------------------------------------------------------------- /library/build/intermediates/annotations/release/annotations.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/annotations/release/annotations.zip -------------------------------------------------------------------------------- /library/build/intermediates/res/resources-debug-androidTest.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/res/resources-debug-androidTest.ap_ -------------------------------------------------------------------------------- /library/build/intermediates/classes/debug/com/itheima/roundedimageview/R.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/debug/com/itheima/roundedimageview/R.class -------------------------------------------------------------------------------- /library/release-proguard.cfg: -------------------------------------------------------------------------------- 1 | # Proguard configuration. 2 | -dontwarn com.squareup.okhttp.** 3 | 4 | # References to Picasso are okay if the consuming app doesn't use it 5 | -dontwarn com.squareup.picasso.Transformation 6 | -------------------------------------------------------------------------------- /library/build/intermediates/classes/debug/com/itheima/roundedimageview/R$id.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/debug/com/itheima/roundedimageview/R$id.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/release/com/itheima/roundedimageview/R.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/release/com/itheima/roundedimageview/R.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/debug/com/itheima/roundedimageview/Corner.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/debug/com/itheima/roundedimageview/Corner.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/debug/com/itheima/roundedimageview/R$attr.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/debug/com/itheima/roundedimageview/R$attr.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/release/com/itheima/roundedimageview/R$id.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/release/com/itheima/roundedimageview/R$id.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/debug/com/itheima/roundedimageview/R$string.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/debug/com/itheima/roundedimageview/R$string.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/release/com/itheima/roundedimageview/Corner.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/release/com/itheima/roundedimageview/Corner.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/release/com/itheima/roundedimageview/R$attr.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/release/com/itheima/roundedimageview/R$attr.class -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /library/build/intermediates/classes/debug/com/itheima/roundedimageview/BuildConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/debug/com/itheima/roundedimageview/BuildConfig.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/debug/com/itheima/roundedimageview/R$styleable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/debug/com/itheima/roundedimageview/R$styleable.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/release/com/itheima/roundedimageview/R$string.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/release/com/itheima/roundedimageview/R$string.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/release/com/itheima/roundedimageview/BuildConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/release/com/itheima/roundedimageview/BuildConfig.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/release/com/itheima/roundedimageview/R$styleable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/release/com/itheima/roundedimageview/R$styleable.class -------------------------------------------------------------------------------- /library/build/intermediates/bundles/debug/proguard.txt: -------------------------------------------------------------------------------- 1 | # Proguard configuration. 2 | -dontwarn com.squareup.okhttp.** 3 | 4 | # References to Picasso are okay if the consuming app doesn't use it 5 | -dontwarn com.squareup.picasso.Transformation 6 | -------------------------------------------------------------------------------- /library/build/intermediates/bundles/release/proguard.txt: -------------------------------------------------------------------------------- 1 | # Proguard configuration. 2 | -dontwarn com.squareup.okhttp.** 3 | 4 | # References to Picasso are okay if the consuming app doesn't use it 5 | -dontwarn com.squareup.picasso.Transformation 6 | -------------------------------------------------------------------------------- /library/build/intermediates/classes/debug/com/itheima/roundedimageview/RoundedDrawable$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/debug/com/itheima/roundedimageview/RoundedDrawable$1.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/debug/com/itheima/roundedimageview/RoundedDrawable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/debug/com/itheima/roundedimageview/RoundedDrawable.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/debug/com/itheima/roundedimageview/RoundedImageView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/debug/com/itheima/roundedimageview/RoundedImageView.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/release/com/itheima/roundedimageview/RoundedDrawable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/release/com/itheima/roundedimageview/RoundedDrawable.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/debug/com/itheima/roundedimageview/RoundedImageView$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/debug/com/itheima/roundedimageview/RoundedImageView$1.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/release/com/itheima/roundedimageview/RoundedDrawable$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/release/com/itheima/roundedimageview/RoundedDrawable$1.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/release/com/itheima/roundedimageview/RoundedImageView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/release/com/itheima/roundedimageview/RoundedImageView.class -------------------------------------------------------------------------------- /library/build/intermediates/incremental/mergeDebugAndroidTestShaders/merger.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /library/build/intermediates/classes/release/com/itheima/roundedimageview/RoundedImageView$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/release/com/itheima/roundedimageview/RoundedImageView$1.class -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /library/build/intermediates/classes/debug/com/itheima/roundedimageview/RoundedTransformationBuilder.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/debug/com/itheima/roundedimageview/RoundedTransformationBuilder.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/debug/com/itheima/roundedimageview/RoundedTransformationBuilder$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/debug/com/itheima/roundedimageview/RoundedTransformationBuilder$1.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/release/com/itheima/roundedimageview/RoundedTransformationBuilder$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/release/com/itheima/roundedimageview/RoundedTransformationBuilder$1.class -------------------------------------------------------------------------------- /library/build/intermediates/classes/release/com/itheima/roundedimageview/RoundedTransformationBuilder.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-android/RoundedImageView/HEAD/library/build/intermediates/classes/release/com/itheima/roundedimageview/RoundedTransformationBuilder.class -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 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-2.10-all.zip 7 | -------------------------------------------------------------------------------- /library/build/intermediates/incremental/mergeDebugShaders/merger.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /library/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /library/build/intermediates/incremental/mergeReleaseShaders/merger.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /library/build/intermediates/incremental/mergeReleaseJniLibFolders/merger.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /library/build/intermediates/bundles/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /library/build/intermediates/bundles/release/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /library/build/intermediates/bundles/debug/aapt/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /library/build/intermediates/bundles/release/aapt/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /library/build/intermediates/incremental/mergeDebugAssets/merger.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /library/build/intermediates/incremental/mergeReleaseAssets/merger.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /library/build/intermediates/incremental/mergeDebugAndroidTestAssets/merger.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/test/java/com/itheima/roundedimagedemo/roundedimageview/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.itheima.roundedimagedemo.roundedimageview; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /app/src/main/java/com/itheima/roundedimagedemo/roundedimageview/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.itheima.roundedimagedemo.roundedimageview; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | 6 | public class MainActivity extends AppCompatActivity { 7 | 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | setContentView(R.layout.activity_main); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/itheima/roundedimagedemo/roundedimageview/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.itheima.roundedimagedemo.roundedimageview; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /library/src/main/java/com/itheima/roundedimageview/Corner.java: -------------------------------------------------------------------------------- 1 | package com.itheima.roundedimageview; 2 | 3 | import android.support.annotation.IntDef; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | 7 | @Retention(RetentionPolicy.SOURCE) 8 | @IntDef({ 9 | Corner.TOP_LEFT, Corner.TOP_RIGHT, 10 | Corner.BOTTOM_LEFT, Corner.BOTTOM_RIGHT 11 | }) 12 | public @interface Corner { 13 | int TOP_LEFT = 0; 14 | int TOP_RIGHT = 1; 15 | int BOTTOM_RIGHT = 2; 16 | int BOTTOM_LEFT = 3; 17 | } 18 | -------------------------------------------------------------------------------- /library/build/generated/source/buildConfig/release/com/itheima/roundedimageview/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Automatically generated file. DO NOT MODIFY 3 | */ 4 | package com.itheima.roundedimageview; 5 | 6 | public final class BuildConfig { 7 | public static final boolean DEBUG = false; 8 | public static final String APPLICATION_ID = "com.itheima.roundedimageview"; 9 | public static final String BUILD_TYPE = "release"; 10 | public static final String FLAVOR = ""; 11 | public static final int VERSION_CODE = 1; 12 | public static final String VERSION_NAME = "unspecified"; 13 | } 14 | -------------------------------------------------------------------------------- /library/build/generated/source/buildConfig/debug/com/itheima/roundedimageview/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Automatically generated file. DO NOT MODIFY 3 | */ 4 | package com.itheima.roundedimageview; 5 | 6 | public final class BuildConfig { 7 | public static final boolean DEBUG = Boolean.parseBoolean("true"); 8 | public static final String APPLICATION_ID = "com.itheima.roundedimageview"; 9 | public static final String BUILD_TYPE = "debug"; 10 | public static final String FLAVOR = ""; 11 | public static final int VERSION_CODE = 1; 12 | public static final String VERSION_NAME = "unspecified"; 13 | } 14 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /library/build/generated/source/buildConfig/androidTest/debug/com/itheima/roundedimageview/test/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Automatically generated file. DO NOT MODIFY 3 | */ 4 | package com.itheima.roundedimageview.test; 5 | 6 | public final class BuildConfig { 7 | public static final boolean DEBUG = Boolean.parseBoolean("true"); 8 | public static final String APPLICATION_ID = "com.itheima.roundedimageview.test"; 9 | public static final String BUILD_TYPE = "debug"; 10 | public static final String FLAVOR = ""; 11 | public static final int VERSION_CODE = 1; 12 | public static final String VERSION_NAME = "unspecified"; 13 | } 14 | -------------------------------------------------------------------------------- /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 C:\android\android_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 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "24.0.1" 6 | 7 | defaultConfig { 8 | applicationId "com.itheima.roundedimagedemo.roundedimageview" 9 | minSdkVersion 16 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 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(dir: 'libs', include: ['*.jar']) 24 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:23.4.0' 26 | compile project(':library') 27 | } 28 | -------------------------------------------------------------------------------- /library/build/intermediates/manifest/androidTest/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /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 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 22 | 23 | -------------------------------------------------------------------------------- /library/src/main/res/values/about_libraries_def.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Vince Mi 5 | https://github.com/vinc3m1 6 | RoundedImageView 7 | A fast ImageView (and Drawable) that supports rounded corners (and ovals or circles) based on the original example from Romain Guy. 8 | 1.3.0 9 | https://github.com/vinc3m1/RoundedImageView 10 | apache_2_0 11 | true 12 | https://github.com/vinc3m1/RoundedImageView.git 13 | 14 | -------------------------------------------------------------------------------- /library/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /library/build/intermediates/bundles/debug/res/values/values.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vince Mi 6 | https://github.com/vinc3m1 7 | true 8 | A fast ImageView (and Drawable) that supports rounded corners (and ovals or circles) based on the original example from Romain Guy. 9 | RoundedImageView 10 | 1.3.0 11 | https://github.com/vinc3m1/RoundedImageView 12 | apache_2_0 13 | https://github.com/vinc3m1/RoundedImageView.git 14 | -------------------------------------------------------------------------------- /library/build/intermediates/bundles/release/res/values/values.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vince Mi 6 | https://github.com/vinc3m1 7 | true 8 | A fast ImageView (and Drawable) that supports rounded corners (and ovals or circles) based on the original example from Romain Guy. 9 | RoundedImageView 10 | 1.3.0 11 | https://github.com/vinc3m1/RoundedImageView 12 | apache_2_0 13 | https://github.com/vinc3m1/RoundedImageView.git 14 | -------------------------------------------------------------------------------- /library/build/intermediates/res/merged/androidTest/debug/values/values.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vince Mi 6 | https://github.com/vinc3m1 7 | true 8 | A fast ImageView (and Drawable) that supports rounded corners (and ovals or circles) based on the original example from Romain Guy. 9 | RoundedImageView 10 | 1.3.0 11 | https://github.com/vinc3m1/RoundedImageView 12 | apache_2_0 13 | https://github.com/vinc3m1/RoundedImageView.git 14 | -------------------------------------------------------------------------------- /library/build/intermediates/bundles/debug/R.txt: -------------------------------------------------------------------------------- 1 | int attr riv_border_color 0x7f010006 2 | int attr riv_border_width 0x7f010005 3 | int attr riv_corner_radius 0x7f010000 4 | int attr riv_corner_radius_bottom_left 0x7f010003 5 | int attr riv_corner_radius_bottom_right 0x7f010004 6 | int attr riv_corner_radius_top_left 0x7f010001 7 | int attr riv_corner_radius_top_right 0x7f010002 8 | int attr riv_mutate_background 0x7f010007 9 | int attr riv_oval 0x7f010008 10 | int attr riv_tile_mode 0x7f010009 11 | int attr riv_tile_mode_x 0x7f01000a 12 | int attr riv_tile_mode_y 0x7f01000b 13 | int id clamp 0x7f030000 14 | int id mirror 0x7f030001 15 | int id repeat 0x7f030002 16 | int string define_roundedimageview 0x7f020000 17 | int string library_roundedimageview_author 0x7f020001 18 | int string library_roundedimageview_authorWebsite 0x7f020002 19 | int string library_roundedimageview_isOpenSource 0x7f020003 20 | int string library_roundedimageview_libraryDescription 0x7f020004 21 | int string library_roundedimageview_libraryName 0x7f020005 22 | int string library_roundedimageview_libraryVersion 0x7f020006 23 | int string library_roundedimageview_libraryWebsite 0x7f020007 24 | int string library_roundedimageview_licenseId 0x7f020008 25 | int string library_roundedimageview_repositoryLink 0x7f020009 26 | int[] styleable RoundedImageView { 0x0101011d, 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b } 27 | int styleable RoundedImageView_android_scaleType 0 28 | int styleable RoundedImageView_riv_border_color 7 29 | int styleable RoundedImageView_riv_border_width 6 30 | int styleable RoundedImageView_riv_corner_radius 1 31 | int styleable RoundedImageView_riv_corner_radius_bottom_left 4 32 | int styleable RoundedImageView_riv_corner_radius_bottom_right 5 33 | int styleable RoundedImageView_riv_corner_radius_top_left 2 34 | int styleable RoundedImageView_riv_corner_radius_top_right 3 35 | int styleable RoundedImageView_riv_mutate_background 8 36 | int styleable RoundedImageView_riv_oval 9 37 | int styleable RoundedImageView_riv_tile_mode 10 38 | int styleable RoundedImageView_riv_tile_mode_x 11 39 | int styleable RoundedImageView_riv_tile_mode_y 12 40 | -------------------------------------------------------------------------------- /library/build/intermediates/bundles/release/R.txt: -------------------------------------------------------------------------------- 1 | int attr riv_border_color 0x7f010006 2 | int attr riv_border_width 0x7f010005 3 | int attr riv_corner_radius 0x7f010000 4 | int attr riv_corner_radius_bottom_left 0x7f010003 5 | int attr riv_corner_radius_bottom_right 0x7f010004 6 | int attr riv_corner_radius_top_left 0x7f010001 7 | int attr riv_corner_radius_top_right 0x7f010002 8 | int attr riv_mutate_background 0x7f010007 9 | int attr riv_oval 0x7f010008 10 | int attr riv_tile_mode 0x7f010009 11 | int attr riv_tile_mode_x 0x7f01000a 12 | int attr riv_tile_mode_y 0x7f01000b 13 | int id clamp 0x7f030000 14 | int id mirror 0x7f030001 15 | int id repeat 0x7f030002 16 | int string define_roundedimageview 0x7f020000 17 | int string library_roundedimageview_author 0x7f020001 18 | int string library_roundedimageview_authorWebsite 0x7f020002 19 | int string library_roundedimageview_isOpenSource 0x7f020003 20 | int string library_roundedimageview_libraryDescription 0x7f020004 21 | int string library_roundedimageview_libraryName 0x7f020005 22 | int string library_roundedimageview_libraryVersion 0x7f020006 23 | int string library_roundedimageview_libraryWebsite 0x7f020007 24 | int string library_roundedimageview_licenseId 0x7f020008 25 | int string library_roundedimageview_repositoryLink 0x7f020009 26 | int[] styleable RoundedImageView { 0x0101011d, 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b } 27 | int styleable RoundedImageView_android_scaleType 0 28 | int styleable RoundedImageView_riv_border_color 7 29 | int styleable RoundedImageView_riv_border_width 6 30 | int styleable RoundedImageView_riv_corner_radius 1 31 | int styleable RoundedImageView_riv_corner_radius_bottom_left 4 32 | int styleable RoundedImageView_riv_corner_radius_bottom_right 5 33 | int styleable RoundedImageView_riv_corner_radius_top_left 2 34 | int styleable RoundedImageView_riv_corner_radius_top_right 3 35 | int styleable RoundedImageView_riv_mutate_background 8 36 | int styleable RoundedImageView_riv_oval 9 37 | int styleable RoundedImageView_riv_tile_mode 10 38 | int styleable RoundedImageView_riv_tile_mode_x 11 39 | int styleable RoundedImageView_riv_tile_mode_y 12 40 | -------------------------------------------------------------------------------- /library/build/intermediates/symbols/androidTest/debug/R.txt: -------------------------------------------------------------------------------- 1 | int attr riv_border_color 0x7f010006 2 | int attr riv_border_width 0x7f010005 3 | int attr riv_corner_radius 0x7f010000 4 | int attr riv_corner_radius_bottom_left 0x7f010003 5 | int attr riv_corner_radius_bottom_right 0x7f010004 6 | int attr riv_corner_radius_top_left 0x7f010001 7 | int attr riv_corner_radius_top_right 0x7f010002 8 | int attr riv_mutate_background 0x7f010007 9 | int attr riv_oval 0x7f010008 10 | int attr riv_tile_mode 0x7f010009 11 | int attr riv_tile_mode_x 0x7f01000a 12 | int attr riv_tile_mode_y 0x7f01000b 13 | int id clamp 0x7f030000 14 | int id mirror 0x7f030001 15 | int id repeat 0x7f030002 16 | int string define_roundedimageview 0x7f020000 17 | int string library_roundedimageview_author 0x7f020001 18 | int string library_roundedimageview_authorWebsite 0x7f020002 19 | int string library_roundedimageview_isOpenSource 0x7f020003 20 | int string library_roundedimageview_libraryDescription 0x7f020004 21 | int string library_roundedimageview_libraryName 0x7f020005 22 | int string library_roundedimageview_libraryVersion 0x7f020006 23 | int string library_roundedimageview_libraryWebsite 0x7f020007 24 | int string library_roundedimageview_licenseId 0x7f020008 25 | int string library_roundedimageview_repositoryLink 0x7f020009 26 | int[] styleable RoundedImageView { 0x0101011d, 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b } 27 | int styleable RoundedImageView_android_scaleType 0 28 | int styleable RoundedImageView_riv_border_color 7 29 | int styleable RoundedImageView_riv_border_width 6 30 | int styleable RoundedImageView_riv_corner_radius 1 31 | int styleable RoundedImageView_riv_corner_radius_bottom_left 4 32 | int styleable RoundedImageView_riv_corner_radius_bottom_right 5 33 | int styleable RoundedImageView_riv_corner_radius_top_left 2 34 | int styleable RoundedImageView_riv_corner_radius_top_right 3 35 | int styleable RoundedImageView_riv_mutate_background 8 36 | int styleable RoundedImageView_riv_oval 9 37 | int styleable RoundedImageView_riv_tile_mode 10 38 | int styleable RoundedImageView_riv_tile_mode_x 11 39 | int styleable RoundedImageView_riv_tile_mode_y 12 40 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 最火Android开源项目RoundedImageView使用 2 | --- 3 | 开源地址:[https://github.com/open-android/RoundedImageView](https://github.com/open-android/RoundedImageView "开源项目地址") 4 | 5 | PS:如果觉得文章太长,你也可观看该课程的[视频](https://www.boxuegu.com/web/html/video.html?courseId=172§ionId=8a2c9bed5a3a4c7e015a3bbffc6107ed&chapterId=8a2c9bed5a3a4c7e015a3bc0868907ee&vId=8a2c9bed5a3a4c7e015a3ad0360e022c&videoId=D277116506A044F09C33DC5901307461),亲,里面还有高清,无码的福利喔 6 | 7 | # 运行效果 8 | 9 | ![](http://i.imgur.com/BpRjAuO.png) 10 | 11 | * 爱生活,爱学习,更爱做代码的搬运工,分类查找更方便请下载黑马助手app 12 | 13 | ![黑马助手.png](http://upload-images.jianshu.io/upload_images/4037105-f777f1214328dcc4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 14 | 15 | 16 | ## 使用步骤 17 | 18 | ### 1. 在project的build.gradle添加如下代码(如下图) 19 | 20 | allprojects { 21 | repositories { 22 | ... 23 | maven { url "https://jitpack.io" } 24 | } 25 | } 26 | 27 | ![](http://oi5nqn6ce.bkt.clouddn.com/itheima/booster/code/jitpack.png) 28 | 29 | 30 | ### 2. 在Module的build.gradle添加依赖 31 | 32 | compile 'com.github.open-android:RoundedImageView:v1.0.0' 33 | 34 | 35 | ### 3. 复制如下代码到xml 36 | 37 | 46 | 47 | 54 | 55 | ### 细节 56 | 57 | * 当然也可以使用代码来控制 58 | 59 | RoundedImageView riv = new RoundedImageView(context); 60 | riv.setScaleType(ScaleType.CENTER_CROP); //缩放居中 61 | riv.setCornerRadius((float) 10); // 四周角度 62 | riv.setBorderWidth((float) 2); //描边大小 63 | riv.setBorderColor(Color.DKGRAY); //描边颜色 64 | riv.setImageDrawable(drawable); //图片设置 65 | riv.setBackground(backgroundDrawable); //背景设置 66 | riv.setOval(true); //是否为椭圆 67 | 68 | * 当然也可以配合Picasso来对图片进行艺术处理 (黑白照) 69 | 70 | Transformation transformation = new RoundedTransformationBuilder() 71 | .borderColor(Color.BLACK) 72 | .borderWidthDp(3) 73 | .cornerRadiusDp(30) 74 | .oval(false) 75 | .build(); 76 | 77 | Picasso.with(context) 78 | .load(url) 79 | .fit() 80 | .transform(transformation) 81 | .into(imageView); 82 | 83 | 84 | 85 | * 详细的使用方法在DEMO里面都演示啦,如果你觉得这个库还不错,请赏我一颗star吧~~~ 86 | 87 | * 欢迎关注微信公众号 88 | 89 | ![](http://upload-images.jianshu.io/upload_images/4037105-8f737b5104dd0b5d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 90 | -------------------------------------------------------------------------------- /library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'maven' 3 | apply plugin: 'signing' 4 | 5 | apply plugin: 'com.github.dcendents.android-maven' 6 | group='com.github.itcastsh' 7 | def sonatypeUsername = project.hasProperty('sonatypeUsername') ? sonatypeUsername : "" 8 | def sonatypePassword = project.hasProperty('sonatypePassword') ? sonatypePassword : "" 9 | 10 | android { 11 | compileSdkVersion 23 12 | buildToolsVersion "23.0.3" 13 | 14 | defaultConfig { 15 | minSdkVersion 16 16 | consumerProguardFiles 'release-proguard.cfg' 17 | versionCode 1 18 | versionName version 19 | } 20 | 21 | compileOptions { 22 | sourceCompatibility JavaVersion.VERSION_1_7 23 | targetCompatibility JavaVersion.VERSION_1_7 24 | } 25 | } 26 | 27 | dependencies { 28 | provided 'com.squareup.picasso:picasso:2.5.2' 29 | provided 'com.android.support:support-annotations:23.1.0' 30 | } 31 | 32 | task androidJavadocs(type: Javadoc) { 33 | source = android.sourceSets.main.java.source 34 | } 35 | 36 | task androidJavadocsJar(type: Jar) { 37 | classifier = 'javadoc' 38 | //basename = artifact_id 39 | from androidJavadocs.destinationDir 40 | } 41 | 42 | task androidSourcesJar(type: Jar) { 43 | classifier = 'sources' 44 | //basename = artifact_id 45 | from android.sourceSets.main.java.source 46 | } 47 | 48 | artifacts { 49 | archives androidSourcesJar 50 | archives androidJavadocsJar 51 | } 52 | 53 | signing { 54 | required { has("release") && gradle.taskGraph.hasTask("uploadArchives") } 55 | sign configurations.archives 56 | } 57 | 58 | uploadArchives { 59 | repositories.mavenDeployer { 60 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } 61 | 62 | repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') { 63 | authentication(userName: sonatypeUsername, password: sonatypePassword) 64 | } 65 | 66 | snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') { 67 | authentication(userName: sonatypeUsername, password: sonatypePassword) 68 | } 69 | 70 | pom { 71 | project { 72 | name 'RoundedImageView' 73 | packaging 'aar' 74 | 75 | description 'Fast ImageView with support for rounded corners and borders' 76 | url 'https://github.com/vinc3m1/RoundedImageView' 77 | 78 | scm { 79 | url 'scm:git@github.com:vinc3m1/RoundedImageView.git' 80 | connection 'scm:git@github.com:vinc3m1/RoundedImageView.git' 81 | developerConnection 'scm:git@github.com:vinc3m1/RoundedImageView.git' 82 | } 83 | 84 | licenses { 85 | license { 86 | name 'The Apache Software License, Version 2.0' 87 | url 'http://www.apache.org/licenses/LICENSE-2.0.txt' 88 | distribution 'repo' 89 | } 90 | } 91 | 92 | developers { 93 | developer { 94 | id 'vinc3m1' 95 | name 'Vince Mi' 96 | email 'vince@makeramen.com' 97 | } 98 | } 99 | } 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /library/build/generated/source/r/androidTest/debug/com/itheima/roundedimageview/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | package com.itheima.roundedimageview; 8 | 9 | public final class R { 10 | public static final class attr { 11 | public static final int riv_border_color = 0x7f010006; 12 | public static final int riv_border_width = 0x7f010005; 13 | public static final int riv_corner_radius = 0x7f010000; 14 | public static final int riv_corner_radius_bottom_left = 0x7f010003; 15 | public static final int riv_corner_radius_bottom_right = 0x7f010004; 16 | public static final int riv_corner_radius_top_left = 0x7f010001; 17 | public static final int riv_corner_radius_top_right = 0x7f010002; 18 | public static final int riv_mutate_background = 0x7f010007; 19 | public static final int riv_oval = 0x7f010008; 20 | public static final int riv_tile_mode = 0x7f010009; 21 | public static final int riv_tile_mode_x = 0x7f01000a; 22 | public static final int riv_tile_mode_y = 0x7f01000b; 23 | } 24 | public static final class id { 25 | public static final int clamp = 0x7f030000; 26 | public static final int mirror = 0x7f030001; 27 | public static final int repeat = 0x7f030002; 28 | } 29 | public static final class string { 30 | public static final int define_roundedimageview = 0x7f020000; 31 | public static final int library_roundedimageview_author = 0x7f020001; 32 | public static final int library_roundedimageview_authorWebsite = 0x7f020002; 33 | public static final int library_roundedimageview_isOpenSource = 0x7f020003; 34 | public static final int library_roundedimageview_libraryDescription = 0x7f020004; 35 | public static final int library_roundedimageview_libraryName = 0x7f020005; 36 | public static final int library_roundedimageview_libraryVersion = 0x7f020006; 37 | public static final int library_roundedimageview_libraryWebsite = 0x7f020007; 38 | public static final int library_roundedimageview_licenseId = 0x7f020008; 39 | public static final int library_roundedimageview_repositoryLink = 0x7f020009; 40 | } 41 | public static final class styleable { 42 | public static final int[] RoundedImageView = { 0x0101011d, 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b }; 43 | public static final int RoundedImageView_android_scaleType = 0; 44 | public static final int RoundedImageView_riv_border_color = 7; 45 | public static final int RoundedImageView_riv_border_width = 6; 46 | public static final int RoundedImageView_riv_corner_radius = 1; 47 | public static final int RoundedImageView_riv_corner_radius_bottom_left = 4; 48 | public static final int RoundedImageView_riv_corner_radius_bottom_right = 5; 49 | public static final int RoundedImageView_riv_corner_radius_top_left = 2; 50 | public static final int RoundedImageView_riv_corner_radius_top_right = 3; 51 | public static final int RoundedImageView_riv_mutate_background = 8; 52 | public static final int RoundedImageView_riv_oval = 9; 53 | public static final int RoundedImageView_riv_tile_mode = 10; 54 | public static final int RoundedImageView_riv_tile_mode_x = 11; 55 | public static final int RoundedImageView_riv_tile_mode_y = 12; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | Android 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 62 | 63 | 64 | 65 | 66 | 1.7 67 | 68 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /library/build/intermediates/incremental/mergeDebugAndroidTestResources/merger.xml: -------------------------------------------------------------------------------- 1 | 2 | RoundedImageViewhttps://github.com/vinc3m1/RoundedImageView.gitapache_2_0truehttps://github.com/vinc3m1/RoundedImageViewVince Mi1.3.0https://github.com/vinc3m1A fast ImageView (and Drawable) that supports rounded corners (and ovals or circles) based on the original example from Romain Guy. -------------------------------------------------------------------------------- /library/build/intermediates/incremental/packageDebugResources/merger.xml: -------------------------------------------------------------------------------- 1 | 2 | RoundedImageViewhttps://github.com/vinc3m1/RoundedImageView.gittrueapache_2_0Vince Mi1.3.0https://github.com/vinc3m1A fast ImageView (and Drawable) that supports rounded corners (and ovals or circles) based on the original example from Romain Guy.https://github.com/vinc3m1/RoundedImageView 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /library/build/intermediates/incremental/packageReleaseResources/merger.xml: -------------------------------------------------------------------------------- 1 | 2 | RoundedImageViewhttps://github.com/vinc3m1/RoundedImageView.gittrueapache_2_0Vince Mi1.3.0https://github.com/vinc3m1A fast ImageView (and Drawable) that supports rounded corners (and ovals or circles) based on the original example from Romain Guy.https://github.com/vinc3m1/RoundedImageView 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /library/src/main/java/com/itheima/roundedimageview/RoundedTransformationBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Vincent Mi 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.itheima.roundedimageview; 18 | 19 | import android.content.res.ColorStateList; 20 | import android.content.res.Resources; 21 | import android.graphics.Bitmap; 22 | import android.util.DisplayMetrics; 23 | import android.util.TypedValue; 24 | import android.widget.ImageView; 25 | import com.squareup.picasso.Transformation; 26 | import java.util.Arrays; 27 | 28 | public final class RoundedTransformationBuilder { 29 | 30 | //private final Resources mResources; 31 | private final DisplayMetrics mDisplayMetrics; 32 | 33 | private float[] mCornerRadii = new float[] { 0, 0, 0, 0 }; 34 | 35 | private boolean mOval = false; 36 | private float mBorderWidth = 0; 37 | private ColorStateList mBorderColor = 38 | ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR); 39 | private ImageView.ScaleType mScaleType = ImageView.ScaleType.FIT_CENTER; 40 | 41 | public RoundedTransformationBuilder() { 42 | mDisplayMetrics = Resources.getSystem().getDisplayMetrics(); 43 | } 44 | 45 | public RoundedTransformationBuilder scaleType(ImageView.ScaleType scaleType) { 46 | mScaleType = scaleType; 47 | return this; 48 | } 49 | 50 | /** 51 | * Set corner radius for all corners in px. 52 | * 53 | * @param radius the radius in px 54 | * @return the builder for chaining. 55 | */ 56 | public RoundedTransformationBuilder cornerRadius(float radius) { 57 | mCornerRadii[Corner.TOP_LEFT] = radius; 58 | mCornerRadii[Corner.TOP_RIGHT] = radius; 59 | mCornerRadii[Corner.BOTTOM_RIGHT] = radius; 60 | mCornerRadii[Corner.BOTTOM_LEFT] = radius; 61 | return this; 62 | } 63 | 64 | /** 65 | * Set corner radius for a specific corner in px. 66 | * 67 | * @param corner the corner to set. 68 | * @param radius the radius in px. 69 | * @return the builder for chaning. 70 | */ 71 | public RoundedTransformationBuilder cornerRadius(int corner, float radius) { 72 | mCornerRadii[corner] = radius; 73 | return this; 74 | } 75 | 76 | /** 77 | * Set corner radius for all corners in density independent pixels. 78 | * 79 | * @param radius the radius in density independent pixels. 80 | * @return the builder for chaining. 81 | */ 82 | public RoundedTransformationBuilder cornerRadiusDp(float radius) { 83 | return cornerRadius( 84 | TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, radius, mDisplayMetrics)); 85 | } 86 | 87 | /** 88 | * Set corner radius for a specific corner in density independent pixels. 89 | * 90 | * @param corner the corner to set 91 | * @param radius the radius in density independent pixels. 92 | * @return the builder for chaining. 93 | */ 94 | public RoundedTransformationBuilder cornerRadiusDp(int corner, float radius) { 95 | return cornerRadius(corner, 96 | TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, radius, mDisplayMetrics)); 97 | } 98 | 99 | /** 100 | * Set the border width in pixels. 101 | * 102 | * @param width border width in pixels. 103 | * @return the builder for chaining. 104 | */ 105 | public RoundedTransformationBuilder borderWidth(float width) { 106 | mBorderWidth = width; 107 | return this; 108 | } 109 | 110 | /** 111 | * Set the border width in density independent pixels. 112 | * 113 | * @param width border width in density independent pixels. 114 | * @return the builder for chaining. 115 | */ 116 | public RoundedTransformationBuilder borderWidthDp(float width) { 117 | mBorderWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, width, mDisplayMetrics); 118 | return this; 119 | } 120 | 121 | /** 122 | * Set the border color. 123 | * 124 | * @param color the color to set. 125 | * @return the builder for chaining. 126 | */ 127 | public RoundedTransformationBuilder borderColor(int color) { 128 | mBorderColor = ColorStateList.valueOf(color); 129 | return this; 130 | } 131 | 132 | /** 133 | * Set the border color as a {@link ColorStateList}. 134 | * 135 | * @param colors the {@link ColorStateList} to set. 136 | * @return the builder for chaining. 137 | */ 138 | public RoundedTransformationBuilder borderColor(ColorStateList colors) { 139 | mBorderColor = colors; 140 | return this; 141 | } 142 | 143 | /** 144 | * Sets whether the image should be oval or not. 145 | * 146 | * @param oval if the image should be oval. 147 | * @return the builder for chaining. 148 | */ 149 | public RoundedTransformationBuilder oval(boolean oval) { 150 | mOval = oval; 151 | return this; 152 | } 153 | 154 | /** 155 | * Creates a {@link Transformation} for use with picasso. 156 | * 157 | * @return the {@link Transformation} 158 | */ 159 | public Transformation build() { 160 | return new Transformation() { 161 | @Override public Bitmap transform(Bitmap source) { 162 | Bitmap transformed = RoundedDrawable.fromBitmap(source) 163 | .setScaleType(mScaleType) 164 | .setCornerRadius(mCornerRadii[0], mCornerRadii[1], mCornerRadii[2], mCornerRadii[3]) 165 | .setBorderWidth(mBorderWidth) 166 | .setBorderColor(mBorderColor) 167 | .setOval(mOval) 168 | .toBitmap(); 169 | if (!source.equals(transformed)) { 170 | source.recycle(); 171 | } 172 | return transformed; 173 | } 174 | 175 | @Override public String key() { 176 | return "r:" + Arrays.toString(mCornerRadii) 177 | + "b:" + mBorderWidth 178 | + "c:" + mBorderColor 179 | + "o:" + mOval; 180 | } 181 | }; 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /library/build/intermediates/blame/res/androidTest/debug/multi/values.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "outputFile": "D:\\work6\\RoundedImageView\\library\\build\\intermediates\\res\\merged\\androidTest\\debug\\values\\values.xml", 4 | "map": [ 5 | { 6 | "to": { 7 | "startLine": 3, 8 | "startColumn": 4, 9 | "startOffset": 1025, 10 | "endColumn": 44, 11 | "endOffset": 1065 12 | }, 13 | "from": { 14 | "file": "D:\\work6\\RoundedImageView\\library\\build\\intermediates\\bundles\\debug\\res\\values\\values.xml", 15 | "position": { 16 | "startLine": 3, 17 | "startColumn": 4, 18 | "startOffset": 1025, 19 | "endColumn": 44, 20 | "endOffset": 1065 21 | } 22 | } 23 | }, 24 | { 25 | "to": { 26 | "startLine": 4, 27 | "startColumn": 4, 28 | "startOffset": 1070, 29 | "endColumn": 68, 30 | "endOffset": 1134 31 | }, 32 | "from": { 33 | "file": "D:\\work6\\RoundedImageView\\library\\build\\intermediates\\bundles\\debug\\res\\values\\values.xml", 34 | "position": { 35 | "startLine": 4, 36 | "startColumn": 4, 37 | "startOffset": 1070, 38 | "endColumn": 68, 39 | "endOffset": 1134 40 | } 41 | } 42 | }, 43 | { 44 | "to": { 45 | "startLine": 5, 46 | "startColumn": 4, 47 | "startOffset": 1139, 48 | "endColumn": 93, 49 | "endOffset": 1228 50 | }, 51 | "from": { 52 | "file": "D:\\work6\\RoundedImageView\\library\\build\\intermediates\\bundles\\debug\\res\\values\\values.xml", 53 | "position": { 54 | "startLine": 5, 55 | "startColumn": 4, 56 | "startOffset": 1139, 57 | "endColumn": 93, 58 | "endOffset": 1228 59 | } 60 | } 61 | }, 62 | { 63 | "to": { 64 | "startLine": 6, 65 | "startColumn": 4, 66 | "startOffset": 1233, 67 | "endColumn": 70, 68 | "endOffset": 1299 69 | }, 70 | "from": { 71 | "file": "D:\\work6\\RoundedImageView\\library\\build\\intermediates\\bundles\\debug\\res\\values\\values.xml", 72 | "position": { 73 | "startLine": 6, 74 | "startColumn": 4, 75 | "startOffset": 1233, 76 | "endColumn": 70, 77 | "endOffset": 1299 78 | } 79 | } 80 | }, 81 | { 82 | "to": { 83 | "startLine": 7, 84 | "startColumn": 4, 85 | "startOffset": 1304, 86 | "endColumn": 203, 87 | "endOffset": 1503 88 | }, 89 | "from": { 90 | "file": "D:\\work6\\RoundedImageView\\library\\build\\intermediates\\bundles\\debug\\res\\values\\values.xml", 91 | "position": { 92 | "startLine": 7, 93 | "startColumn": 4, 94 | "startOffset": 1304, 95 | "endColumn": 203, 96 | "endOffset": 1503 97 | } 98 | } 99 | }, 100 | { 101 | "to": { 102 | "startLine": 8, 103 | "startColumn": 4, 104 | "startOffset": 1508, 105 | "endColumn": 81, 106 | "endOffset": 1585 107 | }, 108 | "from": { 109 | "file": "D:\\work6\\RoundedImageView\\library\\build\\intermediates\\bundles\\debug\\res\\values\\values.xml", 110 | "position": { 111 | "startLine": 8, 112 | "startColumn": 4, 113 | "startOffset": 1508, 114 | "endColumn": 81, 115 | "endOffset": 1585 116 | } 117 | } 118 | }, 119 | { 120 | "to": { 121 | "startLine": 9, 122 | "startColumn": 4, 123 | "startOffset": 1590, 124 | "endColumn": 73, 125 | "endOffset": 1659 126 | }, 127 | "from": { 128 | "file": "D:\\work6\\RoundedImageView\\library\\build\\intermediates\\bundles\\debug\\res\\values\\values.xml", 129 | "position": { 130 | "startLine": 9, 131 | "startColumn": 4, 132 | "startOffset": 1590, 133 | "endColumn": 73, 134 | "endOffset": 1659 135 | } 136 | } 137 | }, 138 | { 139 | "to": { 140 | "startLine": 10, 141 | "startColumn": 4, 142 | "startOffset": 1664, 143 | "endColumn": 111, 144 | "endOffset": 1771 145 | }, 146 | "from": { 147 | "file": "D:\\work6\\RoundedImageView\\library\\build\\intermediates\\bundles\\debug\\res\\values\\values.xml", 148 | "position": { 149 | "startLine": 10, 150 | "startColumn": 4, 151 | "startOffset": 1664, 152 | "endColumn": 111, 153 | "endOffset": 1771 154 | } 155 | } 156 | }, 157 | { 158 | "to": { 159 | "startLine": 11, 160 | "startColumn": 4, 161 | "startOffset": 1776, 162 | "endColumn": 73, 163 | "endOffset": 1845 164 | }, 165 | "from": { 166 | "file": "D:\\work6\\RoundedImageView\\library\\build\\intermediates\\bundles\\debug\\res\\values\\values.xml", 167 | "position": { 168 | "startLine": 11, 169 | "startColumn": 4, 170 | "startOffset": 1776, 171 | "endColumn": 73, 172 | "endOffset": 1845 173 | } 174 | } 175 | }, 176 | { 177 | "to": { 178 | "startLine": 12, 179 | "startColumn": 4, 180 | "startOffset": 1850, 181 | "endColumn": 115, 182 | "endOffset": 1961 183 | }, 184 | "from": { 185 | "file": "D:\\work6\\RoundedImageView\\library\\build\\intermediates\\bundles\\debug\\res\\values\\values.xml", 186 | "position": { 187 | "startLine": 12, 188 | "startColumn": 4, 189 | "startOffset": 1850, 190 | "endColumn": 115, 191 | "endOffset": 1961 192 | } 193 | } 194 | } 195 | ] 196 | } 197 | ] -------------------------------------------------------------------------------- /library/src/main/java/com/itheima/roundedimageview/RoundedImageView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Vincent Mi 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.itheima.roundedimageview; 18 | 19 | import android.content.Context; 20 | import android.content.res.ColorStateList; 21 | import android.content.res.Resources; 22 | import android.content.res.TypedArray; 23 | import android.graphics.Bitmap; 24 | import android.graphics.ColorFilter; 25 | import android.graphics.Shader; 26 | import android.graphics.drawable.ColorDrawable; 27 | import android.graphics.drawable.Drawable; 28 | import android.graphics.drawable.LayerDrawable; 29 | import android.net.Uri; 30 | import android.support.annotation.ColorInt; 31 | import android.support.annotation.DimenRes; 32 | import android.support.annotation.DrawableRes; 33 | import android.util.AttributeSet; 34 | import android.util.Log; 35 | import android.widget.ImageView; 36 | 37 | @SuppressWarnings("UnusedDeclaration") 38 | public class RoundedImageView extends ImageView { 39 | 40 | // Constants for tile mode attributes 41 | private static final int TILE_MODE_UNDEFINED = -2; 42 | private static final int TILE_MODE_CLAMP = 0; 43 | private static final int TILE_MODE_REPEAT = 1; 44 | private static final int TILE_MODE_MIRROR = 2; 45 | 46 | public static final String TAG = "RoundedImageView"; 47 | public static final float DEFAULT_RADIUS = 0f; 48 | public static final float DEFAULT_BORDER_WIDTH = 0f; 49 | public static final Shader.TileMode DEFAULT_TILE_MODE = Shader.TileMode.CLAMP; 50 | private static final ScaleType[] SCALE_TYPES = { 51 | ScaleType.MATRIX, 52 | ScaleType.FIT_XY, 53 | ScaleType.FIT_START, 54 | ScaleType.FIT_CENTER, 55 | ScaleType.FIT_END, 56 | ScaleType.CENTER, 57 | ScaleType.CENTER_CROP, 58 | ScaleType.CENTER_INSIDE 59 | }; 60 | 61 | private final float[] mCornerRadii = 62 | new float[] { DEFAULT_RADIUS, DEFAULT_RADIUS, DEFAULT_RADIUS, DEFAULT_RADIUS }; 63 | 64 | private Drawable mBackgroundDrawable; 65 | private ColorStateList mBorderColor = 66 | ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR); 67 | private float mBorderWidth = DEFAULT_BORDER_WIDTH; 68 | private ColorFilter mColorFilter = null; 69 | private boolean mColorMod = false; 70 | private Drawable mDrawable; 71 | private boolean mHasColorFilter = false; 72 | private boolean mIsOval = false; 73 | private boolean mMutateBackground = false; 74 | private int mResource; 75 | private int mBackgroundResource; 76 | private ScaleType mScaleType; 77 | private Shader.TileMode mTileModeX = DEFAULT_TILE_MODE; 78 | private Shader.TileMode mTileModeY = DEFAULT_TILE_MODE; 79 | 80 | public RoundedImageView(Context context) { 81 | super(context); 82 | } 83 | 84 | public RoundedImageView(Context context, AttributeSet attrs) { 85 | this(context, attrs, 0); 86 | } 87 | 88 | public RoundedImageView(Context context, AttributeSet attrs, int defStyle) { 89 | super(context, attrs, defStyle); 90 | 91 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RoundedImageView, defStyle, 0); 92 | 93 | int index = a.getInt(R.styleable.RoundedImageView_android_scaleType, -1); 94 | if (index >= 0) { 95 | setScaleType(SCALE_TYPES[index]); 96 | } else { 97 | // default scaletype to FIT_CENTER 98 | setScaleType(ScaleType.FIT_CENTER); 99 | } 100 | 101 | float cornerRadiusOverride = 102 | a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_corner_radius, -1); 103 | 104 | mCornerRadii[Corner.TOP_LEFT] = 105 | a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_corner_radius_top_left, -1); 106 | mCornerRadii[Corner.TOP_RIGHT] = 107 | a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_corner_radius_top_right, -1); 108 | mCornerRadii[Corner.BOTTOM_RIGHT] = 109 | a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_corner_radius_bottom_right, -1); 110 | mCornerRadii[Corner.BOTTOM_LEFT] = 111 | a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_corner_radius_bottom_left, -1); 112 | 113 | boolean any = false; 114 | for (int i = 0, len = mCornerRadii.length; i < len; i++) { 115 | if (mCornerRadii[i] < 0) { 116 | mCornerRadii[i] = 0f; 117 | } else { 118 | any = true; 119 | } 120 | } 121 | 122 | if (!any) { 123 | if (cornerRadiusOverride < 0) { 124 | cornerRadiusOverride = DEFAULT_RADIUS; 125 | } 126 | for (int i = 0, len = mCornerRadii.length; i < len; i++) { 127 | mCornerRadii[i] = cornerRadiusOverride; 128 | } 129 | } 130 | 131 | mBorderWidth = a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_border_width, -1); 132 | if (mBorderWidth < 0) { 133 | mBorderWidth = DEFAULT_BORDER_WIDTH; 134 | } 135 | 136 | mBorderColor = a.getColorStateList(R.styleable.RoundedImageView_riv_border_color); 137 | if (mBorderColor == null) { 138 | mBorderColor = ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR); 139 | } 140 | 141 | mMutateBackground = a.getBoolean(R.styleable.RoundedImageView_riv_mutate_background, false); 142 | mIsOval = a.getBoolean(R.styleable.RoundedImageView_riv_oval, false); 143 | 144 | final int tileMode = a.getInt(R.styleable.RoundedImageView_riv_tile_mode, TILE_MODE_UNDEFINED); 145 | if (tileMode != TILE_MODE_UNDEFINED) { 146 | setTileModeX(parseTileMode(tileMode)); 147 | setTileModeY(parseTileMode(tileMode)); 148 | } 149 | 150 | final int tileModeX = 151 | a.getInt(R.styleable.RoundedImageView_riv_tile_mode_x, TILE_MODE_UNDEFINED); 152 | if (tileModeX != TILE_MODE_UNDEFINED) { 153 | setTileModeX(parseTileMode(tileModeX)); 154 | } 155 | 156 | final int tileModeY = 157 | a.getInt(R.styleable.RoundedImageView_riv_tile_mode_y, TILE_MODE_UNDEFINED); 158 | if (tileModeY != TILE_MODE_UNDEFINED) { 159 | setTileModeY(parseTileMode(tileModeY)); 160 | } 161 | 162 | updateDrawableAttrs(); 163 | updateBackgroundDrawableAttrs(true); 164 | 165 | if (mMutateBackground) { 166 | // when setBackground() is called by View constructor, mMutateBackground is not loaded from the attribute, 167 | // so it's false by default, what doesn't allow to create the RoundedDrawable. At this point, after load 168 | // mMutateBackground and updated BackgroundDrawable to RoundedDrawable, the View's background drawable needs to 169 | // be changed to this new drawable. 170 | //noinspection deprecation 171 | super.setBackgroundDrawable(mBackgroundDrawable); 172 | } 173 | 174 | a.recycle(); 175 | } 176 | 177 | private static Shader.TileMode parseTileMode(int tileMode) { 178 | switch (tileMode) { 179 | case TILE_MODE_CLAMP: 180 | return Shader.TileMode.CLAMP; 181 | case TILE_MODE_REPEAT: 182 | return Shader.TileMode.REPEAT; 183 | case TILE_MODE_MIRROR: 184 | return Shader.TileMode.MIRROR; 185 | default: 186 | return null; 187 | } 188 | } 189 | 190 | @Override 191 | protected void drawableStateChanged() { 192 | super.drawableStateChanged(); 193 | invalidate(); 194 | } 195 | 196 | @Override 197 | public ScaleType getScaleType() { 198 | return mScaleType; 199 | } 200 | 201 | @Override 202 | public void setScaleType(ScaleType scaleType) { 203 | assert scaleType != null; 204 | 205 | if (mScaleType != scaleType) { 206 | mScaleType = scaleType; 207 | 208 | switch (scaleType) { 209 | case CENTER: 210 | case CENTER_CROP: 211 | case CENTER_INSIDE: 212 | case FIT_CENTER: 213 | case FIT_START: 214 | case FIT_END: 215 | case FIT_XY: 216 | super.setScaleType(ScaleType.FIT_XY); 217 | break; 218 | default: 219 | super.setScaleType(scaleType); 220 | break; 221 | } 222 | 223 | updateDrawableAttrs(); 224 | updateBackgroundDrawableAttrs(false); 225 | invalidate(); 226 | } 227 | } 228 | 229 | @Override 230 | public void setImageDrawable(Drawable drawable) { 231 | mResource = 0; 232 | mDrawable = RoundedDrawable.fromDrawable(drawable); 233 | updateDrawableAttrs(); 234 | super.setImageDrawable(mDrawable); 235 | } 236 | 237 | @Override 238 | public void setImageBitmap(Bitmap bm) { 239 | mResource = 0; 240 | mDrawable = RoundedDrawable.fromBitmap(bm); 241 | updateDrawableAttrs(); 242 | super.setImageDrawable(mDrawable); 243 | } 244 | 245 | @Override 246 | public void setImageResource(@DrawableRes int resId) { 247 | if (mResource != resId) { 248 | mResource = resId; 249 | mDrawable = resolveResource(); 250 | updateDrawableAttrs(); 251 | super.setImageDrawable(mDrawable); 252 | } 253 | } 254 | 255 | @Override public void setImageURI(Uri uri) { 256 | super.setImageURI(uri); 257 | setImageDrawable(getDrawable()); 258 | } 259 | 260 | private Drawable resolveResource() { 261 | Resources rsrc = getResources(); 262 | if (rsrc == null) { return null; } 263 | 264 | Drawable d = null; 265 | 266 | if (mResource != 0) { 267 | try { 268 | d = rsrc.getDrawable(mResource); 269 | } catch (Exception e) { 270 | Log.w(TAG, "Unable to find resource: " + mResource, e); 271 | // Don't try again. 272 | mResource = 0; 273 | } 274 | } 275 | return RoundedDrawable.fromDrawable(d); 276 | } 277 | 278 | @Override 279 | public void setBackground(Drawable background) { 280 | setBackgroundDrawable(background); 281 | } 282 | 283 | @Override 284 | public void setBackgroundResource(@DrawableRes int resId) { 285 | if (mBackgroundResource != resId) { 286 | mBackgroundResource = resId; 287 | mBackgroundDrawable = resolveBackgroundResource(); 288 | setBackgroundDrawable(mBackgroundDrawable); 289 | } 290 | } 291 | 292 | @Override 293 | public void setBackgroundColor(int color) { 294 | mBackgroundDrawable = new ColorDrawable(color); 295 | setBackgroundDrawable(mBackgroundDrawable); 296 | } 297 | 298 | private Drawable resolveBackgroundResource() { 299 | Resources rsrc = getResources(); 300 | if (rsrc == null) { return null; } 301 | 302 | Drawable d = null; 303 | 304 | if (mBackgroundResource != 0) { 305 | try { 306 | d = rsrc.getDrawable(mBackgroundResource); 307 | } catch (Exception e) { 308 | Log.w(TAG, "Unable to find resource: " + mBackgroundResource, e); 309 | // Don't try again. 310 | mBackgroundResource = 0; 311 | } 312 | } 313 | return RoundedDrawable.fromDrawable(d); 314 | } 315 | 316 | private void updateDrawableAttrs() { 317 | updateAttrs(mDrawable, mScaleType); 318 | } 319 | 320 | private void updateBackgroundDrawableAttrs(boolean convert) { 321 | if (mMutateBackground) { 322 | if (convert) { 323 | mBackgroundDrawable = RoundedDrawable.fromDrawable(mBackgroundDrawable); 324 | } 325 | updateAttrs(mBackgroundDrawable, ScaleType.FIT_XY); 326 | } 327 | } 328 | 329 | @Override public void setColorFilter(ColorFilter cf) { 330 | if (mColorFilter != cf) { 331 | mColorFilter = cf; 332 | mHasColorFilter = true; 333 | mColorMod = true; 334 | applyColorMod(); 335 | invalidate(); 336 | } 337 | } 338 | 339 | private void applyColorMod() { 340 | // Only mutate and apply when modifications have occurred. This should 341 | // not reset the mColorMod flag, since these filters need to be 342 | // re-applied if the Drawable is changed. 343 | if (mDrawable != null && mColorMod) { 344 | mDrawable = mDrawable.mutate(); 345 | if (mHasColorFilter) { 346 | mDrawable.setColorFilter(mColorFilter); 347 | } 348 | // TODO: support, eventually... 349 | //mDrawable.setXfermode(mXfermode); 350 | //mDrawable.setAlpha(mAlpha * mViewAlphaScale >> 8); 351 | } 352 | } 353 | 354 | private void updateAttrs(Drawable drawable, ScaleType scaleType) { 355 | if (drawable == null) { return; } 356 | 357 | if (drawable instanceof RoundedDrawable) { 358 | ((RoundedDrawable) drawable) 359 | .setScaleType(scaleType) 360 | .setBorderWidth(mBorderWidth) 361 | .setBorderColor(mBorderColor) 362 | .setOval(mIsOval) 363 | .setTileModeX(mTileModeX) 364 | .setTileModeY(mTileModeY); 365 | 366 | if (mCornerRadii != null) { 367 | ((RoundedDrawable) drawable).setCornerRadius( 368 | mCornerRadii[Corner.TOP_LEFT], 369 | mCornerRadii[Corner.TOP_RIGHT], 370 | mCornerRadii[Corner.BOTTOM_RIGHT], 371 | mCornerRadii[Corner.BOTTOM_LEFT]); 372 | } 373 | 374 | applyColorMod(); 375 | } else if (drawable instanceof LayerDrawable) { 376 | // loop through layers to and set drawable attrs 377 | LayerDrawable ld = ((LayerDrawable) drawable); 378 | for (int i = 0, layers = ld.getNumberOfLayers(); i < layers; i++) { 379 | updateAttrs(ld.getDrawable(i), scaleType); 380 | } 381 | } 382 | } 383 | 384 | @Override 385 | @Deprecated 386 | public void setBackgroundDrawable(Drawable background) { 387 | mBackgroundDrawable = background; 388 | updateBackgroundDrawableAttrs(true); 389 | //noinspection deprecation 390 | super.setBackgroundDrawable(mBackgroundDrawable); 391 | } 392 | 393 | /** 394 | * @return the largest corner radius. 395 | */ 396 | public float getCornerRadius() { 397 | return getMaxCornerRadius(); 398 | } 399 | 400 | /** 401 | * @return the largest corner radius. 402 | */ 403 | public float getMaxCornerRadius() { 404 | float maxRadius = 0; 405 | for (float r : mCornerRadii) { 406 | maxRadius = Math.max(r, maxRadius); 407 | } 408 | return maxRadius; 409 | } 410 | 411 | /** 412 | * Get the corner radius of a specified corner. 413 | * 414 | * @param corner the corner. 415 | * @return the radius. 416 | */ 417 | public float getCornerRadius(@Corner int corner) { 418 | return mCornerRadii[corner]; 419 | } 420 | 421 | /** 422 | * Set all the corner radii from a dimension resource id. 423 | * 424 | * @param resId dimension resource id of radii. 425 | */ 426 | public void setCornerRadiusDimen(@DimenRes int resId) { 427 | float radius = getResources().getDimension(resId); 428 | setCornerRadius(radius, radius, radius, radius); 429 | } 430 | 431 | /** 432 | * Set the corner radius of a specific corner from a dimension resource id. 433 | * 434 | * @param corner the corner to set. 435 | * @param resId the dimension resource id of the corner radius. 436 | */ 437 | public void setCornerRadiusDimen(@Corner int corner, @DimenRes int resId) { 438 | setCornerRadius(corner, getResources().getDimensionPixelSize(resId)); 439 | } 440 | 441 | /** 442 | * Set the corner radii of all corners in px. 443 | * 444 | * @param radius the radius to set. 445 | */ 446 | public void setCornerRadius(float radius) { 447 | setCornerRadius(radius, radius, radius, radius); 448 | } 449 | 450 | /** 451 | * Set the corner radius of a specific corner in px. 452 | * 453 | * @param corner the corner to set. 454 | * @param radius the corner radius to set in px. 455 | */ 456 | public void setCornerRadius(@Corner int corner, float radius) { 457 | if (mCornerRadii[corner] == radius) { 458 | return; 459 | } 460 | mCornerRadii[corner] = radius; 461 | 462 | updateDrawableAttrs(); 463 | updateBackgroundDrawableAttrs(false); 464 | invalidate(); 465 | } 466 | 467 | /** 468 | * Set the corner radii of each corner individually. Currently only one unique nonzero value is 469 | * supported. 470 | * 471 | * @param topLeft radius of the top left corner in px. 472 | * @param topRight radius of the top right corner in px. 473 | * @param bottomRight radius of the bottom right corner in px. 474 | * @param bottomLeft radius of the bottom left corner in px. 475 | */ 476 | public void setCornerRadius(float topLeft, float topRight, float bottomLeft, float bottomRight) { 477 | if (mCornerRadii[Corner.TOP_LEFT] == topLeft 478 | && mCornerRadii[Corner.TOP_RIGHT] == topRight 479 | && mCornerRadii[Corner.BOTTOM_RIGHT] == bottomRight 480 | && mCornerRadii[Corner.BOTTOM_LEFT] == bottomLeft) { 481 | return; 482 | } 483 | 484 | mCornerRadii[Corner.TOP_LEFT] = topLeft; 485 | mCornerRadii[Corner.TOP_RIGHT] = topRight; 486 | mCornerRadii[Corner.BOTTOM_LEFT] = bottomLeft; 487 | mCornerRadii[Corner.BOTTOM_RIGHT] = bottomRight; 488 | 489 | updateDrawableAttrs(); 490 | updateBackgroundDrawableAttrs(false); 491 | invalidate(); 492 | } 493 | 494 | public float getBorderWidth() { 495 | return mBorderWidth; 496 | } 497 | 498 | public void setBorderWidth(@DimenRes int resId) { 499 | setBorderWidth(getResources().getDimension(resId)); 500 | } 501 | 502 | public void setBorderWidth(float width) { 503 | if (mBorderWidth == width) { return; } 504 | 505 | mBorderWidth = width; 506 | updateDrawableAttrs(); 507 | updateBackgroundDrawableAttrs(false); 508 | invalidate(); 509 | } 510 | 511 | @ColorInt 512 | public int getBorderColor() { 513 | return mBorderColor.getDefaultColor(); 514 | } 515 | 516 | public void setBorderColor(@ColorInt int color) { 517 | setBorderColor(ColorStateList.valueOf(color)); 518 | } 519 | 520 | public ColorStateList getBorderColors() { 521 | return mBorderColor; 522 | } 523 | 524 | public void setBorderColor(ColorStateList colors) { 525 | if (mBorderColor.equals(colors)) { return; } 526 | 527 | mBorderColor = 528 | (colors != null) ? colors : ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR); 529 | updateDrawableAttrs(); 530 | updateBackgroundDrawableAttrs(false); 531 | if (mBorderWidth > 0) { 532 | invalidate(); 533 | } 534 | } 535 | 536 | public boolean isOval() { 537 | return mIsOval; 538 | } 539 | 540 | public void setOval(boolean oval) { 541 | mIsOval = oval; 542 | updateDrawableAttrs(); 543 | updateBackgroundDrawableAttrs(false); 544 | invalidate(); 545 | } 546 | 547 | public Shader.TileMode getTileModeX() { 548 | return mTileModeX; 549 | } 550 | 551 | public void setTileModeX(Shader.TileMode tileModeX) { 552 | if (this.mTileModeX == tileModeX) { return; } 553 | 554 | this.mTileModeX = tileModeX; 555 | updateDrawableAttrs(); 556 | updateBackgroundDrawableAttrs(false); 557 | invalidate(); 558 | } 559 | 560 | public Shader.TileMode getTileModeY() { 561 | return mTileModeY; 562 | } 563 | 564 | public void setTileModeY(Shader.TileMode tileModeY) { 565 | if (this.mTileModeY == tileModeY) { return; } 566 | 567 | this.mTileModeY = tileModeY; 568 | updateDrawableAttrs(); 569 | updateBackgroundDrawableAttrs(false); 570 | invalidate(); 571 | } 572 | 573 | public boolean mutatesBackground() { 574 | return mMutateBackground; 575 | } 576 | 577 | public void mutateBackground(boolean mutate) { 578 | if (mMutateBackground == mutate) { return; } 579 | 580 | mMutateBackground = mutate; 581 | updateBackgroundDrawableAttrs(true); 582 | invalidate(); 583 | } 584 | } 585 | -------------------------------------------------------------------------------- /library/src/main/java/com/itheima/roundedimageview/RoundedDrawable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Vincent Mi 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.itheima.roundedimageview; 18 | 19 | import android.content.res.ColorStateList; 20 | import android.graphics.Bitmap; 21 | import android.graphics.Bitmap.Config; 22 | import android.graphics.BitmapShader; 23 | import android.graphics.Canvas; 24 | import android.graphics.Color; 25 | import android.graphics.ColorFilter; 26 | import android.graphics.Matrix; 27 | import android.graphics.Paint; 28 | import android.graphics.PixelFormat; 29 | import android.graphics.Rect; 30 | import android.graphics.RectF; 31 | import android.graphics.Shader; 32 | import android.graphics.drawable.BitmapDrawable; 33 | import android.graphics.drawable.Drawable; 34 | import android.graphics.drawable.LayerDrawable; 35 | import android.support.annotation.ColorInt; 36 | import android.support.annotation.NonNull; 37 | import android.util.Log; 38 | import android.widget.ImageView.ScaleType; 39 | import java.util.HashSet; 40 | import java.util.Set; 41 | 42 | @SuppressWarnings("UnusedDeclaration") 43 | public class RoundedDrawable extends Drawable { 44 | 45 | public static final String TAG = "RoundedDrawable"; 46 | public static final int DEFAULT_BORDER_COLOR = Color.BLACK; 47 | 48 | private final RectF mBounds = new RectF(); 49 | private final RectF mDrawableRect = new RectF(); 50 | private final RectF mBitmapRect = new RectF(); 51 | private final Bitmap mBitmap; 52 | private final Paint mBitmapPaint; 53 | private final int mBitmapWidth; 54 | private final int mBitmapHeight; 55 | private final RectF mBorderRect = new RectF(); 56 | private final Paint mBorderPaint; 57 | private final Matrix mShaderMatrix = new Matrix(); 58 | private final RectF mSquareCornersRect = new RectF(); 59 | 60 | private Shader.TileMode mTileModeX = Shader.TileMode.CLAMP; 61 | private Shader.TileMode mTileModeY = Shader.TileMode.CLAMP; 62 | private boolean mRebuildShader = true; 63 | 64 | // [ topLeft, topRight, bottomLeft, bottomRight ] 65 | private float mCornerRadius = 0f; 66 | private final boolean[] mCornersRounded = new boolean[] { true, true, true, true }; 67 | 68 | private boolean mOval = false; 69 | private float mBorderWidth = 0; 70 | private ColorStateList mBorderColor = ColorStateList.valueOf(DEFAULT_BORDER_COLOR); 71 | private ScaleType mScaleType = ScaleType.FIT_CENTER; 72 | 73 | public RoundedDrawable(Bitmap bitmap) { 74 | mBitmap = bitmap; 75 | 76 | mBitmapWidth = bitmap.getWidth(); 77 | mBitmapHeight = bitmap.getHeight(); 78 | mBitmapRect.set(0, 0, mBitmapWidth, mBitmapHeight); 79 | 80 | mBitmapPaint = new Paint(); 81 | mBitmapPaint.setStyle(Paint.Style.FILL); 82 | mBitmapPaint.setAntiAlias(true); 83 | 84 | mBorderPaint = new Paint(); 85 | mBorderPaint.setStyle(Paint.Style.STROKE); 86 | mBorderPaint.setAntiAlias(true); 87 | mBorderPaint.setColor(mBorderColor.getColorForState(getState(), DEFAULT_BORDER_COLOR)); 88 | mBorderPaint.setStrokeWidth(mBorderWidth); 89 | } 90 | 91 | public static RoundedDrawable fromBitmap(Bitmap bitmap) { 92 | if (bitmap != null) { 93 | return new RoundedDrawable(bitmap); 94 | } else { 95 | return null; 96 | } 97 | } 98 | 99 | public static Drawable fromDrawable(Drawable drawable) { 100 | if (drawable != null) { 101 | if (drawable instanceof RoundedDrawable) { 102 | // just return if it's already a RoundedDrawable 103 | return drawable; 104 | } else if (drawable instanceof LayerDrawable) { 105 | LayerDrawable ld = (LayerDrawable) drawable; 106 | int num = ld.getNumberOfLayers(); 107 | 108 | // loop through layers to and change to RoundedDrawables if possible 109 | for (int i = 0; i < num; i++) { 110 | Drawable d = ld.getDrawable(i); 111 | ld.setDrawableByLayerId(ld.getId(i), fromDrawable(d)); 112 | } 113 | return ld; 114 | } 115 | 116 | // try to get a bitmap from the drawable and 117 | Bitmap bm = drawableToBitmap(drawable); 118 | if (bm != null) { 119 | return new RoundedDrawable(bm); 120 | } 121 | } 122 | return drawable; 123 | } 124 | 125 | public static Bitmap drawableToBitmap(Drawable drawable) { 126 | if (drawable instanceof BitmapDrawable) { 127 | return ((BitmapDrawable) drawable).getBitmap(); 128 | } 129 | 130 | Bitmap bitmap; 131 | int width = Math.max(drawable.getIntrinsicWidth(), 2); 132 | int height = Math.max(drawable.getIntrinsicHeight(), 2); 133 | try { 134 | bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); 135 | Canvas canvas = new Canvas(bitmap); 136 | drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); 137 | drawable.draw(canvas); 138 | } catch (Exception e) { 139 | e.printStackTrace(); 140 | Log.w(TAG, "Failed to create bitmap from drawable!"); 141 | bitmap = null; 142 | } 143 | 144 | return bitmap; 145 | } 146 | 147 | public Bitmap getSourceBitmap() { 148 | return mBitmap; 149 | } 150 | 151 | @Override 152 | public boolean isStateful() { 153 | return mBorderColor.isStateful(); 154 | } 155 | 156 | @Override 157 | protected boolean onStateChange(int[] state) { 158 | int newColor = mBorderColor.getColorForState(state, 0); 159 | if (mBorderPaint.getColor() != newColor) { 160 | mBorderPaint.setColor(newColor); 161 | return true; 162 | } else { 163 | return super.onStateChange(state); 164 | } 165 | } 166 | 167 | private void updateShaderMatrix() { 168 | float scale; 169 | float dx; 170 | float dy; 171 | 172 | switch (mScaleType) { 173 | case CENTER: 174 | mBorderRect.set(mBounds); 175 | mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); 176 | 177 | mShaderMatrix.reset(); 178 | mShaderMatrix.setTranslate((int) ((mBorderRect.width() - mBitmapWidth) * 0.5f + 0.5f), 179 | (int) ((mBorderRect.height() - mBitmapHeight) * 0.5f + 0.5f)); 180 | break; 181 | 182 | case CENTER_CROP: 183 | mBorderRect.set(mBounds); 184 | mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); 185 | 186 | mShaderMatrix.reset(); 187 | 188 | dx = 0; 189 | dy = 0; 190 | 191 | if (mBitmapWidth * mBorderRect.height() > mBorderRect.width() * mBitmapHeight) { 192 | scale = mBorderRect.height() / (float) mBitmapHeight; 193 | dx = (mBorderRect.width() - mBitmapWidth * scale) * 0.5f; 194 | } else { 195 | scale = mBorderRect.width() / (float) mBitmapWidth; 196 | dy = (mBorderRect.height() - mBitmapHeight * scale) * 0.5f; 197 | } 198 | 199 | mShaderMatrix.setScale(scale, scale); 200 | mShaderMatrix.postTranslate((int) (dx + 0.5f) + mBorderWidth / 2, 201 | (int) (dy + 0.5f) + mBorderWidth / 2); 202 | break; 203 | 204 | case CENTER_INSIDE: 205 | mShaderMatrix.reset(); 206 | 207 | if (mBitmapWidth <= mBounds.width() && mBitmapHeight <= mBounds.height()) { 208 | scale = 1.0f; 209 | } else { 210 | scale = Math.min(mBounds.width() / (float) mBitmapWidth, 211 | mBounds.height() / (float) mBitmapHeight); 212 | } 213 | 214 | dx = (int) ((mBounds.width() - mBitmapWidth * scale) * 0.5f + 0.5f); 215 | dy = (int) ((mBounds.height() - mBitmapHeight * scale) * 0.5f + 0.5f); 216 | 217 | mShaderMatrix.setScale(scale, scale); 218 | mShaderMatrix.postTranslate(dx, dy); 219 | 220 | mBorderRect.set(mBitmapRect); 221 | mShaderMatrix.mapRect(mBorderRect); 222 | mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); 223 | mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); 224 | break; 225 | 226 | default: 227 | case FIT_CENTER: 228 | mBorderRect.set(mBitmapRect); 229 | mShaderMatrix.setRectToRect(mBitmapRect, mBounds, Matrix.ScaleToFit.CENTER); 230 | mShaderMatrix.mapRect(mBorderRect); 231 | mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); 232 | mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); 233 | break; 234 | 235 | case FIT_END: 236 | mBorderRect.set(mBitmapRect); 237 | mShaderMatrix.setRectToRect(mBitmapRect, mBounds, Matrix.ScaleToFit.END); 238 | mShaderMatrix.mapRect(mBorderRect); 239 | mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); 240 | mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); 241 | break; 242 | 243 | case FIT_START: 244 | mBorderRect.set(mBitmapRect); 245 | mShaderMatrix.setRectToRect(mBitmapRect, mBounds, Matrix.ScaleToFit.START); 246 | mShaderMatrix.mapRect(mBorderRect); 247 | mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); 248 | mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); 249 | break; 250 | 251 | case FIT_XY: 252 | mBorderRect.set(mBounds); 253 | mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); 254 | mShaderMatrix.reset(); 255 | mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); 256 | break; 257 | } 258 | 259 | mDrawableRect.set(mBorderRect); 260 | } 261 | 262 | @Override 263 | protected void onBoundsChange(@NonNull Rect bounds) { 264 | super.onBoundsChange(bounds); 265 | 266 | mBounds.set(bounds); 267 | 268 | updateShaderMatrix(); 269 | } 270 | 271 | @Override 272 | public void draw(@NonNull Canvas canvas) { 273 | if (mRebuildShader) { 274 | BitmapShader bitmapShader = new BitmapShader(mBitmap, mTileModeX, mTileModeY); 275 | if (mTileModeX == Shader.TileMode.CLAMP && mTileModeY == Shader.TileMode.CLAMP) { 276 | bitmapShader.setLocalMatrix(mShaderMatrix); 277 | } 278 | mBitmapPaint.setShader(bitmapShader); 279 | mRebuildShader = false; 280 | } 281 | 282 | if (mOval) { 283 | if (mBorderWidth > 0) { 284 | canvas.drawOval(mDrawableRect, mBitmapPaint); 285 | canvas.drawOval(mBorderRect, mBorderPaint); 286 | } else { 287 | canvas.drawOval(mDrawableRect, mBitmapPaint); 288 | } 289 | } else { 290 | if (any(mCornersRounded)) { 291 | float radius = mCornerRadius; 292 | if (mBorderWidth > 0) { 293 | canvas.drawRoundRect(mDrawableRect, radius, radius, mBitmapPaint); 294 | canvas.drawRoundRect(mBorderRect, radius, radius, mBorderPaint); 295 | redrawBitmapForSquareCorners(canvas); 296 | redrawBorderForSquareCorners(canvas); 297 | } else { 298 | canvas.drawRoundRect(mDrawableRect, radius, radius, mBitmapPaint); 299 | redrawBitmapForSquareCorners(canvas); 300 | } 301 | } else { 302 | canvas.drawRect(mDrawableRect, mBitmapPaint); 303 | if (mBorderWidth > 0) { 304 | canvas.drawRect(mBorderRect, mBorderPaint); 305 | } 306 | } 307 | } 308 | } 309 | 310 | private void redrawBitmapForSquareCorners(Canvas canvas) { 311 | if (all(mCornersRounded)) { 312 | // no square corners 313 | return; 314 | } 315 | 316 | if (mCornerRadius == 0) { 317 | return; // no round corners 318 | } 319 | 320 | float left = mDrawableRect.left; 321 | float top = mDrawableRect.top; 322 | float right = left + mDrawableRect.width(); 323 | float bottom = top + mDrawableRect.height(); 324 | float radius = mCornerRadius; 325 | 326 | if (!mCornersRounded[Corner.TOP_LEFT]) { 327 | mSquareCornersRect.set(left, top, left + radius, top + radius); 328 | canvas.drawRect(mSquareCornersRect, mBitmapPaint); 329 | } 330 | 331 | if (!mCornersRounded[Corner.TOP_RIGHT]) { 332 | mSquareCornersRect.set(right - radius, top, right, radius); 333 | canvas.drawRect(mSquareCornersRect, mBitmapPaint); 334 | } 335 | 336 | if (!mCornersRounded[Corner.BOTTOM_RIGHT]) { 337 | mSquareCornersRect.set(right - radius, bottom - radius, right, bottom); 338 | canvas.drawRect(mSquareCornersRect, mBitmapPaint); 339 | } 340 | 341 | if (!mCornersRounded[Corner.BOTTOM_LEFT]) { 342 | mSquareCornersRect.set(left, bottom - radius, left + radius, bottom); 343 | canvas.drawRect(mSquareCornersRect, mBitmapPaint); 344 | } 345 | } 346 | 347 | private void redrawBorderForSquareCorners(Canvas canvas) { 348 | if (all(mCornersRounded)) { 349 | // no square corners 350 | return; 351 | } 352 | 353 | if (mCornerRadius == 0) { 354 | return; // no round corners 355 | } 356 | 357 | float left = mDrawableRect.left; 358 | float top = mDrawableRect.top; 359 | float right = left + mDrawableRect.width(); 360 | float bottom = top + mDrawableRect.height(); 361 | float radius = mCornerRadius; 362 | float offset = mBorderWidth / 2; 363 | 364 | if (!mCornersRounded[Corner.TOP_LEFT]) { 365 | canvas.drawLine(left - offset, top, left + radius, top, mBorderPaint); 366 | canvas.drawLine(left, top - offset, left, top + radius, mBorderPaint); 367 | } 368 | 369 | if (!mCornersRounded[Corner.TOP_RIGHT]) { 370 | canvas.drawLine(right - radius - offset, top, right, top, mBorderPaint); 371 | canvas.drawLine(right, top - offset, right, top + radius, mBorderPaint); 372 | } 373 | 374 | if (!mCornersRounded[Corner.BOTTOM_RIGHT]) { 375 | canvas.drawLine(right - radius - offset, bottom, right + offset, bottom, mBorderPaint); 376 | canvas.drawLine(right, bottom - radius, right, bottom, mBorderPaint); 377 | } 378 | 379 | if (!mCornersRounded[Corner.BOTTOM_LEFT]) { 380 | canvas.drawLine(left - offset, bottom, left + radius, bottom, mBorderPaint); 381 | canvas.drawLine(left, bottom - radius, left, bottom, mBorderPaint); 382 | } 383 | } 384 | 385 | @Override 386 | public int getOpacity() { 387 | return PixelFormat.TRANSLUCENT; 388 | } 389 | 390 | @Override 391 | public int getAlpha() { 392 | return mBitmapPaint.getAlpha(); 393 | } 394 | 395 | @Override 396 | public void setAlpha(int alpha) { 397 | mBitmapPaint.setAlpha(alpha); 398 | invalidateSelf(); 399 | } 400 | 401 | @Override 402 | public ColorFilter getColorFilter() { 403 | return mBitmapPaint.getColorFilter(); 404 | } 405 | 406 | @Override 407 | public void setColorFilter(ColorFilter cf) { 408 | mBitmapPaint.setColorFilter(cf); 409 | invalidateSelf(); 410 | } 411 | 412 | @Override 413 | public void setDither(boolean dither) { 414 | mBitmapPaint.setDither(dither); 415 | invalidateSelf(); 416 | } 417 | 418 | @Override 419 | public void setFilterBitmap(boolean filter) { 420 | mBitmapPaint.setFilterBitmap(filter); 421 | invalidateSelf(); 422 | } 423 | 424 | @Override 425 | public int getIntrinsicWidth() { 426 | return mBitmapWidth; 427 | } 428 | 429 | @Override 430 | public int getIntrinsicHeight() { 431 | return mBitmapHeight; 432 | } 433 | 434 | /** 435 | * @return the corner radius. 436 | */ 437 | public float getCornerRadius() { 438 | return mCornerRadius; 439 | } 440 | 441 | /** 442 | * @param corner the specific corner to get radius of. 443 | * @return the corner radius of the specified corner. 444 | */ 445 | public float getCornerRadius(@Corner int corner) { 446 | return mCornersRounded[corner] ? mCornerRadius : 0f; 447 | } 448 | 449 | /** 450 | * Sets all corners to the specified radius. 451 | * 452 | * @param radius the radius. 453 | * @return the {@link RoundedDrawable} for chaining. 454 | */ 455 | public RoundedDrawable setCornerRadius(float radius) { 456 | setCornerRadius(radius, radius, radius, radius); 457 | return this; 458 | } 459 | 460 | /** 461 | * Sets the corner radius of one specific corner. 462 | * 463 | * @param corner the corner. 464 | * @param radius the radius. 465 | * @return the {@link RoundedDrawable} for chaining. 466 | */ 467 | public RoundedDrawable setCornerRadius(@Corner int corner, float radius) { 468 | if (radius != 0 && mCornerRadius != 0 && mCornerRadius != radius) { 469 | throw new IllegalArgumentException("Multiple nonzero corner radii not yet supported."); 470 | } 471 | 472 | if (radius == 0) { 473 | if (only(corner, mCornersRounded)) { 474 | mCornerRadius = 0; 475 | } 476 | mCornersRounded[corner] = false; 477 | } else { 478 | if (mCornerRadius == 0) { 479 | mCornerRadius = radius; 480 | } 481 | mCornersRounded[corner] = true; 482 | } 483 | 484 | return this; 485 | } 486 | 487 | /** 488 | * Sets the corner radii of all the corners. 489 | * 490 | * @param topLeft top left corner radius. 491 | * @param topRight top right corner radius 492 | * @param bottomRight bototm right corner radius. 493 | * @param bottomLeft bottom left corner radius. 494 | * @return the {@link RoundedDrawable} for chaining. 495 | */ 496 | public RoundedDrawable setCornerRadius(float topLeft, float topRight, float bottomRight, 497 | float bottomLeft) { 498 | Set radiusSet = new HashSet<>(4); 499 | radiusSet.add(topLeft); 500 | radiusSet.add(topRight); 501 | radiusSet.add(bottomRight); 502 | radiusSet.add(bottomLeft); 503 | 504 | radiusSet.remove(0f); 505 | 506 | if (radiusSet.size() > 1) { 507 | throw new IllegalArgumentException("Multiple nonzero corner radii not yet supported."); 508 | } 509 | 510 | if (!radiusSet.isEmpty()) { 511 | float radius = radiusSet.iterator().next(); 512 | if (Float.isInfinite(radius) || Float.isNaN(radius) || radius < 0) { 513 | throw new IllegalArgumentException("Invalid radius value: " + radius); 514 | } 515 | mCornerRadius = radius; 516 | } else { 517 | mCornerRadius = 0f; 518 | } 519 | 520 | mCornersRounded[Corner.TOP_LEFT] = topLeft > 0; 521 | mCornersRounded[Corner.TOP_RIGHT] = topRight > 0; 522 | mCornersRounded[Corner.BOTTOM_RIGHT] = bottomRight > 0; 523 | mCornersRounded[Corner.BOTTOM_LEFT] = bottomLeft > 0; 524 | return this; 525 | } 526 | 527 | public float getBorderWidth() { 528 | return mBorderWidth; 529 | } 530 | 531 | public RoundedDrawable setBorderWidth(float width) { 532 | mBorderWidth = width; 533 | mBorderPaint.setStrokeWidth(mBorderWidth); 534 | return this; 535 | } 536 | 537 | public int getBorderColor() { 538 | return mBorderColor.getDefaultColor(); 539 | } 540 | 541 | public RoundedDrawable setBorderColor(@ColorInt int color) { 542 | return setBorderColor(ColorStateList.valueOf(color)); 543 | } 544 | 545 | public ColorStateList getBorderColors() { 546 | return mBorderColor; 547 | } 548 | 549 | public RoundedDrawable setBorderColor(ColorStateList colors) { 550 | mBorderColor = colors != null ? colors : ColorStateList.valueOf(0); 551 | mBorderPaint.setColor(mBorderColor.getColorForState(getState(), DEFAULT_BORDER_COLOR)); 552 | return this; 553 | } 554 | 555 | public boolean isOval() { 556 | return mOval; 557 | } 558 | 559 | public RoundedDrawable setOval(boolean oval) { 560 | mOval = oval; 561 | return this; 562 | } 563 | 564 | public ScaleType getScaleType() { 565 | return mScaleType; 566 | } 567 | 568 | public RoundedDrawable setScaleType(ScaleType scaleType) { 569 | if (scaleType == null) { 570 | scaleType = ScaleType.FIT_CENTER; 571 | } 572 | if (mScaleType != scaleType) { 573 | mScaleType = scaleType; 574 | updateShaderMatrix(); 575 | } 576 | return this; 577 | } 578 | 579 | public Shader.TileMode getTileModeX() { 580 | return mTileModeX; 581 | } 582 | 583 | public RoundedDrawable setTileModeX(Shader.TileMode tileModeX) { 584 | if (mTileModeX != tileModeX) { 585 | mTileModeX = tileModeX; 586 | mRebuildShader = true; 587 | invalidateSelf(); 588 | } 589 | return this; 590 | } 591 | 592 | public Shader.TileMode getTileModeY() { 593 | return mTileModeY; 594 | } 595 | 596 | public RoundedDrawable setTileModeY(Shader.TileMode tileModeY) { 597 | if (mTileModeY != tileModeY) { 598 | mTileModeY = tileModeY; 599 | mRebuildShader = true; 600 | invalidateSelf(); 601 | } 602 | return this; 603 | } 604 | 605 | private static boolean only(int index, boolean[] booleans) { 606 | for (int i = 0, len = booleans.length; i < len; i++) { 607 | if (booleans[i] != (i == index)) { 608 | return false; 609 | } 610 | } 611 | return true; 612 | } 613 | 614 | private static boolean any(boolean[] booleans) { 615 | for (boolean b : booleans) { 616 | if (b) { return true; } 617 | } 618 | return false; 619 | } 620 | 621 | private static boolean all(boolean[] booleans) { 622 | for (boolean b : booleans) { 623 | if (b) { return false; } 624 | } 625 | return true; 626 | } 627 | 628 | public Bitmap toBitmap() { 629 | return drawableToBitmap(this); 630 | } 631 | } 632 | -------------------------------------------------------------------------------- /library/build/generated/source/r/debug/com/itheima/roundedimageview/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package com.itheima.roundedimageview; 9 | 10 | public final class R { 11 | public static final class attr { 12 | /**

Must be a color value, in the form of "#rgb", "#argb", 13 | "#rrggbb", or "#aarrggbb". 14 |

This may also be a reference to a resource (in the form 15 | "@[package:]type:name") or 16 | theme attribute (in the form 17 | "?[package:][type:]name") 18 | containing a value of this type. 19 | */ 20 | public static int riv_border_color=0x7f010006; 21 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 22 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 23 | in (inches), mm (millimeters). 24 |

This may also be a reference to a resource (in the form 25 | "@[package:]type:name") or 26 | theme attribute (in the form 27 | "?[package:][type:]name") 28 | containing a value of this type. 29 | */ 30 | public static int riv_border_width=0x7f010005; 31 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 32 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 33 | in (inches), mm (millimeters). 34 |

This may also be a reference to a resource (in the form 35 | "@[package:]type:name") or 36 | theme attribute (in the form 37 | "?[package:][type:]name") 38 | containing a value of this type. 39 | */ 40 | public static int riv_corner_radius=0x7f010000; 41 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 42 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 43 | in (inches), mm (millimeters). 44 |

This may also be a reference to a resource (in the form 45 | "@[package:]type:name") or 46 | theme attribute (in the form 47 | "?[package:][type:]name") 48 | containing a value of this type. 49 | */ 50 | public static int riv_corner_radius_bottom_left=0x7f010003; 51 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 52 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 53 | in (inches), mm (millimeters). 54 |

This may also be a reference to a resource (in the form 55 | "@[package:]type:name") or 56 | theme attribute (in the form 57 | "?[package:][type:]name") 58 | containing a value of this type. 59 | */ 60 | public static int riv_corner_radius_bottom_right=0x7f010004; 61 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 62 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 63 | in (inches), mm (millimeters). 64 |

This may also be a reference to a resource (in the form 65 | "@[package:]type:name") or 66 | theme attribute (in the form 67 | "?[package:][type:]name") 68 | containing a value of this type. 69 | */ 70 | public static int riv_corner_radius_top_left=0x7f010001; 71 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 72 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 73 | in (inches), mm (millimeters). 74 |

This may also be a reference to a resource (in the form 75 | "@[package:]type:name") or 76 | theme attribute (in the form 77 | "?[package:][type:]name") 78 | containing a value of this type. 79 | */ 80 | public static int riv_corner_radius_top_right=0x7f010002; 81 | /**

Must be a boolean value, either "true" or "false". 82 |

This may also be a reference to a resource (in the form 83 | "@[package:]type:name") or 84 | theme attribute (in the form 85 | "?[package:][type:]name") 86 | containing a value of this type. 87 | */ 88 | public static int riv_mutate_background=0x7f010007; 89 | /**

Must be a boolean value, either "true" or "false". 90 |

This may also be a reference to a resource (in the form 91 | "@[package:]type:name") or 92 | theme attribute (in the form 93 | "?[package:][type:]name") 94 | containing a value of this type. 95 | */ 96 | public static int riv_oval=0x7f010008; 97 | /**

Must be one of the following constant values.

98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 |
ConstantValueDescription
clamp0
repeat1
mirror2
107 | */ 108 | public static int riv_tile_mode=0x7f010009; 109 | /**

Must be one of the following constant values.

110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 |
ConstantValueDescription
clamp0
repeat1
mirror2
119 | */ 120 | public static int riv_tile_mode_x=0x7f01000a; 121 | /**

Must be one of the following constant values.

122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 |
ConstantValueDescription
clamp0
repeat1
mirror2
131 | */ 132 | public static int riv_tile_mode_y=0x7f01000b; 133 | } 134 | public static final class id { 135 | public static int clamp=0x7f030000; 136 | public static int mirror=0x7f030001; 137 | public static int repeat=0x7f030002; 138 | } 139 | public static final class string { 140 | public static int define_roundedimageview=0x7f020000; 141 | public static int library_roundedimageview_author=0x7f020001; 142 | public static int library_roundedimageview_authorWebsite=0x7f020002; 143 | public static int library_roundedimageview_isOpenSource=0x7f020003; 144 | public static int library_roundedimageview_libraryDescription=0x7f020004; 145 | public static int library_roundedimageview_libraryName=0x7f020005; 146 | public static int library_roundedimageview_libraryVersion=0x7f020006; 147 | public static int library_roundedimageview_libraryWebsite=0x7f020007; 148 | public static int library_roundedimageview_licenseId=0x7f020008; 149 | public static int library_roundedimageview_repositoryLink=0x7f020009; 150 | } 151 | public static final class styleable { 152 | /** Attributes that can be used with a RoundedImageView. 153 |

Includes the following attributes:

154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 |
AttributeDescription
{@link #RoundedImageView_android_scaleType android:scaleType}
{@link #RoundedImageView_riv_border_color com.itheima.roundedimageview:riv_border_color}
{@link #RoundedImageView_riv_border_width com.itheima.roundedimageview:riv_border_width}
{@link #RoundedImageView_riv_corner_radius com.itheima.roundedimageview:riv_corner_radius}
{@link #RoundedImageView_riv_corner_radius_bottom_left com.itheima.roundedimageview:riv_corner_radius_bottom_left}
{@link #RoundedImageView_riv_corner_radius_bottom_right com.itheima.roundedimageview:riv_corner_radius_bottom_right}
{@link #RoundedImageView_riv_corner_radius_top_left com.itheima.roundedimageview:riv_corner_radius_top_left}
{@link #RoundedImageView_riv_corner_radius_top_right com.itheima.roundedimageview:riv_corner_radius_top_right}
{@link #RoundedImageView_riv_mutate_background com.itheima.roundedimageview:riv_mutate_background}
{@link #RoundedImageView_riv_oval com.itheima.roundedimageview:riv_oval}
{@link #RoundedImageView_riv_tile_mode com.itheima.roundedimageview:riv_tile_mode}
{@link #RoundedImageView_riv_tile_mode_x com.itheima.roundedimageview:riv_tile_mode_x}
{@link #RoundedImageView_riv_tile_mode_y com.itheima.roundedimageview:riv_tile_mode_y}
172 | @see #RoundedImageView_android_scaleType 173 | @see #RoundedImageView_riv_border_color 174 | @see #RoundedImageView_riv_border_width 175 | @see #RoundedImageView_riv_corner_radius 176 | @see #RoundedImageView_riv_corner_radius_bottom_left 177 | @see #RoundedImageView_riv_corner_radius_bottom_right 178 | @see #RoundedImageView_riv_corner_radius_top_left 179 | @see #RoundedImageView_riv_corner_radius_top_right 180 | @see #RoundedImageView_riv_mutate_background 181 | @see #RoundedImageView_riv_oval 182 | @see #RoundedImageView_riv_tile_mode 183 | @see #RoundedImageView_riv_tile_mode_x 184 | @see #RoundedImageView_riv_tile_mode_y 185 | */ 186 | public static final int[] RoundedImageView = { 187 | 0x0101011d, 0x7f010000, 0x7f010001, 0x7f010002, 188 | 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 189 | 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 190 | 0x7f01000b 191 | }; 192 | /** 193 |

This symbol is the offset where the {@link android.R.attr#scaleType} 194 | attribute's value can be found in the {@link #RoundedImageView} array. 195 | @attr name android:scaleType 196 | */ 197 | public static int RoundedImageView_android_scaleType = 0; 198 | /** 199 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_border_color} 200 | attribute's value can be found in the {@link #RoundedImageView} array. 201 | 202 | 203 |

Must be a color value, in the form of "#rgb", "#argb", 204 | "#rrggbb", or "#aarrggbb". 205 |

This may also be a reference to a resource (in the form 206 | "@[package:]type:name") or 207 | theme attribute (in the form 208 | "?[package:][type:]name") 209 | containing a value of this type. 210 | @attr name com.itheima.roundedimageview:riv_border_color 211 | */ 212 | public static int RoundedImageView_riv_border_color = 7; 213 | /** 214 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_border_width} 215 | attribute's value can be found in the {@link #RoundedImageView} array. 216 | 217 | 218 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 219 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 220 | in (inches), mm (millimeters). 221 |

This may also be a reference to a resource (in the form 222 | "@[package:]type:name") or 223 | theme attribute (in the form 224 | "?[package:][type:]name") 225 | containing a value of this type. 226 | @attr name com.itheima.roundedimageview:riv_border_width 227 | */ 228 | public static int RoundedImageView_riv_border_width = 6; 229 | /** 230 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_corner_radius} 231 | attribute's value can be found in the {@link #RoundedImageView} array. 232 | 233 | 234 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 235 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 236 | in (inches), mm (millimeters). 237 |

This may also be a reference to a resource (in the form 238 | "@[package:]type:name") or 239 | theme attribute (in the form 240 | "?[package:][type:]name") 241 | containing a value of this type. 242 | @attr name com.itheima.roundedimageview:riv_corner_radius 243 | */ 244 | public static int RoundedImageView_riv_corner_radius = 1; 245 | /** 246 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_corner_radius_bottom_left} 247 | attribute's value can be found in the {@link #RoundedImageView} array. 248 | 249 | 250 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 251 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 252 | in (inches), mm (millimeters). 253 |

This may also be a reference to a resource (in the form 254 | "@[package:]type:name") or 255 | theme attribute (in the form 256 | "?[package:][type:]name") 257 | containing a value of this type. 258 | @attr name com.itheima.roundedimageview:riv_corner_radius_bottom_left 259 | */ 260 | public static int RoundedImageView_riv_corner_radius_bottom_left = 4; 261 | /** 262 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_corner_radius_bottom_right} 263 | attribute's value can be found in the {@link #RoundedImageView} array. 264 | 265 | 266 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 267 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 268 | in (inches), mm (millimeters). 269 |

This may also be a reference to a resource (in the form 270 | "@[package:]type:name") or 271 | theme attribute (in the form 272 | "?[package:][type:]name") 273 | containing a value of this type. 274 | @attr name com.itheima.roundedimageview:riv_corner_radius_bottom_right 275 | */ 276 | public static int RoundedImageView_riv_corner_radius_bottom_right = 5; 277 | /** 278 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_corner_radius_top_left} 279 | attribute's value can be found in the {@link #RoundedImageView} array. 280 | 281 | 282 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 283 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 284 | in (inches), mm (millimeters). 285 |

This may also be a reference to a resource (in the form 286 | "@[package:]type:name") or 287 | theme attribute (in the form 288 | "?[package:][type:]name") 289 | containing a value of this type. 290 | @attr name com.itheima.roundedimageview:riv_corner_radius_top_left 291 | */ 292 | public static int RoundedImageView_riv_corner_radius_top_left = 2; 293 | /** 294 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_corner_radius_top_right} 295 | attribute's value can be found in the {@link #RoundedImageView} array. 296 | 297 | 298 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 299 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 300 | in (inches), mm (millimeters). 301 |

This may also be a reference to a resource (in the form 302 | "@[package:]type:name") or 303 | theme attribute (in the form 304 | "?[package:][type:]name") 305 | containing a value of this type. 306 | @attr name com.itheima.roundedimageview:riv_corner_radius_top_right 307 | */ 308 | public static int RoundedImageView_riv_corner_radius_top_right = 3; 309 | /** 310 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_mutate_background} 311 | attribute's value can be found in the {@link #RoundedImageView} array. 312 | 313 | 314 |

Must be a boolean value, either "true" or "false". 315 |

This may also be a reference to a resource (in the form 316 | "@[package:]type:name") or 317 | theme attribute (in the form 318 | "?[package:][type:]name") 319 | containing a value of this type. 320 | @attr name com.itheima.roundedimageview:riv_mutate_background 321 | */ 322 | public static int RoundedImageView_riv_mutate_background = 8; 323 | /** 324 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_oval} 325 | attribute's value can be found in the {@link #RoundedImageView} array. 326 | 327 | 328 |

Must be a boolean value, either "true" or "false". 329 |

This may also be a reference to a resource (in the form 330 | "@[package:]type:name") or 331 | theme attribute (in the form 332 | "?[package:][type:]name") 333 | containing a value of this type. 334 | @attr name com.itheima.roundedimageview:riv_oval 335 | */ 336 | public static int RoundedImageView_riv_oval = 9; 337 | /** 338 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_tile_mode} 339 | attribute's value can be found in the {@link #RoundedImageView} array. 340 | 341 | 342 |

Must be one of the following constant values.

343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 |
ConstantValueDescription
clamp0
repeat1
mirror2
352 | @attr name com.itheima.roundedimageview:riv_tile_mode 353 | */ 354 | public static int RoundedImageView_riv_tile_mode = 10; 355 | /** 356 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_tile_mode_x} 357 | attribute's value can be found in the {@link #RoundedImageView} array. 358 | 359 | 360 |

Must be one of the following constant values.

361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 |
ConstantValueDescription
clamp0
repeat1
mirror2
370 | @attr name com.itheima.roundedimageview:riv_tile_mode_x 371 | */ 372 | public static int RoundedImageView_riv_tile_mode_x = 11; 373 | /** 374 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_tile_mode_y} 375 | attribute's value can be found in the {@link #RoundedImageView} array. 376 | 377 | 378 |

Must be one of the following constant values.

379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 |
ConstantValueDescription
clamp0
repeat1
mirror2
388 | @attr name com.itheima.roundedimageview:riv_tile_mode_y 389 | */ 390 | public static int RoundedImageView_riv_tile_mode_y = 12; 391 | }; 392 | } 393 | -------------------------------------------------------------------------------- /library/build/generated/source/r/release/com/itheima/roundedimageview/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package com.itheima.roundedimageview; 9 | 10 | public final class R { 11 | public static final class attr { 12 | /**

Must be a color value, in the form of "#rgb", "#argb", 13 | "#rrggbb", or "#aarrggbb". 14 |

This may also be a reference to a resource (in the form 15 | "@[package:]type:name") or 16 | theme attribute (in the form 17 | "?[package:][type:]name") 18 | containing a value of this type. 19 | */ 20 | public static int riv_border_color=0x7f010006; 21 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 22 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 23 | in (inches), mm (millimeters). 24 |

This may also be a reference to a resource (in the form 25 | "@[package:]type:name") or 26 | theme attribute (in the form 27 | "?[package:][type:]name") 28 | containing a value of this type. 29 | */ 30 | public static int riv_border_width=0x7f010005; 31 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 32 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 33 | in (inches), mm (millimeters). 34 |

This may also be a reference to a resource (in the form 35 | "@[package:]type:name") or 36 | theme attribute (in the form 37 | "?[package:][type:]name") 38 | containing a value of this type. 39 | */ 40 | public static int riv_corner_radius=0x7f010000; 41 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 42 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 43 | in (inches), mm (millimeters). 44 |

This may also be a reference to a resource (in the form 45 | "@[package:]type:name") or 46 | theme attribute (in the form 47 | "?[package:][type:]name") 48 | containing a value of this type. 49 | */ 50 | public static int riv_corner_radius_bottom_left=0x7f010003; 51 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 52 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 53 | in (inches), mm (millimeters). 54 |

This may also be a reference to a resource (in the form 55 | "@[package:]type:name") or 56 | theme attribute (in the form 57 | "?[package:][type:]name") 58 | containing a value of this type. 59 | */ 60 | public static int riv_corner_radius_bottom_right=0x7f010004; 61 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 62 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 63 | in (inches), mm (millimeters). 64 |

This may also be a reference to a resource (in the form 65 | "@[package:]type:name") or 66 | theme attribute (in the form 67 | "?[package:][type:]name") 68 | containing a value of this type. 69 | */ 70 | public static int riv_corner_radius_top_left=0x7f010001; 71 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 72 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 73 | in (inches), mm (millimeters). 74 |

This may also be a reference to a resource (in the form 75 | "@[package:]type:name") or 76 | theme attribute (in the form 77 | "?[package:][type:]name") 78 | containing a value of this type. 79 | */ 80 | public static int riv_corner_radius_top_right=0x7f010002; 81 | /**

Must be a boolean value, either "true" or "false". 82 |

This may also be a reference to a resource (in the form 83 | "@[package:]type:name") or 84 | theme attribute (in the form 85 | "?[package:][type:]name") 86 | containing a value of this type. 87 | */ 88 | public static int riv_mutate_background=0x7f010007; 89 | /**

Must be a boolean value, either "true" or "false". 90 |

This may also be a reference to a resource (in the form 91 | "@[package:]type:name") or 92 | theme attribute (in the form 93 | "?[package:][type:]name") 94 | containing a value of this type. 95 | */ 96 | public static int riv_oval=0x7f010008; 97 | /**

Must be one of the following constant values.

98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 |
ConstantValueDescription
clamp0
repeat1
mirror2
107 | */ 108 | public static int riv_tile_mode=0x7f010009; 109 | /**

Must be one of the following constant values.

110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 |
ConstantValueDescription
clamp0
repeat1
mirror2
119 | */ 120 | public static int riv_tile_mode_x=0x7f01000a; 121 | /**

Must be one of the following constant values.

122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 |
ConstantValueDescription
clamp0
repeat1
mirror2
131 | */ 132 | public static int riv_tile_mode_y=0x7f01000b; 133 | } 134 | public static final class id { 135 | public static int clamp=0x7f030000; 136 | public static int mirror=0x7f030001; 137 | public static int repeat=0x7f030002; 138 | } 139 | public static final class string { 140 | public static int define_roundedimageview=0x7f020000; 141 | public static int library_roundedimageview_author=0x7f020001; 142 | public static int library_roundedimageview_authorWebsite=0x7f020002; 143 | public static int library_roundedimageview_isOpenSource=0x7f020003; 144 | public static int library_roundedimageview_libraryDescription=0x7f020004; 145 | public static int library_roundedimageview_libraryName=0x7f020005; 146 | public static int library_roundedimageview_libraryVersion=0x7f020006; 147 | public static int library_roundedimageview_libraryWebsite=0x7f020007; 148 | public static int library_roundedimageview_licenseId=0x7f020008; 149 | public static int library_roundedimageview_repositoryLink=0x7f020009; 150 | } 151 | public static final class styleable { 152 | /** Attributes that can be used with a RoundedImageView. 153 |

Includes the following attributes:

154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 |
AttributeDescription
{@link #RoundedImageView_android_scaleType android:scaleType}
{@link #RoundedImageView_riv_border_color com.itheima.roundedimageview:riv_border_color}
{@link #RoundedImageView_riv_border_width com.itheima.roundedimageview:riv_border_width}
{@link #RoundedImageView_riv_corner_radius com.itheima.roundedimageview:riv_corner_radius}
{@link #RoundedImageView_riv_corner_radius_bottom_left com.itheima.roundedimageview:riv_corner_radius_bottom_left}
{@link #RoundedImageView_riv_corner_radius_bottom_right com.itheima.roundedimageview:riv_corner_radius_bottom_right}
{@link #RoundedImageView_riv_corner_radius_top_left com.itheima.roundedimageview:riv_corner_radius_top_left}
{@link #RoundedImageView_riv_corner_radius_top_right com.itheima.roundedimageview:riv_corner_radius_top_right}
{@link #RoundedImageView_riv_mutate_background com.itheima.roundedimageview:riv_mutate_background}
{@link #RoundedImageView_riv_oval com.itheima.roundedimageview:riv_oval}
{@link #RoundedImageView_riv_tile_mode com.itheima.roundedimageview:riv_tile_mode}
{@link #RoundedImageView_riv_tile_mode_x com.itheima.roundedimageview:riv_tile_mode_x}
{@link #RoundedImageView_riv_tile_mode_y com.itheima.roundedimageview:riv_tile_mode_y}
172 | @see #RoundedImageView_android_scaleType 173 | @see #RoundedImageView_riv_border_color 174 | @see #RoundedImageView_riv_border_width 175 | @see #RoundedImageView_riv_corner_radius 176 | @see #RoundedImageView_riv_corner_radius_bottom_left 177 | @see #RoundedImageView_riv_corner_radius_bottom_right 178 | @see #RoundedImageView_riv_corner_radius_top_left 179 | @see #RoundedImageView_riv_corner_radius_top_right 180 | @see #RoundedImageView_riv_mutate_background 181 | @see #RoundedImageView_riv_oval 182 | @see #RoundedImageView_riv_tile_mode 183 | @see #RoundedImageView_riv_tile_mode_x 184 | @see #RoundedImageView_riv_tile_mode_y 185 | */ 186 | public static final int[] RoundedImageView = { 187 | 0x0101011d, 0x7f010000, 0x7f010001, 0x7f010002, 188 | 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 189 | 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 190 | 0x7f01000b 191 | }; 192 | /** 193 |

This symbol is the offset where the {@link android.R.attr#scaleType} 194 | attribute's value can be found in the {@link #RoundedImageView} array. 195 | @attr name android:scaleType 196 | */ 197 | public static int RoundedImageView_android_scaleType = 0; 198 | /** 199 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_border_color} 200 | attribute's value can be found in the {@link #RoundedImageView} array. 201 | 202 | 203 |

Must be a color value, in the form of "#rgb", "#argb", 204 | "#rrggbb", or "#aarrggbb". 205 |

This may also be a reference to a resource (in the form 206 | "@[package:]type:name") or 207 | theme attribute (in the form 208 | "?[package:][type:]name") 209 | containing a value of this type. 210 | @attr name com.itheima.roundedimageview:riv_border_color 211 | */ 212 | public static int RoundedImageView_riv_border_color = 7; 213 | /** 214 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_border_width} 215 | attribute's value can be found in the {@link #RoundedImageView} array. 216 | 217 | 218 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 219 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 220 | in (inches), mm (millimeters). 221 |

This may also be a reference to a resource (in the form 222 | "@[package:]type:name") or 223 | theme attribute (in the form 224 | "?[package:][type:]name") 225 | containing a value of this type. 226 | @attr name com.itheima.roundedimageview:riv_border_width 227 | */ 228 | public static int RoundedImageView_riv_border_width = 6; 229 | /** 230 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_corner_radius} 231 | attribute's value can be found in the {@link #RoundedImageView} array. 232 | 233 | 234 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 235 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 236 | in (inches), mm (millimeters). 237 |

This may also be a reference to a resource (in the form 238 | "@[package:]type:name") or 239 | theme attribute (in the form 240 | "?[package:][type:]name") 241 | containing a value of this type. 242 | @attr name com.itheima.roundedimageview:riv_corner_radius 243 | */ 244 | public static int RoundedImageView_riv_corner_radius = 1; 245 | /** 246 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_corner_radius_bottom_left} 247 | attribute's value can be found in the {@link #RoundedImageView} array. 248 | 249 | 250 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 251 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 252 | in (inches), mm (millimeters). 253 |

This may also be a reference to a resource (in the form 254 | "@[package:]type:name") or 255 | theme attribute (in the form 256 | "?[package:][type:]name") 257 | containing a value of this type. 258 | @attr name com.itheima.roundedimageview:riv_corner_radius_bottom_left 259 | */ 260 | public static int RoundedImageView_riv_corner_radius_bottom_left = 4; 261 | /** 262 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_corner_radius_bottom_right} 263 | attribute's value can be found in the {@link #RoundedImageView} array. 264 | 265 | 266 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 267 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 268 | in (inches), mm (millimeters). 269 |

This may also be a reference to a resource (in the form 270 | "@[package:]type:name") or 271 | theme attribute (in the form 272 | "?[package:][type:]name") 273 | containing a value of this type. 274 | @attr name com.itheima.roundedimageview:riv_corner_radius_bottom_right 275 | */ 276 | public static int RoundedImageView_riv_corner_radius_bottom_right = 5; 277 | /** 278 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_corner_radius_top_left} 279 | attribute's value can be found in the {@link #RoundedImageView} array. 280 | 281 | 282 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 283 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 284 | in (inches), mm (millimeters). 285 |

This may also be a reference to a resource (in the form 286 | "@[package:]type:name") or 287 | theme attribute (in the form 288 | "?[package:][type:]name") 289 | containing a value of this type. 290 | @attr name com.itheima.roundedimageview:riv_corner_radius_top_left 291 | */ 292 | public static int RoundedImageView_riv_corner_radius_top_left = 2; 293 | /** 294 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_corner_radius_top_right} 295 | attribute's value can be found in the {@link #RoundedImageView} array. 296 | 297 | 298 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 299 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 300 | in (inches), mm (millimeters). 301 |

This may also be a reference to a resource (in the form 302 | "@[package:]type:name") or 303 | theme attribute (in the form 304 | "?[package:][type:]name") 305 | containing a value of this type. 306 | @attr name com.itheima.roundedimageview:riv_corner_radius_top_right 307 | */ 308 | public static int RoundedImageView_riv_corner_radius_top_right = 3; 309 | /** 310 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_mutate_background} 311 | attribute's value can be found in the {@link #RoundedImageView} array. 312 | 313 | 314 |

Must be a boolean value, either "true" or "false". 315 |

This may also be a reference to a resource (in the form 316 | "@[package:]type:name") or 317 | theme attribute (in the form 318 | "?[package:][type:]name") 319 | containing a value of this type. 320 | @attr name com.itheima.roundedimageview:riv_mutate_background 321 | */ 322 | public static int RoundedImageView_riv_mutate_background = 8; 323 | /** 324 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_oval} 325 | attribute's value can be found in the {@link #RoundedImageView} array. 326 | 327 | 328 |

Must be a boolean value, either "true" or "false". 329 |

This may also be a reference to a resource (in the form 330 | "@[package:]type:name") or 331 | theme attribute (in the form 332 | "?[package:][type:]name") 333 | containing a value of this type. 334 | @attr name com.itheima.roundedimageview:riv_oval 335 | */ 336 | public static int RoundedImageView_riv_oval = 9; 337 | /** 338 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_tile_mode} 339 | attribute's value can be found in the {@link #RoundedImageView} array. 340 | 341 | 342 |

Must be one of the following constant values.

343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 |
ConstantValueDescription
clamp0
repeat1
mirror2
352 | @attr name com.itheima.roundedimageview:riv_tile_mode 353 | */ 354 | public static int RoundedImageView_riv_tile_mode = 10; 355 | /** 356 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_tile_mode_x} 357 | attribute's value can be found in the {@link #RoundedImageView} array. 358 | 359 | 360 |

Must be one of the following constant values.

361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 |
ConstantValueDescription
clamp0
repeat1
mirror2
370 | @attr name com.itheima.roundedimageview:riv_tile_mode_x 371 | */ 372 | public static int RoundedImageView_riv_tile_mode_x = 11; 373 | /** 374 |

This symbol is the offset where the {@link com.itheima.roundedimageview.R.attr#riv_tile_mode_y} 375 | attribute's value can be found in the {@link #RoundedImageView} array. 376 | 377 | 378 |

Must be one of the following constant values.

379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 |
ConstantValueDescription
clamp0
repeat1
mirror2
388 | @attr name com.itheima.roundedimageview:riv_tile_mode_y 389 | */ 390 | public static int RoundedImageView_riv_tile_mode_y = 12; 391 | }; 392 | } 393 | -------------------------------------------------------------------------------- /library/build/generated/source/r/androidTest/debug/com/itheima/roundedimageview/test/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package com.itheima.roundedimageview.test; 9 | 10 | public final class R { 11 | public static final class attr { 12 | /**

Must be a color value, in the form of "#rgb", "#argb", 13 | "#rrggbb", or "#aarrggbb". 14 |

This may also be a reference to a resource (in the form 15 | "@[package:]type:name") or 16 | theme attribute (in the form 17 | "?[package:][type:]name") 18 | containing a value of this type. 19 | */ 20 | public static final int riv_border_color=0x7f010006; 21 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 22 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 23 | in (inches), mm (millimeters). 24 |

This may also be a reference to a resource (in the form 25 | "@[package:]type:name") or 26 | theme attribute (in the form 27 | "?[package:][type:]name") 28 | containing a value of this type. 29 | */ 30 | public static final int riv_border_width=0x7f010005; 31 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 32 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 33 | in (inches), mm (millimeters). 34 |

This may also be a reference to a resource (in the form 35 | "@[package:]type:name") or 36 | theme attribute (in the form 37 | "?[package:][type:]name") 38 | containing a value of this type. 39 | */ 40 | public static final int riv_corner_radius=0x7f010000; 41 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 42 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 43 | in (inches), mm (millimeters). 44 |

This may also be a reference to a resource (in the form 45 | "@[package:]type:name") or 46 | theme attribute (in the form 47 | "?[package:][type:]name") 48 | containing a value of this type. 49 | */ 50 | public static final int riv_corner_radius_bottom_left=0x7f010003; 51 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 52 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 53 | in (inches), mm (millimeters). 54 |

This may also be a reference to a resource (in the form 55 | "@[package:]type:name") or 56 | theme attribute (in the form 57 | "?[package:][type:]name") 58 | containing a value of this type. 59 | */ 60 | public static final int riv_corner_radius_bottom_right=0x7f010004; 61 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 62 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 63 | in (inches), mm (millimeters). 64 |

This may also be a reference to a resource (in the form 65 | "@[package:]type:name") or 66 | theme attribute (in the form 67 | "?[package:][type:]name") 68 | containing a value of this type. 69 | */ 70 | public static final int riv_corner_radius_top_left=0x7f010001; 71 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 72 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 73 | in (inches), mm (millimeters). 74 |

This may also be a reference to a resource (in the form 75 | "@[package:]type:name") or 76 | theme attribute (in the form 77 | "?[package:][type:]name") 78 | containing a value of this type. 79 | */ 80 | public static final int riv_corner_radius_top_right=0x7f010002; 81 | /**

Must be a boolean value, either "true" or "false". 82 |

This may also be a reference to a resource (in the form 83 | "@[package:]type:name") or 84 | theme attribute (in the form 85 | "?[package:][type:]name") 86 | containing a value of this type. 87 | */ 88 | public static final int riv_mutate_background=0x7f010007; 89 | /**

Must be a boolean value, either "true" or "false". 90 |

This may also be a reference to a resource (in the form 91 | "@[package:]type:name") or 92 | theme attribute (in the form 93 | "?[package:][type:]name") 94 | containing a value of this type. 95 | */ 96 | public static final int riv_oval=0x7f010008; 97 | /**

Must be one of the following constant values.

98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 |
ConstantValueDescription
clamp0
repeat1
mirror2
107 | */ 108 | public static final int riv_tile_mode=0x7f010009; 109 | /**

Must be one of the following constant values.

110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 |
ConstantValueDescription
clamp0
repeat1
mirror2
119 | */ 120 | public static final int riv_tile_mode_x=0x7f01000a; 121 | /**

Must be one of the following constant values.

122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 |
ConstantValueDescription
clamp0
repeat1
mirror2
131 | */ 132 | public static final int riv_tile_mode_y=0x7f01000b; 133 | } 134 | public static final class id { 135 | public static final int clamp=0x7f030000; 136 | public static final int mirror=0x7f030001; 137 | public static final int repeat=0x7f030002; 138 | } 139 | public static final class string { 140 | public static final int define_roundedimageview=0x7f020000; 141 | public static final int library_roundedimageview_author=0x7f020001; 142 | public static final int library_roundedimageview_authorWebsite=0x7f020002; 143 | public static final int library_roundedimageview_isOpenSource=0x7f020003; 144 | public static final int library_roundedimageview_libraryDescription=0x7f020004; 145 | public static final int library_roundedimageview_libraryName=0x7f020005; 146 | public static final int library_roundedimageview_libraryVersion=0x7f020006; 147 | public static final int library_roundedimageview_libraryWebsite=0x7f020007; 148 | public static final int library_roundedimageview_licenseId=0x7f020008; 149 | public static final int library_roundedimageview_repositoryLink=0x7f020009; 150 | } 151 | public static final class styleable { 152 | /** Attributes that can be used with a RoundedImageView. 153 |

Includes the following attributes:

154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 |
AttributeDescription
{@link #RoundedImageView_android_scaleType android:scaleType}
{@link #RoundedImageView_riv_border_color com.itheima.roundedimageview.test:riv_border_color}
{@link #RoundedImageView_riv_border_width com.itheima.roundedimageview.test:riv_border_width}
{@link #RoundedImageView_riv_corner_radius com.itheima.roundedimageview.test:riv_corner_radius}
{@link #RoundedImageView_riv_corner_radius_bottom_left com.itheima.roundedimageview.test:riv_corner_radius_bottom_left}
{@link #RoundedImageView_riv_corner_radius_bottom_right com.itheima.roundedimageview.test:riv_corner_radius_bottom_right}
{@link #RoundedImageView_riv_corner_radius_top_left com.itheima.roundedimageview.test:riv_corner_radius_top_left}
{@link #RoundedImageView_riv_corner_radius_top_right com.itheima.roundedimageview.test:riv_corner_radius_top_right}
{@link #RoundedImageView_riv_mutate_background com.itheima.roundedimageview.test:riv_mutate_background}
{@link #RoundedImageView_riv_oval com.itheima.roundedimageview.test:riv_oval}
{@link #RoundedImageView_riv_tile_mode com.itheima.roundedimageview.test:riv_tile_mode}
{@link #RoundedImageView_riv_tile_mode_x com.itheima.roundedimageview.test:riv_tile_mode_x}
{@link #RoundedImageView_riv_tile_mode_y com.itheima.roundedimageview.test:riv_tile_mode_y}
172 | @see #RoundedImageView_android_scaleType 173 | @see #RoundedImageView_riv_border_color 174 | @see #RoundedImageView_riv_border_width 175 | @see #RoundedImageView_riv_corner_radius 176 | @see #RoundedImageView_riv_corner_radius_bottom_left 177 | @see #RoundedImageView_riv_corner_radius_bottom_right 178 | @see #RoundedImageView_riv_corner_radius_top_left 179 | @see #RoundedImageView_riv_corner_radius_top_right 180 | @see #RoundedImageView_riv_mutate_background 181 | @see #RoundedImageView_riv_oval 182 | @see #RoundedImageView_riv_tile_mode 183 | @see #RoundedImageView_riv_tile_mode_x 184 | @see #RoundedImageView_riv_tile_mode_y 185 | */ 186 | public static final int[] RoundedImageView = { 187 | 0x0101011d, 0x7f010000, 0x7f010001, 0x7f010002, 188 | 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 189 | 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 190 | 0x7f01000b 191 | }; 192 | /** 193 |

This symbol is the offset where the {@link android.R.attr#scaleType} 194 | attribute's value can be found in the {@link #RoundedImageView} array. 195 | @attr name android:scaleType 196 | */ 197 | public static final int RoundedImageView_android_scaleType = 0; 198 | /** 199 |

This symbol is the offset where the {@link com.itheima.roundedimageview.test.R.attr#riv_border_color} 200 | attribute's value can be found in the {@link #RoundedImageView} array. 201 | 202 | 203 |

Must be a color value, in the form of "#rgb", "#argb", 204 | "#rrggbb", or "#aarrggbb". 205 |

This may also be a reference to a resource (in the form 206 | "@[package:]type:name") or 207 | theme attribute (in the form 208 | "?[package:][type:]name") 209 | containing a value of this type. 210 | @attr name com.itheima.roundedimageview.test:riv_border_color 211 | */ 212 | public static final int RoundedImageView_riv_border_color = 7; 213 | /** 214 |

This symbol is the offset where the {@link com.itheima.roundedimageview.test.R.attr#riv_border_width} 215 | attribute's value can be found in the {@link #RoundedImageView} array. 216 | 217 | 218 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 219 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 220 | in (inches), mm (millimeters). 221 |

This may also be a reference to a resource (in the form 222 | "@[package:]type:name") or 223 | theme attribute (in the form 224 | "?[package:][type:]name") 225 | containing a value of this type. 226 | @attr name com.itheima.roundedimageview.test:riv_border_width 227 | */ 228 | public static final int RoundedImageView_riv_border_width = 6; 229 | /** 230 |

This symbol is the offset where the {@link com.itheima.roundedimageview.test.R.attr#riv_corner_radius} 231 | attribute's value can be found in the {@link #RoundedImageView} array. 232 | 233 | 234 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 235 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 236 | in (inches), mm (millimeters). 237 |

This may also be a reference to a resource (in the form 238 | "@[package:]type:name") or 239 | theme attribute (in the form 240 | "?[package:][type:]name") 241 | containing a value of this type. 242 | @attr name com.itheima.roundedimageview.test:riv_corner_radius 243 | */ 244 | public static final int RoundedImageView_riv_corner_radius = 1; 245 | /** 246 |

This symbol is the offset where the {@link com.itheima.roundedimageview.test.R.attr#riv_corner_radius_bottom_left} 247 | attribute's value can be found in the {@link #RoundedImageView} array. 248 | 249 | 250 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 251 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 252 | in (inches), mm (millimeters). 253 |

This may also be a reference to a resource (in the form 254 | "@[package:]type:name") or 255 | theme attribute (in the form 256 | "?[package:][type:]name") 257 | containing a value of this type. 258 | @attr name com.itheima.roundedimageview.test:riv_corner_radius_bottom_left 259 | */ 260 | public static final int RoundedImageView_riv_corner_radius_bottom_left = 4; 261 | /** 262 |

This symbol is the offset where the {@link com.itheima.roundedimageview.test.R.attr#riv_corner_radius_bottom_right} 263 | attribute's value can be found in the {@link #RoundedImageView} array. 264 | 265 | 266 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 267 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 268 | in (inches), mm (millimeters). 269 |

This may also be a reference to a resource (in the form 270 | "@[package:]type:name") or 271 | theme attribute (in the form 272 | "?[package:][type:]name") 273 | containing a value of this type. 274 | @attr name com.itheima.roundedimageview.test:riv_corner_radius_bottom_right 275 | */ 276 | public static final int RoundedImageView_riv_corner_radius_bottom_right = 5; 277 | /** 278 |

This symbol is the offset where the {@link com.itheima.roundedimageview.test.R.attr#riv_corner_radius_top_left} 279 | attribute's value can be found in the {@link #RoundedImageView} array. 280 | 281 | 282 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 283 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 284 | in (inches), mm (millimeters). 285 |

This may also be a reference to a resource (in the form 286 | "@[package:]type:name") or 287 | theme attribute (in the form 288 | "?[package:][type:]name") 289 | containing a value of this type. 290 | @attr name com.itheima.roundedimageview.test:riv_corner_radius_top_left 291 | */ 292 | public static final int RoundedImageView_riv_corner_radius_top_left = 2; 293 | /** 294 |

This symbol is the offset where the {@link com.itheima.roundedimageview.test.R.attr#riv_corner_radius_top_right} 295 | attribute's value can be found in the {@link #RoundedImageView} array. 296 | 297 | 298 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 299 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 300 | in (inches), mm (millimeters). 301 |

This may also be a reference to a resource (in the form 302 | "@[package:]type:name") or 303 | theme attribute (in the form 304 | "?[package:][type:]name") 305 | containing a value of this type. 306 | @attr name com.itheima.roundedimageview.test:riv_corner_radius_top_right 307 | */ 308 | public static final int RoundedImageView_riv_corner_radius_top_right = 3; 309 | /** 310 |

This symbol is the offset where the {@link com.itheima.roundedimageview.test.R.attr#riv_mutate_background} 311 | attribute's value can be found in the {@link #RoundedImageView} array. 312 | 313 | 314 |

Must be a boolean value, either "true" or "false". 315 |

This may also be a reference to a resource (in the form 316 | "@[package:]type:name") or 317 | theme attribute (in the form 318 | "?[package:][type:]name") 319 | containing a value of this type. 320 | @attr name com.itheima.roundedimageview.test:riv_mutate_background 321 | */ 322 | public static final int RoundedImageView_riv_mutate_background = 8; 323 | /** 324 |

This symbol is the offset where the {@link com.itheima.roundedimageview.test.R.attr#riv_oval} 325 | attribute's value can be found in the {@link #RoundedImageView} array. 326 | 327 | 328 |

Must be a boolean value, either "true" or "false". 329 |

This may also be a reference to a resource (in the form 330 | "@[package:]type:name") or 331 | theme attribute (in the form 332 | "?[package:][type:]name") 333 | containing a value of this type. 334 | @attr name com.itheima.roundedimageview.test:riv_oval 335 | */ 336 | public static final int RoundedImageView_riv_oval = 9; 337 | /** 338 |

This symbol is the offset where the {@link com.itheima.roundedimageview.test.R.attr#riv_tile_mode} 339 | attribute's value can be found in the {@link #RoundedImageView} array. 340 | 341 | 342 |

Must be one of the following constant values.

343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 |
ConstantValueDescription
clamp0
repeat1
mirror2
352 | @attr name com.itheima.roundedimageview.test:riv_tile_mode 353 | */ 354 | public static final int RoundedImageView_riv_tile_mode = 10; 355 | /** 356 |

This symbol is the offset where the {@link com.itheima.roundedimageview.test.R.attr#riv_tile_mode_x} 357 | attribute's value can be found in the {@link #RoundedImageView} array. 358 | 359 | 360 |

Must be one of the following constant values.

361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 |
ConstantValueDescription
clamp0
repeat1
mirror2
370 | @attr name com.itheima.roundedimageview.test:riv_tile_mode_x 371 | */ 372 | public static final int RoundedImageView_riv_tile_mode_x = 11; 373 | /** 374 |

This symbol is the offset where the {@link com.itheima.roundedimageview.test.R.attr#riv_tile_mode_y} 375 | attribute's value can be found in the {@link #RoundedImageView} array. 376 | 377 | 378 |

Must be one of the following constant values.

379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 |
ConstantValueDescription
clamp0
repeat1
mirror2
388 | @attr name com.itheima.roundedimageview.test:riv_tile_mode_y 389 | */ 390 | public static final int RoundedImageView_riv_tile_mode_y = 12; 391 | }; 392 | } 393 | --------------------------------------------------------------------------------