yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] Ya Rahman:
Hi i want to count with timer

I edit codes

but its force close and not work

err:

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.Activity.runOnUiThread(java.lang.Runnable)' on a null object reference

public class WidgetsWindow extends MultiWindow {

int count = 0;
TextView tv;
Context ctx;
Activity act;
public String userId;

public static final int DATA_CHANGED_TEXT = 0;

@Override
public void createAndAttachView(final int id, FrameLayout frame) {

Timer T=new Timer();
T.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
act.runOnUiThread(new Runnable()
{
@Override
public void run()
{
tv.setText(+l);
count++;
}
});
}
}, 1000, 1000);

LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.widgets, frame, true);
[Android Apps and Games] fong0319:
It's means I can change two work quickly??
[Android Apps and Games] abotrix:
Notification change in API 23 for StandoutWindow.java:

In the getPersistentNotification and getHiddenNotification method change:

Notification notification = new Notification(icon, tickerText, when);

notification. setLatestEventInfo(c, contentTitle, contentText,

contentIntent);

To this:

NotificationManager nm = (NotificationManager) c.getSystemService(c.NOTIFICATION_SERVICE);

Resources res = c.getResources();

Notification.Builder builder = new Notification.Builder(c);

builder.setContentIntent(contentIntent)

.setContentTitle(contentTitle)

.setContentText(contentText)

.setTicker(tickerText)

.setWhen(when)

.setAutoCancel(true)

.setSmallIcon(icon)

.setLargeIcon(BitmapFactory.decodeResource(res, R.drawable.icon)); // your own graphic

Notification notification = builder.build();

return notification;
[Android Apps and Games] DimasGhost:
Very interesting thing, thanks!
[Android Apps and Games] MrChops:
Thanks for posting this I was struggling to fix it for 23.

Do you know how I can make it work for < API 11 now that setLatestEventInfo has been removed? Many of my users still run with API 9 to 11.

Cheers, J
[Android Apps and Games] abotrix:
No problem:] I haven't tested this out but I believe it should work. Just add this method to StandoutWindow.java:

/**

* Notifications for Api 9(or lower?) - 23

*/

public Notification showHideNotification(int id, boolean showNotification)

{

Notification notification = null;

Intent notificationIntent = null;

PendingIntent contentIntent = null;

Resources res = null;

int currentapiVersion = Integer.valueOf(android.os.Build.VERSION.SDK_INT);

int icon;

long when;

Context c = null;

String contentTitle, contentText, tickerText;

if(notificationIntent != null)

{

contentIntent = PendingIntent.getService(this, 0,

notificationIntent,

// flag updates existing persistent notification

PendingIntent.FLAG_UPDATE_CURRENT);

}

if(showNotification)

{

icon = getAppIcon();

when = System.currentTimeMillis();

c = getApplicationContext();

contentTitle = getPersistentNotificationTitle(id);

contentText = getPersistentNotificationMessage(id);

tickerText = String.format("%s: %s", contentTitle, contentText);

res = c.getResources();

notificationIntent = getPersistentNotificationIntent(id);

}

else

{

icon = getHiddenIcon();

when = System.currentTimeMillis();

c = StandOutWindow.this;//getApplicationContext();

contentTitle = getHiddenNotificationTitle(id);

contentText = getHiddenNotificationMessage(id);

tickerText = String.format("%s: %s", contentTitle, contentText);

res = c.getResources();

notificationIntent = getHiddenNotificationIntent(id);

}

if(currentapiVersion < android.os.Build.VERSION_CODES.HONEYCOMB)

{

NotificationCompat.Builder builder =

new NotificationCompat.Builder(this)

.setContentTitle(contentTitle)

.setContentText(contentText)

.setWhen(when)

.setTicker(tickerText)

.setAutoCancel(true)

.setSmallIcon(getAppIcon())

.setLargeIcon(BitmapFactory.decodeResource(res, R.drawable.icon));

builder.setContentIntent(contentIntent);

notification = builder.build();

}

else

{

Notification.Builder builder = new Notification.Builder(c);

builder.setContentIntent(contentIntent)

.setContentTitle(contentTitle)

.setContentText(contentText)

.setTicker(tickerText)

.setWhen(when)

.setAutoCancel(true)

.setSmallIcon(icon)

.setLargeIcon(BitmapFactory.decodeResource(res, R.drawable.icon));

notification = builder.build();

}

return notification;

}

In getPersistentNotification and getHiddenNotification methods, remove everything and just put in:

getPersistentNotification:

return showHideNotification(id, true);

getHiddenNotification:

return showHideNotification(id, false);

Don't forget to add both v4 and v7 support library's in an new libs folder in the StandoutWindow project library.
[Android Apps and Games] silvermetal:
Standout Window issue in incoming call when PIN Keyguard is on

i'm being using your library for Standout window and i wanted to say how great it is !!

we found that lately on marshmallow when there is a keyguard on the device and our service try to start a floating window like in TrueCaller the Window doesn't show. it gets stuck behind it.

wondered if you know about this issue ? i tried to add some flags to the window:

flags |= FLAG_DISMISS_KEYGUARD;

flags |= FLAG_SHOW_WHEN_LOCKED;

flags |= FLAG_TURN_SCREEN_ON;

but it didn't help .... :(

it happened on all devices ... have you heared about this issue ?

perhaps i need to check if you have updates as i took the source code a year ago ... :\
[Android Apps and Games] bigsupersquid:
[MENTION=7528975]silvermetal[/MENTION]

http://www.pocketmagic.net/android-overlay-cursor/

uses LayoutParams.TYPE_SYSTEM_OVERLAY to cover keyguard

not sure about turning the screen on but SYSTEM stuff usually gets higher priorities than user stuff.
[Android Apps and Games] silvermetal:
Standout Window issue in incoming call when PIN Keyguard is on

thank you [MENTION=2980661]bigsupersquid[/MENTION] for the quick response :)

yes i'm familiar with this flag, but that doesn't work either. you need to add to it permissions of SYSTEM_ALERT_WINDOW and that something that other apps like TrueCaller don't use(i can see it in their permissions). moreover it blocks touch events from the window . i'm pretty sure that's not good for me.

i'm pretty sure these flags should work:

flags |= FLAG_DISMISS_KEYGUARD;

flags |= FLAG_SHOW_WHEN_LOCKED;

flags |= FLAG_TURN_SCREEN_ON;

but somehow the standout window still doesn't appear in front of the Lock Screen like TrueCaller. i have no idea what to do :(

when there isn't a lock screen with security(lock screen of swipe only) it works great, but when you give it a password it covers the standout window!
[Android Apps and Games] DaNiStO2015:
Also interested?!?

Also interested?!? Someone knows? :confused:
[Android Apps and Games] AndroidTech98:
Hi how can i use this library & project in android studio???
[Android Apps and Games] mehdiam:
how to hard key listener in stand out?
[Android Apps and Games] munged:
did anyone port it to xamarin c# ?
[Android Apps and Games] ntmod:
i get a error when i inflate a .xml resource in method createAndAttachView(...), its contains View (android.support.design.widget.FloatingActionButton) in my class (extends StandOutWindow). how to fix it, sorry my english, please help me!
[Android Apps and Games] suncowiam:
Android AOSP integration

Hi [MENTION=2484344]pingpongboss[/MENTION],

Has anyone been able to integrate this with Android AOSP to enable desktop OS environment for all Android apps in a float window?

If not, could you provide any tips and suggestions on how to go about this?

Thanks
[Android Apps and Games] danini:
Amazing idea, looks great on the phone. I hope we get to see this often!
[Android Apps and Games] kpln04:
Any chance add this function to mx player

Mx will be better with popup
[Android Apps and Games] developerbayman:
this is really hard to implement im using AIDE and it refuses to import please at it to gradle repo like im.delight.Advanced.webview........it dont get any easier than that
[Android Apps and Games] chotakhan:
Thsit good
[Android Apps and Games] wutk3ksHD:
Hi Mark.

Since new update, i got bugs with Vol+ / Vol- buttons. They dont work for me anymore, but they worked in version before. just so you know it.

however.. i love standout :cool:
[Android Apps and Games] acquariusoft:
I have created a program with the layout below, but when i launch the app i cannot show the keyboard in other program.

Someone can help me?

I have the latest source!

<?xml version="1.0" encoding="utf-8"?>

<merge xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="fill_parent"

android:layout_height="fill_parent" android:background="#ff0000" >

<LinearLayout

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:background="#000000"

android:orientation="horizontal"

android:paddingBottom="40dp">

<ListView

android:id="@+id/listView1"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_weight=".50">

</ListView>

<ScrollView android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight=".50">

<TextView

android:id="@+id/textView1"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:text=""

/>

</ScrollView>

</LinearLayout>

<LinearLayout

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_gravity="bottom">

<EditText

android:id="@+id/editText1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_weight="1"

android:ems="10"

android:hint="Message">

</EditText>

<Button

android:id="@+id/button1"

style="?android:attr/buttonStyleSmall"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Button" />

</LinearLayout>

</merge>

with this flags

StandOutFlags.FLAG_DECORATION_SYSTEM

| StandOutFlags.FLAG_BODY_MOVE_ENABLE

| StandOutFlags.FLAG_HIDE_ENABLE

| StandOutFlags.FLAG_WINDOW_BRING_TO_FRONT_ON_TAP

| StandOutFlags.FLAG_WINDOW_EDGE_LIMITS_ENABLE;
[Android Apps and Games] pingpongboss:
Apologies to everyone, the API has changed a bit again. But this update has really important bug fixes, including a fix for the interference with keyboards in other applications.

I know I keep saying this, but I think this update will fix all the issues that you guys are encountering.

Please update to latest. If there's still the volume issue, then let me know what version of Android you are running, and what behavior your expect vs what you see.

Edit: I should mention that I don't have any issues with the volume buttons on my ICS galaxy nexus.

StandOut loves you!

I didn't have time to check your specific case, but I just pushed a fix that should solve the keyboard issues you are encountering. It seems everything was caused by FLAG_ALT_FOCUSABLE_IM, a flag that I didn't think would screw keyboards up. Please get the latest (again) and let me know if the issue is still there.
[Android Apps and Games] xdaid:
What? apologies? you fix bugs so quickly, as you wrote you're developing StandOut in your spare time, so no need for your apologies, just big thanks from the people who use and enjoy your library!!
[Android Apps and Games] darkpain:
Thank you very much for the fast response!

I have found the solution.

