Android Question Screen Notification Lighting

Discussion in 'Android Questions' started by aaronk, Aug 11, 2019.

  1. aaronk

    aaronk Well-Known Member Licensed User

    Hi,

    My friend showed me his Samsung S10+ and when a notification shows, it has a lighting effect that moves around the screen.

    I understand this is something Samsung has done to show this when a notification shows, however I am wanting to show something very similar in my app no matter what phone my app is running on. I was hoping to do it in B4A (and B4i as well).

    I am wanting to make it so that if you tap on a button it will show this animation, and not when a notification shows.

    I am happy for it to only happen when my app is open / showing on the screen. I was hoping for a choice of red, blue or green.

    Is there a way of creating the same effect in B4A (and B4i) ?

    Image was too big in size to upload.
    Here is a link to the image showing the effect I am after:

    https://drive.google.com/file/d/1bXIruCUZELRAFp42F1TtgMxY3IUkwQrn/view?usp=sharing
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    I guess that it depends on one of the built-in settings. Try to set the importance level to HIGH.
     
  3. aaronk

    aaronk Well-Known Member Licensed User

    I think you missed the question.

    It is working fine on Samsung devices from what I can see, since Samsung devices support it.

    I was hoping there is an easy way in doing this effect in B4X so it will work on any device (like Pixel, LG, Sony etc) and not just Samsung devices.

    I understand it won't work on non-Samsung devices, but I was hoping we could make the same effect in B4X using a custom view. Not sure where to start on it.

    I installed the following app on my Nexus5x and it's doing the effect I want, but not sure how to do it in B4A (and B4i).

    I want to do the same thing in my app but when I press a button: https://play.google.com/store/apps/details?id=com.used.aoe&hl=en_AU&rdid=com.used.aoe&pli=1
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Not exactly the same:

    [​IMG]

    B4J example:
    Code:
    Sub Process_Globals
       
    Private fx As JFX
       
    Private MainForm As Form
       
    Private ImageView1 As ImageView
       
    Private BorderIndex As Int
       
    Private xui As XUI
    End Sub

    Sub AppStart (Form1 As Form, Args() As String)
       MainForm = Form1
       MainForm.RootPane.LoadLayout(
    "1")
       MainForm.Show
       CreateBorder(ImageView1)
    End Sub

    Sub MainForm_Resize (Width As Double, Height As Double)
       CreateBorder(ImageView1)
    End Sub

    Sub CreateBorder(iv As B4XView)
       BorderIndex = BorderIndex + 
    1
       
    Dim MyIndex As Int = BorderIndex
       
    Dim bc As BitmapCreator
       bc.Initialize(iv.Width / xui.Scale, iv.Height / xui.Scale)
       
    Dim brushbc As BitmapCreator
       brushbc.Initialize(
    100100)
       brushbc.FillRadialGradient(
    Array As Int(xui.Color_Blue, xui.Color_White), brushbc.TargetRect)
       
    Dim brush As BCBrush = bc.CreateBrushFromBitmapCreator(brushbc)
       
    Dim trans As BCBrush = bc.CreateBrushFromColor(xui.Color_Transparent)
       
    Dim offset As Int = 2
       
    Do While MyIndex = BorderIndex
           brush.SrcOffsetX = brush.SrcOffsetX + offset
           brush.SrcOffsetY = brush.SrcOffsetY - offset
           bc.DrawRect2(bc.TargetRect, trans, 
    True0)
           bc.DrawRect2(bc.TargetRect, brush, 
    False5)
           bc.SetBitmapToImageView(bc.Bitmap, iv)
           Sleep(
    20)
       
    Loop
    End Sub
     
  5. aaronk

    aaronk Well-Known Member Licensed User

    Kind of, but aiming for it to be more like the sample I showed.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice