yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] Jdbye:
Okay, thanks. I actually got the AdView working by initializing it in the main activity, it was just that AdFree was blocking it.

By the way, I just got this error when trying to open the drop down menu:

09-18 02:02:46.027: E/AndroidRuntime(6301): FATAL EXCEPTION: main
09-18 02:02:46.027: E/AndroidRuntime(6301): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
09-18 02:02:46.027: E/AndroidRuntime(6301):	at android.view.ViewRootImpl.setView(ViewRootImpl.java:585)
09-18 02:02:46.027: E/AndroidRuntime(6301):	at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:326)
09-18 02:02:46.027: E/AndroidRuntime(6301):	at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:224)
09-18 02:02:46.027: E/AndroidRuntime(6301):	at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:149)
09-18 02:02:46.027: E/AndroidRuntime(6301):	at android.widget.PopupWindow.invokePopup(PopupWindow.java:988)
09-18 02:02:46.027: E/AndroidRuntime(6301):	at android.widget.PopupWindow.showAsDropDown(PopupWindow.java:897)
09-18 02:02:46.027: E/AndroidRuntime(6301):	at android.widget.PopupWindow.showAsDropDown(PopupWindow.java:860)
09-18 02:02:46.027: E/AndroidRuntime(6301):	at wei.mark.standout.StandOutWindow$Window$2.onClick(StandOutWindow.java:2454)
09-18 02:02:46.027: E/AndroidRuntime(6301):	at android.view.View.performClick(View.java:4084)
09-18 02:02:46.027: E/AndroidRuntime(6301):	at android.view.View$PerformClick.run(View.java:16966)
09-18 02:02:46.027: E/AndroidRuntime(6301):	at android.os.Handler.handleCallback(Handler.java:615)
09-18 02:02:46.027: E/AndroidRuntime(6301):	at android.os.Handler.dispatchMessage(Handler.java:92)
09-18 02:02:46.027: E/AndroidRuntime(6301):	at android.os.Looper.loop(Looper.java:137)
09-18 02:02:46.027: E/AndroidRuntime(6301):	at android.app.ActivityThread.main(ActivityThread.java:4745)
09-18 02:02:46.027: E/AndroidRuntime(6301):	at java.lang.reflect.Method.invokeNative(Native Method)
09-18 02:02:46.027: E/AndroidRuntime(6301):	at java.lang.reflect.Method.invoke(Method.java:511)
09-18 02:02:46.027: E/AndroidRuntime(6301):	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-18 02:02:46.027: E/AndroidRuntime(6301):	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-18 02:02:46.027: E/AndroidRuntime(6301):	at dalvik.system.NativeStart.main(Native Method)
09-18 02:03:02.317: D/dalvikvm(6301): GC_CONCURRENT freed 378K, 14% free 7968K/9159K, paused 16ms+1ms, total 45ms

I wasn't spam clicking it either. Looks like a bug in the library.
[Android Apps and Games] pingpongboss:
Did you just attach the AdView to a new parent in the floating window? Did you finish() the initial Activity?
[Android Apps and Games] Jdbye:
Yes and no. I attached the AdView to a blank layout in the floating window made especially for the purpose. The original activity is left running since it's used as a GUI for connecting to new servers until I add a proper settings GUI. However, when I move everything to the settings GUI it will be harder to make it work.
[Android Apps and Games] pingpongboss:
The problem I had with having the original Activity still running was that it ate up all the touches in the background. Does it not affect you the same way?
[Android Apps and Games] brandall:
Any chance you could share your source code to get the adview working? This is something I've wanted to implement in my app, so would be great if I could see what you've done so far and look to build on it. Cheers

Sent via xda premium
[Android Apps and Games] Jdbye:
I haven't had any problems with that, but it may be because my MainActivity is mostly empty (a couple of EditTexts and a Button). Edit: I just realized I've actually started experiencing this issue after I added the settings window. For some reason though I never had that problem before. Edit: Actually, scratch that. The problem is there even when I use finish()

I have a question: Is there a way to check if a window of a different class with a specific ID is visible before calling .show, to avoid a fatal error?

I can do that in the same class using getWindow(id).visibility, but I can't find a way to do it from a different class. It's making it rather hard to open a single instance of the settings window. The best thing would be if .show and .hide didn't throw exceptions and simply silently ignored the request if the window was already shown/hidden, or focused the window if you called .show on an already visible window. That would make getShowIntent and getHideIntent a lot more useful. I've added this change to the library so I can call .show without worrying about the app crashing.

