Skip to content

Commit 6f9ffce

Browse files
committed
Added examples,
Fixed style
1 parent 7e15fa9 commit 6f9ffce

6 files changed

Lines changed: 84 additions & 11 deletions

File tree

app/src/main/java/com/github/nikartm/stripedprocessbutton/MainActivity.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,26 @@ public class MainActivity extends AppCompatActivity {
1111

1212
private StripedProcessButton stripedButton;
1313
private Button btnStop;
14+
private StripedProcessButton btn_2;
15+
private StripedProcessButton btn_3;
16+
private StripedProcessButton btn_4;
1417

1518
@Override
1619
protected void onCreate(Bundle savedInstanceState) {
1720
super.onCreate(savedInstanceState);
1821
setContentView(R.layout.activity_main);
1922
stripedButton = findViewById(R.id.btn_start);
2023
btnStop = findViewById(R.id.btn_stop);
24+
btn_2 = findViewById(R.id.btn_2);
25+
btn_3 = findViewById(R.id.btn_3);
26+
btn_4 = findViewById(R.id.btn_4);
2127

2228
stripedButton.setOnClickListener(v -> stripedButton.start());
2329
btnStop.setOnClickListener(v -> stripedButton.stop());
30+
stripedButton.adjustButton().setStripeWidth(20).setStripeGradient(false);
31+
32+
btn_2.start();
33+
btn_3.start();
34+
btn_4.start();
2435
}
2536
}

app/src/main/res/drawable/btn_rounded.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<shape xmlns:android="http://schemas.android.com/apk/res/android"
33
android:shape="rectangle">
44

5-
<solid android:color="#F95659"/>
5+
<solid android:color="#FF9800"/>
66
<corners android:radius="24dp" />
77

88
</shape>

app/src/main/res/layout/activity_main.xml

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<android.support.v7.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
2+
<LinearLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
34
xmlns:app="http://schemas.android.com/apk/res-auto"
45
xmlns:tools="http://schemas.android.com/tools"
56
android:layout_width="match_parent"
@@ -19,22 +20,22 @@
1920
<com.github.nikartm.support.StripedProcessButton
2021
android:id="@+id/btn_start"
2122
android:layout_width="match_parent"
22-
android:layout_height="44dp"
23+
android:layout_height="45dp"
2324
android:layout_marginBottom="8dp"
2425
android:layout_marginEnd="16dp"
2526
android:layout_marginStart="16dp"
2627
android:layout_marginTop="16dp"
2728
android:text="Start process"
2829
app:spb_loadingText="Loading..."
30+
app:spb_cornerRadius="25"
2931
android:clickable="true"
3032
android:focusable="true"
31-
android:textColor="#ffffff"
32-
app:spb_cornerRadius="10" />
33+
android:textColor="#ffffff" />
3334

3435
<Button
3536
android:id="@+id/btn_stop"
3637
android:layout_width="wrap_content"
37-
android:layout_height="wrap_content"
38+
android:layout_height="45dp"
3839
android:layout_marginStart="16dp"
3940
android:layout_marginTop="16dp"
4041
android:textSize="16dp"
@@ -44,4 +45,65 @@
4445
android:foreground="@drawable/ripple"
4546
android:text="Stop"/>
4647

47-
</android.support.v7.widget.LinearLayoutCompat>
48+
<com.github.nikartm.support.StripedProcessButton
49+
android:id="@+id/btn_2"
50+
android:layout_width="200dp"
51+
android:layout_height="70dp"
52+
android:layout_marginBottom="8dp"
53+
android:layout_marginEnd="16dp"
54+
android:layout_marginStart="16dp"
55+
android:layout_marginTop="40dp"
56+
android:text="Start process"
57+
app:spb_background="#283593"
58+
app:spb_mainStripColor="#283593"
59+
app:spb_subStripeColor="#E0E0E0"
60+
app:spb_stripeAlpha="0.5"
61+
app:spb_loadingText="Loading..."
62+
app:spb_cornerRadius="60"
63+
app:spb_stripeTilt="0"
64+
android:clickable="true"
65+
android:focusable="true"
66+
android:textColor="#ffffff" />
67+
68+
<com.github.nikartm.support.StripedProcessButton
69+
android:id="@+id/btn_3"
70+
android:layout_width="100dp"
71+
android:layout_height="100dp"
72+
android:layout_marginBottom="8dp"
73+
android:layout_marginEnd="16dp"
74+
android:layout_marginStart="16dp"
75+
android:layout_marginTop="16dp"
76+
android:clickable="true"
77+
android:focusable="true"
78+
android:textColor="#ffffff"
79+
android:text="Start process"
80+
android:layout_gravity="end"
81+
app:spb_stripeGradient="false"
82+
app:spb_stripeRevert="true"
83+
app:spb_background="#6D4C41"
84+
app:spb_mainStripColor="#6D4C41"
85+
app:spb_subStripeColor="#FF9800"
86+
app:spb_stripeAlpha="0.8"
87+
app:spb_loadingText="Loading..."
88+
app:spb_cornerRadius="270" />
89+
90+
<com.github.nikartm.support.StripedProcessButton
91+
android:id="@+id/btn_4"
92+
android:layout_width="match_parent"
93+
android:layout_height="wrap_content"
94+
android:layout_marginBottom="8dp"
95+
android:layout_marginEnd="16dp"
96+
android:layout_marginStart="16dp"
97+
android:layout_marginTop="16dp"
98+
android:text="Start process"
99+
app:spb_loadingText="Loading..."
100+
app:spb_stripeGradient="false"
101+
app:spb_stripeWidth="18dp"
102+
app:spb_subStripeColor="#ffffff"
103+
app:spb_background="#212121"
104+
app:spb_stripeDuration="120"
105+
android:clickable="true"
106+
android:focusable="true"
107+
android:textColor="#ffffff" />
108+
109+
</LinearLayout>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<color name="colorPrimary">#3F51B5</color>
4-
<color name="colorPrimaryDark">#303F9F</color>
3+
<color name="colorPrimary">#009688</color>
4+
<color name="colorPrimaryDark">#00796B</color>
55
<color name="colorAccent">#FF4081</color>
66
</resources>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<resources>
2-
<string name="app_name">StripedProcessButton-Android</string>
2+
<string name="app_name">StripedProcessButton</string>
33
</resources>

support/src/main/java/com/github/nikartm/support/constant/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class Constants {
1111

1212
public static final float STRIPE_WIDTH = 13f;
1313
public static final float STRIPE_ALPHA = 0.3f;
14-
public static final int CORNER = 25;
14+
public static final int CORNER = 0;
1515
public static final int STRIPE_TILT = 40;
1616
public static final int DURATION = 250;
1717
public static final boolean REVERT = false;

0 commit comments

Comments
 (0)