= Transformations.map(_index) {
29 | "Hello world from section: $it"
30 | }
31 |
32 | fun setIndex(index: Int) {
33 | _index.value = index
34 | }
35 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/william/roundimage/ui/main/SectionsPagerAdapter.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright WeiLianYang
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.william.roundimage.ui.main
18 |
19 | import android.content.Context
20 | import androidx.fragment.app.Fragment
21 | import androidx.fragment.app.FragmentManager
22 | import androidx.fragment.app.FragmentPagerAdapter
23 | import com.william.roundimage.R
24 |
25 | private val TAB_TITLES = arrayOf(
26 | R.string.tab_text_1,
27 | R.string.tab_text_2,
28 | R.string.tab_text_3
29 | )
30 |
31 | /**
32 | * A [FragmentPagerAdapter] that returns a fragment corresponding to
33 | * one of the sections/tabs/pages.
34 | */
35 | class SectionsPagerAdapter(private val context: Context, fm: FragmentManager) :
36 | FragmentPagerAdapter(fm) {
37 |
38 | override fun getItem(position: Int): Fragment {
39 | // getItem is called to instantiate the fragment for the given page.
40 | // Return a PlaceholderFragment (defined as a static inner class below).
41 | return when (position) {
42 | 0 -> Fragment1.newInstance(1)
43 | 1 -> Fragment2.newInstance(1)
44 | 2 -> Fragment3.newInstance(1)
45 | else -> Fragment()
46 | }
47 |
48 | }
49 |
50 | override fun getPageTitle(position: Int): CharSequence {
51 | return context.resources.getString(TAB_TITLES[position])
52 | }
53 |
54 | override fun getCount(): Int {
55 | return 3
56 | }
57 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
23 |
24 |
25 |
31 |
34 |
37 |
38 |
39 |
40 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/test1.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeiLianYang/RoundImageView/0349d6cdcd1a99aa59364798a8f9ef258c485e70/app/src/main/res/drawable-xxhdpi/test1.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/test2.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeiLianYang/RoundImageView/0349d6cdcd1a99aa59364798a8f9ef258c485e70/app/src/main/res/drawable-xxhdpi/test2.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
23 |
26 |
31 |
36 |
41 |
46 |
51 |
56 |
61 |
66 |
71 |
76 |
81 |
86 |
91 |
96 |
101 |
106 |
111 |
116 |
121 |
126 |
131 |
136 |
141 |
146 |
151 |
156 |
161 |
166 |
171 |
176 |
181 |
186 |
187 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
24 |
25 |
29 |
30 |
39 |
40 |
44 |
45 |
46 |
51 |
52 |
60 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
19 |
23 |
24 |
27 |
28 |
34 |
35 |
44 |
45 |
56 |
57 |
68 |
69 |
80 |
81 |
91 |
92 |
104 |
105 |
106 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
19 |
23 |
24 |
27 |
28 |
34 |
35 |
47 |
48 |
61 |
62 |
75 |
76 |
89 |
90 |
102 |
103 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
19 |
23 |
24 |
27 |
28 |
34 |
35 |
44 |
45 |
54 |
55 |
65 |
66 |
75 |
76 |
85 |
86 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeiLianYang/RoundImageView/0349d6cdcd1a99aa59364798a8f9ef258c485e70/app/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeiLianYang/RoundImageView/0349d6cdcd1a99aa59364798a8f9ef258c485e70/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeiLianYang/RoundImageView/0349d6cdcd1a99aa59364798a8f9ef258c485e70/app/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeiLianYang/RoundImageView/0349d6cdcd1a99aa59364798a8f9ef258c485e70/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeiLianYang/RoundImageView/0349d6cdcd1a99aa59364798a8f9ef258c485e70/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeiLianYang/RoundImageView/0349d6cdcd1a99aa59364798a8f9ef258c485e70/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeiLianYang/RoundImageView/0349d6cdcd1a99aa59364798a8f9ef258c485e70/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeiLianYang/RoundImageView/0349d6cdcd1a99aa59364798a8f9ef258c485e70/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeiLianYang/RoundImageView/0349d6cdcd1a99aa59364798a8f9ef258c485e70/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeiLianYang/RoundImageView/0349d6cdcd1a99aa59364798a8f9ef258c485e70/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/values-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | 48dp
19 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w1240dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | 200dp
19 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w600dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | 48dp
19 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
21 | 64dp
22 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 | #FFBB86FC
20 | #FF6200EE
21 | #FF3700B3
22 | #FF03DAC5
23 | #FF018786
24 | #FF000000
25 | #FFFFFFFF
26 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | 16dp
20 | 16dp
21 | 16dp
22 | 16dp
23 | 8dp
24 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | RoundImageView
19 | Tab 1
20 | Tab 2
21 | Tab 3
22 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
32 |
33 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/backup_rules.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
24 |
25 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/data_extraction_rules.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
22 |
23 |
24 |
28 |
29 |
35 |
--------------------------------------------------------------------------------
/app/src/test/java/com/william/roundimage/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright WeiLianYang
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.william.roundimage
18 |
19 | import org.junit.Test
20 |
21 | import org.junit.Assert.*
22 |
23 | /**
24 | * Example local unit test, which will execute on the development machine (host).
25 | *
26 | * See [testing documentation](http://d.android.com/tools/testing).
27 | */
28 | class ExampleUnitTest {
29 | @Test
30 | fun addition_isCorrect() {
31 | assertEquals(4, 2 + 2)
32 | }
33 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 |
4 | ext.kotlin_version = "1.7.10"
5 |
6 | repositories {
7 | google()
8 | jcenter()
9 |
10 | mavenCentral()
11 | }
12 | dependencies {
13 | classpath "com.android.tools.build:gradle:4.2.2"
14 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
15 | // NOTE: Do not place your application dependencies here; they belong
16 | // in the individual module build.gradle files
17 | }
18 | }
19 |
20 |
21 | allprojects {
22 | repositories {
23 | google()
24 | jcenter()
25 |
26 | mavenCentral()
27 |
28 | // maven {
29 | // url 'https://s01.oss.sonatype.org/content/groups/staging/'
30 | // }
31 | }
32 | }
33 |
34 | task clean(type: Delete) {
35 | delete rootProject.buildDir
36 | }
--------------------------------------------------------------------------------
/docs/tab1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeiLianYang/RoundImageView/0349d6cdcd1a99aa59364798a8f9ef258c485e70/docs/tab1.png
--------------------------------------------------------------------------------
/docs/tab2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeiLianYang/RoundImageView/0349d6cdcd1a99aa59364798a8f9ef258c485e70/docs/tab2.png
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright WeiLianYang
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 | # Project-wide Gradle settings.
18 | # IDE (e.g. Android Studio) users:
19 | # Gradle settings configured through the IDE *will override*
20 | # any settings specified in this file.
21 | # For more details on how to configure your build environment visit
22 | # http://www.gradle.org/docs/current/userguide/build_environment.html
23 | # Specifies the JVM arguments used for the daemon process.
24 | # The setting is particularly useful for tweaking memory settings.
25 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
26 | # When configured, Gradle will run in incubating parallel mode.
27 | # This option should only be used with decoupled projects. More details, visit
28 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
29 | # org.gradle.parallel=true
30 | # AndroidX package structure to make it clearer which packages are bundled with the
31 | # Android operating system, and which are packaged with your app's APK
32 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
33 | android.useAndroidX=true
34 | # Kotlin code style for this project: "official" or "obsolete":
35 | kotlin.code.style=official
36 | # Enables namespacing of each library's R class so that its R class includes only the
37 | # resources declared in the library itself and none from the library's dependencies,
38 | # thereby reducing the size of the R class for that library
39 | #android.nonTransitiveRClass=true
40 |
41 | # config
42 | publishedGroupId=io.github.weilianyang
43 | siteUrl=https://github.com/WeiLianYang/RoundImageView
44 | gitUrl=https://github.com/WeiLianYang/RoundImageView.git
45 | # developer
46 | developerId=WeiLianYang
47 | developerName=WeiLian
48 | developerEmail=williamyangc@163.com
49 | # license
50 | licenseName=The Apache License, Version 2.0
51 | licenseUrl=http://www.apache.org/licenses/LICENSE-2.0.txt
52 | allLicenses=["Apache-2.0"]
53 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeiLianYang/RoundImageView/0349d6cdcd1a99aa59364798a8f9ef258c485e70/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright WeiLianYang
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 | #Sun Sep 18 21:10:45 CST 2022
18 | distributionBase=GRADLE_USER_HOME
19 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
20 | distributionPath=wrapper/dists
21 | zipStorePath=wrapper/dists
22 | zipStoreBase=GRADLE_USER_HOME
23 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/library/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/library/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | id 'kotlin-android'
4 | }
5 |
6 | android {
7 | compileSdkVersion 33
8 |
9 | defaultConfig {
10 | minSdkVersion 18
11 | targetSdkVersion 33
12 |
13 | versionCode 3
14 | versionName "1.0.2"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | consumerProguardFiles "consumer-rules.pro"
18 | }
19 |
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 | compileOptions {
27 | sourceCompatibility JavaVersion.VERSION_1_8
28 | targetCompatibility JavaVersion.VERSION_1_8
29 | }
30 | kotlinOptions {
31 | jvmTarget = '1.8'
32 | }
33 | }
34 |
35 | dependencies {
36 |
37 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
38 | implementation 'androidx.core:core-ktx:1.8.0'
39 | implementation 'androidx.appcompat:appcompat:1.5.0'
40 |
41 | testImplementation 'junit:junit:4.13.2'
42 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
43 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
44 |
45 | }
46 |
47 | ext {
48 | artifactId = 'RoundImageView'
49 | libraryName = 'RoundImageView'
50 | libraryDescription = 'This library is used to set the rounded corners and outer border colors of the images'
51 | }
52 |
53 | //apply from: 'publish.gradle'
54 |
--------------------------------------------------------------------------------
/library/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeiLianYang/RoundImageView/0349d6cdcd1a99aa59364798a8f9ef258c485e70/library/consumer-rules.pro
--------------------------------------------------------------------------------
/library/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/library/publish.gradle:
--------------------------------------------------------------------------------
1 | // 发布到mavenCentral的配置
2 |
3 | if (project.hasProperty("android")) { // Android libraries
4 | task sourcesJar(type: Jar) {
5 | classifier = 'sources'
6 | from android.sourceSets.main.java.srcDirs
7 | }
8 |
9 | task javadoc(type: Javadoc) {
10 | // https://github.com/novoda/bintray-release/issues/71
11 | excludes = ['**/*.kt'] // < ---- Exclude all kotlin files from javadoc file.
12 | failOnError false
13 | source = android.sourceSets.main.java.srcDirs
14 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
15 | options.addStringOption('Xdoclint:none', '-quiet')
16 | options.encoding = "utf-8"
17 | options.charSet = "utf-8"
18 | }
19 | } else { // Java libraries
20 | task sourcesJar(type: Jar, dependsOn: classes) {
21 | classifier = 'sources'
22 | from sourceSets.main.allSource
23 | }
24 | }
25 |
26 | tasks.withType(JavaCompile) {
27 | options.encoding = "UTF-8"
28 | }
29 |
30 | tasks.withType(Javadoc) {
31 | options.encoding = "UTF-8"
32 | }
33 |
34 | task javadocJar(type: Jar, dependsOn: javadoc) {
35 | classifier = 'javadoc'
36 | from javadoc.destinationDir
37 | }
38 |
39 | // add javadoc/source jar tasks as artifacts
40 | artifacts {
41 | archives javadocJar
42 | archives sourcesJar
43 | }
44 |
45 | apply plugin: 'maven'
46 | apply plugin: 'signing'
47 |
48 | def PUBLISH_GROUP_ID = publishedGroupId
49 | def PUBLISH_ARTIFACT_ID = artifactId
50 | def PUBLISH_VERSION = android.defaultConfig.versionName
51 |
52 | afterEvaluate { project ->
53 |
54 | signing {
55 | required { gradle.taskGraph.hasTask("uploadArchives") }
56 | sign configurations.archives
57 | }
58 |
59 | uploadArchives {
60 | repositories {
61 | mavenDeployer {
62 |
63 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
64 |
65 | repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
66 | authentication(userName: ossrhUsername, password: ossrhPassword)
67 | }
68 |
69 | snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
70 | authentication(userName: ossrhUsername, password: ossrhPassword)
71 | }
72 |
73 | pom.groupId = PUBLISH_GROUP_ID
74 | pom.artifactId = PUBLISH_ARTIFACT_ID
75 | pom.version = PUBLISH_VERSION
76 |
77 | pom.project {
78 | packaging 'aar'
79 |
80 | name libraryName
81 | // optionally artifactId can be defined here
82 | description libraryDescription
83 | url siteUrl
84 |
85 | scm {
86 | connection gitUrl
87 | developerConnection gitUrl
88 | url siteUrl
89 | }
90 |
91 | licenses {
92 | license {
93 | name licenseName
94 | url licenseUrl
95 | }
96 | }
97 |
98 | developers {
99 | developer {
100 | id developerId
101 | name developerName
102 | email developerEmail
103 | }
104 | }
105 | }
106 | }
107 | }
108 | }
109 | }
--------------------------------------------------------------------------------
/library/src/androidTest/java/com/william/roundimage/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright WeiLianYang
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.william.roundimage
18 |
19 | import androidx.test.platform.app.InstrumentationRegistry
20 | import androidx.test.ext.junit.runners.AndroidJUnit4
21 |
22 | import org.junit.Test
23 | import org.junit.runner.RunWith
24 |
25 | import org.junit.Assert.*
26 |
27 | /**
28 | * Instrumented test, which will execute on an Android device.
29 | *
30 | * See [testing documentation](http://d.android.com/tools/testing).
31 | */
32 | @RunWith(AndroidJUnit4::class)
33 | class ExampleInstrumentedTest {
34 | @Test
35 | fun useAppContext() {
36 | // Context of the app under test.
37 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
38 | assertEquals("com.william.roundimage.test", appContext.packageName)
39 | }
40 | }
--------------------------------------------------------------------------------
/library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
20 |
21 |
--------------------------------------------------------------------------------
/library/src/main/java/com/william/widget/RoundImageView.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright WeiLianYang
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 |
18 | package com.william.widget
19 |
20 | import android.content.Context
21 | import android.graphics.*
22 | import android.util.AttributeSet
23 | import androidx.annotation.ColorInt
24 | import androidx.appcompat.widget.AppCompatImageView
25 |
26 |
27 | /**
28 | * author : WilliamYang
29 | * date : 2022/9/18 14:54
30 | * description : 可设置 圆角、外边框 的 ImageView
31 | *
32 | * 使用方式:
33 | *
34 | * 1. 使用 riv_radius 设置4个角均为圆角,且圆角值一样
35 | *
36 | * 2. 使用 riv_roundAsCircle 设置图片为圆形,使用 riv_radius 设置半径,当 riv_radius 未设置时,默认取宽高最小值的一半
37 | *
38 | * 3. 使用 riv_topLeft_radius, riv_topRight_radius, riv_bottomLeft_radius, riv_bottomRight_radius 设置4个圆角
39 | *
40 | * 4. 使用 riv_borderColor, riv_borderWidth 设置外边框颜色和宽度
41 | *
42 | *
43 | */
44 | class RoundImageView @JvmOverloads constructor(
45 | context: Context,
46 | attrs: AttributeSet? = null,
47 | defStyleAttr: Int = 0
48 | ) : AppCompatImageView(context, attrs, defStyleAttr) {
49 |
50 | /** 绘制路径 **/
51 | private val path = Path()
52 |
53 | /** 绘制坐标 **/
54 | private val rectF = RectF()
55 |
56 | /** 圆角大小 **/
57 | private var radius = 0f
58 |
59 | /** 顶部左侧圆角大小 **/
60 | private var topLeftRadius = 0f
61 |
62 | /** 顶部右侧圆角大小 **/
63 | private var topRightRadius = 0f
64 |
65 | /** 底部左侧圆角大小 **/
66 | private var bottomLeftRadius = 0f
67 |
68 | /** 底部右侧圆角大小 **/
69 | private var bottomRightRadius = 0f
70 |
71 | /** 作为圆形图片使用 **/
72 | private var roundAsCircle = false
73 |
74 | /** 外边框颜色、宽度、画笔、路径、坐标 */
75 | private var borderColor = 0
76 | private var borderWidth = 0f
77 | private val borderPaint: Paint?
78 | private val borderPath = Path()
79 | private val borderRectF = RectF()
80 |
81 | init {
82 | val ta = context.obtainStyledAttributes(attrs, R.styleable.RoundImageView)
83 |
84 | roundAsCircle = ta.getBoolean(R.styleable.RoundImageView_riv_roundAsCircle, false)
85 | borderColor = ta.getColor(R.styleable.RoundImageView_riv_borderColor, Color.TRANSPARENT)
86 | borderWidth = ta.getDimension(R.styleable.RoundImageView_riv_borderWidth, 0f)
87 |
88 | radius = ta.getDimension(R.styleable.RoundImageView_riv_radius, 0f)
89 |
90 | topLeftRadius = ta.getDimension(R.styleable.RoundImageView_riv_topLeft_radius, 0f)
91 | topRightRadius = ta.getDimension(R.styleable.RoundImageView_riv_topRight_radius, 0f)
92 | bottomLeftRadius = ta.getDimension(R.styleable.RoundImageView_riv_bottomLeft_radius, 0f)
93 | bottomRightRadius = ta.getDimension(R.styleable.RoundImageView_riv_bottomRight_radius, 0f)
94 |
95 | ta.recycle()
96 |
97 | borderPaint = Paint(Paint.ANTI_ALIAS_FLAG)
98 | updateBorderPaint()
99 | }
100 |
101 | override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
102 | super.onSizeChanged(w, h, oldw, oldh)
103 |
104 | // 当作为圆形图片使用,且半径未设置时,半径将取宽高最小值的一半
105 | if (roundAsCircle && radius <= 0f) {
106 | radius = w.coerceAtMost(h) / 2f
107 | }
108 | }
109 |
110 | override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
111 | // 当作为圆形图片使用,宽高值不同,取宽高的最小值作为宽和高
112 | val widthSize = MeasureSpec.getSize(widthMeasureSpec)
113 | val heightSize = MeasureSpec.getSize(heightMeasureSpec)
114 | if (roundAsCircle && widthSize > 0 && heightSize > 0 && widthSize != heightSize) {
115 | val size = widthSize.coerceAtMost(heightSize)
116 | setMeasuredDimension(size, size)
117 | } else {
118 | super.onMeasure(widthMeasureSpec, heightMeasureSpec)
119 | }
120 | }
121 |
122 | override fun onDraw(canvas: Canvas) {
123 | val halfBorderWidth = borderWidth / 2
124 | if (radius > 0 || topLeftRadius > 0 || topRightRadius > 0 || bottomLeftRadius > 0 || bottomRightRadius > 0) {
125 | // 如果设置了圆角值
126 | path.reset()
127 | borderPath.reset()
128 | if (roundAsCircle) {
129 | path.addCircle(radius, radius, radius, Path.Direction.CW)
130 | } else {
131 | if (topLeftRadius == 0f) topLeftRadius = radius
132 | if (topRightRadius == 0f) topRightRadius = radius
133 | if (bottomLeftRadius == 0f) bottomLeftRadius = radius
134 | if (bottomRightRadius == 0f) bottomRightRadius = radius
135 |
136 | val radii = floatArrayOf(
137 | topLeftRadius, topLeftRadius, topRightRadius, topRightRadius,
138 | bottomRightRadius, bottomRightRadius, bottomLeftRadius, bottomLeftRadius
139 | )
140 |
141 | borderRectF.set(
142 | paddingLeft.toFloat() + halfBorderWidth, paddingTop.toFloat() + halfBorderWidth,
143 | measuredWidth.toFloat() - paddingRight - halfBorderWidth,
144 | measuredHeight.toFloat() - paddingBottom - halfBorderWidth
145 | )
146 |
147 | borderPath.addRoundRect(borderRectF, radii, Path.Direction.CW)
148 |
149 | if (halfBorderWidth > 0) {
150 | radii.forEachIndexed { index, f ->
151 | if (f > 0) {
152 | radii[index] = f + halfBorderWidth
153 | }
154 | }
155 | }
156 | rectF.set(
157 | paddingLeft.toFloat(),
158 | paddingTop.toFloat(),
159 | measuredWidth.toFloat() - paddingRight,
160 | measuredHeight.toFloat() - paddingBottom
161 | )
162 | path.addRoundRect(rectF, radii, Path.Direction.CW)
163 | }
164 |
165 | // 裁剪画布
166 | canvas.clipPath(path)
167 | }
168 |
169 | super.onDraw(canvas)
170 |
171 | if (borderWidth > 0 && borderPaint != null) {
172 | if (roundAsCircle) {
173 | canvas.drawCircle(radius, radius, radius - borderWidth / 2, borderPaint)
174 | } else {
175 | canvas.drawPath(borderPath, borderPaint)
176 | }
177 | }
178 | }
179 |
180 | private fun updateBorderPaint() {
181 | borderPaint?.apply {
182 | color = borderColor
183 | strokeWidth = borderWidth
184 | style = Paint.Style.STROKE
185 | }
186 | }
187 |
188 | /**
189 | * @param radius 圆角大小,当 asCircle 为 true 时,值作为圆形图片的半径,如果为0,则将取宽高最小值的一半
190 | * @param borderWidth 外边框宽度
191 | * @param borderColor 外边框颜色
192 | * @param asCircle 作为圆形图片使用,默认 false
193 | */
194 | fun setRadiusAndBorder(
195 | radius: Float,
196 | borderWidth: Float = 0f,
197 | @ColorInt borderColor: Int = 0,
198 | asCircle: Boolean = false,
199 | ) {
200 | this.radius = radius
201 | this.borderWidth = borderWidth
202 | this.borderColor = borderColor
203 | this.roundAsCircle = asCircle
204 |
205 | updateBorderPaint()
206 | }
207 |
208 | /**
209 | * @param topLeftRadius 顶部左侧圆角大小
210 | * @param topRightRadius 顶部右侧圆角大小
211 | * @param bottomLeftRadius 底部左侧圆角大小
212 | * @param bottomRightRadius 底部右侧圆角大小
213 | * @param borderWidth 外边框宽度
214 | * @param borderColor 外边框颜色
215 | */
216 | fun setRadiusAndBorder(
217 | topLeftRadius: Float = 0f,
218 | topRightRadius: Float = 0f,
219 | bottomLeftRadius: Float = 0f,
220 | bottomRightRadius: Float = 0f,
221 | borderWidth: Float = 0f,
222 | @ColorInt borderColor: Int = 0
223 | ) {
224 | this.topLeftRadius = topLeftRadius
225 | this.topRightRadius = topRightRadius
226 | this.bottomLeftRadius = bottomLeftRadius
227 | this.bottomRightRadius = bottomRightRadius
228 | this.borderWidth = borderWidth
229 | this.borderColor = borderColor
230 |
231 | updateBorderPaint()
232 | }
233 |
234 | }
--------------------------------------------------------------------------------
/library/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/library/src/test/java/com/william/roundimage/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright WeiLianYang
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.william.roundimage
18 |
19 | import org.junit.Test
20 |
21 | import org.junit.Assert.*
22 |
23 | /**
24 | * Example local unit test, which will execute on the development machine (host).
25 | *
26 | * See [testing documentation](http://d.android.com/tools/testing).
27 | */
28 | class ExampleUnitTest {
29 | @Test
30 | fun addition_isCorrect() {
31 | assertEquals(4, 2 + 2)
32 | }
33 | }
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = "RoundImageView"
2 | include ':app'
3 | include ':library'
4 |
--------------------------------------------------------------------------------