Skip to content
This repository has been archived by the owner on Jan 13, 2018. It is now read-only.

Commit

Permalink
Add new spinner activity into sample and fixed up the drop down to ta…
Browse files Browse the repository at this point in the history
…ke in a context since it was removed.
  • Loading branch information
jamesmontemagno committed Apr 22, 2013
1 parent fcbfc2f commit 9b4b49d
Show file tree
Hide file tree
Showing 6 changed files with 282 additions and 79 deletions.
4 changes: 2 additions & 2 deletions LegacyBar.Library/Bar/LegacyBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public void SetHomeAction(LegacyBarAction legacyBarAction)
((LayoutParams)_titleLayout.LayoutParameters).AddRule(LayoutRules.RightOf, Resource.Id.actionbar_home_bg);
}

public void SetDropDown(string[] items, EventHandler<AdapterView.ItemSelectedEventArgs> eventHandler)
public void SetDropDown(Context context, string[] items, EventHandler<AdapterView.ItemSelectedEventArgs> eventHandler)
{
if (items == null)
return;
Expand All @@ -343,7 +343,7 @@ public void SetDropDown(string[] items, EventHandler<AdapterView.ItemSelectedEve
{
var previousSelected = _titleDropdown.SelectedItemPosition;
_titleView.Visibility = ViewStates.Gone;
var adapter = new ArrayAdapter(_context, Android.Resource.Layout.SimpleSpinnerItem, items);
var adapter = new ArrayAdapter(context, Android.Resource.Layout.SimpleSpinnerItem, items);
adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleDropDownItem1Line);

_titleDropdown.Visibility = ViewStates.Visible;
Expand Down
7 changes: 7 additions & 0 deletions LegacyBar.Sample/HomeActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,13 @@ protected override void OnCreate(Bundle bundle)
var intent = new Intent(this, typeof (FragmentTabActivity));
StartActivity(intent);
};

var spinnerActivity = FindViewById<Button>(Resource.Id.dropdown_activity);
spinnerActivity.Click += (s, e) =>
{
var intent = new Intent(this, typeof(SpinnerActivity));
StartActivity(intent);
};
}

public override bool OnOptionsItemSelected(IMenuItem item)
Expand Down
1 change: 1 addition & 0 deletions LegacyBar.Sample/LegacyBar.Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<Reference Include="Mono.Android" />
</ItemGroup>
<ItemGroup>
<Compile Include="SpinnerActivity.cs" />
<Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="FragmentTabActivity.cs" />
Expand Down
201 changes: 124 additions & 77 deletions LegacyBar.Sample/Resources/Resource.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions LegacyBar.Sample/Resources/layout/main.axml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Blue Theme" />
<Button
android:id="@+id/dropdown_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Dropdown spinner Demo" />
<Button
android:id="@+id/fragment_activity"
android:layout_width="match_parent"
Expand Down
Loading

0 comments on commit 9b4b49d

Please sign in to comment.