Esempio n. 1
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);

            _navigationBarView = view.FindViewById <NavigationBarView>(Resource.Id.fragment_chats_navigation_bar);

            if (StyleHelper.Style.UseLogoInsteadOfConnectionStatus)
            {
                _navigationBarView.SetCenterImage(StyleHelper.Style.LogoIcon, null);
            }

            _createChatFloatButton = view.FindViewById <FloatingActionButton>(Resource.Id.fab_create_chat);
            _chatsRecyclerView     = view.FindViewById <RecyclerView>(Resource.Id.rv_chats_list);

            InitializeRecyclerView();

            _createChatFloatButton.SetCommand(nameof(_createChatFloatButton.Click), ViewModel.CreateChatCommand);

            _swipeLeaveActionViewOptions = new SimpleSwipeActionView.Options
            {
                Width           = Activity.ToPixels(80),
                TextSize        = Activity.ToPixels(14),
                BackgroundColor = Color.Red
            };
            _swipeCloseActionViewOptions = new SimpleSwipeActionView.Options
            {
                Width           = Activity.ToPixels(80),
                TextSize        = Activity.ToPixels(14),
                BackgroundColor = Color.Orange
            };
        }
Esempio n. 2
0
        private void ConfigureSwipeForViewHolder(RecyclerView.ViewHolder viewHolder, int position,
                                                 ICollection <SwipeCallback.ISwipeActionView> actions)
        {
            var member = ViewModel.Members[position];

            if (!member.IsRemovable)
            {
                return;
            }

            var swipeLeaveActionViewOptions = new SimpleSwipeActionView.Options
            {
                Width           = this.ToPixels(80),
                TextSize        = this.ToPixels(14),
                BackgroundColor = Color.Red
            };

            actions.Add(new SimpleSwipeActionView(ViewModel.LocalizedStrings.Remove,
                                                  swipeLeaveActionViewOptions,
                                                  pos =>
            {
                ViewModel.RemoveMemberCommand.Execute(ViewModel.Members[pos]);
            }));
        }