Ejemplo n.º 1
0
        protected override void OnCreate(Android.OS.Bundle?savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_main);

            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);

            // Hack to tell the platform independent samples where the files can be found on Android.
            MbTilesSample.MbTilesLocation = MbTilesLocationOnAndroid;
            MbTilesHelper.DeployMbTilesFile(s => File.Create(System.IO.Path.Combine(MbTilesLocationOnAndroid, s)));

            _mapControl                       = FindViewById <MapControl>(Resource.Id.mapcontrol) ?? throw new NullReferenceException();
            _mapControl.Map                   = MbTilesSample.CreateMap();
            _mapControl.Info                 += MapOnInfo;
            _mapControl.Map.RotationLock      = true;
            _mapControl.UnSnapRotationDegrees = 30;
            _mapControl.ReSnapRotationDegrees = 5;
            _mapControl.Renderer.WidgetRenders[typeof(CustomWidget.CustomWidget)] = new CustomWidgetSkiaRenderer();

            var relativeLayout = FindViewById <RelativeLayout>(Resource.Id.mainLayout) ?? throw new NullReferenceException();;

            _popup?.Dispose();
            relativeLayout.AddView(_popup = CreatePopup());
            _mapControl.Map.Layers.Clear();
            var sample = new MbTilesOverlaySample();

            sample.Setup(_mapControl);

            //_mapControl.Info += MapControlOnInfo;
            //LayerList.Initialize(_mapControl.Map.Layers);
        }
Ejemplo n.º 2
0
        public void StopRecord()
        {
            if (_isRecording)
            {
                if (_textureView != null)
                {
                    _textureView.Visibility = ViewStates.Invisible;
                }
                // 録画終了
                _recorder.Stop();
                _recorder.Reset();
                _recorder.Release();
                _recorder = null;

                if (_linearLayout != null)
                {
                    ((ViewGroup)_linearLayout.Parent).RemoveView(_linearLayout);
                    _linearLayout.Dispose();
                    _linearLayout = null;
                }

                if (_listener != null)
                {
                    _listener.StopCamera2();
                    _listener.Dispose();
                    _listener = null;
                }

                _isRecording = false;
            }
        }
Ejemplo n.º 3
0
        public void LinearLayoutLinearAlignment()
        {
            tlog.Debug(tag, $"LinearLayoutLinearAlignment START");

            var testingTarget = new LinearLayout();

            Assert.IsNotNull(testingTarget, "null handle returned");
            Assert.IsInstanceOf <LinearLayout>(testingTarget, "Should return LinearLayout instance.");

            testingTarget.LinearAlignment = LinearLayout.Alignment.End;
            Assert.AreEqual(testingTarget.LinearAlignment, LinearLayout.Alignment.End, "Should be End.");

            testingTarget.LinearAlignment = LinearLayout.Alignment.Center;
            Assert.AreEqual(testingTarget.LinearAlignment, LinearLayout.Alignment.Center, "Should be Center.");

            testingTarget.LinearAlignment = LinearLayout.Alignment.Begin;
            Assert.AreEqual(testingTarget.LinearAlignment, LinearLayout.Alignment.Begin, "Should be Begin.");

            testingTarget.LinearAlignment = LinearLayout.Alignment.CenterHorizontal;
            Assert.AreEqual(testingTarget.LinearAlignment, LinearLayout.Alignment.CenterHorizontal, "Should be CenterHorizontal.");

            testingTarget.LinearAlignment = LinearLayout.Alignment.Top;
            Assert.AreEqual(testingTarget.LinearAlignment, LinearLayout.Alignment.Top, "Should be Top.");

            testingTarget.LinearAlignment = LinearLayout.Alignment.Bottom;
            Assert.AreEqual(testingTarget.LinearAlignment, LinearLayout.Alignment.Bottom, "Should be Bottom.");

            testingTarget.LinearAlignment = LinearLayout.Alignment.CenterVertical;
            Assert.AreEqual(testingTarget.LinearAlignment, LinearLayout.Alignment.CenterVertical, "Should be CenterVertical.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"LinearLayoutLinearAlignment END (OK)");
        }
        /// <summary>
        /// Dispose the specified disposing.
        /// </summary>
        /// <returns>The dispose.</returns>
        /// <param name="disposing">If set to <c>true</c> disposing.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_command != null)
                {
                    _command.CanExecuteChanged -= Command_CanExecuteChanged;
                }
                Execute  = null;
                _command = null;
                _indicatorView?.RemoveFromParent();
                _indicatorView?.SetImageDrawable(null);
                _indicatorView?.SetImageBitmap(null);
                _indicatorView?.Dispose();
                _indicatorView = null;

                _coreView?.RemoveFromParent();
                _coreView?.Dispose();
                _coreView = null;

                _container?.RemoveFromParent();
                _container?.Dispose();
                _container = null;
            }
            base.Dispose(disposing);
        }
