Java Question Direction Help please

NFOBoy

Active Member
Licensed User
Longtime User
What I want to do is:

1) Put a transparent panel over the Entire screen (including notification bar)

2) Add another panel to that panel (centered in the panel), with some controls on it to fire off events in my Class (seekbar, buttons... etc)


In looking at possibilitites for this, I need to build a library that lets me do this to one of our Panels (or something similiar, not sure of the details yet because I can't seem to start staying above water):

Here are the LayoutParams I have found work for others at stackoverflow:
B4X:
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
            WindowManager.LayoutParams.WRAP_CONTENT,
            WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
            WindowManager.LayoutParams.FLAG_FULLSCREEN,
            PixelFormat.TRANSLUCENT);

    params.gravity = Gravity.RIGHT | Gravity.TOP;

    WindowManager.addView(mOverlayView, params);

I "Think" (gets me in trouble) that this means that if I access our Panel in B4A via the PanelWrapper, that somewhere along the way, eventually their is a call in there that does just that for our Panel (calling the addView function)

When I try to look in Eclipse though, I cannot see where that is happening...

I have reviewed Roger Garstang's library example (awesome by the way) and I see this:
B4X:
if (ba.vg.getParent() instanceof BALayout)
            return;
        ExtendedBALayout e = new ExtendedBALayout(ba.context, EventPrefix, ba);
        ba.activity.setContentView(e);
        BALayout.LayoutParams lp = new BALayout.LayoutParams();
        lp.height = ba.vg.getLayoutParams().height;
        lp.width = ba.vg.getLayoutParams().width;
        ba.vg.setLayoutParams(lp);
        e.addView(ba.vg);
        ba.activity.getWindow().setSoftInputMode(ba.activity.getWindow().getAttributes().softInputMode | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

It appears to me their IS a way to get to something within BA that is the LayoutParams I want to adjust.

I just don't SEE it though.

I would think this is a fairly simple (HAHAHA) case of declaring the right kind of variable (I think a Window object) and assigning it the Panel View, but I can't assign a PanelWrapper to a Window. But it appears that LayoutParams are accessible in the BA, but I don't know how to assign the Params that I can declare using the WindowManager.LayoutParams Constructor, without messing up all the other Params that are already declared in the BA.

Ugh.

Any kicks to the.. I mean pointers?
 

NFOBoy

Active Member
Licensed User
Longtime User
Erel,

I have been beating my head on this for a number of hours now.

I really do appreciate the advice.

But, I don't understand it.

I can follow along the logic in many of the examples shown for libraries, but I haven't gotten that "ahhh that's it!" feeling like I have with B4A.

Do you (or anyone else) have a suggestion for where to look on going from "Hello World" to Adding a View using Java as it relates to how we would use it with B4A.

I don't want to dig too deep to learn Java for what, seems to me, should be fairly straight forward to access, (as I can find the documentation at the Android Developer website) getting a Type Flag added. (I was excited about the option of using Reflection, but apparently this is too deep to use that, and now that I've started down this library path, I want to try and get my head wrapped around it)

But, I will do it (because I want my program to look clean, and this seems to be my only way to make it so), I just don't know where to look for that viewpoint. (working with Java in relation to B4A)

I would never have my apps on the market without B4A, at least not as soon as I did... as it took me several hundred hours to figure out just the basics of the algorithm, and it would've added several hundred hours more to figure out how to do it in Eclipse, if not just breaking my head out of frustration... at least compared to B4A.

For my next app, I just want it to be even cleaner, and I want to understand a little better what I can do with B4A and android.

(hmm, vent off... not sure where that came from.. oh, maybe it was staring at Eclipse for the last two days.. and not going very far! :) )


Anyway, by creating a ViewGroup.. do you mean a ViewGroup Class based on android.View.ViewGroup, or BA.vg ??

And adding a Panel to that, that call is the one from B4A that will "hook" in to the code for the View Group?

Ross
 
Top