diff --git a/MonoStockPortfolio.Core/MonoStockPortfolio.Core.csproj b/MonoStockPortfolio.Core/MonoStockPortfolio.Core.csproj index ef8cf74..1626d04 100644 --- a/MonoStockPortfolio.Core/MonoStockPortfolio.Core.csproj +++ b/MonoStockPortfolio.Core/MonoStockPortfolio.Core.csproj @@ -48,7 +48,6 @@ - diff --git a/MonoStockPortfolio.Core/PortfolioRepositories/FakePortfolioRepository.cs b/MonoStockPortfolio.Core/PortfolioRepositories/FakePortfolioRepository.cs deleted file mode 100644 index 2b2d57f..0000000 --- a/MonoStockPortfolio.Core/PortfolioRepositories/FakePortfolioRepository.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using MonoStockPortfolio.Entities; - -namespace MonoStockPortfolio.Core.PortfolioRepositories -{ - public class FakePortfolioRepository : IPortfolioRepository - { - public IList GetAllPortfolios() - { - return new List {new Portfolio(1) {Name = "test portfolio"}}; - } - - public void SavePortfolio(Portfolio portfolio) - { - ; - } - - public void DeletePortfolioById(int portfolioId) - { - ; - } - - public IList GetAllPositions(long portfolioId) - { - var list = new List(); - list.Add(new Position(1) { ContainingPortfolioID = 1, PricePerShare = 5, Shares = 280, Ticker = "XIN"}); - list.Add(new Position(2) { ContainingPortfolioID = 1, PricePerShare = 3, Shares = 100, Ticker = "DENN"}); - list.Add(new Position(3) { ContainingPortfolioID = 1, PricePerShare = 25, Shares = 300, Ticker = "MSFT"}); - list.Add(new Position(4) { ContainingPortfolioID = 1, PricePerShare = 590.18M, Shares = 400, Ticker = "GOOG"}); - list.Add(new Position(5) { ContainingPortfolioID = 1, PricePerShare = 330.10M, Shares = 500, Ticker = "AAPL"}); - list.Add(new Position(6) { ContainingPortfolioID = 1, PricePerShare = 15.10M, Shares = 600, Ticker = "YHOO"}); - return list; - } - - public Portfolio GetPortfolioById(long portfolioId) - { - return GetAllPortfolios().First(); - } - - public void SavePosition(Position position) - { - ; - } - - public Portfolio GetPortfolioByName(string portfolioName) - { - return GetAllPortfolios().First(p => p.Name == portfolioName); - } - } -} \ No newline at end of file diff --git a/MonoStockPortfolio.Core/Services/PortfolioService.cs b/MonoStockPortfolio.Core/Services/PortfolioService.cs index af9cce3..b58d2e1 100644 --- a/MonoStockPortfolio.Core/Services/PortfolioService.cs +++ b/MonoStockPortfolio.Core/Services/PortfolioService.cs @@ -14,7 +14,7 @@ namespace MonoStockPortfolio.Core.Services private readonly IPortfolioRepository _portRepo; private readonly IStockDataProvider _stockRepo; - public PortfolioService(Context context) : this(new FakePortfolioRepository(), + public PortfolioService(Context context) : this(new AndroidSqlitePortfolioRepository(context), new YahooStockDataProvider()) { } diff --git a/MonoStockPortfolio/Activites/PortfolioActivity.cs b/MonoStockPortfolio/Activites/PortfolioActivity.cs index 8fa212a..ba4dad1 100644 --- a/MonoStockPortfolio/Activites/PortfolioActivity.cs +++ b/MonoStockPortfolio/Activites/PortfolioActivity.cs @@ -4,9 +4,7 @@ using System.Linq; using System.Threading; using Android.App; using Android.Content; -using Android.Content.Res; using Android.OS; -using Android.Util; using Android.Views; using Android.Widget; using MonoStockPortfolio.Core; @@ -129,7 +127,7 @@ namespace MonoStockPortfolio.Activites var cell = new TextView(Context); cell.Text = item.Items[stockDataItem]; cell.SetWidth(columnWidth); - row.AddView(cell); + row.AddView(cell, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent)); } return row; } diff --git a/MonoStockPortfolio/Framework/IoCAttribute.cs b/MonoStockPortfolio/Framework/IoCAttribute.cs index ff55fc8..efb1cff 100644 --- a/MonoStockPortfolio/Framework/IoCAttribute.cs +++ b/MonoStockPortfolio/Framework/IoCAttribute.cs @@ -47,8 +47,7 @@ namespace MonoStockPortfolio.Framework { var map = new Dictionary>(); map.Add(typeof(IPortfolioService), () => new PortfolioService(_context)); - //map.Add(typeof(IPortfolioRepository), () => new AndroidSqlitePortfolioRepository(_context)); - map.Add(typeof(IPortfolioRepository), () => new FakePortfolioRepository()); + map.Add(typeof(IPortfolioRepository), () => new AndroidSqlitePortfolioRepository(_context)); return map; } diff --git a/MonoStockPortfolio/Resources/Resource.Designer.cs b/MonoStockPortfolio/Resources/Resource.Designer.cs index 5043e4e..3c6bea7 100644 --- a/MonoStockPortfolio/Resources/Resource.Designer.cs +++ b/MonoStockPortfolio/Resources/Resource.Designer.cs @@ -68,7 +68,10 @@ namespace MonoStockPortfolio public const int portfolioName = 2131034112; // aapt resource value: 0x7f050009 - public const int quoteListview = 2131034121; + public const int quoteHeaderLayout = 2131034121; + + // aapt resource value: 0x7f05000a + public const int quoteListview = 2131034122; private id() { diff --git a/MonoStockPortfolio/Resources/layout/portfolio.xml b/MonoStockPortfolio/Resources/layout/portfolio.xml index 1d4d6d0..f20a99c 100644 --- a/MonoStockPortfolio/Resources/layout/portfolio.xml +++ b/MonoStockPortfolio/Resources/layout/portfolio.xml @@ -4,28 +4,18 @@ android:layout_width="fill_parent" android:layout_height="fill_parent"> - +