B4A Library Alerter Library

Original Alerter library: https://github.com/Tapadoo/Alerter
Original description: This library aims to overcome the limitations of Toasts and Snackbars, while reducing the complexity of your layouts.

alert_coloured.gif
alert_with_buttons.gif
alert_icon.gif


  • v0.80 - Initial release
  • v0.90 - Show and Hide events
  • v1.00 - Completely rewritten, from zero. Now include: right icon, typeface, sound, vibration, progress, infinite duration, new events, events signatures is also changed, icon pulse, hide icon, gravity to show alert on top, center or bottom of the screen, swipe to dismiss, disable outside touch, etc.
  • v1.01 - Support for RTL
  • v1.02 - Text appearance with 50 presets or full custom title and text style from manifest, including color and size.
  • v1.10 - Alerter library v7.2.4, no more EnableSound, theme must be set to Theme.AppCompat, example app updated.
This is my first wrapper, v0.80 and v0.90 are example HOW NOT TO wrap library. I will be better next time :)

Download library zip file from this link and extract archive to Additional Libraries folder. I'm not able to upload on forum, as size of file is over maximum allowed limit.
 

Attachments

  • AlerterExample.zip
    11.4 KB · Views: 191
  • AlerterWithTitleBarExample.zip
    11 KB · Views: 172
Last edited:

Pendrush

Well-Known Member
Licensed User
Longtime User
If you set it to False, user will not be able to dismiss dialog by touching on it.
 

Patrick Clark

Active Member
Licensed User
Thanks.

I have added Alerter1.Dismissable(True) and Alerter1.Dismissable(False) to the btnShowAlertWithIcon_Click and to btnShowAlertWithOneButton_Click and it makes no difference. In all cases tapping on the alert closes it
 

Patrick Clark

Active Member
Licensed User
but if i change dismissable to true in that example it makes no difference. the alert still doesn't dismiss when tapped
 

Pendrush

Well-Known Member
Licensed User
Longtime User
You can use:
B4X:
Sub Alerter1_Click
    Alerter1.Close
End Sub
Indeed dismissable(False) or True does not change behavior.
 

Patrick Clark

Active Member
Licensed User
Ok, thanks. I am glad I am not going mad :)

one final question. is it possible to get the index of the button rather than the text?
 

Almora

Active Member
Licensed User
Longtime User
hi..
android 13
I get this error..
is there a solution for this..
android.view.InflateException: Binary XML file line #49 in xx:layout/alerter_alert_default_layout: Binary XML file line #49 in xx:layout/alerter_alert_default_layout: Error inflating class androidx.appcompat.widget.AppCompatTextView

#AdditionalJar: androidx.appcompat:appcompat
 

NGUYEN TUAN ANH

Active Member
Licensed User
How to Use v1.02 with android:targetSdkVersion="31" ?
Because v1.10 hide my title bar, i want to keep title bar, could you please help me
 
Last edited:

Pendrush

Well-Known Member
Licensed User
Longtime User
How to Use v1.02 with android:targetSdkVersion="31" ?
Because v1.10 hide my title bar, i want to keep title bar, could you please help me

Remove this from manifest:
B4X:
SetApplicationAttribute(android:theme, "@style/Theme.AppCompat")

Add this:
B4X:
SetApplicationAttribute(android:theme, "@style/myTheme")
CreateResource(values-v21, theme.xml,
<resources>
  <style name="myTheme" parent="@style/Theme.AppCompat">
        <item name="android:windowNoTitle">false</item>
        <item name="android:windowActionBar">true</item>
    </style>
</resources>)

Another example with title bar attached to post #1
 
Last edited:

syerif

Active Member
Licensed User
Longtime User
hi ,
i got this error

Error in D:\Android\tools\..\extras\b4a_local\unpacked-kotlin-stdlib-1.7.22-63817667628000\dex_v1\kotlin-stdlib-1.7.22.zip:classes.dex:
Type kotlin.ArrayIntrinsicsKt is defined multiple times: D:\Android\tools\..\extras\b4a_local\unpacked-kotlin-stdlib-1.7.22-63817667628000\dex_v1\kotlin-stdlib-1.7.22.zip:classes.dex, D:\Android\tools\..\extras\b4a_local\unpacked-kotlin-stdlib-1.6.10-63810050730000\dex_v1\kotlin-stdlib-1.6.10.zip:classes.dex
Compilation failed

any solution please?
 
Top