Ejemplo n.º 5
0
        public void Dispose()
        {
            if (calendar != null)
            {
                calendar.Dispose();
                calendar = null;
            }

            if (mainLayout != null)
            {
                mainLayout.Dispose();
                mainLayout = null;
            }

            if (proprtyOptionsLayout != null)
            {
                proprtyOptionsLayout.Dispose();
                proprtyOptionsLayout = null;
            }

            if (dataAdapter != null)
            {
                dataAdapter.Dispose();
                dataAdapter = null;
            }

            if (cultureSpinner != null)
            {
                cultureSpinner.Dispose();
                cultureSpinner = null;
            }
        }
        protected override void OnDestroy()
        {
            base.OnDestroy();

            //Unbind events
            unlocker.Touch -= Unlocker_Touch;
            clearAll.Click -= BtnClearAll_Click;
            WallpaperPublisher.NewWallpaperIssued     -= Wallpaper_NewWallpaperIssued;
            CatcherHelper.NotificationListSizeChanged -= CatcherHelper_NotificationListSizeChanged;
            lockscreen.Touch -= Lockscreen_Touch;

            watchDog.Stop();
            watchDog.Elapsed -= WatchdogInterval_Elapsed;
            watchDog.Dispose();
            //Dispose Views
            //Views
            recycler.Dispose();
            unlocker.Dispose();
            clearAll.Dispose();
            lockscreen.Dispose();
            wallpaper.Background.Dispose();
            wallpaper.Dispose();

            //Dispose Fragments
            notificationFragment.Dispose();
            musicFragment.Dispose();
            clockFragment.Dispose();
            weatherFragment.Dispose();

            StopFloatingNotificationService();
        }
Ejemplo n.º 7
0
        protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <MyMiniPlayer> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null)
            {
                activity = this.Context as Activity;
                view.Dispose();
                linearLayout.Dispose();
            }


            if (e.NewElement != null)
            {
                if (Control == null)
                {
                    activity = this.Context as Activity;

                    view = activity.LayoutInflater.Inflate(Resource.Layout.miniplayerLayout, null);

                    var test = view.FindViewById(Resource.Id.castMiniController);

                    linearLayout = view.FindViewById <LinearLayout>(Resource.Layout.miniplayerLayout);
                    SetNativeControl(view);
                }
            }
        }
Ejemplo n.º 8
0
        void Destroy()
        {
            if (ShellItem != null)
            {
                UnhookEvents(ShellItem);
            }

            ((IShellController)ShellContext?.Shell)?.RemoveAppearanceObserver(this);

            if (_bottomSheetDialog != null)
            {
                _bottomSheetDialog.DismissEvent -= OnMoreSheetDismissed;
                _bottomSheetDialog?.Dispose();
                _bottomSheetDialog = null;
            }

            _navigationArea?.Dispose();
            _appearanceTracker?.Dispose();
            _outerLayout?.Dispose();

            if (_bottomView != null)
            {
                _bottomView?.SetOnItemSelectedListener(null);
                _bottomView?.Background?.Dispose();
                _bottomView?.Dispose();
            }

            _bottomView        = null;
            _navigationArea    = null;
            _appearanceTracker = null;
            _outerLayout       = null;
        }
Ejemplo n.º 9
0
 public void Dispose()
 {
     View.Dispose();
     ContentView.Dispose();
     Buttons.Dispose();
     OpenAnimator?.Dispose();
     CloseAnimator?.Dispose();
     ShowCoords.Dispose();
 }
        public void Dispose()
        {
            if (calendar != null)
            {
                calendar.Dispose();
                calendar = null;
            }

            if (mainView != null)
            {
                mainView.Dispose();
                mainView = null;
            }

            if (culturetxt != null)
            {
                culturetxt.Dispose();
                culturetxt = null;
            }

            if (cultureSpinner != null)
            {
                cultureSpinner.Dispose();
                cultureSpinner = null;
            }

            if (layoutParams1 != null)
            {
                layoutParams1.Dispose();
                layoutParams1 = null;
            }

            if (separate != null)
            {
                separate.Dispose();
                separate = null;
            }

            if (propertylayout != null)
            {
                propertylayout.Dispose();
                propertylayout = null;
            }

            if (dataAdapter != null)
            {
                dataAdapter.Dispose();
                dataAdapter = null;
            }

            if (localinfo != null)
            {
                localinfo.Dispose();
                localinfo = null;
            }
        }
Ejemplo n.º 11
0
 public void hideBannerAds()
 {
     if (ll != null)
     {
         fl.RemoveView(ll);
         ll.RemoveView(bannerAd);
         bannerAd.Dispose();
         bannerAd = null;
         ll.Dispose();
         ll = null;
     }
 }
Ejemplo n.º 12
0
        public void LinearLayoutConstructor()
        {
            tlog.Debug(tag, $"LinearLayoutConstructor START");

            var testingTarget = new LinearLayout();

            Assert.IsNotNull(testingTarget, "null handle returned");
            Assert.IsInstanceOf <LinearLayout>(testingTarget, "Should return LinearLayout instance.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"LinearLayoutConstructor END (OK)");
        }
Ejemplo n.º 13
0
        protected override void OnElementChanged(ElementChangedEventArgs <CarouselPage> e)
        {
            base.OnElementChanged(e);

            if (viewPager != null)
            {
                if (viewPager.Adapter != null)
                {
                    viewPager.Adapter.Dispose();
                    viewPager.Adapter = null;
                }
                RemoveView(viewPager);
                viewPager.SetOnPageChangeListener(null);
                viewPager.Dispose();
            }

            if (indicator != null)
            {
                RemoveView(indicator);
                indicator.SetOnPageChangeListener(null);
                indicator.Dispose();
            }

            if (linearLayout != null)
            {
                RemoveView(linearLayout);
                linearLayout.Dispose();
            }

            RemoveAllViews();

            linearLayout = new LinearLayout(Forms.Context);
            linearLayout.SetGravity(GravityFlags.Center);
            linearLayout.Orientation      = Orientation.Vertical;
            linearLayout.LayoutParameters = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
            linearLayout.Focusable        = true;
            linearLayout.Clickable        = true;
            AddView(linearLayout);

            viewPager = new ViewPager(Context)
            {
                OffscreenPageLimit = int.MaxValue
            };

            //the following is needed to draw indicator based on the exisitng theme.
            var contextThemeWrapper = new ContextThemeWrapper(Context, Resource.Style.Theme_PageIndicatorDefaults);

            indicator = new TabCarouselPageIndicator(contextThemeWrapper, Element);

            linearLayout.AddView(indicator, new LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent));
            linearLayout.AddView(viewPager, new LinearLayout.LayoutParams(LayoutParams.MatchParent, 0, 1.0f));
        }
Ejemplo n.º 14
0
        private void UnbindViews()
        {
            tvTitle.Dispose();
            tvAlbum.Dispose();
            tvArtist.Dispose();

            btnSkipPrevious.Dispose();
            btnPlayPause.Dispose();
            btnSkipNext.Dispose();
            skbSeekSongTime.Dispose();

            maincontainer.Dispose();
        }
        public void Dispose()
        {
            if (calendar != null)
            {
                calendar.Dispose();
                calendar = null;
            }
            if (dataAdapter != null)
            {
                dataAdapter.Dispose();
                dataAdapter = null;
            }

            if (modeSpinner != null)
            {
                modeSpinner.Dispose();
                modeSpinner = null;
            }

            if (mainView != null)
            {
                mainView.Dispose();
                mainView = null;
            }

            if (separatorLayoutParams != null)
            {
                separatorLayoutParams.Dispose();
                separatorLayoutParams = null;
            }

            if (separate != null)
            {
                separate.Dispose();
                separate = null;
            }

            if (propertylayout != null)
            {
                propertylayout.Dispose();
                propertylayout = null;
            }

            if (viewModetxt != null)
            {
                viewModetxt.Dispose();
                viewModetxt = null;
            }
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Dispose the specified disposing.
 /// </summary>
 /// <returns>The dispose.</returns>
 /// <param name="disposing">If set to <c>true</c> disposing.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         _textLabel?.Dispose();
         _textLabel = null;
         _detailLabel?.Dispose();
         _detailLabel = null;
         _checkBox?.Dispose();
         _checkBox = null;
         _textContainr?.Dispose();
         _textContainr = null;
     }
     base.Dispose(disposing);
 }
