public StandOutLayoutParams(XStandOutWindow that, int id, int w, int h, int xpos, int ypos)
                : this(that, id, w, h)
            {
                if (xpos != AUTO_POSITION)
                {
                    x = xpos;
                }
                if (ypos != AUTO_POSITION)
                {
                    y = ypos;
                }

                Display display = that.mWindowManager.getDefaultDisplay();
                int width = display.getWidth();
                int height = display.getHeight();

                if (x == RIGHT)
                {
                    x = width - w;
                }
                else if (x == CENTER)
                {
                    x = (width - w) / 2;
                }

                if (y == BOTTOM)
                {
                    y = height - h;
                }
                else if (y == CENTER)
                {
                    y = (height - h) / 2;
                }
            }
            public StandOutLayoutParams(XStandOutWindow that, int id, int w, int h, int xpos, int ypos)
                : this(that, id, w, h)
            {
                if (xpos != AUTO_POSITION)
                {
                    x = xpos;
                }
                if (ypos != AUTO_POSITION)
                {
                    y = ypos;
                }

                Display display = that.mWindowManager.getDefaultDisplay();
                int     width   = display.getWidth();
                int     height  = display.getHeight();

                if (x == RIGHT)
                {
                    x = width - w;
                }
                else if (x == CENTER)
                {
                    x = (width - w) / 2;
                }

                if (y == BOTTOM)
                {
                    y = height - h;
                }
                else if (y == CENTER)
                {
                    y = (height - h) / 2;
                }
            }
            public StandOutLayoutParams(XStandOutWindow that, int id)
                : base(200, 200, TYPE_PHONE,
                       StandOutLayoutParams.FLAG_NOT_TOUCH_MODAL
                       | StandOutLayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
                       PixelFormat.TRANSLUCENT)
            {
                this.that = that;


                int windowFlags = that.getFlags(id);

                setFocusFlag(false);

                if (!XUtils.isSet(windowFlags,
                                  XStandOutFlags.FLAG_WINDOW_EDGE_LIMITS_ENABLE))
                {
                    // windows may be moved beyond edges
                    flags |= FLAG_LAYOUT_NO_LIMITS;
                }

                x = getX(id, width);
                y = getY(id, height);

                gravity = Gravity.TOP | Gravity.LEFT;

                threshold = 10;
                minWidth  = minHeight = 0;
                maxWidth  = maxHeight = Integer.MAX_VALUE;
            }
            public StandOutLayoutParams(XStandOutWindow that, int id)
                : base(200, 200, TYPE_PHONE,
                        StandOutLayoutParams.FLAG_NOT_TOUCH_MODAL
                                | StandOutLayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
                        PixelFormat.TRANSLUCENT)
            {
                this.that = that;


                int windowFlags = that.getFlags(id);

                setFocusFlag(false);

                if (!XUtils.isSet(windowFlags,
                        XStandOutFlags.FLAG_WINDOW_EDGE_LIMITS_ENABLE))
                {
                    // windows may be moved beyond edges
                    flags |= FLAG_LAYOUT_NO_LIMITS;
                }

                x = getX(id, width);
                y = getY(id, height);

                gravity = Gravity.TOP | Gravity.LEFT;

                threshold = 10;
                minWidth = minHeight = 0;
                maxWidth = maxHeight = Integer.MAX_VALUE;
            }
 public StandOutLayoutParams(XStandOutWindow that, int id, int w, int h)
     : this(that, id)
 {
     width  = w;
     height = h;
 }
 public StandOutLayoutParams(XStandOutWindow that, int id, int w, int h, int xpos, int ypos, int minWidth, int minHeight, int threshold)
     : this(that, id, w, h, xpos, ypos, minWidth, minHeight)
 {
     this.threshold = threshold;
 }
 public StandOutLayoutParams(XStandOutWindow that, int id, int w, int h, int xpos, int ypos, int minWidth, int minHeight)
     : this(that, id, w, h, xpos, ypos)
 {
     this.minWidth  = minWidth;
     this.minHeight = minHeight;
 }
 public virtual void sendData(int fromId, Class toCls, int toId, int requestCode, Bundle data)
 {
     XStandOutWindow.sendData(this, toCls, toId, requestCode, data,
                              GetType
                                  ().ToClass(), fromId);
 }
        public virtual void updateViewLayout(int id, XStandOutWindow.StandOutLayoutParams @params)
        {
            XWindow window = getWindow(id);

            if (window == null)
            {
                throw new System.Exception("Tried to updateViewLayout("
                        + id + ") a null window.");
            }

            if (window.visibility == XWindow.VISIBILITY_GONE)
            {
                return;
            }

            if (window.visibility == XWindow.VISIBILITY_TRANSITION)
            {
                return;
            }

            // alert callbacks and cancel if instructed
            if (onUpdate(id, window, @params))
            {
                //Log.w(TAG, "Window " + id + " update cancelled by implementation.");
                return;
            }

            try
            {
                window.setLayoutParams(@params);
                mWindowManager.updateViewLayout(window, @params);
            }
            catch// (Exception ex) 
            {
                //ex.printStackTrace();
            }
        }