What I ended up doing with the AdViews was simply making an array of them in MainActivity for windows to use, but of course it will run out if you open a lot of windows. It's just a temporary solution until support is added in the library itself.
[Android Apps and Games] pingpongboss:
you have to edit the library for now for getting windows of a different class.
[Android Apps and Games] Jdbye:
Actually, the issue I had with input was due to calling bringToFront(id); in onFocusChange. Does that function not work properly? It caused the whole GUI to stop updating and if I tried to open the drop down menu it would just show the error I mentioned earlier.

The windows don't seem to be brought to the front when I tap them, so I added bringToFront(id) to make focusing windows actually work as you'd expect it to.
[Android Apps and Games] pingpongboss:
for being to front pass the flag instead. Look at FLAG_...
[Android Apps and Games] Jdbye:
The thing is, I already have that flag, and the window does flash when I tap it, but it doesn't bring the window to front. At least not on top of other window classes. I haven't tried with the same window class.
[Android Apps and Games] pingpongboss:
whoa weird. I depend on the fact that removing a view and then re-adding that view to the WindowManager would bring it to the front. Maybe it's a framework difference?

If the tapping doesnt work, then bringToFront() won't work either.
[Android Apps and Games] Jdbye:
Ah, I figured it out. It works when I tap, I was just confused by it not working when I dragged the window. FLAG_WINDOW_BRING_TO_FRONT_ON_TOUCH does not seem to work however. Do I need to set both flags?
[Android Apps and Games] pingpongboss:
another crises averted
[Android Apps and Games] Jdbye:
You respond too fast :p I edited my post, please reread it.
[Android Apps and Games] pingpongboss:
Hmm. It should work when you lift your finger UP (not down). The window doesn't flash when you lift your finger up?
[Android Apps and Games] Jdbye:
Nope. I'll just go back to using FLAG_WINDOW_BRING_TO_FRONT_ON_TAP for now.
[Android Apps and Games] Alexintosh:
problem Conversion to Dalvik

Hi, first of all thanks for sharing this library, really look awesome.

I downloaded your repo and imported in eclipse as usual, but when I try to run I have this kind of error

09-20 18:42:27.830: E/AndroidRuntime(1507): java.lang.RuntimeException: Unable to start service wei.mark.example.MultiWindow@422c5808 with Intent { act=SHOW cmp=wei.mark.example/.MultiWindow (has extras) }: java.lang.NullPointerException
[Android Apps and Games] pingpongboss:
Is there a stack trace? That would help.

Also, what is "imported in eclipse as usual?" Did you follow the steps in the first post?
[Android Apps and Games] wutk3ksHD:
I have a question again :)

I want to fit a window to the whole screenheight but i dont know how to get the screenheight without the statusbar. I searched the web yet. Any idea?

PS: a new app is in development :D
[Android Apps and Games] pingpongboss:
If you JUST want to fit to screen-height (or width), use LayoutParams.FILL_PARENT when creating your return value for getParams().

If you actually want to get the height: https://github.com/pingpongboss/Sta...c/wei/mark/standout/StandOutWindow.java#L2690

displayHeight = (int) (metrics.heightPixels - 25 * metrics.density);

The 25 is kind of a magic number I got as I was searching the web for the same question.
[Android Apps and Games] pXel:
Good job!
[Android Apps and Games] wutk3ksHD:
Ah, got it working. Thanks :)

