Skip to content

Commit 6ffac8c

Browse files
committed
Fixed example
1 parent a0f45d6 commit 6ffac8c

4 files changed

Lines changed: 47 additions & 50 deletions

File tree

app/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ android {
2727
targetCompatibility rootProject.ext.javaVersion
2828
sourceCompatibility rootProject.ext.javaVersion
2929
}
30+
31+
buildFeatures {
32+
viewBinding = true
33+
}
3034
}
3135

3236
dependencies {

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

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.github.nikartm.stripedprocessbutton
2+
3+
import android.os.Bundle
4+
import androidx.appcompat.app.AppCompatActivity
5+
import com.github.nikartm.stripedprocessbutton.databinding.ActivityMainBinding
6+
7+
class MainActivity : AppCompatActivity() {
8+
9+
private lateinit var binding: ActivityMainBinding
10+
11+
override fun onCreate(savedInstanceState: Bundle?) {
12+
super.onCreate(savedInstanceState)
13+
binding = ActivityMainBinding.inflate(layoutInflater)
14+
setContentView(binding.root)
15+
bindView()
16+
}
17+
18+
private fun bindView() = with(binding) {
19+
initStartStripedButton()
20+
btnStart.setOnClickListener {
21+
btnStart.start()
22+
btn2.start()
23+
btn3.start()
24+
btn4.start()
25+
}
26+
btnStop.setOnClickListener {
27+
btnStart.stop()
28+
btn2.stop()
29+
btn3.stop()
30+
btn4.stop()
31+
}
32+
}
33+
34+
private fun initStartStripedButton() = with(binding.btnStart) {
35+
text = "Start process"
36+
setCornerRadius(50f)
37+
setStripeAlpha(0.7f)
38+
setStripeRevert(true)
39+
setStripeGradient(false)
40+
setTilt(15f)
41+
}
42+
}

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="#FF9800"/>
5+
<solid android:color="#F44336"/>
66
<corners android:radius="24dp" />
77

88
</shape>

0 commit comments

Comments
 (0)