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

Commit

Permalink
Fiddled around with API 14 stuff. HasMenuKey and MenuItem. Really nee…
Browse files Browse the repository at this point in the history
…d to

do something about that IMenuItem inheritance!
  • Loading branch information
Cheesebaron committed Apr 16, 2013
1 parent 816428c commit 07662fc
Show file tree
Hide file tree
Showing 8 changed files with 279 additions and 129 deletions.
13 changes: 6 additions & 7 deletions LegacyBar.Library/Bar/LegacyBar.cs
Expand Up @@ -62,14 +62,13 @@ public bool HasMenuButton
{
get
{
#if __ANDROID_14__
return ViewConfiguration.Get(Context).HasPermanentMenuKey;
#elif __ANDROID_11__
return false;
#else
//fallback
return ((int)Build.VERSION.SdkInt) < 11;
if ((int) Build.VERSION.SdkInt >= 14)
{
#if __ANDROID_14_
return ViewConfiguration.Get(Context).HasPermanentMenuKey;
#endif
}
return (int) Build.VERSION.SdkInt != 11;
}
}

Expand Down
162 changes: 162 additions & 0 deletions LegacyBar.Library/BarActions/LegacyBarMenuItem.cs
@@ -0,0 +1,162 @@
using System;
using Android.Content;
using Android.Graphics.Drawables;
using Android.Views;
using Java.Lang;

namespace LegacyBar.Library.BarActions
{
/// <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 LegacyBarMenuItem : IMenuItem
{
public LegacyBarMenuItem(int id, IntPtr handle)
{
ItemId = id;
Handle = handle;
}

public IntPtr Handle { get; private set; }
public char AlphabeticShortcut { get; private set; }
public int GroupId { get; private set; }
public bool HasSubMenu { get; private set; }
public Drawable Icon { get; private set; }
public Intent Intent { get; private set; }
public bool IsActionViewExpanded { get; private set; }
public bool IsCheckable { get; private set; }
public bool IsChecked { get; private set; }
public bool IsEnabled { get; private set; }
public bool IsVisible { get; private set; }
public int ItemId { get; private set; }
public IContextMenuContextMenuInfo MenuInfo { get; private set; }
public char NumericShortcut { get; private set; }
public int Order { get; private set; }
public ISubMenu SubMenu { get; private set; }
public ICharSequence TitleFormatted { get; private set; }
public ICharSequence TitleCondensedFormatted { get; private set; }
public View ActionView { get; private set; }

public void Dispose()
{
throw new NotImplementedException();
}

public bool CollapseActionView()
{
throw new NotImplementedException();
}

public bool ExpandActionView()
{
throw new NotImplementedException();
}

public IMenuItem SetActionView(View view)
{
throw new NotImplementedException();
}

public IMenuItem SetActionView(int resId)
{
throw new NotImplementedException();
}

public IMenuItem SetAlphabeticShortcut(char alphaChar)
{
throw new NotImplementedException();
}

public IMenuItem SetCheckable(bool checkable)
{
throw new NotImplementedException();
}

public IMenuItem SetChecked(bool @checked)
{
throw new NotImplementedException();
}

public IMenuItem SetEnabled(bool enabled)
{
throw new NotImplementedException();
}

public IMenuItem SetIcon(Drawable icon)
{
throw new NotImplementedException();
}

public IMenuItem SetIcon(int iconRes)
{
throw new NotImplementedException();
}

public IMenuItem SetIntent(Intent intent)
{
throw new NotImplementedException();
}

public IMenuItem SetNumericShortcut(char numericChar)
{
throw new NotImplementedException();
}

public IMenuItem SetOnMenuItemClickListener(IMenuItemOnMenuItemClickListener menuItemClickListener)
{
throw new NotImplementedException();
}

public IMenuItem SetShortcut(char numericChar, char alphaChar)
{
throw new NotImplementedException();
}



public IMenuItem SetTitle(int title)
{
throw new NotImplementedException();
}

public IMenuItem SetTitle(ICharSequence title)
{
throw new NotImplementedException();
}

public IMenuItem SetTitleCondensed(ICharSequence title)
{
throw new NotImplementedException();
}

public IMenuItem SetVisible(bool visible)
{
throw new NotImplementedException();
}

#if __ANDROID_14_
public IMenuItem SetOnActionExpandListener(IMenuItemOnActionExpandListener listener)
{
throw new NotImplementedException();
}

public void SetShowAsAction(ShowAsAction actionEnum)
{
throw new NotImplementedException();
}

public IMenuItem SetShowAsActionFlags(ShowAsAction actionEnum)
{
throw new NotImplementedException();
}

public IMenuItem SetActionProvider(ActionProvider actionProvider)
{
throw new NotImplementedException();
}

public ActionProvider ActionProvider { get; private set; }
#endif
}
}
110 changes: 0 additions & 110 deletions LegacyBar.Library/BarActions/MenuItemLegacyBarAction.cs
Expand Up @@ -18,122 +18,12 @@
*
*/

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

namespace LegacyBar.Library.BarActions
{
/// <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 LegacyBarMenuItem : IMenuItem
{
public LegacyBarMenuItem(int id, IntPtr handle)
{
ItemId = id;
Handle = handle;
}

public IntPtr Handle { get; private set; }
public char AlphabeticShortcut { get; private set; }
public int GroupId { get; private set; }
public bool HasSubMenu { get; private set; }
public Drawable Icon { get; private set; }
public Intent Intent { get; private set; }
public bool IsCheckable { get; private set; }
public bool IsChecked { get; private set; }
public bool IsEnabled { get; private set; }
public bool IsVisible { get; private set; }
public int ItemId { get; private set; }
public IContextMenuContextMenuInfo MenuInfo { get; private set; }
public char NumericShortcut { get; private set; }
public int Order { get; private set; }
public ISubMenu SubMenu { get; private set; }
public ICharSequence TitleFormatted { get; private set; }
public ICharSequence TitleCondensedFormatted { get; private set; }
public View ActionView { get; private set; }

public void Dispose()
{
throw new NotImplementedException();
}

public IMenuItem SetAlphabeticShortcut(char alphaChar)
{
throw new NotImplementedException();
}

public IMenuItem SetCheckable(bool checkable)
{
throw new NotImplementedException();
}

public IMenuItem SetChecked(bool @checked)
{
throw new NotImplementedException();
}

public IMenuItem SetEnabled(bool enabled)
{
throw new NotImplementedException();
}

public IMenuItem SetIcon(Drawable icon)
{
throw new NotImplementedException();
}

public IMenuItem SetIcon(int iconRes)
{
throw new NotImplementedException();
}

public IMenuItem SetIntent(Intent intent)
{
throw new NotImplementedException();
}

public IMenuItem SetNumericShortcut(char numericChar)
{
throw new NotImplementedException();
}

public IMenuItem SetOnMenuItemClickListener(IMenuItemOnMenuItemClickListener menuItemClickListener)
{
throw new NotImplementedException();
}

public IMenuItem SetShortcut(char numericChar, char alphaChar)
{
throw new NotImplementedException();
}

public IMenuItem SetTitle(int title)
{
throw new NotImplementedException();
}

public IMenuItem SetTitle(ICharSequence title)
{
throw new NotImplementedException();
}

public IMenuItem SetTitleCondensed(ICharSequence title)
{
throw new NotImplementedException();
}

public IMenuItem SetVisible(bool visible)
{
throw new NotImplementedException();
}
}

/// <summary>
/// MenuItemLegacyBarAction will call teh main activitiess "OnOptionsItemSelected", which allows us to re-use code.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion LegacyBar.Library/LegacyBar.Library.csproj
Expand Up @@ -46,6 +46,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="BarActions\ActionLegacyBarAction.cs" />
<Compile Include="BarActions\LegacyBarMenuItem.cs" />
<Compile Include="BarBase\LegacyBarExpandableListActivity.cs" />
<Compile Include="BarBase\LegacyBarTabActivity.cs" />
<Compile Include="Resources\Resource.designer.cs" />
Expand All @@ -66,7 +67,6 @@
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
<None Include="Properties\AndroidManifest.xml" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\Drawable\actionbar_back_indicator.png" />
Expand Down
6 changes: 0 additions & 6 deletions LegacyBar.Library/Properties/AndroidManifest.xml

This file was deleted.

0 comments on commit 07662fc

Please sign in to comment.