예제 #1
0
        /// <summary>
        /// Called when [measure].
        /// </summary>
        /// <param name="widthMeasureSpec">horizontal space requirements as imposed by the parent.
        /// The requirements are encoded with
        /// <c><see cref="T:Android.Views.View+MeasureSpec" /></c>.</param>
        /// <param name="heightMeasureSpec">vertical space requirements as imposed by the parent.
        /// The requirements are encoded with
        /// <c><see cref="T:Android.Views.View+MeasureSpec" /></c>.</param>
        /// <since version="Added in API level 1" />
        /// <altmember cref="P:Android.Views.View.MeasuredWidth" />
        /// <altmember cref="P:Android.Views.View.MeasuredHeight" />
        /// <altmember cref="M:Android.Views.View.SetMeasuredDimension(System.Int32, System.Int32)" />
        /// <altmember cref="M:Android.Views.View.get_SuggestedMinimumHeight" />
        /// <altmember cref="M:Android.Views.View.get_SuggestedMinimumWidth" />
        /// <altmember cref="M:Android.Views.View.MeasureSpec.GetMode(System.Int32)" />
        /// <altmember cref="M:Android.Views.View.MeasureSpec.GetSize(System.Int32)" />
        /// <remarks><para tool="javadoc-to-mdoc" />
        /// <para tool="javadoc-to-mdoc">
        /// Measure the view and its content to determine the measured width and the
        /// measured height. This method is invoked by <c><see cref="M:Android.Views.View.Measure(System.Int32, System.Int32)" /></c> and
        /// should be overriden by subclasses to provide accurate and efficient
        /// measurement of their contents.
        /// </para>
        /// <para tool="javadoc-to-mdoc">
        ///   <i>CONTRACT:</i> When overriding this method, you
        /// <i>must</i> call <c><see cref="M:Android.Views.View.SetMeasuredDimension(System.Int32, System.Int32)" /></c> to store the
        /// measured width and height of this view. Failure to do so will trigger an
        /// <c>IllegalStateException</c>, thrown by
        /// <c><see cref="M:Android.Views.View.Measure(System.Int32, System.Int32)" /></c>. Calling the superclass'
        /// <c><see cref="M:Android.Views.View.OnMeasure(System.Int32, System.Int32)" /></c> is a valid use.
        /// </para>
        /// <para tool="javadoc-to-mdoc">
        /// The base class implementation of measure defaults to the background size,
        /// unless a larger size is allowed by the MeasureSpec. Subclasses should
        /// override <c><see cref="M:Android.Views.View.OnMeasure(System.Int32, System.Int32)" /></c> to provide better measurements of
        /// their content.
        /// </para>
        /// <para tool="javadoc-to-mdoc">
        /// If this method is overridden, it is the subclass's responsibility to make
        /// sure the measured height and width are at least the view's minimum height
        /// and width (<c><see cref="M:Android.Views.View.get_SuggestedMinimumHeight" /></c> and
        /// <c><see cref="M:Android.Views.View.get_SuggestedMinimumWidth" /></c>).
        /// </para>
        /// <para tool="javadoc-to-mdoc">
        ///   <format type="text/html">
        ///     <a href="http://developer.android.com/reference/android/view/View.html#onMeasure(int, int)" target="_blank">[Android Documentation]</a>
        ///   </format>
        /// </para></remarks>
        protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();

            int totalWidth = MeasureSpec.GetSize(widthMeasureSpec);
            int height     = MeasureSpec.GetSize(heightMeasureSpec);

            _cellSize = totalWidth / 7;
            int cellWidthSpec  = MeasureSpec.MakeMeasureSpec(_cellSize, MeasureSpecMode.Exactly);
            int cellHeightSpec = IsHeaderRow
                                ? MeasureSpec.MakeMeasureSpec(_cellSize, MeasureSpecMode.AtMost)
                                : cellWidthSpec;
            int rowHeight = 0;

            for (int c = 0; c < ChildCount; c++)
            {
                var child = GetChildAt(c);
                child.Measure(cellWidthSpec, cellHeightSpec);
                //The row height is the height of the tallest cell.
                if (child.MeasuredHeight > rowHeight)
                {
                    rowHeight = child.MeasuredHeight;
                }
            }
            int widthWithPadding  = totalWidth + PaddingLeft + PaddingRight;
            int heightWithPadding = rowHeight + PaddingTop + PaddingBottom;

            SetMeasuredDimension(widthWithPadding, heightWithPadding);

            stopwatch.Stop();
            Logr.D("Row.OnMeasure {0} ms", stopwatch.ElapsedMilliseconds);
        }
예제 #2
0
        /// <summary>
        /// Initializes the specified minimum date.
        /// </summary>
        /// <param name="minDate">The minimum date.</param>
        /// <param name="maxDate">The maximum date.</param>
        /// <param name="highlightedDaysOfWeek">The highlighted days of week.</param>
        /// <returns>FluentInitializer.</returns>
        /// <exception cref="Java.Lang.IllegalArgumentException">
        /// minDate and maxDate must be non-zero.  +
        ///                 Debug(minDate, maxDate)
        /// or
        /// minDate must be before maxDate.  +
        ///                 Debug(minDate, maxDate)
        /// </exception>
        public FluentInitializer Init(DateTime minDate, DateTime maxDate, DayOfWeek[] highlightedDaysOfWeek)
        {
            if (minDate == DateTime.MinValue || maxDate == DateTime.MinValue)
            {
                throw new IllegalArgumentException("minDate and maxDate must be non-zero. " +
                                                   Debug(minDate, maxDate));
            }
            if (minDate.CompareTo(maxDate) > 0)
            {
                throw new IllegalArgumentException("minDate must be before maxDate. " +
                                                   Debug(minDate, maxDate));
            }

            HighlighDaysOfWeeks(highlightedDaysOfWeek);

            Mode = SelectionMode.Single;
            //Clear out any previously selected dates/cells.
            SelectedCals.Clear();
            SelectedCells.Clear();
            _highlightedCals.Clear();
            _highlightedCells.Clear();

            //Clear previous state.
            Cells.Clear();
            Months.Clear();
            MinDate = minDate;
            MaxDate = maxDate;
            MinDate = SetMidnight(MinDate);
            MaxDate = SetMidnight(MaxDate);

            // maxDate is exclusive: bump back to the previous day so if maxDate is the first of a month,
            // We don't accidentally include that month in the view.
            if (MaxDate.Day == 1)
            {
                MaxDate = MaxDate.AddMinutes(-1);
            }

            //Now iterate between minCal and maxCal and build up our list of months to show.
            _monthCounter = MinDate;
            int maxMonth = MaxDate.Month;
            int maxYear  = MaxDate.Year;

            while ((_monthCounter.Month <= maxMonth ||
                    _monthCounter.Year < maxYear) &&
                   _monthCounter.Year < maxYear + 1)
            {
                var month = new MonthDescriptor(_monthCounter.Month, _monthCounter.Year, _monthCounter,
                                                _monthCounter.ToString(MonthNameFormat), _styleDescriptor);
                Cells.Add(GetMonthCells(month, _monthCounter));
                Logr.D("Adding month {0}", month);
                Months.Add(month);
                _monthCounter = _monthCounter.AddMonths(1);
            }

            ValidateAndUpdate();
            return(new FluentInitializer(this));
        }
