├── .gitignore
├── LICENSE.md
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── silvestr
│ │ └── dotprogressbarexample
│ │ └── ApplicationTest.java
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── silvestr
│ │ └── dotprogressbarexample
│ │ ├── MainActivity.java
│ │ └── SecondActivity.java
│ └── res
│ ├── layout
│ ├── activity_main.xml
│ └── second_activity.xml
│ ├── menu
│ └── menu_main.xml
│ ├── mipmap-hdpi
│ ├── ic_account_circle_black_48dp.png
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ ├── ic_account_circle_black_48dp.png
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ ├── ic_account_circle_black_48dp.png
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ ├── ic_account_circle_black_48dp.png
│ └── ic_launcher.png
│ ├── mipmap-xxxhdpi
│ ├── ic_account_circle_black_48dp.png
│ └── ic_launcher.png
│ ├── values-w820dp
│ └── dimens.xml
│ └── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── dot-progress-bar
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── github
│ │ └── silvestrpredko
│ │ └── dotprogressbar
│ │ ├── AnimationListener.java
│ │ ├── DotProgressBar.java
│ │ └── DotProgressBarBuilder.java
│ └── res
│ └── values
│ ├── attrs.xml
│ ├── colors.xml
│ └── strings.xml
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | ###############################
2 | ### Project files
3 | ##############################
4 | *.obb
5 | *.zip
6 |
7 | ###############################
8 | ### OS temporary files
9 | ###############################
10 | ### Windows
11 | Thumbs.db
12 | Desktop.ini
13 | *.exe
14 | *.msi
15 | ### Linux
16 | *~
17 | .directory
18 | ### OS X
19 | .DS_Store
20 | .AppleDouble
21 | .LSOverride
22 | .Spotlight-V100
23 | .Trashes
24 | ._*
25 |
26 | ### Java generated files
27 | *.class
28 | *.jar
29 | !*/libs/*.jar
30 | *.war
31 | *.ear
32 | *.apk
33 | *.alloc
34 |
35 | ### VM crash logs
36 | hs_err_pid*
37 |
38 | ### Hibernate MetaModels
39 | *_.java
40 |
41 | ## GWT
42 | war/
43 | html/war/gwt_bree/
44 | html/gwt-unitCache/
45 | .apt_generated/
46 | html/war/WEB-INF/deploy/
47 | html/war/WEB-INF/classes/
48 | .gwt/
49 | gwt-unitCache/
50 | www-test/
51 | .gwt-tmp/
52 |
53 | ### JBoss
54 | jboss/server/all/deploy/project.ext
55 | jboss/server/default/deploy/project.ext
56 | jboss/server/minimal/deploy/project.ext
57 | jboss/server/all/log/*.log
58 | jboss/server/all/tmp/**/*
59 | jboss/server/all/data/**/*
60 | jboss/server/all/work/**/*
61 | jboss/server/default/log/*.log
62 | jboss/server/default/tmp/**/*
63 | jboss/server/default/data/**/*
64 | jboss/server/default/work/**/*
65 | jboss/server/minimal/log/*.log
66 | jboss/server/minimal/tmp/**/*
67 | jboss/server/minimal/data/**/*
68 | jboss/server/minimal/work/**/*
69 |
70 | *.DEPLOYED
71 |
72 | #####################################
73 | ### Build Systems
74 | #####################################
75 |
76 | ### Ant
77 | gen/
78 |
79 | ### Maven
80 | target/
81 | pom.xml.tag
82 | pom.xml.releaseBackup
83 | pom.xml.versionsBackup
84 | pom.xml.next
85 | release.properties
86 |
87 | ### Gradle
88 | .gradle
89 | build/
90 | android/libs/armeabi/
91 | android/libs/armeabi-v7a/
92 | android/libs/x86/
93 | android/gen/
94 |
95 | gradle/
96 | gradlew*
97 | gradle.properties
98 |
99 | # Ignore Gradle GUI config
100 | gradle-app.setting
101 |
102 | ######################################
103 | ### IDE
104 | ######################################
105 |
106 | ### JetBrains IDEs
107 | .idea/
108 | *.ipr
109 | *.iml
110 | *.iws
111 |
112 | out/
113 |
114 | .idea_modules/
115 | atlassian-ide-plugin.xml
116 | com_crashlytics_export_strings.xml
117 |
118 | ### Eclipse
119 | *.pydevproject
120 | .metadata
121 | .classpath
122 | .project
123 | bin/
124 | tmp/
125 | *.tmp
126 | *.bak
127 | *.swp
128 | *~.nib
129 | local.properties
130 | .settings/
131 | .loadpath
132 |
133 | # External tool builders
134 | .externalToolBuilders/
135 |
136 | # Locally stored "Eclipse launch configurations"
137 | *.launch
138 |
139 | # CDT-specific
140 | .cproject
141 |
142 | # PDT-specific
143 | .buildpath
144 |
145 | # sbteclipse plugin
146 | .target
147 |
148 | ### NetBeans
149 | nbproject/private
150 | nbbuild/
151 | dist/
152 | nbdist/
153 | nbactions.xml
154 | nb-configuration.xml
155 | Logic/target/
156 |
157 | #### Diff temporary files
158 | *.orig
159 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Predko Silvestr
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | **DotProgressBar**
2 | ===================
3 |
4 | ### It`s a simple progress bar.
5 |
6 | ## **Example** ##
7 |
8 | 
9 |
10 | [](https://play.google.com/store/apps/details?id=com.silvestr.dotprogressbarexample&hl=en)
11 |
12 | [](https://android-arsenal.com/details/1/3340)
13 |
14 | ### **Gradle**
15 | ```groovy
16 | compile 'com.github.silvestrpredko:dot-progress-bar:1.1'
17 | ```
18 |
19 | ## **Usage** ##
20 | #### **XML**
21 | ```xml
22 |
31 | ```
32 | #### **Code**
33 | ```java
34 | dotProgressBar.setStartColor(startColor);
35 | dotProgressBar.setEndColor(endColor);
36 | dotProgressBar.setDotAmount(amount);
37 | dotProgressBar.setAnimationTime(time);
38 |
39 | // or you can use builder
40 |
41 | new DotProgressBarBuilder(this)
42 | .setDotAmount(5)
43 | .setStartColor(Color.BLACK)
44 | .setAnimationDirection(DotProgressBar.LEFT_DIRECTION)
45 | .build();
46 | ```
47 |
48 | ### [License](./LICENSE.md)
49 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "24.0.2"
6 |
7 | lintOptions {
8 | abortOnError false
9 | }
10 |
11 | defaultConfig {
12 | applicationId "com.silvestr.dotprogressbarexample"
13 | minSdkVersion 15
14 | targetSdkVersion 25
15 | versionCode 3
16 | versionName "1.2"
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | }
25 |
26 | dependencies {
27 | compile project(':dot-progress-bar')
28 | compile 'com.github.bumptech.glide:glide:3.7.0'
29 | compile 'com.android.support:support-v4:25.1.0'
30 | compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
31 | }
32 |
--------------------------------------------------------------------------------
/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 /home/silvestr/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 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/silvestr/dotprogressbarexample/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.silvestr.dotprogressbarexample;
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 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
13 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/silvestr/dotprogressbarexample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.silvestr.dotprogressbarexample;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.graphics.Bitmap;
6 | import android.graphics.BitmapShader;
7 | import android.graphics.Canvas;
8 | import android.graphics.Paint;
9 | import android.net.Uri;
10 | import android.os.Build;
11 | import android.os.Bundle;
12 | import android.support.v4.content.ContextCompat;
13 | import android.support.v7.app.AppCompatActivity;
14 | import android.support.v7.widget.Toolbar;
15 | import android.view.Gravity;
16 | import android.view.View;
17 | import android.view.ViewGroup;
18 | import android.widget.Button;
19 | import android.widget.FrameLayout;
20 | import android.widget.ImageView;
21 |
22 | import com.bumptech.glide.Glide;
23 | import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
24 | import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
25 | import com.github.silvestrpredko.dotprogressbar.DotProgressBar;
26 | import com.github.silvestrpredko.dotprogressbar.DotProgressBarBuilder;
27 |
28 | public class MainActivity extends AppCompatActivity {
29 |
30 | DotProgressBar dotProgressBar;
31 |
32 | @Override
33 | protected void onCreate(Bundle savedInstanceState) {
34 | super.onCreate(savedInstanceState);
35 | setContentView(R.layout.activity_main);
36 |
37 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
38 | getWindow().setStatusBarColor(getResources().getColor(R.color.indigo_700));
39 | }
40 |
41 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
42 | toolbar.setTitleTextColor(getResources().getColor(R.color.indigo_50));
43 | setSupportActionBar(toolbar);
44 |
45 | getSupportActionBar().setTitle(getString(R.string.app_name));
46 | ImageView profileImageView = (ImageView) findViewById(R.id.imageView);
47 | final Button btnChangeVisibility = (Button) findViewById(R.id.btn_visibility);
48 | final Button btnChangeAnimationDirection = (Button) findViewById(R.id.btn_direction);
49 | final Button btnGoToNextActivity = (Button) findViewById(R.id.btnGoToNextActivity);
50 | dotProgressBar = (DotProgressBar) findViewById(R.id.dot_progress_bar);
51 |
52 | btnChangeVisibility.setOnClickListener(new View.OnClickListener() {
53 | @Override
54 | public void onClick(View view) {
55 | if (dotProgressBar.getVisibility() == View.VISIBLE) {
56 | dotProgressBar.setVisibility(View.INVISIBLE);
57 | } else {
58 | dotProgressBar.setVisibility(View.VISIBLE);
59 | }
60 | }
61 | });
62 |
63 | btnChangeAnimationDirection.setOnClickListener(new View.OnClickListener() {
64 | @Override
65 | public void onClick(View view) {
66 | if (dotProgressBar.getAnimationDirection() < 0) {
67 | dotProgressBar.changeAnimationDirection(DotProgressBar.RIGHT_DIRECTION);
68 | } else {
69 | dotProgressBar.changeAnimationDirection(DotProgressBar.LEFT_DIRECTION);
70 | }
71 | }
72 | });
73 |
74 | btnGoToNextActivity.setOnClickListener(new View.OnClickListener() {
75 | @Override
76 | public void onClick(View view) {
77 | startActivity(new Intent(MainActivity.this, SecondActivity.class));
78 | }
79 | });
80 |
81 | final FrameLayout progressBarContainer =
82 | (FrameLayout) findViewById(R.id.container);
83 |
84 | DotProgressBarBuilder builder = new DotProgressBarBuilder(this);
85 | builder.setStartColor(ContextCompat.getColor(this, R.color.deep_purple_800))
86 | .setEndColor(ContextCompat.getColor(this, R.color.deep_purple_400))
87 | .setAnimationDirection(DotProgressBar.LEFT_DIRECTION)
88 | .setDotAmount(7);
89 |
90 | progressBarContainer.addView(
91 | builder.build(),
92 | new FrameLayout.LayoutParams(
93 | ViewGroup.LayoutParams.MATCH_PARENT,
94 | 150,
95 | Gravity.CENTER
96 | )
97 | );
98 |
99 | Uri uri = Uri.parse("http://i1.wp.com/cdn.techreviewpro.com//2015/03/Amazing-WhatsApp-DP-Wonderful-Stylish-Girls-for-fb-Profile-Picture.jpg");
100 | Glide.with(this).load(uri)
101 | .transform(new CircleTransform(this))
102 | .placeholder(getResources().getDrawable(R.mipmap.ic_account_circle_black_48dp))
103 | .into(profileImageView);
104 | }
105 |
106 | static class CircleTransform extends BitmapTransformation {
107 | public CircleTransform(Context context) {
108 | super(context);
109 | }
110 |
111 | private static Bitmap circleCrop(BitmapPool pool, Bitmap source) {
112 | if (source == null) return null;
113 |
114 | int size = Math.min(source.getWidth(), source.getHeight());
115 | int x = (source.getWidth() - size) / 2;
116 | int y = (source.getHeight() - size) / 2;
117 |
118 | Bitmap squared = Bitmap.createBitmap(source, x, y, size, size);
119 |
120 | Bitmap result = pool.get(size, size, Bitmap.Config.ARGB_8888);
121 | if (result == null) {
122 | result = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
123 | }
124 |
125 | Canvas canvas = new Canvas(result);
126 | Paint paint = new Paint();
127 | paint.setShader(new BitmapShader(squared, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));
128 | paint.setAntiAlias(true);
129 | float r = size / 2f;
130 | canvas.drawCircle(r, r, r, paint);
131 | return result;
132 | }
133 |
134 | @Override protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
135 | return circleCrop(pool, toTransform);
136 | }
137 |
138 | @Override public String getId() {
139 | return getClass().getName();
140 | }
141 | }
142 |
143 | @Override
144 | public void onAttachedToWindow() {
145 | super.onAttachedToWindow();
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/app/src/main/java/com/silvestr/dotprogressbarexample/SecondActivity.java:
--------------------------------------------------------------------------------
1 | package com.silvestr.dotprogressbarexample;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.app.AppCompatActivity;
6 |
7 | /**
8 | * @author silvestr.predko
9 | */
10 |
11 | public class SecondActivity extends AppCompatActivity {
12 |
13 | @Override
14 | protected void onCreate(@Nullable Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | setContentView(R.layout.second_activity);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
18 |
19 |
31 |
32 |
45 |
46 |
56 |
57 |
68 |
69 |
86 |
87 |
103 |
104 |
112 |
113 |
114 |
123 |
124 |
125 |
126 |
138 |
139 |
140 |
141 |
151 |
152 |
153 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/second_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_account_circle_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silvestrpredko/DotProgressBarExample/2ad0496bc757cab147c7000ed0e095aa70987fb4/app/src/main/res/mipmap-hdpi/ic_account_circle_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silvestrpredko/DotProgressBarExample/2ad0496bc757cab147c7000ed0e095aa70987fb4/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_account_circle_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silvestrpredko/DotProgressBarExample/2ad0496bc757cab147c7000ed0e095aa70987fb4/app/src/main/res/mipmap-mdpi/ic_account_circle_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silvestrpredko/DotProgressBarExample/2ad0496bc757cab147c7000ed0e095aa70987fb4/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_account_circle_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silvestrpredko/DotProgressBarExample/2ad0496bc757cab147c7000ed0e095aa70987fb4/app/src/main/res/mipmap-xhdpi/ic_account_circle_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silvestrpredko/DotProgressBarExample/2ad0496bc757cab147c7000ed0e095aa70987fb4/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_account_circle_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silvestrpredko/DotProgressBarExample/2ad0496bc757cab147c7000ed0e095aa70987fb4/app/src/main/res/mipmap-xxhdpi/ic_account_circle_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silvestrpredko/DotProgressBarExample/2ad0496bc757cab147c7000ed0e095aa70987fb4/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_account_circle_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silvestrpredko/DotProgressBarExample/2ad0496bc757cab147c7000ed0e095aa70987fb4/app/src/main/res/mipmap-xxxhdpi/ic_account_circle_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silvestrpredko/DotProgressBarExample/2ad0496bc757cab147c7000ed0e095aa70987fb4/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #FFEBEE
5 | #FFCDD2
6 | #EF9A9A
7 | #E57373
8 | #EF5350
9 | #F44336
10 | #E53935
11 | #D32F2F
12 | #C62828
13 | #B71C1C
14 | #FF8A80
15 | #FF5252
16 | #FF1744
17 | #D50000
18 |
19 |
20 | #FCE4EC
21 | #F8BBD0
22 | #F48FB1
23 | #F06292
24 | #EC407A
25 | #E91E63
26 | #D81B60
27 | #C2185B
28 | #AD1457
29 | #880E4F
30 | #FF80AB
31 | #FF4081
32 | #F50057
33 | #C51162
34 |
35 |
36 | #F3E5F5
37 | #E1BEE7
38 | #CE93D8
39 | #BA68C8
40 | #AB47BC
41 | #9C27B0
42 | #8E24AA
43 | #7B1FA2
44 | #6A1B9A
45 | #4A148C
46 | #EA80FC
47 | #E040FB
48 | #D500F9
49 | #AA00FF
50 |
51 |
52 | #EDE7F6
53 | #D1C4E9
54 | #B39DDB
55 | #9575CD
56 | #7E57C2
57 | #673AB7
58 | #5E35B1
59 | #512DA8
60 | #4527A0
61 | #311B92
62 | #B388FF
63 | #7C4DFF
64 | #651FFF
65 | #6200EA
66 |
67 |
68 | #E8EAF6
69 | #C5CAE9
70 | #9FA8DA
71 | #7986CB
72 | #5C6BC0
73 | #3F51B5
74 | #3949AB
75 | #303F9F
76 | #283593
77 | #1A237E
78 | #8C9EFF
79 | #536DFE
80 | #3D5AFE
81 | #304FFE
82 |
83 |
84 | #E3F2FD
85 | #BBDEFB
86 | #90CAF9
87 | #64B5F6
88 | #42A5F5
89 | #2196F3
90 | #1E88E5
91 | #1976D2
92 | #1565C0
93 | #0D47A1
94 | #82B1FF
95 | #448AFF
96 | #2979FF
97 | #2962FF
98 |
99 |
100 | #E1F5FE
101 | #B3E5FC
102 | #81D4fA
103 | #4fC3F7
104 | #29B6FC
105 | #03A9F4
106 | #039BE5
107 | #0288D1
108 | #0277BD
109 | #01579B
110 | #80D8FF
111 | #40C4FF
112 | #00B0FF
113 | #0091EA
114 |
115 |
116 | #E0F7FA
117 | #B2EBF2
118 | #80DEEA
119 | #4DD0E1
120 | #26C6DA
121 | #00BCD4
122 | #00ACC1
123 | #0097A7
124 | #00838F
125 | #006064
126 | #84FFFF
127 | #18FFFF
128 | #00E5FF
129 | #00B8D4
130 |
131 |
132 | #E0F2F1
133 | #B2DFDB
134 | #80CBC4
135 | #4DB6AC
136 | #26A69A
137 | #009688
138 | #00897B
139 | #00796B
140 | #00695C
141 | #004D40
142 | #A7FFEB
143 | #64FFDA
144 | #1DE9B6
145 | #00BFA5
146 |
147 |
148 | #E8F5E9
149 | #C8E6C9
150 | #A5D6A7
151 | #81C784
152 | #66BB6A
153 | #4CAF50
154 | #43A047
155 | #388E3C
156 | #2E7D32
157 | #1B5E20
158 | #B9F6CA
159 | #69F0AE
160 | #00E676
161 | #00C853
162 |
163 |
164 | #F1F8E9
165 | #DCEDC8
166 | #C5E1A5
167 | #AED581
168 | #9CCC65
169 | #8BC34A
170 | #7CB342
171 | #689F38
172 | #558B2F
173 | #33691E
174 | #CCFF90
175 | #B2FF59
176 | #76FF03
177 | #64DD17
178 |
179 |
180 | #F9FBE7
181 | #F0F4C3
182 | #E6EE9C
183 | #DCE775
184 | #D4E157
185 | #CDDC39
186 | #C0CA33
187 | #A4B42B
188 | #9E9D24
189 | #827717
190 | #F4FF81
191 | #EEFF41
192 | #C6FF00
193 | #AEEA00
194 |
195 |
196 | #FFFDE7
197 | #FFF9C4
198 | #FFF590
199 | #FFF176
200 | #FFEE58
201 | #FFEB3B
202 | #FDD835
203 | #FBC02D
204 | #F9A825
205 | #F57F17
206 | #FFFF82
207 | #FFFF00
208 | #FFEA00
209 | #FFD600
210 |
211 |
212 | #FFF8E1
213 | #FFECB3
214 | #FFE082
215 | #FFD54F
216 | #FFCA28
217 | #FFC107
218 | #FFB300
219 | #FFA000
220 | #FF8F00
221 | #FF6F00
222 | #FFE57F
223 | #FFD740
224 | #FFC400
225 | #FFAB00
226 |
227 |
228 | #FFF3E0
229 | #FFE0B2
230 | #FFCC80
231 | #FFB74D
232 | #FFA726
233 | #FF9800
234 | #FB8C00
235 | #F57C00
236 | #EF6C00
237 | #E65100
238 | #FFD180
239 | #FFAB40
240 | #FF9100
241 | #FF6D00
242 |
243 |
244 | #FBE9A7
245 | #FFCCBC
246 | #FFAB91
247 | #FF8A65
248 | #FF7043
249 | #FF5722
250 | #F4511E
251 | #E64A19
252 | #D84315
253 | #BF360C
254 | #FF9E80
255 | #FF6E40
256 | #FF3D00
257 | #DD2600
258 |
259 |
260 | #EFEBE9
261 | #D7CCC8
262 | #BCAAA4
263 | #A1887F
264 | #8D6E63
265 | #795548
266 | #6D4C41
267 | #5D4037
268 | #4E342E
269 | #3E2723
270 |
271 |
272 | #FAFAFA
273 | #F5F5F5
274 | #EEEEEE
275 | #E0E0E0
276 | #BDBDBD
277 | #9E9E9E
278 | #757575
279 | #616161
280 | #424242
281 | #212121
282 | #000000
283 | #ffffff
284 |
285 |
286 | #ECEFF1
287 | #CFD8DC
288 | #B0BBC5
289 | #90A4AE
290 | #78909C
291 | #607D8B
292 | #546E7A
293 | #455A64
294 | #37474F
295 | #263238
296 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | DotProgressBarExample
3 |
4 | Hello world!
5 | Settings
6 | is typing
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.2.3'
9 | // classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.3.1'
10 | // classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 |
14 | // NOTE: Do not place your application dependencies here; they belong
15 | // in the individual module build.gradle files
16 | }
17 | }
18 |
19 | allprojects {
20 | repositories {
21 | jcenter()
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/dot-progress-bar/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/dot-progress-bar/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | ext {
4 | bintrayRepo = 'maven'
5 | bintrayName = 'dot-progress-bar'
6 |
7 | PUBLISH_GROUP_ID = 'com.github.silvestrpredko'
8 | libraryName = 'DotProgressBar'
9 | PUBLISH_ARTIFACT_ID = 'dot-progress-bar'
10 |
11 | libraryDescription = 'simple progress bar'
12 |
13 | siteUrl = 'https://github.com/silvestrpredko/DotProgressBarExample'
14 | gitUrl = 'https://github.com/silvestrpredko/DotProgressBarExample.git'
15 |
16 | PUBLISH_VERSION = '1.1'
17 |
18 | developerId = 'silvestr1994'
19 | developerName = 'Silvestr Predko'
20 | developerEmail = 'Silvestr1994@gmail.com'
21 |
22 | licenseName = 'The Apache Software License, Version 2.0'
23 | licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
24 | allLicenses = ["Apache-2.0"]
25 | }
26 |
27 | android {
28 | compileSdkVersion 25
29 | buildToolsVersion "24.0.2"
30 |
31 | defaultConfig {
32 | minSdkVersion 14
33 | targetSdkVersion 25
34 | versionCode 4
35 | versionName "4.0"
36 | }
37 |
38 | buildTypes {
39 | release {
40 | minifyEnabled false
41 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
42 | }
43 | }
44 | }
45 |
46 | dependencies {
47 | compile fileTree(dir: 'libs', include: ['*.jar'])
48 | compile 'com.android.support:appcompat-v7:25.1.0'
49 | }
50 |
51 | apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'
52 |
--------------------------------------------------------------------------------
/dot-progress-bar/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 /home/silvestr/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 |
--------------------------------------------------------------------------------
/dot-progress-bar/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/dot-progress-bar/src/main/java/com/github/silvestrpredko/dotprogressbar/AnimationListener.java:
--------------------------------------------------------------------------------
1 | package com.github.silvestrpredko.dotprogressbar;
2 |
3 | import android.view.animation.Animation;
4 |
5 | /**
6 | * @author Silvestr Predko.
7 | */
8 | abstract class AnimationListener implements Animation.AnimationListener {
9 | @Override
10 | public void onAnimationStart(Animation animation) {
11 | // stub
12 | }
13 |
14 | @Override
15 | public void onAnimationEnd(Animation animation) {
16 | // stub
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/dot-progress-bar/src/main/java/com/github/silvestrpredko/dotprogressbar/DotProgressBar.java:
--------------------------------------------------------------------------------
1 | package com.github.silvestrpredko.dotprogressbar;
2 |
3 | import android.animation.ArgbEvaluator;
4 | import android.animation.ValueAnimator;
5 | import android.annotation.TargetApi;
6 | import android.content.Context;
7 | import android.content.res.TypedArray;
8 | import android.graphics.Canvas;
9 | import android.graphics.Color;
10 | import android.graphics.Paint;
11 | import android.os.Build;
12 | import android.support.annotation.ColorInt;
13 | import android.support.annotation.IntDef;
14 | import android.support.annotation.NonNull;
15 | import android.support.v4.content.ContextCompat;
16 | import android.util.AttributeSet;
17 | import android.view.View;
18 | import android.view.animation.Animation;
19 | import android.view.animation.LinearInterpolator;
20 | import android.view.animation.Transformation;
21 |
22 | import java.lang.annotation.Retention;
23 | import java.lang.annotation.RetentionPolicy;
24 |
25 | /**
26 | * @author Silvestr Predko.
27 | */
28 | public class DotProgressBar extends View {
29 |
30 | public static final int RIGHT_DIRECTION = 1;
31 | public static final int LEFT_DIRECTION = -1;
32 |
33 | /**
34 | * Dots amount
35 | */
36 | private int dotAmount;
37 |
38 | /**
39 | * Drawing tools
40 | */
41 | private Paint primaryPaint;
42 | private Paint startPaint;
43 | private Paint endPaint;
44 |
45 | /**
46 | * Animation tools
47 | */
48 | private long animationTime;
49 | private float animatedRadius;
50 | private boolean isFirstLaunch = true;
51 | private ValueAnimator startValueAnimator;
52 | private ValueAnimator endValueAnimator;
53 |
54 | /**
55 | * Circle size
56 | */
57 | private float dotRadius;
58 | private float bounceDotRadius;
59 | /**
60 | * Circle coordinates
61 | */
62 | private float xCoordinate;
63 | private int dotPosition;
64 |
65 | /**
66 | * Colors
67 | */
68 | private int startColor;
69 | private int endColor;
70 |
71 | /**
72 | * This value detect direction of circle animation direction
73 | * {@link DotProgressBar#RIGHT_DIRECTION} and {@link DotProgressBar#LEFT_DIRECTION}
74 | * */
75 | private int animationDirection;
76 |
77 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
78 | public DotProgressBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
79 | super(context, attrs, defStyleAttr, defStyleRes);
80 | initializeAttributes(attrs);
81 | init();
82 | }
83 |
84 | public DotProgressBar(Context context, AttributeSet attrs, int defStyleAttr) {
85 | super(context, attrs, defStyleAttr);
86 | initializeAttributes(attrs);
87 | init();
88 | }
89 |
90 | public DotProgressBar(Context context, AttributeSet attrs) {
91 | super(context, attrs);
92 | initializeAttributes(attrs);
93 | init();
94 | }
95 |
96 | public DotProgressBar(Context context) {
97 | super(context);
98 | initializeAttributes(null);
99 | init();
100 | }
101 |
102 | public static int darker(int color, float factor) {
103 | int a = Color.alpha(color);
104 | int r = Color.red(color);
105 | int g = Color.green(color);
106 | int b = Color.blue(color);
107 |
108 | return Color.argb(a,
109 | Math.max((int) (r * factor), 0),
110 | Math.max((int) (g * factor), 0),
111 | Math.max((int) (b * factor), 0));
112 | }
113 |
114 | @Override
115 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
116 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
117 | setMeasuredDimension(getMeasuredWidth(), getMeasuredHeight());
118 |
119 | if (getMeasuredHeight() > getMeasuredWidth()) {
120 | dotRadius = getMeasuredWidth() / dotAmount / 4;
121 | } else {
122 | dotRadius = getMeasuredHeight() / 4;
123 | }
124 |
125 | bounceDotRadius = dotRadius + (dotRadius / 3);
126 | float circlesWidth = (dotAmount * (dotRadius * 2)) + dotRadius * (dotAmount - 1);
127 | xCoordinate = (getMeasuredWidth() - circlesWidth) / 2 + dotRadius;
128 | }
129 |
130 | private void initializeAttributes(AttributeSet attrs) {
131 | if (attrs != null) {
132 | TypedArray a = getContext().getTheme().obtainStyledAttributes(
133 | attrs,
134 | R.styleable.DotProgressBar,
135 | 0, 0);
136 |
137 | try {
138 | setDotAmount(a.getInteger(R.styleable.DotProgressBar_amount, 5));
139 | setAnimationTime(animationTime = a.getInteger(
140 | R.styleable.DotProgressBar_duration,
141 | getResources().getInteger(android.R.integer.config_mediumAnimTime)
142 | ));
143 | setStartColor(
144 | a.getInteger(
145 | R.styleable.DotProgressBar_startColor,
146 | ContextCompat.getColor(getContext(), R.color.light_blue_A700)
147 | )
148 | );
149 | setEndColor(
150 | a.getInteger(
151 | R.styleable.DotProgressBar_endColor,
152 | ContextCompat.getColor(getContext(), R.color.light_blue_A400)
153 | )
154 | );
155 | setAnimationDirection(a.getInt(R.styleable.DotProgressBar_animationDirection, 1));
156 | } finally {
157 | a.recycle();
158 | }
159 |
160 | } else {
161 | setDotAmount(5);
162 | setAnimationTime(getResources().getInteger(android.R.integer.config_mediumAnimTime));
163 | setStartColor(ContextCompat.getColor(getContext(), R.color.light_blue_A700));
164 | setEndColor(ContextCompat.getColor(getContext(), R.color.light_blue_A400));
165 | setAnimationDirection(1);
166 | }
167 | }
168 |
169 | private void init() {
170 | primaryPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
171 | primaryPaint.setColor(startColor);
172 | primaryPaint.setStrokeJoin(Paint.Join.ROUND);
173 | primaryPaint.setStrokeCap(Paint.Cap.ROUND);
174 | primaryPaint.setStrokeWidth(20);
175 |
176 | startPaint = new Paint(primaryPaint);
177 | endPaint = new Paint(primaryPaint);
178 |
179 | startValueAnimator = ValueAnimator.ofInt(startColor, endColor);
180 | startValueAnimator.setDuration(animationTime);
181 | startValueAnimator.setEvaluator(new ArgbEvaluator());
182 | startValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
183 | @Override
184 | public void onAnimationUpdate(ValueAnimator animation) {
185 | startPaint.setColor(((Integer) animation.getAnimatedValue()));
186 | }
187 | });
188 |
189 | endValueAnimator = ValueAnimator.ofInt(endColor, startColor);
190 | endValueAnimator.setDuration(animationTime);
191 | endValueAnimator.setEvaluator(new ArgbEvaluator());
192 | endValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
193 | @Override
194 | public void onAnimationUpdate(ValueAnimator animation) {
195 | endPaint.setColor(((Integer) animation.getAnimatedValue()));
196 | }
197 | });
198 | }
199 |
200 | /**
201 | * setters
202 | * */
203 | void setDotAmount(int amount) {
204 | this.dotAmount = amount;
205 | }
206 |
207 | void setStartColor(@ColorInt int color) {
208 | this.startColor = color;
209 | }
210 |
211 | void setEndColor(@ColorInt int color) {
212 | this.endColor = color;
213 | }
214 |
215 | void setAnimationTime(long animationTime) {
216 | this.animationTime = animationTime;
217 | }
218 |
219 | private void setDotPosition(int dotPosition) {
220 | this.dotPosition = dotPosition;
221 | }
222 |
223 | /**
224 | * Set amount of dots, it will be restarted your view
225 | * @param amount number of dots, dot size automatically adjust
226 | * */
227 | public void changeDotAmount(int amount) {
228 | stopAnimation();
229 | setDotAmount(amount);
230 | setDotPosition(0);
231 | reinitialize();
232 | }
233 |
234 | /**
235 | * It will be restarted your view
236 | * */
237 | public void changeStartColor(@ColorInt int color) {
238 | stopAnimation();
239 | setStartColor(color);
240 | reinitialize();
241 | }
242 |
243 | /**
244 | * It will be restarted your view
245 | * */
246 | public void changeEndColor(@ColorInt int color) {
247 | stopAnimation();
248 | setEndColor(color);
249 | reinitialize();
250 | }
251 |
252 | /**
253 | * It will be restarted your view
254 | * */
255 | public void changeAnimationTime(long animationTime) {
256 | stopAnimation();
257 | setAnimationTime(animationTime);
258 | reinitialize();
259 | }
260 |
261 | /**
262 | * Change animation direction, doesn't restart view.
263 | * @param animationDirection left or right animation direction
264 | * */
265 | public void changeAnimationDirection(@AnimationDirection int animationDirection) {
266 | setAnimationDirection(animationDirection);
267 | }
268 |
269 | public int getAnimationDirection() {
270 | return animationDirection;
271 | }
272 |
273 | void setAnimationDirection(int direction) {
274 | this.animationDirection = direction;
275 | }
276 |
277 | /**
278 | * Reinitialize animators instances
279 | * */
280 | void reinitialize() {
281 | init();
282 | requestLayout();
283 | startAnimation();
284 | }
285 |
286 | private void drawCirclesLeftToRight(Canvas canvas, float radius) {
287 | float step = 0;
288 | for (int i = 0; i < dotAmount; i++) {
289 | drawCircles(canvas, i, step, radius);
290 | step += dotRadius * 3;
291 | }
292 | }
293 |
294 | private void drawCirclesRightToLeft(Canvas canvas, float radius) {
295 | float step = 0;
296 | for (int i = dotAmount - 1; i >= 0; i--) {
297 | drawCircles(canvas, i, step, radius);
298 | step += dotRadius * 3;
299 | }
300 | }
301 |
302 | private void drawCircles(@NonNull Canvas canvas, int i, float step, float radius) {
303 | if (dotPosition == i) {
304 | drawCircleUp(canvas, step, radius);
305 | } else {
306 | if ((i == (dotAmount - 1) && dotPosition == 0 && !isFirstLaunch) || ((dotPosition - 1) == i)) {
307 | drawCircleDown(canvas, step, radius);
308 | } else {
309 | drawCircle(canvas, step);
310 | }
311 | }
312 | }
313 |
314 | /**
315 | * Circle radius is grow
316 | * */
317 | private void drawCircleUp(@NonNull Canvas canvas, float step, float radius) {
318 | canvas.drawCircle(
319 | xCoordinate + step,
320 | getMeasuredHeight() / 2,
321 | dotRadius + radius,
322 | startPaint
323 | );
324 | }
325 |
326 | private void drawCircle(@NonNull Canvas canvas, float step) {
327 | canvas.drawCircle(
328 | xCoordinate + step,
329 | getMeasuredHeight() / 2,
330 | dotRadius,
331 | primaryPaint
332 | );
333 | }
334 |
335 | /**
336 | * Circle radius is decrease
337 | * */
338 | private void drawCircleDown(@NonNull Canvas canvas, float step, float radius) {
339 | canvas.drawCircle(
340 | xCoordinate + step,
341 | getMeasuredHeight() / 2,
342 | bounceDotRadius - radius,
343 | endPaint
344 | );
345 | }
346 |
347 | @Override
348 | protected void onDraw(Canvas canvas) {
349 | super.onDraw(canvas);
350 | if (animationDirection < 0) {
351 | drawCirclesRightToLeft(canvas, animatedRadius);
352 | } else {
353 | drawCirclesLeftToRight(canvas, animatedRadius);
354 | }
355 | }
356 |
357 | private void stopAnimation() {
358 | this.clearAnimation();
359 | postInvalidate();
360 | }
361 |
362 | private void startAnimation() {
363 | final BounceAnimation bounceAnimation = new BounceAnimation();
364 | bounceAnimation.setDuration(animationTime);
365 | bounceAnimation.setRepeatCount(Animation.INFINITE);
366 | bounceAnimation.setInterpolator(new LinearInterpolator());
367 | bounceAnimation.setAnimationListener(new AnimationListener() {
368 | @Override
369 | public void onAnimationRepeat(Animation animation) {
370 | dotPosition++;
371 | if (dotPosition == dotAmount) {
372 | dotPosition = 0;
373 | }
374 |
375 | startValueAnimator.start();
376 |
377 | if (!isFirstLaunch) {
378 | endValueAnimator.start();
379 | }
380 |
381 | isFirstLaunch = false;
382 | }
383 | });
384 | startAnimation(bounceAnimation);
385 | }
386 |
387 | @Override
388 | public void setVisibility(int visibility) {
389 | super.setVisibility(visibility);
390 |
391 | if (visibility == GONE || visibility == INVISIBLE) {
392 | stopAnimation();
393 | } else {
394 | startAnimation();
395 | }
396 | }
397 |
398 | @Override
399 | protected void onDetachedFromWindow() {
400 | stopAnimation();
401 | super.onDetachedFromWindow();
402 | }
403 |
404 | @Override
405 | protected void onAttachedToWindow() {
406 | super.onAttachedToWindow();
407 | startAnimation();
408 | }
409 |
410 | @Retention(RetentionPolicy.SOURCE)
411 | @IntDef({RIGHT_DIRECTION, LEFT_DIRECTION})
412 | public @interface AnimationDirection {}
413 |
414 | private class BounceAnimation extends Animation {
415 | @Override
416 | protected void applyTransformation(float interpolatedTime, Transformation t) {
417 | super.applyTransformation(interpolatedTime, t);
418 | animatedRadius = (bounceDotRadius - dotRadius) * interpolatedTime;
419 | invalidate();
420 | }
421 | }
422 | }
--------------------------------------------------------------------------------
/dot-progress-bar/src/main/java/com/github/silvestrpredko/dotprogressbar/DotProgressBarBuilder.java:
--------------------------------------------------------------------------------
1 | package com.github.silvestrpredko.dotprogressbar;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.ColorInt;
5 | import android.support.annotation.NonNull;
6 |
7 | /**
8 | * @author Silvestr Predko.
9 | */
10 | public class DotProgressBarBuilder {
11 |
12 | private DotProgressBar dotProgressBar;
13 |
14 | public DotProgressBarBuilder(@NonNull Context context) {
15 | dotProgressBar = new DotProgressBar(context);
16 | }
17 |
18 | public DotProgressBarBuilder setDotAmount(int amount) {
19 | dotProgressBar.setDotAmount(amount);
20 | return this;
21 | }
22 |
23 | public DotProgressBarBuilder setStartColor(@ColorInt int color) {
24 | dotProgressBar.setStartColor(color);
25 | return this;
26 | }
27 |
28 | public DotProgressBarBuilder setEndColor(@ColorInt int color) {
29 | dotProgressBar.setEndColor(color);
30 | return this;
31 | }
32 |
33 | public DotProgressBarBuilder setAnimationTime(long animationTime) {
34 | dotProgressBar.setAnimationTime(animationTime);
35 | return this;
36 | }
37 |
38 | public DotProgressBarBuilder setAnimationDirection(
39 | @DotProgressBar.AnimationDirection int direction) {
40 | dotProgressBar.setAnimationDirection(direction);
41 | return this;
42 | }
43 |
44 | public DotProgressBar build() {
45 | dotProgressBar.reinitialize();
46 | return dotProgressBar;
47 | }
48 | }
--------------------------------------------------------------------------------
/dot-progress-bar/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/dot-progress-bar/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFEBEE
4 | #FFCDD2
5 | #EF9A9A
6 | #E57373
7 | #EF5350
8 | #F44336
9 | #E53935
10 | #D32F2F
11 | #C62828
12 | #B71C1C
13 | #FF8A80
14 | #FF5252
15 | #FF1744
16 | #D50000
17 |
18 | #EDE7F6
19 | #D1C4E9
20 | #B39DDB
21 | #9575CD
22 | #7E57C2
23 | #673AB7
24 | #5E35B1
25 | #512DA8
26 | #4527A0
27 | #311B92
28 | #B388FF
29 | #7C4DFF
30 | #651FFF
31 | #6200EA
32 |
33 | #E1F5FE
34 | #B3E5FC
35 | #81D4FA
36 | #4FC3F7
37 | #29B6F6
38 | #03A9F4
39 | #039BE5
40 | #0288D1
41 | #0277BD
42 | #01579B
43 | #80D8FF
44 | #40C4FF
45 | #00B0FF
46 | #0091EA
47 |
48 | #E8F5E9
49 | #C8E6C9
50 | #A5D6A7
51 | #81C784
52 | #66BB6A
53 | #4CAF50
54 | #43A047
55 | #388E3C
56 | #2E7D32
57 | #1B5E20
58 | #B9F6CA
59 | #69F0AE
60 | #00E676
61 | #00C853
62 |
63 | #FFFDE7
64 | #FFF9C4
65 | #FFF59D
66 | #FFF176
67 | #FFEE58
68 | #FFEB3B
69 | #FDD835
70 | #FBC02D
71 | #F9A825
72 | #F57F17
73 | #FFFF8D
74 | #FFFF00
75 | #FFEA00
76 | #FFD600
77 |
78 | #FBE9E7
79 | #FFCCBC
80 | #FFAB91
81 | #FF8A65
82 | #FF7043
83 | #FF5722
84 | #F4511E
85 | #E64A19
86 | #D84315
87 | #BF360C
88 | #FF9E80
89 | #FF6E40
90 | #FF3D00
91 | #DD2C00
92 |
93 | #ECEFF1
94 | #CFD8DC
95 | #B0BEC5
96 | #90A4AE
97 | #78909C
98 | #607D8B
99 | #546E7A
100 | #455A64
101 | #37474F
102 | #263238
103 |
104 | #FCE4EC
105 | #F8BBD0
106 | #F48FB1
107 | #F06292
108 | #EC407A
109 | #E91E63
110 | #D81B60
111 | #C2185B
112 | #AD1457
113 | #880E4F
114 | #FF80AB
115 | #FF4081
116 | #F50057
117 | #C51162
118 |
119 | #E8EAF6
120 | #C5CAE9
121 | #9FA8DA
122 | #7986CB
123 | #5C6BC0
124 | #3F51B5
125 | #3949AB
126 | #303F9F
127 | #283593
128 | #1A237E
129 | #8C9EFF
130 | #536DFE
131 | #3D5AFE
132 | #304FFE
133 |
134 | #E0F7FA
135 | #B2EBF2
136 | #80DEEA
137 | #4DD0E1
138 | #26C6DA
139 | #00BCD4
140 | #00ACC1
141 | #0097A7
142 | #00838F
143 | #006064
144 | #84FFFF
145 | #18FFFF
146 | #00E5FF
147 | #00B8D4
148 |
149 | #F1F8E9
150 | #DCEDC8
151 | #C5E1A5
152 | #AED581
153 | #9CCC65
154 | #8BC34A
155 | #7CB342
156 | #689F38
157 | #558B2F
158 | #33691E
159 | #CCFF90
160 | #B2FF59
161 | #76FF03
162 | #64DD17
163 |
164 | #FFF8E1
165 | #FFECB3
166 | #FFE082
167 | #FFD54F
168 | #FFCA28
169 | #FFC107
170 | #FFB300
171 | #FFA000
172 | #FF8F00
173 | #FF6F00
174 | #FFE57F
175 | #FFD740
176 | #FFC400
177 | #FFAB00
178 |
179 | #EFEBE9
180 | #D7CCC8
181 | #BCAAA4
182 | #A1887F
183 | #8D6E63
184 | #795548
185 | #6D4C41
186 | #5D4037
187 | #4E342E
188 | #3E2723
189 |
190 | #F3E5F5
191 | #E1BEE7
192 | #CE93D8
193 | #BA68C8
194 | #AB47BC
195 | #9C27B0
196 | #8E24AA
197 | #7B1FA2
198 | #6A1B9A
199 | #4A148C
200 | #EA80FC
201 | #E040FB
202 | #D500F9
203 | #AA00FF
204 |
205 | #E3F2FD
206 | #BBDEFB
207 | #90CAF9
208 | #64B5F6
209 | #42A5F5
210 | #2196F3
211 | #1E88E5
212 | #1976D2
213 | #1565C0
214 | #0D47A1
215 | #82B1FF
216 | #448AFF
217 | #2979FF
218 | #2962FF
219 |
220 | #E0F2F1
221 | #B2DFDB
222 | #80CBC4
223 | #4DB6AC
224 | #26A69A
225 | #009688
226 | #00897B
227 | #00796B
228 | #00695C
229 | #004D40
230 | #A7FFEB
231 | #64FFDA
232 | #1DE9B6
233 | #00BFA5
234 |
235 | #F9FBE7
236 | #F0F4C3
237 | #E6EE9C
238 | #DCE775
239 | #D4E157
240 | #CDDC39
241 | #C0CA33
242 | #AFB42B
243 | #9E9D24
244 | #827717
245 | #F4FF81
246 | #EEFF41
247 | #C6FF00
248 | #AEEA00
249 |
250 | #FFF3E0
251 | #FFE0B2
252 | #FFCC80
253 | #FFB74D
254 | #FFA726
255 | #FF9800
256 | #FB8C00
257 | #F57C00
258 | #EF6C00
259 | #E65100
260 | #FFD180
261 | #FFAB40
262 | #FF9100
263 | #FF6D00
264 |
265 | #FAFAFA
266 | #F5F5F5
267 | #EEEEEE
268 | #E0E0E0
269 | #BDBDBD
270 | #9E9E9E
271 | #757575
272 | #616161
273 | #424242
274 | #212121
275 |
276 | #000000
277 | #FFFFFF
278 |
--------------------------------------------------------------------------------
/dot-progress-bar/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | DotProgressBar
3 |
4 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':dot-progress-bar'
2 |
--------------------------------------------------------------------------------