/// <summary>
        /// This method sets bar on an appropriate border.
        /// </summary>
        /// <param name="alignment">
        ///            This parameter shall be RelativeLayout alignment. It indicates on which border
        ///            floating controller shall be placed initially. Its value ma be:
        ///            RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.ALIGN_PARENT_RIGHT,
        ///            RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.ALIGN_PARENT_BOTTOM. </param>
        private void putBarOnBoard(int alignment)
        {
            FrameLayout hLayout      = mPanelMap[alignment];
            View        CurrentChild = null;

            if (hLayout != null)
            {
                CurrentChild = hLayout.getChildAt(0);
            }

            if (this.mBarAlignment == alignment && CurrentChild != null && CurrentChild.Visibility == View.VISIBLE)
            {
                return;
            }

            ControlBar visibleBar = null;

            FrameLayout.LayoutParams @params;

            if (hLayout != null)
            {
                FrameLayout parentLayout = null;
                int         size         = mControlBar.Context.Resources.getDimensionPixelSize(R.dimen.default_controlbar_thickness);

                mBarAlignment = alignment;
                mOrientation  = HORIZONTAL;
                visibleBar    = mControlBar;

                @params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, size, mGravityMap[alignment]);

                if (visibleBar != null)
                {
                    parentLayout = (FrameLayout)visibleBar.Parent;
                }

                if (parentLayout != null)
                {
                    parentLayout.removeView(visibleBar);
                }

                hLayout.addView(visibleBar, @params);

                if (visibleBar != null)
                {
                    visibleBar.CurrentPosition = mBarAlignment;
                    visibleBar.Visibility      = View.INVISIBLE;
                    visibleBar.getChildAt(0).forceLayout();
                }
            }

            if (visibleBar != null)
            {
                visibleBar.CurrentPosition = mBarAlignment;
                visibleBar.Visibility      = View.VISIBLE;
                visibleBar.expand();
            }
        }
Beispiel #2
0
        public override void initLayout(ViewGroup root)
        {
            FrameLayout layout = (FrameLayout)root.findViewById(R.id.topScroll);

            layout.addView(this.mControlBar);
            mMainView = root;
            mPanelMap = new SortedDictionary <int?, ViewGroup>();
            mPanelMap[ALIGN_PARENT_BOTTOM] = (ViewGroup)root.findViewById(R.id.bottomScroll);
            mPanelMap[ALIGN_PARENT_TOP]    = (ViewGroup)root.findViewById(R.id.topScroll);
            mPanelMap[ALIGN_PARENT_LEFT]   = (ViewGroup)root.findViewById(R.id.leftScroll);
            mPanelMap[ALIGN_PARENT_RIGHT]  = (ViewGroup)root.findViewById(R.id.rightScroll);
            View dragReceiver = root.findViewById(R.id.for_content);

            (dragReceiver != null ? dragReceiver : root).OnDragListener = new MyDropListener(this);
            mBarAlignment = mPanelMap.ContainsKey(mBarAlignment) ? mBarAlignment : ALIGN_PARENT_TOP;
            putBarOnBoard(mBarAlignment);
        }