yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] negiot:
Titlebar layout

Hi, for change the layout of your titlebar, I have create in my res/layout/ the file system_window_decorators.xml is correct way or not?

Best regards

negiot
[Android Apps and Games] abudgx:
You could leave the window visible but move it out of the display by specifying a negative x,y position.
[Android Apps and Games] yik6787:
hi pingpongboss, i am trying create a floating application which able to call few of the apps, how i oepn another apps on floating window?do i need to custom view?do you have tutorial about this? hopefully u saw my reply
[Android Apps and Games] yik6787:
hi sir, i just start developing android apps,and i try on simple webview which direct to google,but the floating example force close?can i ask why?
[Android Apps and Games] yik6787:
dude can i get your source code?tq
[Android Apps and Games] joplayer:
I might answer this a bit too late but for those like me that might have encountered this issue of Window never showing you should look at your manifest. Actually in the <application> you must not forget to put

<service android:name=".yourWindowClass"></service>
[Android Apps and Games] yik6787:
thx for the answer, the problem is i cant put the onClick() in xml,have to use onclicklisterner.TQ, iam doing floating note do you have any tutorial or reference on this topic?
[Android Apps and Games] Leonidas10:
Floating Atiora Player

I have created a floating music player using this library. Thank you [MENTION=2484344]pingpongboss[/MENTION] for this awesome library. :o

https://play.google.com/store/apps/details?id=com.tesla.atiora.player

[URL="http://xdaforums.com/android/apps-games/coolest-floating-music-player-facebook-t2978007"[/URL]
[Android Apps and Games] Ironsteel:
Made Call Utils - A call utility app where I used Standout library extensively. Link to the app -

https://play.google.com/store/apps/details?id=callutils.com.scimet.admin.callutils
[Android Apps and Games] yik6787:
guys is i wana create a floating note pad, but when i wan show the listview i need to extends listactivity right?den what i supposed to do to extends standoutwindow
[Android Apps and Games] hotspot_volcano:
Nope i using a listview without extending anything addition
[Android Apps and Games] wutk3ksHD:
Here is a small sample of how to implement a list inside a StandOutWindow.

First, create your layoutfile named xyz including a ListView-Element like this:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/v_listview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
</LinearLayout>

In your class which extends StandOutWindow, override the method createAndAttachView(...) like this

@Override
public void createAndAttachView(int id, FrameLayout frame)
{
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.xyz, frame, true);
}

You can now compile the application. An empty ListView will appear, resulting in showing nothing inside your window.

You can access the ListView inside the method onShow(...) like this:

@Override
public boolean onShow(final int id, final Window window)
{
ListView v_listview = (ListView) window.findViewById(R.id.v_listview);
String[] values = new String[] {"Android", "iPhone", "WindowsMobile"};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_1, android.R.id.text1, values);
v_listview.setAdapter(adapter);
return false;
}
[Android Apps and Games] fekri.navid:
question about standoutwindow theme please

Hello

when i use each controls (example seekbar) in standoutwindow , standoutwindow show it look old android device theme. but my api that i used in android studio is 21! i uploaded 2 screenshot to show you what do i mean. pleae help me to make it theme newer.:(

thanks

screenshot

upload7.ir/uploads//f79e25893a4b3ec053e3e877a17ecb08e8949126.png
[Android Apps and Games] yik6787:
Hi sir, thanks for the example, but i still cant work on it, before i use standoutout library everything is just working fine. Hope you will help me,tq,the attachment is my short code
[Android Apps and Games] wutk3ksHD:
Oh dear... StandOutWindow is a Service, not an Activity. Since that, you cannot access methods like "onBackPressed" and "onListItemClicked" from Activity. In a StandOutWindow, you only have these two methods where you better handle everything: createAndAttachView and onShow. In onShow, you access your ListView, load your notes, set an OnItemClickListener to your ListView and do all the other stuff.
[Android Apps and Games] hotspot_volcano:
Try the following

1)Create the listview as an xml file in layout folder as described at http://www.heikkitoivonen.net/blog/2009/02/15/multicolumn-listview-in-android/

