B4A Library [Library] ICOSSlidingDrawer

Hi guys, today I am pleased to add to forum another gem, ICOSSlidingDrawer 1.0 the real SlidingDrawer.
You can load the layout previously created with visual designers, you can add any Visual, you can remove the single view or the entire layout etc.etc.etc. It's easy to use, all you need to do, take a look at the demo.





Installation instructions:
- Copy the ICOSSlidingDrawer.xml and ICOSSlidingDrawer.jar files to your custom libraries folder
- Copy the res directory to your projects "Objects" folder
- Make all files copied to the Objects/res folder read only.

Any comments and any thanks will be appreciated.

G.Salvi


thanks to Martin Pearman for is great job Library and Module Reference generator.


ICOSSlidingDrawer
Author: Giuseppe Salvi
Version: 1
  • ICOSSlidingDrawer
    Events:
    • OnDrawerClosed
    • OnDrawerOpened
    • OnScrollEnded
    • OnScrollStarted
    Fields:
    • SlideFromBottom As Int
    • SlideFromLeft As Int
    • SlideFromRight As Int
    • SlideFromTop As Int
    Methods:
    • AddView (view As View, left As Int, top As Int, width As Int, height As Int)
      Adds a child view with the specified [ left, top, width, height ].
    • AnimateClose
      Closes the drawer with an animation.
    • AnimateOpen
      Opens the drawer with an animation.
    • AnimateToggle
      Toggles the drawer open and close with an animation.
    • BringToFront (view As View)
      Change the z order of the child so it's on top of all other children.
    • HideView (view As View)
      Hide a child view that you want to use later.
    • Initialize (EventName As String, Orientation As Int)
      Intitialize the Object
      example:
      Dim sd As ICOSSlidingDrawer
      Initialize("sd",sd.SlideFromBottom)
    • IsInitialized As Boolean
    • IsMoving As Boolean
      Indicates whether the drawer is scrolling or flinging.
    • IsOpened As Boolean
      Indicates whether the drawer is currently fully opened.
    • LoadLayout (Layout As String)
      Load the layout file created with the visual designer in SlidingDrawer.
    • Lock
      Locks the SlidingDrawer so that touch events are ignores.
    • RemoveLayout
      Removes the entire layout you previously loaded.
    • RemoveViewAt (index As Int)
      Removes the view at the specified position in the group.
    • ReplaceView (oldView As View, newView As View)
      Replace a view with any other, to the same position
      Example:
      Dim sd As ICOSSlidingDrawer
      Dim btn As Button
      btn.Initialize("btn")
      sd.ReplaceView(img1,btn) it will Replace the btn to the same position of img.
    • RotatateHandle
      Auto-rotate the Handle.
    • RotatateHandleBack
      Auto-rotate back the Handle.
    • SendToBack (view As View)
      Change the z order of the child so it's on back of all other children
    • ShowView (view As View)
      Show a child view previously hidden.
    • SlidingClose
      Close the drawer immediately.
    • SlidingOpen
      Opens the drawer immediately.
    • SlidingToggle
      Toggles the drawer open and close.
    • UnLock
      Unlocks the SlidingDrawer so that touch events are processed.
    Properties:
    • BackgroundColor As Int [write only]
      Sets the background color for this view.
    • BackgroundDrawable As Drawable [write only]
      Set the background to a given Drawable, or remove the background.
    • BackgroundImage As Bitmap [write only]
      Set the background to a given bitmap.
    • BackgroundResource As String [write only]
      Set the background to a given resource.
    • ChangeHandleImage As Bitmap [write only]
      Change the Image Handle to a given Bitmap.
    • ChangeHandleImageFromRes As String [write only]
      Change the Image Handle to a given resource.
    • ChildCount As Int [read only]
      Returns the number of children in the group.
    • StartAnimation As Animation [write only]
      Sets the animation to play for this view.
    • StartAnimationFromRes As String [write only]
      Sets the animation from resource to play for this view.
    • Version As Double [read only]
      Return the version of this library
 

Attachments

  • SlidingFromLeftToRight.jpg
    SlidingFromLeftToRight.jpg
    46.9 KB · Views: 875
  • SlidingFromBottomToTop.jpg
    SlidingFromBottomToTop.jpg
    48.6 KB · Views: 666
  • SlidingFromRightToLeft.jpg
    SlidingFromRightToLeft.jpg
    46.8 KB · Views: 549
  • SlidingFromTopToBottom.jpg
    SlidingFromTopToBottom.jpg
    62.4 KB · Views: 565
  • ICOSSlidingDrawer v1.4.zip
    250.2 KB · Views: 515
Last edited:

lonleystar

Well-Known Member
Licensed User
Longtime User
Same error with the emulator. It's maybe a problem with the OS. I tested only with Gingerbread.
Hi Informatix, yes you're right, I am using Android APIs 16, to get some new future.

I'm already working to resolve this problem immediately.

Nb.

With Android 3.0 to 4.1 work fine.

best regar

G.Salvi
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Same error with the emulator. It's maybe a problem with the OS. I tested only with Gingerbread.
Hi Informatix, i fixed the library now works with froyo and gingerbread. the only limitation is that you can only use two orientations, SlidingFromBottom and SlidingFromRight ( this 2 orienations only for fr
oyo and gingerbread ) from Honeycomb to jelly bean u can use all four orientations.

