[LIB] [B4A SourceCode] ahaShareLibrary
Hi!
As we all have the Problems with sharing Text/Pictures via Intents and Facebook, I decided to write a small library that get rid of this Problem. It's very easy to use and takes all the work away from you
You can share Text, Pictures, Documents.....
It's still beta, so please report any Bugs/Wishes.
Usage is very simple:
After sharing, the Finished Event is called
Screenshot :
PS: As you can see you can customize nearly everything:
This library is written in B4A
I hope you like it
---------------
Version 0.6
New: _Finished Event added
Version 0.7
New: Long click on the App-Symbol opens the Android Application Settings for the clicked app (as the original contentchooser
Fixed: Last line of Icons was not displayed. (Thanks to derez!!)
Change: More icons are displayed at once (Height of the Buttons reduced)
Version 0.8
New:
AppButtonWidth: sets the width of the Buttons
AppButtonHeight: sets the height of the Buttons
AppIconSize: Sets width & height of the AppIcons
HeaderHeight: Sets the height of the Header
Fixed: Error handling in all Subs
Version 1.0
Beta finished
SourceCode attached
Hi!
As we all have the Problems with sharing Text/Pictures via Intents and Facebook, I decided to write a small library that get rid of this Problem. It's very easy to use and takes all the work away from you
You can share Text, Pictures, Documents.....
It's still beta, so please report any Bugs/Wishes.
Usage is very simple:
B4X:
Dim Share as ahaShare
Share.initialize(Me, "Share")
Share.FaceBookAppID = "xxxx"
Share.FaceBookRedirectUri = "http://www.xxxxxx.xxx/"
Share.Share("Test-Subject","Test-Text")
B4X:
Sub Share_Finished
..your code here
End Sub
PS: As you can see you can customize nearly everything:
This library is written in B4A
I hope you like it
- ahaShare
Methods:- IsInitialized As Boolean
Tests whether the object has been initialized. - Addfile (Directory As String, Filename As String) As String
Adds a file to the Intent
<B>Attention: file.DirAssets and file.dirInternal will <I>NOT></I> work as Directory!!</B> - Addpackagefilter (PackageFilter As String) As String
Adds a packagefilter. Packages with the given names will not be shown in the ContentChooser
Example1: "com.google.android.keep" to hide Google Keep from the choosable Apps
Example2: "synology" hides every Synology-App - Clearfiles As String
Clears all added files - Initialize (Module As Object, EventName As String) As String
Initializes the Library
<B>Normal Library usage:</B>
-----------------------
<code>Dim Share as ahaShare
Share.initialize(me, "Share")
Share.FaceBookAppID = "xxxx"
Share.FaceBookRedirectUri = "http://www.xxxxxx.xxx/"
Share.Share("Test-Subject","Test-Text")</code>
Event Finished will be raised when Sharing is finished:
Sub Share_Finished
..your code here (i.e deleting temp files,...)
End Sub
<B>That's it</B> - Sshare (Subject As String, Text As String) As String
Starts the ContentChooser
- buttonnormalcolor As Int
Color of the unpressed Buttons
Standard: colors.white - buttonpressedcolor As Int
Color of the pressed Button
Standard: Colors.RGB(29,162,235) - cornerradius As Int
Corner radius of the Buttons - facebookappid As String
Your Facebook AppID. Needed for publishing to FaceBook.
Tutorial by NJDude: <link>http://www.b4x.com/forum/basic4android-getting-started-tutorials/17739-tutorial-post-facebook-wall-via-b4a-app.html|http://www.b4x.com/forum/basic4android-getting-started-tutorials/17739-tutorial-post-facebook-wall-via-b4a-app.html</link>
Attention: If not set, FaceBook will not be available to share with - facebookredirecturi As String
Your Facebook RedirectUri. Needed for publishing to FaceBook.
Tutorial by NJDude: <link>http://www.b4x.com/forum/basic4android-getting-started-tutorials/17739-tutorial-post-facebook-wall-via-b4a-app.html|http://www.b4x.com/forum/basic4android-getting-started-tutorials/17739-tutorial-post-facebook-wall-via-b4a-app.html</link>
Attention: If not set, FaceBook will not be available to share with - headerbackcolor As Int
BackColor of the Header
Standard: Colors.Transparent - headertext As String
HeaderText of the ContentChooser
Standard: Choose - headertextcolor As Int
TextColor of the Header
Standard: Colors.RGB(49,182,255) - headertextsize As Int
TextSize of the Header
Standard: 22 - intenttype As String
IntentType, for example "text/*" for Text, "image/jpeg" for jpg, "image/png" for png etc.. - linecolor As Int
Color of the Seperatorline below the Header
Standard: Colors.RGB(49,182,255) - padding As Int
Padding
Standard: 10dip - panelcolor As Int
Color of the ContentChooser Panel
Standard: Colors.white - sendingtofacebookfinishedstring As String
The String displayed as ToastMessage after Sending to Facebook succeeded
Standard: "Posted to Facebook" - sendingtofacebookstring As String
The String displayed in the ProgressDialog while sending to FaceBook
Standard: "Posting to Facebook..." - shadowcolor As Int
Color of the Background Shadow.
Use colors.rgb(x,x,x) for opaque background, colors.argb(x,x,x,x) for Transparency
Standard: Colors.ARGB(150,0,0,0) - subject As String
Subject (for E-Mail,..) set as android.intent.extra.SUBJECT - text As String
The Message. Set as android.intent.extra.TEXT - textcolor As Int
Textcolor of the Names of the displayed Packages
Standard: Colors.Black - textsize As Int
TextSize of the Names of the displayed Packages.
Standard: 14 - AppButtonWidth As Int
Width of the Buttons
Standard: 160dip - AppButtonHeight As Int
Height of the Buttons
Standard: 120dip - AppIconSize As Int
Size of the Images on the Buttons
Standard: 48dip - HeaderHeight As Int
Height of the Header
Standard: 60dip
- IsInitialized As Boolean
---------------
Version 0.6
New: _Finished Event added
Version 0.7
New: Long click on the App-Symbol opens the Android Application Settings for the clicked app (as the original contentchooser
Fixed: Last line of Icons was not displayed. (Thanks to derez!!)
Change: More icons are displayed at once (Height of the Buttons reduced)
Version 0.8
New:
AppButtonWidth: sets the width of the Buttons
AppButtonHeight: sets the height of the Buttons
AppIconSize: Sets width & height of the AppIcons
HeaderHeight: Sets the height of the Header
Fixed: Error handling in all Subs
Version 1.0
Beta finished
SourceCode attached
Attachments
Last edited: