private void init(Context context)
        {
            setUseWeekDayAbbreviation(false);
            dayPaint.TextAlign = Paint.Align.Center;
            dayPaint.SetStyle(Paint.Style.Stroke);
            dayPaint.Flags = PaintFlags.AntiAlias;
            dayPaint.SetTypeface(Typeface.SansSerif);
            dayPaint.TextSize = textSize;
            dayPaint.Color    = new Color(calenderTextColor);
            dayPaint.GetTextBounds("31", 0, "31".Length, rect);
            textHeight = rect.Height() * 3;
            textWidth  = rect.Width() * 2;

            todayCalender.Time = currentDate;
            setToMidnight(todayCalender);

            currentCalender.Time = currentDate;
            setCalenderToFirstDayOfMonth(calendarWithFirstDayOfMonth, currentDate, -monthsScrolledSoFar, 0);

            eventsCalendar.FirstDayOfWeek = Calendar.Monday;

            if (context != null)
            {
                screenDensity = context.Resources.DisplayMetrics.Density;
                ViewConfiguration configuration = ViewConfiguration.Get(context);
                densityAdjustedSnapVelocity = (int)(screenDensity * SNAP_VELOCITY_DIP_PER_SECOND);
                maximumVelocity             = configuration.ScaledMaximumFlingVelocity;
            }

            //just set a default growFactor to draw full calendar when initialised
            growFactor = Integer.MaxValue;
        }
        public BottomSheet4StateBehaviour(Context context, IAttributeSet attrs) : base(context, attrs)
        {
            using (TypedArray a = context.ObtainStyledAttributes(attrs, Resource.Styleable.BottomSheetBehavior_Layout))
            {
                PeekHeight = a.GetDimensionPixelSize(Resource.Styleable.BottomSheetBehavior_Layout_behavior_peekHeight, 0);

                Hideable = a.GetBoolean(Resource.Styleable.BottomSheetBehavior_Layout_behavior_hideable, false);
            }

            /**
             * Getting the anchorPoint...
             */
            AnchorPoint = DefaultAnchorPoint > PeekHeight ? DefaultAnchorPoint : 0;
            Collapsible = true;


            using (TypedArray a1 = context.ObtainStyledAttributes(attrs, Resource.Styleable.CustomBottomSheetBehavior))
            {
                AnchorPoint = (int)a1.GetDimension(Resource.Styleable.CustomBottomSheetBehavior_anchorPoint, DefaultAnchorPoint);
//                _state = a1.GetInt(Resource.Styleable.CustomBottomSheetBehavior_defaultState, StateCollapsed);
                _state = a1.GetInt(Resource.Styleable.CustomBottomSheetBehavior_defaultState, StateAnchorPoint);
            }

            ViewConfiguration configuration = ViewConfiguration.Get(context);

            _minimumVelocity = configuration.ScaledMinimumFlingVelocity;

            _dragCallback = new ViewDragHelperCallback(this);
        }
        /**
         * Creates a new {@code DragAndDropHandler} for the listview implementation
         * in given {@link com.nhaarman.listviewanimations.itemmanipulation.dragdrop.DragAndDropListViewWrapper}
         *
         * @param dragAndDropListViewWrapper the {@code DragAndDropListViewWrapper} which wraps the listview implementation to use.
         */
        public DragAndDropHandler(DragAndDropListViewWrapper dragAndDropListViewWrapper)
        {
            mWrapper = dragAndDropListViewWrapper;
            if (mWrapper.getAdapter() != null)
            {
                setAdapterInternal(mWrapper.getAdapter());
            }

            mScrollHandler = new ScrollHandler(this);
            mWrapper.setOnScrollListener(mScrollHandler);

            mDraggableManager = new DefaultDraggableManager();

            if (Build.VERSION.SdkInt <= BuildVersionCodes.Kitkat)
            {
                mSwitchViewAnimator = new KitKatSwitchViewAnimator(this);
            }
            else
            {
                mSwitchViewAnimator = new LSwitchViewAnimator(this);
            }

            mMobileItemId = INVALID_ID;

            ViewConfiguration vc = ViewConfiguration.Get(dragAndDropListViewWrapper.getListView().Context);

            mSlop = vc.ScaledTouchSlop;
        }