best regard

G.Salvi
 

lonleystar

Well-Known Member
Licensed User
Longtime User
I tried the new version and I had no crash with it. LoadLayout 1 & 2 does not display anything on my phone. And the handle goes back and forth quickly before opening/closing the drawer; that does not look like a wanted effect.
Hi Informatix, yesterday i install froyo and gingerbread on my tab and it work good im really sorry that it doesnt work with your mobile. but please let me know wich mobile u have so i can ceck. Grazie

best regard

G.Salvi
 

lonleystar

Well-Known Member
Licensed User
Longtime User
I tried on a Nexus 7 with JellyBean 4.2 and the problem with the handle is still there.
Hi Informatix, i fixed it just download again the library and let me know.

About Nexus 7 JellyBean 4.2 have you set in the Manifest

<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="17"/>

if yes please try and let me know about it.


best regard

G.Salvi
 

lonleystar

Well-Known Member
Licensed User
Longtime User
I created a video to show you the problem.



Hi informatix, I can't understand, why to you does not work.

Anyway this is a image of ICOSSlidingDrawer while running on Froyo emulator.

It work good believe me. I tested it from Froyo to JellyBean 4.2 also on emulator.


Best Regard

G.Salvi

today is my birthday.
 

Attachments

  • Froyo__Emulator.jpg
    Froyo__Emulator.jpg
    95.7 KB · Views: 256

moster67

Expert
Licensed User
Longtime User
@lonleystar

Buon compleanno!

:wav:

I tried your demo as well and as mentioned by Informatix, the imageviews are not loaded with their images. I tried both on Gingerbread and JB.

Shall we add Activity.LoadLayout("1") and Activity.LoadLayout("2") to the code? In activity_create?

I can confirm I can see the problem with the handle too.

Maybe you can re-upload a new demo when you have free time. Maybe something is missing?
 

moster67

Expert
Licensed User
Longtime User
Ahh...now I understand. You must load actitivity using Altro in Menu.

However, I confirm I can see the problem with the handle too.
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Ahh...now I understand. You must load actitivity using Altro in Menu.

However, I confirm I can see the problem with the handle too.
hi monster67 thanks to wish me happy birthday. Are u italian? if yes explane me in italian because i cant se any problem to the handle.

best regard

G.Salvi
 

moster67

Expert
Licensed User
Longtime User
Ciao

non sono italiano ma abito in Italia da tanti anni. Il mio italiano scritto non è il massimo ma provo a spiegarti lo stesso :)

Non appena che tocco "la maniglia" o la freccia (se lo uso), sia la maniglia che l'imagine (presumo che si trova su un panel) si alza e si abassa oppure va a sinistra e a destra (secondo dove faccio partire lo slide) per poi fare lo slide in modo normale. Questo accade anche quando "tiro" lentamente la maniglia. Questo crea un strano effetto - sembra che "salta". Non so se è voluto. Si vede abbastanza bene nel video che Informatix ha postato.

Spero che sia più chiaro il problema.
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Ciao

non sono italiano ma abito in Italia da tanti anni. Il mio italiano scritto non è il massimo ma provo a spiegarti lo stesso :)

Non appena che tocco "la maniglia" o la freccia (se lo uso), sia la maniglia che l'imagine (presumo che si trova su un panel) si alza e si abassa oppure va a sinistra e a destra (secondo dove faccio partire lo slide) per poi fare lo slide in modo normale. Questo accade anche quando "tiro" lentamente la maniglia. Questo crea un strano effetto - sembra che "salta". Non so se è voluto. Si vede abbastanza bene nel video che Informatix ha postato.

Spero che sia più chiaro il problema.
ciao adesso e chiaro la maniglia non si trova in un pannello ma fa parte dello SlidingDrawer Library di android , questo strano effeto che voi vedete non e altro che un´animazione.

Se tu vai nella demo su a_OnScrollStarted ed elimini a.StartAnimationFromRes="layout_up_animation" vedrai che non avrai piu questo strano effetto.

per quanto riguarda il layout se tu chiami Activity.LoadLayout("2") la layout verra caricata nell´Activity

per caricare la layout creata da te in precedenza con visual designer, devi usare a.LoadLayout("2")
non necessariamente devi usare il menu puoi usare anche dei button o qualcosaltro per richiamare la layout nello SlidingDrawer.

Cordiali Saluti

G.Salvi


-----------------------------------------------------------
Sub a_OnScrollStarted
a.StartAnimationFromRes="layout_up_animation"
End Sub
-----------------------------------------------------------
 

zeuspower

Member
Licensed User
Longtime User
hello !
i am trying to put your class/lib in my app ,what are the absolute necessary items to put it to work ?
I only need "from bottom" or "from right" drawers...

I am getting the error :

B4X:
<!>anywheresoftware.b4a.BA 466<!> android.content.res.Resources$NotFoundException: Resource ID #0x0

:signOops: OK i did'nt saw the installation instructions


:sign0098:
 
Last edited:

zeuspower

Member
Licensed User
Longtime User
it's very useful,
I want to use it with Tabhost,I load the tabs with layouts from the designer...

how I will add the sliding drawer on a specific tab ?
if i use the
activity.AddView(drawer,0,0,100%x,100%y)

it is visible on all my tabs (logical of course)

SOLVED !!

USE OF panel.loadlayout
 
Last edited:
Top