first commit

This commit is contained in:
Łukasz Zalewski 2018-12-01 14:28:52 +01:00
parent db30f099c4
commit d2b2063665
42 changed files with 8455 additions and 0 deletions

261
.gitignore vendored Normal file
View File

@ -0,0 +1,261 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
project.fragment.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
#*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Support.V7.App;
using Android.Views;
using Android.Widget;
using Eat.Models;
namespace Eat.Activities
{
[Activity(Label = "MealActivity")]
public class MealsActivity : AppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.meal);
}
}
}

View File

@ -0,0 +1,302 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Globalization;
using Android.App;
using Android.OS;
using Android.Support.V7.App;
using Android.Runtime;
using Android.Widget;
using Android.Content;
using Newtonsoft.Json;
using Eat.Controls;
namespace Eat.Activities
{
[Activity(Label = "Products", MainLauncher = true)]
public class ProductsActivity : AppCompatActivity
{
readonly string path;
EditText addName, addTags, addFat, addCarbs, addProtein, addCost;
Button addAdd;
bool productBeignEdited;
Models.Product productEdited;
ListView list;
TextView name, kcal, fat, carbs, protein, cost;
EditText tags;
ImageButton search;
List<Models.Product> products = new List<Models.Product>(), productsFiltered = new List<Models.Product>();
bool orderedByName, orderedByKcal, orderedByFat, orderedByCarbs, orderedByProtein, orderedByCost;
public ProductsActivity()
{
path = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "products.json");
orderedByName = orderedByKcal = orderedByFat = orderedByCarbs = orderedByProtein = orderedByCost = false;
productBeignEdited = false;
}
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.products);
DeserializeProducts();
InitializeControls();
InitializeAddControls();
}
// Save products
protected override void OnStop()
{
base.OnStop();
SerializeAndSaveProducts();
}
void SerializeAndSaveProducts()
{
string productsSerialized = JsonConvert.SerializeObject(productsFiltered);
File.WriteAllText(path, productsSerialized);
}
void DeserializeProducts()
{
try
{
string productsSerialized = File.ReadAllText(path);
products = JsonConvert.DeserializeObject<List<Models.Product>>(productsSerialized);
productsFiltered = products.ToList();
}
catch (Exception e)
{
// TODO
Console.WriteLine(e.Message);
products = new List<Models.Product>();
for (int i = 0; i < 3; ++i)
{
products.Add(new Models.Product("Product " + i.ToString(), 1.0f, Convert.ToSingle(i), 1.0f, 1.0f, new List<string>()));
}
}
}
void InitializeControls()
{
productsFiltered = products.ToList();
list = FindViewById<ListView>(Resource.Id.products_list);
list.Adapter = new ProductsListViewAdapter(this, productsFiltered);
list.ItemLongClick += (sender, e) =>
{
PopupMenu popup = new PopupMenu(this, e.View);
popup.Menu.Add(Resource.String.product_edit);
popup.Menu.Add(Resource.String.product_delete);
popup.Show();
popup.MenuItemClick += (_sender, _e) =>
{
// Edit
if (_e.Item.TitleFormatted.ToString() == Resources.GetString(Resource.String.product_edit))
{
productBeignEdited = true;
productEdited = productsFiltered[e.Position];
addAdd.Text = "Edit";
addName.Text = productEdited.Name;
addTags.Text = String.Join(" ", productEdited.Tags);
addFat.Text = productEdited.Fat.ToString();
addCarbs.Text = productEdited.Carbs.ToString();
addProtein.Text = productEdited.Protein.ToString();
addCost.Text = productEdited.Cost.ToString();
}
// Remove
else if (_e.Item.TitleFormatted.ToString() == Resources.GetString(Resource.String.product_delete))
{
Models.Product product = productsFiltered[e.Position];
productsFiltered.Remove(product);
products.Remove(product);
list.Adapter = new ProductsListViewAdapter(this, productsFiltered);
}
};
};
tags = FindViewById<EditText>(Resource.Id.products_tags);
search = FindViewById<ImageButton>(Resource.Id.products_search);
search.Click += (sender, e) =>
{
if (tags.Text == "")
{
productsFiltered = products.ToList();
}
else
{
productsFiltered = new List<Models.Product>();
List<string> tagsSeparated = tags.Text.Split(' ').ToList();
foreach (var tag in tagsSeparated)
{
productsFiltered.AddRange(products.Where(x => x.Name.ToLower().Contains(tag.ToLower()) || x.Tags.Contains(tag.ToLower())));
}
}
list.Adapter = new ProductsListViewAdapter(this, productsFiltered);
};
name = FindViewById<TextView>(Resource.Id.products_name);
name.Click += (sender, e) =>
{
if (!orderedByName)
{
productsFiltered = productsFiltered.OrderBy(x => x.Name).ToList();
}
else
{
productsFiltered = productsFiltered.OrderByDescending(x => x.Name).ToList();
}
orderedByName = !orderedByName;
list.Adapter = new ProductsListViewAdapter(this, productsFiltered);
};
kcal = FindViewById<TextView>(Resource.Id.products_kcal);
kcal.Click += (sender, e) =>
{
if (!orderedByKcal)
{
productsFiltered = productsFiltered.OrderBy(x => x.Kcal).ToList();
}
else
{
productsFiltered = productsFiltered.OrderByDescending(x => x.Kcal).ToList();
}
orderedByKcal = !orderedByKcal;
list.Adapter = new ProductsListViewAdapter(this, productsFiltered);
};
fat = FindViewById<TextView>(Resource.Id.products_fat);
fat.Click += (sender, e) =>
{
if (!orderedByFat)
{
productsFiltered = productsFiltered.OrderBy(x => x.Fat).ToList();
}
else
{
productsFiltered = productsFiltered.OrderByDescending(x => x.Fat).ToList();
}
orderedByFat = !orderedByFat;
list.Adapter = new ProductsListViewAdapter(this, productsFiltered);
};
carbs = FindViewById<TextView>(Resource.Id.products_carbs);
carbs.Click += (sender, e) =>
{
if (!orderedByCarbs)
{
productsFiltered = productsFiltered.OrderBy(x => x.Carbs).ToList();
}
else
{
productsFiltered = productsFiltered.OrderByDescending(x => x.Carbs).ToList();
}
orderedByCarbs = !orderedByCarbs;
list.Adapter = new ProductsListViewAdapter(this, productsFiltered);
};
protein = FindViewById<TextView>(Resource.Id.products_protein);
protein.Click += (sender, e) =>
{
if (!orderedByProtein)
{
productsFiltered = productsFiltered.OrderBy(x => x.Protein).ToList();
}
else
{
productsFiltered = productsFiltered.OrderByDescending(x => x.Protein).ToList();
}
orderedByProtein = !orderedByProtein;
list.Adapter = new ProductsListViewAdapter(this, productsFiltered);
};
cost = FindViewById<TextView>(Resource.Id.products_cost);
cost.Click += (sender, e) =>
{
if (!orderedByCost)
{
productsFiltered = productsFiltered.OrderBy(x => x.Cost).ToList();
}
else
{
productsFiltered = productsFiltered.OrderByDescending(x => x.Cost).ToList();
}
orderedByCost = !orderedByCost;
list.Adapter = new ProductsListViewAdapter(this, productsFiltered);
};
}
void InitializeAddControls()
{
addName = FindViewById<EditText>(Resource.Id.products_add_name);
addTags = FindViewById<EditText>(Resource.Id.products_add_tags);
addFat = FindViewById<EditText>(Resource.Id.products_add_fat);
addCarbs = FindViewById<EditText>(Resource.Id.products_add_carbs);
addProtein = FindViewById<EditText>(Resource.Id.products_add_protein);
addCost = FindViewById<EditText>(Resource.Id.products_add_cost);
addAdd = FindViewById<Button>(Resource.Id.products_add_add);
addAdd.Click += (sender, e) =>
{
if (addName.Text != "" && addFat.Text != "" && addCarbs.Text != "" && addProtein.Text != "" && addCost.Text != "")
{
if (productBeignEdited)
{
products.Remove(productEdited);
productsFiltered.Remove(productEdited);
productBeignEdited = false;
addAdd.Text = "Add";
}
Models.Product product;
List<string> tags;
if (addTags.Text != "")
{
tags = addTags.Text.Split(' ').ToList();
}
else
{
tags = new List<string>();
}
product = new Models.Product(addName.Text,
Math.Round(double.Parse(addCost.Text, CultureInfo.InvariantCulture), 2),
Math.Round(double.Parse(addFat.Text, CultureInfo.InvariantCulture), 2),
Math.Round(double.Parse(addCarbs.Text, CultureInfo.InvariantCulture), 2),
Math.Round(double.Parse(addProtein.Text, CultureInfo.InvariantCulture), 2),
tags);
products.Add(product);
productsFiltered.Add(product);
addName.Text = addTags.Text = addFat.Text = addCarbs.Text = addProtein.Text = addCost.Text = "";
list.Adapter = new ProductsListViewAdapter(this, productsFiltered);
}
};
}
}
}

