private void InitComponent(View view)
        {
            try
            {
                CollapsingToolbar       = view.FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsingToolbar);
                CollapsingToolbar.Title = "";

                IconBack    = view.FindViewById <TextView>(Resource.Id.back_btn);
                TxtUserName = view.FindViewById <TextView>(Resource.Id.username);
                BtnMore     = view.FindViewById <TextView>(Resource.Id.more_btn);

                ImageUser   = view.FindViewById <ImageView>(Resource.Id.user_image);
                TxtFullName = view.FindViewById <TextView>(Resource.Id.fullname);

                FollowingLayout   = view.FindViewById <LinearLayout>(Resource.Id.following_layout);
                TxtFollowingCount = view.FindViewById <TextView>(Resource.Id.following_count_txt);

                FollowersLayout   = view.FindViewById <LinearLayout>(Resource.Id.followers_layout);
                TxtFollowersCount = view.FindViewById <TextView>(Resource.Id.followers_count_txt);

                PostLayout   = view.FindViewById <LinearLayout>(Resource.Id.post_layout);
                TxtPostCount = view.FindViewById <TextView>(Resource.Id.post_count_txt);

                BtnMessage   = view.FindViewById <TextView>(Resource.Id.message_btn);
                FollowButton = view.FindViewById <Button>(Resource.Id.add_btn);

                ViewPager = view.FindViewById <ViewPager>(Resource.Id.pager);
                TabLayout = view.FindViewById <TabLayout>(Resource.Id.tabs);

                TxtFollowingCount.Text = "0";
                TxtFollowersCount.Text = "0";
                TxtPostCount.Text      = "0";

                ViewPager.OffscreenPageLimit = 2;
                SetUpViewPager(ViewPager);
                TabLayout.SetupWithViewPager(ViewPager);

                TabLayout.GetTabAt(0).SetIcon(Resource.Drawable.ic_tab_more);
                TabLayout.GetTabAt(1).SetIcon(Resource.Drawable.ic_tab_user_profile);

                // set icon color pre-selected
                TabLayout.GetTabAt(0).Icon.SetColorFilter(new PorterDuffColorFilter(AppSettings.SetTabDarkTheme ? Color.White : Color.Gray, PorterDuff.Mode.SrcIn));
                TabLayout.GetTabAt(1).Icon.SetColorFilter(new PorterDuffColorFilter(AppSettings.SetTabDarkTheme ? Color.White : Color.Gray, PorterDuff.Mode.SrcIn));

                TabLayout.GetTabAt(0).Icon.SetColorFilter(new PorterDuffColorFilter(Color.ParseColor(AppSettings.MainColor), PorterDuff.Mode.SrcIn));

                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, IconBack, IonIconsFonts.AndroidArrowBack);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, BtnMore, IonIconsFonts.AndroidMoreVertical);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, BtnMessage, FontAwesomeIcon.PaperPlane);

                TxtUserName.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                BtnMore.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                TxtFullName.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);

                if (AppSettings.FlowDirectionRightToLeft)
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, IconBack, IonIconsFonts.AndroidArrowForward);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#2
0
        protected override void RegisterUIEvent()
        {
            UITopStatus.BtnClose.OnClickAsObservable().Subscribe(_ =>
            {
                CloseSelf();
            });

            #region ItemPanel
            BtnSell.OnClickAsObservable().Subscribe(_ =>
            {
                if (mData.item.Capacity > 1)
                {
                    ItemPanel.Hide();
                    SellConfirmPanel.Hide();
                    SelectNumPanel.Show();
                }
                else
                {
                    ItemPanel.Hide();
                    SelectNumPanel.Hide();
                    SellConfirmPanel.Show();
                    TxtDesc.text = "确认售出道具,获得 " + mData.item.SellPrice.ToString() + " 金币吗?";
                }
            });
            #endregion

            #region SelectNumPanel
            BtnSelectCancel.OnClickAsObservable().Subscribe(_ =>
            {
                ItemPanel.Show();
                SelectNumPanel.Hide();
                SellConfirmPanel.Hide();
            });
            BtnLess.OnClickAsObservable().Subscribe(_ =>
            {
                if (SelectNum > 1)
                {
                    SelectNum = SelectNum - 1;
                }
                ShowSelectTxt();
            });
            BtnMore.OnClickAsObservable().Subscribe(_ =>
            {
                if (SelectNum < mData.Amount)
                {
                    SelectNum = SelectNum + 1;
                }
                ShowSelectTxt();
            });
            BtnMin.OnClickAsObservable().Subscribe(_ =>
            {
                SelectNum = 1;
                ShowSelectTxt();
            });
            BtnMax.OnClickAsObservable().Subscribe(_ =>
            {
                SelectNum = mData.Amount;
                ShowSelectTxt();
            });
            BtnSelectSell.OnClickAsObservable().Subscribe(_ =>
            {
                SellDone();
            });
            #endregion

            #region SellConfirmPanel
            BtnConfirmCancel.OnClickAsObservable().Subscribe(_ =>
            {
                ItemPanel.Show();
                SelectNumPanel.Hide();
                SellConfirmPanel.Hide();
            });
            BtnConfirmOK.OnClickAsObservable().Subscribe(_ =>
            {
                SellDone();
            });
            #endregion
        }