private AndroidBug5497WorkaroundForXamarinAndroid(Activity activity)
        {
            FrameLayout content = (FrameLayout)activity.FindViewById(Android.Resource.Id.Content);

            mChildOfContent = content.GetChildAt(0);
            ViewTreeObserver vto = mChildOfContent.ViewTreeObserver;

            vto.GlobalLayout += (object sender, EventArgs e) => {
                possiblyResizeChildOfContent();
            };
            frameLayoutParams = (FrameLayout.LayoutParams)mChildOfContent.LayoutParameters;
        }
コード例 #2
0
        void AddLayoutListener()
        {
            if (_carouselViewLayoutListener != null)
            {
                return;
            }

            _carouselViewLayoutListener              = new CarouselViewwOnGlobalLayoutListener();
            _carouselViewLayoutListener.LayoutReady += LayoutReady;

            ViewTreeObserver.AddOnGlobalLayoutListener(_carouselViewLayoutListener);
        }
コード例 #3
0
        protected override void OnElementChanged(ElementChangedEventArgs <WebView> e)
        {
            base.OnElementChanged(e);

            _webView = new Android.Webkit.WebView(Context);

            _viewTreeObserver = _webView.ViewTreeObserver;

            _viewTreeObserver.PreDraw += ResizeWebView;

            SetNativeControl(_webView);
        }
コード例 #4
0
        private void Init()
        {
            Inflate(Context, Resource.Layout.tooltip, this);

            _topPointerView    = FindViewById <ImageView>(Resource.Id.tooltip_pointer_up);
            _contentHolder     = (ViewGroup)FindViewById(Resource.Id.tooltip_contentholder);
            _tooltipTextView   = FindViewById <TextView>(Resource.Id.tooltip_contenttv);
            _bottomPointerView = FindViewById <ImageView>(Resource.Id.tooltip_pointer_down);
            _shadowView        = FindViewById(Resource.Id.tooltip_shadow);

            SetOnClickListener(this);
            ViewTreeObserver.AddOnPreDrawListener(this);
        }
コード例 #5
0
        public static void AddOnGlobalLayoutAction(this ViewTreeObserver observer, Action callback)
        {
            GlobalLayoutSingleFireListener listener = null;

            listener = new GlobalLayoutSingleFireListener(() =>
            {
                if (observer.IsAlive)
                {
                    callback();
                }
            });
            observer.AddOnGlobalLayoutListener(listener);
        }
コード例 #6
0
        public void OnGlobalLayout()
        {
            ViewTreeObserver obs = tv.ViewTreeObserver;

            obs.RemoveOnGlobalLayoutListener(this);

            lineCount = tv.LineCount;
            if (isPartial && lineCount > maxLines)
            {
                //tv.Ellipsize = ellipsize;
                tv.SetMaxLines(maxLines);
                tv.RequestLayout();
            }

            listerner.LineCountDetected(tv);
        }
コード例 #7
0
        public void OnGlobalLayout()
        {
            ViewTreeObserver vto = ViewTreeObserver;

            vto.RemoveOnGlobalLayoutListener(this);

            if (this.LineCount <= mMaxLines)
            {
                SetText(mFullText, BufferType.Normal);
            }
            else
            {
                MovementMethod = LinkMovementMethod.Instance;
                ShowLess();
            }
        }
コード例 #8
0
        public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.fragment_run, container, false);

            mStartedTextView   = view.FindViewById <TextView>(Resource.Id.run_startedTextView);
            mLatitudeTextView  = view.FindViewById <TextView>(Resource.Id.run_latitudeTextView);
            mLongitudeTextView = view.FindViewById <TextView>(Resource.Id.run_longitudeTextView);
            mAltitudeTextView  = view.FindViewById <TextView>(Resource.Id.run_altitudeTextView);
            mDurationTextView  = view.FindViewById <TextView>(Resource.Id.run_durationTextView);

            mStartButton = view.FindViewById <Button>(Resource.Id.run_startButton);
            mStopButton  = view.FindViewById <Button>(Resource.Id.run_stopButton);

            mStartButton.Click += (object sender, EventArgs e) => {
                CurrentRun = mRunManager.StartNewRun();
                mGoogleMap.Clear();
                mMapShouldFollow = true;
                UpdateUI();
            };

            mStopButton.Click += (object sender, EventArgs e) => {
                mRunManager.StopRun(CurrentRun);
                CurrentRun = null;
                UpdateUI();
            };

            mGoogleMap = ((MapFragment)FragmentManager.FindFragmentById(Resource.Id.mapFrag)).Map;
            mGoogleMap.MyLocationEnabled = true;
            mGoogleMap.MapType           = GoogleMap.MapTypeHybrid;
            mGoogleMap.PolylineClick    += (object sender, GoogleMap.PolylineClickEventArgs e) => {
                Console.WriteLine("***** Polyline Clicked");
                mPolyline.Width = 20;
                mPolyline.Color = Color.Red;
            };
            mGoogleMap.MapClick += (object sender, GoogleMap.MapClickEventArgs e) => {
                Console.WriteLine("***** Map Clicked");
                mPolyline.Width = mPolyLineOriginalWidth;
                mPolyline.Color = Color.Black;
            };

            mMapLayout = view.FindViewById <LinearLayout>(Resource.Id.mapLayout);
            ViewTreeObserver vto = mMapLayout.ViewTreeObserver;

            vto.AddOnGlobalLayoutListener(this);

            return(view);
        }
コード例 #9
0
        public void Cleanup()
        {
            if (null != mImageView)
            {
                mImageView.TryGetTarget(out ImageView v);
                v.ViewTreeObserver.RemoveGlobalOnLayoutListener(this);
            }
            mViewTreeObserver = null;

            // Clear listeners too
            mMatrixChangeListener = null;
            mPhotoTapListener     = null;
            mViewTapListener      = null;

            // Finally, clear ImageView
            mImageView = null;
        }
コード例 #10
0
        public void Cancel()
        {
            ImageView target;

            if (!m_Target.TryGetTarget(out target))
            {
                return;
            }

            ViewTreeObserver vto = target.ViewTreeObserver;

            if (!vto.IsAlive)
            {
                return;
            }

            vto.RemoveOnPreDrawListener(this);
        }
コード例 #11
0
        protected override void OnElementChanged(ElementChangedEventArgs <MarkdownView> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement == null)
            {
                _webView = new WebView(Context);
                _webView.Settings.JavaScriptEnabled = true;
                _webView.SetWebViewClient(new MarkdownViewClient());

                _viewTreeObserver          = _webView.ViewTreeObserver;
                _viewTreeObserver.PreDraw += ResizeWebView;

                SetNativeControl(_webView);
            }

            RenderMarkdownAndBindContent(Element.Markdown, Element.StyleString);
        }
コード例 #12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.DiagnoseDetail);

            string[] studyInfo = new string[] {
                $"检查时间: {MyStudyList.SelectedStudy.SampleTime.ToLocalTime():HH:mm:ss}",
                $"患者姓名: {MyStudyList.SelectedStudy.PatientName}",
            };
            ListView lsvStudyInfo = FindViewById <ListView>(Resource.Id.lsvStudyInfo);

            lsvStudyInfo.Adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, studyInfo);

            ImageView imgWave = FindViewById <ImageView>(Resource.Id.imgWave);

            //初始化绘制ECG波形对象
            MyDrawBioWave = new DrawBioWave(imgWave, MyStudyList.SelectedStudy.BioBuf);

            //onCreate时控件未显示,大小为0,不能直接初始化绘图对象,onStart,onResume都不行
            //System.NullReferenceException: Object reference not set to an instance of an object.
            observer = imgWave.ViewTreeObserver;
            observer.AddOnGlobalLayoutListener(this);

            //诊断结果列表
            DiagnoseList = new List <string>()
            {
                "正常", "轻度异常", "严重异常"
            };
            DiagnoseAdapter     = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, DiagnoseList);
            spnDiagnose         = FindViewById <Spinner>(Resource.Id.spnDiagnose);
            spnDiagnose.Adapter = DiagnoseAdapter;

            //自动分析
            Button btnAutoAnalyse = FindViewById <Button>(Resource.Id.btnAutoAnalyse);

            btnAutoAnalyse.Click += (s1, e1) => AutoAnalyse();

            //完成诊断
            Button btnSave = FindViewById <Button>(Resource.Id.btnSave);

            btnSave.Click += (s1, e1) => SaveStudy();
        }
コード例 #13
0
        void RemoveRow()
        {
            m_cellTopMap.Clear();
            int firstVisiblePosition = m_listView.FirstVisiblePosition;

            for (int i = 0; i < m_listView.ChildCount; i++)
            {
                var  child    = m_listView.GetChildAt(i);
                int  position = firstVisiblePosition + i;
                long itemId   = m_adapter.GetItemId(position);
                m_cellTopMap.Add(itemId, child.Top);
            }

            m_team.Remove(0);
            m_team.Remove(3);
            m_adapter.NotifyDataSetChanged();

            m_observer          = m_listView.ViewTreeObserver;
            m_observer.PreDraw += this.onPreDrawRemoveHandler;
        }
コード例 #14
0
ファイル: DragLayout.cs プロジェクト: dove-team/Xam.Plugins
 private void Init(IAttributeSet attrs)
 {
     scrollVelocity = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip,
                                                     DEFAULT_SCROLL_VELOCITY_DP, Context.Resources.DisplayMetrics);
     touchScrollable = true;
     if (null != attrs)
     {
         TypedArray ta = Context.ObtainStyledAttributes(attrs, Resource.Styleable.DragLayout);
         overScroll     = ta.GetInt(Resource.Styleable.DragLayout_overScroll, OVER_SCROLL_ALL);
         scrollVelocity = ta.GetDimensionPixelSize(
             Resource.Styleable.DragLayout_scrollVelocity, scrollVelocity);
         maxScrollTime   = ta.GetInt(Resource.Styleable.DragLayout_maxScrollTime, 0);
         touchScrollable = ta.GetBoolean(Resource.Styleable.DragLayout_touchScrollable, touchScrollable);
         ta.Recycle();
     }
     gestureHelper   = GestureHelper.CreateDefault(Context);
     layerScroller   = new Scroller(Context);
     velocityTracker = VelocityTracker.Obtain();
     ViewTreeObserver.AddOnGlobalLayoutListener(new DragLayoutListener(this));
 }
コード例 #15
0
        public void OnGlobalLayout()
        {
            int newHeight = _outerContainer.Height + _navBarHeightCopy;

            _outerContainer.LayoutParameters.Height = newHeight;

            ViewTreeObserver obs = _outerContainer.ViewTreeObserver;

            if (obs.IsAlive)
            {
                if (Build.VERSION.SdkInt >= BuildVersionCodes.JellyBean)
                {
                    obs.RemoveOnGlobalLayoutListener(this);
                }
                else
                {
                    obs.RemoveGlobalOnLayoutListener(this);
                }
            }
        }
コード例 #16
0
        /**
         * This method determines whether the hover cell has been shifted far enough
         * to invoke a cell swap. If so, then the respective cell swap candidate is
         * determined and the data set is changed. Upon posting a notification of the
         * data set change, a layout is invoked to place the cells in the right place.
         * Using a ViewTreeObserver and a corresponding OnPreDrawListener, we can
         * offset the cell being swapped to where it previously was and then animate it to
         * its new position.
         */
        void handleCellSwitch()
        {
            observeDeltaY = mLastEventY - mDownY;
            int deltaYTotal = mHoverCellOriginalBounds.Top + mTotalOffset + observeDeltaY;

            View belowView  = getViewForID(mBelowItemId);
            View mobileView = getViewForID(mMobileItemId);
            View aboveView  = getViewForID(mAboveItemId);

            bool isBelow = (belowView != null) && (deltaYTotal > belowView.Top);
            bool isAbove = (aboveView != null) && (deltaYTotal < aboveView.Top);

            if (isBelow || isAbove)
            {
                observeSwitchItemID = isBelow ? mBelowItemId : mAboveItemId;
                View switchView   = isBelow ? belowView : aboveView;
                int  originalItem = GetPositionForView(mobileView);

                if (switchView == null)
                {
                    updateNeighborViewsForID(mMobileItemId);
                    return;
                }

                swapElements(mCheeseList, originalItem, GetPositionForView(switchView));

                ((BaseAdapter)Adapter).NotifyDataSetChanged();

                mDownY = mLastEventY;

                observeSwitchViewStartTop = switchView.Top;

                mobileView.Visibility = ViewStates.Visible;
                switchView.Visibility = ViewStates.Invisible;

                updateNeighborViewsForID(mMobileItemId);

                observer = ViewTreeObserver;
                observer.AddOnPreDrawListener(this);
            }
        }
