Skip to content

Commit 315d157

Browse files
committed
Add custom StepProgressBar view.
1 parent a61be00 commit 315d157

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1124
-0
lines changed

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 28
5+
defaultConfig {
6+
applicationId "stepprogressbar.sbodi.com.stepprogressbar"
7+
minSdkVersion 21
8+
targetSdkVersion 28
9+
versionCode 1
10+
versionName "1.0"
11+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12+
}
13+
buildTypes {
14+
release {
15+
minifyEnabled false
16+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17+
}
18+
}
19+
}
20+
21+
dependencies {
22+
implementation fileTree(dir: 'libs', include: ['*.jar'])
23+
implementation 'com.android.support:appcompat-v7:28.0.0'
24+
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
25+
implementation 'com.android.support:design:28.0.0'
26+
testImplementation 'junit:junit:4.12'
27+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
28+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
29+
api project (":library")
30+
}

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

app/src/main/AndroidManifest.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.sbodi.stepprogressbar">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:supportsRtl="true"
10+
android:theme="@style/AppTheme">
11+
<activity
12+
android:name=".MainActivity"
13+
android:label="@string/app_name"
14+
android:theme="@style/AppTheme.NoActionBar">
15+
<intent-filter>
16+
<action android:name="android.intent.action.MAIN" />
17+
<category android:name="android.intent.category.LAUNCHER" />
18+
</intent-filter>
19+
</activity>
20+
</application>
21+
22+
</manifest>
Binary file not shown.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.sbodi.stepprogressbar;
2+
3+
import android.os.Bundle;
4+
import android.os.Handler;
5+
import android.os.Looper;
6+
import android.os.Message;
7+
import android.support.v7.app.AppCompatActivity;
8+
9+
import com.sbodi.stepprogressbar.library.view.StepProgressBar;
10+
11+
12+
public class MainActivity extends AppCompatActivity {
13+
14+
private StepProgressBar mStepProgressBar;
15+
private Handler mUIHandler;
16+
private int mCurrentStep = 0;
17+
18+
@Override
19+
protected void onCreate(Bundle savedInstanceState) {
20+
super.onCreate(savedInstanceState);
21+
setContentView(R.layout.activity_main);
22+
mStepProgressBar = (StepProgressBar) findViewById(R.id.step_progress_view);
23+
final int totalSteps = getResources().getInteger(R.integer.default_no_steps);
24+
mUIHandler = new Handler(Looper.getMainLooper()) {
25+
@Override
26+
public void handleMessage(Message msg) {
27+
if (mCurrentStep >= totalSteps) {
28+
mCurrentStep = 0;
29+
}
30+
mStepProgressBar.updateStepState(mCurrentStep++);
31+
mUIHandler.sendEmptyMessageDelayed(0, 2000);
32+
}
33+
};
34+
mUIHandler.sendEmptyMessage(0);
35+
}
36+
37+
}
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:width="108dp"
4+
android:height="108dp"
5+
android:viewportHeight="108"
6+
android:viewportWidth="108">
7+
<path
8+
android:fillColor="#26A69A"
9+
android:pathData="M0,0h108v108h-108z" />
10+
<path
11+
android:fillColor="#00000000"
12+
android:pathData="M9,0L9,108"
13+
android:strokeColor="#33FFFFFF"
14+
android:strokeWidth="0.8" />
15+
<path
16+
android:fillColor="#00000000"
17+
android:pathData="M19,0L19,108"
18+
android:strokeColor="#33FFFFFF"
19+
android:strokeWidth="0.8" />
20+
<path
21+
android:fillColor="#00000000"
22+
android:pathData="M29,0L29,108"
23+
android:strokeColor="#33FFFFFF"
24+
android:strokeWidth="0.8" />
25+
<path
26+
android:fillColor="#00000000"
27+
android:pathData="M39,0L39,108"
28+
android:strokeColor="#33FFFFFF"
29+
android:strokeWidth="0.8" />
30+
<path
31+
android:fillColor="#00000000"
32+
android:pathData="M49,0L49,108"
33+
android:strokeColor="#33FFFFFF"
34+
android:strokeWidth="0.8" />
35+
<path
36+
android:fillColor="#00000000"
37+
android:pathData="M59,0L59,108"
38+
android:strokeColor="#33FFFFFF"
39+
android:strokeWidth="0.8" />
40+
<path
41+
android:fillColor="#00000000"
42+
android:pathData="M69,0L69,108"
43+
android:strokeColor="#33FFFFFF"
44+
android:strokeWidth="0.8" />
45+
<path
46+
android:fillColor="#00000000"
47+
android:pathData="M79,0L79,108"
48+
android:strokeColor="#33FFFFFF"
49+
android:strokeWidth="0.8" />
50+
<path
51+
android:fillColor="#00000000"
52+
android:pathData="M89,0L89,108"
53+
android:strokeColor="#33FFFFFF"
54+
android:strokeWidth="0.8" />
55+
<path
56+
android:fillColor="#00000000"
57+
android:pathData="M99,0L99,108"
58+
android:strokeColor="#33FFFFFF"
59+
android:strokeWidth="0.8" />
60+
<path
61+
android:fillColor="#00000000"
62+
android:pathData="M0,9L108,9"
63+
android:strokeColor="#33FFFFFF"
64+
android:strokeWidth="0.8" />
65+
<path
66+
android:fillColor="#00000000"
67+
android:pathData="M0,19L108,19"
68+
android:strokeColor="#33FFFFFF"
69+
android:strokeWidth="0.8" />
70+
<path
71+
android:fillColor="#00000000"
72+
android:pathData="M0,29L108,29"
73+
android:strokeColor="#33FFFFFF"
74+
android:strokeWidth="0.8" />
75+
<path
76+
android:fillColor="#00000000"
77+
android:pathData="M0,39L108,39"
78+
android:strokeColor="#33FFFFFF"
79+
android:strokeWidth="0.8" />
80+
<path
81+
android:fillColor="#00000000"
82+
android:pathData="M0,49L108,49"
83+
android:strokeColor="#33FFFFFF"
84+
android:strokeWidth="0.8" />
85+
<path
86+
android:fillColor="#00000000"
87+
android:pathData="M0,59L108,59"
88+
android:strokeColor="#33FFFFFF"
89+
android:strokeWidth="0.8" />
90+
<path
91+
android:fillColor="#00000000"
92+
android:pathData="M0,69L108,69"
93+
android:strokeColor="#33FFFFFF"
94+
android:strokeWidth="0.8" />
95+
<path
96+
android:fillColor="#00000000"
97+
android:pathData="M0,79L108,79"
98+
android:strokeColor="#33FFFFFF"
99+
android:strokeWidth="0.8" />
100+
<path
101+
android:fillColor="#00000000"
102+
android:pathData="M0,89L108,89"
103+
android:strokeColor="#33FFFFFF"
104+
android:strokeWidth="0.8" />
105+
<path
106+
android:fillColor="#00000000"
107+
android:pathData="M0,99L108,99"
108+
android:strokeColor="#33FFFFFF"
109+
android:strokeWidth="0.8" />
110+
<path
111+
android:fillColor="#00000000"
112+
android:pathData="M19,29L89,29"
113+
android:strokeColor="#33FFFFFF"
114+
android:strokeWidth="0.8" />
115+
<path
116+
android:fillColor="#00000000"
117+
android:pathData="M19,39L89,39"
118+
android:strokeColor="#33FFFFFF"
119+
android:strokeWidth="0.8" />
120+
<path
121+
android:fillColor="#00000000"
122+
android:pathData="M19,49L89,49"
123+
android:strokeColor="#33FFFFFF"
124+
android:strokeWidth="0.8" />
125+
<path
126+
android:fillColor="#00000000"
127+
android:pathData="M19,59L89,59"
128+
android:strokeColor="#33FFFFFF"
129+
android:strokeWidth="0.8" />
130+
<path
131+
android:fillColor="#00000000"
132+
android:pathData="M19,69L89,69"
133+
android:strokeColor="#33FFFFFF"
134+
android:strokeWidth="0.8" />
135+
<path
136+
android:fillColor="#00000000"
137+
android:pathData="M19,79L89,79"
138+
android:strokeColor="#33FFFFFF"
139+
android:strokeWidth="0.8" />
140+
<path
141+
android:fillColor="#00000000"
142+
android:pathData="M29,19L29,89"
143+
android:strokeColor="#33FFFFFF"
144+
android:strokeWidth="0.8" />
145+
<path
146+
android:fillColor="#00000000"
147+
android:pathData="M39,19L39,89"
148+
android:strokeColor="#33FFFFFF"
149+
android:strokeWidth="0.8" />
150+
<path
151+
android:fillColor="#00000000"
152+
android:pathData="M49,19L49,89"
153+
android:strokeColor="#33FFFFFF"
154+
android:strokeWidth="0.8" />
155+
<path
156+
android:fillColor="#00000000"
157+
android:pathData="M59,19L59,89"
158+
android:strokeColor="#33FFFFFF"
159+
android:strokeWidth="0.8" />
160+
<path
161+
android:fillColor="#00000000"
162+
android:pathData="M69,19L69,89"
163+
android:strokeColor="#33FFFFFF"
164+
android:strokeWidth="0.8" />
165+
<path
166+
android:fillColor="#00000000"
167+
android:pathData="M79,19L79,89"
168+
android:strokeColor="#33FFFFFF"
169+
android:strokeWidth="0.8" />
170+
</vector>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:layout_height="match_parent"
6+
android:layout_width="match_parent">
7+
8+
<RelativeLayout
9+
android:id="@+id/checkout_progress_view_container"
10+
android:layout_width="match_parent"
11+
android:layout_height="100dp"
12+
android:background="@color/default_steps_view_background_color"
13+
android:clipChildren="false">
14+
15+
<com.sbodi.stepprogressbar.library.view.StepProgressBar
16+
android:id="@+id/step_progress_view"
17+
android:layout_width="match_parent"
18+
android:layout_height="wrap_content"
19+
android:layout_centerInParent="true"
20+
android:layout_marginStart="30dp"
21+
android:layout_marginEnd="30dp"
22+
app:stepProgressBarBackgroundColor="@color/default_steps_view_background_color"
23+
app:stepProgressBarCircleRadius="@dimen/dimen_15dp"
24+
app:stepProgressBarCompletedDrawable="@drawable/timeline_completed"
25+
app:stepProgressBarCompletedLineColor="@android:color/white"
26+
app:stepProgressBarCurrentDrawable="@drawable/timeline_active"
27+
app:stepProgressBarFutureDrawable="@drawable/timeline_upcoming"
28+
app:stepProgressBarFutureLineColor="@color/default_steps_view_future_line_color"
29+
app:stepProgressBarLineHeight="@dimen/default_line_height"
30+
app:stepProgressBarTitleTextColor="@android:color/white"
31+
app:stepProgressBarTitleTextSize="@dimen/default_text_size"
32+
app:stepProgressBarTitlesList="@array/step_progress_titles"
33+
app:stepProgressBarTotalSteps="@integer/default_no_steps"
34+
app:stepProgressBarTitleFont="interstate_regular.ttf"/>
35+
36+
</RelativeLayout>
37+
38+
</RelativeLayout>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent"
7+
app:layout_behavior="@string/appbar_scrolling_view_behavior"
8+
tools:context=".MainActivity"
9+
tools:showIn="@layout/activity_main">
10+
11+
<TextView
12+
android:layout_width="wrap_content"
13+
android:layout_height="wrap_content"
14+
android:text="Hello World!"
15+
app:layout_constraintBottom_toBottomOf="parent"
16+
app:layout_constraintLeft_toLeftOf="parent"
17+
app:layout_constraintRight_toRightOf="parent"
18+
app:layout_constraintTop_toTopOf="parent" />
19+
20+
</android.support.constraint.ConstraintLayout>
2.98 KB
Loading
4.46 KB
Loading
6.31 KB
Loading
9.03 KB
Loading

app/src/main/res/values/colors.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="colorPrimary">#3F51B5</color>
4+
<color name="colorPrimaryDark">#303F9F</color>
5+
<color name="colorAccent">#FF4081</color>
6+
<color name="default_steps_view_future_line_color">#8d7b99</color>
7+
<color name="default_steps_view_background_color">#3F51B5</color>
8+
</resources>

app/src/main/res/values/dimens.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<resources>
2+
<dimen name="default_line_height">2dp</dimen>
3+
<dimen name="default_text_size">10sp</dimen>
4+
<dimen name="dimen_15dp">10dp</dimen>
5+
</resources>

app/src/main/res/values/integer.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<integer name="default_no_steps">3</integer>
4+
</resources>

app/src/main/res/values/strings.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<resources>
2+
<string name="app_name">StepProgressBar</string>
3+
<string name="action_settings">Settings</string>
4+
5+
<string-array name="step_progress_titles">
6+
<item>Step 1</item>
7+
<item>Step 2</item>
8+
<item>Step 3</item>
9+
</string-array>
10+
</resources>

0 commit comments

Comments
 (0)