Skip to content

Commit 04ec898

Browse files
committed
Added adjust button programmatically
1 parent dccc4ce commit 04ec898

3 files changed

Lines changed: 4 additions & 161 deletions

File tree

support/src/main/java/com/github/nikartm/support/AnimatedStripedDrawable.java

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -52,55 +52,17 @@ public AnimatedStripedDrawable(Context context) {
5252
this.context = context;
5353
}
5454

55-
public AnimatedStripedDrawable(Context context,
56-
int colorBack,
57-
int colorMain,
58-
int colorSub,
59-
float alpha) {
60-
this.context = context;
61-
this.colorBack = colorBack;
62-
this.colorMain = colorMain;
63-
this.colorSub = colorSub;
64-
this.alpha = alpha;
65-
}
66-
67-
public AnimatedStripedDrawable(Context context,
68-
int colorBack,
69-
int colorMain,
70-
int colorSub,
71-
float alpha,
72-
int stripeWidth,
73-
int stripeTilt,
74-
float cornerRadius,
75-
int duration,
76-
boolean stripeRevert) {
77-
this.context = context;
78-
this.colorBack = colorBack;
79-
this.colorMain = colorMain;
80-
this.colorSub = colorSub;
81-
this.alpha = alpha;
82-
this.stripeWidth = stripeWidth;
83-
this.tilt = stripeTilt;
84-
this.cornerRadius = cornerRadius;
85-
this.duration = duration;
86-
this.stripeRevert = stripeRevert;
87-
}
88-
8955
@Override
9056
protected void onBoundsChange(Rect bounds) {
9157
super.onBoundsChange(bounds);
9258
density = context.getResources().getDisplayMetrics().density;
9359
viewHeight = bounds.height();
9460
viewWidth = bounds.width();
9561
adjustStripes();
96-
defineTilt();
9762
}
9863

9964
private void adjustStripes() {
10065
stripeWidth = stripeWidth * density;
101-
}
102-
103-
private void defineTilt() {
10466
if (!stripeRevert) {
10567
tiltLeft = tilt / density;
10668
tiltRight = 0;

support/src/main/java/com/github/nikartm/support/StripedProgressButton.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
*/
1313
public class StripedProgressButton extends AppCompatButton implements Animatable {
1414

15-
private AttributeController attrController;
1615
private AnimatedStripedDrawable stripedDrawable;
1716

1817
public StripedProgressButton(Context context) {
@@ -31,7 +30,7 @@ public StripedProgressButton(Context context, AttributeSet attrs, int defStyleAt
3130
}
3231

3332
private void initAttrs(AttributeSet attrs) {
34-
attrController = new AttributeController(getContext(), attrs);
33+
AttributeController attrController = new AttributeController(getContext(), attrs);
3534
stripedDrawable = attrController.getStripedDrawable();
3635
}
3736

@@ -61,4 +60,7 @@ public boolean isRunning() {
6160
return stripedDrawable.isRunning();
6261
}
6362

63+
public AnimatedStripedDrawable adjustButton() {
64+
return stripedDrawable;
65+
}
6466
}

support/src/main/java/com/github/nikartm/support/model/StrippedButton.java

Lines changed: 0 additions & 121 deletions
This file was deleted.

0 commit comments

Comments
 (0)