Skip to content

Commit

Permalink
Latest UI updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Programming-With-Chris committed Aug 19, 2022
1 parent 11a5b71 commit 0ebfb2d
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 29 deletions.
2 changes: 1 addition & 1 deletion ShoppingList/Controls/CircularButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public string Image

public new BindableProperty IsVisibleProperty = BindableProperty.Create(
nameof(IsVisible), typeof(bool), typeof(CircularButton),
propertyChanging: OnIsVisibleChanged);
propertyChanged: OnIsVisibleChanged);

public CircularButton()
{
Expand Down
32 changes: 32 additions & 0 deletions ShoppingList/Controls/StringToBoolConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System.Globalization;

namespace ShoppingList.Controls;

public class StringToBoolConverter : IValueConverter
{
public StringToBoolConverter()
{

}

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Console.WriteLine("Test");
var asString = (string)value;
if (value is not null)
{
var result = Boolean.Parse(asString);
return result;
}
else
{
return false;
}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
Console.WriteLine("Test");
return null;
}
}
13 changes: 5 additions & 8 deletions ShoppingList/Drawable/CircularButtonDrawable.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Reflection;
using Microsoft.Maui.Graphics.Platform;
using IImage = Microsoft.Maui.Graphics.IImage;

namespace ShoppingList.Drawable;
Expand Down Expand Up @@ -39,12 +38,15 @@ public void Draw(ICanvas canvas, RectF dirtyRect)
var limitingDim = width > height ? height : width;
PointF centerOfCircle = new PointF(width / 2, height / 2);

#if !WINDOWS
#if WINDOWS
canvas.FillColor = this.ButtonColor;
canvas.FillCircle(centerOfCircle, limitingDim / 2);
#elif ANDROID || IOS
IImage image;
Assembly assembly = GetType().GetTypeInfo().Assembly;
using (Stream stream = assembly.GetManifestResourceStream("ShoppingList.Resources.Images." + Image))
{
image = PlatformImage.FromStream(stream);
image = Microsoft.Maui.Graphics.Platform.PlatformImage.FromStream(stream);
if (image is null)
throw new FileNotFoundException("ShoppingList.Resources.Images." + Image);
}
Expand All @@ -54,11 +56,6 @@ public void Draw(ICanvas canvas, RectF dirtyRect)
canvas.FillCircle(centerOfCircle, limitingDim / 2);
canvas.DrawImage(image, dirtyRect.X + dirtyRect.Width / 4, dirtyRect.Y + dirtyRect.Height / 4, dirtyRect.Width / 2, dirtyRect.Height / 2);
}
#else

canvas.FillColor = this.ButtonColor;
canvas.FillCircle(centerOfCircle, limitingDim / 2);

#endif
}
}
Expand Down
4 changes: 0 additions & 4 deletions ShoppingList/Platforms/iOS/Entitlements.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.application-groups</key>
<string>group.dev.programmingwithchris.ShoppingList</string>
<key>com.apple.developer.default-data-protection</key>
<string>NSFileProtectionComplete</string>
<key>com.apple.security.inherit</key>
<true/>
<key>get-task-allow</key>
Expand Down
2 changes: 2 additions & 0 deletions ShoppingList/Platforms/iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@
</array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/appicon.appiconset</string>
<key>CFBundleIdentifier</key>
<string></string>
</dict>
</plist>
32 changes: 24 additions & 8 deletions ShoppingList/View/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
xmlns:model="clr-namespace:ShoppingList.Model"
xmlns:viewmodel="clr-namespace:ShoppingList.ViewModels"
xmlns:skiasharp="clr-namespace:SkiaSharp.Extended.UI.Controls;assembly=SkiaSharp.Extended.UI"
xmlns:controls="clr-namespace:ShoppingList.Controls"
x:DataType="viewmodel:UserListViewModel"
Title="{Binding Title}"
x:Name="CurrentPage"
BackgroundColor="{DynamicResource Secondary}"
x:Class="ShoppingList.MainPage">