コード例 #17
0
        private void AddCroutonToView(Crouton crouton)
        {
            // don't Add if it is already showing
            if (crouton.IsShowing())
            {
                return;
            }

            View croutonView = crouton.GetView();

            if (null == croutonView.Parent)
            {
                ViewGroup.LayoutParams parameters = croutonView.LayoutParameters;
                if (null == parameters)
                {
                    parameters = new ViewGroup.MarginLayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                  ViewGroup.LayoutParams.WrapContent);
                }

                Activity activity = crouton.GetActivity();
                if (null == activity || activity.IsFinishing)
                {
                    return;
                }
                HandleTranslucentActionBar((ViewGroup.MarginLayoutParams)parameters, activity);
                HandleActionBarOverlay((ViewGroup.MarginLayoutParams)parameters, activity);

                activity.AddContentView(croutonView, parameters);
            }

            croutonView.RequestLayout(); // This is needed so the animation can use the measured with/height
            ViewTreeObserver observer = croutonView.ViewTreeObserver;

            if (null != observer)
            {
                CallOnGlobalLayout(crouton, croutonView);
            }
        }
コード例 #18
0
        protected void OnGlobalLayout(object sender, EventArgs args)
        {
            if (View == null)
            {
                return;
            }

            ViewTreeObserver vto = (ViewTreeObserver)sender;
            var dateGridView     = View.FindViewById <GridView>(Resource.Id.date_gridView);

            if (vto.IsAlive)
            {
                vto.GlobalLayout -= OnGlobalLayout;
            }
            else if (dateGridView != null)
            {
                dateGridView.ViewTreeObserver.GlobalLayout -= OnGlobalLayout;
            }
            if (dateGridView != null)
            {
                dateGridView.LayoutParameters.Height = dateGridView.MeasuredHeight * rowItems.Count / 7;
            }
        }
コード例 #19
0
        public void Cleanup()
        {
            if (null == _imageView)
            {
                return;                     // cleanup already done
            }
            var imageView = (ImageView)(((Reference)_imageView).Get());

            if (null != imageView)
            {
                // Remove this as a global layout listener
                ViewTreeObserver observer = imageView.ViewTreeObserver;
                if (null != observer && observer.IsAlive)
                {
                    observer.RemoveGlobalOnLayoutListener(this);
                }

                // Remove the ImageView's reference to this
                imageView.SetOnTouchListener(null);

                // make sure a pending fling runnable won't be run
                cancelFling();
            }

            if (null != _gestureDetector)
            {
                _gestureDetector.SetOnDoubleTapListener(null);
            }

            // Clear listeners too
            _matrixChangeListener = null;
            _photoTapListener     = null;
            _viewTapListener      = null;

            // Finally, clear ImageView
            _imageView = null;
        }
コード例 #20
0
        void LoadPagesDataSource()
        {
            //LOViewModel vm = ViewModel as LOViewModel;
            //var styles = new StyleConstants();
            //vm.IsLoading.Execute(null);
            bool is_main = true;
            int  space   = Configuration.getWidth(30);
            //	for (int i = 0; i < 3; i++)
            //	{
            var s_listp = vm.LOsInCircle[vm._currentUnidad].stack.StacksList;
            int indice  = 0;

            if (s_listp != null)
            {
                for (int j = 0; j < s_listp.Count; j++)
                {
                    for (int k = 0; k < s_listp [j].PagesList.Count; k++)
                    {
                        VerticalScrollViewPager scrollPager = new VerticalScrollViewPager(this);
                        scrollPager.setOnScrollViewListener(this);
                        LinearLayout linearScroll = new LinearLayout(this);
                        linearScroll.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);
                        linearScroll.Orientation      = Orientation.Vertical;

                        var content = s_listp [j].PagesList [k].content;
                        FrontContainerViewPager front = new FrontContainerViewPager(this);
                        front.Tag = "pager";


                        front.ImageChapter = s_listp [j].PagesList [k].page.url_img;


                        front.Title       = s_listp [j].PagesList [k].page.title;
                        front.Description = s_listp [j].PagesList [k].page.description;
                        var slides = s_listp [j].PagesList [k].content.lopage.loslide;
                        front.setBack(drBack);


                        linearScroll.AddView(front);

                        LinearLayout descriptionLayout = new LinearLayout(this);
                        descriptionLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);

                        descriptionLayout.Orientation = Orientation.Vertical;

                        int padW = Configuration.getWidth(30);
                        int padH = Configuration.getHeight(30);

                        descriptionLayout.SetPadding(padW, 0, padW, 0);


                        TextView titulo_detalle = new TextView(this);
                        titulo_detalle.Text     = "Descripción";
                        titulo_detalle.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/ArcherMediumPro.otf");
                        titulo_detalle.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(38));
                        titulo_detalle.SetTextColor(Color.ParseColor(Configuration.ListaColores [indice % 6]));
                        descriptionLayout.AddView(titulo_detalle);

                        TextView detalle = new TextView(this);
                        detalle.TextFormatted = Html.FromHtml(slides[0].loparagraph);
                        detalle.Typeface      = Typeface.CreateFromAsset(this.Assets, "fonts/ArcherMediumPro.otf");
                        detalle.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(32));
                        descriptionLayout.AddView(detalle);



                        ViewTreeObserver vto = detalle.ViewTreeObserver;
                        int H = 0;
                        vto.GlobalLayout += (sender, args) => {
                            H = detalle.Height;
                            detalle.LayoutParameters.Height = H - Configuration.getHeight(50);
                        };


                        LinearLayout separationLinear = new LinearLayout(this);
                        separationLinear.LayoutParameters = new LinearLayout.LayoutParams(-1, 5);
                        separationLinear.SetBackgroundColor(Color.ParseColor("#D8D8D8"));
                        separationLinear.Orientation = Orientation.Horizontal;

                        linearScroll.AddView(descriptionLayout);
                        linearScroll.AddView(separationLinear);

                        separationLinear.SetPadding(0, padH, 0, padH);


                        listFrontPager.Add(front);

                        var currentpage = s_listp [j].PagesList [k];



                        for (int m = 1; m < slides.Count; m++)
                        {
                            LOSlideSource slidesource = new LOSlideSource(this);

                            var _id_ = vm.LOsInCircle [vm._currentUnidad].lo.color_id;
                            is_main = !is_main;


                            slidesource.ColorS = Configuration.ListaColores [indice % 6];

                            slidesource.Type = slides [m].lotype;
                            if (slides [m].lotitle != null)
                            {
                                slidesource.Title = slides [m].lotitle;
                            }
                            if (slides [m].loparagraph != null)
                            {
                                slidesource.Paragraph = slides [m].loparagraph;
                            }
                            if (slides [m].loimage != null)
                            {
                                slidesource.ImageUrl = slides [m].loimage;
                            }
                            if (slides [m].lotext != null)
                            {
                                slidesource.Paragraph = slides [m].lotext;
                            }
                            if (slides [m].loauthor != null)
                            {
                                slidesource.Author = slides [m].loauthor;
                            }
                            if (slides [m].lovideo != null)
                            {
                                slidesource.VideoUrl = slides [m].lovideo;
                            }

                            var c_slide = slides [m];


                            if (c_slide.loitemize != null)
                            {
                                slidesource.Itemize = new ObservableCollection <LOItemSource> ();
                                var items = c_slide.loitemize.loitem;

                                for (int n = 0; n < items.Count; n++)
                                {
                                    LOItemSource item = new LOItemSource();
                                    if (items [n].loimage != null)
                                    {
                                        item.ImageUrl = items [n].loimage;
                                    }
                                    if (items [n].lotext != null)
                                    {
                                        item.Text = items [n].lotext;
                                    }


                                    var c_item_ize = items [n];

                                    slidesource.Itemize.Add(item);
                                }
                            }



                            linearScroll.AddView(slidesource.getViewSlide());
                        }


                        //linearScroll.SetPadding (padW,padH,padW,padH);

                        scrollPager.VerticalScrollBarEnabled = false;
                        if (k == 0)
                        {
                            scrollPager.AddView(linearScroll);
                            listaScroll.Add(scrollPager);
                            indice++;
                        }
                    }
                }
            }
            else
            {
                Console.WriteLine("ERROR");
            }



            //	}
            mainLayoutPages.RemoveAllViews();
            //_progresD.Hide ();
            mainLayoutPages.AddView(viewPager);
            mainLayoutPages.SetX(0);
            mainLayoutPages.SetY(0);
            _mainLayout.AddView(mainLayoutPages);

            _publicidadLayout = new LinearLayout(this);
            _publicidadLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(85));
            Drawable drp = new BitmapDrawable(getBitmapFromAsset("images/footerad.jpg"));

            _publicidadLayout.SetBackgroundDrawable(drp);
            _publicidadLayout.SetY(Configuration.getHeight(1136 - 85));
            _mainLayout.AddView(_publicidadLayout);
            _publicidadLayout.Click += delegate {
                if (adOpen)
                {
                    hideAd();
                }
                else
                {
                    Random rnd = new Random();
                    showAd(rnd.Next(adsImagesPath.Count));
                }
            };


            LOViewAdapter adapter = new LOViewAdapter(this, listaScroll);

            viewPager.Adapter = adapter;
            //viewPager.CurrentItem = IndiceSection;
            viewPager.SetCurrentItem(vm._currentSection, true);
        }
