This repository was archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Set StatusBar color and StatusBarStyle for iOS Android and UWP from Page #8298
Closed
Closed
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
224beb0
StatusBar Background color
KSemenenko 50244fc
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko 81797cf
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko 76a4b0b
gallery
KSemenenko 6ba0c66
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko 5410f90
revert changes
KSemenenko 52ff6b7
wip
KSemenenko 1cbef02
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko 1c244ef
changes from review + UWP
KSemenenko 9ecde1b
StatusBarStyle
KSemenenko 5a782da
uwp
KSemenenko b8b1563
refactoring
KSemenenko 36df8d5
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko 437fb62
Merge branch 'master' into issue-7314-status-bar-color
KSemenenko 2d0ef89
refactoring
KSemenenko 97e9039
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko 3535061
Shell and Pages
KSemenenko 9276d35
swhitch page
KSemenenko e217084
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko 654881d
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko aabc274
appeared
KSemenenko 47a4d42
refactoring
KSemenenko cd8b4b8
SendAppearing
KSemenenko 59fdde4
IsOnScreen
KSemenenko 19b86de
refactoring and more samples
KSemenenko 0f8ce38
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko 74faacc
IsOnScreenProperty
KSemenenko 606b8dc
Tests
KSemenenko 2e88988
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko 225e237
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko 674b55b
IsLoaded
KSemenenko 6fda594
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko 13093db
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko 3cbdac3
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko 64ca279
IsPresented
KSemenenko e575bd9
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko c5d2c2f
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko 0b26303
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko aa6d1c5
IsAppeared
KSemenenko 4f345fe
IsAppeared
KSemenenko f620add
IsAppearedProperty
KSemenenko 713b988
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko 2c5de8b
Merge branch 'master' into issue-7314-status-bar-color
KSemenenko 3ba5c26
Commands
KSemenenko 57180a6
remove extra propeties
KSemenenko ec10e8d
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko 01470c3
tests
KSemenenko 10beb52
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko 0ea8872
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko 54ef8d8
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko d019c04
tabs
KSemenenko 659cc11
refactoring
KSemenenko aba19bf
tabbedpage fix
KSemenenko c764ecf
GetEffectiveBindableValue
KSemenenko 0857aea
Merge remote-tracking branch 'upstream/master' into issue-7314-status…
KSemenenko de427f1
Merge branch 'main' into issue-7314-status-bar-color
KSemenenko 564279d
Merge branch 'main' into issue-7314-status-bar-color
KSemenenko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ | |
<string>[email protected]</string> | ||
</array> | ||
<key>UIViewControllerBasedStatusBarAppearance</key> | ||
<true/> | ||
<false/> | ||
<key>NSLocationWhenInUseUsageDescription</key> | ||
<string>We are using your location</string> | ||
<key>NSLocationAlwaysUsageDescription</key> | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
x:Class="Xamarin.Forms.Controls.GalleryPages.StatusBarGallery"> | ||
<StackLayout> | ||
<Label Text="Slide to change StatusBarColor color"/> | ||
|
||
<Slider Minimum="0" Maximum="255" Value="0" ValueChanged="Slider_OnValueChanged" MaximumTrackColor="Red" ThumbColor="Red" | ||
MinimumTrackColor="Red" Margin="20,10" x:Name="RedSlider"/> | ||
|
||
<Slider Minimum="0" Maximum="255" Value="0" ValueChanged="Slider_OnValueChanged" MaximumTrackColor="Green" ThumbColor="Green" | ||
MinimumTrackColor="Green" Margin="20,10" x:Name="GreenSlider"/> | ||
|
||
<Slider Minimum="0" Maximum="255" Value="0" ValueChanged="Slider_OnValueChanged" MaximumTrackColor="Blue" ThumbColor="Blue" | ||
MinimumTrackColor="Blue" Margin="20,10" x:Name="BlueSlider"/> | ||
|
||
<Label Text="Swith to change StatusBarStyle"/> | ||
|
||
<Switch Toggled="Switch_OnToggled" HorizontalOptions="Start"/> | ||
<ScrollView> | ||
<StackLayout> | ||
<Button Text="NavigationPage" Clicked="NavigationPage_Navigate"/> | ||
<Button Text="NavigationPage Pages" Clicked="NavigationPage_Pages_Navigate"/> | ||
<Button Text="TabbedPage" Clicked="TabbedPage_Navigate"/> | ||
<Button Text="TabbedPage Pages" Clicked="TabbedPage_Pages_Navigate"/> | ||
<Button Text="CarouselPage" Clicked="CarouselPage_Navigate"/> | ||
<Button Text="CarouselPage Pages" Clicked="CarouselPage_Pages_Navigate"/> | ||
<Button Text="ContentPage" Clicked="ContentPage_Navigate"/> | ||
<Button Text="Shell" Clicked="Shell_Navigate"/> | ||
</StackLayout> | ||
</ScrollView> | ||
</StackLayout> | ||
</ContentPage> |
133 changes: 133 additions & 0 deletions
133
Xamarin.Forms.Controls/GalleryPages/StatusBarGallery.xaml.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Xamarin.Forms.Xaml; | ||
|
||
namespace Xamarin.Forms.Controls.GalleryPages | ||
{ | ||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
public partial class StatusBarGallery : ContentPage | ||
{ | ||
public StatusBarGallery() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
void Slider_OnValueChanged(object sender, ValueChangedEventArgs e) | ||
{ | ||
StatusBarColor = Color.FromRgb(Convert.ToInt32(RedSlider.Value), Convert.ToInt32(GreenSlider.Value), Convert.ToInt32(BlueSlider.Value)); | ||
} | ||
|
||
void Switch_OnToggled(object sender, ToggledEventArgs e) | ||
{ | ||
StatusBarStyle = e.Value ? StatusBarStyle.DarkContent : StatusBarStyle.LightContent; | ||
} | ||
|
||
void NavigationPage_Navigate(object sender, EventArgs e) | ||
{ | ||
var page = new NavigationPage(new StatusBarGallery()); | ||
page.StatusBarColor = Color.DarkBlue; | ||
page.StatusBarStyle = StatusBarStyle.DarkContent; | ||
Application.Current.MainPage = page; | ||
} | ||
|
||
void NavigationPage_Pages_Navigate(object sender, EventArgs e) | ||
{ | ||
var page = new NavigationPage(new StatusBarGallery() | ||
{ | ||
StatusBarColor = Color.Red, | ||
StatusBarStyle = StatusBarStyle.LightContent | ||
}); | ||
Application.Current.MainPage = page; | ||
page.PushAsync(new StatusBarGallery() | ||
{ | ||
StatusBarColor = Color.Cyan, | ||
StatusBarStyle = StatusBarStyle.DarkContent | ||
}); | ||
} | ||
|
||
void ContentPage_Navigate(object sender, EventArgs e) | ||
{ | ||
var page = new StatusBarGallery() | ||
{ | ||
StatusBarColor = Color.DarkTurquoise, | ||
StatusBarStyle = StatusBarStyle.DarkContent | ||
}; | ||
Application.Current.MainPage = page; | ||
} | ||
|
||
void TabbedPage_Navigate(object sender, EventArgs e) | ||
{ | ||
var page = new TabbedPage(); | ||
page.Children.Add(new StatusBarGallery { Title = "Page1" }); | ||
page.Children.Add(new StatusBarGallery { Title = "Page2" }); | ||
page.StatusBarColor = Color.DarkCyan; | ||
page.StatusBarStyle = StatusBarStyle.DarkContent; | ||
Application.Current.MainPage = page; | ||
} | ||
|
||
void TabbedPage_Pages_Navigate(object sender, EventArgs e) | ||
{ | ||
var page = new TabbedPage(); | ||
page.Children.Add(new StatusBarGallery() | ||
{ | ||
StatusBarColor = Color.Red, | ||
StatusBarStyle = StatusBarStyle.LightContent, | ||
Title = "Page1" | ||
}); | ||
page.Children.Add(new StatusBarGallery() | ||
{ | ||
StatusBarColor = Color.Cyan, | ||
StatusBarStyle = StatusBarStyle.DarkContent, | ||
Title = "Page1" | ||
}); | ||
Application.Current.MainPage = page; | ||
} | ||
|
||
void CarouselPage_Navigate(object sender, EventArgs e) | ||
{ | ||
var page = new CarouselPage(); | ||
page.Children.Add(new StatusBarGallery()); | ||
page.Children.Add(new StatusBarGallery()); | ||
page.StatusBarColor = Color.DarkMagenta; | ||
page.StatusBarStyle = StatusBarStyle.DarkContent; | ||
Application.Current.MainPage = page; | ||
} | ||
|
||
void CarouselPage_Pages_Navigate(object sender, EventArgs e) | ||
{ | ||
var page = new CarouselPage(); | ||
page.Children.Add(new StatusBarGallery() | ||
{ | ||
StatusBarColor = Color.Red, | ||
StatusBarStyle = StatusBarStyle.LightContent | ||
}); | ||
page.Children.Add(new StatusBarGallery() | ||
{ | ||
StatusBarColor = Color.Cyan, | ||
StatusBarStyle = StatusBarStyle.DarkContent | ||
}); | ||
Application.Current.MainPage = page; | ||
} | ||
|
||
void Shell_Navigate(object sender, EventArgs e) | ||
{ | ||
var shell = new Shell(); | ||
shell.Items.Add(new TabBar() | ||
{ | ||
Items = { new Tab | ||
{ | ||
Items = { new ShellContent() | ||
{ | ||
Content = new StatusBarGallery() | ||
}} | ||
}} | ||
}); | ||
shell.StatusBarColor = Color.DarkGoldenrod; | ||
shell.StatusBarStyle = StatusBarStyle.DarkContent; | ||
|
||
Application.Current.MainPage = shell; | ||
} | ||
|
||
|
||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -357,5 +357,6 @@ void UpdateCurrentPage() | |
else if (SelectedItem is T) | ||
CurrentPage = (T)SelectedItem; | ||
} | ||
|
||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.