The problem was that when you create new window the EditText was having different id but for some reason the Buttons click listeners were setting the text in the last window`s EditText.After many tries i found the solution by writing this in every Button listener instead in createAndAttachView() :

editText = (EditText) v.getRootView().findViewById(R.id.myedittext);
[Android Apps and Games] acquariusoft:
Very goood!!!

This update seems to solve all my problem.

You are very quickly!!!

Inviato dal mio Transformer TF101 con Tapatalk 2
[Android Apps and Games] wutk3ksHD:
solved same problem for me. There is no "additional Edittext" anymore and all edittextes in other applications work for me. Will proof with WebView.

<edit> But i still have problems with Vol+ / Vol-. If i focused the window, volume will not change. if the window is out of focus, i can change volume. @ 2.3.7</edit>

Great Work!
[Android Apps and Games] acquariusoft:
I have a question for you.

From a floatwindows i launch a preferenceActivity.

From this activity i wanna send a message to all floatingwindows.

How can i do?

I have only find StandOutWindow.sendData but i don't know all ids

Tnx
[Android Apps and Games] pingpongboss:
Awesome! I'm glad I finally figured all this stuff out. There's a new version out that will provide a different visual state for windows that are focused. Developers can choose to turn this off with flags.

I've been vacationing in Japan and China, I don't know how I manage to have time working on this :p

But I'll be starting work in August so I'm trying to pump out as many changes as I can before I get real busy.

Yes, this is possible. In your PreferenceActivity, do this:

StandOutWindow.sendData(context, toCls, StandOutWindow.DISREGARD_ID, requestCode, data, null, StandOutWindow.DISREGARD_ID);

You can set context to the PreferenceActivity, toCls should be the implementation class of all the windows you are trying to send the message to. DISREGARD_ID means that you are not sending this message to a specific window. requestCode is something you choose, and you'll look for the same requestCode in onReceiveData(). Put the message you want to send in data. Everything after that is not important, since you don't expect a response back.

In StandOutWindow.java change getCacheIds() to be protected instead of private. I'll make it easy for implementations to get all ids later, but since you'll need a solution right now just edit it temporarily.

In your implementation class, override onReceiveData(...), make sure the id argument is DISREGARD_ID and request code argument is requestCode. Then get the list of ids with getCacheIds(), and there u have all the ids.

I'll let you know when I make it easier to do this.
[Android Apps and Games] acquariusoft:
tnx for the help!!

another little big question.

Is possible launch an external app in a StandoutWindow? i can call an external activity and insert in it?

Inviato dal mio Transformer TF101 con Tapatalk 2
[Android Apps and Games] pingpongboss:
you can start an app with startActivity(). look at how FloatingFolders can start arbitrary apps.

im not sure what "insert in it" means.

Edit: oh i think you meant, can you host an app inside a StandoutWindow? No you can't. You can only host views!
[Android Apps and Games] acquariusoft:
yes, you have understand right.

Tnx for response

Inviato dal mio Transformer TF101 con Tapatalk 2
[Android Apps and Games] Metallice:
Wow this looks great. Hope app devs use this. Thanks for sharing! I love floating apps.

By the way, Is that floating folders app available to download? Looks great and i've actually been looking for something like that.
[Android Apps and Games] AlkaDragos:
I've seen a floating folder example. Is there an compiled apk anywhere around? :) It looks nice, thank you.
[Android Apps and Games] pingpongboss:
I've attached the latest APKs to this post and the original post.

Keep in mind that Floating Folders is still a tech demo and not really usable at this point. I have not yet added the ability to create more than 1 window, apps cannot be moved around, and I need to make resizing smarter and persistent.

But I'm always working on it so one day it may become a full fledged app on the Market :)
[Android Apps and Games] darkpain:
DarkCalc

Hello Mark,

Thanks to your library i published my first application(DarkCalc):D

Thank you very much again for your support and for publishing your work!

You can view the thread i have just created for the application here
[Android Apps and Games] pingpongboss:
AWESOME!! You get the distinction for being the first published StandOut app! Going to steal your screenshot, if you don't mind.

Edit:

I'm glad I have an actual app to play around now. I'll be adding a few features to StandOut after seeing your app:

Minimum width/height

keep aspect ratio option (when resizing)

Let me know if you wish StandOut had any other features while you were developing DarkCalc.

Also, I have a question about your app's focus behavior, if you don't mind. I noticed that you don't keep focus even after I interact with the UI. But you obviously need focus for the buttons to have their pressed state changed visually. Did you change the default focus behavior? Like manually relinquish focus on ACTION_UP or something? You can email me at markwei@gmail.com if it's not something you want to discuss on a forum.
[Android Apps and Games] darkpain:
Wow,thanks Mark:D

Get everything you want,i dont mind:D

If it wasnt you i couldnt do it;)

EDIT

I have emailed you the things i changed so you can improved your library.
[Android Apps and Games] xdaid:
pardon my intrusion, i made some test-apps which contain buttons, lists and so on, all of them work prefectly with no need of focus provided that you use a touch listener instead of a click listener for your buttons and items.

However, the developer is able to choose to gain focus or not, that's a great idea.
[Android Apps and Games] pingpongboss:
Hmm, in my experience, if the window does not have focus, then Buttons and ListViews will not "look" pressed when you click it. It will still work, but won't look pretty. Does your experience differ?
[Android Apps and Games] xdaid:
I mean, once i assign a touch listener to a button i can easily handle how it looks, i can change its background according to the current state (pressed/released).

This does not involve any change in the library itself, it's made on the view i attach via createAndAttachView method.

Edit: Don't know if you're interested (since the library is not involved directly) but i can send you the code i use to make the buttons look pressed (once at home)
[Android Apps and Games] pingpongboss:
Yes, you are correct! But the beauty of having focus is, the state of the button is automatically changed by the android system (just like in a regular app). This way, you don't need to change the drawable of the button yourself, you can just use the Button's default background or create your own StateListDrawable.

Developers who want to take advantage of this "automatic" state changing can use the default focus behavior in the latest StandOut update. You only need to setOnClickListener() and don't have to worry about onTouchListener() anymore.

Btw xdaid, I'm waiting for news from you about any apps that you might be making ;) Anything in progress?
[Android Apps and Games] xdaid:
hehe yes you're right, but most of the times i use onTouchListener() even if i could use onClickListener(), the outouch gives me more options :)

I'm doing lot of tests and one app (or two), they work but still not ready for a release. However, work in progress!
[Android Apps and Games] pingpongboss:
New update

And there's a new changelog section on the OP.

looking forward to it!
[Android Apps and Games] pingpongboss:
Updated 6/24: Constant aspect ratio
[Android Apps and Games] pingpongboss:
Thanks to a few emails from wutk3ksHD, I've implemented the ability to manipulate the titles of the window, as well as minimum/maximum width and height, and a new FLAG_WINDOW_ASPECT_RATIO_ENABLE to keep the window under a constant aspect ratio while resizing.

I also want to share his finding that under Android 2.3 (and possibly others), if the window is in focus, VOLUME_UP and DOWN keys will be consumed by the window instead of the system. Implement the onKeyEvent(int id, Window window, KeyEvent event) to handle this if your app needs to.

Also got a preview of his app ;) cool stuff man
[Android Apps and Games] acquariusoft:
Hi,

very tnx for your great library.

I like use light theme but i don't know where i must set.

i try

android:theme="@android:style/Theme.Light"

in application tag in AndroidManifest.xml

and

setTheme(android.R.style.Theme_Light);

on createAndAttachView but not work.

How can i do? Tnx!!
[Android Apps and Games] pingpongboss:
Try adding the android:theme to the <application> instead. I have no idea if it will work. If it doesn't, maybe some other people can chime in.
[Android Apps and Games] acquariusoft:
already tried in the application but not work!

---------- Post added at 03:56 PM ---------- Previous post was at 03:22 PM ----------

I have solved inserting the line

setTheme(android.R.style.Theme_Holo_Light);

in

the function

public Window(int id)

is possible insert some code to edit the theme or i need change the code of library on every release :P

Tnx for quick response
[Android Apps and Games] pingpongboss:
well holy crap, good work figuring it out. I didn't think it's possible.

I'll add a way to customize the theme in the next StandOut release if you give me details on how you did it. (which line? after super()?)
[Android Apps and Games] acquariusoft:
yes, after super i set the theme.
[Android Apps and Games] pingpongboss:
OK. I'll be on a 12 hour plane in a second so I'll be pushing this out tomorrow.
[Android Apps and Games] acquariusoft:
very good!!

Tnx for your hard work!!
[Android Apps and Games] xdaid:
You can do it by yourself by adding an argument to window costructor, show and getShowIntent methods. Note that show(int id) is the only place where new Window(int id) is called.

You'll have something like

public Window(int id, int theme)

void show(Context context, Class<? extends StandOutWindow> cls, int id, int theme)

Intent getShowIntent(Context context, Class<? extends StandOutWindow> cls, int id, int theme)

protected final synchronized Window show(int id, int theme)

By doing this way you pass the argument "theme" from the show method you call from your code till the Window constructor and the setTheme method inside. In getShowIntent remember to add

.putExtra("theme", theme)

to the intent.

*Don't know how smart it could be but it should work*

EDIT:

Nevermind what i wrote above, i did not read Mark's answer, he'll find the best way :)
[Android Apps and Games] pingpongboss:
Haha I pushed something out in a hurry. Plane is boarding. Please test it out.

You can't seem to set the theme for each window individually. You have to set the theme for the entire implementation

This should mean that if you have multiple implementations (2 different Services that extend StandOutWindow) then you should be able to set the theme differently for those Services. Plane is boarding so I can't test haha.

Who's going to Google IO? :laugh:
[Android Apps and Games] brandall:
I was looking for just something like this to implement into my application :) Fantastic! Thanks for sharing.

Do you have any plans (or is it possible) to add pinch resizing?
[Android Apps and Games] acquariusoft:
Tnx, it works very well!!!

Fast and easy solution!!

---------- Post added at 05:31 PM ---------- Previous post was at 05:21 PM ----------

Last request for today ;D

is possible have the onresize event with the size and position of windows, so it's possible to save and restore easily?
[Android Apps and Games] pingpongboss:
Now I have plans to :) thanks for the suggestion I was running out of things to do.

I implemented a crappy version on the plane. I'll try to find if android has a native way to recognize pinch gestures. If not I'll improve my custom handling and push it later.

You can get the LayoutParams from window.getLayoutParams() and access the size and position of the window that way. FloatingFolders now remembers the size in onResize()
[Android Apps and Games] leezhang:
Great

Hehe it could be useful~~;)
[Android Apps and Games] acquariusoft:
onresize is good solution.

Tnx!!
[Android Apps and Games] brandall:
Super! :D I've built it in to the next release of my app and it works flawlessly. I'm hugely impressed... I'll link to the use of your library in the app thread and drop you the apk link when I get it finalised.
[Android Apps and Games] pingpongboss:
OMG you're the creator of utter! I can't wait to check it out :good: