forked from Cheesebaron/LegacyBar
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Added ability to now use a menu in correlation with the Action Bar.
We can dynamically remove items and add items to the menu bar based off what you put in the action bar. This allows you to reuse the existing architecture of menus. Target 13 sdk so we always get a target button Added icons and menus for demo. updated OtherActivity.cs to end loop when you use home button by making the intent single top and new task.
- Loading branch information
James Montemagno
committed
Apr 24, 2012
1 parent
cdae2f2
commit 685aed4
Showing
15 changed files
with
506 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,50 @@ | ||
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs) | ||
bin | ||
obj | ||
#Library objects | ||
*.lo | ||
*.la | ||
|
||
# mstest test results | ||
TestResults | ||
#OS junk files | ||
[Tt]humbs.db | ||
*.DS_Store | ||
|
||
#Visual Studio files | ||
*.[Oo]bj | ||
*.user | ||
*.aps | ||
*.pch | ||
*.vspscc | ||
*.vssscc | ||
*_i.c | ||
*_p.c | ||
*.ncb | ||
*.suo | ||
*.tlb | ||
*.tlh | ||
*.bak | ||
*.[Cc]ache | ||
*.ilk | ||
*.log | ||
*.lib | ||
*.sbr | ||
*.sdf | ||
*.opensdf | ||
*.unsuccessfulbuild | ||
ipch/ | ||
obj/ | ||
[Bb]in | ||
[Dd]ebug*/ | ||
[Rr]elease*/ | ||
Ankh.NoLoad | ||
|
||
#Tooling | ||
_ReSharper*/ | ||
*.resharper | ||
[Tt]est[Rr]esult* | ||
|
||
#Project files | ||
*/[Bb]uild/ | ||
|
||
#Subversion files | ||
.svn | ||
|
||
# Office Temp Files | ||
~$* |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
230 changes: 230 additions & 0 deletions
230
MonoDroid.ActionBar/ActionBar/MenuItemActionBarAction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,230 @@ | ||
/* | ||
* Copyright (C) 2012 Tomasz Cielecki <tomasz@ostebaronen.dk> | ||
* | ||
* Port from https://github.com/johannilsson/android-actionbar | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* Addition by: Copyright (C) 2012 James Montemagno (motz2k1@oh.rr.com) | ||
*/ | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Android.App; | ||
using Android.Content; | ||
using Android.Views; | ||
using Android.Widget; | ||
|
||
namespace MonoDroid.ActionBarSample | ||
{ | ||
|
||
/// <summary> | ||
/// This is just a stub so we can set the id. | ||
/// In the long run we should really read in the full menu item and use it. | ||
/// </summary> | ||
public class ActionBarMenuItem : IMenuItem | ||
{ | ||
public ActionBarMenuItem(int id) | ||
{ | ||
m_ItemId = id; | ||
} | ||
|
||
char IMenuItem.AlphabeticShortcut | ||
{ | ||
get { throw new NotImplementedException(); } | ||
} | ||
|
||
int IMenuItem.GroupId | ||
{ | ||
get { throw new NotImplementedException(); } | ||
} | ||
|
||
bool IMenuItem.HasSubMenu | ||
{ | ||
get { throw new NotImplementedException(); } | ||
} | ||
|
||
Android.Graphics.Drawables.Drawable IMenuItem.Icon | ||
{ | ||
get { throw new NotImplementedException(); } | ||
} | ||
|
||
Intent IMenuItem.Intent | ||
{ | ||
get { throw new NotImplementedException(); } | ||
} | ||
|
||
bool IMenuItem.IsCheckable | ||
{ | ||
get { throw new NotImplementedException(); } | ||
} | ||
|
||
bool IMenuItem.IsChecked | ||
{ | ||
get { throw new NotImplementedException(); } | ||
} | ||
|
||
bool IMenuItem.IsEnabled | ||
{ | ||
get { throw new NotImplementedException(); } | ||
} | ||
|
||
bool IMenuItem.IsVisible | ||
{ | ||
get { throw new NotImplementedException(); } | ||
} | ||
|
||
private int m_ItemId; | ||
int IMenuItem.ItemId { get { return m_ItemId; } } | ||
|
||
IContextMenuContextMenuInfo IMenuItem.MenuInfo | ||
{ | ||
get { throw new NotImplementedException(); } | ||
} | ||
|
||
char IMenuItem.NumericShortcut | ||
{ | ||
get { throw new NotImplementedException(); } | ||
} | ||
|
||
int IMenuItem.Order | ||
{ | ||
get { throw new NotImplementedException(); } | ||
} | ||
|
||
IMenuItem IMenuItem.SetAlphabeticShortcut(char alphaChar) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
IMenuItem IMenuItem.SetCheckable(bool checkable) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
IMenuItem IMenuItem.SetChecked(bool @checked) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
IMenuItem IMenuItem.SetEnabled(bool enabled) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
IMenuItem IMenuItem.SetIcon(int iconRes) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
IMenuItem IMenuItem.SetIcon(Android.Graphics.Drawables.Drawable icon) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
IMenuItem IMenuItem.SetIntent(Intent intent) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
IMenuItem IMenuItem.SetNumericShortcut(char numericChar) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
IMenuItem IMenuItem.SetOnMenuItemClickListener(IMenuItemOnMenuItemClickListener menuItemClickListener) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
IMenuItem IMenuItem.SetShortcut(char numericChar, char alphaChar) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
IMenuItem IMenuItem.SetTitle(Java.Lang.ICharSequence title) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
IMenuItem IMenuItem.SetTitle(int title) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
IMenuItem IMenuItem.SetTitleCondensed(Java.Lang.ICharSequence title) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
IMenuItem IMenuItem.SetVisible(bool visible) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
ISubMenu IMenuItem.SubMenu | ||
{ | ||
get { throw new NotImplementedException(); } | ||
} | ||
|
||
Java.Lang.ICharSequence IMenuItem.TitleCondensedFormatted | ||
{ | ||
get { throw new NotImplementedException(); } | ||
} | ||
|
||
Java.Lang.ICharSequence IMenuItem.TitleFormatted | ||
{ | ||
get { throw new NotImplementedException(); } | ||
} | ||
|
||
IntPtr Android.Runtime.IJavaObject.Handle | ||
{ | ||
get { throw new NotImplementedException(); } | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// MenuItemActionBarAction will call teh main activitiess "OnOptionsItemSelected", which allows us to re-use code. | ||
/// </summary> | ||
class MenuItemActionBarAction: ActionBarAction | ||
{ | ||
private Activity m_Activity; | ||
private ActionBarMenuItem m_MenuItem; | ||
public int MenuItemId; | ||
public MenuItemActionBarAction(Context context, Activity activity, int menuId, int drawable) | ||
{ | ||
mDrawable = drawable; | ||
mContext = context; | ||
m_Activity = activity; | ||
MenuItemId = menuId; | ||
m_MenuItem = new ActionBarMenuItem(menuId); | ||
} | ||
|
||
public override int GetDrawable() | ||
{ | ||
return mDrawable; | ||
} | ||
|
||
public override void PerformAction(View view) | ||
{ | ||
try | ||
{ | ||
m_Activity.OnOptionsItemSelected(m_MenuItem); | ||
} | ||
catch(Exception ex) | ||
{ | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.