Buy Before Add

On the Add Item screen the “Save to Add list” option is selected by default. Somehow this workflow didn’t seem right.

Let’s say you’re on the Add screen, searching for an item to add to your Buy list. You can’t find it so you decide to add it by tapping the Add Item button in the upper right corner. Your mental modal is “I’ve got to add this item that I want to buy” but the Add Item screen destination defaults to the Add list. So now you’ve got to switch your destination for this item to the Buy list, type in your item name, and hit save.

It’s not onerous but I think we could remove one step in this process by making the Buy list the default destination when the Add Item list screen is displayed. (There is a second use case–walking around the kitchen adding items that aren’t on the Add list but I think it’s an edge case.)

To make the Buy list the default destination I set the quantity control (a StackLayout that contains the Label and Slider) IsVisible property from false to true.

<StackLayout x:Name="quantityControl" Orientation="Horizontal"
	HorizontalOptions="Center" VerticalOptions="Center"
	IsVisible="true">
		<Label x:Name="quantityLabel" VerticalOptions="Center"
			BindingContext="{x:Reference Name=quantitySlider}"
			Text="{Binding Path=Value, StringFormat='{0:F0} Quantity'}"/>
		<Slider x:Name="quantitySlider" Maximum="4" Minimum="1"/>
</StackLayout>

I also modified the label around the switch, putting the Add list selection on the left (when the switch is off) and the Buy list selection on the right (when the switch is on).

Add-Item-Buy-1  Add-Item-Add-1

By adding another Label to that XAML and modifying the text of the existing one.

<Label x:Name="destinationAddLabel" VerticalOptions="Center" Text="Save to Add list"/>
<Switch x:Name="destinationSwitch"
	IsToggled="true"
	Toggled="OnDestinationSwitchToggled"/>
<Label x:Name="destinationBuyLabel" VerticalOptions="Center" Text="Buy list"/>

Then, in the code behind page, I set the addToBuyList boolean to true when the variable is declared.

public partial class AddItemPage : ContentPage
{
	private List<Item> allItems;
	private bool addToBuyList = true;

Finally, I had to modify the logic in OnDestinationSwitchToggled

void OnDestinationSwitchToggled(object sender, EventArgs args)
{
	if (destinationSwitch.IsToggled != true) {
		quantityControl.IsVisible = false;
		addToBuyList = false;
	} else {
		quantityControl.IsVisible = true;
		addToBuyList = true;
	}
}
This entry was posted in Side Projects, Software Development and tagged , , , . Bookmark the permalink.