Esempio n. 10
0
        //location: class PopupWebView.Library.XWindow
        //super(class35.context);

        public XWindow(Context xcontext)
            : base(xcontext)
        {
            // ?
            mContext = null;
        }
 public virtual bool onUpdate(int arg0, XWindow arg1, XStandOutWindow.StandOutLayoutParams arg2)
 {
     return false;
 }
 public StandOutLayoutParams(XStandOutWindow that, int id, int w, int h)
     : this(that, id)
 {
     width = w;
     height = h;
 }
 public StandOutLayoutParams(XStandOutWindow that, int id, int w, int h, int xpos, int ypos, int minWidth, int minHeight, int threshold)
     : this(that, id, w, h, xpos, ypos, minWidth, minHeight)
 {
     this.threshold = threshold;
 }
Esempio n. 14
0
        //location: class PopupWebView.Library.XWindow
        //super(class35.context);

        public XWindow(Context xcontext)
            : base(xcontext)
        {
            // ?
            mContext = null;
        }
Esempio n. 15
0
        public XWindow(XStandOutWindow xcontext, int id)
            : base(xcontext)
        {
            var context = xcontext;

            context.setTheme(context.getThemeStyle());

            mContext = context;
            //mLayoutInflater = LayoutInflater.from(context);

            this.cls            = context.GetType().ToClass();
            this.id             = id;
            this.originalParams = context.getParams(id, this);
            this.flags          = context.getFlags(id);
            this.touchInfo      = new XTouchInfo();
            touchInfo.ratio     = (float)originalParams.width / originalParams.height;
            this.data           = new Bundle();
            DisplayMetrics metrics = mContext.getResources()
                                     .getDisplayMetrics();

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

            // create the window contents
            View        content;
            FrameLayout body;


            content = new FrameLayout(context);
            body    = (FrameLayout)content;

            addView(content);

            body.setOnTouchListener(new XOnTouchListener
            {
                yield = (View v, MotionEvent @event) =>
                {
                    // pass all touch events to the implementation
                    var consumed = false;

                    // handle move and bring to front
                    consumed = context.onTouchHandleMove(id, this, v, @event) ||
                               consumed;

                    // alert implementation
                    consumed = context.onTouchBody(id, this, v, @event) ||
                               consumed;

                    return(consumed);
                }
            });

            // attach the view corresponding to the id from the
            // implementation
            context.createAndAttachView(id, body);

            // make sure the implementation attached the view
            if (body.getChildCount() == 0)
            {
                throw new System.Exception(
                          "You must attach your view to the given frame in createAndAttachView()");
            }

            //// implement StandOut specific workarounds
            //if (!XUtils.isSet(flags,
            //        XStandOutFlags.FLAG_FIX_COMPATIBILITY_ALL_DISABLE))
            //{
            //    fixCompatibility(body);
            //}
            //// implement StandOut specific additional functionality
            //if (!XUtils.isSet(flags,
            //        XStandOutFlags.FLAG_ADD_FUNCTIONALITY_ALL_DISABLE))
            //{
            //    addFunctionality(body);
            //}

            // attach the existing tag from the frame to the window
            setTag(body.getTag());
        }
Esempio n. 16
0
        public XWindow(XStandOutWindow xcontext, int id)
            : base(xcontext)
        {
            var context = xcontext;

            context.setTheme(context.getThemeStyle());

            mContext = context;
            //mLayoutInflater = LayoutInflater.from(context);

            this.cls = context.GetType().ToClass();
            this.id = id;
            this.originalParams = context.getParams(id, this);
            this.flags = context.getFlags(id);
            this.touchInfo = new XTouchInfo();
            touchInfo.ratio = (float)originalParams.width / originalParams.height;
            this.data = new Bundle();
            DisplayMetrics metrics = mContext.getResources()
                    .getDisplayMetrics();
            displayWidth = metrics.widthPixels;
            displayHeight = (int)(metrics.heightPixels - 25 * metrics.density);

            // create the window contents
            View content;
            FrameLayout body;


            content = new FrameLayout(context);
            body = (FrameLayout)content;

            addView(content);

            body.setOnTouchListener(new XOnTouchListener
            {

                yield = (View v, MotionEvent @event) =>
                {
                    // pass all touch events to the implementation
                    var consumed = false;

                    // handle move and bring to front
                    consumed = context.onTouchHandleMove(id, this, v, @event)
                            || consumed;

                    // alert implementation
                    consumed = context.onTouchBody(id, this, v, @event)
                            || consumed;

                    return consumed;
                }
            });

            // attach the view corresponding to the id from the
            // implementation
            context.createAndAttachView(id, body);

            // make sure the implementation attached the view
            if (body.getChildCount() == 0)
            {
                throw new System.Exception(
                        "You must attach your view to the given frame in createAndAttachView()");
            }

            //// implement StandOut specific workarounds
            //if (!XUtils.isSet(flags,
            //        XStandOutFlags.FLAG_FIX_COMPATIBILITY_ALL_DISABLE))
            //{
            //    fixCompatibility(body);
            //}
            //// implement StandOut specific additional functionality
            //if (!XUtils.isSet(flags,
            //        XStandOutFlags.FLAG_ADD_FUNCTIONALITY_ALL_DISABLE))
            //{
            //    addFunctionality(body);
            //}

            // attach the existing tag from the frame to the window
            setTag(body.getTag());
        }
            public StandOutLayoutParams(XStandOutWindow that, int id, int w, int h, int xpos, int ypos, int minWidth, int minHeight)
                : this(that, id, w, h, xpos, ypos)
            {

                this.minWidth = minWidth;
                this.minHeight = minHeight;
            }