예제 #1
0
        private async void ProfilePageGeneralTabActionButtonOnClick()
        {
            var str = await TextInputDialogBuilder.BuildInputTextDialog(Context, "Find user", "username...", "Go");

            if (!string.IsNullOrEmpty(str))
            {
                ViewModel.NavigateProfileCommand.Execute(new MalUser {
                    Name = str
                });
            }
        }
        protected override void InitBindings()
        {
            ForumBoardPageIcon.Typeface = FontManager.GetTypeface(Activity, FontManager.TypefacePath);

            Bindings.Add(
                this.SetBinding(() => ViewModel.LoadingTopics,
                                () => ForumBoardPageLoadingSpinner.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));

            Bindings.Add(
                this.SetBinding(() => ViewModel.Title,
                                () => ForumBoardPageTitle.Text));

            Bindings.Add(this.SetBinding(() => ViewModel.Icon).WhenSourceChanges(() =>
            {
                ForumBoardPageIcon.SetText(DummyFontAwesomeToRealFontAwesomeConverter.Convert(ViewModel.Icon));
            }));

            Bindings.Add(
                this.SetBinding(() => ViewModel.SearchButtonVisibility,
                                () => ForumBoardPageSearchButton.Visibility)
                .ConvertSourceToTarget(Converters.BoolToVisibility));

            Bindings.Add(
                this.SetBinding(() => ViewModel.NewTopicButtonVisibility,
                                () => ForumBoardPageActionButton.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));

            ForumBoardPageActionButton.Click += (sender, args) => ViewModel.CreateNewTopicCommand.Execute(null);


            Bindings.Add(this.SetBinding(() => ViewModel.Topics).WhenSourceChanges(() =>
            {
                ForumBoardPagePostsList.Adapter = ViewModel.Topics.GetAdapter(GetTopicTemplateDelegate);
            }));

            Bindings.Add(
                this.SetBinding(() => ViewModel.EmptyNoticeVisibility,
                                () => ForumBoardPageEmptyNotice.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));

            ForumBoardPageSearchButton.Click += async(sender, args) =>
            {
                var str = await TextInputDialogBuilder.BuildInputTextDialog(Context, "Search", "keyword...", "Go");

                if (!string.IsNullOrEmpty(str))
                {
                    ViewModel.SearchQuery = str;
                    ViewModel.SearchCommand.Execute(null);
                }
            };

            ForumBoardPageGotoPageButton.SetOnClickListener(new OnClickListener(OnGotoPageButtonClick));

            Bindings.Add(this.SetBinding(() => ViewModel.AvailablePages).WhenSourceChanges(UpdatePageSelection));
        }
예제 #3
0
        private async void SetListSource()
        {
            var src = await TextInputDialogBuilder.BuildInputTextDialog(Activity, "List source", "username...", "Go!", true);

            if (string.IsNullOrWhiteSpace(src))
            {
                return;
            }
            if (src.Length > 2)
            {
                ViewModel.ListSource = src;
                await ViewModel.FetchData();
            }
            else
            {
                ResourceLocator.SnackbarProvider.ShowText("Invalid username");
            }
        }