Java Question Error when make custom view wrapper

tuhatinhvn

Active Member
Licensed User
I am testing to make this library wrapper from Github: https://github.com/harjot-oberai/Croller/

This is my source wrapper, i has file aar include and jar extract from aar on Libs

B4X:
package com.example.b4acrollerwrapper;
        import android.view.View;
        import android.view.ViewGroup;
        import android.view.ViewParent;
        import anywheresoftware.b4a.BA;
        import anywheresoftware.b4a.BA.Hide;
        import anywheresoftware.b4a.BA.Pixel;
        import anywheresoftware.b4a.BA.ShortName;
        import anywheresoftware.b4a.BA.Version;
        import anywheresoftware.b4a.BALayout;
        import anywheresoftware.b4a.BALayout.LayoutParams;
        import anywheresoftware.b4a.keywords.Common;
        import anywheresoftware.b4a.keywords.Common.DesignerCustomView;
        import anywheresoftware.b4a.objects.LabelWrapper;
        import anywheresoftware.b4a.objects.PanelWrapper;
        import anywheresoftware.b4a.objects.ViewWrapper;
        import anywheresoftware.b4a.objects.collections.Map;
        import com.sdsmdg.harjot.crollerTest.Croller;
        import anywheresoftware.b4a.objects.CustomViewWrapper;
        import com.sdsmdg.harjot.crollerTest.OnCrollerChangeListener;