19
Assets/AboutAssets.txt Normal file
View File

@ -0,0 +1,19 @@
Any raw assets you want to be deployed with your application can be placed in
this directory (and child directories) and given a Build Action of "AndroidAsset".
These files will be deployed with you package and will be accessible using Android's
AssetManager, like this:
public class ReadAsset : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
InputStream input = Assets.Open ("my_asset.txt");
}
}
Additionally, some Android functions will automatically load asset files:
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");

View File

@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Eat.Models;
namespace Eat.Controls
{
class ProductsListViewAdapter : BaseAdapter<Product>
{
public List<Product> Products
{
get; set;
}
readonly private Context context;
public ProductsListViewAdapter(Context context, List<Product> items)
{
this.context = context;
Products = items;
}
public override int Count => Products.Count;
public override long GetItemId(int position)
{
return position;
}
public override Product this[int position] => Products[position];
public override View GetView(int position, View convertView, ViewGroup parent)
{
View row = convertView;
if (row == null)
{
row = LayoutInflater.From(context).Inflate(Resource.Layout.products_row, null, false);
}
void FillTextView(int resourceId, string text, Android.Graphics.Color color)
{
var textView = row.FindViewById<TextView>(resourceId);
textView.Text = text;
textView.SetTextColor(color);
}
FillTextView(Resource.Id.products_row_name, Products[position].Name, new Android.Graphics.Color(10, 10, 10));
FillTextView(Resource.Id.products_row_kcal, Products[position].Kcal.ToString(), new Android.Graphics.Color(255, 255, 0));
FillTextView(Resource.Id.products_row_fat, Products[position].Fat.ToString(), new Android.Graphics.Color(255, 0, 255));
FillTextView(Resource.Id.products_row_carbs, Products[position].Carbs.ToString(), new Android.Graphics.Color(0, 255, 255));
FillTextView(Resource.Id.products_row_protein, Products[position].Protein.ToString(), new Android.Graphics.Color(100, 100, 20));
FillTextView(Resource.Id.products_row_cost, Products[position].Cost.ToString(), new Android.Graphics.Color(150, 150, 150));
return row;
}
}
}

66
Database.cs Normal file
View File

@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Eat.Models;
namespace Eat
{
class Database
{
public User User
{
get;
set;
}
// Do DaysPast dodac jakis limit, samemu ustawialny albo cos max do przechowywania, zeby ta lista nie przetrzymywala 10lat. Chociaż jeszcze pomyśle
// Wtedy mógłbym za kązdym razem ladowac historie, bo nie bedzie za duza i nie trzymac nic w temp tak zrobie.
public List<Tuple<Day, Product>> DaysPast { get; set; } = new List<Tuple<Day, Product>>();
// Jeśli dzień z Days już minął to dodaj go do DaysPast z Product (zapotrzebowaniem), jakie jest w momencie zapisu
// Usuń go z Days
public List<Day> Days { get; set; } = new List<Day>();
public List<Meal> Meals { get; set; } = new List<Meal>();
public List<Product> Products { get; set; } = new List<Product>();
// Jedyna mozliwosc to zaladowanie z pliku, jesli nie ma pliku i user 1 raz sie loguje to i tak w innym miejscu musza
// zosatac przygotowane puste listy i dane
public Database(User user, List<Tuple<Day, Product>> daysPast, List<Day> days, List<Meal> meals, List<Product> products)
{
User = user;
DaysPast = daysPast;
Days = days;
Meals = meals;
Products = products;
}
// Sprobuj ogarnac to zeby wykonywalo sie to tylko przy starcie apki
public void PassDays()
{
foreach (var day in Days)
{
// Prawdopodobnie to znaczy ze dzien juz minal
if (DateTime.Now.Subtract(day.Date) > TimeSpan.Zero)
{
DaysPast.Add(new Tuple<Day, Product>(day, User));
Days.Remove(day);
}
// Jesli kolejny dzien jeszcze nie minal
else
{
break;
}
}
}
}
}

134
Eat.csproj Normal file
View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{16792D5B-245F-4FD6-9277-38B7F69BF8E6}</ProjectGuid>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TemplateGuid>{122416d6-6b49-4ee2-a1e8-b825f31c79fe}</TemplateGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Eat</RootNamespace>
<AssemblyName>Eat</AssemblyName>
<FileAlignment>512</FileAlignment>
<AndroidApplication>True</AndroidApplication>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidResgenClass>Resource</AndroidResgenClass>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v8.1</TargetFrameworkVersion>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>
<AndroidLinkMode>None</AndroidLinkMode>
<EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidManagedSymbols>true</AndroidManagedSymbols>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Mono.Android" />
</ItemGroup>
<ItemGroup>
<Compile Include="Activities\MealsActivity.cs" />
<Compile Include="Activities\ProductsActivity.cs" />
<Compile Include="Controls\ProductsListViewAdapter.cs" />
<Compile Include="Database.cs" />
<Compile Include="Models\Day.cs" />
<Compile Include="Models\Meal.cs" />
<Compile Include="Models\Product.cs" />
<Compile Include="Models\User.cs" />
<Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
<None Include="Properties\AndroidManifest.xml" />
<None Include="Assets\AboutAssets.txt" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\values\colors.xml" />
<AndroidResource Include="Resources\values\ic_launcher_background.xml" />
<AndroidResource Include="Resources\values\strings.xml" />
<AndroidResource Include="Resources\values\styles.xml" />
<AndroidResource Include="Resources\mipmap-anydpi-v26\ic_launcher.xml" />
<AndroidResource Include="Resources\mipmap-anydpi-v26\ic_launcher_round.xml" />
<AndroidResource Include="Resources\mipmap-hdpi\ic_launcher.png" />
<AndroidResource Include="Resources\mipmap-hdpi\ic_launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-hdpi\ic_launcher_round.png" />
<AndroidResource Include="Resources\mipmap-mdpi\ic_launcher.png" />
<AndroidResource Include="Resources\mipmap-mdpi\ic_launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-mdpi\ic_launcher_round.png" />
<AndroidResource Include="Resources\mipmap-xhdpi\ic_launcher.png" />
<AndroidResource Include="Resources\mipmap-xhdpi\ic_launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-xhdpi\ic_launcher_round.png" />
<AndroidResource Include="Resources\mipmap-xxhdpi\ic_launcher.png" />
<AndroidResource Include="Resources\mipmap-xxhdpi\ic_launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-xxhdpi\ic_launcher_round.png" />
<AndroidResource Include="Resources\mipmap-xxxhdpi\ic_launcher.png" />
<AndroidResource Include="Resources\mipmap-xxxhdpi\ic_launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-xxxhdpi\ic_launcher_round.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json">
<Version>11.0.2</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Design" Version="27.0.2.1" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\layout\products.axml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateGeneratedFiles</Generator>
</AndroidResource>
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\layout\products_row.axml">
<SubType>Designer</SubType>
</AndroidResource>
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\lupa.png">
<Generator>MSBuild:UpdateGeneratedFiles</Generator>
</AndroidResource>
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\layout\meals.axml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateGeneratedFiles</Generator>
</AndroidResource>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

9
Eat.csproj.user Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SelectedDevice>Samsung SM-G960F</SelectedDevice>
<DefaultDevice>Android_Accelerated_x86_Nougat</DefaultDevice>
<AndroidDesignerPreferredTheme>AppTheme</AndroidDesignerPreferredTheme>
<AndroidDesignerPreferredDevice>Nexus 4</AndroidDesignerPreferredDevice>
</PropertyGroup>
</Project>

56
Models/Day.cs Normal file
View File

@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Newtonsoft.Json;
namespace Eat.Models
{
class Day : Product
{
[JsonProperty]
internal List<Tuple<Meal, double>> Meals { get; private set; } = new List<Tuple<Meal, double>>();
[JsonProperty]
public DateTime Date { get; private set; }
public Day(DateTime date)
{
this.Date = date;
}
public Day(DateTime date, List<Tuple<Meal, double>> meals)
{
this.Date = date;
Meals = meals;
}
public void AddMeal(Meal meal, double portion)
{
Meals.Add(new Tuple<Meal, double>(meal, portion));
}
public override void CalculateElements()
{
Cost = 0.0;
Kcal = 0;
Fat = Carbs = Protein = 0.0;
foreach (var meal in Meals)
{
Cost += meal.Item1.Cost * meal.Item2;
Kcal += Convert.ToInt32(meal.Item1.Kcal * meal.Item2);
Fat += meal.Item1.Fat * meal.Item2;
Carbs += meal.Item1.Carbs * meal.Item2;
Protein += meal.Item1.Protein * meal.Item2;
}
}
}
}

78
Models/Meal.cs Normal file
View File

@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Newtonsoft.Json;
namespace Eat.Models
{
class Meal : Product
{
[JsonProperty]
internal List<Tuple<Product, double>> Products { get; private set; } = new List<Tuple<Product, double>>();
[JsonProperty]
public int PrepTime
{
get;
private set;
}
public Meal(string name, int prepTime)
{
Name = name;
PrepTime = prepTime;
}
public Meal(string name, int prepTime, List<Tuple<Product, double>> products)
{
Name = name;
PrepTime = prepTime;
Products = products;
}
public void AddProduct(Product product)
{
Products.Add(new Tuple<Product, double>(product, 1.0f));
}
public void AddProduct(Product product, double ratio)
{
Products.Add(new Tuple<Product, double>(product, ratio));
}
public override void CalculateElements()
{
Cost = 0.0;
Kcal = 0;
Fat = Carbs = Protein = 0.0;
foreach (var product in Products)
{
Cost += product.Item1.Cost;
Kcal += Convert.ToInt32(product.Item1.Kcal * product.Item2);
Fat += product.Item1.Fat * product.Item2;
Carbs += product.Item1.Carbs * product.Item2;
Protein += product.Item1.Protein * product.Item2;
}
}
public string GetProducts()
{
string result = "";
foreach (var product in Products)
{
result += product.Item1.Name + " ";
}
return result;
}
}
}

89
Models/Product.cs Normal file
View File

@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Newtonsoft.Json;
namespace Eat.Models
{
class Product
{
[JsonProperty]
public string Name
{
get; protected set;
}
[JsonProperty]
public double Cost
{
get; protected set;
}
[JsonProperty]
public int Kcal
{
get; protected set;
}
[JsonProperty]
public double Fat
{
get; protected set;
}
[JsonProperty]
public double Carbs
{
get; protected set;
}
[JsonProperty]
public double Protein
{
get; protected set;
}
// Make sure they are always written in lowercase
[JsonProperty]
public List<string> Tags
{
get; protected set;
} = new List<string>();
public Product()
{
Name = "Unknown";
}
public Product(string name, double cost, double fat, double carbs, double protein, List<string> tags)
{
Name = name;
Cost = cost;
Kcal = Convert.ToInt32((fat * 9) + (carbs * 4) + (protein * 4));
Fat = fat;
Carbs = carbs;
Protein = protein;
Tags = tags;
}
public string Serialize()
{
return JsonConvert.SerializeObject(this);
}
public virtual void CalculateElements()
{
throw new Exception("Don't call this method from object of class Product");
}
}
}

193
Models/User.cs Normal file
View File

@ -0,0 +1,193 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Newtonsoft.Json;
namespace Eat.Models
{
enum Sex
{
Male, Female
};
enum ActivityLevel
{
VeryLow, Low, Medium, High, VeryHigh
};
enum Goal
{
Reduce, Stay, Gain
}
class User : Product
{
[JsonProperty]
public Sex Sex
{
get;
set;
}
[JsonProperty]
public ActivityLevel ActivityLevel
{
get; set;
}
[JsonProperty]
public Goal Goal
{
get;
set;
}
[JsonProperty]
public double Weight
{
get;
set;
}
[JsonProperty]
public int Height
{
get;
set;
}
[JsonProperty]
public DateTime Birthday
{
get => Birthday;
set
{
Birthday = value;
Age = (DateTime.Now.Subtract(Birthday).Days / 365);
}
}
[JsonProperty]
public int Age
{
get;
private set;
}
[JsonProperty]
public double FatRatio
{
get;
private set;
}
[JsonProperty]
public double CarbsRatio
{
get;
private set;
}
[JsonProperty]
public double ProteinRatio
{
get;
private set;
}
static readonly Dictionary<ActivityLevel, double> ActivityFactor = new Dictionary<ActivityLevel, double>
{
{ActivityLevel.VeryLow, 1.2},
{ActivityLevel.Low, 1.375},
{ActivityLevel.Medium, 1.55},
{ActivityLevel.High, 1.725},
{ActivityLevel.VeryHigh, 1.9}
};
public User(Sex sex, ActivityLevel activityLevel, Goal goal, double weight, int height, DateTime birthday)
{
Sex = sex;
ActivityLevel = activityLevel;
Goal = Goal;
Weight = weight;
Height = height;
Birthday = birthday;
if (Goal == Goal.Reduce)
{
FatRatio = 0.3;
CarbsRatio = 0.4;
ProteinRatio = 0.3;
}
else if (Goal == Goal.Stay)
{
FatRatio = 0.275;
CarbsRatio = 0.5;
ProteinRatio = 0.225;
}
else
{
FatRatio = 0.2;
CarbsRatio = 0.6;
ProteinRatio = 0.2;
}
}
public User(Sex sex, ActivityLevel activityLevel, Goal goal, double weight, int height, DateTime birthday, double fatRatio, double carbsRatio, double proteinRatio)
{
Sex = sex;
ActivityLevel = ActivityLevel;
Goal = goal;
Weight = weight;
Height = height;
Birthday = birthday;
FatRatio = fatRatio;
CarbsRatio = carbsRatio;
ProteinRatio = proteinRatio;
}
public override void CalculateElements()
{
// Kcal
//
//
// Basic calculation
//
Kcal = Convert.ToInt32((10 * Weight) + (6.25 * Height) - (4.92 * Age));
// Gender
//
if (Sex == Sex.Male)
{
Kcal += 5;
}
else
{
Kcal -= 161;
}
// ActivityFactor
//
Kcal = Convert.ToInt32(Kcal * ActivityFactor[ActivityLevel]);
// Goal
//
if (Goal == Goal.Reduce)
{
Kcal -= 250;
}
else if (Goal == Goal.Gain)
{
Kcal += 250;
}
// Elements
//
//
Fat = Kcal / 9.0 * FatRatio;
Carbs = Kcal / 4.0 * CarbsRatio;
Protein = Kcal / 4.0 * ProteinRatio;
}
}
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
package="Eat.Eat">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="27" />
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme">
</application>
</manifest>

View File

@ -0,0 +1,30 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Android.App;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Eat")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Eat")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,44 @@
Images, layout descriptions, binary blobs and string dictionaries can be included
in your application as resource files. Various Android APIs are designed to
operate on the resource IDs instead of dealing with images, strings or binary blobs
directly.
For example, a sample Android app that contains a user interface layout (main.axml),
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
would keep its resources in the "Resources" directory of the application:
Resources/
drawable/
icon.png
layout/
main.axml
values/
strings.xml
In order to get the build system to recognize Android resources, set the build action to
"AndroidResource". The native Android APIs do not operate directly with filenames, but
instead operate on resource IDs. When you compile an Android application that uses resources,
the build system will package the resources for distribution and generate a class called "R"
(this is an Android convention) that contains the tokens for each one of the resources
included. For example, for the above Resources layout, this is what the R class would expose:
public class R {
public class drawable {
public const int icon = 0x123;
}
public class layout {
public const int main = 0x456;
}
public class strings {
public const int first_string = 0xabc;
public const int second_string = 0xbcd;
}
}
You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
to reference the layout/main.axml file, or R.strings.first_string to reference the first
string in the dictionary file values/strings.xml.

6626
Resources/Resource.designer.cs generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:thickness="2dp"
android:shape="rectangle">
<stroke android:width="1dp"
android:color="#555555"/>
</shape>

BIN
Resources/drawable/lupa.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

173
Resources/layout/meals.axml Normal file
View File

@ -0,0 +1,173 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:minWidth="25px"
android:minHeight="25px"
android:layout_height="match_parent">
<EditText
android:layout_width="344dp"
android:layout_height="wrap_content"
android:id="@+id/meals_products_tags"
android:singleLine="true"
android:hint="..."
android:textSize="15dp" />
<ImageButton
android:src="@drawable/lupa"
android:layout_width="match_parent"
android:layout_height="40dp"
android:scaleType="centerInside"
android:layout_toRightOf="@id/meals_products_tags"
android:id="@+id/meals_products_search"/>
<TextView
android:layout_width="144dp"
android:layout_height="wrap_content"
android:layout_below="@id/meals_products_tags"
android:id="@+id/meals_products_name"
android:text="Name"
android:textSize="14dp"
android:singleLine="true"
android:clickable="true" />
<TextView
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_below="@id/meals_products_tags"
android:layout_toRightOf="@id/meals_products_name"
android:id="@+id/meals_products_kcal"
android:text="Kcal"
android:textSize="14dp"
android:singleLine="true"
android:clickable="true" />
<TextView
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_below="@id/meals_products_tags"
android:layout_toRightOf="@id/meals_products_kcal"
android:id="@+id/meals_products_fat"
android:text="Fat"
android:textSize="14dp"
android:singleLine="true"
android:clickable="true" />
<TextView
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_below="@id/meals_products_tags"
android:layout_toRightOf="@id/meals_products_fat"
android:id="@+id/meals_products_carbs"
android:text="Carbs"
android:textStyle="normal"
android:textSize="14dp"
android:singleLine="true"
android:clickable="true" />
<TextView
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_below="@id/meals_products_tags"
android:layout_toRightOf="@id/meals_products_carbs"
android:id="@+id/meals_products_protein"
android:text="Protein"
android:textSize="14dp"
android:singleLine="true"
android:clickable="true" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/meals_products_tags"
android:layout_toRightOf="@id/meals_products_protein"
android:id="@+id/meals_products_cost"
android:text="Cost"
android:textSize="14dp"
android:singleLine="true"
android:clickable="true" />
<ListView
android:minWidth="25px"
android:minHeight="25px"
android:layout_below="@id/meals_products_name"
android:layout_width="match_parent"
android:layout_height="200dp"
android:id="@+id/meals_products_list" />
<android.support.v4.widget.Space
android:layout_width="wrap_content"
android:layout_height="16dp"
android:layout_below="@id/meals_products_list"
android:id="@+id/meals_space" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/meals_space"
android:id="@+id/meals_used_products_header"
android:text="Used products"
android:textSize="16dp"
android:singleLine="true"
android:textAlignment="center" />
<ListView
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:layout_below="@id/meals_used_products_header"
android:id="@+id/meals_used_products_list" />
<EditText
android:layout_width="144dp"
android:layout_height="wrap_content"
android:layout_below="@id/meals_used_products_list"
android:id="@+id/meals_completed_name"
android:hint="Name"
android:textSize="14dp"
android:singleLine="true"
android:clickable="true" />
<TextView
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_below="@id/meals_completed_name"
android:id="@+id/meals_completed_kcal"
android:text="Kcal"
android:textSize="14dp"
android:singleLine="true"
android:clickable="true" />
<TextView
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_below="@id/meals_completed_kcal"
android:id="@+id/meals_completed_fat"
android:text="Fat"
android:textSize="14dp"
android:singleLine="true"
android:clickable="true" />
<TextView
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_below="@id/meals_completed_fat"
android:id="@+id/meals_completed_carbs"
android:text="Carbs"
android:textStyle="normal"
android:textSize="14dp"
android:singleLine="true"
android:clickable="true" />
<TextView
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_below="@id/meals_completed_carbs"
android:id="@+id/meals_completed_protein"
android:text="Protein"
android:textSize="14dp"
android:singleLine="true"
android:clickable="true" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/meals_completed_protein"
android:id="@+id/meals_completed_cost"
android:text="Cost"
android:textSize="14dp"
android:singleLine="true"
android:clickable="true" />
<Button
android:text="Add"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/meals_completed_cost"
android:id="@+id/meals_completed_add" />
</RelativeLayout>

View File

@ -0,0 +1,163 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:minWidth="25px"
android:minHeight="25px"
android:layout_height="match_parent">
<EditText
android:layout_width="192dp"
android:layout_height="wrap_content"
android:id="@+id/products_add_name"
android:textSize="15dp"
android:hint="Name"
android:singleLine="true" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/products_add_name"
android:id="@+id/products_add_tags"
android:textSize="15dp"
android:hint="Tags"
android:singleLine="true" />
<EditText
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_below="@id/products_add_name"
android:id="@+id/products_add_fat"
android:textSize="15dp"
android:hint="Fat"
android:singleLine="true"
android:numeric="decimal"
android:maxLength="5" />
<EditText
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_below="@id/products_add_name"
android:layout_toRightOf="@id/products_add_fat"
android:id="@+id/products_add_carbs"
android:textSize="15dp"
android:hint="Carbs"
android:singleLine="true"
android:numeric="decimal"
android:maxLength="5" />
<EditText
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_below="@id/products_add_name"
android:layout_toRightOf="@id/products_add_carbs"
android:id="@+id/products_add_protein"
android:textSize="15dp"
android:hint="Protein"
android:singleLine="true"
android:numeric="decimal"
android:maxLength="5" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/products_add_name"
android:layout_toRightOf="@id/products_add_protein"
android:id="@+id/products_add_cost"
android:textSize="15dp"
android:hint="Cost"
android:singleLine="true"
android:numeric="decimal"
android:maxLength="5" />
<Button
android:text="add"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/products_add_fat"
android:id="@+id/products_add_add" />
<android.support.v4.widget.Space
android:layout_width="wrap_content"
android:layout_height="32dp"
android:layout_below="@id/products_add_add"
android:id="@+id/products_space" />
<EditText
android:layout_width="344dp"
android:layout_height="wrap_content"
android:id="@+id/products_tags"
android:layout_below="@id/products_space"
android:singleLine="true"
android:hint="..."
android:textSize="15dp" />
<ImageButton
android:src="@drawable/lupa"
android:layout_width="match_parent"
android:layout_height="40dp"
android:scaleType="centerInside"
android:layout_below="@id/products_space"
android:layout_toRightOf="@id/products_tags"
android:id="@+id/products_search"/>
<TextView
android:layout_width="144dp"
android:layout_height="wrap_content"
android:layout_below="@id/products_tags"
android:id="@+id/products_name"
android:text="Name"
android:textSize="14dp"
android:singleLine="true"
android:clickable="true" />
<TextView
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_below="@id/products_tags"
android:layout_toRightOf="@id/products_name"
android:id="@+id/products_kcal"
android:text="Kcal"
android:textSize="14dp"
android:singleLine="true"
android:clickable="true" />
<TextView
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_below="@id/products_tags"
android:layout_toRightOf="@id/products_kcal"
android:id="@+id/products_fat"
android:text="Fat"
android:textSize="14dp"
android:singleLine="true"
android:clickable="true" />
<TextView
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_below="@id/products_tags"
android:layout_toRightOf="@id/products_fat"
android:id="@+id/products_carbs"
android:text="Carbs"
android:textStyle="normal"
android:textSize="14dp"
android:singleLine="true"
android:clickable="true" />
<TextView
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_below="@id/products_tags"
android:layout_toRightOf="@id/products_carbs"
android:id="@+id/products_protein"
android:text="Protein"
android:textSize="14dp"
android:singleLine="true"
android:clickable="true" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/products_tags"
android:layout_toRightOf="@id/products_protein"
android:id="@+id/products_cost"
android:text="Cost"
android:textSize="14dp"
android:singleLine="true"
android:clickable="true" />
<ListView
android:minWidth="25px"
android:minHeight="25px"
android:layout_below="@id/products_name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/products_list" />
</RelativeLayout>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minWidth="25px"
android:minHeight="25px">
<TextView
android:layout_width="144dp"
android:layout_height="wrap_content"
android:id="@+id/products_row_name"
android:hint="Name"
android:textSize="14dp"
android:singleLine="true" />
<TextView
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/products_row_name"
android:id="@+id/products_row_kcal"
android:hint="Kcal"
android:textSize="14dp"
android:singleLine="true" />
<TextView
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/products_row_kcal"
android:id="@+id/products_row_fat"
android:hint="Fat"
android:textSize="14dp"
android:singleLine="true" />
<TextView
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/products_row_fat"
android:id="@+id/products_row_carbs"
android:hint="Carbs"
android:textStyle="normal"
android:textSize="14dp"
android:singleLine="true" />
<TextView
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/products_row_carbs"
android:id="@+id/products_row_protein"
android:hint="Protein"
android:textSize="14dp"
android:singleLine="true" />
<TextView
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/products_row_protein"
android:id="@+id/products_row_cost"
android:hint="Cost"
android:textSize="14dp"
android:singleLine="true" />
</RelativeLayout>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 958 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#2c3e50</color>
<color name="colorPrimaryDark">#1B3147</color>
<color name="colorAccent">#3498db</color>
</resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#2C3E50</color>
</resources>

View File

@ -0,0 +1,6 @@
<resources>
<string name="app_name">Eat!</string>
<string name="action_settings">Settings</string>
<string name="product_edit">Edit</string>
<string name="product_delete">Delete</string>
</resources>

View File

@ -0,0 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>