Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Upgraded to Support Android X #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SlidingMenuSharp
================

A direct port of [SlidingMenu](https://github.com/jfeinstein10/SlidingMenu) to C# to work with [Xamarin.Android](http://xamarin.com/monoforandroid)
A direct port of [SlidingMenu](https://github.com/jfeinstein10/SlidingMenu) to C# to work with [Xamarin.Android](http://xamarin.com/monoforandroid) **upgraded to support AndroidX**

TODO
----
Expand Down
66 changes: 33 additions & 33 deletions SlidingMenuSharp/App/ISlidingActivity.cs
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
/*
* Copyright 2012-2014 Jeremy Feinstein
* Copyright 2013-2014 Tomasz Cielecki
*
* 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.
*/
using Android.Views;
namespace SlidingMenuSharp.App
{
public interface ISlidingActivity
{
void SetBehindContentView(View view, ViewGroup.LayoutParams layoutParams);
void SetBehindContentView(View view);
void SetBehindContentView(int layoutResId);
SlidingMenu SlidingMenu { get; }
void Toggle();
void ShowContent();
void ShowMenu();
void ShowSecondaryMenu();
void SetSlidingActionBarEnabled(bool enabled);
}
/*
* Copyright 2012-2014 Jeremy Feinstein
* Copyright 2013-2014 Tomasz Cielecki
*
* 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.
*/

using Android.Views;

namespace SlidingMenuSharp.App
{
public interface ISlidingActivity
{
void SetBehindContentView(View view, ViewGroup.LayoutParams layoutParams);
void SetBehindContentView(View view);
void SetBehindContentView(int layoutResId);
SlidingMenu SlidingMenu { get; }
void Toggle();
void ShowContent();
void ShowMenu();
void ShowSecondaryMenu();
void SetSlidingActionBarEnabled(bool enabled);
}
}
242 changes: 121 additions & 121 deletions SlidingMenuSharp/App/SlidingActivity.cs
Original file line number Diff line number Diff line change
@@ -1,122 +1,122 @@
/*
* Copyright 2012-2014 Jeremy Feinstein
* Copyright 2013-2014 Tomasz Cielecki
*
* 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.
*/
using Android.App;
using Android.OS;
using Android.Views;
namespace SlidingMenuSharp.App
{
public class SlidingActivity : Activity, ISlidingActivity
{
private SlidingActivityHelper _helper;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
_helper = new SlidingActivityHelper(this);
_helper.OnCreate(savedInstanceState);
}
protected override void OnPostCreate(Bundle savedInstanceState)
{
base.OnPostCreate(savedInstanceState);
_helper.OnPostCreate(savedInstanceState);
}
public override View FindViewById(int id)
{
var v = base.FindViewById(id);
return v ?? _helper.FindViewById(id);
}
protected override void OnSaveInstanceState(Bundle outState)
{
base.OnSaveInstanceState(outState);
_helper.OnSaveInstanceState(outState);
}
public override void SetContentView(int layoutResId)
{
SetContentView(LayoutInflater.Inflate(layoutResId, null));
}
public override void SetContentView(View view)
{
SetContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
ViewGroup.LayoutParams.MatchParent));
}
public override void SetContentView(View view, ViewGroup.LayoutParams @params)
{
base.SetContentView(view, @params);
_helper.RegisterAboveContentView(view, @params);
}
public void SetBehindContentView(View view, ViewGroup.LayoutParams layoutParams)
{
_helper.SetBehindContentView(view, layoutParams);
}
public void SetBehindContentView(View view)
{
SetBehindContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
ViewGroup.LayoutParams.MatchParent));
}
public void SetBehindContentView(int layoutResId)
{
SetBehindContentView(LayoutInflater.Inflate(layoutResId, null));
}
public SlidingMenu SlidingMenu
{
get { return _helper.SlidingMenu; }
}
public void Toggle()
{
_helper.Toggle();
}
public void ShowContent()
{
_helper.ShowContent();
}
public void ShowMenu()
{
_helper.ShowMenu();
}
public void ShowSecondaryMenu()
{
_helper.ShowSecondaryMenu();
}
public void SetSlidingActionBarEnabled(bool enabled)
{
_helper.SlidingActionBarEnabled = enabled;
}
public override bool OnKeyUp(Keycode keyCode, KeyEvent e)
{
var b = _helper.OnKeyUp(keyCode, e);
return b ? b : base.OnKeyUp(keyCode, e);
}
}
/*
* Copyright 2012-2014 Jeremy Feinstein
* Copyright 2013-2014 Tomasz Cielecki
*
* 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.
*/

using Android.App;
using Android.OS;
using Android.Views;

namespace SlidingMenuSharp.App
{
public class SlidingActivity : Activity, ISlidingActivity
{
private SlidingActivityHelper _helper;

protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
_helper = new SlidingActivityHelper(this);
_helper.OnCreate(savedInstanceState);
}

protected override void OnPostCreate(Bundle savedInstanceState)
{
base.OnPostCreate(savedInstanceState);
_helper.OnPostCreate(savedInstanceState);
}

public override View FindViewById(int id)
{
var v = base.FindViewById(id);
return v ?? _helper.FindViewById(id);
}

protected override void OnSaveInstanceState(Bundle outState)
{
base.OnSaveInstanceState(outState);
_helper.OnSaveInstanceState(outState);
}

public override void SetContentView(int layoutResId)
{
SetContentView(LayoutInflater.Inflate(layoutResId, null));
}

public override void SetContentView(View view)
{
SetContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
ViewGroup.LayoutParams.MatchParent));
}

public override void SetContentView(View view, ViewGroup.LayoutParams @params)
{
base.SetContentView(view, @params);
_helper.RegisterAboveContentView(view, @params);
}

public void SetBehindContentView(View view, ViewGroup.LayoutParams layoutParams)
{
_helper.SetBehindContentView(view, layoutParams);
}

public void SetBehindContentView(View view)
{
SetBehindContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
ViewGroup.LayoutParams.MatchParent));
}

public void SetBehindContentView(int layoutResId)
{
SetBehindContentView(LayoutInflater.Inflate(layoutResId, null));
}

public SlidingMenu SlidingMenu
{
get { return _helper.SlidingMenu; }
}

public void Toggle()
{
_helper.Toggle();
}

public void ShowContent()
{
_helper.ShowContent();
}

public void ShowMenu()
{
_helper.ShowMenu();
}

public void ShowSecondaryMenu()
{
_helper.ShowSecondaryMenu();
}

public void SetSlidingActionBarEnabled(bool enabled)
{
_helper.SlidingActionBarEnabled = enabled;
}

public override bool OnKeyUp(Keycode keyCode, KeyEvent e)
{
var b = _helper.OnKeyUp(keyCode, e);
return b ? b : base.OnKeyUp(keyCode, e);
}
}
}
Loading