Skip to content

Commit

Permalink
Added delete swipe views and polished up the themes
Browse files Browse the repository at this point in the history
  • Loading branch information
Programming-With-Chris committed Aug 19, 2022
1 parent bc2f712 commit ef13104
Show file tree
Hide file tree
Showing 13 changed files with 156 additions and 43 deletions.
36 changes: 36 additions & 0 deletions ShoppingList/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,45 @@ public App()
{
InitializeComponent();

SetTheme();
MainPage = new AppShell();
}

public void SetTheme()
{

var themeName = Preferences.Get("Theme", "Nautical");

ICollection<ResourceDictionary> mergedDictionaries = Application.Current.Resources.MergedDictionaries;
if (mergedDictionaries != null)
{
foreach(ResourceDictionary dictionaries in mergedDictionaries)
{
var primaryFound = dictionaries.TryGetValue(themeName + "Primary", out var primary);
if (primaryFound)
dictionaries["Primary"] = primary;

var secondaryFound = dictionaries.TryGetValue(themeName + "Secondary", out var secondary);
if (secondaryFound)
dictionaries["Secondary"] = secondary;

var tertiaryFound = dictionaries.TryGetValue(themeName + "Tertiary", out var tertiary);
if (tertiaryFound)
dictionaries["Tertiary"] = tertiary;

var accentFound = dictionaries.TryGetValue(themeName + "Accent", out var accent);
if (accentFound)
dictionaries["Accent"] = accent;

var darkAccentFound = dictionaries.TryGetValue(themeName + "DarkAccent", out var darkAccent);
if (darkAccentFound)
dictionaries["DarkAccent"] = darkAccent;
}
}


}

//#if NET6_TARGET
//public static void Main(string[] args) {}

Expand Down
10 changes: 7 additions & 3 deletions ShoppingList/AppShell.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:ShoppingList"
xmlns:views="clr-namespace:ShoppingList"
Shell.FlyoutBehavior="Flyout">
Shell.BackgroundColor="{DynamicResource Primary}"
Shell.FlyoutBehavior="Flyout"
>

<ShellContent
Title="Home"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />
Route="MainPage"
/>


<FlyoutItem FlyoutDisplayOptions="AsMultipleItems">
<FlyoutItem FlyoutDisplayOptions="AsMultipleItems"
>
<ShellContent Title="Settings"
Route="SettingsView"
ContentTemplate="{DataTemplate views:SettingsView}"/>
Expand Down
1 change: 0 additions & 1 deletion ShoppingList/Platforms/iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UIRequiredDeviceCapabilities</key>
<array>
Expand Down
Binary file added ShoppingList/Resources/Images/delete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 15 additions & 1 deletion ShoppingList/Resources/Styles/Colors.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<!-- Nautical -->
<Color x:Key="NauticalPrimary">#0081A7</Color>
<Color x:Key="NauticalSecondary">#00AFB9</Color>
<Color x:Key="NauticalTertiary">#FDFCDC</Color>
<Color x:Key="NauticalTertiary">#d9512b</Color>
<Color x:Key="NauticalAccent">#FED9B7</Color>
<Color x:Key="NauticalDarkAccent">#F07167</Color>

Expand All @@ -45,7 +45,21 @@
<Color x:Key="StrikingAccent">#EE6C4D</Color>
<Color x:Key="StrikingDarkAccent">#293241</Color>

<!-- Muted -->
<Color x:Key="MutedPrimary">#355070</Color>
<Color x:Key="MutedSecondary">#6D597A</Color>
<Color x:Key="MutedTertiary">#B56576</Color>
<Color x:Key="MutedAccent">#E56B6F</Color>
<Color x:Key="MutedDarkAccent">#EAAC8B</Color>

<!-- Pretty -->
<Color x:Key="PrettyPrimary">#AF99FF</Color>
<Color x:Key="PrettySecondary">#CAADFF</Color>
<Color x:Key="PrettyTertiary">#FFC2E2</Color>
<Color x:Key="PrettyAccent">#FFADC7</Color>
<Color x:Key="PrettyDarkAccent">#FF99B6</Color>


<SolidColorBrush x:Key="PrimaryBrush" Color="{DynamicResource Primary}"/>
<SolidColorBrush x:Key="SecondaryBrush" Color="{DynamicResource Secondary}"/>
<SolidColorBrush x:Key="TertiaryBrush" Color="{StaticResource Tertiary}"/>
Expand Down
4 changes: 2 additions & 2 deletions ShoppingList/Resources/Styles/Styles.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@

<Style TargetType="Frame">
<Setter Property="HasShadow" Value="False" />
<Setter Property="BorderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray900}}" />
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Gray100}, Dark={StaticResource Gray900}}" />
<Setter Property="BorderColor" Value="{AppThemeBinding Light={DynamicResource DarkAccent}, Dark={DynamicResource DarkAccent}}" />
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={DynamicResource Tertiary}, Dark={DynamicResource Tertiary}}" />
<Setter Property="CornerRadius" Value="8" />
</Style>

