This is (another) wrap for this Github project.
It is kind of the same as the lib posted here.
The Lib requires B4A 6+ and the new maven repositories as it requires Android support v4 and AppCompat.
The lib depends on 3rd party libs Nineoldandroids and Picasso. Both are included in the library zip.
ImageSlider
Comment: AndroidSlider currently wraps version x
https://github.com/daimajia/AndroidImageSlider
Author: DonManfred (wrapper)
Version: 1.1
PagerIndicator
Events:
ImageSlider
Events:
Example Code (See Example zip)
This library is Donationware. You can download the library, you can test the library. But if you want to USE the library in your App you need to Donate for it.
Please click here to donate (You can donate any amount you want to donate for the library (or my work)
It is kind of the same as the lib posted here.
The Lib requires B4A 6+ and the new maven repositories as it requires Android support v4 and AppCompat.
The lib depends on 3rd party libs Nineoldandroids and Picasso. Both are included in the library zip.
ImageSlider
Comment: AndroidSlider currently wraps version x
https://github.com/daimajia/AndroidImageSlider
Author: DonManfred (wrapper)
Version: 1.1
PagerIndicator
Events:
- onClick ( As )
- DesignerCreateView (base As anywheresoftware.b4a.objects.PanelWrapper, lw As anywheresoftware.b4a.objects.LabelWrapper, props As anywheresoftware.b4a.objects.collections.Map) As void
- setDefaultIndicatorColor (selectedColor As int, unselectedColor As int) As void
if you are using the default indicator , this method will help you to set the selected status and
the unselected status color.
selectedColor:
unselectedColor: - setIndicatorStyleResource (selected As java.lang.String, unselected As java.lang.String) As void
Set Indicator style.
selected: page selected drawable
unselected: page unselected drawable - IsInitialized As boolean
- Initialize (ba As anywheresoftware.b4a.BA, EventName As java.lang.String) As void
- setDefaultIndicatorSize (width As float, height As float) As void
- BringToFront As void
- SetLayout (arg0 As int, arg1 As int, arg2 As int, arg3 As int) As void
- GetApplicationDrawableID (DrawableName As java.lang.String) As int
Get a Drawable from the Application Resources.
Returns Null if the Drawable is not found. - SendToBack As void
- SetVisibleAnimated (arg0 As int, arg1 As boolean) As void
- setDefaultUnselectedIndicatorSize (width As float, height As float) As void
- RemoveView As void
- Invalidate3 (arg0 As int, arg1 As int, arg2 As int, arg3 As int) As void
- setDefaultSelectedIndicatorSize (width As float, height As float) As void
- Invalidate2 (arg0 As android.graphics.Rect) As void
- SetColorAnimated (arg0 As int, arg1 As int, arg2 As int) As void
- SetBackgroundImage (arg0 As android.graphics.Bitmap) As void
- Invalidate As void
- SetLayoutAnimated (arg0 As int, arg1 As int, arg2 As int, arg3 As int, arg4 As int) As void
- RequestFocus As boolean
- Left As int
- Background As android.graphics.drawable.Drawable
- Parent As java.lang.Object [read only]
- DefaultIndicatorShape As java.lang.String [write only]
if you are using the default indicator, this method will help you to set the shape of
indicator, there are two kind of shapes you can set, oval and rect. - Color As int [write only]
- Enabled As boolean
- Top As int
- Visible As boolean
- Padding As int[]
- Height As int
- Tag As java.lang.Object
- IndicatorVisible As boolean [write only]
set the visibility of indicator. - Width As int
ImageSlider
Events:
- onPageScrollStateChanged (state As int)
- onPageScrolled (position As int, positionOffset As float, positionOffsetPixels As int)
- onPageSelected (position As int)
- onSliderClick ( As )
- SLIDER_TRANSITION_FlipPage As int
- SLIDER_TRANSITION_ZoomIn As int
- SLIDER_TRANSITION_Tablet As int
- SLIDER_TRANSITION_CubeIn As int
- SLIDER_TRANSITION_ZoomOut As int
- SLIDER_TRANSITION_RotateUp As int
- SLIDER_TRANSITION_Background2Foreground As int
- SLIDER_TRANSITION_ZoomOutSlide As int
- SLIDER_TRANSITION_Default As int
preset transformers and their names - SLIDER_TRANSITION_Fade As int
- SLIDER_TRANSITION_Accordion As int
- SLIDER_TRANSITION_RotateDown As int
- SLIDER_TRANSITION_DepthPage As int
- SLIDER_TRANSITION_Foreground2Background As int
- SLIDER_TRANSITION_Stack As int
- SLIDER_TRANSITION_FlipHorizontal As int
- stopAutoCycle As void
stop the auto circle - DesignerCreateView (base As anywheresoftware.b4a.objects.PanelWrapper, lw As anywheresoftware.b4a.objects.LabelWrapper, props As anywheresoftware.b4a.objects.collections.Map) As void
- onSliderClick (slider As com.daimajia.slider.library.SliderTypes.BaseSliderView) As void
- IsInitialized As boolean
- Initialize (ba As anywheresoftware.b4a.BA, EventName As java.lang.String) As void
- BringToFront As void
- SetLayout (arg0 As int, arg1 As int, arg2 As int, arg3 As int) As void
- setSliderTransformDuration (period As int, interpolator As android.view.animation.Interpolator) As void
set the duration between two slider changes.
period:
interpolator: - SendToBack As void
- SetVisibleAnimated (arg0 As int, arg1 As boolean) As void
- RemoveView As void
- Invalidate3 (arg0 As int, arg1 As int, arg2 As int, arg3 As int) As void
- Invalidate2 (arg0 As android.graphics.Rect) As void
- SetColorAnimated (arg0 As int, arg1 As int, arg2 As int) As void
- startAutoCycle As void
- SetBackgroundImage (arg0 As android.graphics.Bitmap) As void
- addSliderLocal (name As java.lang.String, path As java.lang.String, scale As com.daimajia.slider.library.SliderTypes.BaseSliderView.ScaleType) As void
- addSliderUrl (name As java.lang.String, url As java.lang.String, scale As com.daimajia.slider.library.SliderTypes.BaseSliderView.ScaleType) As void
- Invalidate As void
- startAutoCycle2 (delay As long, duration As long, autoRecover As boolean) As void
start auto cycle.
delay: delay time
duration: animation duration time.
autoRecover: if recover after user touches the slider. - removeAllSliders As void
- SetLayoutAnimated (arg0 As int, arg1 As int, arg2 As int, arg3 As int, arg4 As int) As void
- RequestFocus As boolean
- android.permission.ACCESS_NETWORK_STATE
- android.permission.INTERNET
- android.permission.READ_EXTERNAL_STORAGE
- android.permission.WAKE_LOCK
- android.permission.WRITE_EXTERNAL_STORAGE
- PresetTransformer2 As com.daimajia.slider.library.SliderLayout.Transformer [write only]
- Left As int
- RotateUp As com.daimajia.slider.library.SliderLayout.Transformer [read only]
- Parent As java.lang.Object [read only]
- PresetIndicator As java.lang.String [write only]
- FitCenterCrop As com.daimajia.slider.library.SliderTypes.BaseSliderView.ScaleType [read only]
- FlipPage As com.daimajia.slider.library.SliderLayout.Transformer [read only]
- FlipHorizontal As com.daimajia.slider.library.SliderLayout.Transformer [read only]
- ZoomOutSlide As com.daimajia.slider.library.SliderLayout.Transformer [read only]
- CurrentPosition As int [read only]
get the current item position - Visible As boolean
- Padding As int[]
- Tablet As com.daimajia.slider.library.SliderLayout.Transformer [read only]
- Height As int
- ZoomIn As com.daimajia.slider.library.SliderLayout.Transformer [read only]
- DepthPage As com.daimajia.slider.library.SliderLayout.Transformer [read only]
- Width As int
- RotateDown As com.daimajia.slider.library.SliderLayout.Transformer [read only]
- Background As android.graphics.drawable.Drawable
- Background2Foreground As com.daimajia.slider.library.SliderLayout.Transformer [read only]
- Color As int [write only]
- CenterCrop As com.daimajia.slider.library.SliderTypes.BaseSliderView.ScaleType [read only]
- CubeIn As com.daimajia.slider.library.SliderLayout.Transformer [read only]
- Enabled As boolean
- Duration As long [write only]
set the duration between two slider changes. the duration value must >= 500 - CustomIndicator As com.daimajia.slider.library.Indicators.PagerIndicator [write only]
- CenterInside As com.daimajia.slider.library.SliderTypes.BaseSliderView.ScaleType [read only]
- Default As com.daimajia.slider.library.SliderLayout.Transformer [read only]
- Stack As com.daimajia.slider.library.SliderLayout.Transformer [read only]
- Fit As com.daimajia.slider.library.SliderTypes.BaseSliderView.ScaleType [read only]
- ZoomOut As com.daimajia.slider.library.SliderLayout.Transformer [read only]
- PresetTransformer As java.lang.String [write only]
- Accordion As com.daimajia.slider.library.SliderLayout.Transformer [read only]
- Top As int
- CurrentSlider As com.daimajia.slider.library.SliderTypes.BaseSliderView [read only]
get current slider. - Tag As java.lang.Object
- Fade As com.daimajia.slider.library.SliderLayout.Transformer [read only]
- Foreground2Background As com.daimajia.slider.library.SliderLayout.Transformer [read only]
Example Code (See Example zip)
B4X:
#Extends: android.support.v7.app.AppCompatActivity
#AdditionalRes: ..\res
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Type SlideImage(name As String, path As String)
Dim slides As List
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private slider As ImageSlider
Private indicator As PagerIndicator
Private currentImage As SlideImage
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Layout1")
' Globale Liste von "Slides" (List of SlideImage)
' Wird benötigt, um beim erreichen eines Bildes seinen Namen (pfad) wieder zu erhalten...
slides.Initialize
indicator.DefaultIndicatorShape = "Rectangle"
indicator.setDefaultIndicatorColor(Colors.Red,Colors.Gray)
indicator.setDefaultIndicatorSize(1dip,1dip)
indicator.setDefaultSelectedIndicatorSize(5dip,1dip)
indicator.setDefaultUnselectedIndicatorSize(1dip,1dip)
indicator.Visible = True
slider.CustomIndicator = indicator
'indicator.setIndicatorStyleResource("ic_action_camera","ic_action_chat")
Dim flist As List
flist = File.ListFiles(File.DirRootExternal&"/DCIM/Holger.Bilder")
Log(flist)
For i = 0 To flist.Size-1
Dim f As String = flist.Get(i)
If f.StartsWith(".") Then
Else
Log("File added: "&f)
Dim sl As SlideImage
sl.Initialize
sl.name = f
sl.path = File.DirRootExternal&"/DCIM/Holger.Bilder/"&f
slides.Add(sl)
slider.addSliderLocal(sl.name,sl.path,slider.CenterCrop)
End If
Next
' Wir legen auch einen Eintrag in der globalen Liste ab für Einträge die per URL aufgenommen werden
Dim sl As SlideImage
sl.Initialize
sl.name = "GoT"
sl.path = "http://images.boomsbeat.com/data/images/full/19640/game-of-thrones-season-4-jpg.jpg"
slides.Add(sl)
slider.addSliderUrl(sl.name,sl.path,slider.CenterInside)
slider.PresetTransformer2 = slider.Accordion
Log(slider.CurrentPosition)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Slider_onSliderClick()
Log($"Slider_onClick()"$)
End Sub
Sub Slider_onPageScrollStateChanged(state As Int)
'Log($"Slider_onPageScrollStateChanged(${state})"$)
End Sub
Sub Slider_onPageScrolled(position As Int, positionOffset As Float, positionOffsetPixels As Int)
'Log($"Slider_onPageScrolled(${position},${positionOffset})"$)
End Sub
Sub Slider_onPageSelected(position As Int)
Log($"Slider_onPageSelected(${position})"$)
' Setze die globale Variable currentImage (welches ein Type SlideImage ist)
currentImage = slides.Get(position)
' Hier wissen wir, welche Datei (oder URL) gerade aktiv ist.
Log("Name: "¤tImage.name)
Log("Path: "¤tImage.path)
End Sub
Sub indicator_onClick()
Log($"indicator_onClick()"$)
End Sub
This library is Donationware. You can download the library, you can test the library. But if you want to USE the library in your App you need to Donate for it.
Please click here to donate (You can donate any amount you want to donate for the library (or my work)
Attachments
Last edited: