mirror of
https://github.com/mgroves/MonodroidStockPortfolio.git
synced 2024-12-26 03:00:17 +00:00
issue 4 - removed 'save' button from config screen, it now just saves whenever a checkbox is clicked (thanks correll)
This commit is contained in:
parent
d9959b0867
commit
cbe17a7175
4 changed files with 32 additions and 34 deletions
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Android.App;
|
||||
|
@ -14,7 +15,6 @@ namespace MonoStockPortfolio.Activites.ConfigScreen
|
|||
public class ConfigActivity : Activity, IConfigView
|
||||
{
|
||||
[LazyView(Resource.Id.configList)] private ListView ConfigList;
|
||||
[LazyView(Resource.Id.btnSaveConfig)] private Button SaveConfigButton;
|
||||
|
||||
[IoC] IConfigPresenter _presenter;
|
||||
|
||||
|
@ -36,9 +36,27 @@ namespace MonoStockPortfolio.Activites.ConfigScreen
|
|||
WireUpEvents();
|
||||
}
|
||||
|
||||
void WireUpEvents()
|
||||
private void WireUpEvents()
|
||||
{
|
||||
SaveConfigButton.Click += SaveConfigButton_Click;
|
||||
ConfigList.ItemClick += ConfigList_ItemClick;
|
||||
}
|
||||
|
||||
void ConfigList_ItemClick(object sender, ItemEventArgs e)
|
||||
{
|
||||
SaveConfiguration();
|
||||
}
|
||||
|
||||
void SaveConfiguration()
|
||||
{
|
||||
var checkedItems = new List<StockDataItem>();
|
||||
for(int i =0;i<ConfigList.Count;i++)
|
||||
{
|
||||
if (ConfigList.IsItemChecked(i))
|
||||
{
|
||||
checkedItems.Add((StockDataItem) i);
|
||||
}
|
||||
}
|
||||
_presenter.SaveConfig(checkedItems);
|
||||
}
|
||||
|
||||
#region IConfigView members
|
||||
|
@ -65,18 +83,5 @@ namespace MonoStockPortfolio.Activites.ConfigScreen
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
void SaveConfigButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
var checkedItems = new List<StockDataItem>();
|
||||
for(int i =0;i<ConfigList.Count;i++)
|
||||
{
|
||||
if (ConfigList.IsItemChecked(i))
|
||||
{
|
||||
checkedItems.Add((StockDataItem) i);
|
||||
}
|
||||
}
|
||||
_presenter.SaveConfig(checkedItems);
|
||||
}
|
||||
}
|
||||
}
|
25
MonoStockPortfolio/Resources/Resource.Designer.cs
generated
25
MonoStockPortfolio/Resources/Resource.Designer.cs
generated
|
@ -58,32 +58,29 @@ namespace MonoStockPortfolio
|
|||
// aapt resource value: 0x7f050002
|
||||
public const int addPositionTicker = 2131034114;
|
||||
|
||||
// aapt resource value: 0x7f050008
|
||||
public const int btnAddPortfolio = 2131034120;
|
||||
// aapt resource value: 0x7f050007
|
||||
public const int btnAddPortfolio = 2131034119;
|
||||
|
||||
// aapt resource value: 0x7f05000a
|
||||
public const int btnAddPosition = 2131034122;
|
||||
// aapt resource value: 0x7f050009
|
||||
public const int btnAddPosition = 2131034121;
|
||||
|
||||
// aapt resource value: 0x7f050001
|
||||
public const int btnSave = 2131034113;
|
||||
|
||||
// aapt resource value: 0x7f050006
|
||||
public const int btnSaveConfig = 2131034118;
|
||||
public const int configList = 2131034118;
|
||||
|
||||
// aapt resource value: 0x7f050007
|
||||
public const int configList = 2131034119;
|
||||
|
||||
// aapt resource value: 0x7f050009
|
||||
public const int portfolioList = 2131034121;
|
||||
// aapt resource value: 0x7f050008
|
||||
public const int portfolioList = 2131034120;
|
||||
|
||||
// aapt resource value: 0x7f050000
|
||||
public const int portfolioName = 2131034112;
|
||||
|
||||
// aapt resource value: 0x7f05000b
|
||||
public const int quoteHeaderLayout = 2131034123;
|
||||
// aapt resource value: 0x7f05000a
|
||||
public const int quoteHeaderLayout = 2131034122;
|
||||
|
||||
// aapt resource value: 0x7f05000c
|
||||
public const int quoteListview = 2131034124;
|
||||
// aapt resource value: 0x7f05000b
|
||||
public const int quoteListview = 2131034123;
|
||||
|
||||
private Id()
|
||||
{
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView android:layout_width="fill_parent"
|
||||
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Price per share" />
|
||||
|
||||
|
|
|
@ -4,9 +4,6 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<Button android:text="Save" android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent" android:id="@+id/btnSaveConfig" />
|
||||
|
||||
<ListView android:id="@+id/configList"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
|
Loading…
Reference in a new issue