Expand Down
5 changes: 4 additions & 1 deletion ShoppingList/ShoppingList.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
<ProvisioningType>automatic</ProvisioningType>
<CodesignProvision />
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net6.0-ios'">
<CodesignKey>Apple Development: Created via API (8TKY844XYR)</CodesignKey>
<CodesignKey>Apple Development: Created via API (4FWGR6HJNC)</CodesignKey>
<CodesignProvision>VS: dev.programmingwithchris.ShoppingList Development</CodesignProvision>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0-ios|AnyCPU'">
<CodesignEntitlements />
<MtouchUseLlvm>True</MtouchUseLlvm>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-ios|AnyCPU'">
Expand Down Expand Up @@ -79,6 +81,7 @@
<MauiCss Remove="Tests\**" />
<MauiXaml Remove="Tests\**" />
<None Remove="Tests\**" />
<None Remove="Resources\Images\delete.png" />
<None Remove="SQLiteNetExtensions" />
<None Remove="Microsoft.Data.Sqlite.Core" />
<None Remove="sqlite-net-pcl" />
Expand Down
43 changes: 27 additions & 16 deletions ShoppingList/View/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
xmlns:viewmodel="clr-namespace:ShoppingList.ViewModels"
x:DataType="viewmodel:UserListViewModel"
Title="{Binding Title}"
BackgroundColor="{DynamicResource Secondary}"
x:Class="ShoppingList.MainPage">

<Grid ColumnDefinitions="*,*"
Expand All @@ -17,26 +18,38 @@
<CollectionView.ItemTemplate >
<DataTemplate x:DataType="model:UserList">
<Grid Padding="10">
<Frame>
<Frame.GestureRecognizers>
<TapGestureRecognizer CommandParameter="{Binding .}"
<SwipeView Grid.ColumnSpan="3">
<SwipeView.RightItems>
<SwipeItems>
<SwipeItem Text="Delete"
IconImageSource="delete.png"
BackgroundColor="{DynamicResource DarkAccent}"
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:UserListViewModel}}, Path=DeleteItemCommand}"
CommandParameter="{Binding .}">
</SwipeItem>
</SwipeItems>
</SwipeView.RightItems>
<Frame>
<Frame.GestureRecognizers>
<TapGestureRecognizer CommandParameter="{Binding .}"
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:UserListViewModel}}, Path=GoToListItemsCommand}"/>

<SwipeGestureRecognizer CommandParameter="{Binding .}"

<!--<SwipeGestureRecognizer CommandParameter="{Binding .}"
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:UserListViewModel}}, Path=DeleteItemCommand}"
Direction="Right"/>
</Frame.GestureRecognizers>
<VerticalStackLayout>
<Label Text="{Binding Name}"
Direction="Right"/>-->
</Frame.GestureRecognizers>
<VerticalStackLayout>
<Label Text="{Binding Name}"
FontSize="Medium"
TextColor="{DynamicResource Secondary}"/>
<Label Text="{Binding Type}"
<Label Text="{Binding Type}"
FontSize="Micro"
TextColor="{DynamicResource Secondary}"
Margin="25,0,0,0"/>
</VerticalStackLayout>
</Frame>
</VerticalStackLayout>
</Frame>
</SwipeView>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
Expand All @@ -45,17 +58,15 @@
<Button Text="Get UserLists"
Command="{Binding GetUserListsCommand}"
IsEnabled="{Binding IsNotBusy}"
TextColor="{DynamicResource Primary}"
BackgroundColor="{DynamicResource Secondary}"
BackgroundColor="{DynamicResource Primary}"
Grid.Row="1"
Margin="8"/>


<Button Text="Create New List"
Command="{Binding CreateUserListCommand}"
IsEnabled="{Binding IsNotBusy}"
TextColor="{DynamicResource Primary}"
BackgroundColor="{DynamicResource Secondary}"
BackgroundColor="{DynamicResource Primary}"
Grid.Row="1"
Grid.Column="3"
Margin="8"/>
Expand Down
35 changes: 30 additions & 5 deletions ShoppingList/View/SettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
xmlns:control="clr-namespace:ShoppingList.Controls"
x:DataType="viewmodel:SettingsViewModel"
x:Class="ShoppingList.SettingsView"
BackgroundColor="{DynamicResource Secondary}"
Shell.PresentationMode="Animated"
>

Expand All @@ -19,9 +20,9 @@
Spacing="10"
Grid.ColumnSpan="3">

<Border BackgroundColor="{DynamicResource Secondary}">
<Border BackgroundColor="{DynamicResource Primary}"
>
<Label Text="List Sorting Settings"