Display d = ((WindowManager)getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();

DisplayMetrics metrics = new DisplayMetrics();

d.getMetrics(metrics);

width = metrics.widthPixels/2;

height = (int) (metrics.heightPixels - 25 * metrics.density);

return new LayoutParams(id,width,height,-width+20, LayoutParams.TOP);
[Android Apps and Games] w_ongkl:
Hi! good job on standOutWindow library! I have some question regarding the usage. How can I implement onKeyDown with this library? I see that standOutWindow is extended from Service. How to implement onKeyDown which is in Activity?
[Android Apps and Games] pingpongboss:
Override onKeyEvent() https://github.com/pingpongboss/Sta...c/wei/mark/standout/StandOutWindow.java#L1395

you can see that it is called from Window.dispatchKeyEvent() quick should be similar to what you are looking for.
[Android Apps and Games] Oscar-Mark:
If you already haven't seen this http://www.youtube.com/watch?v=mtkNnwF-_h0
[Android Apps and Games] pingpongboss:
Nice, looks very polished. I wonder if their source code is part of the SDK... would love to steal some stuff
[Android Apps and Games] wutk3ksHD:
I will stay with StandOut. I love it.

How can i make a window lose focus?
[Android Apps and Games] pingpongboss:
aww :p

you should use this:

protected final synchronized boolean unfocus(int id)
[Android Apps and Games] nikad1970:
As promised - sorry, I forgot!

Nikad
[Android Apps and Games] Jdbye:
Just wanted to say that I released my app on Android Market a few days ago: FloatIRC Beta

It's still in beta as there are some issues/caveats to work out, some which are partially the library's fault and partially Android's (no context menus, meaning no copy/pasting, and inability to use Android's link handler since windows run as services, not activities, meaning it's tricky to get clickable links to work), and a couple of bugs that cause occasional crashes. It's still very usable, just not entirely stable.

If anyone else has gotten clickable links to work with StandOut, I'd love to hear how so I can implement it in my app. It's been requested by several people and I tried getting it to work originally with a custom link handler but couldn't get link spanning to work, which might have something to do with the fact that I use Html.fromHtml for formatting support.

I'd also love to hear if someone has got context menus or copy/paste working, as that would at least lessen the need for clickable links.
[Android Apps and Games] Jdbye:
I have a feature request. Would it be possible to add a flag that will resize the window temporarily if necessary when the soft keyboard is open? It would be very useful to make better use of the screen space, since currently I either have to keep the window small enough to not be covered by the soft keyboard, or resize it every time I need to type something.
[Android Apps and Games] wutk3ksHD:
1. I noticed that if StandOutFlags.FLAG_WINDOW_ASPECT_RATIO_ENABLE is set, you cant change the size of the window using Editor.

2. I want to add a share option to the dropdown menu of each window for plain text. Although i set FLAG_ACTIVITY_NEW_TASK, i get "startActivity() from outside of an Activity context.... Is this really what you want?" Any idea :rolleyes:?
[Android Apps and Games] marianop89:
Cool app man! Maybe i can help with the link thing... i've send you a PM cuz i need some help too.
[Android Apps and Games] pingpongboss:
I've been sick with pneumonia for the past 7 days, so while I'm recovering, I've decided to work on some non-Google stuff. So I've done some cleaning on StandOut, with the purpose of making it easier for you guys to submit patches!

You guys want to help improve StandOut right? :) I've gotten a few helpful patches, and just merged some in today. If you guys don't know how to submit patches, go to StandOut's github page https://github.com/pingpongboss/StandOut, fork it with the button on the top right, and work on it as if it was your own project. When you are ready to submit your commits, you can click the Pull Request button at the top of your own project github page, and it will send me a request to merge your changes. Hopefully StandOut can improve faster with your help.
[Android Apps and Games] pingpongboss:
Patches welcomed :)

weird, because that should work. I use startActivity() with no problem in FloatingFolders

Patches welcomed :)

Patches welcomed :)

Patches welcomed :)
[Android Apps and Games] Jdbye:
I'm not sure how to add the window resizing to the library itself, I could probably add it to my own code but it would be kind of hacky.

The .show/.hide modification to silently ignore existing/nonexistant windows was a simple change. You're probably more experienced with Java than me, so this may not be the best way to do it, but it was the quickest:

Similarly, I just made this change in .hide:

However, I occasionally get an issue where the window will freeze up and won't redraw, it will seemingly minimize or close if I press the respective buttons, but the window stays visible and frozen no matter how many times I minimize and restore, and if I try to close it a few times it will just give this error, indicating that the library is no longer keeping track of it after the first time I clicked close, but that it's still accepting input:

This error is probably related, I think it occurs sometimes when I try to interact with the window when it's frozen:

This seems like a bug in the library, but I don't know what causes it. It seems to happen randomly. I'm pretty sure it occurred before I made the changes in .show, so I doubt that could be it. This is the main crashing issue I'm currently having that I can't seem to track down.

Since I can't track it down, I can't be sure it's the library's fault, but I kind of hope it is, at least that would mean it's not something I did.