예제 #3
0
        /// <summary>
        /// Called when [measure].
        /// </summary>
        /// <param name="widthMeasureSpec">horizontal space requirements as imposed by the parent.
        /// The requirements are encoded with
        /// <c><see cref="T:Android.Views.View+MeasureSpec" /></c>.</param>
        /// <param name="heightMeasureSpec">vertical space requirements as imposed by the parent.
        /// The requirements are encoded with
        /// <c><see cref="T:Android.Views.View+MeasureSpec" /></c>.</param>
        /// <since version="Added in API level 1" />
        /// <altmember cref="P:Android.Views.View.MeasuredWidth" />
        /// <altmember cref="P:Android.Views.View.MeasuredHeight" />
        /// <altmember cref="M:Android.Views.View.SetMeasuredDimension(System.Int32, System.Int32)" />
        /// <altmember cref="M:Android.Views.View.get_SuggestedMinimumHeight" />
        /// <altmember cref="M:Android.Views.View.get_SuggestedMinimumWidth" />
        /// <altmember cref="M:Android.Views.View.MeasureSpec.GetMode(System.Int32)" />
        /// <altmember cref="M:Android.Views.View.MeasureSpec.GetSize(System.Int32)" />
        /// <remarks><para tool="javadoc-to-mdoc" />
        /// <para tool="javadoc-to-mdoc">
        /// Measure the view and its content to determine the measured width and the
        /// measured height. This method is invoked by <c><see cref="M:Android.Views.View.Measure(System.Int32, System.Int32)" /></c> and
        /// should be overriden by subclasses to provide accurate and efficient
        /// measurement of their contents.
        /// </para>
        /// <para tool="javadoc-to-mdoc">
        ///   <i>CONTRACT:</i> When overriding this method, you
        /// <i>must</i> call <c><see cref="M:Android.Views.View.SetMeasuredDimension(System.Int32, System.Int32)" /></c> to store the
        /// measured width and height of this view. Failure to do so will trigger an
        /// <c>IllegalStateException</c>, thrown by
        /// <c><see cref="M:Android.Views.View.Measure(System.Int32, System.Int32)" /></c>. Calling the superclass'
        /// <c><see cref="M:Android.Views.View.OnMeasure(System.Int32, System.Int32)" /></c> is a valid use.
        /// </para>
        /// <para tool="javadoc-to-mdoc">
        /// The base class implementation of measure defaults to the background size,
        /// unless a larger size is allowed by the MeasureSpec. Subclasses should
        /// override <c><see cref="M:Android.Views.View.OnMeasure(System.Int32, System.Int32)" /></c> to provide better measurements of
        /// their content.
        /// </para>
        /// <para tool="javadoc-to-mdoc">
        /// If this method is overridden, it is the subclass's responsibility to make
        /// sure the measured height and width are at least the view's minimum height
        /// and width (<c><see cref="M:Android.Views.View.get_SuggestedMinimumHeight" /></c> and
        /// <c><see cref="M:Android.Views.View.get_SuggestedMinimumWidth" /></c>).
        /// </para>
        /// <para tool="javadoc-to-mdoc">
        ///   <format type="text/html">
        ///     <a href="http://developer.android.com/reference/android/view/View.html#onMeasure(int, int)" target="_blank">[Android Documentation]</a>
        ///   </format>
        /// </para></remarks>
        protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
        {
            Logr.D("Grid.OnMeasure w={0} h={1}", MeasureSpec.ToString(widthMeasureSpec),
                   MeasureSpec.ToString(heightMeasureSpec));

            int widthMeasureSize  = MeasureSpec.GetSize(widthMeasureSpec);
            int heightMeasureSize = MeasureSpec.GetSize(heightMeasureSpec);

            if (_oldWidthMeasureSize == widthMeasureSize && _oldHeightMeasureSize == heightMeasureSize)
            {
                Logr.D("SKIP Grid.OnMeasure");
                SetMeasuredDimension(MeasuredWidth, MeasuredHeight);
                return;
            }

            var stopwatch = Stopwatch.StartNew();

            _oldWidthMeasureSize  = widthMeasureSize;
            _oldHeightMeasureSize = heightMeasureSize;
            int visibleChildCount = 0;

            for (int c = 0; c < ChildCount; c++)
            {
                var child = GetChildAt(c);
                if (child.Visibility == ViewStates.Visible)
                {
                    visibleChildCount++;
                }
            }
            int cellSize = Math.Min((widthMeasureSize - sidePadding * 2) / 7, heightMeasureSize / visibleChildCount);

            //int cellSize =  widthMeasureSize / 7;
            //Remove any extra pixels since /7 us unlikey to give whole nums.
            widthMeasureSize = cellSize * 7 + sidePadding * 2;
            int totalHeight   = 0;
            int rowWidthSpec  = MeasureSpec.MakeMeasureSpec(widthMeasureSize - 2 * sidePadding, MeasureSpecMode.Exactly);
            int rowHeightSpec = MeasureSpec.MakeMeasureSpec(cellSize, MeasureSpecMode.Exactly);

            for (int c = 0; c < ChildCount; c++)
            {
                var child = GetChildAt(c);
                if (child.Visibility == ViewStates.Visible)
                {
                    MeasureChild(child, rowWidthSpec,
                                 c == 0 ? MeasureSpec.MakeMeasureSpec(cellSize, MeasureSpecMode.AtMost) : rowHeightSpec);
                    totalHeight += child.MeasuredHeight;
                }
            }
            int measuredWidth  = widthMeasureSize;            // Fudge factor to make the borders show up right.
            int measuredHeight = heightMeasureSize + 2;

            SetMeasuredDimension(measuredWidth, totalHeight);

            stopwatch.Stop();
            Logr.D("Grid.OnMeasure {0} ms", stopwatch.ElapsedMilliseconds);
        }