コード例 #21
0
 public PerformanceTrackerRenderer(global::Android.Content.Context context) : base(context)
 {
     ViewTreeObserver.AddOnDrawListener(this);
 }
コード例 #22
0
 protected override void OnAttached()
 {
     _attached         = true;
     _viewTreeObserver = Control.ViewTreeObserver;
     _viewTreeObserver.GlobalLayout += OnGlobalLayout;
 }
コード例 #23
0
 private ViewTreeObserverCompat(ViewTreeObserver observer)
 {
     _observer = observer;
 }
コード例 #24
0
ファイル: LOView.cs プロジェクト: joselhuillca/PeruCampingV3
        void LoadPagesDataSource()
        {
            bool is_main = true;
            int  space   = Configuration.getWidth(30);

            var s_listp = vm.LOsInCircle[vm._currentUnidad].stack.StacksList;
            int indice  = 0;

            if (s_listp != null)
            {
                int j = vm._currentSection;
                //	for (int j = 0; j < s_listp.Count; j++) {

                for (int k = 0; k < s_listp [j].PagesList.Count; k++)
                {
                    //		if (j == vm._currentSection) {

                    VerticalScrollViewPager scrollPager = new VerticalScrollViewPager(this);
                    scrollPager.setOnScrollViewListener(this);
                    LinearLayout linearScroll = new LinearLayout(this);
                    linearScroll.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);
                    linearScroll.Orientation      = Orientation.Vertical;

                    var content = s_listp [j].PagesList [k].content;
                    FrontContainerViewPager front = new FrontContainerViewPager(this);
                    front.Tag = "pager";


                    front.ImageChapter = s_listp [j].PagesList [k].page.url_img;


                    front.Title       = s_listp [j].PagesList [k].page.title;
                    front.Description = s_listp [j].PagesList [k].page.description;


                    var slides = s_listp [j].PagesList [k].content.lopage.loslide;
                    front.setBack(drBack);


                    linearScroll.AddView(front);

                    LinearLayout descriptionLayout = new LinearLayout(this);
                    descriptionLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);
                    descriptionLayout.SetPadding(space, 0, space, space);
                    descriptionLayout.Orientation = Orientation.Vertical;

                    TextView titulo_detalle = new TextView(this);
                    titulo_detalle.Text     = "Descripción";
                    titulo_detalle.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/ArcherMediumPro.otf");
                    titulo_detalle.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(38));
                    titulo_detalle.SetTextColor(Color.ParseColor(Configuration.ListaColores [indice % 6]));
                    titulo_detalle.SetPadding(0, 0, 0, space);
                    descriptionLayout.AddView(titulo_detalle);

                    TextView detalle = new TextView(this);
                    detalle.TextFormatted = Html.FromHtml(slides [0].loparagraph);
                    detalle.Typeface      = Typeface.CreateFromAsset(this.Assets, "fonts/ArcherMediumPro.otf");
                    detalle.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(32));
                    descriptionLayout.AddView(detalle);

                    ViewTreeObserver vto = detalle.ViewTreeObserver;
                    int H = 0;
                    vto.GlobalLayout += (sender, args) =>
                    {
                        H = detalle.Height;
                        Console.WriteLine("TAM:::1:" + H);
                        detalle.LayoutParameters.Height = H - Configuration.getHeight(60);
                    };



                    LinearLayout separationLinear = new LinearLayout(this);
                    separationLinear.LayoutParameters = new LinearLayout.LayoutParams(-1, 5);
                    separationLinear.SetBackgroundColor(Color.ParseColor("#D8D8D8"));
                    separationLinear.Orientation = Orientation.Horizontal;
                    //separationLinear.SetPadding (0,0,0,50);

                    //Añadir mis-Favoritos-----------------------------------------------------------
                    iconFavorito = Bitmap.CreateScaledBitmap(getBitmapFromAsset("icons/notas.png"), Configuration.getWidth(40), Configuration.getWidth(30), true);
                    //Colocando icono de Favoritos
                    ImageView favorit_ = new ImageView(this);
                    favorit_.Tag = j;
                    favorit_.SetImageBitmap(iconFavorito);
                    favorit_.SetX(Configuration.getWidth(20));
                    favorit_.SetY(Configuration.getHeight(0));
                    favorit_.Click += delegate { funcFavoritos(favorit_); };

                    TextView tomar_notas = new TextView(this);
                    tomar_notas.Text = "Tomar notas";
                    tomar_notas.SetTextColor(Color.ParseColor("#E65100"));
                    tomar_notas.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(21));
                    tomar_notas.SetX(Configuration.getWidth(60));
                    tomar_notas.SetY(Configuration.getHeight(0));
                    tomar_notas.Click += delegate
                    {
                        Bundle bundle = new Bundle();
                        bundle.PutString("Titulo", front.Title);
                        bundle.PutInt("TaskID", isListNotas(front.Title));

                        //Intent nos permite enlazar dos actividades
                        Intent intent = new Intent(this, typeof(NotasItemScreen));
                        //añadir parametros
                        intent.PutExtras(bundle);
                        //ejuta intent
                        StartActivity(intent);
                    };

                    RelativeLayout misFavoritos = new RelativeLayout(this);
                    misFavoritos.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(60));
                    misFavoritos.SetX(Configuration.getWidth(0));
                    misFavoritos.SetY(Configuration.getHeight(0));
                    misFavoritos.AddView(tomar_notas);
                    misFavoritos.AddView(favorit_);
                    linearScroll.AddView(misFavoritos);
                    //FIN FAVoritos-----------------------------------------------------------
                    linearScroll.AddView(descriptionLayout);
                    linearScroll.AddView(separationLinear);

                    listFrontPager.Add(front);

                    var currentpage = s_listp [j].PagesList [k];



                    for (int m = 1; m < slides.Count; m++)
                    {
                        LOSlideSource slidesource = new LOSlideSource(this);

                        var _id_ = vm.LOsInCircle [vm._currentUnidad].lo.color_id;
                        is_main = !is_main;


                        slidesource.ColorS = Configuration.ListaColores [indice % 6];

                        slidesource.Type = slides [m].lotype;
                        if (slides [m].lotitle != null)
                        {
                            slidesource.Title = slides [m].lotitle;
                        }
                        if (slides [m].loparagraph != null)
                        {
                            slidesource.Paragraph = slides [m].loparagraph;
                        }
                        if (slides [m].loimage != null)
                        {
                            slidesource.ImageUrl = slides [m].loimage;
                        }
                        if (slides [m].lotext != null)
                        {
                            slidesource.Paragraph = slides [m].lotext;
                        }
                        if (slides [m].loauthor != null)
                        {
                            slidesource.Author = slides [m].loauthor;
                        }
                        if (slides [m].lovideo != null)
                        {
                            slidesource.VideoUrl = slides [m].lovideo;
                        }

                        var c_slide = slides [m];


                        if (c_slide.loitemize != null)
                        {
                            slidesource.Itemize = new ObservableCollection <LOItemSource> ();
                            var items = c_slide.loitemize.loitem;

                            for (int n = 0; n < items.Count; n++)
                            {
                                LOItemSource item = new LOItemSource();
                                if (items [n].loimage != null)
                                {
                                    item.ImageUrl = items [n].loimage;
                                }
                                if (items [n].lotext != null)
                                {
                                    item.Text = items [n].lotext;
                                }


                                var c_item_ize = items [n];

                                slidesource.Itemize.Add(item);
                            }
                        }



                        slidesource.title_page = front.Title;
                        linearScroll.AddView(slidesource.getViewSlide());                                          //Toda la info menos la descripcion
                    }

                    scrollPager.VerticalScrollBarEnabled = false;
                    if (k == 0)
                    {
                        scrollPager.AddView(linearScroll);
                        listaScroll.Add(scrollPager);
                        indice++;
                    }


                    //	}
                }

                //}
            }
            else
            {
                Console.WriteLine("ERROR");
            }


            mainLayoutPages.RemoveAllViews();
            mainLayoutPages.AddView(viewPager);
            mainLayoutPages.SetX(0);
            mainLayoutPages.SetY(0);
            _mainLayout.AddView(mainLayoutPages);

            _publicidadLayout = new LinearLayout(this);
            _publicidadLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(85));
            Drawable drp = new BitmapDrawable(getBitmapFromAsset("images/footerad.jpg"));

            _publicidadLayout.SetBackgroundDrawable(drp);
            _publicidadLayout.SetY(Configuration.getHeight(1136 - 85));
            _mainLayout.AddView(_publicidadLayout);
            _publicidadLayout.Click += delegate {
                if (adOpen)
                {
                    hideAd();
                }
                else
                {
                    Random rnd = new Random();
                    showAd(rnd.Next(adsImagesPath.Count));
                }
            };


            LOViewAdapter adapter = new LOViewAdapter(this, listaScroll);

            viewPager.Adapter = adapter;
            //viewPager.CurrentItem = IndiceSection;
            //viewPager.SetCurrentItem (vm._currentSection, true);
        }
コード例 #25
0
 public static ViewTreeObserverCompat From(ViewTreeObserver observer)
 {
     return(new ViewTreeObserverCompat(observer));
 }
コード例 #26
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.TabbedPage> e)
        {
            base.OnElementChanged(e);

            if (!_isFirstDesign)
            {
                return;
            }

            if (e.OldElement != null)
            {
                listener.GlobalLayout -= listener_GlobalLayout;
                ViewTreeObserver.RemoveOnGlobalLayoutListener(listener);
            }

            if (e.NewElement != null)
            {
                listener.GlobalLayout += listener_GlobalLayout;
                ViewTreeObserver.AddOnGlobalLayoutListener(listener);
            }

            myTabbedPage = (MvvmAspire.Controls.TabbedPage)Element;

            if (_activity == null)
            {
                _activity = this.Context as Activity;

                if (myTabbedPage.TabScreenLocation == TabGravity.Bottom)
                {
                    mMenu = new CustomMenuPopUp(this.Context, this, _activity.LayoutInflater);
                }
                else
                {
                    mMenu = new CustomMenu(this.Context, this, _activity.LayoutInflater);
                }

                mMenu.SetBadgeLocation(myTabbedPage.BadgeLocation);
                mMenu.SetItemsCountInLine(myTabbedPage.ActiveIcons.Count);
                if (myTabbedPage.BackgroundDrawable != null && myTabbedPage.SelectedDrawable != null)
                {
                    mMenu.SetBackgroundDrawable(myTabbedPage.BackgroundDrawable.File, myTabbedPage.SelectedDrawable.File);
                }

                if (myTabbedPage.TabScreenLocation == TabGravity.Bottom)
                {
                    originalPadding = myTabbedPage.Padding.Bottom;
                }
                else
                {
                    originalPadding = myTabbedPage.Padding.Top;
                }
            }

            if (childrenIcons.Count == 0)
            {
                for (int i = 0; i < myTabbedPage.Children.Count; i++)
                {
                    if (myTabbedPage.Children[i].Icon.File != null)
                    {
                        childrenIcons.Add(myTabbedPage.Children[i].Icon.File);
                    }
                }
            }

            myTabbedPage.Appearing    += myTabbedPage_Appearing;
            myTabbedPage.Disappearing += myTabbedPage_Disappearing;
        }
