Esempio n. 1
0
        public override bool onInterceptTouchEvent(MotionEvent @event)
        {
            XStandOutWindow.StandOutLayoutParams @params = (XStandOutWindow.StandOutLayoutParams)getLayoutParams();

            // focus window
            if (@event.getAction() == MotionEvent.ACTION_DOWN)
            {
                if (mContext.getFocusedWindow() != this)
                {
                    mContext.focus(id);
                }
            }

            // multitouch

            // script: error JSC1000: Java : Opcode not implemented: brfalse.s at PopupWebView.Library.XWindow.onInterceptTouchEvent

            var flag1 = @event.getPointerCount() >= 2;
            var flag2 = (@event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_DOWN;

            var flag = flag1 &&
                       XUtils.isSet(flags, XStandOutFlags.FLAG_WINDOW_PINCH_RESIZE_ENABLE) &&
                       flag2;

            if (flag)
            {
                touchInfo.scale       = 1;
                touchInfo.dist        = -1;
                touchInfo.firstWidth  = @params.width;
                touchInfo.firstHeight = @params.height;
                return(true);
            }

            return(false);
        }
Esempio n. 2
0
 public virtual void commit()
 {
     if (mParams != null)
     {
         that.mContext.updateViewLayout(that.id, mParams);
         mParams = null;
     }
 }
Esempio n. 3
0
            public Editor(XWindow that)
            {
                this.that = that;

                mParams = (XStandOutWindow.StandOutLayoutParams) this.that.getLayoutParams();
                anchorX = 0;
                anchorY = 0;
            }
Esempio n. 4
0
 public override ViewGroup.LayoutParams getLayoutParams()
 {
     XStandOutWindow.StandOutLayoutParams @params = (XStandOutWindow.StandOutLayoutParams)base.getLayoutParams();
     if (@params == null)
     {
         @params = originalParams;
     }
     return(@params);
 }
Esempio n. 5
0
        public virtual bool onFocus(bool focus)
        {
            if (!XUtils.isSet(flags, XStandOutFlags.FLAG_WINDOW_FOCUSABLE_DISABLE))
            {
                // window is focusable

                if (focus == focused)
                {
                    // window already focused/unfocused
                    return(false);
                }

                focused = focus;

                // alert callbacks and cancel if instructed
                if (mContext.onFocusChange(id, this, focus))
                {
                    //Log.d(TAG, "Window " + id + " focus change "
                    //        + (focus ? "(true)" : "(false)")
                    //        + " cancelled by implementation.");
                    focused = !focus;
                    return(false);
                }



                // set window manager params
                XStandOutWindow.StandOutLayoutParams @params = (XStandOutWindow.StandOutLayoutParams)getLayoutParams();
                @params.setFocusFlag(focus);
                mContext.updateViewLayout(id, @params);

                if (focus)
                {
                    mContext.setFocusedWindow(this);
                }
                else
                {
                    if (mContext.getFocusedWindow() == this)
                    {
                        mContext.setFocusedWindow(null);
                    }
                }

                return(true);
            }
            return(false);
        }
        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. 7
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. 8
0
 public virtual void commit()
 {
     if (mParams != null)
     {
         that.mContext.updateViewLayout(that.id, mParams);
         mParams = null;
     }
 }
Esempio n. 9
0
            public Editor(XWindow that)
            {
                this.that = that;

                mParams = (XStandOutWindow.StandOutLayoutParams)this.that.getLayoutParams();
                anchorX = 0;
                anchorY = 0;
            }
 public virtual bool onUpdate(int arg0, XWindow arg1, XStandOutWindow.StandOutLayoutParams arg2)
 {
     return(false);
 }
Esempio n. 11
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());
        }