protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Intent.PrintExtras();

            SupportActionBar.SetDisplayShowTitleEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.Title = ViewModel.Title;

            SetupToolbar();
            SetupRecyclerView();

            // Scroll to bottom message
            _newMessageToken = Mvx.Resolve <IMvxMessenger>().SubscribeOnMainThread <ChatConversationAddMessage>(
                message =>
            {
                _recyclerView.ScrollToPosition(ViewModel.Messages.Count - 1);
            });
        }
예제 #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            _recyclerView = FindViewById <MvxRecyclerView>(Resource.Id.details_recycler_view);

            if (_recyclerView != null)
            {
                _recyclerView.AddOnLayoutChangeListener(this);

                _recyclerView.Adapter = new DetailsAdapter((IMvxAndroidBindingContext)BindingContext);
            }

            _mvxSubscriptionToken = Mvx.Resolve <IMvxMessenger>().SubscribeOnMainThread <NewCommentMessage>(message =>
            {
                var detailAdapter = _recyclerView.Adapter as DetailsAdapter;

                if (ViewModel.Items.Count > 1)
                {
                    detailAdapter?.NotifyItemChanged(ViewModel.Items.Count - 1);
                }

                _recyclerView.ScrollToPosition(ViewModel.Items.Count - 1);
            });

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            // Check comment role
            if (Settings.UserRoles.All(r => r != Home.Feed.Comment.ToLower()))
            {
                var inputContainer = FindViewById <LinearLayout>(Resource.Id.details_input_container);

                if (inputContainer != null)
                {
                    var layoutParams = inputContainer.LayoutParameters;
                    layoutParams.Height             = 0;
                    inputContainer.LayoutParameters = layoutParams;
                }
            }
        }
예제 #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetupRecyclerView();

            // Scroll to bottom
            ViewModel.Commented = () => { _recyclerView.ScrollToPosition(ViewModel.Items.Count - 1); };

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            if (Settings.UserRoles.All(r => r != Event.EventComment))
            {
                var inputBox = FindViewById <LinearLayout>(Resource.Id.event_input_container);

                if (inputBox != null)
                {
                    var layoutParams = inputBox.LayoutParameters;
                    layoutParams.Height       = 0;
                    inputBox.LayoutParameters = layoutParams;
                }
            }
        }