Exemplo n.º 1
0
        private void SetupHeardCheckbox()
        {
            var checkBoxHeard = _view.FindViewById <CheckBox>(Resource.Id.checkboxheard);

            checkBoxHeard.Click += (sender, args) =>
            {
                HeardClicked?.Invoke(this, EventArgs.Empty);
            };
        }
Exemplo n.º 2
0
        private void SetupListView()
        {
            _listView = _view.FindViewById <ListView>(Resource.Id.listViewAudioDramas);

            _listViewAdapter = new AudioDramaListAdapter(Activity, _imageViewFiller, _releaseDateService);

            _listView.ItemClick += (sender, args) =>
            {
                var audioDrama = _listViewAdapter[args.Position];
                AudioDramaClicked?.Invoke(this, audioDrama.AudioDramaDto.Id);
            };

            var swipeActionAdapter = new SwipeActionAdapter(_listViewAdapter);

            swipeActionAdapter.SetListView(_listView);

            _listView.Adapter = swipeActionAdapter;

            swipeActionAdapter
            .AddBackground(SwipeDirection.DirectionFarLeft, Resource.Layout.swipebackgroundleft)
            .AddBackground(SwipeDirection.DirectionFarRight, Resource.Layout.swipebackgroundright)
            .AddBackground(SwipeDirection.DirectionNormalLeft, Resource.Layout.swipebackgroundleft)
            .AddBackground(SwipeDirection.DirectionNormalRight, Resource.Layout.swipebackgroundright);

            _swipeActionListener = new SwipeActionListener();

            _swipeActionListener.LeftSwiped += (sender, i) =>
            {
                try
                {
                    var audioDrama = _listViewAdapter[i];
                    HeardClicked?.Invoke(this, audioDrama.AudioDramaDto.Id);
                }
                catch (ArgumentOutOfRangeException)
                {
                    _userNotifier.Notify("Fehler beim Markieren als gehört. Bitte erneut versuchen.");
                }
            };

            _swipeActionListener.RightSwiped += (sender, i) =>
            {
                try
                {
                    var audioDrama = _listViewAdapter[i];
                    IsFavoriteClicked?.Invoke(this, audioDrama.AudioDramaDto.Id);
                }
                catch (ArgumentOutOfRangeException)
                {
                    _userNotifier.Notify("Fehler beim Markieren als Favorit. Bitte erneut versuchen.");
                }
            };


            swipeActionAdapter.SetSwipeActionListener(_swipeActionListener);
        }