├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── drawable
│ │ │ │ ├── nadim.png
│ │ │ │ └── phone.png
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ └── layout
│ │ │ │ └── activity_main.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── nadim
│ │ │ └── ndroid
│ │ │ └── sample
│ │ │ └── MainActivity.java
│ ├── test
│ │ └── java
│ │ │ └── nadim
│ │ │ └── ndroid
│ │ │ └── sample
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── nadim
│ │ └── ndroid
│ │ └── sample
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── coolview
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ └── attrs.xml
│ │ │ └── layout
│ │ │ │ └── cool_button.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── ndroid
│ │ │ ├── CoolEditText.java
│ │ │ ├── CoolButton.java
│ │ │ └── CoolImage.java
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── ndroid
│ │ │ └── nadim
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── ndroid
│ │ └── nadim
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── .idea
├── copyright
│ └── profiles_settings.xml
├── modules.xml
├── runConfigurations.xml
├── gradle.xml
├── compiler.xml
└── misc.xml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── gradle.properties
├── gradlew.bat
├── README.md
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/coolview/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':coolview'
2 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/coolview/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | CoolView
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadimgouia/CoolView/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/drawable/nadim.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadimgouia/CoolView/HEAD/app/src/main/res/drawable/nadim.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/phone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadimgouia/CoolView/HEAD/app/src/main/res/drawable/phone.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadimgouia/CoolView/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadimgouia/CoolView/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadimgouia/CoolView/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadimgouia/CoolView/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadimgouia/CoolView/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadimgouia/CoolView/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadimgouia/CoolView/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadimgouia/CoolView/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadimgouia/CoolView/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadimgouia/CoolView/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Sep 28 21:03:11 CET 2017
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-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Sample
3 |
4 | - TUNISIA
5 | - CANADA
6 | - FRENSH
7 | - USA
8 |
9 |
10 |
--------------------------------------------------------------------------------
/coolview/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/test/java/nadim/ndroid/sample/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package nadim.ndroid.sample;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/coolview/src/test/java/com/ndroid/nadim/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.ndroid.nadim;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/coolview/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/nadim/ndroid/sample/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package nadim.ndroid.sample;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("nadim.ndroid.sample", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/coolview/src/androidTest/java/com/ndroid/nadim/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.ndroid.nadim;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.ndroid.nadim.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/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 /Users/mac/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/coolview/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 /Users/mac/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 26
5 | buildToolsVersion "26.0.0"
6 | defaultConfig {
7 | applicationId "nadim.ndroid.sample"
8 | minSdkVersion 15
9 | targetSdkVersion 26
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:26.+'
28 | compile 'com.android.support.constraint:constraint-layout:1.0.2'
29 | testCompile 'junit:junit:4.12'
30 | compile project(':coolview')
31 | }
32 |
--------------------------------------------------------------------------------
/coolview/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | ext {
4 | PUBLISH_GROUP_ID = 'com.ndroid'
5 | PUBLISH_ARTIFACT_ID = 'cool-view'
6 | PUBLISH_VERSION = '1.0'
7 | }
8 |
9 | android {
10 | compileSdkVersion 26
11 | buildToolsVersion "26.0.0"
12 |
13 | defaultConfig {
14 | minSdkVersion 15
15 | targetSdkVersion 26
16 | versionCode 1
17 | versionName "1.0"
18 |
19 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
20 |
21 | }
22 | buildTypes {
23 | release {
24 | minifyEnabled false
25 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
26 | }
27 | }
28 | }
29 |
30 | dependencies {
31 | compile fileTree(dir: 'libs', include: ['*.jar'])
32 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
33 | exclude group: 'com.android.support', module: 'support-annotations'
34 | })
35 | compile 'com.android.support:appcompat-v7:26.+'
36 | testCompile 'junit:junit:4.12'
37 | }
38 | apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'
--------------------------------------------------------------------------------
/coolview/src/main/res/layout/cool_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
14 |
19 |
20 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/java/nadim/ndroid/sample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package nadim.ndroid.sample;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 |
6 | import com.ndroid.CoolButton;
7 | import com.ndroid.CoolEditText;
8 | import com.ndroid.CoolImage;
9 |
10 | public class MainActivity extends AppCompatActivity {
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.activity_main);
16 |
17 |
18 | CoolButton coolButton = (CoolButton) findViewById(R.id.coolButton);
19 |
20 | //custom button border ...
21 | // set the border color
22 | coolButton.setBorderColor("#FFD42626");
23 | // set the border radius
24 | coolButton.setBorderRadius(20);
25 | // set the border stroke
26 | coolButton.setBorderStroke(4);
27 |
28 | CoolEditText coolEditText = (CoolEditText) findViewById(R.id.coolEditText);
29 |
30 | //custom editText border ...
31 | // set the border color
32 | coolEditText.setBorderColor("#000000");
33 | // set the border radius
34 | coolEditText.setBorderRadius(20);
35 | // set the border stroke
36 | coolEditText.setBorderStroke(4);
37 |
38 |
39 | CoolImage coolImage = (CoolImage) findViewById(R.id.coolImage);
40 | //custom ImageView border ...
41 | /*
42 | // set the border color
43 | coolImage.setBorderColor("#000000");
44 | // set the border radius
45 | coolImage.setBorderRadius(20);
46 | // set the border stroke
47 | coolImage.setBorderStroke(4);
48 | coolImage.setCircle(true);
49 | */
50 |
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/.idea/misc.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 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | 1.8
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/coolview/src/main/java/com/ndroid/CoolEditText.java:
--------------------------------------------------------------------------------
1 | package com.ndroid;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Color;
6 | import android.graphics.drawable.ColorDrawable;
7 | import android.graphics.drawable.GradientDrawable;
8 | import android.os.Build;
9 | import android.support.annotation.ColorInt;
10 | import android.util.AttributeSet;
11 | import android.util.Log;
12 |
13 |
14 | /**
15 | * Created by Nadim on 29/09/2017.
16 | */
17 |
18 | public class CoolEditText extends android.support.v7.widget.AppCompatEditText {
19 |
20 | float borderRadius = 0;
21 | int borderStroke = 0;
22 | int borderColor = 0;
23 | GradientDrawable shape;
24 |
25 | int colorId;
26 |
27 | public CoolEditText(Context context, AttributeSet attrs) {
28 | super(context, attrs);
29 |
30 | TypedArray a = context.obtainStyledAttributes(attrs,
31 | R.styleable.Options, 0, 0);
32 |
33 | // Border attributes...
34 | borderRadius = a.getFloat(R.styleable.Options_border_radius, 0f);
35 | borderStroke = a.getInt(R.styleable.Options_border_stroke, 0);
36 | borderColor = a.getInt(R.styleable.Options_border_color, 0);
37 |
38 | shape = new GradientDrawable();
39 |
40 | try {
41 | ColorDrawable buttonColor = (ColorDrawable) getBackground();
42 | colorId = buttonColor.getColor();
43 | shape.setColor(colorId);
44 | } catch (Exception ex) {
45 | Log.e("parsing error", ex.getMessage());
46 | }
47 |
48 | a.recycle();
49 |
50 | initView();
51 | setPadding(20, 20, 20, 20);
52 |
53 | }
54 |
55 | public CoolEditText(Context context) {
56 | super(context);
57 | }
58 |
59 | public void initView() {
60 |
61 | shape.setCornerRadius(borderRadius);
62 | shape.setStroke(borderStroke, borderColor);
63 |
64 |
65 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
66 | setBackground(shape);
67 | } else {
68 | setBackgroundDrawable(shape);
69 | }
70 |
71 | }
72 |
73 | public float getBorderRadius() {
74 | return borderRadius;
75 | }
76 |
77 | public void setBorderRadius(float borderRadius) {
78 | this.borderRadius = borderRadius;
79 | initView();
80 | }
81 |
82 | public int getBorderStroke() {
83 | return borderStroke;
84 | }
85 |
86 | public void setBorderStroke(int borderStroke) {
87 | this.borderStroke = borderStroke;
88 | initView();
89 |
90 | }
91 |
92 | public int getBorderColor() {
93 | return borderColor;
94 | }
95 |
96 | public void setBorderColor(@ColorInt int borderColor) {
97 | this.borderColor = borderColor;
98 | initView();
99 | }
100 |
101 |
102 | public void setBorderColor(String borderColor) {
103 | this.borderColor = Color.parseColor(borderColor);
104 | initView();
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/coolview/src/main/java/com/ndroid/CoolButton.java:
--------------------------------------------------------------------------------
1 | package com.ndroid;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Color;
6 | import android.graphics.drawable.ColorDrawable;
7 | import android.graphics.drawable.GradientDrawable;
8 | import android.os.Build;
9 | import android.support.annotation.ColorInt;
10 | import android.util.AttributeSet;
11 | import android.util.Log;
12 |
13 |
14 | /**
15 | * Created by Nadim on 28/09/2017.
16 | */
17 |
18 | public class CoolButton extends android.support.v7.widget.AppCompatButton {
19 |
20 | float borderRadius = 0;
21 | int borderStroke = 0;
22 | int borderColor = 0;
23 | GradientDrawable shape;
24 |
25 | int colorId;
26 |
27 | public CoolButton(Context context, AttributeSet attrs) {
28 | super(context, attrs);
29 |
30 | TypedArray a = context.obtainStyledAttributes(attrs,
31 | R.styleable.Options, 0, 0);
32 |
33 | // Border attributes...
34 | borderRadius = a.getFloat(R.styleable.Options_border_radius, 0f);
35 | borderStroke = a.getInt(R.styleable.Options_border_stroke, 0);
36 | borderColor = a.getInt(R.styleable.Options_border_color, 0);
37 |
38 | shape = new GradientDrawable();
39 |
40 | try {
41 | ColorDrawable buttonColor = (ColorDrawable) getBackground();
42 | colorId = buttonColor.getColor();
43 | shape.setColor(colorId);
44 | } catch (Exception ex) {
45 | shape.setColor(Color.parseColor("#cecfcf"));
46 | Log.e("parsing error", ex.getMessage());
47 | }
48 |
49 | a.recycle();
50 |
51 | initView();
52 |
53 | setPadding(20, 20, 20, 20);
54 |
55 | }
56 |
57 | public CoolButton(Context context) {
58 | this(context, null);
59 | }
60 |
61 |
62 | public void initView() {
63 |
64 | shape.setCornerRadius(borderRadius);
65 | shape.setStroke(borderStroke, borderColor);
66 |
67 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
68 | setBackground(shape);
69 | } else {
70 | setBackgroundDrawable(shape);
71 | }
72 |
73 | }
74 |
75 | public float getBorderRadius() {
76 | return borderRadius;
77 | }
78 |
79 | public void setBorderRadius(float borderRadius) {
80 | this.borderRadius = borderRadius;
81 | initView();
82 | }
83 |
84 | public int getBorderStroke() {
85 | return borderStroke;
86 | }
87 |
88 | public void setBorderStroke(int borderStroke) {
89 | this.borderStroke = borderStroke;
90 | initView();
91 |
92 | }
93 |
94 | public int getBorderColor() {
95 | return borderColor;
96 | }
97 |
98 | public void setBorderColor(@ColorInt int borderColor) {
99 | this.borderColor = borderColor;
100 | initView();
101 | }
102 |
103 |
104 | public void setBorderColor(String borderColor) {
105 | this.borderColor = Color.parseColor(borderColor);
106 | initView();
107 | }
108 |
109 |
110 | }
111 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CoolView
2 | An Android Library that help you to customise views (Button, EditText, ImageView), by adding border with the size and color that you want, and give it the corner radius that you seems cool, and you can also make an imageview looks like a circle.
3 |
4 | # Gradle
5 | compile on your dependencies
6 |
7 |
8 | dependencies {
9 | compile 'com.ndroid:cool-view:1.0'
10 | }
11 |
12 |
13 |
14 | # ScreenShot
15 |
16 |
17 | # Sample Example
18 | Sample Module
19 |
20 | # Usage
21 |
22 | To create a new CoolButton (its the same way for the CoolEditText)
23 |
24 |
25 | <com.ndroid.CoolButton
26 | android:layout_width="100dp"
27 | android:layout_height="wrap_content"
28 | android:background="#26d64c"
29 | android:drawableLeft="@drawable/phone"
30 | android:text="Call Now"
31 | android:textColor="#fff"
32 | custom:border_color="#262626"
33 | custom:border_radius="20"
34 | custom:border_stroke="5" />
35 |
36 |
37 |
38 | To set the border_radius, border_stroke, border_color from the activity class..
39 |
40 |
41 | CoolButton coolButton = (CoolButton) findViewById(R.id.coolButton);
42 | //custom button border ...
43 | // set the border color
44 | coolButton.setBorderColor("#FFD42626");
45 | // set the border radius
46 | coolButton.setBorderRadius(20);
47 | // set the border stroke
48 | coolButton.setBorderStroke(4);
49 |
50 |
51 |
52 | Create a bordered Cool ImageView..
53 |
54 |
55 | <com.ndroid.CoolImageView
56 | android:layout_width="200dp"
57 | android:layout_height="200dp"
58 | android:background="#26d64c"
59 | android:drawableLeft="@drawable/phone"
60 | android:text="Call Now"
61 | android:textColor="#fff"
62 | custom:border_color="#262626"
63 | custom:border_radius="20"
64 | custom:border_stroke="5" />
65 |
66 |
67 |
68 | Make the CoolImageView Circle ...
69 |
70 |
71 | <com.ndroid.CoolImageView
72 | android:layout_width="200dp"
73 | android:layout_height="200dp"
74 | android:background="#26d64c"
75 | android:drawableLeft="@drawable/phone"
76 | android:text="Call Now"
77 | android:textColor="#fff"
78 | custom:border_color="#262626"
79 | custom:border_stroke="5"
80 | custom:is_circle="true"
81 | />
82 |
83 |
84 |
85 | Customize the ImageView From Activity class ...
86 |
87 |
88 | CoolImage coolImage = (CoolImage) findViewById(R.id.coolImage);
89 | //custom ImageView border ...
90 | // set the border color
91 | coolImage.setBorderColor("#000000");
92 | // set the border radius
93 | coolImage.setBorderRadius(20);
94 | // set the border stroke
95 | coolImage.setBorderStroke(4);
96 | // make the imageview circle
97 | coolImage.setCircle(true);
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
19 |
20 |
25 |
26 |
33 |
34 |
41 |
42 |
43 |
48 |
49 |
60 |
61 |
65 |
66 |
74 |
75 |
76 |
84 |
85 |
90 |
91 |
99 |
100 |
105 |
106 |
115 |
116 |
117 |
127 |
128 |
129 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/coolview/src/main/java/com/ndroid/CoolImage.java:
--------------------------------------------------------------------------------
1 | package com.ndroid;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Bitmap;
6 | import android.graphics.BitmapShader;
7 | import android.graphics.Canvas;
8 | import android.graphics.Color;
9 | import android.graphics.Paint;
10 | import android.graphics.RectF;
11 | import android.graphics.Shader;
12 | import android.graphics.drawable.BitmapDrawable;
13 | import android.graphics.drawable.Drawable;
14 | import android.graphics.drawable.GradientDrawable;
15 | import android.os.Build;
16 | import android.support.annotation.ColorInt;
17 | import android.support.annotation.Nullable;
18 | import android.util.AttributeSet;
19 |
20 | /**
21 | * Created by Nadim on 02/10/2017.
22 | */
23 |
24 | public class CoolImage extends android.support.v7.widget.AppCompatImageView {
25 |
26 | float borderRadius;
27 | int borderStroke, borderColor;
28 | Drawable src;
29 | Bitmap bitmap, originalBitmap;
30 | Boolean isCircle = false;
31 |
32 | public CoolImage(Context context) {
33 | super(context, null);
34 | }
35 |
36 | public CoolImage(Context context, @Nullable AttributeSet attrs) {
37 | super(context, attrs);
38 |
39 | TypedArray a = context.obtainStyledAttributes(attrs,
40 | R.styleable.Options, 0, 0);
41 |
42 | borderRadius = a.getFloat(R.styleable.Options_border_radius, 0f);
43 | borderStroke = a.getInt(R.styleable.Options_border_stroke, 0);
44 | borderColor = a.getInt(R.styleable.Options_border_color, 0);
45 | isCircle = a.getBoolean(R.styleable.Options_is_circle, false);
46 | src = getDrawable();
47 |
48 | a.recycle();
49 |
50 | originalBitmap = drawableToBitmap(src);
51 | bitmap = drawableToBitmap(src);
52 |
53 | initView();
54 | }
55 |
56 | private void initView() {
57 |
58 | if (isCircle) {
59 | bitmap = getCircleBitmap(originalBitmap);
60 | } else {
61 | bitmap = getRectangleBitmap(originalBitmap);
62 | }
63 |
64 | setScaleType(ScaleType.FIT_XY);
65 | setImageBitmap(bitmap);
66 |
67 | }
68 |
69 | private Bitmap getRectangleBitmap(Bitmap mbitmap) {
70 |
71 | GradientDrawable shape = new GradientDrawable();
72 | shape.setCornerRadius(borderRadius * 2);
73 | shape.setStroke(borderStroke, borderColor);
74 |
75 | Bitmap imageRounded = Bitmap.createBitmap(mbitmap.getWidth(), mbitmap.getHeight(), mbitmap.getConfig());
76 | Canvas canvas = new Canvas(imageRounded);
77 | Paint mpaint = new Paint();
78 | mpaint.setAntiAlias(true);
79 | mpaint.setShader(new BitmapShader(mbitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP));
80 | canvas.drawRoundRect((new RectF(0, 0, mbitmap.getWidth(), mbitmap.getHeight())), borderRadius * 5, borderRadius * 5, mpaint);
81 |
82 | setPadding(borderStroke, borderStroke, borderStroke, borderStroke);
83 |
84 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
85 | setBackground(shape);
86 | } else {
87 | setBackgroundDrawable(shape);
88 | }
89 |
90 | return imageRounded;
91 | }
92 |
93 | private Bitmap getCircleBitmap(Bitmap mbitmap) {
94 |
95 | GradientDrawable shape = new GradientDrawable();
96 | shape.setCornerRadius(mbitmap.getWidth() / 2);
97 | shape.setStroke(borderStroke, borderColor);
98 |
99 | Bitmap imageRounded = Bitmap.createBitmap(mbitmap.getWidth(), mbitmap.getHeight(), mbitmap.getConfig());
100 | Canvas canvas = new Canvas(imageRounded);
101 | Paint mpaint = new Paint();
102 | mpaint.setAntiAlias(true);
103 | mpaint.setShader(new BitmapShader(mbitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP));
104 | canvas.drawRoundRect((new RectF(0, 0, mbitmap.getWidth(), mbitmap.getHeight())), mbitmap.getWidth() / 2, mbitmap.getHeight() / 2, mpaint);
105 |
106 | setPadding(borderStroke, borderStroke, borderStroke, borderStroke);
107 |
108 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
109 | setBackground(shape);
110 | } else {
111 | setBackgroundDrawable(shape);
112 | }
113 |
114 | return imageRounded;
115 |
116 | }
117 |
118 | public static Bitmap drawableToBitmap(Drawable drawable) {
119 | Bitmap bitmap = null;
120 |
121 | if (drawable instanceof BitmapDrawable) {
122 | BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
123 | if (bitmapDrawable.getBitmap() != null) {
124 | return bitmapDrawable.getBitmap();
125 | }
126 | }
127 |
128 | if (drawable.getIntrinsicWidth() <= 0 || drawable.getIntrinsicHeight() <= 0) {
129 | bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
130 | // Single color bitmap will be created of 1x1 pixel
131 | } else {
132 | bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
133 | }
134 |
135 | Canvas canvas = new Canvas(bitmap);
136 | drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
137 | drawable.draw(canvas);
138 | return bitmap;
139 | }
140 |
141 | @Override
142 | protected void onAttachedToWindow() {
143 | super.onAttachedToWindow();
144 |
145 | if (isCircle) {
146 | int width = getLayoutParams().width;
147 | int height = getLayoutParams().height;
148 |
149 | if (width < height) {
150 | getLayoutParams().width = width;
151 | getLayoutParams().height = width;
152 | } else {
153 | getLayoutParams().width = height;
154 | getLayoutParams().height = height;
155 | }
156 | }
157 | }
158 |
159 |
160 | public float getBorderRadius() {
161 | return borderRadius;
162 | }
163 |
164 | public void setBorderRadius(float borderRadius) {
165 | this.borderRadius = borderRadius;
166 | initView();
167 | }
168 |
169 | public int getBorderStroke() {
170 | return borderStroke;
171 | }
172 |
173 | public void setBorderStroke(int borderStroke) {
174 | this.borderStroke = borderStroke;
175 | initView();
176 | }
177 |
178 | public int getBorderColor() {
179 | return borderColor;
180 | }
181 |
182 |
183 | public void setBorderColor(@ColorInt int borderColor) {
184 | this.borderColor = borderColor;
185 | initView();
186 | }
187 |
188 |
189 | public void setBorderColor(String borderColor) {
190 | this.borderColor = Color.parseColor(borderColor);
191 | initView();
192 | }
193 |
194 | public Boolean getCircle() {
195 | return isCircle;
196 | }
197 |
198 | public void setCircle(Boolean circle) {
199 | isCircle = circle;
200 | initView();
201 | }
202 | }
203 |
--------------------------------------------------------------------------------