B4A Library B4AMediaBucket v1.20

Hi guys I am proud to share with you all a new library B4AMediaBucket v1.20 explanations below:

This library is used with B4AGridview, B4AGallery, B4ACoverflow and B4APhotoPager. right now is used only with B4AGridview till at the end of the next week I'll try to fix all library to work properly with B4AMediaBucket.

I have uploaded a zip file, the zip includes:

1 - library
3 - demos with photopager and gridview
1 - resource



B4AMediaBucket v1.0_From_Designer - open te Designer and check it out

B4AMediaBucket v1.0_From_Layout - can be used with LinearLayout, FrameLayot, RelativeLayout - open te Manifest and check it out.

You can use Eclipse or AndroidStudio to build your own layout

B4AMediaBucket v1.0_Programmatically

below all features:


  • B4AMediaBucket
    Author: Giuseppe Salvi
    Version: 1.2

    • Fields:
      • Bottom_Inside As BucketGravity
        Text Bottom InSide
      • Bottom_OutSide As BucketGravity
        Text Bottom OutSide
      • Center_Inside As BucketGravity
        Text Center InSide
      • Text_Center As BucketGravity
        Text center
      • Text_Left As BucketGravity
        Text left
      • Text_Right As BucketGravity
        Text right
      • Top_Inside As BucketGravity
        Text Top InSide
      • Top_OutSide As BucketGravity
        Text Top OutSide

    • Fields:
      • AUTO_FIT As Int
        Creates as many columns as can fit on screen.
      • NO_STRETCH As Int
        Disables stretching.
      • STRETCH_COLUMN_WIDTH As Int
        Stretches the spacing between columns.
      • STRETCH_SPACING As Int
        Stretches columns.
      • STRETCH_SPACING_UNIFORM As Int
        Stretches the spacing between columns.

    • Fields:
      • SCREEN_ORIENTATION_BEHIND As Int
      • SCREEN_ORIENTATION_FULL_SENSOR As Int
      • SCREEN_ORIENTATION_LANDSCAPE As Int
      • SCREEN_ORIENTATION_NOSENSOR As Int
      • SCREEN_ORIENTATION_PORTRAIT As Int
      • SCREEN_ORIENTATION_REVERSE_LANDSCAPE As Int
      • SCREEN_ORIENTATION_REVERSE_PORTRAIT As Int
      • SCREEN_ORIENTATION_SENSOR As Int
      • SCREEN_ORIENTATION_SENSOR_LANDSCAPE As Int
      • SCREEN_ORIENTATION_SENSOR_PORTRAIT As Int
      • SCREEN_ORIENTATION_UNSPECIFIED As Int
      • SCREEN_ORIENTATION_USER As Int

    • Fields:
      • Center As ScaleType
        Center the image in the view, but perform no scaling.
      • Center_Crop As ScaleType
        Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image
        will be equal to or larger than the corresponding dimension of the view (minus padding).
      • Center_Inside As ScaleType
        Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image
        will be equal to or less than the corresponding dimension of the view (minus padding).
      • Fit_Center As ScaleType
        Scale the image using CENTER.
      • Fit_End As ScaleType
        Scale the image using END.
      • Fit_Start As ScaleType
        Scale the image using START.
      • Fit_XY As ScaleType
        Scale the image using FILL.
      • Matrix As ScaleType
        Scale using the image matrix when drawing.

    • Fields:
      • Default As Typeface
        The default NORMAL typeface object.
      • Default_Bold As Typeface
        The default BOLD typeface object.
      • Monospace As Typeface
        The NORMAL style of the default monospace typeface.
      • Sans_Serif As Typeface
        The NORMAL style of the default sans serif typeface.
      • Serif As Typeface
        The NORMAL style of the default serif typeface.
      • Style_Bold As Int
        The default BOLD style int.
      • Style_Bold_Italic As Int
        The default BOLD ITALIC style int.
      • Style_Italic As Int
        The default ITALIC style int.
      • Style_Normal As Int
        The default NORMAL style int.
      Methods:
      • LoadFontFromAssets (file As String) As Typeface
        Create a new typeface from the specified font data from assets.
      • LoadFontFromFile (file As String) As Typeface
        Create a new typeface from the specified font data from sdcard.

    • MediaBucketGallery
      Events:
      • ItemClick (Position As Int, Value As Object)
      • ItemLongClick (Position As Int, Value As Object)
      • Ready
      Methods:
      • AddThisView
        Adds view to this activity 100%x,100%y.
      • BringToFront
      • ClearDiskCache
        Clears disk cache.
      • ClearMemoryCache
        Clears memory cache
      • DesignerCreateView (base As PanelWrapper, label As LabelWrapper, props As Map)
        This method is only for the B4A Designer. Don't call it directly.
      • Initialize (EventName As String)
        Initialize the object.
        EventName:
      • Initialize2 (EventName As String, cacheDir As String)
        Initialize the object and set own cache dir.
        EventName:
        cacheDir:
      • InitializeFromLayout (EventName As String, cacheDir As String, Layout As String, LayoutID As String)
        Initialize the object from layout.
        EventName:
        cacheDir:
        Layout:
        LayoutID:
      • 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)
      • ShowMediaFromBucket
        Show media from bucket.
      Permissions:
      • android.permission.INTERNET
      • android.permission.MEDIA_CONTENT_CONTROL
      • android.permission.READ_EXTERNAL_STORAGE
      • android.permission.WRITE_EXTERNAL_STORAGE
      Properties:
      • Background As Drawable
      • CacheInMemory As Boolean [write only]
        Sets whether loaded image will be cached in memory.
      • CacheOnDisk As Boolean [write only]
        Sets whether loaded image will be cached on disk.
      • Color As Int [write only]
      • Enabled As Boolean
      • Gravity As Int [write only]
        Specifies the gravity within each cell.
      • Height As Int
      • Icon As String [write only]
        Sets own folder icon.
      • IconVisible As Boolean
        Get or Sets the visibility of the icon displayed right to the text - by default is false.
      • ImageOnFail As String [write only]
        Sets own error icon.
      • ImageOnLoading As String [write only]
        Sets own on loading icon.
      • ItemHeight As Int
        Get or Set ItemHeight
      • ItemWidth As Int
        Get or Sets ItemWidth
      • Left As Int
      • LoadFontFromAssets As String [write only]
        Loads a new Typeface from the specified font data.
      • LoadFontFromFile As String [write only]
        Loads a new Typeface from the specified font data.
      • Padding()() As Int
      • Parent As Object [read only]
      • ReflectionAlpha As Int [write only]
        Sets alpha by default is 125
      • ReflectionGap As Int [write only]
        Sets gap by default is 4
      • ScaleType As BucketScaleType
        Controls how the image should be resized or moved to match the size of this ImageView.
        by default ScaleType.CENTER_CROP
      • ShowReflection As Boolean [write only]
        Set to true if reflection must be shown by default is false
      • Spacing As Int [write only]
        Sets the spacing between items in a Gallery
      • Tag As Object
        Get or Sets this view's tag.
      • TextBackGroundColor As String
        Get or Sets the background color for this view.
        Example:
        TextBackGroundColor = "#88666666"
        or
        TextBackGroundColor = Colors.ARGB(100,20,20,20)
      • TextColor As String
        Get or Sets Text Color - by default White.
      • TextGravity As BucketGravity [write only]
        Set the position alignment of the text that will be used.
        <b>param Text_Left</b>
        <b>param Text_Center</b>
        <b>param Text_Right</b>
      • TextPosition As BucketTextPosition
        Get or Sets the position alignment of the TextView that will be used.
        <b>param Top_Outside</b>
        <b>param Top_Inside</b>
        <b>param Center_Inside</b>
        <b>param Bottom_Inside</b>
        <b>param Bottom_Outside</b>
      • TextSize As Int
        Get or Sets Text Size - by default 14.
      • TextStyle As Int [write only]
        Sets the style in which the text should be displayed.
      • TextTypeFace As BucketTypefaceUtils
        Get or Sets the typeface and style in which the text should be displayed.
        Note that not all Typeface families actually have bold and italic variants,
        so you may need to use TextStyle(style) to get the appearance that you actually want.
      • TextVisible As Boolean
        Get or Sets the visibility of the text - by default is false.
      • Top As Int
      • Version As String [read only]
        Version of the library
      • Visible As Boolean
      • Width As Int

    • MediaBucketGrid
      Events:
      • ItemClick (Position As Int, Value As Object)
      • ItemLongClick (Position As Int, Value As Object)
      • Ready
      Methods:
      • AddThisView
        Adds view to this activity 100%x,100%y.
      • BringToFront
      • ClearDiskCache
        Clears disk cache.
      • ClearMemoryCache
        Clears memory cache
      • DesignerCreateView (base As PanelWrapper, label As LabelWrapper, props As Map)
        This method is only for the B4A Designer. Don't call it directly.
      • Initialize (EventName As String)
        Initialize the object.
        EventName:
      • Initialize2 (EventName As String, cacheDir As String)
        Initialize the object and set own cache dir.
        EventName:
        cacheDir:
      • InitializeFromLayout (EventName As String, cacheDir As String, Layout As String, LayoutID As String)
        Initialize the object from layout.
        EventName:
        cacheDir:
        Layout:
        LayoutID:
      • 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)
      • ShowMediaFromBucket
        Show media from bucket.
      Permissions:
      • android.permission.INTERNET
      • android.permission.MEDIA_CONTENT_CONTROL
      • android.permission.READ_EXTERNAL_STORAGE
      • android.permission.WRITE_EXTERNAL_STORAGE
      Properties:
      • Background As Drawable
      • CacheInMemory As Boolean [write only]
        Sets whether loaded image will be cached in memory.
      • CacheOnDisk As Boolean [write only]
        Sets whether loaded image will be cached on disk.
      • Color As Int [write only]
      • ColumnWidth As Int
        Get or Sets Specifies the fixed width for each column.
      • Enabled As Boolean
      • Gravity As Int [write only]
        Specifies the gravity within each cell.
      • Height As Int
      • HorizontalSpacing As Int [write only]
        Defines the default horizontal spacing between columns.
      • Icon As String [write only]
        Sets own folder icon.
      • IconVisible As Boolean
        Get or Sets the visibility of the icon displayed right to the text - by default is false.
      • ImageOnFail As String [write only]
        Sets own error icon.
      • ImageOnLoading As String [write only]
        Sets own on loading icon.
      • ItemHeight As Int
        Get or Set ItemHeight
      • ItemWidth As Int
        Get or Sets ItemWidth
      • Left As Int
      • LoadFontFromAssets As String [write only]
        Loads a new Typeface from the specified font data.
      • LoadFontFromFile As String [write only]
        Loads a new Typeface from the specified font data.
      • NumColumns As Int
        Get or Sets the number of columns in the grid.
      • Orientation As ActivityOrientation
        Constant corresponding to unspecified, reverseLandscape, portrait in the screen Orientation attribute.
      • Padding()() As Int
      • Parent As Object [read only]
      • ScaleType As BucketScaleType
        Controls how the image should be resized or moved to match the size of this ImageView.
        by default ScaleType.CENTER_CROP
      • StretchMode As BucketStretchMode
        Defines how columns should stretch to fill the available empty space, if any.
        Examples:
        GridView.StretchMode = GridView.StretchMode.STRETCH_SPACING
      • Tag As Object
        Get or Sets this view's tag.
      • TextBackGroundColor As String
        Get or Sets the background color for this view.
        Example:
        TextBackGroundColor = "#88666666"
        or
        TextBackGroundColor = Colors.ARGB(100,20,20,20)
      • TextColor As String
        Get or Sets Text Color - by default White.
      • TextGravity As BucketGravity [write only]
        Set the position alignment of the text that will be used.
        <b>param Text_Left</b>
        <b>param Text_Center</b>
        <b>param Text_Right</b>
      • TextPosition As BucketTextPosition
        Get or Sets the position alignment of the TextView that will be used.
        <b>param Top_Outside</b>
        <b>param Top_Inside</b>
        <b>param Center_Inside</b>
        <b>param Bottom_Inside</b>
        <b>param Bottom_Outside</b>
      • TextSize As Int
        Get or Sets Text Size - by default 14.
      • TextStyle As Int [write only]
        Sets the style in which the text should be displayed.
      • TextTypeFace As BucketTypefaceUtils
        Get or Sets the typeface and style in which the text should be displayed.
        Note that not all Typeface families actually have bold and italic variants,
        so you may need to use TextStyle(style) to get the appearance that you actually want.
      • TextVisible As Boolean
        Get or Sets the visibility of the text - by default is false.
      • Top As Int
      • Version As String [read only]
        Version of the library
      • VerticalSpacing As Int [write only]
        Defines the default vertical spacing between rows.
      • Visible As Boolean
      • Width As Int
 

