コード例 #1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup c, Bundle b)
        {
            try
            {
                var layout = inflater.Inflate(Resource.Layout.layout_remote, c, false);
                Inject(layout);

                prefsMain = new Preferences();

                int lastTab = prefsMain.spMain.GetInt(PREF_FRAG_REM_LAST, 1);
                ViewHelper.AddTabLayoutTab(tlMain, "Player", lastTab == 0);
                ViewHelper.AddTabLayoutTab(tlMain, "Receiver", lastTab == 1);
                ViewHelper.AddTabLayoutTab(tlMain, "TV", lastTab == 2);

                tlMain.TabSelected += delegate
                {
                    prefsMain.PutInt(PREF_FRAG_REM_LAST, tlMain.SelectedTabPosition);
                    int lastState = BottomSheetBehavior.StateCollapsed;
                    if (bsbMain.State == BottomSheetBehavior.StateCollapsed ||
                        bsbMain.State == BottomSheetBehavior.StateExpanded)
                    {
                        lastState = bsbMain.State;
                    }
                    bsbMain.Hideable = true;
                    bsbMain.State    = BottomSheetBehavior.StateHidden;

                    RefreshButtons();


                    nvSheet.Post(delegate
                    {
                        try
                        {
                            bsbMain.State    = lastState;
                            bsbMain.Hideable = false;
                        }
                        catch (Exception e)
                        {
                            Toast.MakeText(Activity, $"UI Error: {e.Message}", ToastLength.Short).Show();
                        }
                    });
                };
                gt = new ViewHelper.GestureDetector(flGesture, Application.Context);
                gt.OnGestureEvent += delegate(int id)
                {
                    string cmd = GetCurCmd();
                    switch (id)
                    {
                    case 1:
                        cmd += CmdHelper.Menu.UP;
                        break;

                    case 2:
                        cmd += CmdHelper.Menu.LEFT;
                        break;

                    case 3:
                        cmd += CmdHelper.Menu.DOWN;
                        break;

                    case 4:
                        cmd += CmdHelper.Menu.RIGHT;
                        break;

                    case 5:
                        cmd += CmdHelper.Menu.ENTER;
                        break;
                    }
                    DeviceService.SendCommand($"{cmd}");
                };

                bsbMain = BottomSheetBehavior.From(nvSheet);
                var bsc = new ViewHelper.BrinBottomSheetCallBack();
                bsbMain.SetBottomSheetCallback(bsc);

                nvSheet.PostDelayed(delegate
                {
                    try
                    {
                        bsbMain.Hideable = true;
                        bsbMain.State    = BottomSheetBehavior.StateHidden;
                        bsbMain.State    = BottomSheetBehavior.StateCollapsed;
                        bsbMain.Hideable = false;
                    }
                    catch (Exception e)
                    {
                    }
                }, 1000);


                RefreshButtons();

                LayoutTransition transition = new LayoutTransition();
                transition.SetAnimateParentHierarchy(false);
                //llRemHolder.LayoutTransition = transition;

                OpenBroadcast();
                return(layout);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
コード例 #2
0
        public override void Show()
        {
            using (var dialogView = (LinearLayout)LayoutInflater.From(Context).Inflate(Resource.Layout.lyt_claim_rewards, null))
            {
                dialogView.SetMinimumWidth((int)(Style.ScreenWidth * 0.8));

                _title          = dialogView.FindViewById <TextView>(Resource.Id.title);
                _title.Typeface = Style.Light;
                _title.Text     = AppSettings.LocalizationManager.GetText(LocalizationKeys.TimeToClaimRewards);

                var tokenOne = dialogView.FindViewById <TextView>(Resource.Id.token_one);
                tokenOne.Typeface = Style.Semibold;

                var tokenTwo = dialogView.FindViewById <TextView>(Resource.Id.token_two);
                tokenTwo.Typeface = Style.Semibold;

                var tokenThree = dialogView.FindViewById <TextView>(Resource.Id.token_three);
                tokenThree.Typeface = Style.Semibold;

                var tokenOneValue = dialogView.FindViewById <TextView>(Resource.Id.token_one_value);
                tokenOneValue.Typeface = Style.Semibold;
                tokenOneValue.Text     = _balance.RewardSteem.ToBalanceValueString();

                var tokenTwoValue = dialogView.FindViewById <TextView>(Resource.Id.token_two_value);
                tokenTwoValue.Typeface = Style.Semibold;
                tokenTwoValue.Text     = _balance.RewardSp.ToBalanceValueString();

                var tokenThreeValue = dialogView.FindViewById <TextView>(Resource.Id.token_three_value);
                tokenThreeValue.Typeface = Style.Semibold;
                tokenThreeValue.Text     = _balance.RewardSbd.ToBalanceValueString();

                switch (_balance.UserInfo.Chain)
                {
                case KnownChains.Steem:
                    tokenOne.Text   = CurrencyType.Steem.ToString().ToUpper();
                    tokenTwo.Text   = $"{CurrencyType.Steem.ToString()} Power".ToUpper();
                    tokenThree.Text = CurrencyType.Sbd.ToString().ToUpper();
                    break;

                case KnownChains.Golos:
                    tokenOne.Text   = CurrencyType.Golos.ToString().ToUpper();
                    tokenTwo.Text   = $"{CurrencyType.Golos.ToString()} Power".ToUpper();
                    tokenThree.Text = CurrencyType.Gbg.ToString().ToUpper();
                    break;
                }

                _claimBtnContainer = dialogView.FindViewById <RelativeLayout>(Resource.Id.claimBtnContainer);

                _claimBtn        = dialogView.FindViewById <Button>(Resource.Id.claimBtn);
                _claimBtn.Text   = AppSettings.LocalizationManager.GetText(LocalizationKeys.ClaimRewards);
                _claimBtn.Click += ClaimBtnOnClick;

                var closeBtn = dialogView.FindViewById <Button>(Resource.Id.close);
                closeBtn.Text   = AppSettings.LocalizationManager.GetText(LocalizationKeys.Close);
                closeBtn.Click += CloseBtnOnClick;

                _claimSpinner = dialogView.FindViewById <ProgressBar>(Resource.Id.claim_spinner);

                LayoutTransition transition = new LayoutTransition();
                transition.SetAnimateParentHierarchy(false);
                dialogView.LayoutTransition = transition;

                SetContentView(dialogView);
                Window.FindViewById(Resource.Id.design_bottom_sheet).SetBackgroundColor(Color.Transparent);
                var dialogPadding = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 10, Context.Resources.DisplayMetrics);
                Window.DecorView.SetPadding(dialogPadding, dialogPadding, dialogPadding, dialogPadding);
                base.Show();

                var bottomSheet = FindViewById <FrameLayout>(Resource.Id.design_bottom_sheet);
                BottomSheetBehavior.From(bottomSheet).State = BottomSheetBehavior.StateExpanded;
            }
        }