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

Commit

Permalink
Remove Themes.xml as it is not needed.
Browse files Browse the repository at this point in the history
Clean up MenuItemLegacyBarAction so you don't need the context (you do need activity).
  • Loading branch information
jamesmontemagno committed Apr 22, 2013
1 parent 07662fc commit 2dc9116
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 134 deletions.
7 changes: 5 additions & 2 deletions LegacyBar.Library/BarActions/MenuItemLegacyBarAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
*
*/

using System;
using Android.App;
using Android.Content;
using Android.Graphics.Drawables;
using Android.Views;
using Java.Lang;

namespace LegacyBar.Library.BarActions
{
Expand All @@ -32,10 +35,10 @@ public class MenuItemLegacyBarAction: LegacyBarAction
private readonly Activity _activity;
private readonly LegacyBarMenuItem _menuItem;
public int MenuItemId;
public MenuItemLegacyBarAction(Context context, Activity activity, int menuId, int drawable, int popupId)
public MenuItemLegacyBarAction(Activity activity, int menuId, int drawable, int popupId)
{
Drawable = drawable;
Context = context;
Context = activity;
_activity = activity;
MenuItemId = menuId;
_menuItem = new LegacyBarMenuItem(menuId, Handle);
Expand Down
1 change: 0 additions & 1 deletion LegacyBar.Library/LegacyBar.Library.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@
<AndroidResource Include="Resources\Values\styles.xml">
<SubType>Designer</SubType>
</AndroidResource>
<AndroidResource Include="Resources\Values\themes.xml" />
<AndroidResource Include="Resources\Values-land\dimens.xml">
<SubType>Designer</SubType>
</AndroidResource>
Expand Down
57 changes: 2 additions & 55 deletions LegacyBar.Library/Resources/Resource.designer.cs

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

6 changes: 0 additions & 6 deletions LegacyBar.Library/Resources/Values/themes.xml

This file was deleted.

2 changes: 1 addition & 1 deletion LegacyBar.Sample/FragmentTabActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected override void OnCreate(Bundle bundle)
AddHomeAction(typeof (HomeActivity), Resource.Drawable.icon);


var action = new MenuItemLegacyBarAction(this, this, Resource.Id.menu_search,
var action = new MenuItemLegacyBarAction(this, Resource.Id.menu_search,
Resource.Drawable.ic_action_search_dark,
Resource.String.menu_string_search);
LegacyBar.AddAction(action);
Expand Down
4 changes: 2 additions & 2 deletions LegacyBar.Sample/HomeActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected override void OnCreate(Bundle bundle)

//only put in if there is room
var searchMenuItemAction = new MenuItemLegacyBarAction(
this, this, Resource.Id.menu_search, LegacyBar.LightIcons ? Resource.Drawable.ic_action_share : Resource.Drawable.ic_action_share_dark,
this, Resource.Id.menu_search, LegacyBar.LightIcons ? Resource.Drawable.ic_action_share : Resource.Drawable.ic_action_share_dark,
Resource.String.menu_string_search)
{
ActionType = ActionType.IfRoom
Expand All @@ -88,7 +88,7 @@ protected override void OnCreate(Bundle bundle)

//never put this guy in there
searchMenuItemAction = new MenuItemLegacyBarAction(
this, this, Resource.Id.menu_refresh, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh : Resource.Drawable.ic_action_refresh_dark,
this, Resource.Id.menu_refresh, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh : Resource.Drawable.ic_action_refresh_dark,
Resource.String.menu_string_refresh)
{
ActionType = ActionType.Never
Expand Down
18 changes: 9 additions & 9 deletions LegacyBar.Sample/OtherActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected override void OnCreate(Bundle savedInstanceState)

//always show the search icon no matter what.
var itemActionBarAction = new MenuItemLegacyBarAction(
this, this, Resource.Id.menu_search, LegacyBar.LightIcons ? Resource.Drawable.ic_action_search : Resource.Drawable.ic_action_search_dark,
this, Resource.Id.menu_search, LegacyBar.LightIcons ? Resource.Drawable.ic_action_search : Resource.Drawable.ic_action_search_dark,
Resource.String.menu_string_search)
{
ActionType = ActionType.Always
Expand All @@ -76,54 +76,54 @@ protected override void OnCreate(Bundle savedInstanceState)
//the rest of them I will say NEVER show. now on devices with a menu button you can press it and it will show old menus with the icon you specifies in the menu.xml file
//on newer devices without a menu button an overflow will appear.
itemActionBarAction = new MenuItemLegacyBarAction(
this, this, Resource.Id.menu_refresh, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh :
this, Resource.Id.menu_refresh, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh :
Resource.Drawable.ic_action_refresh_dark,
Resource.String.menu_string_refresh)
{ActionType = ActionType.Never};
LegacyBar.AddAction(itemActionBarAction);

itemActionBarAction = new MenuItemLegacyBarAction(
this, this, Resource.Id.menu_test1, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh :
this, Resource.Id.menu_test1, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh :
Resource.Drawable.ic_action_refresh_dark,
Resource.String.menu_string_refresh) { ActionType = ActionType.Never };
LegacyBar.AddAction(itemActionBarAction);

itemActionBarAction = new MenuItemLegacyBarAction(
this, this, Resource.Id.menu_test2, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh :
this, Resource.Id.menu_test2, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh :
Resource.Drawable.ic_action_refresh_dark,
Resource.String.menu_string_refresh) { ActionType = ActionType.Never };
LegacyBar.AddAction(itemActionBarAction);

itemActionBarAction = new MenuItemLegacyBarAction(
this, this, Resource.Id.menu_test3, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh :
this, Resource.Id.menu_test3, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh :
Resource.Drawable.ic_action_refresh_dark,
Resource.String.menu_string_refresh) { ActionType = ActionType.Never };
LegacyBar.AddAction(itemActionBarAction);

var bottomActionBar = FindViewById<Library.Bar.LegacyBar>(Resource.Id.bottomActionbar);

var action = new MenuItemLegacyBarAction(this, this, Resource.Id.menu_up, bottomActionBar.LightIcons ? Resource.Drawable.ic_action_up : Resource.Drawable.ic_action_up_dark,
var action = new MenuItemLegacyBarAction(this, Resource.Id.menu_up, bottomActionBar.LightIcons ? Resource.Drawable.ic_action_up : Resource.Drawable.ic_action_up_dark,
Resource.String.menu_string_down)
{
ActionType = ActionType.Always
};

bottomActionBar.AddAction(action);
action = new MenuItemLegacyBarAction(this, this, Resource.Id.menu_down, bottomActionBar.LightIcons ? Resource.Drawable.ic_action_down : Resource.Drawable.ic_action_down_dark,
action = new MenuItemLegacyBarAction(this, Resource.Id.menu_down, bottomActionBar.LightIcons ? Resource.Drawable.ic_action_down : Resource.Drawable.ic_action_down_dark,
Resource.String.menu_string_down)
{
ActionType = ActionType.Always
};
bottomActionBar.AddAction(action);

action = new MenuItemLegacyBarAction(this, this, Resource.Id.menu_left, bottomActionBar.LightIcons ? Resource.Drawable.ic_action_left : Resource.Drawable.ic_action_left_dark,
action = new MenuItemLegacyBarAction(this, Resource.Id.menu_left, bottomActionBar.LightIcons ? Resource.Drawable.ic_action_left : Resource.Drawable.ic_action_left_dark,
Resource.String.menu_string_left)
{
ActionType = ActionType.Always
};
bottomActionBar.AddAction(action);

action = new MenuItemLegacyBarAction(this, this, Resource.Id.menu_right, bottomActionBar.LightIcons ? Resource.Drawable.ic_action_right : Resource.Drawable.ic_action_right_dark,
action = new MenuItemLegacyBarAction(this, Resource.Id.menu_right, bottomActionBar.LightIcons ? Resource.Drawable.ic_action_right : Resource.Drawable.ic_action_right_dark,
Resource.String.menu_string_right)
{
ActionType = ActionType.Always
Expand Down
Loading

0 comments on commit 2dc9116

Please sign in to comment.