I'm trying my first wrap.
I've started with this one: https://github.com/dmytrodanylyk/android-morphing-button
So far, I've had success creating both jar and xml files,
but they are not properly functional.
Specifically, I can't figure how to make the methods on the wrapper class work. The sample code of the library shows
I've tried already but I'm not sure how to code on my MorphingButtonWrapper, considering Params class and morph at MorphingButton..
I guess I need to set Params and then call morph(Params), but on B4A despite being able to add the view and set params, morph dont work.
Any help will be
appreciated
I've started with this one: https://github.com/dmytrodanylyk/android-morphing-button
So far, I've had success creating both jar and xml files,
but they are not properly functional.
Specifically, I can't figure how to make the methods on the wrapper class work. The sample code of the library shows
B4X:
// inside on click event
MorphingButton.Params circle = MorphingButton.Params.create()
.duration(500)
.cornerRadius(dimen(R.dimen.mb_height_56)) // 56 dp
.width(dimen(R.dimen.mb_height_56)) // 56 dp
.height(dimen(R.dimen.mb_height_56)) // 56 dp
.color(color(R.color.green)) // normal state color
.colorPressed(color(R.color.green_dark)) // pressed state color
.icon(R.drawable.ic_done); // icon
btnMorph.morph(circle);
I've tried already but I'm not sure how to code on my MorphingButtonWrapper, considering Params class and morph at MorphingButton..
B4X:
public static class Params {
private int cornerRadius;
private int width;
private int height;
private int color;
private int colorPressed;
private int duration;
private int icon;
private int strokeWidth;
private int strokeColor;
private String text;
private MorphingAnimation.Listener animationListener;
private Params() {
}
public static Params create() {
return new Params();
}
public Params text(@NonNull String text) {
this.text = text;
return this;
}
public Params icon(@DrawableRes int icon) {
this.icon = icon;
return this;
}
public Params cornerRadius(int cornerRadius) {
this.cornerRadius = cornerRadius;
return this;
}
public Params width(int width) {
this.width = width;
return this;
}
public Params height(int height) {
this.height = height;
return this;
}
public Params color(int color) {
this.color = color;
return this;
}
public Params colorPressed(int colorPressed) {
this.colorPressed = colorPressed;
return this;
}
public Params duration(int duration) {
this.duration = duration;
return this;
}
public Params strokeWidth(int strokeWidth) {
this.strokeWidth = strokeWidth;
return this;
}
public Params strokeColor(int strokeColor) {
this.strokeColor = strokeColor;
return this;
}
public Params animationListener(MorphingAnimation.Listener animationListener) {
this.animationListener = animationListener;
return this;
}
}
B4X:
public void morph(@NonNull Params params) {...
}
I guess I need to set Params and then call morph(Params), but on B4A despite being able to add the view and set params, morph dont work.
Any help will be
appreciated