2)Add a listview to your main layout (Place it near the bottom of your layout as you may want it to appear over all the other layouts items

change the code slightly-->

mSchedule = new SimpleAdapter(this, mylist, R.layout.YOURXMLLISTFILENAMEGOESHERE!!!!!!!!!!!!!!!!!!!!!!!!,

Most of the code other than variable intializations should go in

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

}

use the following code to capture clicks

yourlistview = (ListView) YOURVIEWGOESHERE.findViewById(R.id.yourlistview);

yourlistview.setOnItemClickListener(new AdapterView.OnItemClickListener() {

@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {

Object o = yourlistview.getItemAtPosition(position);
System.out.println("contents: " + o.toString());

}
}
});

3)Set the visiblity as visible when required and as invisible when not in use.

---------- Post added at 01:33 PM ---------- Previous post was at 01:04 PM ----------

Hmm i had the same outcome when tried.. Perhaps use a seekbar style. I used styled buttons and it worked fine.
[Android Apps and Games] joplayer:
Hi Guys I got a small issue with StandOut

Actually I might not be doing it correctly but I'm trying to use a dynamic size for my Window. As it must be compatible with a huge amount of devices I'm using the solution in one of Mark's example to auto generate the Window Size based on the layout. However at the very first launch of the Window it isn't working at all and giving me a ridiculously small window.

That is why I'd like to know if any of you encountered this problem and how did you solve it.

Btw if you use another way to generate the size I'd be happy to learn how.

My current code :

int heightMeasureSpec = frame.getHeight();
int widthMeasureSpec = frame.getWidth();

frame.measure(widthMeasureSpec, heightMeasureSpec);
frame.getMeasuredHeight();
frame.getMeasuredWidth();

SharedPreferences preferences = getSharedPreferences("dimensions", MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();

editor.putLong("height", frame.getMeasuredHeight());
editor.putLong("width", frame.getMeasuredWidth());
editor.commit();
[Android Apps and Games] wutk3ksHD:
I dont know where you place this code. StandOutWindow has a method for you, named getParams(...), where you can set the width and height of a window, before it gets shown. Example:

public StandOutLayoutParams getParams(int id, Window window){
return new StandOutLayoutParams(id, StandOutLayoutParams.WRAP_CONTENT, StandOutLayoutParams.WRAP_CONTENT, StandOutLayoutParams.CENTER, StandOutLayoutParams.CENTER, 200, 200);
};
[Android Apps and Games] hotspot_volcano:
I currently use this code in my service class. I actually start of using a mini window based on the screenwidth via

width = ((MyApplication) this.getApplication()).getSomeVariable();

There appears to be no height as far as i know.

My question is similar and it is how do i call the maximize and minimize code that is used in the tool bar. Found in the standout library Windows Class

I moved the control code out into

public void changeSize(){

....

}

However calling the function does not resize the window.

import wei.mark.standout.ui.Window;

Window cls2= new Window(getApplicationContext());

cls2.changeSize();
[Android Apps and Games] hotspot_volcano:
Hmm appears some custom list adapters need to work with Activities only.. they do not appear to work well with services, SimpleAdapter seems to work fine. Its beyond me on how to modify them so they work like SimpleAdapter.

Ok finally found a solution for a timer object on a list that actually works. Looked at 6 different solutions.. Just changed a few lines so it looked like SimpleAdapter and it worked. Its mostly there when you can successfully assign the arraydata to the your custom adapter.
[Android Apps and Games] joplayer:
That was it I was actually misplacing my size edition :)

Thanks a lot
[Android Apps and Games] hotspot_volcano:
How to extend further functions from standout library. I'm not sure how to add to a function to the library and be able to call it. This is probably a noobie question. Oh i just noticed standoutwindow is an abstract class.

One thing i need to do is change the title color from my service class

code for StandoutWindow

Window window;
View title;

public static final String ACTION_CHANGE = "CHANGE"; //???????

public final void setTitle(int id, String text) { //change to existing code
window = getWindow(id);
if (window != null) {
title = window.findViewById(R.id.title);
if (title instanceof TextView) {
((TextView) title).setText(text);
}
}
}

//added
public final void changeC(String hexstring){
title.setBackgroundColor(hexstring);	//0xFAFAFA
}

What i tried so far.. Tried to get it as an layout of the current layout. Tried to access it via a new view system_windows_decoration, use http://stackoverflow.com/questions/13670991/interview-can-we-instantiate-abstract-class instantiate the abstract. None so far has worked.

What i might try treat StandOut as a separate activity and try to send data to via an intent???
[Android Apps and Games] fekri.navid:
Strange Problem, help me please

hi dear pingpongboss

i wrote an application that play music. but a strange problem is that when i open new window for playing music and press pause button or every other buttons in old window the music play in new window and the old window music player doesn't work. :crying:

what shoud i do. please help me

b_play=(Button) view.findViewById(R.id.play_icon);

b_play.setOnClickListener(new View.OnClickListener() {

[MENTION=439709]override[/MENTION]

public void onClick(View arg0) {

// check for already playing

if(mp.isPlaying()){

if(mp!=null){

mp.pause();

// Changing button image to play button

b_play.setBackgroundResource(R.drawable.play44);

}

}else{

// Resume song

if(mp!=null){

mp.start();

// Changing button image to pause button

b_play.setBackgroundResource(R.drawable.pause44);

}

}

}

});
[Android Apps and Games] wutk3ksHD:
This sounds like you have a global MediaPlayer for your music in your StandOutWindow class. You better create a local MediaPlayer in onShow() for each window instead.

Here is why: StandOutWIndow is a service. This service contains all windows you create. All of your windows use the same global variables. Do it like this:

public class Window_Musicplayer extends StandOutWindow{

MediaPlayer mMediaplayer; //can be used by any window you create. Delete and dont do this.

//...

@Override
public boolean onShow(final int id, final Window window)
{
//do all stuff here which shall be unique for each window.
MediaPlayer mediaplayerForThisWindow = new MediaPlayer();
Button b_play = (Button) window.findViewById(R.id.play_icon);
b_play.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View arg0)
{
//do stuff with your mediaplayer of this window
}
});
return false;
}
}
[Android Apps and Games] fekri.navid:
thanks alot but i have a big problem! b_play is used in some functions. see the code below please :

//b_play=(Button) view.findViewById(R.id.play_icon);

b_play.setOnClickListener(new View.OnClickListener() {

[MENTION=439709]override[/MENTION]

public void onClick(View arg0) {

// check for already playing

if(mp.isPlaying()){

if(mp!=null){

mp.pause();

// Changing button image to play button

b_play.setBackgroundResource(R.drawable.play44);

}

}else{

// Resume song

if(mp!=null){

mp.start();

// Changing button image to pause button

b_play.setBackgroundResource(R.drawable.pause44);

}

}

}

});

b_next=(Button) view.findViewById(R.id.right_icon);

b_next.setOnClickListener(new View.OnClickListener() {

[MENTION=439709]override[/MENTION]

public void onClick(View arg0) {

if(turn_shuffle)

{

// shuffle is on - play a random song

Random rand = new Random();

currentPosition = rand.nextInt((adapter.getCount() - 1) - 0 + 1) + 0;

playSong(currentDir + "/" + adapter.getItem(currentPosition).getName());

}

else {

if (currentPosition < (adapter.getCount() - 1)) {

playSong(currentDir + "/" + adapter.getItem(currentPosition + 1).getName());

currentPosition = currentPosition + 1;

} else {

// play first song

playSong(currentDir + "/" + adapter.getItem(1).getName());

currentPosition = 1;

}

}

b_play.setBackgroundResource(R.drawable.pause44);

}

});

what should i do? :(
[Android Apps and Games] wutk3ksHD:
please use pastebin.com and show all of your code so that i can help you.
[Android Apps and Games] fekri.navid:
thanks alot here is pastbin link

pastebin.com/0GEeSJk1

:rolleyes:
[Android Apps and Games] fekri.navid:
please help me. please :crying:
[Android Apps and Games] hotspot_volcano:
A quick update i wasn't able to get make any calls to the StandoffWindow abstract class. So i am still unable to make the title bar flash. Maybe i try to send it via preference when i get around to it.

Setting the window width to the icon size was easy, seems to be a fixed dp no matter whatever the screen resolution.
[Android Apps and Games] evildog1:
the source code should work with android studio....
[Android Apps and Games] hotspot_volcano:
[MENTION=5955060]hoanngothanh[/MENTION]

Why not just disable the search button so they can't double click it. And when they click close button on your search window's main layout it will send a message back to enable the search button.

As for me i built my additional popup windows inside the main activity. I have like 3 layouts hidden in my main layout that gets revealed as required. And since they are layouts they are much more customizable than alertdialogs which dont work.
[Android Apps and Games] yik6787:
guys what function i need to call when i click a button and show a new floating window, which the button also is from another floating window.In the buttonclick Event what shoud i call.

public class main extends StandOutWindow {
Button Btn1;
Button Btn2;
Button Btn3;
Button Btn4;
public String getAppName() {
return "test";
}

@Override
public int getAppIcon() {
return android.R.drawable.ic_menu_close_clear_cancel;
}

@Override
public void createAndAttachView(int id, FrameLayout frame) {
// create a new layout from body.xml
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);

View child = inflater.inflate(R.layout.mainscreen,frame, true);
Btn1 = (Button) child.findViewById(R.id.button1);

Btn1.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {

try {
StandOutWindow.show(this, DialerAppActivity.class,
StandOutWindow.DEFAULT_ID);

}catch (Exception e) {
Log.e("DialerAppActivity", "error: " + e.getMessage(),
e);}
}
});
}
[Android Apps and Games] hotspot_volcano:
StandOutWindow.closeAll(main.this, main.class);
StandOutWindow.show(main.this, DialerAppActivity.class,StandOutWindow.DISREGARD_ID);

Edit I;m not entirely about your code. I use StandOutWindow() to call standout windows.. Is DialerAppActivity a standard activity or is it a Standout service ( DialerAppWindow)?

Everything else like services or activities ,broadcast receivers just use the regular intent method of opening those windows.

Oh you may want to use

public class main extends MultiWindow {

instead which allows more complex standout windows
[Android Apps and Games] yik6787:
thanks dude for the reply. i have done this by changing the context, instead of using .this i use main.this.

one more thing how i change the interface for the floating window?

i wana change to Theme_Holo_Light, and i do it like this,but nothing change.

in StandOutWindow

public int getThemeStyle() {

return android.R.style.Theme_Holo_Light;

}

in Window

context.setTheme(context.getThemeStyle());
[Android Apps and Games] hotspot_volcano:
How to use AlertDialog in StandOutWindow

I was considering doing some YES NO button sets. Got me thinking that it shouldn't be so hard getting Alert Dialogs to work so i took a shot at it.

I actually got it working . So here is an example.. Just pop it onto any button.

// custom dialog
final Dialog dialog = new Dialog(YourWindow.this); //OR final Dialog dialog = Dialog(v.getContext)); //apparently for views from abstract classes.. idk lol
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); //THIS SINGLE LINE MAKES IT ALL WORK
dialog.setContentView(R.layout.custom);
dialog.setTitle("Title...");

// set the custom dialog components - text, image and button
TextView text = (TextView) dialog.findViewById(R.id.text);
text.setText("Android custom dialog example!");
ImageView image = (ImageView) dialog.findViewById(R.id.image);
image.setImageResource(R.drawable.ic_launcher);

Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK);
// if button is clicked, close the custom dialog
dialogButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});

dialog.show();

Create an xml custom.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp" />

<TextView
android:id="@+id/text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#FFF"
android:layout_toRightOf="@+id/image"/>/>

<Button
android:id="@+id/dialogButtonOK"
android:layout_width="100px"
android:layout_height="wrap_content"
android:text=" Ok "
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:layout_below="@+id/image"
/>

</RelativeLayout>

Why does it work?

Short answer is the only way a service can show an alertdialog is if you use a a system alert.

---------- Post added at 09:40 AM ---------- Previous post was at 08:52 AM ----------

I have not tried any themes but the actually bar you see at the top of the screen is NOT an appcompat bar thingy.. its actually another standout-window from what i understand as i get double triggers from window events from a single standoutwindow instance.
[Android Apps and Games] hotspot_volcano:
I did more testing i also got Alertdialog builder working.

cancelAction = new AlertDialog.Builder(yourWindow.this);

// YOUR code here to setpositivebuttons, etc...

AlertDialog dlg = cancelAction.create(); //convert them into AlertDialog that can be manipulated
dlg.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
dlg.show();
[Android Apps and Games] yik6787:
so i cant change the frame?
[Android Apps and Games] hotspot_volcano:
You can always apply custom colors to the xml of your layouts or mess around with the drawables of the library which are used to build the window.
[Android Apps and Games] yik6787:
how about the flag_decoration system?i mean the frame which contain minimize,maximize and exit button.
[Android Apps and Games] yik6787:
Guys urgent!!please help

i create a button to trigger the example floating folder.but the following error come out,please help.Thanks
[Android Apps and Games] hotspot_volcano:
Yeah i got ad-mob Interstitial Ads working but with a problem. The ad appears underneath the standout window, which is probably correct because you woudnt want video ads blocking the way when you get a phone call.

So its comes back to how to call the minimize window function in the toolbar from your service. This still eludes me. I've been asking question for a while. Where is pingpongboss nowadays? haven't seen him reply to this thread.

Currently i can do this.. But this seems to break things as it doesn't switch the maximize/minimize bool state probably need some nasty Preference look-up and settings based on the window name to fix it.

//WIP CODE TO RESIZE the window holdWindow comes from the StandOutWIndowLayout function (use in your service)
StandOutLayoutParams params = (StandOutLayoutParams) holdWindow.getLayoutParams();
params.width = 150;
holdWindow.edit().setSize(params.width, params.height).commit();

I also got back button detection 50% working, but not going to work on for a while as its not important. Just need to figure out how to detect which standout window has got focus (ie the blue outline around it as it currently passes all the backspaces to a single window regardless of which window is selected or an unrelated activity is selected.
[Android Apps and Games] sunnychan2012:
Hi,

I import the Download.zip from gitHub and see only hundred of errors immediately. Where is the library? How should I get started?

Thanks:good:
[Android Apps and Games] ECJ:
Change the code of the lines 107 to 110:

DisplayMetrics metrics = mContext.getResources()
.getDisplayMetrics();
displayWidth = metrics.widthPixels;
displayHeight = (int) (metrics.heightPixels - 25 * metrics.density);

in Window.java for this:

final DisplayMetrics metrics = mContext.getResources().getDisplayMetrics();
OrientationEventListener screenOrientationMonitor =
new OrientationEventListener(this.mContext, SensorManager.SENSOR_DELAY_NORMAL){
int currentOrientation, lastOrientation;
@Override
public void onOrientationChanged(int arg0) {
currentOrientation = mContext.getResources().getConfiguration().orientation;
if (currentOrientation != lastOrientation) {
displayWidth = metrics.widthPixels;
displayHeight = (int) (metrics.heightPixels - 25 * metrics.density);
lastOrientation = currentOrientation;
}
}
};
screenOrientationMonitor.enable();
screenOrientationMonitor.onOrientationChanged(0);

:svetius:
[Android Apps and Games] danizwam:
Hi [MENTION=2484344]pingpongboss[/MENTION],

i think i found and bug and i almost became nuts until i figured out what causes the bug :(

If you set android:targetSdkVersion in the AndroidManifest.xml above 16, the popup menu stays inside the active window and is not really useable.

Attached, you will see some screenshots taken from your FloatingFolder and MultiWindow examples and compiled with different targetSdkVersions.

Is there a workaround, because i want to use some features above SDK 16 :(

Greetings, Daniel
[Android Apps and Games] rezaeareza:
setTitle in standout library

Hi

I use setTitle method in createAndAttachView but title no changed.also for setIcon.
[Android Apps and Games] unrealsoul007:
Using floating back key

Hey, do you know how to use floating View to send hardware back key press event to the underlying activity. Actually my hardware back key is not working so I am looking if I can programmatically send hardware back press event to the underlying event. The app Back Button on playstore (xda not allowing me to post the link) does the same thing but I want to code it on my own. Also this app uses Accessibility Service but I don't know how to use it. Any help would be appreciated. Thanks!
[Android Apps and Games] ToolWiz Privacy:
looks cool, maybe i can use this lib in my project. thanks for your work!