Esempio n. 4
0
        public bool HasSoftKeys()
        {
            bool hasSoftwareKeys;
            var  c = Android.App.Application.Context;

            if (Build.VERSION.SdkInt >= Build.VERSION_CODES.JellyBeanMr1)
            {
                Display d = c.GetSystemService(Context.WindowService).JavaCast <IWindowManager>().DefaultDisplay;

                DisplayMetrics realDisplayMetrics = new DisplayMetrics();
                d.GetRealMetrics(realDisplayMetrics);

                int realHeight = realDisplayMetrics.HeightPixels;
                int realWidth  = realDisplayMetrics.WidthPixels;

                DisplayMetrics displayMetrics = new DisplayMetrics();
                d.GetMetrics(displayMetrics);

                int displayHeight = displayMetrics.HeightPixels;
                int displayWidth  = displayMetrics.WidthPixels;

                BottomBarHeight = (realHeight - displayHeight);

                hasSoftwareKeys = (realWidth - displayWidth) > 0 ||
                                  (realHeight - displayHeight) > 0;
            }
            else
            {
                bool hasMenuKey = ViewConfiguration.Get(c).HasPermanentMenuKey;
                bool hasBackKey = KeyCharacterMap.DeviceHasKey(Keycode.Back);
                hasSoftwareKeys = !hasMenuKey && !hasBackKey;
            }
            return(hasSoftwareKeys);
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            ViewConfiguration vc = new ViewConfiguration();

            vc.Caching = true;
            //vc.PluginFolder = "";
            vc.WwwrootFolder = AppContext.BaseDirectory;
            vc.ViewFolder    = System.IO.Path.Combine(AppContext.BaseDirectory, "../../../Views/");
            vc.HomePath      = "/";
            vc.ViewExtension = ".tpl";
            vc.Caching       = false;

            //plugin register
            vc.PluginAssemblies.Add(typeof(Program).Assembly);

            //
            ViewEngine = new ViewEngine(vc);


            Adf.HttpServer server = new Adf.HttpServer(8080);
            server.Callback = HttpServerCallback;
            server.Start();

            Console.WriteLine("ok");
            Console.ReadLine();
        }
        /**
         * Constructor that is called when inflating SwipeRefreshLayout from XML.
         *
         * @param context
         * @param attrs
         */
        public SwipeRefreshLayout(Context context, IAttributeSet attrs = null)
            : base(context, attrs)
        {
            _refreshListener          = new CustomRefreshListener(this);
            _animateToCorrectPosition = new CustommAnimateToCorrectPosition(this);
            _animateToStartPosition   = new CustommAnimateToStartPosition(this);

            _touchSlop = ViewConfiguration.Get(context).ScaledTouchSlop;

            _mediumAnimationDuration = Resources.GetInteger(
                AndroidResource.Integer.ConfigMediumAnimTime);

            SetWillNotDraw(false);
            _decelerateInterpolator = new DecelerateInterpolator(DecelerateInterpolationFactor);

            var a = context.ObtainStyledAttributes(attrs, LayoutAttrs);

            Enabled = (a.GetBoolean(0, true));
            a.Recycle();

            var metrics = Resources.DisplayMetrics;

            _circleWidth  = (int)(CircleDiameter * metrics.Density);
            _circleHeight = (int)(CircleDiameter * metrics.Density);

            CreateProgressView();
#pragma warning disable 618
            ViewCompat.SetChildrenDrawingOrderEnabled(this, true);
#pragma warning restore 618
            // the absolute offset has to take into account that the circle starts at an offset
            _spinnerFinalOffset = DefaultCircleTarget * metrics.Density;
            _totalDragDistance  = _spinnerFinalOffset;

            RequestDisallowInterceptTouchEvent(true);
        }
Esempio n. 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OsmSharp.Android.UI.TwoFingerGestureDetector"/> class.
        /// </summary>
        /// <param name="context">Context.</param>
        public TwoFingerGestureDetector(Context context)
            : base(context)
        {
            ViewConfiguration config = ViewConfiguration.Get(context);

            _edgeSlop = config.ScaledEdgeSlop;
        }
Esempio n. 8
0
        private void LoadItems()
        {
            if (_pages != null)
            {
                return;
            }

            _pages = new List <PageInfo>();

            for (int i = 0; i < TutorialItemModel.Count(); i++)
            {
                var page = new PageInfo {
                    ItemModel = TutorialItemModel[i], RootView = new View(Context)
                };
                _pages.Add(page);
                AddView(page.RootView);
            }

            LoadItem(0);
            PostDelayed(() => LoadItem(1), 200);
            _mScroller = new Scroller(Context);

            var configuration = ViewConfiguration.Get(Context);

            _mTouchSlop       = configuration.ScaledTouchSlop;
            _mMaximumVelocity = configuration.ScaledMaximumFlingVelocity;
        }
        private bool PointInView(float localX, float localY)
        {
            float slop = ViewConfiguration.Get(this.owner.Context).ScaledTouchSlop;

            return(localX >= -slop && localY >= -slop && localX < ((this.owner.Right - this.owner.Left) + slop) &&
                   localY < ((this.owner.Bottom - this.owner.Top) + slop));
        }
Esempio n. 10
0
        public override bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
        {
            try
            {
                if (e1 != null && e2 != null)
                {
                    ViewConfiguration vc       = ViewConfiguration.Get(iContext);
                    int swipeMinDistance       = vc.ScaledPagingTouchSlop;
                    int swipeThresholdVelocity = vc.ScaledMinimumFlingVelocity;
                    //int swipeMaxOffPath = vc.ScaledTouchSlop;
                    float length = Math.Abs(e1.GetX() - e2.GetX());
                    float height = Math.Abs(e1.GetY() - e2.GetY());

                    if (height / length > 0.5f)
                    {
                        return(false);
                    }
                    // right to left swipe
                    if (e1.GetX() - e2.GetX() > swipeMinDistance && Math.Abs(velocityX) > swipeThresholdVelocity)
                    {
                        OnEventSwipe(ESwipeDirection.Left);
                        return(true);
                    }
                    else if (e2.GetX() - e1.GetX() > swipeMinDistance && Math.Abs(velocityX) > swipeThresholdVelocity)
                    {
                        OnEventSwipe(ESwipeDirection.Right);
                        return(true);
                    }
                }
            }
            catch (Exception) { }
            return(false);
        }
        public AndroidInputContext(View hostView,
                                   Context context,
                                   BaseInputHandler inputHandler,
                                   IDisplayMetrics displayMetrics)
        {
            _hostView           = hostView;
            _inputHandler       = inputHandler;
            _activeInputActions = InputAction.None;

            var viewConfig = ViewConfiguration.Get(context) ?? throw new NotSupportedException();

            _maximumFlingVelocity = viewConfig.ScaledMaximumFlingVelocity;
            _minimumFlingVelocity = viewConfig.ScaledMinimumFlingVelocity;

            _touchSlop = viewConfig.ScaledTouchSlop;


            if (displayMetrics.ZoomLevel.AreEqualEnough(1.0))
            {
                _dpiRatio          = 1;
                _isOffsetPositions = false;
            }
            else
            {
                _dpiRatio          = 1 / displayMetrics.ZoomLevel;
                _isOffsetPositions = true;
            }

            _gestureDetector = new GestureDetectorCompat(context, this);
            _gestureDetector.SetOnDoubleTapListener(this);

            hostView.SetOnTouchListener(this);
        }
        protected TwoFingerGestureDetector(Context context)
            : base(context)
        {
            var config = ViewConfiguration.Get(context);

            this.mEdgeSlop = config.ScaledEdgeSlop;
        }
