diff --git a/LegacyBar.Library/BarBase/LegacyBarActivity.cs b/LegacyBar.Library/BarBase/LegacyBarActivity.cs index 20ffe6e..785b890 100644 --- a/LegacyBar.Library/BarBase/LegacyBarActivity.cs +++ b/LegacyBar.Library/BarBase/LegacyBarActivity.cs @@ -49,20 +49,15 @@ public override bool OnCreateOptionsMenu(IMenu menu) return base.OnCreateOptionsMenu(menu); } - public void AddHomeAction(Type activity) + public void AddHomeAction(Type activity, int resId) { var homeIntent = new Intent(this, activity); homeIntent.AddFlags(ActivityFlags.ClearTop); homeIntent.AddFlags(ActivityFlags.NewTask); - LegacyBar.SetHomeAction(new DefaultLegacyBarAction(this, homeIntent, Resource.Drawable.ic_launcher)); + LegacyBar.SetHomeAction(new DefaultLegacyBarAction(this, homeIntent, resId)); LegacyBar.SetDisplayHomeAsUpEnabled(true); } - public void AddHomeAction(Action action) - { - AddHomeAction(action, Resource.Drawable.ic_launcher); - } - public void AddHomeAction(Action action, int resId, bool isHomeAsUpEnabled = true) { LegacyBar.SetHomeAction(new ActionLegacyBarAction(this, action, resId)); diff --git a/LegacyBar.Library/BarBase/LegacyBarFragmentActivity.cs b/LegacyBar.Library/BarBase/LegacyBarFragmentActivity.cs index ad6a624..d95846b 100644 --- a/LegacyBar.Library/BarBase/LegacyBarFragmentActivity.cs +++ b/LegacyBar.Library/BarBase/LegacyBarFragmentActivity.cs @@ -48,20 +48,15 @@ public override bool OnCreateOptionsMenu(IMenu menu) return base.OnCreateOptionsMenu(menu); } - public void AddHomeAction(Type activity) + public void AddHomeAction(Type activity, int resId) { var homeIntent = new Intent(this, activity); homeIntent.AddFlags(ActivityFlags.ClearTop); homeIntent.AddFlags(ActivityFlags.NewTask); - ActionBar.SetHomeAction(new DefaultLegacyBarAction(this, homeIntent, Resource.Drawable.ic_launcher)); + ActionBar.SetHomeAction(new DefaultLegacyBarAction(this, homeIntent, resId)); ActionBar.SetDisplayHomeAsUpEnabled(true); } - public void AddHomeAction(Action action) - { - AddHomeAction(action, Resource.Drawable.ic_launcher); - } - public void AddHomeAction(Action action, int resId, bool isHomeAsUpEnabled = true) { ActionBar.SetHomeAction(new ActionLegacyBarAction(this, action, resId)); diff --git a/LegacyBar.Library/BarBase/LegacyBarListActivity.cs b/LegacyBar.Library/BarBase/LegacyBarListActivity.cs index 7db26a5..371fda3 100644 --- a/LegacyBar.Library/BarBase/LegacyBarListActivity.cs +++ b/LegacyBar.Library/BarBase/LegacyBarListActivity.cs @@ -49,19 +49,15 @@ public override bool OnCreateOptionsMenu(IMenu menu) return base.OnCreateOptionsMenu(menu); } - public void AddHomeAction(Type activity) + public void AddHomeAction(Type activity, int resId) { var homeIntent = new Intent(this, activity); homeIntent.AddFlags(ActivityFlags.ClearTop); homeIntent.AddFlags(ActivityFlags.NewTask); - ActionBar.SetHomeAction(new DefaultLegacyBarAction(this, homeIntent, Resource.Drawable.ic_launcher)); + ActionBar.SetHomeAction(new DefaultLegacyBarAction(this, homeIntent, resId)); ActionBar.SetDisplayHomeAsUpEnabled(true); } - public void AddHomeAction(Action action) - { - AddHomeAction(action, Resource.Drawable.ic_launcher); - } public void AddHomeAction(Action action, int resId, bool isHomeAsUpEnabled = true) { diff --git a/LegacyBar.Library/LegacyBar.Library.csproj b/LegacyBar.Library/LegacyBar.Library.csproj index 05132b9..4b4cbd7 100644 --- a/LegacyBar.Library/LegacyBar.Library.csproj +++ b/LegacyBar.Library/LegacyBar.Library.csproj @@ -82,11 +82,7 @@ - - - - Designer diff --git a/LegacyBar.Library/Properties/AndroidManifest.xml b/LegacyBar.Library/Properties/AndroidManifest.xml index f7fe3d5..76c17ea 100644 --- a/LegacyBar.Library/Properties/AndroidManifest.xml +++ b/LegacyBar.Library/Properties/AndroidManifest.xml @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/LegacyBar.Library/Resources/Drawable-hdpi/ic_launcher.png b/LegacyBar.Library/Resources/Drawable-hdpi/ic_launcher.png deleted file mode 100644 index e3bed82..0000000 Binary files a/LegacyBar.Library/Resources/Drawable-hdpi/ic_launcher.png and /dev/null differ diff --git a/LegacyBar.Library/Resources/Drawable-ldpi/ic_launcher.png b/LegacyBar.Library/Resources/Drawable-ldpi/ic_launcher.png deleted file mode 100644 index ab5379e..0000000 Binary files a/LegacyBar.Library/Resources/Drawable-ldpi/ic_launcher.png and /dev/null differ diff --git a/LegacyBar.Library/Resources/Drawable-mdpi/ic_launcher.png b/LegacyBar.Library/Resources/Drawable-mdpi/ic_launcher.png deleted file mode 100644 index f3fe5d4..0000000 Binary files a/LegacyBar.Library/Resources/Drawable-mdpi/ic_launcher.png and /dev/null differ diff --git a/LegacyBar.Library/Resources/Drawable-xhdpi/ic_launcher.png b/LegacyBar.Library/Resources/Drawable-xhdpi/ic_launcher.png deleted file mode 100644 index 7d7f994..0000000 Binary files a/LegacyBar.Library/Resources/Drawable-xhdpi/ic_launcher.png and /dev/null differ diff --git a/LegacyBar.Library/Resources/Resource.designer.cs b/LegacyBar.Library/Resources/Resource.designer.cs index ece00e9..c225795 100644 --- a/LegacyBar.Library/Resources/Resource.designer.cs +++ b/LegacyBar.Library/Resources/Resource.designer.cs @@ -2,7 +2,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18033 +// Runtime Version:4.0.30319.17929 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -15,15 +15,10 @@ namespace LegacyBar.Library { - [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("Novell.MonoDroid.Build.Tasks", "1.0.0.0")] public partial class Resource { - Resource() - { - global::Android.Runtime.ResourceIdManager.UpdateIdValues (); - } - public partial class Attribute { @@ -366,9 +361,6 @@ public partial class Drawable // aapt resource value: 0x7f02001f public static int ic_action_overflow_dark = 2130837535; - // aapt resource value: 0x7f020020 - public static int ic_launcher = 2130837536; - private Drawable() { } @@ -460,34 +452,7 @@ public partial class String { // aapt resource value: 0x7f070000 - public static int Hello = 2131165184; - - // aapt resource value: 0x7f070002 - public static int actionbar_activity_not_found = 2131165186; - - // aapt resource value: 0x7f070001 - public static int app_name = 2131165185; - - // aapt resource value: 0x7f070006 - public static int menu_string_down = 2131165190; - - // aapt resource value: 0x7f070007 - public static int menu_string_left = 2131165191; - - // aapt resource value: 0x7f070009 - public static int menu_string_refresh = 2131165193; - - // aapt resource value: 0x7f070008 - public static int menu_string_right = 2131165192; - - // aapt resource value: 0x7f070004 - public static int menu_string_search = 2131165188; - - // aapt resource value: 0x7f070005 - public static int menu_string_up = 2131165189; - - // aapt resource value: 0x7f070003 - public static int some_title = 2131165187; + public static int actionbar_activity_not_found = 2131165184; private String() { diff --git a/LegacyBar.Library/Resources/Values/strings.xml b/LegacyBar.Library/Resources/Values/strings.xml index 6d573fc..a79be78 100644 --- a/LegacyBar.Library/Resources/Values/strings.xml +++ b/LegacyBar.Library/Resources/Values/strings.xml @@ -1,13 +1,4 @@  - Hello World! - LegacyBar Failed to open intent... - Some Title - Search - up - down - left - right - refresh \ No newline at end of file diff --git a/LegacyBar.Sample/FragmentTabActivity.cs b/LegacyBar.Sample/FragmentTabActivity.cs index aab60cf..9cd9330 100644 --- a/LegacyBar.Sample/FragmentTabActivity.cs +++ b/LegacyBar.Sample/FragmentTabActivity.cs @@ -31,7 +31,7 @@ namespace LegacyBar.Sample { [Activity(Label = "Fragment Demo", MainLauncher = false, LaunchMode = LaunchMode.SingleTop, - Icon = "@drawable/ic_launcher", Theme = "@style/MyTheme")] + Icon = "@drawable/icon", Theme = "@style/MyTheme")] public class FragmentTabActivity : LegacyBarFragmentActivity { private TabHost _tabHost; @@ -56,7 +56,7 @@ protected override void OnCreate(Bundle bundle) ActionBar = FindViewById(Resource.Id.actionbar); ActionBar.Title = "Look Fragments"; ActionBar.CurrentActivity = this; - AddHomeAction(typeof (HomeActivity)); + AddHomeAction(typeof (HomeActivity), Resource.Drawable.icon); var action = new MenuItemLegacyBarAction(this, this, Resource.Id.menu_search, diff --git a/LegacyBar.Sample/HomeActivity.cs b/LegacyBar.Sample/HomeActivity.cs index 2f7e594..ffd68d1 100644 --- a/LegacyBar.Sample/HomeActivity.cs +++ b/LegacyBar.Sample/HomeActivity.cs @@ -39,7 +39,7 @@ protected override void OnCreate(Bundle bundle) LegacyBar = FindViewById(Resource.Id.actionbar); LegacyBar.CurrentActivity = this; - LegacyBar.SetHomeLogo(Resource.Drawable.ic_launcher); + LegacyBar.SetHomeLogo(Resource.Drawable.icon); /* * You can also set the title of the LegacyBar with: diff --git a/LegacyBar.Sample/LegacyBar.Sample.csproj b/LegacyBar.Sample/LegacyBar.Sample.csproj index d4a8914..cb8c6ef 100644 --- a/LegacyBar.Sample/LegacyBar.Sample.csproj +++ b/LegacyBar.Sample/LegacyBar.Sample.csproj @@ -104,9 +104,7 @@ LegacyBar.Library - - - + @@ -272,4 +270,7 @@ + + + \ No newline at end of file diff --git a/LegacyBar.Sample/OtherActivity.cs b/LegacyBar.Sample/OtherActivity.cs index 2d38c5f..9c44cc3 100644 --- a/LegacyBar.Sample/OtherActivity.cs +++ b/LegacyBar.Sample/OtherActivity.cs @@ -24,7 +24,7 @@ namespace LegacyBar.Sample { [Activity(Label = "OtherActivity", MainLauncher = false, LaunchMode = LaunchMode.SingleTop, - Icon = "@drawable/ic_launcher", Theme = "@style/MyTheme")] + Icon = "@drawable/icon", Theme = "@style/MyTheme")] internal class OtherActivity : LegacyBarActivity { protected override void OnCreate(Bundle savedInstanceState) @@ -51,16 +51,20 @@ protected override void OnCreate(Bundle savedInstanceState) break; } - - MenuId = Resource.Menu.mainmenu; + //First we will specify the menu we are using. + MenuId = Resource.Menu.othermainmenu; LegacyBar = FindViewById(Resource.Id.actionbar); + // You can also assign the title programmatically by passing a // CharSequence or resource id. LegacyBar.Title = "Other Activity"; - AddHomeAction(typeof (HomeActivity)); + + //Set the Up button to go home, also much set current activity on the Legacy Bar + AddHomeAction(typeof (HomeActivity), Resource.Drawable.icon); LegacyBar.CurrentActivity = this; + //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, Resource.String.menu_string_search) @@ -69,6 +73,9 @@ protected override void OnCreate(Bundle savedInstanceState) }; LegacyBar.AddAction(itemActionBarAction); + + //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 : Resource.Drawable.ic_action_refresh_dark, @@ -76,6 +83,24 @@ protected override void OnCreate(Bundle savedInstanceState) {ActionType = ActionType.Never}; LegacyBar.AddAction(itemActionBarAction); + itemActionBarAction = new MenuItemLegacyBarAction( + this, 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 : + 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 : + Resource.Drawable.ic_action_refresh_dark, + Resource.String.menu_string_refresh) { ActionType = ActionType.Never }; + LegacyBar.AddAction(itemActionBarAction); + var bottomActionBar = FindViewById(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, diff --git a/LegacyBar.Sample/Properties/AndroidManifest.xml b/LegacyBar.Sample/Properties/AndroidManifest.xml index 6ac280d..31ee61d 100644 --- a/LegacyBar.Sample/Properties/AndroidManifest.xml +++ b/LegacyBar.Sample/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/LegacyBar.Sample/Resources/Menu/othermainmenu.xml b/LegacyBar.Sample/Resources/Menu/othermainmenu.xml index c10c836..9d381d5 100644 --- a/LegacyBar.Sample/Resources/Menu/othermainmenu.xml +++ b/LegacyBar.Sample/Resources/Menu/othermainmenu.xml @@ -20,4 +20,17 @@ + + + + + + + \ No newline at end of file diff --git a/LegacyBar.Sample/Resources/Resource.designer.cs b/LegacyBar.Sample/Resources/Resource.designer.cs index de26679..1d5298f 100644 --- a/LegacyBar.Sample/Resources/Resource.designer.cs +++ b/LegacyBar.Sample/Resources/Resource.designer.cs @@ -2,7 +2,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18033 +// Runtime Version:4.0.30319.17929 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -15,15 +15,10 @@ namespace LegacyBar.Sample { - [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("Novell.MonoDroid.Build.Tasks", "1.0.0.0")] public partial class Resource { - Resource() - { - global::Android.Runtime.ResourceIdManager.UpdateIdValues (); - } - public static void UpdateIdValues() { LegacyBar.Library.Resource.Attribute.background = LegacyBar.Sample.Resource.Attribute.background; @@ -131,7 +126,6 @@ public static void UpdateIdValues() LegacyBar.Library.Resource.Drawable.bottomactionbar_btn_pressed = LegacyBar.Sample.Resource.Drawable.bottomactionbar_btn_pressed; LegacyBar.Library.Resource.Drawable.ic_action_overflow = LegacyBar.Sample.Resource.Drawable.ic_action_overflow; LegacyBar.Library.Resource.Drawable.ic_action_overflow_dark = LegacyBar.Sample.Resource.Drawable.ic_action_overflow_dark; - LegacyBar.Library.Resource.Drawable.ic_launcher = LegacyBar.Sample.Resource.Drawable.ic_launcher; LegacyBar.Library.Resource.Id.actionbar_actions = LegacyBar.Sample.Resource.Id.actionbar_actions; LegacyBar.Library.Resource.Id.actionbar_home = LegacyBar.Sample.Resource.Id.actionbar_home; LegacyBar.Library.Resource.Id.actionbar_home_bg = LegacyBar.Sample.Resource.Id.actionbar_home_bg; @@ -154,16 +148,7 @@ public static void UpdateIdValues() LegacyBar.Library.Resource.Layout.blankspinner = LegacyBar.Sample.Resource.Layout.blankspinner; LegacyBar.Library.Resource.Layout.overflowactionbar_item = LegacyBar.Sample.Resource.Layout.overflowactionbar_item; LegacyBar.Library.Resource.Layout.spinneritem = LegacyBar.Sample.Resource.Layout.spinneritem; - LegacyBar.Library.Resource.String.Hello = LegacyBar.Sample.Resource.String.Hello; LegacyBar.Library.Resource.String.actionbar_activity_not_found = LegacyBar.Sample.Resource.String.actionbar_activity_not_found; - LegacyBar.Library.Resource.String.app_name = LegacyBar.Sample.Resource.String.app_name; - LegacyBar.Library.Resource.String.menu_string_down = LegacyBar.Sample.Resource.String.menu_string_down; - LegacyBar.Library.Resource.String.menu_string_left = LegacyBar.Sample.Resource.String.menu_string_left; - LegacyBar.Library.Resource.String.menu_string_refresh = LegacyBar.Sample.Resource.String.menu_string_refresh; - LegacyBar.Library.Resource.String.menu_string_right = LegacyBar.Sample.Resource.String.menu_string_right; - LegacyBar.Library.Resource.String.menu_string_search = LegacyBar.Sample.Resource.String.menu_string_search; - LegacyBar.Library.Resource.String.menu_string_up = LegacyBar.Sample.Resource.String.menu_string_up; - LegacyBar.Library.Resource.String.some_title = LegacyBar.Sample.Resource.String.some_title; LegacyBar.Library.Resource.Style.MyTheme = LegacyBar.Sample.Resource.Style.MyTheme; LegacyBar.Library.Resource.Style.actionbar = LegacyBar.Sample.Resource.Style.actionbar; LegacyBar.Library.Resource.Style.actionbarhomeitem = LegacyBar.Sample.Resource.Style.actionbarhomeitem; @@ -594,7 +579,13 @@ public partial class Drawable public const int ic_menu_up = 2130837558; // aapt resource value: 0x7f020037 - public const int icon = 2130837559; + public const int ic_title_export_default = 2130837559; + + // aapt resource value: 0x7f020038 + public const int ic_title_share_default = 2130837560; + + // aapt resource value: 0x7f020039 + public const int icon = 2130837561; private Drawable() { @@ -691,6 +682,15 @@ public partial class Id // aapt resource value: 0x7f040025 public const int menu_search = 2130968613; + // aapt resource value: 0x7f040027 + public const int menu_test1 = 2130968615; + + // aapt resource value: 0x7f040028 + public const int menu_test2 = 2130968616; + + // aapt resource value: 0x7f040029 + public const int menu_test3 = 2130968617; + // aapt resource value: 0x7f040023 public const int menu_up = 2130968611; @@ -793,35 +793,35 @@ private Menu() public partial class String { - // aapt resource value: 0x7f070000 - public const int Hello = 2131165184; + // aapt resource value: 0x7f070001 + public const int Hello = 2131165185; - // aapt resource value: 0x7f070002 - public const int actionbar_activity_not_found = 2131165186; + // aapt resource value: 0x7f070000 + public const int actionbar_activity_not_found = 2131165184; - // aapt resource value: 0x7f070001 - public const int app_name = 2131165185; + // aapt resource value: 0x7f070005 + public const int menu_string_down = 2131165189; // aapt resource value: 0x7f070006 - public const int menu_string_down = 2131165190; + public const int menu_string_left = 2131165190; + + // aapt resource value: 0x7f070008 + public const int menu_string_refresh = 2131165192; // aapt resource value: 0x7f070007 - public const int menu_string_left = 2131165191; + public const int menu_string_right = 2131165191; - // aapt resource value: 0x7f070009 - public const int menu_string_refresh = 2131165193; + // aapt resource value: 0x7f070003 + public const int menu_string_search = 2131165187; - // aapt resource value: 0x7f070008 - public const int menu_string_right = 2131165192; + // aapt resource value: 0x7f070009 + public const int menu_string_sort = 2131165193; // aapt resource value: 0x7f070004 - public const int menu_string_search = 2131165188; - - // aapt resource value: 0x7f070005 - public const int menu_string_up = 2131165189; + public const int menu_string_up = 2131165188; - // aapt resource value: 0x7f070003 - public const int some_title = 2131165187; + // aapt resource value: 0x7f070002 + public const int some_title = 2131165186; private String() { diff --git a/LegacyBar.Sample/Resources/values/strings.xml b/LegacyBar.Sample/Resources/values/strings.xml new file mode 100644 index 0000000..15af2d6 --- /dev/null +++ b/LegacyBar.Sample/Resources/values/strings.xml @@ -0,0 +1,12 @@ + + + Hello World! + Some Title + Search + up + down + left + right + refresh + Sort + \ No newline at end of file