@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="launcher_background">#000000</color>
|
<color name="launcher_background">#000000</color>
|
||||||
<color name="colorPrimary">#555555</color>
|
<color name="colorPrimary">#360485</color>
|
||||||
<color name="colorPrimaryDark">#000000</color>
|
<color name="colorPrimaryDark">#000000</color>
|
||||||
<color name="colorAccent">#bbaa11</color>
|
<color name="colorAccent">#bbaa11</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -14,12 +14,12 @@
|
|||||||
<!--
|
<!--
|
||||||
<item name="colorPrimary">#2196F3</item>
|
<item name="colorPrimary">#2196F3</item>
|
||||||
-->
|
-->
|
||||||
<item name="colorPrimary">#222222</item>
|
<item name="colorPrimary">#333333</item>
|
||||||
<!-- colorPrimaryDark is used for the status bar -->
|
<!-- colorPrimaryDark is used for the status bar -->
|
||||||
<item name="colorPrimaryDark">#000000</item>
|
<item name="colorPrimaryDark">#000000</item>
|
||||||
<!-- colorAccent is used as the default value for colorControlActivated
|
<!-- colorAccent is used as the default value for colorControlActivated
|
||||||
which is used to tint widgets -->
|
which is used to tint widgets -->
|
||||||
<item name="colorAccent">#FF4081</item>
|
<item name="colorAccent">#9955fa</item>
|
||||||
<!-- You can also set colorControlNormal, colorControlActivated
|
<!-- You can also set colorControlNormal, colorControlActivated
|
||||||
colorControlHighlight and colorSwitchThumbNormal. -->
|
colorControlHighlight and colorSwitchThumbNormal. -->
|
||||||
<item name="windowActionModeOverlay">true</item>
|
<item name="windowActionModeOverlay">true</item>
|
||||||
@@ -28,6 +28,6 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
|
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
|
||||||
<item name="colorAccent">#FF4081</item>
|
<item name="colorAccent">#9955fc</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
+44
-39
@@ -3,72 +3,77 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
x:Class="Mear.App">
|
x:Class="Mear.App">
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<Color x:Key="NavigationPageColor">#000010</Color>
|
<Color x:Key="NavigationPageColor">#101010</Color>
|
||||||
|
<Color x:Key="NavigationBarColor">#9955fa</Color>
|
||||||
<Color x:Key="BarTextColor">#ffffff</Color>
|
<Color x:Key="BarTextColor">#ffffff</Color>
|
||||||
<Color x:Key="NavigationPageBackgroundColor">#000000</Color>
|
<Color x:Key="NavigationPageBackgroundColor">#ffffff</Color>
|
||||||
|
|
||||||
<Color x:Key="TabbedBarTextColor">#ffffff</Color>
|
<Color x:Key="TabbedBarTextColor">#ffffff</Color>
|
||||||
<Color x:Key="TabbedUnselectedColor">#000000</Color>
|
<Color x:Key="TabbedUnselectedColor">#000000</Color>
|
||||||
<Color x:Key="TabbedSelectedColor">#333333</Color>
|
<Color x:Key="TabbedSelectedColor">#333333</Color>
|
||||||
|
|
||||||
<Color x:Key="ButtonColor">#660066</Color>
|
<Color x:Key="ButtonColor">#360485</Color>
|
||||||
<Color x:Key="ButtonTextColor">#ffccff</Color>
|
<Color x:Key="ButtonTextColor">#ffffff</Color>
|
||||||
<Color x:Key="ButtonBorderColor">#ffe6ff</Color>
|
<Color x:Key="ButtonBorderColor">#9555fa</Color>
|
||||||
|
|
||||||
<Color x:Key="LabelTextColor">#ffffee</Color>
|
<Color x:Key="LabelTextColor">#ffffff</Color>
|
||||||
<Color x:Key="LabelBackgroundColor">#aaaaaa</Color>
|
<Color x:Key="LabelBackgroundColor">#333333</Color>
|
||||||
|
|
||||||
<Color x:Key="EntryTextColor">#ffffee</Color>
|
<Color x:Key="EntryTextColor">#ffffff</Color>
|
||||||
|
<Color x:Key="EntryPlaceholderTextColor">#a300ff</Color>
|
||||||
|
<Color x:Key="EntryBackgroundColor">#111111</Color>
|
||||||
|
|
||||||
<!--
|
<Color x:Key="SwitchBackgroundColor">#222222</Color>
|
||||||
<Color x:Key="SearchBarBackgroundColor">#ffffee</Color>
|
<Color x:Key="SwitchActiveColor">#915dfa</Color>
|
||||||
<Color x:Key="SearchBarCancelButtonColor">#999999</Color>
|
|
||||||
<Color x:Key="StaticResource SearchBarPlaceholderColor">#ffeeff</Color>
|
<Color x:Key="SearchBarBackgroundColor">#222222</Color>
|
||||||
-->
|
<Color x:Key="SearchBarCancelButtonColor">#9955fa</Color>
|
||||||
<Color x:Key="StaticResource SearchBarTextColor">#ffffff</Color>
|
<Color x:Key="SearchBarPlaceholderTextColor">#eeffff</Color>
|
||||||
|
<Color x:Key="SearchBarTextColor">#ffffff</Color>
|
||||||
|
|
||||||
<Style TargetType="NavigationPage">
|
<Style TargetType="NavigationPage">
|
||||||
<Setter Property="BackgroundColor" Value="{StaticResource NavigationPageBackgroundColor}" />
|
<Setter Property="BackgroundColor" Value="{DynamicResource NavigationPageBackgroundColor}" />
|
||||||
<Setter Property="BarBackgroundColor" Value="{StaticResource NavigationPageColor}" />
|
<Setter Property="BarBackgroundColor" Value="{DynamicResource NavigationBarColor}" />
|
||||||
<Setter Property="BarTextColor" Value="{StaticResource BarTextColor}" />
|
<Setter Property="BarTextColor" Value="{DynamicResource BarTextColor}" />
|
||||||
</Style>
|
</Style>
|
||||||
|
<!--
|
||||||
<Style TargetType="ContentPage">
|
<Style TargetType="ContentPage">
|
||||||
<Setter Property="BackgroundColor" Value="{StaticResource NavigationPageBackgroundColor}" />
|
<Setter Property="BackgroundColor" Value="{DynamicResource NavigationPageBackgroundColor}" />
|
||||||
|
<Setter Property="BackgroundColor" Value="Red" />
|
||||||
</Style>
|
</Style>
|
||||||
|
-->
|
||||||
|
<!--
|
||||||
<Style TargetType="TabbedPage">
|
<Style TargetType="TabbedPage">
|
||||||
<Setter Property="BarTextColor" Value="{StaticResource TabbedBarTextColor}" />
|
<Setter Property="BarTextColor" Value="{DynamicResource TabbedBarTextColor}" />
|
||||||
<!--
|
|
||||||
<Setter Property="UnselectedTabColor" Value="{StaticResource TabbedUnselectedColor}" />
|
|
||||||
-->
|
|
||||||
<Setter Property="UnselectedTabColor" Value="Green" />
|
|
||||||
<!--
|
|
||||||
<Setter Property="SelectedTabColor" Value="{StaticResource TabbedSelectedColor}" />
|
|
||||||
-->
|
|
||||||
<Setter Property="SelectedTabColor" Value="Yellow" />
|
|
||||||
</Style>
|
</Style>
|
||||||
|
-->
|
||||||
<Style TargetType="StackLayout">
|
<Style TargetType="StackLayout">
|
||||||
<Setter Property="BackgroundColor" Value="{StaticResource NavigationPageColor}" />
|
<Setter Property="BackgroundColor" Value="{DynamicResource NavigationPageColor}" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style TargetType="Button">
|
<Style TargetType="Button">
|
||||||
<Setter Property="BackgroundColor" Value="{StaticResource ButtonColor}" />
|
<Setter Property="BackgroundColor" Value="{DynamicResource ButtonColor}" />
|
||||||
<Setter Property="TextColor" Value="{StaticResource ButtonTextColor}" />
|
<Setter Property="TextColor" Value="{DynamicResource ButtonTextColor}" />
|
||||||
<Setter Property="BorderColor" Value="{StaticResource ButtonBorderColor}" />
|
<Setter Property="BorderColor" Value="{DynamicResource ButtonBorderColor}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style TargetType="Label">
|
<Style TargetType="Label">
|
||||||
<Setter Property="TextColor" Value="{StaticResource LabelTextColor}" />
|
<Setter Property="TextColor" Value="{DynamicResource LabelTextColor}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style TargetType="Entry">
|
<Style TargetType="Entry">
|
||||||
<Setter Property="TextColor" Value="{StaticResource EntryTextColor}" />
|
<Setter Property="TextColor" Value="{DynamicResource EntryTextColor}" />
|
||||||
|
<Setter Property="PlaceholderColor" Value="{DynamicResource EntryPlaceholderTextColor}" />
|
||||||
|
<Setter Property="BackgroundColor" Value="{DynamicResource EntryBackgroundColor}" />
|
||||||
</Style>
|
</Style>
|
||||||
<!--
|
|
||||||
<Style TargetType="SearchBar">
|
<Style TargetType="SearchBar">
|
||||||
<Setter Property="BackgroundColor" Value="{StaticResource SearchBarBackgroundColor}" />
|
<Setter Property="BackgroundColor" Value="{DynamicResource SearchBarBackgroundColor}" />
|
||||||
<Setter Property="CancelButtonColor" Value="{StaticResource SearchBarCancelButtonColor}" />
|
<Setter Property="CancelButtonColor" Value="{DynamicResource SearchBarCancelButtonColor}" />
|
||||||
<Setter Property="PlaceholderColor" Value="{StaticResource SearchBarPlaceholderColor}" />
|
<Setter Property="PlaceholderColor" Value="{DynamicResource SearchBarPlaceholderTextColor}" />
|
||||||
<Setter Property="TextColor" Value="{StaticResource SearchBarTextColor}" />
|
<Setter Property="TextColor" Value="{DynamicResource SearchBarTextColor}" />
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="Switch">
|
||||||
|
<Setter Property="OnColor" Value="{DynamicResource SwitchActiveColor}" />
|
||||||
|
<Setter Property="BackgroundColor" Value="{DynamicResource SwitchBackgroundColor}" />
|
||||||
</Style>
|
</Style>
|
||||||
-->
|
|
||||||
|
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
</Application>
|
</Application>
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
using Mear.Models;
|
||||||
|
using Mear.Repositories.Database;
|
||||||
|
|
||||||
|
namespace Mear.Managers
|
||||||
|
{
|
||||||
|
public class ThemeManager
|
||||||
|
{
|
||||||
|
#region Methods
|
||||||
|
public void InitTheme()
|
||||||
|
{
|
||||||
|
var settingsRepo = new DBSettingsRepository();
|
||||||
|
if (settingsRepo.IsDarkThemeOn())
|
||||||
|
{
|
||||||
|
ApplyDarkTheme();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ApplyLightTheme();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void ChangeTheme(bool? isDarkTheme = null)
|
||||||
|
{
|
||||||
|
var settingsRepo = new DBSettingsRepository();
|
||||||
|
if (isDarkTheme == null)
|
||||||
|
{
|
||||||
|
settingsRepo.UpdateDarkTheme();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
settingsRepo.UpdateDarkTheme(isDarkTheme.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settingsRepo.IsDarkThemeOn())
|
||||||
|
{
|
||||||
|
ApplyDarkTheme();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ApplyLightTheme();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplyDarkTheme()
|
||||||
|
{
|
||||||
|
App.Current.Resources["NavigationPageColor"] = Color.FromHex("#101010");
|
||||||
|
App.Current.Resources["BarTextColor"] = Color.FromHex("#ffffff");
|
||||||
|
App.Current.Resources["ButtonColor"] = Color.FromHex("#360485");
|
||||||
|
App.Current.Resources["ButtonTextColor"] = Color.FromHex("#ffffff");
|
||||||
|
App.Current.Resources["ButtonBorderColor"] = Color.FromHex("#9955fa");
|
||||||
|
App.Current.Resources["LabelTextColor"] = Color.FromHex("#ffffff");
|
||||||
|
App.Current.Resources["LabelBackgroundColor"] = Color.FromHex("#333333");
|
||||||
|
App.Current.Resources["EntryTextColor"] = Color.FromHex("#ffffff");
|
||||||
|
App.Current.Resources["EntryPlaceholderTextColor"] = Color.FromHex("#a300ff");
|
||||||
|
App.Current.Resources["EntryBackgroundColor"] = Color.FromHex("#111111");
|
||||||
|
App.Current.Resources["SwitchBackgroundColor"] = Color.FromHex("#222222");
|
||||||
|
App.Current.Resources["SwitchActiveColor"] = Color.FromHex("#915dfa");
|
||||||
|
App.Current.Resources["SearchBarBackgroundColor"] = Color.FromHex("#222222");
|
||||||
|
App.Current.Resources["SearchBarCancelButtonColor"] = Color.FromHex("#9955fa");
|
||||||
|
App.Current.Resources["SearchBarPlaceholderTextColor"] = Color.FromHex("eeffff");
|
||||||
|
App.Current.Resources["SearchBarTextColor"] = Color.FromHex("#ffffff");
|
||||||
|
}
|
||||||
|
private void ApplyLightTheme()
|
||||||
|
{
|
||||||
|
App.Current.Resources["NavigationPageColor"] = Color.FromHex("#eeffff");
|
||||||
|
App.Current.Resources["BarTextColor"] = Color.FromHex("#000000");
|
||||||
|
App.Current.Resources["ButtonColor"] = Color.FromHex("#9955fa");
|
||||||
|
App.Current.Resources["ButtonTextColor"] = Color.FromHex("#000000");
|
||||||
|
App.Current.Resources["ButtonBorderColor"] = Color.FromHex("#360485");
|
||||||
|
App.Current.Resources["LabelTextColor"] = Color.FromHex("#000000");
|
||||||
|
App.Current.Resources["LabelBackgroundColor"] = Color.FromHex("efffff");
|
||||||
|
App.Current.Resources["EntryTextColor"] = Color.FromHex("#000000");
|
||||||
|
App.Current.Resources["EntryPlaceholderTextColor"] = Color.FromHex("#231412");
|
||||||
|
App.Current.Resources["EntryBackgroundColor"] = Color.FromHex("#efffff");
|
||||||
|
App.Current.Resources["SwitchBackgroundColor"] = Color.FromHex("#eeffff");
|
||||||
|
App.Current.Resources["SwitchActiveColor"] = Color.FromHex("#360485");
|
||||||
|
App.Current.Resources["SearchBarBackgroundColor"] = Color.FromHex("#eeffff");
|
||||||
|
App.Current.Resources["SearchBarCancelButtonColor"] = Color.FromHex("#360485");
|
||||||
|
App.Current.Resources["SearchBarPlaceholderTextColor"] = Color.FromHex("#111111");
|
||||||
|
App.Current.Resources["SearchBarTextColor"] = Color.FromHex("#000000");
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -66,6 +66,22 @@ namespace Mear.Repositories.Database
|
|||||||
var msg = ex.Message;
|
var msg = ex.Message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void UpdateDarkTheme(bool isDarkTheme)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (DoesTableExist(_tableName))
|
||||||
|
{
|
||||||
|
var settings = RetrieveSettings();
|
||||||
|
settings.DarkTheme = isDarkTheme;
|
||||||
|
_Db.Update(settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
var msg = ex.Message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Settings RetrieveSettings()
|
private Settings RetrieveSettings()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Text;
|
|||||||
|
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
using Mear.Managers;
|
||||||
using Mear.Repositories.Database;
|
using Mear.Repositories.Database;
|
||||||
|
|
||||||
namespace Mear.ViewModels
|
namespace Mear.ViewModels
|
||||||
@@ -36,6 +37,11 @@ namespace Mear.ViewModels
|
|||||||
|
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
public void ToggleTheme(bool? isDarkTheme = null)
|
||||||
|
{
|
||||||
|
var themeMgr = new ThemeManager();
|
||||||
|
themeMgr.ChangeTheme(isDarkTheme);
|
||||||
|
}
|
||||||
private SwitchItem RetrieveColorSchemeSwitch()
|
private SwitchItem RetrieveColorSchemeSwitch()
|
||||||
{
|
{
|
||||||
var settingsRepo = new DBSettingsRepository();
|
var settingsRepo = new DBSettingsRepository();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
|||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using Xamarin.Forms.Xaml;
|
using Xamarin.Forms.Xaml;
|
||||||
|
|
||||||
|
using Mear.Managers;
|
||||||
using Mear.Models.Authentication;
|
using Mear.Models.Authentication;
|
||||||
using Mear.Repositories.Database;
|
using Mear.Repositories.Database;
|
||||||
|
|
||||||
@@ -27,6 +28,8 @@ namespace Mear.Views
|
|||||||
public MusicLibrary()
|
public MusicLibrary()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
var themeMgr = new ThemeManager();
|
||||||
|
themeMgr.InitTheme();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -23,15 +23,22 @@
|
|||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<StackLayout Grid.Row="0" Grid.Column="0"
|
<StackLayout Grid.Row="0" Grid.Column="0"
|
||||||
Orientation="Horizontal">
|
HorizontalOptions="FillAndExpand"
|
||||||
|
MinimumWidthRequest="300"
|
||||||
|
Orientation="Vertical">
|
||||||
<Label Text="{Binding Title}"
|
<Label Text="{Binding Title}"
|
||||||
d:Text="{Binding .}"
|
d:Text="{Binding .}"
|
||||||
LineBreakMode="NoWrap"
|
LineBreakMode="NoWrap"
|
||||||
FontSize="14" />
|
FontSize="15" />
|
||||||
|
</StackLayout>
|
||||||
|
<StackLayout Grid.Row="0" Grid.Column="1"
|
||||||
|
MinimumWidthRequest="120">
|
||||||
<Switch IsToggled="{Binding On}"
|
<Switch IsToggled="{Binding On}"
|
||||||
|
MinimumHeightRequest="120"
|
||||||
Toggled="Switch_Toggled" />
|
Toggled="Switch_Toggled" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -33,9 +33,8 @@ namespace Mear.Views
|
|||||||
#region Events
|
#region Events
|
||||||
private void Switch_Toggled(object sender, ToggledEventArgs e)
|
private void Switch_Toggled(object sender, ToggledEventArgs e)
|
||||||
{
|
{
|
||||||
var val = e;
|
bool? isDarkTheme = e.Value;
|
||||||
var valOne = sender;
|
_viewModel.ToggleTheme(isDarkTheme);
|
||||||
var yp = "";
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user