This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override void OnViewAdded(Android.Views.View child) | |
{ | |
base.OnViewAdded(child); | |
if (child.GetType() == typeof(Android.Support.V7.Widget.Toolbar)) | |
{ | |
var lastPage = Element?.Navigation?.NavigationStack?.Last(); | |
_toolbar = (Android.Support.V7.Widget.Toolbar)child; | |
_originalToolbarBackground = _toolbar.Background; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void SetupPageTransition(Android.Support.V4.App.FragmentTransaction transaction, bool isPush) | |
{ | |
Page lastPage = null; | |
if (isPush) | |
{ | |
if (Element?.Navigation?.NavigationStack?.Count() >= 2) | |
{ | |
var previousPage = Element?.Navigation?.NavigationStack[Element.Navigation.NavigationStack.Count() - 2]; | |
previousPage.PropertyChanged -= LastPage_PropertyChanged; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void OnToolbarChildViewAdded(object sender, ChildViewAddedEventArgs e) | |
{ | |
var view = e.Child.GetType(); | |
if (e.Child.GetType() == typeof(Android.Widget.TextView)) | |
{ | |
var textView = (Android.Widget.TextView)e.Child; | |
textView.Visibility = ViewStates.Gone; | |
_originalDrawable = textView.Background; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void UpdateFormattedTitleText(Android.Widget.TextView titleTextView, FormattedString formattedString, string defaulTitle) | |
{ | |
if (formattedString != null && formattedString.Spans.Count > 0) | |
{ | |
titleTextView.TextFormatted = formattedString.ToAttributed(Font.Default, Xamarin.Forms.Color.Default, titleTextView); | |
} | |
else | |
{ | |
//Update if not formatted text then update with normal title text | |
UpdateTitleText(titleTextView, defaulTitle); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override void ViewDidLoad() | |
{ | |
base.ViewDidLoad(); | |
containerView = new UIView() | |
{ | |
AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth | |
}; | |
titleView = new UIView() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override void ViewWillAppear(bool animated) | |
{ | |
base.ViewWillAppear(animated); | |
SetupNavBar(NavigationController.NavigationBar.Bounds.Size); | |
SetTitlePosition(CustomNavigationPage.GetTitlePosition(Element), CustomNavigationPage.GetTitlePadding(Element), CustomNavigationPage.GetTitleMargin(Element), new CGRect(0, 0, Math.Max(subtitleLabel.IntrinsicContentSize.Width, titleLabel.IntrinsicContentSize.Width), (titleLabel.IntrinsicContentSize.Height + subtitleLabel.IntrinsicContentSize.Height + (subtitleLabel.IntrinsicContentSize.Height > 0.0f ? 3.0f : 0.0f)))); | |
System.Diagnostics.Debug.WriteLine("Preparing"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIImage CreateGradientBackground(Color startColor, Color endColor, CustomNavigationPage.GradientDirection direction) | |
{ | |
var gradientLayer = new CAGradientLayer(); | |
gradientLayer.Bounds = NavigationController.NavigationBar.Bounds; | |
gradientLayer.Colors = new CGColor[] { startColor.ToCGColor(), endColor.ToCGColor() }; | |
switch(direction) | |
{ | |
case CustomNavigationPage.GradientDirection.LeftToRight: | |
gradientLayer.StartPoint = new CGPoint(0.0, 0.5); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using SegmentedControlSample.Controls; | |
using Xamarin.Forms; | |
namespace SegmentedControlSample | |
{ | |
public class SegmentedBarControl: ScrollViewWithNotBar | |
{ |