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; } }