コード例 #27
0
        /// <summary>
        /// Create an AmbilWarnaDialog.
        /// </summary>
        /// <param name="context"> activity context </param>
        /// <param name="color"> current color </param>
        /// <param name="supportsAlpha"> whether alpha/transparency controls are enabled </param>
        /// <param name="listener"> an OnAmbilWarnaListener, allowing you to get back error or OK </param>
        public AmbilWarnaDialog(Context context, int color, bool supportsAlpha, IOnAmbilWarnaListener listener)
        {
            var supportsAlpha1 = supportsAlpha;

            _listener = listener;

            if (!supportsAlpha)
            {
                // remove alpha if not supported
                color = color | unchecked ((int)0xff000000);
            }

            Android.Graphics.Color.ColorToHSV(color.ToColor(), _currentColorHsv);
            _alpha = Android.Graphics.Color.GetAlphaComponent(color);

            View view = LayoutInflater.From(context).Inflate(R.Layout.ambilwarna_dialog, null);

            _viewHue    = view.FindViewById(R.Id.ambilwarna_viewHue);
            _viewSatVal = (AmbilWarnaSquare)view.FindViewById(R.Id.ambilwarna_viewSatBri);
            _viewCursor = (ImageView)view.FindViewById(R.Id.ambilwarna_cursor);
            var viewOldColor = view.FindViewById(R.Id.ambilwarna_oldColor);
            var viewNewColor = view.FindViewById(R.Id.ambilwarna_newColor);

            _viewTarget         = (ImageView)view.FindViewById(R.Id.ambilwarna_target);
            _viewContainer      = (ViewGroup)view.FindViewById(R.Id.ambilwarna_viewContainer);
            _viewAlphaOverlay   = view.FindViewById(R.Id.ambilwarna_overlay);
            _viewAlphaCursor    = (ImageView)view.FindViewById(R.Id.ambilwarna_alphaCursor);
            _viewAlphaCheckered = (ImageView)view.FindViewById(R.Id.ambilwarna_alphaCheckered);

            // Hide/show alpha
            _viewAlphaOverlay.Visibility   = supportsAlpha ? ViewStates.Visible : ViewStates.Gone;
            _viewAlphaCursor.Visibility    = supportsAlpha ? ViewStates.Visible : ViewStates.Gone;
            _viewAlphaCheckered.Visibility = supportsAlpha ? ViewStates.Visible : ViewStates.Gone;

            _viewSatVal.SetHue(Hue);
            viewOldColor.SetBackgroundColor(color.ToColor());
            viewNewColor.SetBackgroundColor(color.ToColor());


            _viewHue.Touch += (sender, e) =>
            {
                if (e.Event.Action == MotionEventActions.Move ||
                    e.Event.Action == MotionEventActions.Down ||
                    e.Event.Action == MotionEventActions.Up)
                {
                    float y = e.Event.GetY();
                    if (y < 0.0f)
                    {
                        y = 0.0f;
                    }
                    if (y > _viewHue.MeasuredHeight)
                    {
                        // To avoid jumping the cursor from bottom to top.
                        y = _viewHue.MeasuredHeight - 0.001f;
                    }
                    float hue = 360.0f - 360.0f / _viewHue.MeasuredHeight * y;

                    // HACK
                    // if (hue == 360.0f)
                    if (Math.Abs(hue - 360.0f) < Tolerance)
                    {
                        hue = 0.0f;
                    }

                    Hue = hue;

                    // Update view
                    _viewSatVal.SetHue(Hue);
                    MoveCursor();
                    viewNewColor.SetBackgroundColor(Color.ToColor());
                    UpdateAlphaView();

                    //return true;
                    e.Handled = true;
                }

                //return false;
                e.Handled = false;
            };


            if (supportsAlpha)
            {
                _viewAlphaCheckered.Touch += (sender, e) =>
                {
                    if (e.Event.Action == MotionEventActions.Move ||
                        e.Event.Action == MotionEventActions.Down ||
                        e.Event.Action == MotionEventActions.Up)
                    {
                        float y = e.Event.GetY();

                        if (y < 0.0f)
                        {
                            y = 0.0f;
                        }

                        if (y > _viewAlphaCheckered.MeasuredHeight)
                        {
                            y = _viewAlphaCheckered.MeasuredHeight - 0.001f;                             // to avoid jumping the cursor from bottom to top.
                        }

                        var a = (int)Math.Round(255.0f - 255.0f / _viewAlphaCheckered.MeasuredHeight * y);
                        Alpha = a;

                        // Update view
                        MoveAlphaCursor();
                        int col = Color;
                        int c   = a << 24 | col & 0x00ffffff;
                        viewNewColor.SetBackgroundColor(c.ToColor());

                        //return true;
                        e.Handled = true;
                    }

                    //return false;
                    e.Handled = false;
                };
            }


            _viewSatVal.Touch += (sender, e) =>
            {
                if (e.Event.Action == MotionEventActions.Move ||
                    e.Event.Action == MotionEventActions.Down ||
                    e.Event.Action == MotionEventActions.Up)
                {
                    float x = e.Event.GetX();                     // Touch event are in dp units.
                    float y = e.Event.GetY();

                    if (x < 0.0f)
                    {
                        x = 0.0f;
                    }

                    if (x > _viewSatVal.MeasuredWidth)
                    {
                        x = _viewSatVal.MeasuredWidth;
                    }

                    if (y < 0.0f)
                    {
                        y = 0.0f;
                    }

                    if (y > _viewSatVal.MeasuredHeight)
                    {
                        y = _viewSatVal.MeasuredHeight;
                    }

                    Sat = 1.0f / _viewSatVal.MeasuredWidth * x;
                    Val = 1.0f - 1.0f / _viewSatVal.MeasuredHeight * y;

                    // Update view
                    MoveTarget();
                    viewNewColor.SetBackgroundColor(Color.ToColor());

                    //return true;
                    e.Handled = true;
                }

                //return false;
                e.Handled = false;
            };


            Dialog = new AlertDialog.Builder(context)
                     .SetPositiveButton(
                Android.Resource.String.Ok,
                (sender, e) =>
            {
                // Set Listener
                listener?.OnOk(this, Color);

                // EventHandler
                OnOk(this, Color);
            }
                ).SetNegativeButton(
                Android.Resource.String.Cancel,
                (sender, e) =>
            {
                // Set Listener
                listener?.OnCancel(this);

                // EventHandler
                OnCancel(this);
            }
                ).SetOnCancelListener(
                // If back button is used, call back our listener.
                new MyDialogInterfaceOnCancelListener(
                    (dlg) =>
            {
                // Set Listener
                listener?.OnCancel(this);

                // EventHandler
                OnCancel(this);
            })
                ).Create();


            // Kill all padding from the dialog window
            Dialog.SetView(view, 0, 0, 0, 0);

            // Move cursor & target on first draw
            ViewTreeObserver vto = view.ViewTreeObserver;
            var vtoListener      = new MyVtoOnGlobalLayoutListener();

            vtoListener.GlobalLayoutEvent += delegate
            {
                MoveCursor();

                if (supportsAlpha1)
                {
                    MoveAlphaCursor();
                }
                MoveTarget();

                if (supportsAlpha1)
                {
                    UpdateAlphaView();
                }

                //view.ViewTreeObserver.RemoveGlobalOnLayoutListener(vtoListener); // obsolete
                RemoveOnGlobalLayoutCompatListener(view, vtoListener);
            };

            vto.AddOnGlobalLayoutListener(vtoListener);
        }