Margin="5,15,15,15"
Padding="10"/>
</Border>
Expand All @@ -31,7 +32,7 @@
Grid.ColumnSpan="3">
<Label Text="Start at back of store?"/>
<CheckBox IsChecked="{Binding StartAtBackOfStore}"
Color="{DynamicResource Primary}"
Color="{DynamicResource Tertiary}"
HorizontalOptions="Center"
Grid.Column="2"/>
</HorizontalStackLayout>
Expand All @@ -41,7 +42,7 @@
Grid.ColumnSpan="3">
<Label Text="Get Frozen Aisle Food Last?" />
<CheckBox IsChecked="{Binding FrozenFoodLast}"
Color="{DynamicResource Primary}"
Color="{DynamicResource Tertiary}"
Grid.Column="2"/>
</HorizontalStackLayout>

Expand All @@ -59,7 +60,7 @@

</HorizontalStackLayout>

<Border BackgroundColor="{DynamicResource Secondary}" Margin="0,25,0,0">
<Border BackgroundColor="{DynamicResource Primary}" Margin="0,25,0,0">
<Label Text="List Sorting Settings"
Margin="5,15,15,15"
Padding="10"/>
Expand Down Expand Up @@ -109,6 +110,30 @@
</control:CircularButton.GestureRecognizers>

</control:CircularButton>
<control:CircularButton ButtonColor="{StaticResource MutedPrimary}"
WidthRequest="30"
HeightRequest="30"
Margin="25,0,0,25"
x:Name="Muted">

<control:CircularButton.GestureRecognizers>
<TapGestureRecognizer Command="{Binding UpdatePrimaryColorPressedCommand}"
CommandParameter="Muted"/>
</control:CircularButton.GestureRecognizers>

</control:CircularButton>
<control:CircularButton ButtonColor="{StaticResource PrettyPrimary}"
WidthRequest="30"
HeightRequest="30"
Margin="25,0,0,25"
x:Name="Pretty">

<control:CircularButton.GestureRecognizers>
<TapGestureRecognizer Command="{Binding UpdatePrimaryColorPressedCommand}"
CommandParameter="Pretty"/>
</control:CircularButton.GestureRecognizers>

</control:CircularButton>

</HorizontalStackLayout>

Expand Down
5 changes: 4 additions & 1 deletion ShoppingList/View/StoreFinder.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
xmlns:viewmodel="clr-namespace:ShoppingList.ViewModels"
x:DataType="viewmodel:StoreFinderViewModel"
x:Class="ShoppingList.StoreFinder"
BackgroundColor="{DynamicResource Secondary}"
Shell.PresentationMode="ModalAnimated"
>

Expand All @@ -27,6 +28,7 @@
<Button Text="Make My Store"
Margin="0,0,10,0"
HeightRequest="50"
BackgroundColor="{DynamicResource Primary}"
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:StoreFinderViewModel}}, Path=SetUserKrogerCommand}"
CommandParameter="{Binding .}"/>

Expand All @@ -40,7 +42,8 @@
<Button Text="Cancel"
Grid.Row="2"
Grid.Column="1"
Command="{Binding CancelQueryCommand}"/>
Command="{Binding CancelQueryCommand}"
BackgroundColor="{DynamicResource Primary}"/>

</Grid>

Expand Down
11 changes: 7 additions & 4 deletions ShoppingList/View/UserListDataInput.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
xmlns:viewmodel="clr-namespace:ShoppingList.ViewModels"
x:DataType="viewmodel:UserListDataInputViewModel"
x:Class="ShoppingList.UserListDataInput"
BackgroundColor="{DynamicResource Secondary}"
Shell.PresentationMode="Animated"
>

Expand Down Expand Up @@ -49,11 +50,11 @@

<HorizontalStackLayout>
<Label Text="Pre-populate list with Items from last time?"
TextColor="{DynamicResource Primary}"
TextColor="{DynamicResource Tertiary}"
Padding="10"/>

<CheckBox IsChecked="{Binding PrepopulateList, Mode=TwoWay}"
Color="{DynamicResource Primary}"
Color="{DynamicResource Tertiary}"
CheckedChanged="CheckBox_CheckedChanged"/>

</HorizontalStackLayout>
Expand All @@ -64,13 +65,15 @@
<Button Text="Cancel"
IsEnabled="True"
Command="{Binding CancelCommand}"
BackgroundColor="{DynamicResource Primary}"
Margin="8"
Grid.Row="1"
Grid.Column="0"/>
Grid.Row="1"
Grid.Column="0"/>

<Button Text="Create New List"
IsEnabled="True"
Command="{Binding UserListCompletedCommand}"
BackgroundColor="{DynamicResource Primary}"
Margin="8"
Grid.Column="1"
Grid.Row="1"/>
Expand Down
Loading

0 comments on commit ef13104

Please sign in to comment.