mirror of
https://github.com/mgroves/MonodroidStockPortfolio.git
synced 2024-12-25 11:21:12 +00:00
only the first two 'rows' appear visible...
This commit is contained in:
parent
5d2d664833
commit
c07f913502
8 changed files with 58 additions and 19 deletions
|
@ -48,6 +48,7 @@
|
||||||
<Compile Include="DictionaryExtensions.cs" />
|
<Compile Include="DictionaryExtensions.cs" />
|
||||||
<Compile Include="EnumExtensions.cs" />
|
<Compile Include="EnumExtensions.cs" />
|
||||||
<Compile Include="PortfolioRepositories\AndroidSqlitePortfolioRepository.cs" />
|
<Compile Include="PortfolioRepositories\AndroidSqlitePortfolioRepository.cs" />
|
||||||
|
<Compile Include="PortfolioRepositories\FakePortfolioRepository.cs" />
|
||||||
<Compile Include="PortfolioRepositories\IPortfolioRepository.cs" />
|
<Compile Include="PortfolioRepositories\IPortfolioRepository.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Services\IPortfolioService.cs" />
|
<Compile Include="Services\IPortfolioService.cs" />
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using MonoStockPortfolio.Entities;
|
||||||
|
|
||||||
|
namespace MonoStockPortfolio.Core.PortfolioRepositories
|
||||||
|
{
|
||||||
|
public class FakePortfolioRepository : IPortfolioRepository
|
||||||
|
{
|
||||||
|
public IList<Portfolio> GetAllPortfolios()
|
||||||
|
{
|
||||||
|
return new List<Portfolio> {new Portfolio(1) {Name = "test portfolio"}};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SavePortfolio(Portfolio portfolio)
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeletePortfolioById(int portfolioId)
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IList<Position> GetAllPositions(long portfolioId)
|
||||||
|
{
|
||||||
|
var list = new List<Position>();
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,7 +14,7 @@ namespace MonoStockPortfolio.Core.Services
|
||||||
private readonly IPortfolioRepository _portRepo;
|
private readonly IPortfolioRepository _portRepo;
|
||||||
private readonly IStockDataProvider _stockRepo;
|
private readonly IStockDataProvider _stockRepo;
|
||||||
|
|
||||||
public PortfolioService(Context context) : this(new AndroidSqlitePortfolioRepository(context),
|
public PortfolioService(Context context) : this(new FakePortfolioRepository(),
|
||||||
new YahooStockDataProvider())
|
new YahooStockDataProvider())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ using MonoStockPortfolio.Core;
|
||||||
using MonoStockPortfolio.Core.Services;
|
using MonoStockPortfolio.Core.Services;
|
||||||
using MonoStockPortfolio.Entities;
|
using MonoStockPortfolio.Entities;
|
||||||
using MonoStockPortfolio.Framework;
|
using MonoStockPortfolio.Framework;
|
||||||
|
using Orientation = Android.Widget.Orientation;
|
||||||
|
|
||||||
namespace MonoStockPortfolio.Activites
|
namespace MonoStockPortfolio.Activites
|
||||||
{
|
{
|
||||||
|
@ -122,6 +123,7 @@ namespace MonoStockPortfolio.Activites
|
||||||
var columnWidth = width / item.Items.Count;
|
var columnWidth = width / item.Items.Count;
|
||||||
|
|
||||||
var row = new LinearLayout(Context);
|
var row = new LinearLayout(Context);
|
||||||
|
row.Orientation = Orientation.Horizontal;
|
||||||
foreach (var stockDataItem in GetStockItemsFromConfig())
|
foreach (var stockDataItem in GetStockItemsFromConfig())
|
||||||
{
|
{
|
||||||
var cell = new TextView(Context);
|
var cell = new TextView(Context);
|
||||||
|
|
|
@ -47,7 +47,8 @@ namespace MonoStockPortfolio.Framework
|
||||||
{
|
{
|
||||||
var map = new Dictionary<Type, Func<object>>();
|
var map = new Dictionary<Type, Func<object>>();
|
||||||
map.Add(typeof(IPortfolioService), () => new PortfolioService(_context));
|
map.Add(typeof(IPortfolioService), () => new PortfolioService(_context));
|
||||||
map.Add(typeof(IPortfolioRepository), () => new AndroidSqlitePortfolioRepository(_context));
|
//map.Add(typeof(IPortfolioRepository), () => new AndroidSqlitePortfolioRepository(_context));
|
||||||
|
map.Add(typeof(IPortfolioRepository), () => new FakePortfolioRepository());
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,11 +124,6 @@
|
||||||
<AndroidResource Include="Resources\drawable-ldpi\ic_menu_refresh.png" />
|
<AndroidResource Include="Resources\drawable-ldpi\ic_menu_refresh.png" />
|
||||||
<AndroidResource Include="Resources\drawable-mdpi\ic_menu_refresh.png" />
|
<AndroidResource Include="Resources\drawable-mdpi\ic_menu_refresh.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<AndroidResource Include="Resources\layout\row.xml">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</AndroidResource>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- 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.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|
|
@ -68,10 +68,7 @@ namespace MonoStockPortfolio
|
||||||
public const int portfolioName = 2131034112;
|
public const int portfolioName = 2131034112;
|
||||||
|
|
||||||
// aapt resource value: 0x7f050009
|
// aapt resource value: 0x7f050009
|
||||||
public const int quoteHeaderLayout = 2131034121;
|
public const int quoteListview = 2131034121;
|
||||||
|
|
||||||
// aapt resource value: 0x7f05000a
|
|
||||||
public const int quoteListview = 2131034122;
|
|
||||||
|
|
||||||
private id()
|
private id()
|
||||||
{
|
{
|
||||||
|
@ -93,9 +90,6 @@ namespace MonoStockPortfolio
|
||||||
// aapt resource value: 0x7f030003
|
// aapt resource value: 0x7f030003
|
||||||
public const int portfolio = 2130903043;
|
public const int portfolio = 2130903043;
|
||||||
|
|
||||||
// aapt resource value: 0x7f030004
|
|
||||||
public const int row = 2130903044;
|
|
||||||
|
|
||||||
private layout()
|
private layout()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:orientation="horizontal" />
|
|
Loading…
Reference in a new issue