Attachments

  • B4AMediaBucket_v1.0.zip
    440.1 KB · Views: 346
  • bucket_2_columns.jpg
    bucket_2_columns.jpg
    176.1 KB · Views: 616
  • bucket_auto_fit.jpg
    bucket_auto_fit.jpg
    169.9 KB · Views: 574
  • B4AMediaBucket_Lib_v1.10.zip
    150.6 KB · Views: 320
  • B4AMediaBucket_Lib_1.20.zip
    211.7 KB · Views: 365
  • mediagallery.jpg
    mediagallery.jpg
    221.6 KB · Views: 473
Last edited:

cambopad

Active Member
Licensed User
Longtime User
Thanks for this cool lib! Anyway, is this something similar to B4AGallery?
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hi guys B4AMediaBucket has been updated to v1.10. What's new:

fixed:

Initialize2 - to set your own cache

TextBackGroundColor - the value as object example:

TextBackGroundColor = Colors.ARGB(100,20,20,20) - Colors.RGB(20,20,20)
or
TextBackGroundColor = "#AA335577"
in any case you forget to add the character ( # ) in the string will be added automatically

TextColor like above

InitializeFromLayout(EventName,cacheDir,Layout,LayoutID) instead of InitializeFromLayout(EventName,Container,Layout,LayoutID)


removed:

TextBackGroundColor2
TextColor2

P.S.

** if you use B4AMediaBucket with B4AGridView you should set both the cache name **
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hi guys B4AMediaBucket has been updated to v1.20. What's new:

Changed:
MediaBucketGrid instead of MediaBucket (show as Grid)

Added:
ClearDiskCache
ClearMemoryCache
ItemHeight(Get,Set)
ItemWidth(Get,Set)
ScaleType(Get,Set)
Orientation(Get,Set)

MediaBucketGallery(show as Gallery)

Removed unnecessary code.

Best Regard
 

mcqueccu

Well-Known Member
Licensed User
Longtime User
what about this error? Stucked
Compiling generated Java code. (4.66s)
Convert byte code - optimized dex. Error
Uncaught translation error: java.lang.IllegalArgumentException: already added: LA;
Uncaught translation error: java.lang.IllegalArgumentException: already added: LB;
Uncaught translation error: java.lang.IllegalArgumentException: already added: LC;
Uncaught translation error: java.lang.IllegalArgumentException: already added: LCode;
Uncaught translation error: java.lang.IllegalArgumentException: already added: LD;
Uncaught translation error: java.lang.IllegalArgumentException: already added: LF;
Uncaught translation error: java.lang.IllegalArgumentException: already added: LH;
Uncaught translation error: java.lang.IllegalArgumentException: already added: LI;
Uncaught translation error: java.lang.IllegalArgumentException: already added: LL;
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:689)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:313)
at com.android.dx.command.dexer.Main.run(Main.java:279)
at com.android.dx.command.dexer.Main.main(Main.java:247)
at com.android.dx.command.Main.main(Main.java:106)
Caused by: java.lang.InterruptedException: Too many errors
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:681)
... 4 more

I could not run any of the example code provided here with.
It shows the above error for all the example provide.What is this? and how can i solve this?Plz help
 
Last edited:
Top