Expand Down Expand Up @@ -73,21 +75,35 @@
BackgroundColor="Transparent">
</skiasharp:SKLottieView>

<Button Text="Get UserLists"
Command="{Binding GetUserListsCommand}"
IsEnabled="{Binding IsNotBusy}"
BackgroundColor="{DynamicResource Primary}"
Grid.Row="1"
Margin="8"/>


<Button Text="Create New List"
<controls:CircularButton
Grid.Row="1"
Grid.Column="3"
x:Name="NewItemButton"
WidthRequest="75"
HeightRequest="75"
Margin="0,0,45,45"
ButtonColor="{StaticResource Tertiary}"
BackgroundColor="Transparent"
Image="plus_sign.png"
VerticalOptions="End"
HorizontalOptions="End"
>
<GraphicsView.GestureRecognizers>
<TapGestureRecognizer Command="{Binding CreateUserListCommand}"/>

</GraphicsView.GestureRecognizers>
</controls:CircularButton>


<!--<Button Text="Create New List"
Command="{Binding CreateUserListCommand}"
IsEnabled="{Binding IsNotBusy}"
BackgroundColor="{DynamicResource Primary}"
Grid.Row="1"
Grid.Column="3"
Margin="8"/>
Margin="8"/>-->

<ActivityIndicator IsVisible="{Binding IsBusy}"
IsRunning="{Binding IsBusy}"
Expand Down
1 change: 1 addition & 0 deletions ShoppingList/View/SettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<Label Text="Default Kroger Location:"
Margin="0,0,25,0"/>
<Label Text="{Binding KrogerStoreName}"
BackgroundColor="{DynamicResource Primary}"
>
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding OpenLocationFinderDialogCommand}"/>
Expand Down
18 changes: 10 additions & 8 deletions ShoppingList/View/UserListDetails.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
Title="{Binding Title}"
>

<ContentPage.Resources>
<controls:StringToBoolConverter x:Key="stringToBool" />
</ContentPage.Resources>

<Shell.BackButtonBehavior>
<BackButtonBehavior Command="{Binding GoBackToListScreenCommand}"
/>
Expand Down Expand Up @@ -50,7 +54,7 @@
</SwipeItems>
</SwipeView.RightItems>
<Frame Grid.ColumnSpan="3"
Padding="10"
Padding="5"
Margin="0,0,0,10"
x:Name="ItemFrame"
BindingContext="{Binding .}">
Expand Down Expand Up @@ -110,10 +114,9 @@
VerticalOptions="End"
HorizontalOptions="End"
>
<GraphicsView.GestureRecognizers>
<TapGestureRecognizer Command="{Binding NewItemDialogCommand}"/>

</GraphicsView.GestureRecognizers>
<controls:CircularButton.GestureRecognizers>
<TapGestureRecognizer Tapped="NewItemButtonPressed"/>
</controls:CircularButton.GestureRecognizers>
</controls:CircularButton>


Expand All @@ -131,10 +134,9 @@
IsEnabled="{Binding HasUndo}"
IsVisible="{Binding HasUndo}"
>
<GraphicsView.GestureRecognizers>
<controls:CircularButton.GestureRecognizers>
<TapGestureRecognizer Command="{Binding UndoButtonPressedCommand}"/>

</GraphicsView.GestureRecognizers>
</controls:CircularButton.GestureRecognizers>
</controls:CircularButton>
</Grid>
</Grid>
Expand Down
11 changes: 11 additions & 0 deletions ShoppingList/View/UserListDetails.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,15 @@ public void OnCheckboxClicked(object sender, CheckedChangedEventArgs e)

}

public void NewItemButtonPressed(object sender, EventArgs e)
{

var circularButton = sender as CircularButton;
//need to grab the drawable, add a method in the drawable to animate a scale, and then call it here

_ulvm.NewItemDialog();


}

}

0 comments on commit 0ebfb2d

Please sign in to comment.