Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/johnkil/SideNavigation

Implementation of "Side Navigation" or "Fly-in app menu" pattern for Android (based on Google+ app)
https://github.com/johnkil/SideNavigation

Last synced: 2 months ago
JSON representation

Implementation of "Side Navigation" or "Fly-in app menu" pattern for Android (based on Google+ app)

Awesome Lists containing this project

README

        

Android SideNavigation Library
==============================

Implementation of "Side Navigation" or "Fly-in app menu" pattern for Android (based on Google+ app).

Description
-----------

The Google+ app slides the navigation on top of the UI while the others move the UI to the side.
Google+ also has the up caret icon and the action bar present when the menu is opened while other apps don't.

There was a interesting discussion about this pattern in the blog's Google+ page some time ago.
You can find the post & discussion here: [Google+](https://plus.google.com/115177579026138386092/posts/AvXiTF7LqDK).

Sample
------

A sample application is available on Google Play:


Get it on Google Play

![Example Image][1] ![Example Image][2]

The source code is available in this repository.

Compatibility
-------------

This library is compatible from API 4 (Android 1.6).

Installation
------------

The sample project requires:

* The library project
* [ActionBarSherlock](https://github.com/JakeWharton/ActionBarSherlock)

Usage
-----

SideNavigation is presented as an [Android library project](http://developer.android.com/guide/developing/projects/projects-eclipse.html).
You can include this project by [referencing it as a library project](http://developer.android.com/guide/developing/projects/projects-eclipse.html#ReferencingLibraryProject) in Eclipse or ant.

To display the item you need the following code:

* Add SideNavigationView to the end of the layout. Example:

``` xml

```

* Create '.xml' description of the menu for the sideNavigationView. Example:

``` xml





```

* Set home should be displayed as an "up" and initialize the sideNavigationView:

``` java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// other code

sideNavigationView = (SideNavigationView) findViewById(R.id.side_navigation_view);
sideNavigationView.setMenuItems(R.menu.side_navigation_menu);
sideNavigationView.setMenuClickCallback(/*ISideNavigationCallback*/);
sideNavigationView.setMode(/*SideNavigationView.Mode*/);

getActionBar().setDisplayHomeAsUpEnabled(true);
}
```

* Override onOptionsItemSelected() method for show/hide teh sideNavigationView:

``` java
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
sideNavigationView.toggleMenu();
break;
default:
return super.onOptionsItemSelected(item);
}
return true;
}
```

* Implementation of ISideNavigationCallback:

``` java
ISideNavigationCallback sideNavigationCallback = new ISideNavigationCallback() {

@Override
public void onSideNavigationItemClick(int itemId) {
// Validation clicking on side navigation item
}
};
```

Contribution
------------

Please fork [dev](https://github.com/johnkil/SideNavigation/tree/dev) repository and contribute back using [pull requests](https://github.com/johnkil/SideNavigation/pulls).

Contributors are recommended to follow the Android [Code Style Guidelines](http://source.android.com/source/code-style.html).

Any contributions, large or small, major features, bug fixes, additional language translations, unit/integration tests are welcomed and appreciated but will be thoroughly reviewed and discussed.

Developed By
------------
* Evgeny Shishkin -

License
-------

Copyright (C) 2012 Evgeny Shishkin

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.

[1]: http://i45.tinypic.com/f8jzn.png
[2]: http://i48.tinypic.com/2naid6d.png