B4J Library [ABMaterial]: MashEmail

Hi y'all

Let's play...


Here is one of the new things in MashPlugIns. Ok. I must say I'm even surprised at myself and also at the power that is ABMaterial. This framework is da bomb!!! Let's be honest, the css is frustrating though... it can be a lot of tweaking when building a complex custom component. ;)

If you have been following my Mash(Things), the usual code addition is usually..

Add the themes and add the component...

B4X:
MashPlugIns.AddTheme("redgreen",ABM.COLOR_RED,"",ABM.COLOR_GREEN,ABM.INTENSITY_LIGHTEN3)
    MashPlugIns.AddTheme("whitelightblue",ABM.COLOR_WHITE,"",ABM.COLOR_LIGHTBLUE,"")
    MashPlugIns.AddTheme("whitered",ABM.COLOR_WHITE,"",ABM.COLOR_RED,"")
    MashPlugIns.AddTheme("alert","","",ABM.COLOR_LIGHTBLUE,"")
    MashPlugIns.AddTheme("whiteamber","white","","amber","")
    MashPlugIns.AddTheme("whitegreen","white","","green","")
    MashPlugIns.AddTheme("whiteblue","white","","blue","")
    MashPlugIns.AddTheme("whiteorange","white","","orange","")
    MashPlugIns.AddTheme("redorange","red","","orange","")
    MashPlugIns.AddTheme("lightblue",ABM.COLOR_LIGHTBLUE,"",ABM.COLOR_TRANSPARENT,"")
    MashPlugIns.AddTheme("selectiontheme",ABM.COLOR_TRANSPARENT,ABM.INTENSITY_NORMAL,ABM.COLOR_BLUE,ABM.INTENSITY_LIGHTEN5)
  
    email.Initialize(page,"emails")
    email.ZDepth = ABM.ZDEPTH_2
    email.HeaderTheme = "whitelightblue"
    email.SideBarTheme = "lightblue"
    email.SelectionTheme = "selectiontheme"
    email.ProfileImage = "../images/sponge.png"
    AddThemEmails
    page.Cell(1,1).AddComponent(email.ABMComp)

The AddThemEmails method...

B4X:
Sub AddThemEmails
    email.AddSocial("anele@mbangas.com","Someone likes you on FaceBook","Hi{BR}{BR}Anele Mashy Mbanga has liked your profile picture.","4",True)
    email.AddPromotion("anele@mbangas.com","Anywhere Software has released B4J 6 Beta, you should try it out.", _
    "Good day{BR}{BR}An amazing new beta update to the free B4J app from Anywhere Software has been released.", "1",True)
    email.AddUpdates("anele@mbangas.com","Windows 10 Update","Mashy{BR}{BR}We have noticed that you are still running Windows 7, don't you want to update to Windows 10?.", "7",False)
  
    email.AddEmail("1","Anele Mbanga","xolani@mbangas.com", _
    "This is a test email","Content: This is a test email","12:03 am",False,"../images/sponge.png",True,"",False,"")
    email.AddEmail("2","Usibabale Mbanga","anele@mbangas.com", _
    "Daddy, I have finished my exams for the year.","Content: Daddy, I have finished by exams for the year.","12:03 am",True,"",False,"",False,"")
    email.AddEmail("3","Olothando Mbanga","anele@mbangas.com", _
    "It has been a lovely day today.","Content: It has been a lovely day today.","13:05 am",False,"",False,"",False,"")
    email.AddEmail("4","Esona Mbanga","anele@mbangas.com", _
    "Daddy, when can we watch movies, you need to take a break", _
    "Content: Daddy, when can we watch movies, you need To take a break","09:03 am",False,"",False,"",False,"")
End Sub

And then finally the events trapping and doing other things...

B4X:
Sub emails_click(value As Map)
    Dim valuex As String = value.GetDefault("value","")
    'clean the returned item from the component
    Dim emailID As String = email.GetEmailID(valuex)
    Dim emailAction As String = email.GetEmailAction(valuex)
    Select Case emailAction
    Case "replytoall"
            page.Msgbox("","Your 'reply to all' code comes here.",emailID,"OK",False,"","")
    Case "reply"
            page.Msgbox("","Your 'reply to' code comes here.",emailID,"OK",False,"","")
    Case "emailmenu"
            page.Msgbox("","Your 'email menu' code comes here.",emailID,"OK",False,"","")
    Case "forward"
            page.Msgbox("","Your forwarding code comes here.",emailID,"OK",False,"","")
    Case "menu"
            page.Msgbox("",emailAction,"","OK",False,"","")
        Case "search"
            page.Msgbox("",emailAction,"","OK",False,"","")
        Case "attach"
            page.Msgbox("",emailAction,"","OK",False,"","")
    Case "type"
            page.Msgbox("",emailAction,"","OK",False,"","")
        Case "archive"
            page.Msgbox("",emailAction,"","OK",False,"","")
        Case "delete"
            page.Msgbox("",emailAction,"","OK",False,"","")
        Case "content"
            'page.Msgbox("",valuex,"","OK",False,"","")
            email.clear
            AddThemEmails
            email.refresh
        Case "navigate"
            page.Msgbox("",emailAction,"","OK",False,"","")
        Case "archives"
            'update the navbar and update active item
            email.clear
            AddThemEmails
            email.refresh
            email.SetSideBarItem(emailAction)
        Case "socialgroup"
            'update the navbar and update active item
            email.clear
            email.SetSideBarItem(emailAction)
        Case "mapslocaloffer"
            'update the navbar and update active item
            email.clear
            email.SetSideBarItem(emailAction)
        Case "alerterror"
            'update the navbar and update active item
            email.clear
            email.SetSideBarItem(emailAction)
        Case Else
            email.View(emailID)
    End Select
End Sub

Perhaps I will add functionality to load the emails from a JSON string...

Attached is an early Christmas present, the source code for MashEmail component. This is part of the MashPlugIn library for anything ABMaterial components I'm doing.

You can Dropbox the MashPlugIns library here, you can do it now.
 

Attachments

  • MashEmail.bas
    27.8 KB · Views: 278
Last edited:
Top