@BA.Version(1.0F)
@BA.ShortName("B4ACrollerWrapper")
@BA.DependsOn(values = {"croller-1.0.7.aar"})
public class B4ACrollerWrapper
        extends ViewWrapper<Croller>
        implements DesignerCustomView
{
    private BA ba;
    private String eventName;
    public void Initialize(BA paramBA, String paramString)
    {
        _initialize(paramBA, null, paramString);
    }
    @BA.Hide
    public void _initialize(final BA paramBA, Object paramObject, String paramString)
    {
        this.eventName = paramString.toLowerCase(BA.cul);
        this.ba = paramBA;
        setObject(new Croller(paramBA.context));
        ((Croller)getObject()).setOnCrollerChangeListener(new OnCrollerChangeListener()
        {
            @Override
            public void onProgressChanged(Croller croller, int progress) {
                if (paramBA.subExists(B4ACrollerWrapper.this.eventName + "_onProgressChanged"))
                {
                    BA.Log("lib:Raising.. " + B4ACrollerWrapper.this.eventName + "_onProgressChanged()");
                    paramBA.raiseEvent(paramBA.context, B4ACrollerWrapper.this.eventName + "_onProgressChanged", progress);
                }
                else
                {
                    BA.Log("lib: NOTFOUND '" + B4ACrollerWrapper.this.eventName + "_onProgressChanged");
                }
            }

            @Override
            public void onStartTrackingTouch(Croller croller) {
                if (paramBA.subExists(B4ACrollerWrapper.this.eventName + "_onStartTrackingTouch"))
                {
                    BA.Log("lib:Raising.. " + B4ACrollerWrapper.this.eventName + "_onStartTrackingTouch()");
                    paramBA.raiseEvent(paramBA.context, B4ACrollerWrapper.this.eventName + "_onStartTrackingTouch", null);
                }
                else
                {
                    BA.Log("lib: NOTFOUND '" + B4ACrollerWrapper.this.eventName + "_onStartTrackingTouch");
                }
            }

            @Override
            public void onStopTrackingTouch(Croller croller) {
                if (paramBA.subExists(B4ACrollerWrapper.this.eventName + "_onStopTrackingTouch"))
                {
                    BA.Log("lib:Raising.. " + B4ACrollerWrapper.this.eventName + "_onStopTrackingTouch()");
                    paramBA.raiseEvent(paramBA.context, B4ACrollerWrapper.this.eventName + "_onStopTrackingTouch", null);
                }
                else
                {
                    BA.Log("lib: NOTFOUND '" + B4ACrollerWrapper.this.eventName + "_onStopTrackingTouch");
                }
            }

        });
      
    }


    public boolean isEnabled() {
        return ((Croller)getObject()).isEnabled();
    }

    public void setEnabled(boolean enabled) {
        ((Croller)getObject()).setEnabled( enabled);
    }

    public int getProgress() {
        return ((Croller)getObject()).getProgress();
    }

    public void setProgress(int x) {
        ((Croller)getObject()).setProgress( x);
    }

    public String getLabel() {
        return ((Croller)getObject()).getLabel();
    }

    public void setLabel(String txt) {
        ((Croller)getObject()).setLabel( txt);
    }

    public int getBackCircleColor() {
        return ((Croller)getObject()).getBackCircleColor();
    }

    public void setBackCircleColor(int backCircleColor) {
        ((Croller)getObject()).setBackCircleColor( backCircleColor);
    }

    public int getMainCircleColor() {
        return ((Croller)getObject()).getMainCircleColor();
    }

    public void setMainCircleColor(int mainCircleColor) {
        ((Croller)getObject()).setMainCircleColor( mainCircleColor);
    }

    public int getIndicatorColor() {
        return ((Croller)getObject()).getIndicatorColor();
    }

    public void setIndicatorColor(int indicatorColor) {
        ((Croller)getObject()).setIndicatorColor( indicatorColor);
    }

    public int getProgressPrimaryColor() {
        return ((Croller)getObject()).getProgressPrimaryColor();
    }

    public void setProgressPrimaryColor(int progressPrimaryColor) {
        ((Croller)getObject()).setProgressPrimaryColor( progressPrimaryColor);
    }

    public int getProgressSecondaryColor() {
        return ((Croller)getObject()).getProgressSecondaryColor();
    }

    public void setProgressSecondaryColor(int progressSecondaryColor) {
        ((Croller)getObject()).setProgressSecondaryColor( progressSecondaryColor);
    }


    public float getLabelSize() {
        return ((Croller)getObject()).getLabelSize();
    }

    public void setLabelSize(float labelSize) {
        ((Croller)getObject()).setLabelSize((int) labelSize);
    }

    public int getLabelColor() {
        return ((Croller)getObject()).getLabelColor();
    }

    public void setLabelColor(int labelColor) {
        ((Croller)getObject()).setLabelColor((int) labelColor);
    }


    public float getIndicatorWidth() {
        return ((Croller)getObject()).getIndicatorWidth();
    }

    public void setIndicatorWidth(float indicatorWidth) {
        ((Croller)getObject()).setIndicatorWidth(indicatorWidth);
    }

    public boolean isContinuous() {
        return ((Croller)getObject()).isContinuous();
    }

    public void setIsContinuous(boolean isContinuous) {
        ((Croller)getObject()).setIsContinuous(isContinuous);
    }

    public float getProgressPrimaryCircleSize() {
        return ((Croller)getObject()).getProgressPrimaryCircleSize();
    }

    public void setProgressPrimaryCircleSize(float progressPrimaryCircleSize) {
        ((Croller)getObject()).setProgressPrimaryCircleSize(progressPrimaryCircleSize);
    }

    public float getProgressSecondaryCircleSize() {
        return ((Croller)getObject()).getProgressSecondaryCircleSize();
    }

    public void setProgressSecondaryCircleSize(float progressSecondaryCircleSize) {
        ((Croller)getObject()).setProgressSecondaryCircleSize(progressSecondaryCircleSize);
    }

    public float getProgressPrimaryStrokeWidth() {
        return ((Croller)getObject()).getProgressPrimaryStrokeWidth();
    }

    public void setProgressPrimaryStrokeWidth(float progressPrimaryStrokeWidth) {
        ((Croller)getObject()).setProgressPrimaryStrokeWidth(progressPrimaryStrokeWidth);
    }

    public float getProgressSecondaryStrokeWidth() {
        return ((Croller)getObject()).getProgressSecondaryStrokeWidth();
    }

    public void setProgressSecondaryStrokeWidth(float progressSecondaryStrokeWidth) {
        ((Croller)getObject()).setProgressSecondaryStrokeWidth(progressSecondaryStrokeWidth);
    }

    public int getSweepAngle() {
        return ((Croller)getObject()).getSweepAngle();
    }

    public void setSweepAngle(int sweepAngle) {
        ((Croller)getObject()).setSweepAngle(sweepAngle);
    }

    public int getStartOffset() {
        return ((Croller)getObject()).getStartOffset();
    }

    public void setStartOffset(int startOffset) {
        ((Croller)getObject()).setStartOffset(startOffset);
    }

    public int getMax() {
        return ((Croller)getObject()).getMax();
    }

    public void setMax(int max) {
        ((Croller)getObject()).setMax(max);
    }

    public int getMin() {
        return ((Croller)getObject()).getMin();
    }

    public void setMin(int min) {
        ((Croller)getObject()).setMin(min);
    }

    public float getMainCircleRadius() {
        return ((Croller)getObject()).getMainCircleRadius();
    }

    public void setMainCircleRadius(float mainCircleRadius) {
        ((Croller)getObject()).setMainCircleRadius(mainCircleRadius);
    }

    public float getBackCircleRadius() {
        return ((Croller)getObject()).getBackCircleRadius();
    }

    public void setBackCircleRadius(float backCircleRadius) {
        ((Croller)getObject()).setBackCircleRadius(backCircleRadius);
    }

    public float getProgressRadius() {
        return ((Croller)getObject()).getProgressRadius();
    }

    public void setProgressRadius(float progressRadius) {
        ((Croller)getObject()).setProgressRadius(progressRadius);
    }

    public boolean isAntiClockwise() {
        return ((Croller)getObject()).isAntiClockwise();
    }

    public void setAntiClockwise(boolean antiClockwise) {
        ((Croller)getObject()).setAntiClockwise(antiClockwise);
    }
    public void DesignerCreateView(PanelWrapper base, LabelWrapper lw, Map props) {
        //getObject().setChecked((Boolean)props.Get("Checked"));
        //CustomViewWrapper.replaceBaseWithView(base, getObject());
        CustomViewWrapper.replaceBaseWithView2(base,getObject());
    }
}

But when i use SLC to build wrapper, everything is ok, no error, but when i click to new library on Libraries Manager dont have version text (i think it can not load)
YktwnGG.png

And when i use designer to add customview, i not found it.
W4acLE6.png


Any one can help me to fix?
Thank you!
 

Attachments

  • crollerwrapper.zip
    35.3 KB · Views: 122

tuhatinhvn

Active Member
Licensed User
what is the SLC output in the logwindow?
What is the content of b4aignore line?
Thank you for your help, i have a misteke here
B4X:
    public boolean isContinuous() {
        return ((Croller)getObject()).isContinuous();
    }

    public void setIsContinuous(boolean isContinuous) {
        ((Croller)getObject()).setIsContinuous(isContinuous);
    }
it should be getIsContinuous

and i want to ask @DonManfred how can make properties of wrapper for faster and dont have this same error in next projects??

and b4aignore i dont remove com.example. so it make error!

Anyway i have finished the first wrapper with customview!
I love b4a more! Thank you every people who very kind of you!
 
Top