public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // create a timer that can be used to autohide this toolbar. NavBarTimer = new System.Timers.Timer(); NavBarTimer.AutoReset = false; NavBarTimer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e) => { // when the timer fires, hide the toolbar. // Although the timer fires on a seperate thread, because we queue the reveal // on the main (UI) thread, we don't have to worry about race conditions. Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { InternalReveal(false); }); }; ButtonLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); ButtonLayout.BaselineAligned = false; // set the nav subBar color (including opacity) Color navColor = Rock.Mobile.UI.Util.GetUIColor(PrivateSubNavToolbarConfig.BackgroundColor); navColor.A = (Byte)((float)navColor.A * PrivateSubNavToolbarConfig.Opacity); ButtonLayout.SetBackgroundColor(navColor); ButtonLayout.LayoutParameters.Height = (int)Rock.Mobile.Graphics.Util.UnitToPx(50.0f); uint disabledColor = Rock.Mobile.Graphics.Util.ScaleRGBAColor(ControlStylingConfig.TextField_PlaceholderTextColor, 4, false); // create the back button BackButton.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); ((LinearLayout.LayoutParams)BackButton.LayoutParameters).Gravity = GravityFlags.Top; // set the back button's font Typeface fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(PrivateControlStylingConfig.Icon_Font_Secondary); BackButton.SetTypeface(fontFace, TypefaceStyle.Normal); BackButton.SetTextSize(Android.Util.ComplexUnitType.Dip, PrivateSubNavToolbarConfig.BackButton_Size); BackButton.Text = PrivateSubNavToolbarConfig.BackButton_Text; BackButton.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(0)); BackButton.SetPadding(0, 0, 0, 0); BackButton.Click += delegate { Activity.OnBackPressed(); }; // default to NOT enabled BackButton.Enabled = false; // use the completely overcomplicated color states to set the normal vs pressed color state. int [][] states = new int[][] { new int[] { Android.Resource.Attribute.StatePressed }, new int[] { Android.Resource.Attribute.StateEnabled }, new int[] { -Android.Resource.Attribute.StateEnabled }, }; int [] colors = new int[] { Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor), Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor), Rock.Mobile.UI.Util.GetUIColor(disabledColor), }; BackButton.SetTextColor(new Android.Content.Res.ColorStateList(states, colors)); // create the share button ShareButton.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); ((LinearLayout.LayoutParams)ShareButton.LayoutParameters).Gravity = GravityFlags.Top; // set the share button's font fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(PrivateControlStylingConfig.Icon_Font_Secondary); ShareButton.SetTypeface(fontFace, TypefaceStyle.Normal); ShareButton.SetTextSize(Android.Util.ComplexUnitType.Dip, PrivateSubNavToolbarConfig.ShareButton_Size); ShareButton.SetPadding(0, 0, 0, 0); ShareButton.Text = PrivateSubNavToolbarConfig.ShareButton_Text; ShareButton.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(0)); // default to NOT enabled ShareButton.Enabled = false; // use the completely overcomplicated color states to set the normal vs pressed color state. states = new int[][] { new int[] { Android.Resource.Attribute.StatePressed }, new int[] { Android.Resource.Attribute.StateEnabled }, new int[] { -Android.Resource.Attribute.StateEnabled }, }; colors = new int[] { Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor), Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor), Rock.Mobile.UI.Util.GetUIColor(disabledColor), }; ShareButton.SetTextColor(new Android.Content.Res.ColorStateList(states, colors)); // create the "create" button CreateButton.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); ((LinearLayout.LayoutParams)CreateButton.LayoutParameters).Gravity = GravityFlags.Top; // set the create button's font fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(PrivateControlStylingConfig.Icon_Font_Secondary); CreateButton.SetTypeface(fontFace, TypefaceStyle.Normal); CreateButton.SetTextSize(Android.Util.ComplexUnitType.Dip, PrivateSubNavToolbarConfig.CreateButton_Size); CreateButton.SetPadding(0, 0, 0, 0); CreateButton.Text = PrivateSubNavToolbarConfig.CreateButton_Text; CreateButton.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(0)); // default to NOT enabled CreateButton.Enabled = false; // use the completely overcomplicated color states to set the normal vs pressed color state. states = new int[][] { new int[] { Android.Resource.Attribute.StatePressed }, new int[] { Android.Resource.Attribute.StateEnabled }, new int[] { -Android.Resource.Attribute.StateEnabled }, }; colors = new int[] { Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor), Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor), Rock.Mobile.UI.Util.GetUIColor(disabledColor), }; CreateButton.SetTextColor(new Android.Content.Res.ColorStateList(states, colors)); // default its position to hidden Revealed = false; ButtonLayout.SetY((int)Rock.Mobile.Graphics.Util.UnitToPx(50.0f)); return(ButtonLayout); }