Example #1
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());
        }
Example #2
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());
        }