Esempio n. 13
0
        private void OnStartup(object sender, StartupEventArgs e)
        {
            Storage.InitConfigDirectory();
            Configuration     configuration     = Storage.RestoreConfiguration();
            ViewConfiguration viewConfiguration = Storage.RestoreViewConfiguration();

            var paletteHelper = new PaletteHelper();
            var theme         = paletteHelper.GetTheme();

            theme.SetBaseTheme(viewConfiguration.GetProperty(ViewConfiguration.ThemeKey) == ViewConfiguration.LightTheme
                ? new MaterialDesignLightTheme()
                : (IBaseTheme) new MaterialDesignDarkTheme());
            paletteHelper.SetTheme(theme);

            if (configuration == null)
            {
                ConsoleWriter.WriteLine("NO CONFIGURATION", ConsoleColor.Red);
                new AuthWindow().Show();
            }
            else
            {
                ConsoleWriter.WriteLine($"configuration.Url = {configuration.Url}", ConsoleColor.Green);
                new MainWindow(configuration, viewConfiguration).Show();
            }
        }
        public SlidingUpPanelLayout(Context context, IAttributeSet attrs, int defStyle)
            : base(context, attrs, defStyle)
        {
            if (attrs != null)
            {
                var defAttrs = context.ObtainStyledAttributes(attrs, DefaultAttrs);

                if (defAttrs.Length() > 0)
                {
                    var gravity     = defAttrs.GetInt(0, (int)GravityFlags.NoGravity);
                    var gravityFlag = (GravityFlags)gravity;
                    if (gravityFlag != GravityFlags.Top && gravityFlag != GravityFlags.Bottom)
                    {
                        throw new ArgumentException("layout_gravity must be set to either top or bottom");
                    }
                    _isSlidingUp = gravityFlag == GravityFlags.Bottom;
                }

                defAttrs.Recycle();

                var ta = context.ObtainStyledAttributes(attrs, Resource.Styleable.SlidingUpPanelLayout);

                if (ta.Length() > 0)
                {
                    _panelHeight  = ta.GetDimensionPixelSize(Resource.Styleable.SlidingUpPanelLayout_collapsedHeight, -1);
                    _shadowHeight = ta.GetDimensionPixelSize(Resource.Styleable.SlidingUpPanelLayout_shadowHeight, -1);

                    _minFlingVelocity = ta.GetInt(Resource.Styleable.SlidingUpPanelLayout_flingVelocity,
                                                  DefaultMinFlingVelocity);
                    _coveredFadeColor = ta.GetColor(Resource.Styleable.SlidingUpPanelLayout_fadeColor, DefaultFadeColor);

                    _dragViewResId = ta.GetResourceId(Resource.Styleable.SlidingUpPanelLayout_dragView, -1);
                }

                ta.Recycle();
            }

            var density = context.Resources.DisplayMetrics.Density;

            if (_panelHeight == -1)
            {
                _panelHeight = (int)(DefaultPanelHeight * density + 0.5f);
            }
            if (_shadowHeight == -1)
            {
                _shadowHeight = (int)(DefaultShadowHeight * density + 0.5f);
            }

            SetWillNotDraw(false);

            _dragHelper             = ViewDragHelper.Create(this, 0.5f, new DragHelperCallback(this));
            _dragHelper.MinVelocity = _minFlingVelocity * density;

            _canSlide      = true;
            SlidingEnabled = true;

            var vc = ViewConfiguration.Get(context);

            _scrollTouchSlop = vc.ScaledTouchSlop;
        }
Esempio n. 15
0
            public CupcakeDetector(Context context)
            {
                ViewConfiguration configuration = ViewConfiguration.Get(context);

                mMinimumVelocity = configuration.ScaledMinimumFlingVelocity;
                mTouchSlop       = configuration.ScaledTouchSlop;
            }