It has been going on for a long time but seems to have gotten more frequent recently, that might just be my imagination though.
[Android Apps and Games] pingpongboss:
I think this has to do with input during Animations. Try to disable Animations by returning null from getShowAnimation(), getHideAnimation(), and getCloseAnimation() and see if that helps
[Android Apps and Games] marianop89:
There is a easy way to implement things like maps or AdMob?! Withouts hacks and stuffs... cuz it gives me an error of "not in the correct context" or something like that (like there is not in an activity). The user who make IRC Client could implement AdMob but with a trick.
[Android Apps and Games] Jdbye:
I'll try that, thanks.

Also, got another feature request for you.

Drop down menus should be scrollable, as in my app there might be a lot of menu items and on smaller screens it could go out of screen bounds, making the bottom items unclickable. I tried adding this myself making this change around "final PopupWindow dropDown = new PopupWindow(list, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, true);" in StandOutWindow.java:

But it acts the same way. Maybe there's something I'm missing.

I've also tried simply adding "list.setVerticalScrollBarEnabled(true);" but that doesn't work either.

Another feature you could add is multi-column menus, and have that as an alternative option to scrollable menus. However scrollable columns would be preferred in my case.
[Android Apps and Games] wutk3ksHD:
This should work. I modified something in StandOutWindow.java to get it working. Replace...

with

For this, you need a ScrollView named scroller before calling the code above. So place the following lines before the above code:

The fully modified method getDropDown(final int id):
[Android Apps and Games] Jdbye:
@pingpongboss: I have animations disabled but still got this crash just now when I tried to close the window:

That's exactly what I did, but it didn't work.
[Android Apps and Games] pingpongboss:
wutk3ksHD has submitted a patch that adds scrollability to the menu. It was merged into the latest StandOut.
[Android Apps and Games] wutk3ksHD:
It works for me. See attachment.
[Android Apps and Games] Matze2402:
AdMob

Hi,

Is there any possibility to get AdMob working? I tried so much but I cant find a solution...

Thanks in advance!
[Android Apps and Games] pingpongboss:
People seem to be able to do it by instantiating a backing activity and then hiding the activity.
[Android Apps and Games] Matze2402:
Thanks, but I tried it but it do not worked. Maybe I do something wrong. Has anybody a tip? ;)

Edit: Problem solved!
[Android Apps and Games] wutk3ksHD:
I just want to show you a preview of my newest floating apps. How do they look? :) Any "styling"-tips?
[Android Apps and Games] jimmod:
Wow, this is a great library.

One of my app user give me link to this thread because he want me to implement this kind of concept to the app.

Keep up the great work..
[Android Apps and Games] pingpongboss:
SHARE WITH US so this problem is solved once and for all :victory:

I like black apps :) true white text on true black often has too much contrast. The hide button image doesn't fit in with the rest. The plus sign on the right side of the windows might need a background image to separate it from the stuff behind it. Looks very good!

Thanks! Feel free to come back and ask questions if you have issues with StandOut.
[Android Apps and Games] ZuzooVn:
I insert some image in

and use

android:adjustViewBounds="true"
android:src="@drawable/green_frog"

when i try to resize by click the conner, it's not smooth

How can i fix this?

Thanks
[Android Apps and Games] brandall:
+1 ! Currently editing the XML adView ready to attempt to do this, so if I'm about to run into problems that you've solved, it would great if you could share the knowledge! :good:
[Android Apps and Games] wutk3ksHD:
I want to implement speech to text. This is possible with the following code:

Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);

intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);

intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speak now...");

startActivityForResult(intent, REQUEST_CODE);

startActivityForResult() is not possible. Is there any other way?

In an activity i get the result with the following:

onActivityResult(int requestCode, int resultCode, Intent data)

This wont work, because we have a Service instead of an activity. Is there any other way :)?
[Android Apps and Games] wutk3ksHD:
I had the same problem. "But if your layout is complicated, I could see how that would slow it down" (pingpongboss, 9.11.2012). You have to implement onResize() like this to make your views gone while resizing:
[Android Apps and Games] Matze2402:
Hi,

actually this is not my solution. Jdbye sent me a message with his version.

First of all I define in my MainActivity

public static AdView[] adviews;
public static int adCount;

in the "onCreate"-method

adviews = new AdView[15];

for (int i=0; i<adviews.length; i++)
{
AdView ads = new AdView(this, AdSize.BANNER,"your puplisher id here");
ads.setGravity(Gravity.CENTER_HORIZONTAL);
ads.setTag("adview");
adviews[i] = ads;
}

