Hi
I'm trying to wrap the AndroidImageSlider from https://github.com/daimajia/AndroidImageSlider
I have an issue in the following code which terminates the program just after initialize calling without any error
would you please tell me whats wrong
I'm trying to wrap the AndroidImageSlider from https://github.com/daimajia/AndroidImageSlider
I have an issue in the following code which terminates the program just after initialize calling without any error
would you please tell me whats wrong
B4X:
package AndroidSlider.SliderLibrary;
import java.util.HashMap;
import com.daimajia.slider.library.SliderLayout;
import com.daimajia.slider.library.Animations.DescriptionAnimation;
import com.daimajia.slider.library.SliderTypes.BaseSliderView;
import com.daimajia.slider.library.SliderTypes.TextSliderView;
import android.content.Context;
import android.util.Log;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.ActivityObject;
import anywheresoftware.b4a.BA.DependsOn;
import anywheresoftware.b4a.BA.Events;
import anywheresoftware.b4a.BA.Hide;
import anywheresoftware.b4a.BA.Permissions;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;
import anywheresoftware.b4a.objects.ViewWrapper;
@ActivityObject
@ShortName("Slider")
@Version(1)
@Permissions(values = { "android.permission.INTERNET", "android.permission.WAKE_LOCK" })
@DependsOn(values={"Library"})
@Events(values={"Playing",
"Stopped",
"Paused",
"Resumed",
"ImageChanged(index as Int)"
})
public class Slider extends ViewWrapper<SliderLayout>{
HashMap<String,String> url_maps = new HashMap<String, String>();
Context mCont;
HashMap<String,Integer> file_maps = new HashMap<String, Integer>();
/**
* AndroidSlider currently wraps version x
* https://github.com/daimajia/AndroidImageSlider
*/
public static void LIBRARY_DOC() {
}
@Override
public void Initialize(BA pBA, String EventName) {
super.Initialize(pBA, EventName);
}
@Hide
@Override
public void innerInitialize(final BA pBA, final String pEventName, boolean pKeepOldObject) {
if (!pKeepOldObject) {
SliderLayout mDemoSlider=new SliderLayout(pBA.context);
mCont=pBA.context;
setObject(mDemoSlider);
pKeepOldObject=true;
}
super.innerInitialize(pBA, pEventName, pKeepOldObject);
}
public void AddSlide(String Name,String URL)
{
url_maps.put(Name, URL);
}
@Override
public void SetLayout(int Top, int Left, int Width, int Height) {
super.SetLayout(Left, Top, Width, Height);
}
/**
* Starts or resumes playing.
*/
public void Start() {
for(String name : url_maps.keySet()){
TextSliderView textSliderView = new TextSliderView(mCont);
// initialize a SliderLayout
textSliderView
.description(name)
.image(url_maps.get(name))
.setScaleType(BaseSliderView.ScaleType.Fit);
//add your extra information
textSliderView.getBundle()
.putString("extra",name);
getObject().addSlider(textSliderView);
}
getObject().setPresetTransformer(SliderLayout.Transformer.Accordion);
getObject().setPresetIndicator(SliderLayout.PresetIndicators.Center_Bottom);
getObject().setCustomAnimation(new DescriptionAnimation());
getObject().setDuration(4000);
}
/**
* Stops the playback.
*/
public void StopPlayback() {
getObject().stopAutoCycle();
}
/**
* Resumes the playback.
*/
public void Resume() {
getObject().startLayoutAnimation();
}
/**
* Pauses the playback.
*/
public void Pause() {
getObject().stopAutoCycle();
}
}