Ejemplo n.º 17
0
        public void LinearLayoutCellPadding()
        {
            tlog.Debug(tag, $"LinearLayoutCellPadding START");

            var testingTarget = new LinearLayout();

            Assert.IsNotNull(testingTarget, "null handle returned");
            Assert.IsInstanceOf <LinearLayout>(testingTarget, "Should return LinearLayout instance.");

            testingTarget.CellPadding = new Size2D(6, 8);
            Assert.AreEqual(testingTarget.CellPadding.Width, 6, "Should be equal.");
            Assert.AreEqual(testingTarget.CellPadding.Height, 8, "Should be equal.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"LinearLayoutCellPadding END (OK)");
        }
Ejemplo n.º 18
0
        public void LinearLayoutLinearOrientation()
        {
            tlog.Debug(tag, $"LinearLayoutLinearOrientation START");

            var testingTarget = new LinearLayout();

            Assert.IsNotNull(testingTarget, "null handle returned");
            Assert.IsInstanceOf <LinearLayout>(testingTarget, "Should return LinearLayout instance.");

            testingTarget.LinearOrientation = LinearLayout.Orientation.Vertical;
            Assert.AreEqual(testingTarget.LinearOrientation, LinearLayout.Orientation.Vertical, "Should be Vertical.");

            testingTarget.LinearOrientation = LinearLayout.Orientation.Horizontal;
            Assert.AreEqual(testingTarget.LinearOrientation, LinearLayout.Orientation.Horizontal, "Should be Horizontal.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"LinearLayoutLinearOrientation END (OK)");
        }
Ejemplo n.º 19
0
        public void Dispose()
        {
            if (mainLayout != null)
            {
                mainLayout.Dispose();
                mainLayout = null;
            }

            if (leftmainLayout != null)
            {
                leftmainLayout.Dispose();
                leftmainLayout = null;
            }

            if (mainheaderLayout != null)
            {
                mainheaderLayout.Dispose();
                mainheaderLayout = null;
            }

            if (optionLinearlayout != null)
            {
                optionLinearlayout.Dispose();
                optionLinearlayout = null;
            }

            if (monthTextlayout != null)
            {
                monthTextlayout.Dispose();
                monthTextlayout = null;
            }

            if (plusLinearlayout != null)
            {
                plusLinearlayout.Dispose();
                plusLinearlayout = null;
            }

            if (calendarLinearlayout != null)
            {
                calendarLinearlayout.Dispose();
                calendarLinearlayout = null;
            }
        }
Ejemplo n.º 20
0
        void _fadeOut_AnimationEnd(object sender, EventArgs e)
        {
            this._Token.Cancel();
            this._Token.Dispose();
            this._Token = null;

            _Layout.Touch         -= LayoutTouched;
            _Layout.Visibility     = ViewStates.Gone;
            _fadeOut.AnimationEnd -= _fadeOut_AnimationEnd;

            _Set.Dispose();
            _Set = null;

            _fadeOut.RemoveAllListeners();
            _fadeOut.Dispose();
            _fadeOut = null;

            _Layout.Dispose();
            _Layout = null;
        }
Ejemplo n.º 21
0
        public void Dispose()
        {
            if (sfSchedule != null)
            {
                sfSchedule.Dispose();
                sfSchedule = null;
            }

            if (mainLayout != null)
            {
                mainLayout.Dispose();
                mainLayout = null;
            }

            if (borderLayout != null)
            {
                borderLayout.Dispose();
                borderLayout = null;
            }
        }
Ejemplo n.º 22
0
        public void Dispose()
        {
            if (sfSchedule != null)
            {
                sfSchedule.Dispose();
                sfSchedule = null;
            }

            if (spinner != null)
            {
                spinner.ItemSelected -= Spinner_ItemSelected;
                spinner.Dispose();
                spinner = null;
            }

            if (propertylayout != null)
            {
                propertylayout.Dispose();
                propertylayout = null;
            }
        }
Ejemplo n.º 23
0
        protected override void OnDestroy()
        {
            base.OnDestroy();
            ActivityLifecycleHelper.GetInstance().NotifyActivityStateChange(typeof(LockScreenActivity), ActivityStates.Destroyed);
            //Unbind events

            clearAll.Click -= BtnClearAll_Click;
            WallpaperPublisher.NewWallpaperIssued       -= Wallpaper_NewWallpaperIssued;
            CatcherHelper.NotificationListSizeChanged   -= CatcherHelper_NotificationListSizeChanged;
            WidgetStatusPublisher.OnWidgetStatusChanged += WidgetStatusPublisher_OnWidgetStatusChanged;
            lockscreen.Touch -= Lockscreen_Touch;

            watchDog.Stop();
            watchDog.Elapsed -= WatchdogInterval_Elapsed;
            watchDog.Dispose();
            //Dispose Views
            //Views
            recycler.Dispose();
            clearAll.Dispose();
            lockscreen.Dispose();

            viewPropertyAnimator.Dispose();
        }
Ejemplo n.º 24
0
        private void LoadElements()
        {
            if (_notificationList != null && _notificationList.Any())
            {
                _notificationListView = _view.FindViewById <ListView>(Resource.Id.notificationListView);

                var notificationAdapter = new NotificationAdapter(Activity, _notificationList);
                var newsLayout          = _view.FindViewById <LinearLayout>(Resource.Id.newsLayoutId);
                newsLayout.Visibility       = ViewStates.Visible;
                _lottieAnimation.Visibility = ViewStates.Gone;

                _notificationListView.Adapter = notificationAdapter;
                notificationAdapter.NotifyDataSetChanged();
            }
            else
            {
                _emptyState                 = _view.FindViewById <LinearLayout>(Resource.Id.empty_state);
                _emptyState.Visibility      = ViewStates.Visible;
                _lottieAnimation.Visibility = ViewStates.Gone;
            }
            _lottieAnimation.Dispose();
            GarbageCollector();
        }
Ejemplo n.º 25
0
        private void FillData()
        {
            _lottieAnimation.Visibility = ViewStates.Gone;
            _commentView.Visibility     = ViewStates.Visible;

            var enumValues     = Enum.GetValues(typeof(Common.ReportTypesEnum));
            var objectList     = ((IEnumerable)enumValues).Cast <Common.ReportTypesEnum>().ToList();
            var reportAdapters = objectList.Select(e => EnumHelper.GetDescription(e)).ToArray();

            _typeReportSpinner.Adapter = new ArrayAdapter <string>(Activity, Resource.Drawable.spinner_item, reportAdapters);
            _typeReportSpinner.SetMinimumHeight(30);

            var truckAdapters = _vehiclesList.Select(x => x.TruckName).ToArray();
            var trucklist     = truckAdapters.ToList();

            trucklist.Insert(0, "No aplica / No conozco el dato");
            truckAdapters             = trucklist.ToArray();
            _truckNameSpinner.Adapter = new TruckSpinner(Activity, Resource.Drawable.spinner_item, truckAdapters, _vehiclesList);
            _truckNameSpinner.SetMinimumHeight(30);

            if (truckID != "")
            {
                var vehicle = _vehiclesList.FirstOrDefault(x => x.Id.ToString() == truckID);
                var index   = _vehiclesList.IndexOf(vehicle);
                _truckNameSpinner.SetSelection(index);
            }
            else
            {
                _truckNameSpinner.SetSelection(0);

                _truckNameSpinner.SetSelection(trucklist.Capacity - 1);

                _truckNameSpinner.SetSelection(0);
            }
            _lottieAnimation.Dispose();
            GarbageCollector();
        }
Ejemplo n.º 26
0
        protected override void OnDestroy()
        {
            base.OnDestroy();
            OnActivityStateChanged?.Invoke(null, new LockScreenLifecycleEventArgs {
                State = ActivityStates.Destroyed
            });
            //Unbind events

            OnActivityStateChanged -= LockScreenActivity_OnActivityStateChanged;
            //unlocker.Touch -= Unlocker_Touch;
            clearAll.Click -= BtnClearAll_Click;
            WallpaperPublisher.NewWallpaperIssued     -= Wallpaper_NewWallpaperIssued;
            CatcherHelper.NotificationListSizeChanged -= CatcherHelper_NotificationListSizeChanged;
            lockscreen.Touch -= Lockscreen_Touch;

            watchDog.Stop();
            watchDog.Elapsed -= WatchdogInterval_Elapsed;
            watchDog.Dispose();
            //Dispose Views
            //Views
            recycler.Dispose();
            //unlocker.Dispose();
            clearAll.Dispose();
            lockscreen.Dispose();
            //wallpaperView.Background?.Dispose();
            //wallpaperView = null;

            viewPropertyAnimator.Dispose();

            //Dispose Fragments
            notificationFragment.Dispose();
            musicFragment.Dispose();
            clockFragment.Dispose();
            weatherFragment.Dispose();
            livedisplayinfo?.Dispose();
        }
Ejemplo n.º 27
0
        protected virtual void LoadView(SearchHandler searchHandler)
        {
            var query       = searchHandler.Query;
            var placeholder = searchHandler.Placeholder;

            LP  lp;
            var context = Context;

            _cardView = new CardView(context);
            using (lp = new LayoutParams(LP.MatchParent, LP.MatchParent))
                _cardView.LayoutParameters = lp;


            var linearLayout = new LinearLayout(context);

            using (lp = new LP(LP.MatchParent, LP.MatchParent))
                linearLayout.LayoutParameters = lp;
            linearLayout.Orientation = Orientation.Horizontal;

            _cardView.AddView(linearLayout);

            int padding = (int)context.ToPixels(8);

            _searchButton = CreateImageButton(context, searchHandler, SearchHandler.QueryIconProperty, Resource.Drawable.abc_ic_search_api_material, padding, 0);

            lp = new LinearLayout.LayoutParams(0, LP.MatchParent)
            {
                Gravity = GravityFlags.Fill,
                Weight  = 1
            };
            _textBlock = new AppCompatAutoCompleteTextView(context)
            {
                LayoutParameters = lp,
                Text             = query,
                Hint             = placeholder,
                ImeOptions       = ImeAction.Done
            };
            lp.Dispose();
            _textBlock.Enabled = searchHandler.IsSearchEnabled;
            _textBlock.SetBackground(null);
            _textBlock.SetPadding(padding, 0, padding, 0);
            _textBlock.SetSingleLine(true);
            _textBlock.Threshold  = 1;
            _textBlock.Adapter    = new ShellSearchViewAdapter(SearchHandler, _shellContext);
            _textBlock.ItemClick += OnTextBlockItemClicked;
            _textBlock.SetDropDownBackgroundDrawable(new ClipDrawableWrapper(_textBlock.DropDownBackground));

            // A note on accessibility. The _textBlocks hint is what android defaults to reading in the screen
            // reader. Therefor we do not need to set something else.

            _clearButton            = CreateImageButton(context, searchHandler, SearchHandler.ClearIconProperty, Resource.Drawable.abc_ic_clear_material, 0, padding);
            _clearPlaceholderButton = CreateImageButton(context, searchHandler, SearchHandler.ClearPlaceholderIconProperty, -1, 0, padding);

            linearLayout.AddView(_searchButton);
            linearLayout.AddView(_textBlock);
            linearLayout.AddView(_clearButton);
            linearLayout.AddView(_clearPlaceholderButton);

            UpdateClearButtonState();

            // hook all events down here to avoid getting events while doing setup
            searchHandler.PropertyChanged += OnSearchHandlerPropertyChanged;
            _textBlock.AddTextChangedListener(this);
            _textBlock.SetOnEditorActionListener(this);
            _clearButton.Click            += OnClearButtonClicked;
            _clearPlaceholderButton.Click += OnClearPlaceholderButtonClicked;
            _searchButton.Click           += OnSearchButtonClicked;

            AddView(_cardView);

            linearLayout.Dispose();
        }
Ejemplo n.º 28
0
        protected virtual BottomSheetDialog CreateMoreBottomSheet(Action <int, BottomSheetDialog> selectCallback)
        {
            var bottomSheetDialog = new BottomSheetDialog(Context);
            var bottomSheetLayout = new LinearLayout(Context);

            using (var bottomShellLP = new LP(LP.MatchParent, LP.WrapContent))
                bottomSheetLayout.LayoutParameters = bottomShellLP;
            bottomSheetLayout.Orientation = Orientation.Vertical;

            // handle the more tab
            for (int i = _bottomView.MaxItemCount - 1; i < ShellItem.Items.Count; i++)
            {
                var closure_i    = i;
                var shellContent = ShellItem.Items[i];

                using (var innerLayout = new LinearLayout(Context))
                {
                    innerLayout.SetClipToOutline(true);
                    innerLayout.SetBackground(CreateItemBackgroundDrawable());
                    innerLayout.SetPadding(0, (int)Context.ToPixels(6), 0, (int)Context.ToPixels(6));
                    innerLayout.Orientation = Orientation.Horizontal;
                    using (var param = new LP(LP.MatchParent, LP.WrapContent))
                        innerLayout.LayoutParameters = param;

                    // technically the unhook isn't needed
                    // we dont even unhook the events that dont fire
                    void clickCallback(object s, EventArgs e)
                    {
                        selectCallback(closure_i, bottomSheetDialog);
                        if (!innerLayout.IsDisposed())
                        {
                            innerLayout.Click -= clickCallback;
                        }
                    }

                    innerLayout.Click += clickCallback;

                    var image = new ImageView(Context);
                    var lp    = new LinearLayout.LayoutParams((int)Context.ToPixels(32), (int)Context.ToPixels(32))
                    {
                        LeftMargin   = (int)Context.ToPixels(20),
                        RightMargin  = (int)Context.ToPixels(20),
                        TopMargin    = (int)Context.ToPixels(6),
                        BottomMargin = (int)Context.ToPixels(6),
                        Gravity      = GravityFlags.Center
                    };
                    image.LayoutParameters = lp;
                    lp.Dispose();

                    image.ImageTintList = ColorStateList.ValueOf(Color.Black.MultiplyAlpha(0.6).ToAndroid());
                    ShellContext.ApplyDrawableAsync(shellContent, ShellSection.IconProperty, icon =>
                    {
                        if (!image.IsDisposed())
                        {
                            image.SetImageDrawable(icon);
                        }
                    });

                    innerLayout.AddView(image);

                    using (var text = new TextView(Context))
                    {
                        text.Typeface = "sans-serif-medium".ToTypeFace();
                        text.SetTextColor(AColor.Black);
                        text.Text = shellContent.Title;
                        lp        = new LinearLayout.LayoutParams(0, LP.WrapContent)
                        {
                            Gravity = GravityFlags.Center,
                            Weight  = 1
                        };
                        text.LayoutParameters = lp;
                        lp.Dispose();

                        innerLayout.AddView(text);
                    }

                    bottomSheetLayout.AddView(innerLayout);
                }
            }

            bottomSheetDialog.SetContentView(bottomSheetLayout);
            bottomSheetLayout.Dispose();

            return(bottomSheetDialog);
        }
Ejemplo n.º 29
0
        public void Dispose()
        {
            if (sfschedule != null)
            {
                sfschedule.Dispose();
                sfschedule = null;
            }

            if (propertylayout != null)
            {
                propertylayout.Dispose();
                propertylayout = null;
            }

            if (monthViewLayout != null)
            {
                monthViewLayout.Dispose();
                monthViewLayout = null;
            }

            if (otherviewsLayout != null)
            {
                otherviewsLayout.Dispose();
                otherviewsLayout = null;
            }

            if (workHourRangeSlider != null)
            {
                workHourRangeSlider.RangeChanged -= WorkHour_rangeSlider_RangeChanged;
                workHourRangeSlider.Dispose();
                workHourRangeSlider = null;
            }

            if (showWeekNumber != null)
            {
                showWeekNumber.CheckedChange -= Show_week_number_CheckedChange;
                showWeekNumber.Dispose();
                showWeekNumber = null;
            }

            if (workingHoursTxtBlock != null)
            {
                workingHoursTxtBlock.Dispose();
                workingHoursTxtBlock = null;
            }

            if (showNonAccessibleBlockcheckBox != null)
            {
                showNonAccessibleBlockcheckBox.CheckedChange -= Show_Non_Accessible_Block_checkBox_CheckedChange;
                showNonAccessibleBlockcheckBox.Dispose();
                showNonAccessibleBlockcheckBox = null;
            }

            if (showBlackoutDates != null)
            {
                showBlackoutDates.CheckedChange -= Show_Blackout_Dates_CheckedChange;
                showBlackoutDates.Dispose();
                showBlackoutDates = null;
            }

            if (monthViewLayout != null)
            {
                monthViewLayout.Dispose();
                monthViewLayout = null;
            }
        }
Ejemplo n.º 30
0
        public void Dispose()
        {
            if (calendar != null)
            {
                calendar.DrawMonthCell -= Calendar_DrawMonthCell;
                calendar.Dispose();
                calendar = null;
            }

            if (viewModetxt != null)
            {
                viewModetxt.Dispose();
                viewModetxt = null;
            }

            if (modeSpinner != null)
            {
                modeSpinner.Dispose();
                modeSpinner = null;
            }

            if (spaceAdder1 != null)
            {
                spaceAdder1.Dispose();
                spaceAdder1 = null;
            }

            if (spaceAdder2 != null)
            {
                spaceAdder2.Dispose();
                spaceAdder2 = null;
            }

            if (minDate != null)
            {
                minDate.Dispose();
                minDate = null;
            }

            if (maxDate != null)
            {
                maxDate.Dispose();
                maxDate = null;
            }

            if (minPick != null)
            {
                minPick.Dispose();
                minPick = null;
            }

            if (maxPick != null)
            {
                maxPick.Dispose();
                maxPick = null;
            }

            if (minDateButton != null)
            {
                minDateButton.Dispose();
                minDateButton = null;
            }

            if (maxDateButton != null)
            {
                maxDateButton.Dispose();
                maxDateButton = null;
            }

            if (mainView != null)
            {
                mainView.Dispose();
                mainView = null;
            }

            if (propertylayout != null)
            {
                propertylayout.Dispose();
                propertylayout = null;
            }

            if (minDatePicker != null)
            {
                minDatePicker.Dispose();
                minDatePicker = null;
            }

            if (maxDatePicker != null)
            {
                maxDatePicker.Dispose();
                maxDatePicker = null;
            }

            if (underMaxSeparatorLayoutParam != null)
            {
                underMaxSeparatorLayoutParam.Dispose();
                underMaxSeparatorLayoutParam = null;
            }

            if (minMaxSeparatorLayoutParam != null)
            {
                minMaxSeparatorLayoutParam.Dispose();
                minMaxSeparatorLayoutParam = null;
            }

            if (dataAdapter != null)
            {
                dataAdapter.Dispose();
                dataAdapter = null;
            }

            if (underMaxSeparator != null)
            {
                underMaxSeparator.Dispose();
                underMaxSeparator = null;
            }

            if (minMaxSeparator != null)
            {
                minMaxSeparator.Dispose();
                minMaxSeparator = null;
            }
        }