B4A Library LiveWallpaper Library

Discussion in 'Additional libraries, classes and official updates' started by XverhelstX, Sep 21, 2011.

  1. XverhelstX

    XverhelstX Well-Known Member Licensed User

    Hey everyone,

    Releasing a new library that took me about approx. 1 hour to make.
    With this library you are able to create/specify your own (live) wallpaper from your app.
    So you can:

    - remove the current wallpaper
    - get information about the current wallpaper
    - get the desired height and width.
    - Setting the x- and y offset.
    - specify a new wallpaper from a bitmap or a stream
    - and a little bit more functions.

    and so you can create your own dynamical wallpaper.

    Code:
    Dim lw As LiveWallpaper
    Dim btmp As Bitmap
    lw.Initialize
    btmp.Initialize(
    File.DirAssets,"rs2.png")

    lw.clearWallpaper

    Msgbox(lw.WallpaperInfo,"Information")
    Msgbox(lw.DesiredMinimumHeight,lw.DesiredMinimumWidth)
    lw.WallpaperBitmap(btmp)
    Cheers,

    XverhelstX
     
    Last edited: Nov 16, 2011
    koaunglay likes this.
  2. susu

    susu Well-Known Member Licensed User

    Woah, that's so great. I just don't know how to create animated/dynamic wallpaper. Can I use .gif file?
     
  3. XverhelstX

    XverhelstX Well-Known Member Licensed User

    you can use a timer and set a new bitmap, but I will look for a more efficient, alternative way.
    However, It will be a lot easier if I could use the source code of Agraham's GifDecoder Library.

    XverhelstX
     
  4. bluedude

    bluedude Well-Known Member Licensed User

    You are getting better and faster :) Pretty cute!

    Still struggling with some of your other libs like Audiorecorder and Advanced Camera.

    Audiorecorder
    Not sure how to record and store files, no sample available.

    Advanced Camera
    Saves images taken in portrait mode not in portrait mode.

    Anyway, good stuff!
     
  5. XverhelstX

    XverhelstX Well-Known Member Licensed User

    Thanks! I just want to help the B4A community and 'expand' B4A with more functions.

    Well, It did worked for me.
    When you saved your file to the directory, you can use AudioRecorder.mSampleFile as the name of the latest record.
    Then you can use file.copy to save it as a new name in your directory.


    Somewhere at the last posts, Erel wrote some codes for rotating your bitmap.

    But don't worry, I will update both versions this weekend.

    XverhelstX
     
  6. bluedude

    bluedude Well-Known Member Licensed User

    A good sample of the audiorecorder would help, couldn't find a nice sample on how to capture file etc.

    If you could add saving the picture rotated it would be awesome!

    Cheers,
     
  7. Rui

    Rui Member Licensed User

    Does the wallpaper respond to touch ?
     
  8. Kamac

    Kamac Active Member Licensed User

    Nice :sign0188:!
     
  9. Mikie

    Mikie Member Licensed User

    HI,

    Did get the library to work. It installed a wallpaper. How do I remove the wallpaper. I have deleted the image and the app, yet the wallpager stays.
     
  10. XverhelstX

    XverhelstX Well-Known Member Licensed User

    With clearWallpaper.

    Code:
    dim lw as LiveWallpaper
    lw.clearWallpaper
    Here is some sample code:

    Code:
    'Activity module
    Sub Process_Globals
       
    'These global variables will be declared once when the application starts.
       'These variables can be accessed from all modules.

    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.
       Dim lw As LiveWallpaper
       
    Dim imgbox As ImageView
       
    Dim btmp As Bitmap
       btmp.Initialize(
    File.DirAssets,"rs2.png")

    End Sub

    Sub Activity_Create(FirstTime As Boolean)

    lw.Initialize
    imgbox.Initialize(
    "image")

    Activity.AddMenuItem("setBitmap","mnusetBitmap")
    Activity.AddMenuItem("clear","mnuClear")
    Activity.AddMenuItem("Info","mnuInfo")

    Activity.AddView(imgbox,0,0,75,100)



    End Sub

    Sub Activity_Resume

    End Sub

    Sub Activity_Pause (UserClosed As Boolean)

    End Sub

    Sub mnuClear_Click
    lw.clearWallpaper
    End Sub

    Sub mnuInfo_Click
    Msgbox(lw.WallpaperInfo,"info")
    Msgbox(lw.DesiredMinimumHeight,lw.DesiredMinimumWidth)
    End Sub

    Sub mnusetBitmap_Click
    lw.WallpaperBitmap(btmp)
    End Sub
     
    koaunglay likes this.
  11. Highwinder

    Highwinder Active Member Licensed User

    XverhelstX,

    First, thank yu very much for providing at least some way to change or even cycle some images as live wallpaper.

    I'm wanting very much to write a live wallpaper using animated GIFs or even video clips. Can this be done? Better yet, can a full B4A app with a layout be used as a live wallpaper? Or are we stuck with static images only?

    Thanks,

    Highwinder
     
  12. Highwinder

    Highwinder Active Member Licensed User

    Crickets...

    "...you can use a timer and set a new bitmap, but I will look for a more efficient, alternative way.However, It will be a lot easier if I could use the source code of Agraham's GifDecoder Library. XverhelstX"

    Any updates on this? Animated gifs are being used out there in Java land, so I know it's possible for some library guru to bring that capability into a library for B4A. I want to write an app along the lines of the app called "AnimGIF", which allows the use of animated GIFs as LWP.

    Example:
    AnimGIF

    I have posted a grovelling request to Agraham (here) to provide a way for both your LiveWallpaper library and his GIFDecoder library to be able to be combined to produce Live Wallpaper that is capable of animated GIF looping.


    Highwinder


    :sign0163:

    Highwinder
     
    Last edited: Oct 24, 2011
  13. Erel

    Erel Administrator Staff Member Licensed User

  14. agraham

    agraham Expert Licensed User

    As I've pointed out here the GifDecoder library does no animations, it merely decodes the individual frames and makes them available. As I've also pointed out you need to write a special WallpaperService to implement live wallpapers efficiently.
     
  15. susu

    susu Well-Known Member Licensed User

    XverhelstX, do you plan to implement WallpaperService into your library? Thank you in advance.
     
  16. Highwinder

    Highwinder Active Member Licensed User

    Ditto

    I too would like to ask if there is any plan to implement/include the Android wallpaper service into your wonderfully "almost there" library. There are tremendous opportunities being missed here.

    In general, I'm still trying to figure out how complex things like GPS, sensors, widgets, OpenGL, voice recognition, camera, web, etc can be a part of B4A but live wallpaper continues to be so elusive. This just strikes me as being, well, backwards...

    :confused:

    - Highwinder
     
    Last edited: Nov 9, 2011
  17. NeoTechni

    NeoTechni Well-Known Member Licensed User

    The best solution I could think of, is if we could get a livewallpaper to act as exactly like a canvas. So we could actually pass it around as one, and call the same methods.

    I just want to make a LW that draws some stuff
     
  18. Highwinder

    Highwinder Active Member Licensed User

    I'll settle for just being able to make live wallpapers of any kind...
     
  19. Gigatron

    Gigatron Member Licensed User

    Hi all

    I have analyzed how to make live wallpaper. At the moment it's hard to me for making simple repeat 50 png files like gif and set the background of my phone.

    With my bad english when i read google doc how to make a live wallpaper , my first impression is very hard !

    It's start service engine, modify manifest file etc...
    But i found something on xda developpers, this little tool repeat png picture
    and set the background like GIF anims. Max 100 png file.

    I have not tested , here is the link of live wallpapers maker.

    Download for free on Filesonic.com
    Free File Hosting, Online Storage &amp File Upload with FileServe
    Hotfile.com: One click file hosting
    Download Custom LiveWallpapers.2.6.zip for free on uploading.com
    MEGAUPLOAD - The leading online storage and file delivery service

    Live wallpaper is working since android version 2.1 update.

    Good luck...
     
  20. Erel

    Erel Administrator Staff Member Licensed User

    Note that I started developing a LiveWallpaper library.
    LiveWallpapers are indeed pretty complicated.
    Livewallpapers are actually much more complicated than most of the above mentioned features and are probably less useful for most developers / users than most of them.

    I don't know why some members expect LiveWallpapers to be simple. It involves an interaction between two separate processes in a performance critical area.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice