I respect your views, but its fine with me even if it works only on my
android version as its a personal project. The fact thats its been
done (check proof of concepts in OP) and we are unable to do it
discomforts even more :(

On Dec 19, 7:12 am, Dianne Hackborn <hack...@android.com> wrote:
> The whole point of that window type is the window can't get any user input.
>
> This is not stuff that third party applications are supposed to do.  I
> strongly discourage this -- whatever you do here is likely to break in
> future versions of the platform.
>
>
>
>
>
>
>
>
>
> On Sat, Dec 18, 2010 at 4:58 PM, Aco <gamestic...@gmail.com> wrote:
> > Hi All! I'm trying to create an always-op-top button/clickable-image
> > which stays on top of all the windows all the time. The proof of
> > concept is here
> >http://www.appbrain.com/app/smart-taskbar-%28sidebar%29/com.smart.tas...
> > and herehttp://forum.xda-developers.com/showthread.php?t=865525I'm
> > following this example code
>
> >http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;...
>
> > I have been successful and have a running service now. The service
> > displays some text on top left corner of screen all the time while
> > user can freely interact with rest of apps in normal manner. What I'm
> > doing is subclass ViewGroup and add it to root window manager with
> > flag TYPE_SYSTEM_OVERLAY. Now I want to add a button/clickable-image
> > in place of this text which can receive touch events on itself. I
> > tried overriding "onTouchEvent" for the whole ViewGroup but it does
> > not receive any event. How can I receive events only on certain parts
> > of my always-on-top view group? Kindly suggest.
>
> > ======
> > CODE=
> > ======
>
> > import android.app.Service;
> > import android.content.Context;
> > import android.content.Intent;
> > import android.graphics.Canvas;
> > import android.graphics.Paint;
> > import android.graphics.PixelFormat;
> > import android.os.IBinder;
> > import android.view.Gravity;
> > import android.view.MotionEvent;
> > import android.view.ViewGroup;
> > import android.view.WindowManager;
> > import android.widget.AbsoluteLayout;
> > import android.widget.Button;
> > import android.widget.LinearLayout;
> > import android.widget.RelativeLayout;
> > import android.widget.Toast;
>
> > public class HUD extends Service {
> >        HUDView mView;
>
> >       �...@override
> >        public IBinder onBind(Intent intent) {
> >                return null;
> >        }
>
> >       �...@override
> >        public void onCreate() {
> >                super.onCreate();
> >                Toast.makeText(getBaseContext(),"onCreate",
> > Toast.LENGTH_LONG).show();
> >                mView = new HUDView(this);
> >                WindowManager.LayoutParams params = new
> > WindowManager.LayoutParams(
> >                                WindowManager.LayoutParams.WRAP_CONTENT,
> >                                WindowManager.LayoutParams.WRAP_CONTENT,
>
> >  WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
> >                                0,
> > //
> >  WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
> > //                                              |
> > WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
> >                                PixelFormat.TRANSLUCENT);
> >                params.gravity = Gravity.RIGHT | Gravity.TOP;
> >                params.setTitle("Load Average");
> >                WindowManager wm = (WindowManager)
> > getSystemService(WINDOW_SERVICE);
> >                wm.addView(mView, params);
> >        }
>
> >       �...@override
> >        public void onDestroy() {
> >                super.onDestroy();
> >                Toast.makeText(getBaseContext(),"onDestroy",
> > Toast.LENGTH_LONG).show();
> >                if(mView != null)
> >                {
> >                        ((WindowManager)
> > getSystemService(WINDOW_SERVICE)).removeView(mView);
> >                        mView = null;
> >                }
> >        }
> > }
>
> > class HUDView extends ViewGroup {
> >        private Paint mLoadPaint;
>
> >        public HUDView(Context context) {
> >                super(context);
> >                Toast.makeText(getContext(),"HUDView",
> > Toast.LENGTH_LONG).show();
>
> >                mLoadPaint = new Paint();
> >                mLoadPaint.setAntiAlias(true);
> >                mLoadPaint.setTextSize(10);
> >                mLoadPaint.setARGB(255, 255, 0, 0);
> >        }
>
> >       �...@override
> >        protected void onDraw(Canvas canvas) {
> >                super.onDraw(canvas);
> >                canvas.drawText("Hello World", 5, 15, mLoadPaint);
> >        }
>
> >       �...@override
> >        protected void onLayout(boolean arg0, int arg1, int arg2, int arg3,
> > int arg4) {
> >        }
>
> >       �...@override
> >        public boolean onTouchEvent(MotionEvent event) {
> >                //return super.onTouchEvent(event);
> >                Toast.makeText(getContext(),"onTouchEvent",
> > Toast.LENGTH_LONG).show();
> >                return true;
> >        }
> > }
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to