removed unnecessary views from portfolio.xml which were screwing things up

This commit is contained in:
mgroves 2011-01-02 15:47:12 -05:00
parent c07f913502
commit 505a87bd8c
7 changed files with 17 additions and 79 deletions

View file

@ -48,7 +48,6 @@
<Compile Include="DictionaryExtensions.cs" />
<Compile Include="EnumExtensions.cs" />
<Compile Include="PortfolioRepositories\AndroidSqlitePortfolioRepository.cs" />
<Compile Include="PortfolioRepositories\FakePortfolioRepository.cs" />
<Compile Include="PortfolioRepositories\IPortfolioRepository.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\IPortfolioService.cs" />

View file

@ -1,51 +0,0 @@
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);
}
}
}

View file

@ -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())
{
}

View file

@ -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;
}

View file

@ -47,8 +47,7 @@ namespace MonoStockPortfolio.Framework
{
var map = new Dictionary<Type, Func<object>>();
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;
}

View file

@ -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()
{

View file

@ -4,28 +4,18 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button android:id="@+id/btnAddPosition"
android:text="Add Position"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical">
<Button android:id="@+id/btnAddPosition"
android:text="Add Position"
<LinearLayout android:id="@+id/quoteHeaderLayout"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
android:layout_width="fill_parent"
android:orientation="horizontal" />
<LinearLayout android:id="@+id/quoteHeaderLayout"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="horizontal" />
<ListView android:id="@+id/quoteListview"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<ListView android:id="@+id/quoteListview"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>
</LinearLayout>