createAndAttachView of your window:

AdView adview = StartActivity.adviews[MainActivity.adCount++]; // Error checking could be added here to avoid out of bounds index
if ((adview != null) && (adlayout != null))
{
adlayout.addView(adview);
AdRequest r = new AdRequest();
adview.loadAd(r);
}

Until now I had no time to solve this problem. The study and job need too much time. If anybody find a solution let me know it!!! :)
[Android Apps and Games] himlich:
admob

HOW to you define adlayout in the createAndAttachView func?

you cant use findviewbyid?
[Android Apps and Games] Matze2402:
Of course you can! Sorry forgot to copy this line ;)

RelativeLayout adlayout = (RelativeLayout)view.findViewById(R.id.admob_standout_layout);
[Android Apps and Games] himlich:
admob

hi,

first of all - thank you.

but i dont understand where to insert this line...

can you please send me all the relevant parts - including the layouts, please?
[Android Apps and Games] kiki.kiki:
brightness slider

Hi pingpongboss,

I think your code is great! I have a problem though to set the system brightness or the brightness of the respective standoutwindow, since the way it is mostly done is by

WindowManager.LayoutParams lp = this.getWindow().getAttributes();

lp.screenBrightness = brightness;

getWindow().setAttributes(lp);

Since it's a service, it can't call getWindow but how then to adjust the brightness?

Thanks!
[Android Apps and Games] jsxgt:
Brightness

If you want to temporarily set the brightness, only while your app is visible, your code is mostly correct, and just needs a small adjusment. Instead of using getWindow(), you use getWindow(id). The id variable is the current window's id, which you can get in createAndAttachView(int id, FrameLayout frame). This works in most Android versions, except Jelly Bean it seems. In 4.1, the brightness is only changed when a touch event is registered outside the window, or the window is moved, probably when the window parameters are refreshed, for some reason. This is fixed in 4.2, but there are a lot of devices getting 4.1 now, like the S3. I haven't managed to find a fix for that yet. But outside of that version, it seems to work properly.

Now if you want the brightness you set to remain when you exit the app as well, you will need to save it to the system preferences, and you do that with the code below.

android.provider.Settings.System.putInt(getContentResolver(), android.provider.Settings.System.SCREEN_BRIGHTNESS, brightness);

In this code, brightness takes a value between 0 and 255 as opposed to the LayoutParams set one which takes it's values from 0 to 1. Just remember that for setting the system preferences you have to declare the android.permission.WRITE_SETTINGS permission.

Hope this helps!
[Android Apps and Games] kiki.kiki:
jsxgt,

You are the best!! Thank you so so much! <3 (missing the love smileys, much needed in such a wonderful opensource sharing environment)

For a next person, this is what I put in my service window:

WindowManager.LayoutParams lp = this.getWindow(idHere).getLayoutParams();

lp.screenBrightness = brightness/100F;

this.getWindow(idHere).setLayoutParams(lp);

where idHere is a private int declared at the top of the class and which I give the value at createAndAttachView(int id, FrameLayout frame)...

Indeed I have to wiggle the window a bit for it to work, but thats fine with me. Again, a big fat thanks!

p.s. pingpongboss, of course for you too a big fat <3
[Android Apps and Games] berkley:
Hi,

thanks for publishing and maintaining this great library.

I still have very limited knowledge on developing for Android. It's a hard learning curve, when you decide to learn all this stuff from scratch once you're a bit older. Anyway, I just wonder, if I can control the visibility of the floating windows the way that they are just in front of another app and get completly out of view, when the other app is closed or runs in background?

Cheers, berkley

P.S.

After reading through all of the 31 pages, i think it's time to start a FAQ page somewhere ;)
[Android Apps and Games] pingpongboss:
utter! recently made headlines with the newly released beta version. You can see StandOut being integrated into utter!'s "visual results" here http://youtu.be/A_irIFVI1x0?t=9m15s

Congrats brandall

Congrats on reading all 31 pages :) a FAQ sounds good.. I'll put it on my list of todos
[Android Apps and Games] jsxgt:
Hi,

I think I might have an idea, but I'm not quite sure. Could you please describe in more detail exactly what you want to accomplish? Maybe a step-by-step description of how a user would run through this process.