예제 #4
0
 /// <summary>
 /// Called when [measure].
 /// </summary>
 /// <param name="widthMeasureSpec">horizontal space requirements as imposed by the parent.
 /// The requirements are encoded with
 /// <c><see cref="T:Android.Views.View+MeasureSpec" /></c>.</param>
 /// <param name="heightMeasureSpec">vertical space requirements as imposed by the parent.
 /// The requirements are encoded with
 /// <c><see cref="T:Android.Views.View+MeasureSpec" /></c>.</param>
 /// <exception cref="System.InvalidOperationException">Must have at least one month to display. Did you forget to call Init()?</exception>
 /// <since version="Added in API level 1" />
 /// <altmember cref="P:Android.Views.View.MeasuredWidth" />
 /// <altmember cref="P:Android.Views.View.MeasuredHeight" />
 /// <altmember cref="M:Android.Views.View.SetMeasuredDimension(System.Int32, System.Int32)" />
 /// <altmember cref="M:Android.Views.View.get_SuggestedMinimumHeight" />
 /// <altmember cref="M:Android.Views.View.get_SuggestedMinimumWidth" />
 /// <altmember cref="M:Android.Views.View.MeasureSpec.GetMode(System.Int32)" />
 /// <altmember cref="M:Android.Views.View.MeasureSpec.GetSize(System.Int32)" />
 /// <remarks><para tool="javadoc-to-mdoc" />
 /// <para tool="javadoc-to-mdoc">
 /// Measure the view and its content to determine the measured width and the
 /// measured height. This method is invoked by <c><see cref="M:Android.Views.View.Measure(System.Int32, System.Int32)" /></c> and
 /// should be overriden by subclasses to provide accurate and efficient
 /// measurement of their contents.
 /// </para>
 /// <para tool="javadoc-to-mdoc">
 ///   <i>CONTRACT:</i> When overriding this method, you
 /// <i>must</i> call <c><see cref="M:Android.Views.View.SetMeasuredDimension(System.Int32, System.Int32)" /></c> to store the
 /// measured width and height of this view. Failure to do so will trigger an
 /// <c>IllegalStateException</c>, thrown by
 /// <c><see cref="M:Android.Views.View.Measure(System.Int32, System.Int32)" /></c>. Calling the superclass'
 /// <c><see cref="M:Android.Views.View.OnMeasure(System.Int32, System.Int32)" /></c> is a valid use.
 /// </para>
 /// <para tool="javadoc-to-mdoc">
 /// The base class implementation of measure defaults to the background size,
 /// unless a larger size is allowed by the MeasureSpec. Subclasses should
 /// override <c><see cref="M:Android.Views.View.OnMeasure(System.Int32, System.Int32)" /></c> to provide better measurements of
 /// their content.
 /// </para>
 /// <para tool="javadoc-to-mdoc">
 /// If this method is overridden, it is the subclass's responsibility to make
 /// sure the measured height and width are at least the view's minimum height
 /// and width (<c><see cref="M:Android.Views.View.get_SuggestedMinimumHeight" /></c> and
 /// <c><see cref="M:Android.Views.View.get_SuggestedMinimumWidth" /></c>).
 /// </para>
 /// <para tool="javadoc-to-mdoc">
 ///   <format type="text/html">
 ///     <a href="http://developer.android.com/reference/android/view/View.html#onMeasure(int, int)" target="_blank">[Android Documentation]</a>
 ///   </format>
 /// </para></remarks>
 protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
 {
     if (Months.Count == 0)
     {
         throw new InvalidOperationException(
                   "Must have at least one month to display. Did you forget to call Init()?");
     }
     Logr.D("PickerView.OnMeasure w={0} h={1}", MeasureSpec.ToString(widthMeasureSpec),
            MeasureSpec.ToString(heightMeasureSpec));
     base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
 }
예제 #5
0
        /// <summary>
        /// Gets the month cells.
        /// </summary>
        /// <param name="month">The month.</param>
        /// <param name="startCal">The start cal.</param>
        /// <returns>List&lt;List&lt;MonthCellDescriptor&gt;&gt;.</returns>
        internal List <List <MonthCellDescriptor> > GetMonthCells(MonthDescriptor month, DateTime startCal)
        {
            var cells          = new List <List <MonthCellDescriptor> >();
            var cal            = new DateTime(startCal.Year, startCal.Month, 1);
            var firstDayOfWeek = (int)cal.DayOfWeek;

            cal = cal.AddDays((int)CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek - firstDayOfWeek);

            var minSelectedCal = GetMinDate(SelectedCals);
            var maxSelectedCal = GetMaxDate(SelectedCals);

            while ((cal.Month < month.Month + 1 || cal.Year < month.Year) &&
                   cal.Year <= month.Year)
            {
                Logr.D("Building week row starting at {0}", cal);
                var weekCells = new List <MonthCellDescriptor>();
                cells.Add(weekCells);
                for (int i = 0; i < 7; i++)
                {
                    var  date           = cal;
                    bool isCurrentMonth = cal.Month == month.Month;
                    bool isSelected     = isCurrentMonth && ContatinsDate(SelectedCals, cal);
                    bool isSelectable   = isCurrentMonth && IsBetweenDates(cal, MinDate, MaxDate);
                    bool isToday        = IsSameDate(cal, Today);
                    bool isHighlighted  = ContatinsDate(_highlightedCals, cal) || _hlighlightedDaysOfWeek[(int)cal.DayOfWeek];
                    int  value          = cal.Day;

                    var rangeState = RangeState.None;
                    if (SelectedCals.Count > 1)
                    {
                        if (IsSameDate(minSelectedCal, cal))
                        {
                            rangeState = RangeState.First;
                        }
                        else if (IsSameDate(maxSelectedCal, cal))
                        {
                            rangeState = RangeState.Last;
                        }
                        else if (IsBetweenDates(cal, minSelectedCal, maxSelectedCal))
                        {
                            rangeState = RangeState.Middle;
                        }
                    }

                    weekCells.Add(new MonthCellDescriptor(date, isCurrentMonth, isSelectable, isSelected,
                                                          isToday, isHighlighted, value, rangeState, _styleDescriptor));
                    cal = cal.AddDays(1);
                }
            }
            return(cells);
        }
예제 #6
0
        /// <summary>
        /// Called from layout when this view should
        /// assign a size and position to each of its children.
        /// </summary>
        /// <param name="changed">This is a new size or position for this view</param>
        /// <param name="l">Left position, relative to parent</param>
        /// <param name="t">Top position, relative to parent</param>
        /// <param name="r">Right position, relative to parent</param>
        /// <param name="b">Bottom position, relative to parent</param>
        /// <since version="Added in API level 1" />
        /// <remarks><para tool="javadoc-to-mdoc">Called from layout when this view should
        /// assign a size and position to each of its children.
        /// Derived classes with children should override
        /// this method and call layout on each of
        /// their children.
        /// </para>
        /// <para tool="javadoc-to-mdoc">
        ///   <format type="text/html">
        ///     <a href="http://developer.android.com/reference/android/view/ViewGroup.html#onLayout(boolean, int, int, int, int)" target="_blank">[Android Documentation]</a>
        ///   </format>
        /// </para></remarks>
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();

            int cellHeight = b - t;

            for (int c = 0; c < ChildCount; c++)
            {
                var child = GetChildAt(c);
                child.Layout(c * _cellSize, 0, (c + 1) * _cellSize, cellHeight);
            }

            stopwatch.Stop();
            Logr.D("Row.OnLayout {0} ms", stopwatch.ElapsedMilliseconds);
        }
예제 #7
0
        /// <summary>
        /// Called from layout when this view should
        /// assign a size and position to each of its children.
        /// </summary>
        /// <param name="changed">This is a new size or position for this view</param>
        /// <param name="l">Left position, relative to parent</param>
        /// <param name="t">Top position, relative to parent</param>
        /// <param name="r">Right position, relative to parent</param>
        /// <param name="b">Bottom position, relative to parent</param>
        /// <since version="Added in API level 1" />
        /// <remarks><para tool="javadoc-to-mdoc">Called from layout when this view should
        /// assign a size and position to each of its children.
        /// Derived classes with children should override
        /// this method and call layout on each of
        /// their children.
        /// </para>
        /// <para tool="javadoc-to-mdoc">
        ///   <format type="text/html">
        ///     <a href="http://developer.android.com/reference/android/view/ViewGroup.html#onLayout(boolean, int, int, int, int)" target="_blank">[Android Documentation]</a>
        ///   </format>
        /// </para></remarks>
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            var stopwatch   = Stopwatch.StartNew();
            int heightSoFar = 0;

            t = 0;
            for (int c = 0; c < ChildCount; c++)
            {
                var child     = GetChildAt(c);
                int rowHeight = child.MeasuredHeight;
                child.Layout(sidePadding, heightSoFar, r, heightSoFar + rowHeight);
                heightSoFar += rowHeight;
            }

            stopwatch.Stop();
            Logr.D("Grid.OnLayout {0} ms", stopwatch.ElapsedMilliseconds);
        }
예제 #8
0
        /// <summary>
        /// Initializes the specified month.
        /// </summary>
        /// <param name="month">The month.</param>
        /// <param name="cells">The cells.</param>
        public void Init(MonthDescriptor month, List <List <MonthCellDescriptor> > cells)
        {
            Logr.D("Initializing MonthView ({0:d}) for {1}", GetHashCode(), month);
            var stopWatch = new Stopwatch();

            stopWatch.Start();

            _title.Text = month.Label;
            if (_title.Typeface != null)
            {
                _title.Typeface = month.Style.MonthTitleFont;
            }
            _title.SetTextColor(month.Style.TitleForegroundColor);
            _title.SetBackgroundColor(month.Style.TitleBackgroundColor);

            _grid.DividerColor = month.Style.DateSeparatorColor;

            var headerRow = (CalendarRowView)_grid.GetChildAt(0);

            if (headerRow != null)
            {
                headerRow.SetBackgroundColor(month.Style.DayOfWeekLabelBackgroundColor);
                var week = cells[0];
                for (int c = 0; c <= 6; c++)
                {
                    var headerText = (TextView)headerRow.GetChildAt(c);
                    if (month.Style.ShouldHighlightDaysOfWeekLabel && week[c].IsHighlighted)
                    {
                        headerText.SetBackgroundColor(month.Style.HighlightedDateBackgroundColor);
                    }
                    headerText.SetTextColor(month.Style.DayOfWeekLabelForegroundColor);
                }
            }

            int numOfRows = cells.Count;

            _grid.NumRows = numOfRows;
            for (int i = 0; i < 6; i++)
            {
                var weekRow = (CalendarRowView)_grid.GetChildAt(i + 1);
                weekRow.ClickHandler = _clickHandler;
                if (i < numOfRows)
                {
                    weekRow.Visibility = ViewStates.Visible;
                    var week = cells[i];
                    for (int c = 0; c < week.Count; c++)
                    {
                        var cell     = week[c];
                        var cellView = (CalendarCellView)weekRow.GetChildAt(c);

                        cellView.Text           = cell.Value.ToString();
                        cellView.Enabled        = cell.IsCurrentMonth;
                        cellView.Selectable     = cell.IsSelectable;
                        cellView.Selected       = cell.IsSelected;
                        cellView.IsCurrentMonth = cell.IsCurrentMonth;
                        cellView.IsToday        = cell.IsToday;
                        cellView.IsHighlighted  = cell.IsHighlighted;
                        cellView.RangeState     = cell.RangeState;
                        cellView.Tag            = cell;
                        cellView.SetStyle(month.Style);
                        //Logr.D("Setting cell at {0} ms", stopWatch.ElapsedMilliseconds);
                    }
                }
                else
                {
                    weekRow.Visibility = ViewStates.Gone;
                }
            }
            stopWatch.Stop();
            Logr.D("MonthView.Init took {0} ms", stopWatch.ElapsedMilliseconds);
        }