コード例 #28
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Window.AddFlags(WindowManagerFlags.Fullscreen);
            Window.ClearFlags(WindowManagerFlags.ForceNotFullscreen);
            ActionBar.Hide();

            numberOfVariables = Intent.GetIntExtra(Constants.VARIABLE_COUNT, 0);

            SetContentView(Resource.Layout.MultiplyTwoVar);

            // Create your application here
            activityType = Constants.MULTIPLY;
            listeners    = new Listeners(this);

            result = (TextView)FindViewById(Resource.Id.result);

            tile_1  = (AlgeTilesTextView)FindViewById(Resource.Id.tile_1);
            x_tile  = (AlgeTilesTextView)FindViewById(Resource.Id.x_tile);
            y_tile  = (AlgeTilesTextView)FindViewById(Resource.Id.y_tile);
            xy_tile = (AlgeTilesTextView)FindViewById(Resource.Id.xy_tile);
            x2_tile = (AlgeTilesTextView)FindViewById(Resource.Id.x2_tile);
            y2_tile = (AlgeTilesTextView)FindViewById(Resource.Id.y2_tile);

            tile_1.LongClick  += listeners.tile_LongClick;
            x_tile.LongClick  += listeners.tile_LongClick;
            y_tile.LongClick  += listeners.tile_LongClick;
            x2_tile.LongClick += listeners.tile_LongClick;
            y2_tile.LongClick += listeners.tile_LongClick;
            xy_tile.LongClick += listeners.tile_LongClick;

            upperLeftGrid  = FindViewById <AlgeTilesRelativeLayout>(Resource.Id.upperLeft);
            upperRightGrid = FindViewById <AlgeTilesRelativeLayout>(Resource.Id.upperRight);
            lowerLeftGrid  = FindViewById <AlgeTilesRelativeLayout>(Resource.Id.lowerLeft);
            lowerRightGrid = FindViewById <AlgeTilesRelativeLayout>(Resource.Id.lowerRight);

            upperMiddleGrid = FindViewById <GridLayout>(Resource.Id.upperMiddle);
            middleLeftGrid  = FindViewById <GridLayout>(Resource.Id.middleLeft);
            middleRightGrid = FindViewById <GridLayout>(Resource.Id.middleRight);
            lowerMiddleGrid = FindViewById <GridLayout>(Resource.Id.lowerMiddle);

            ViewTreeObserver vto2 = upperLeftGrid.ViewTreeObserver;

            vto2.GlobalLayout += (sender, e) =>
            {
                if (!isFirstTime)
                {
                    heightInPx = upperLeftGrid.Height;
                    widthInPx  = upperLeftGrid.Width;
                    upperLeftGrid.SetMinimumHeight(0);
                    upperLeftGrid.SetMinimumWidth(0);
                    isFirstTime = true;

                    LinearLayout.LayoutParams par_1 = (LinearLayout.LayoutParams)tile_1.LayoutParameters;
                    TileUtilities.TileFactor  tF    = TileUtilities.getTileFactors(tile_1.getTileType());
                    par_1.Height = (int)(heightInPx / 7);
                    par_1.Width  = (int)(heightInPx / 7);
                    tile_1.SetBackgroundResource(tF.id);
                    tile_1.Text             = tF.text;
                    tile_1.LayoutParameters = par_1;

                    LinearLayout.LayoutParams par_x = (LinearLayout.LayoutParams)x_tile.LayoutParameters;
                    tF           = TileUtilities.getTileFactors(x_tile.getTileType());
                    par_x.Height = (int)(heightInPx / tF.heightFactor);
                    par_x.Width  = (int)(heightInPx / 7);
                    x_tile.SetBackgroundResource(tF.id);
                    x_tile.Text             = tF.text;
                    x_tile.LayoutParameters = par_x;

                    LinearLayout.LayoutParams par_y = (LinearLayout.LayoutParams)y_tile.LayoutParameters;
                    tF           = TileUtilities.getTileFactors(y_tile.getTileType());
                    par_y.Height = (int)(heightInPx / tF.heightFactor);
                    par_y.Width  = (int)(heightInPx / 7);
                    y_tile.SetBackgroundResource(tF.id);
                    y_tile.Text             = tF.text;
                    y_tile.LayoutParameters = par_y;

                    LinearLayout.LayoutParams par_x2 = (LinearLayout.LayoutParams)x2_tile.LayoutParameters;
                    tF            = TileUtilities.getTileFactors(x2_tile.getTileType());
                    par_x2.Height = (int)(heightInPx / tF.heightFactor);
                    par_x2.Width  = (int)(heightInPx / tF.widthFactor);
                    x2_tile.SetBackgroundResource(tF.id);
                    if (tF.text.Length > 1 && !tF.text.Equals("xy"))
                    {
                        var cs = new SpannableStringBuilder(tF.text);
                        cs.SetSpan(new SuperscriptSpan(), 1, 2, SpanTypes.ExclusiveExclusive);
                        cs.SetSpan(new RelativeSizeSpan(0.75f), 1, 2, SpanTypes.ExclusiveExclusive);
                        x2_tile.TextFormatted = cs;
                    }
                    else
                    {
                        x2_tile.Text = tF.text;
                    }
                    x2_tile.LayoutParameters = par_x2;

                    LinearLayout.LayoutParams par_y2 = (LinearLayout.LayoutParams)y2_tile.LayoutParameters;
                    tF            = TileUtilities.getTileFactors(y2_tile.getTileType());
                    par_y2.Height = (int)(heightInPx / tF.heightFactor);
                    par_y2.Width  = (int)(heightInPx / tF.widthFactor);
                    y2_tile.SetBackgroundResource(tF.id);
                    if (tF.text.Length > 1 && !tF.text.Equals("xy"))
                    {
                        var cs = new SpannableStringBuilder(tF.text);
                        cs.SetSpan(new SuperscriptSpan(), 1, 2, SpanTypes.ExclusiveExclusive);
                        cs.SetSpan(new RelativeSizeSpan(0.75f), 1, 2, SpanTypes.ExclusiveExclusive);
                        y2_tile.TextFormatted = cs;
                    }
                    else
                    {
                        y2_tile.Text = tF.text;
                    }
                    y2_tile.LayoutParameters = par_y2;

                    LinearLayout.LayoutParams par_xy = (LinearLayout.LayoutParams)xy_tile.LayoutParameters;
                    tF            = TileUtilities.getTileFactors(xy_tile.getTileType());
                    par_xy.Height = (int)(heightInPx / tF.heightFactor);
                    par_xy.Width  = (int)(heightInPx / tF.widthFactor);
                    xy_tile.SetBackgroundResource(tF.id);
                    if (tF.text.Length > 1 && !tF.text.Equals("xy"))
                    {
                        var cs = new SpannableStringBuilder(tF.text);
                        cs.SetSpan(new SuperscriptSpan(), 1, 2, SpanTypes.ExclusiveExclusive);
                        cs.SetSpan(new RelativeSizeSpan(0.75f), 1, 2, SpanTypes.ExclusiveExclusive);
                        xy_tile.TextFormatted = cs;
                    }
                    else
                    {
                        xy_tile.Text = tF.text;
                    }
                    xy_tile.LayoutParameters = par_xy;
                }
            };

            outerGridLayoutList.Add(upperLeftGrid);
            outerGridLayoutList.Add(upperRightGrid);
            outerGridLayoutList.Add(lowerLeftGrid);
            outerGridLayoutList.Add(lowerRightGrid);

            innerGridLayoutList.Add(upperMiddleGrid);
            innerGridLayoutList.Add(middleLeftGrid);
            innerGridLayoutList.Add(middleRightGrid);
            innerGridLayoutList.Add(lowerMiddleGrid);

            //For multiply this is the initial grid available
            //Together form one Part of the formula
            upperMiddleGrid.Drag += listeners.GridLayout_Drag;
            lowerMiddleGrid.Drag += listeners.GridLayout_Drag;

            //Together form one Part of the formula
            middleLeftGrid.Drag  += listeners.GridLayout_Drag;
            middleRightGrid.Drag += listeners.GridLayout_Drag;

            //Shade red the other grids
            for (int i = 0; i < outerGridLayoutList.Count; ++i)
            {
                outerGridLayoutList[i].SetBackgroundResource(Resource.Drawable.unavailable);
            }

            removeToggle = (ToggleButton)FindViewById(Resource.Id.remove);
            dragToggle   = (ToggleButton)FindViewById(Resource.Id.drag);
            rotateToggle = (ToggleButton)FindViewById(Resource.Id.rotate);
            muteToggle   = (ToggleButton)FindViewById(Resource.Id.mute);

            removeToggle.Click += listeners.toggle_click;
            dragToggle.Click   += listeners.toggle_click;
            rotateToggle.Click += listeners.toggle_click;
            muteToggle.Click   += listeners.toggle_click;

            tutorialButton        = FindViewById <Button>(Resource.Id.tutorial);
            tutorialButton.Click += listeners.toggle_click;

            prefs = PreferenceManager.GetDefaultSharedPreferences(this);
            muteToggle.Checked = prefs.GetBoolean(Constants.MUTE, false);

            newQuestionButton = (Button)FindViewById <Button>(Resource.Id.new_question_button);
            refreshButton     = (Button)FindViewById <Button>(Resource.Id.refresh_button);
            checkButton       = (Button)FindViewById <Button>(Resource.Id.check_button);

            newQuestionButton.Click += button_click;
            refreshButton.Click     += button_click;
            checkButton.Click       += button_click;

            upperLeftGV  = new GridValue();
            upperRightGV = new GridValue();
            lowerLeftGV  = new GridValue();
            lowerRightGV = new GridValue();

            midUpGV    = new GridValue();
            midLowGV   = new GridValue();
            midLeftGV  = new GridValue();
            midRightGV = new GridValue();

            gridValueList.Add(upperLeftGV);
            gridValueList.Add(upperRightGV);
            gridValueList.Add(lowerLeftGV);
            gridValueList.Add(lowerRightGV);

            gridValueList.Add(midUpGV);
            gridValueList.Add(midLowGV);
            gridValueList.Add(midLeftGV);
            gridValueList.Add(midRightGV);

            setupNewQuestion();

            correct   = MediaPlayer.Create(this, Resource.Raw.correct);
            incorrect = MediaPlayer.Create(this, Resource.Raw.wrong);

            x2ET  = FindViewById <EditText>(Resource.Id.x2_value);
            y2ET  = FindViewById <EditText>(Resource.Id.y2_value);
            xyET  = FindViewById <EditText>(Resource.Id.xy_value);
            xET   = FindViewById <EditText>(Resource.Id.x_value);
            yET   = FindViewById <EditText>(Resource.Id.y_value);
            oneET = FindViewById <EditText>(Resource.Id.one_value);

            editTextList.Add(x2ET);
            editTextList.Add(y2ET);
            editTextList.Add(xyET);
            editTextList.Add(xET);
            editTextList.Add(yET);
            editTextList.Add(oneET);

            sv = FindViewById <ScrollView>(Resource.Id.sv);

            refreshScreen(Constants.MULTIPLY, gridValueList, innerGridLayoutList, outerGridLayoutList);

            rectTileListList.Add(upperRightRectTileList);
            rectTileListList.Add(upperLeftRectTileList);
            rectTileListList.Add(lowerLeftRectTileList);
            rectTileListList.Add(lowerRightRectTileList);

            settingsDialog = new Dialog(this);
            settingsDialog.Window.RequestFeature(WindowFeatures.NoTitle);
        }
コード例 #29
0
 public OnGlobalLayoutListenerImpl(ViewTreeObserver sender)
 {
     _sender = sender;
 }
コード例 #30
0
 private void AttachLayoutListener()
 {
     layoutListener = new LayoutListener(this);
     ViewTreeObserver.AddOnGlobalLayoutListener(layoutListener);
 }