Esempio n. 16
0
        public CupcakeGestureDetector(Context context)
        {
            var configuration = ViewConfiguration.Get(context);

            MinimumVelocity = configuration.ScaledMinimumFlingVelocity;
            TouchSlop       = configuration.ScaledTouchSlop;
        }
Esempio n. 17
0
        public void Test_SetTheme_DoesNothing_WhenAnEmptyUrlIsSpecified()
        {
            ViewConfiguration configuration = new ViewConfiguration();

            configuration.Theme = " ";
            Assert.Null(configuration.Theme);
        }
Esempio n. 18
0
        public void Test_SetTheme_WithAUrlThatHasATrailingSpaceCharacter()
        {
            ViewConfiguration configuration = new ViewConfiguration();

            configuration.Theme = "https://example.com/theme.json ";
            Assert.Equal("https://example.com/theme.json", configuration.Theme);
        }
        private void RenderCurrentList(OrganizationServiceContext context, Guid viewId)
        {
            var savedQueryView = new SavedQueryView(context, viewId, LanguageCode);

            savedQueryView.FetchXml.Element("entity").Add(new XElement("filter", new XAttribute("type", "and"),
                                                                       new XElement("condition",
                                                                                    new XAttribute("attribute", PreviousStepEntityPrimaryKeyLogicalName),
                                                                                    new XAttribute("operator", "eq"),
                                                                                    new XAttribute("value", PreviousStepEntityID))));

            var viewConfiguration = new ViewConfiguration(savedQueryView)
            {
                DataPagerEnabled = false,
                FetchXml         = savedQueryView.FetchXml.ToString(),
                LanguageCode     = LanguageCode,
                PortalName       = PortalName
            };

            var crmEntityListView = new CrmEntityListView
            {
                ID                 = "CurrentList",
                LanguageCode       = LanguageCode,
                PortalName         = PortalName,
                ViewConfigurations = new List <ViewConfiguration> {
                    viewConfiguration
                },
                ListCssClass = "table table-striped",
                SelectMode   = EntityGridExtensions.GridSelectMode.Single
            };

            CurrentListPlaceholder.Controls.Add(crmEntityListView);
        }
Esempio n. 20
0
        /**
         * Constructor that is called when inflating SwipeRefreshLayout from XML.
         *
         * @param context
         * @param attrs
         */
        public SwipeRefreshLayout(Context context, IAttributeSet attrs)
            : base(context, attrs)
        {
            mRefreshListener          = new CustomRefreshListener(this);
            mAnimateToCorrectPosition = new CustommAnimateToCorrectPosition(this);
            mAnimateToStartPosition   = new CustommAnimateToStartPosition(this);

            mTouchSlop = ViewConfiguration.Get(context).ScaledTouchSlop;

            mMediumAnimationDuration = Resources.GetInteger(
                AndroidResource.Integer.ConfigMediumAnimTime);

            SetWillNotDraw(false);
            mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);

            TypedArray a = context.ObtainStyledAttributes(attrs, LAYOUT_ATTRS);

            Enabled = (a.GetBoolean(0, true));
            a.Recycle();

            DisplayMetrics metrics = Resources.DisplayMetrics;

            mCircleWidth  = (int)(CIRCLE_DIAMETER * metrics.Density);
            mCircleHeight = (int)(CIRCLE_DIAMETER * metrics.Density);

            createProgressView();
            ViewCompat.SetChildrenDrawingOrderEnabled(this, true);
            // the absolute offset has to take into account that the circle starts at an offset
            mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.Density;
            mTotalDragDistance  = mSpinnerFinalOffset;

            RequestDisallowInterceptTouchEvent(true);
        }
Esempio n. 21
0
        public void Test_SetTheme_WithAUrl()
        {
            ViewConfiguration configuration = new ViewConfiguration();

            configuration.Theme = "https://example.com/theme.json";
            Assert.Equal("https://example.com/theme.json", configuration.Theme);
        }
Esempio n. 22
0
        private static ViewDataAdapter SetViewDataAdapter(ViewConfiguration viewConfiguration, string sortExpression, string search,
                                                          string filter, string metaFilter, int page, bool applyRecordLevelFilters, bool applyRelatedRecordFilter,
                                                          string filterRelationshipName, string filterEntityName, string filterAttributeName, Guid?filterValue,
                                                          IDictionary <string, string> customParameters, PortalConfigurationDataAdapterDependencies dataAdapterDependencies, CrmWebsite website)
        {
            var viewDataAdapter = applyRelatedRecordFilter &&
                                  (!string.IsNullOrWhiteSpace(filterRelationshipName) &&
                                   !string.IsNullOrWhiteSpace(filterEntityName))
                                ? new ViewDataAdapter(viewConfiguration, dataAdapterDependencies, filterRelationshipName,
                                                      filterEntityName,
                                                      filterAttributeName, filterValue ?? Guid.Empty, page, search, sortExpression, filter, metaFilter,
                                                      applyRecordLevelFilters, customParameters: customParameters)
                                : new ViewDataAdapter(viewConfiguration, dataAdapterDependencies, page, search, sortExpression, filter,
                                                      metaFilter,
                                                      applyRecordLevelFilters, customParameters: customParameters);

            var siteSettings       = new SettingDataAdapter(dataAdapterDependencies, website);
            var multiQueryEntities = (siteSettings.GetValue("Grid/DoQueryPerRecordLevelFilter/Entities") ?? string.Empty)
                                     .Split(',')
                                     .ToLookup(e => e, StringComparer.OrdinalIgnoreCase);

            viewDataAdapter.DoQueryPerRecordLevelFilter = multiQueryEntities.Contains(viewConfiguration.EntityName);

            return(viewDataAdapter);
        }
        private void Initialize(Context context)
        {
            if (!_initialized)
            {
                m_TouchSlop = ViewConfiguration.Get(this.Context).ScaledTouchSlop;

                m_DataSetObserver = new StickyListHeadersListViewObserver(this);
                m_AdapterHeaderAdapterClickListener = new AdapterHeaderAdapterClickListener(OnHeaderListClickListener, this);

                base.SetOnScrollListener(this);
                //null out divider, dividers are handled by adapter so they look good with headers
                base.Divider       = null;
                base.DividerHeight = 0;

                m_ViewConfiguration = ViewConfiguration.Get(context);
                m_ClippingToPadding = true;

                try
                {
                    //reflection to get selector ref
                    var absListViewClass  = JNIEnv.FindClass(typeof(AbsListView));
                    var selectorRectId    = JNIEnv.GetFieldID(absListViewClass, "mSelectorRect", "()Landroid/graphics/Rect");
                    var selectorRectField = JNIEnv.GetObjectField(absListViewClass, selectorRectId);
                    m_SelectorRect = Java.Lang.Object.GetObject <Rect>(selectorRectField, JniHandleOwnership.TransferLocalRef);

                    var selectorPositionId = JNIEnv.GetFieldID(absListViewClass, "mSelectorPosition", "()Ljava/lang/Integer");
                    m_SelectorPositionField = JNIEnv.GetObjectField(absListViewClass, selectorPositionId);
                }
                catch (Exception)
                {
                }
                _initialized = true;
            }
        }
Esempio n. 24
0
        public int GetNavBarHeight(Context c)
        {
            int result = 0;

            if (Build.VERSION.SdkInt >= BuildVersionCodes.IceCreamSandwich)
            {
                bool hasMenuKey = ViewConfiguration.Get(c).HasPermanentMenuKey;
                bool hasBackKey = KeyCharacterMap.DeviceHasKey(Keycode.Back);

                if (!hasMenuKey && !hasBackKey)
                {
                    //The device has a navigation bar
                    Resources resources   = c.Resources;
                    var       orientation = Resources.Configuration.Orientation;
                    int       resourceId;
                    if (IsTablet(c))
                    {
                        resourceId = resources.GetIdentifier(orientation == AContRes_O.Portrait ? "navigation_bar_height" : "navigation_bar_height_landscape", "dimen", "android");
                    }
                    else
                    {
                        resourceId = resources.GetIdentifier(orientation == AContRes_O.Portrait ? "navigation_bar_height" : "navigation_bar_width", "dimen", "android");
                    }

                    if (resourceId > 0)
                    {
                        return(Resources.GetDimensionPixelSize(resourceId));
                    }
                }
            }
            return(result);
        }
Esempio n. 25
0
        private Tuple <ViewConfiguration, int> GetViewConfigurationFromAttributes(IPortalViewContext portalViewContext, Context context)
        {
            var view = GetViewFromAttributes(portalViewContext, context);

            if (view == null)
            {
                return(null);
            }

            var configuration = new ViewConfiguration(view)
            {
                EnableEntityPermissions = true
            };

            configuration.Search.Enabled = true;

            string languageCode;
            int    parsedLanguageCode;

            if ((TryGetAttributeValue(context, "languagecode", out languageCode) || TryGetAttributeValue(context, "language_code", out languageCode)) && int.TryParse(languageCode, out parsedLanguageCode))
            {
                return(new Tuple <ViewConfiguration, int>(configuration, parsedLanguageCode));
            }

            return(new Tuple <ViewConfiguration, int>(configuration, 0));
        }
Esempio n. 26
0
        void ConceptView_Touch_StartDrag(object sender, EventArgs e)
        {
            var v           = sender as View;
            var motionEvent = (e as View.TouchEventArgs).Event;

            switch (motionEvent.Action & MotionEventActions.Mask)
            {
            case MotionEventActions.Down:
                touchDownX = motionEvent.RawX;
                touchDownY = motionEvent.RawY;
                break;

            case MotionEventActions.Move:
                float deltaX    = motionEvent.RawX - touchDownX;
                float deltaY    = motionEvent.RawY - touchDownY;
                int   touchSlop = ViewConfiguration.Get(v.Context).ScaledTouchSlop / 4;
                if (Math.Abs(deltaX) > touchSlop || Math.Abs(deltaY) > touchSlop)
                {
                    v.StartDrag(ClipData.NewPlainText("", ""), new View.DragShadowBuilder(v), v, 0);
                }
                break;

            case MotionEventActions.Up:
                if (!dragActionStartedHandled)
                {
                    v.PerformClick();
                }
                break;

            default:
                break;
            }
        }
        void InitCustomViewAbove()
        {
            TouchMode = TouchMode.Margin;
            SetWillNotDraw(false);
            DescendantFocusability = DescendantFocusability.AfterDescendants;
            Focusable = true;
            _scroller = new Scroller(Context, _interpolator);
            var configuration = ViewConfiguration.Get(Context);
            _touchSlop = ViewConfigurationCompat.GetScaledPagingTouchSlop(configuration);
            _minimumVelocity = configuration.ScaledMinimumFlingVelocity;
            MaximumVelocity = configuration.ScaledMaximumFlingVelocity;

            var density = Context.Resources.DisplayMetrics.Density;
            _flingDistance = (int) (MinDistanceForFling*density);

            PageSelected += (sender, args) =>
                {
                    if (_viewBehind == null) return;
                    switch (args.Position)
                    {
                        case 0:
                        case 2:
                            _viewBehind.ChildrenEnabled = true;
                            break;
                        case 1:
                            _viewBehind.ChildrenEnabled = false;
                            break;
                    }
                };
        }
Esempio n. 28
0
        /// <summary>
        /// Initializes the recycler view.
        /// </summary>
        public void Init()
        {
            handler   = new Handler(this);
            Clickable = true;

            foreground = FindViewById(Resource.Id.swipe_recycler_view_foreground);
            if (foreground == null)
            {
                throw new Exception("Attempted to create a " + typeof(SwipeMenuLayout).Name + " without a foreground view");
            }

            background = FindViewById(Resource.Id.swipe_recycler_view_background);
            if (background == null)
            {
                throw new Exception("Attempted to create a " + typeof(SwipeMenuLayout).Name + " without a background view");
            }

            viewConfig = ViewConfiguration.Get(Context);

            isOpen = false;

            gestureDetector = new GestureDetector(Context, this);
            openScroller    = new Scroller(Context, recyclerView.openInterpolator);
            closeScroller   = new Scroller(Context, recyclerView.closeInterpolator);
        }
Esempio n. 29
0
        public void test_defaultView_DoesNothing_WhenPassedNull()
        {
            ViewConfiguration configuration = new ViewConfiguration();

            configuration.SetDefaultView(null);
            Assert.Null(configuration.DefaultView);
        }
Esempio n. 30
0
            public NancyViewFile(ViewLocationResult viewLocationResult, ViewConfiguration viewConfiguration)
            {
                this.viewLocationResult = viewLocationResult;
                this.viewConfiguration  = viewConfiguration;

                this.UpdateContents();
            }
Esempio n. 31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultViewLocator"/> class.
 /// </summary>
 /// <param name="viewLocationProvider">An <see cref="IViewLocationProvider"/> instance.</param>
 /// <param name="viewEngines">An <see cref="IEnumerable{T}"/> of <see cref="IViewEngine"/> instances.</param>
 /// <param name="environment">An <see cref="INancyEnvironment"/> instance.</param>
 public DefaultViewLocator(IViewLocationProvider viewLocationProvider, IEnumerable<IViewEngine> viewEngines, INancyEnvironment environment)
 {
     this.viewLocationProvider = viewLocationProvider;
     this.viewEngines = viewEngines;
     this.invalidCharacters = Path.GetInvalidFileNameChars().Where(c => c != '/').ToArray();
     this.viewLocationResults = new List<ViewLocationResult>(this.GetInititialViewLocations());
     this.configuration = environment.GetValue<ViewConfiguration>();
 }
Esempio n. 32
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NancyViewFolder"/> class, using the provided <see cref="viewEngineStartupContext"/> instance.
        /// </summary>
        /// <param name="viewEngineStartupContext">A <see cref="ViewEngineStartupContext"/> instance.</param>
        /// <param name="environment">An <see cref="INancyEnvironment"/> instance.</param>
        public NancyViewFolder(ViewEngineStartupContext viewEngineStartupContext, INancyEnvironment environment)
        {
            this.viewEngineStartupContext = viewEngineStartupContext;
            this.configuration = environment.GetValue<ViewConfiguration>();

            // No need to lock here
            this.currentlyLocatedViews =
                new List<ViewLocationResult>(viewEngineStartupContext.ViewLocator.GetAllCurrentlyDiscoveredViews());
        }
Esempio n. 33
0
        private void InitializeReportConfiguration()
        {
            WaitDialog.Show("Loading components ...");
            if (m_eftReportConfiguration == null)
                m_eftReportConfiguration = new ViewConfiguration();

            m_eftReportConfiguration.Dock = DockStyle.Fill;
            m_eftReportConfiguration.btnPreviewViewOnClick += new ViewConfiguration.btnPreviewViewOnClickEventHandler(objViewConfiguration_btnPreviewViewOnClick);
            pcReportConfiguration.Controls.Clear();
            pcReportConfiguration.Controls.Add(m_eftReportConfiguration);
            WaitDialog.Close();
        }
Esempio n. 34
0
            public NancyViewFile(ViewLocationResult viewLocationResult, ViewConfiguration viewConfiguration)
            {
                this.viewLocationResult = viewLocationResult;
                this.viewConfiguration = viewConfiguration;

                this.UpdateContents();
            }