예제 #9
0
 /// <summary>
 /// Called when [measure].
 /// </summary>
 /// <param name="widthMeasureSpec">horizontal space requirements as imposed by the parent.
 /// The requirements are encoded with
 /// <c><see cref="T:Android.Views.View+MeasureSpec" /></c>.</param>
 /// <param name="heightMeasureSpec">vertical space requirements as imposed by the parent.
 /// The requirements are encoded with
 /// <c><see cref="T:Android.Views.View+MeasureSpec" /></c>.</param>
 /// <since version="Added in API level 1" />
 /// <altmember cref="P:Android.Views.View.MeasuredWidth" />
 /// <altmember cref="P:Android.Views.View.MeasuredHeight" />
 /// <altmember cref="M:Android.Views.View.SetMeasuredDimension(System.Int32, System.Int32)" />
 /// <altmember cref="M:Android.Views.View.get_SuggestedMinimumHeight" />
 /// <altmember cref="M:Android.Views.View.get_SuggestedMinimumWidth" />
 /// <altmember cref="M:Android.Views.View.MeasureSpec.GetMode(System.Int32)" />
 /// <altmember cref="M:Android.Views.View.MeasureSpec.GetSize(System.Int32)" />
 /// <remarks><para tool="javadoc-to-mdoc" />
 /// <para tool="javadoc-to-mdoc">
 /// Measure the view and its content to determine the measured width and the
 /// measured height. This method is invoked by <c><see cref="M:Android.Views.View.Measure(System.Int32, System.Int32)" /></c> and
 /// should be overriden by subclasses to provide accurate and efficient
 /// measurement of their contents.
 /// </para>
 /// <para tool="javadoc-to-mdoc">
 ///   <i>CONTRACT:</i> When overriding this method, you
 /// <i>must</i> call <c><see cref="M:Android.Views.View.SetMeasuredDimension(System.Int32, System.Int32)" /></c> to store the
 /// measured width and height of this view. Failure to do so will trigger an
 /// <c>IllegalStateException</c>, thrown by
 /// <c><see cref="M:Android.Views.View.Measure(System.Int32, System.Int32)" /></c>. Calling the superclass'
 /// <c><see cref="M:Android.Views.View.OnMeasure(System.Int32, System.Int32)" /></c> is a valid use.
 /// </para>
 /// <para tool="javadoc-to-mdoc">
 /// The base class implementation of measure defaults to the background size,
 /// unless a larger size is allowed by the MeasureSpec. Subclasses should
 /// override <c><see cref="M:Android.Views.View.OnMeasure(System.Int32, System.Int32)" /></c> to provide better measurements of
 /// their content.
 /// </para>
 /// <para tool="javadoc-to-mdoc">
 /// If this method is overridden, it is the subclass's responsibility to make
 /// sure the measured height and width are at least the view's minimum height
 /// and width (<c><see cref="M:Android.Views.View.get_SuggestedMinimumHeight" /></c> and
 /// <c><see cref="M:Android.Views.View.get_SuggestedMinimumWidth" /></c>).
 /// </para>
 /// <para tool="javadoc-to-mdoc">
 ///   <format type="text/html">
 ///     <a href="http://developer.android.com/reference/android/view/View.html#onMeasure(int, int)" target="_blank">[Android Documentation]</a>
 ///   </format>
 /// </para></remarks>
 protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
 {
     Logr.D("Month.OnMeasure w={0} h={1}", MeasureSpec.ToString(widthMeasureSpec),
            MeasureSpec.ToString(heightMeasureSpec));
     base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
 }