It wraps this Github project. Posting the following:
1. B4A project demonstrating the library
2. B4A library files (2x Jar and 1 x XML) - copy them to your additional library folder
3. The Java code
Note: there is a file called placeholder.pnd in the B4A project's /Objects/res/drawable folder. It needs to be there is you start a new project (it needs to be set to read-only)
It seems to work best with images that are just about 100% square.
....or pass a color such as for eg "#66FF0000" to make the colors transparent
Sample code:
The library:
DriveImageView
Author: Github: Yannick Signer, Wrapped by: Johan Schoeman
Version: 1
1. B4A project demonstrating the library
2. B4A library files (2x Jar and 1 x XML) - copy them to your additional library folder
3. The Java code
Note: there is a file called placeholder.pnd in the B4A project's /Objects/res/drawable folder. It needs to be there is you start a new project (it needs to be set to read-only)
It seems to work best with images that are just about 100% square.
....or pass a color such as for eg "#66FF0000" to make the colors transparent
Sample code:
B4X:
#Region Project Attributes
#ApplicationLabel: b4aDriveImageView
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: landscape
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
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.
Private div1, div2 As DriveImageView
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("main")
Dim bm As Bitmap
bm.Initialize(File.dirassets,"pluto.jpg")
div1.ImageBitmap = bm
div1.AnimateTextDuration = 5000
' div1.animateText 'same as above but has a default value of 3000ms assiged to it
div1.FolderCorner = 20 'the height for the folder corner on the right
div1.BackgroundColor = "#FFAA44" 'red
div1.CustomFolderSpacing = 100 'make the folder size bigger smaller in x direction
div1.CustomHeight = 35 'the height of the overlay
div1.FolderText = "Photo 1 of 2" 'text for the folder
div1.MainText = "Pluto" 'main text
div1.DivideColor = "#FFFFFF" 'white
div1.TextColor = "#FFFFFF" 'black
bm.Initialize(File.DirAssets,"stitch.jpg")
div2.ImageBitmap = bm
div2.AnimateTextDuration = 5000
' div2.animateText 'same as above but has a default value of 3000ms assiged to it
div2.FolderCorner = 15 'the height for the folder corner on the right
div2.BackgroundColor = "#c8c8c8" 'red
div2.CustomFolderSpacing = 100 'make the folder size bigger smaller in x direction
div2.CustomHeight = 35 'the height of the overlay
div2.FolderText = "Photo 2 of 2" 'text for the folder
div2.MainText = "Stitch" 'main text
div2.ImageScaleType = div2.ScaleTypeCentreCrop
div2.DivideColor = "#00FFFF" 'white
div2.TextColor = "#FF00FF" 'black
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
The library:
DriveImageView
Author: Github: Yannick Signer, Wrapped by: Johan Schoeman
Version: 1
- DriveImageView
Fields:- ScaleTypeCentre As String
- ScaleTypeCentreCrop As String
- ScaleTypeCentreInside As String
- ScaleTypeFitCentre As String
- ScaleTypeFitEnd As String
- ScaleTypeFitStart As String
- ScaleTypeFitXY As String
- ScaleTypeMatrix As String
- ba As BA
- BringToFront
- DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
- Initialize (EventName As String)
- Invalidate
- Invalidate2 (arg0 As Rect)
- Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- IsInitialized As Boolean
- RemoveView
- RequestFocus As Boolean
- SendToBack
- SetBackgroundImage (arg0 As Bitmap)
- SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
- SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- animateText
This animates the text with a duration of 3 seconds.
- AnimateTextDuration As Int [write only]
This a animates a "blend-in" animation of the figure. The duration can be customised. - Background As Drawable
- BackgroundColor As String [write only]
Sets the background-color of the main figure on the canvas. - Color As Int [write only]
- CustomFolderSpacing As Float [write only]
Sets the spacing between the left border of the DriveImageView and the crack before the folder-text. - CustomHeight As Float [write only]
Sets the custom height of the whole figure. This recalculates the text-sizes inside the Canvas. - DivideColor As String [write only]
Sets the background-color of the divider figure. - Enabled As Boolean
- FolderCorner As Float [write only]
Sets the height and width of the folder corner. - FolderText As String [write only]
Sets the folder text - Height As Int
- ImageBitmap As Bitmap [write only]
Sets the image bimap - ImageScaleType As String [write only]
Sets the image scale type - Left As Int
- MainText As String [write only]
Sets the main text - Tag As Object
- TextColor As String [write only]
Sets the text-color of both text's (main-text and folder-text) - Top As Int
- Visible As Boolean
- Width As Int
Attachments
Last edited: