Android Question [SOLVED] 2 Custom Views, a SnapShot and a weird effect...

Cableguy

Expert
Licensed User
Longtime User
Hi guys,

I will try to explain my issue as simply as possible...

I'm using a CustomView called "TopPanel" as a... TopPanel!
Inside I have 6 Labels and 1 button.
5 of these labels have the BasePanel as parent, and 2 of them have "click" events set.
I'm also using a second CustomView, called "InputPanel" as a... InputPanel!
It starts as not visible, and when one of the clickable labels is clicked, it takes a snapshot of the activity (it's Parent) and blurs it, using the code from the blur snippet.

My issue is, one of these clickable labels, lets call it Label14, when clicked, resizes itself to the same size as the other label, Label15, BUT if Label15 is the one clicked, all is good, sizes remain unchanged!
I have searched the code up and down, left and right, and I can't figure why!

Another "question" is, why does the blur snippet need the log statement to work!?
(if i take it out, it doesn't)

To help you guys help me, I exported my current project as is, that will show you what I mean.

Thank you in advance!

[Solved]

I was using the same colordrawable to set the aspect of those labels, and by doing so, they kind of inherited from each other, altering the way they looked.
Creating individual colordrawables solved my issue!
 

Attachments

  • CRIT.zip
    12 KB · Views: 154
Last edited:

klaus

Expert
Licensed User
Longtime User
... resizes itself to the same size as the other label, ...
You use the same ColorDrawable object for both.
B4X:
Label14.Background = SecondaryDrawable

Label15.Background = SecondaryDrawable
You must define a new one for each Label.
B4X:
Private cdw As ColorDrawable
cdw.Initialize2(SecondaryBackgroundColor, 3dip, 1dip, SecondaryBorderColor)
Label14.Background = cdw

Private cdw As ColorDrawable
cdw.Initialize2(SecondaryBackgroundColor, 3dip, 1dip, SecondaryBorderColor)
Label15.Background = cdw

Another "question" is, why does the blur snippet need the log statement to work!?
The Blur routine takes some time to complete.
Using a ResumableSub with Wait For works without the Log:
B4X:
Public Sub ShowInputPanel
    Private xParent As B4XView = mParent
    Private xBackgroundImage As B4XBitmap = xParent.Snapshot
    Wait For(Blur(xBackgroundImage)) Complete (Result As B4XBitmap)
    mBase.SetBackgroundImage(Result)
    mBase.SetVisibleAnimated(400,True)
End Sub

Private Sub Blur (bmp As B4XBitmap) As ResumableSub

Attached a modified project.
 

Attachments

  • CRITNew.zip
    12.1 KB · Views: 162
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Hi Klaus, for the drawable, I had figured out yesterday night, as you can notice by my edit time, but thanks anyway...
As for the blur, I knew it was about the time it took to complete, but I didn't dig much in to it.. I was just curious...
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Hi Klaus, for the drawable, I had figured out yesterday night, as you can notice by my edit time,
I had seen your post yesterday and left it open for this morning for an answer.
I saw that you solved it by yourself on your own only later after posting my answer.
 
Upvote 0
Top