Git Product home page Git Product logo

ribbonmenu's Introduction

RibbonMenu

Navigation menu for Android (based on Google+ app).

RibbonMenu

Usage

Menus are created in xml as normal, adding text and an icon.

In the layout you want to show the menu, add a FrameLayout as the root layout and add the RibbonMenuView set with width and height to match_parent.

In your class you need to implement the iRibbonMenuCallback interface. This is called when you click a menu item and it passes the menu item id from the xml. You then make a reference to the RibbonMenuView and set the callback, set the menu items and add toggleMenu() to your android.R.id.home in your onOptionsItemSelected

The sample activity shows how it should all work.

License

Copyright 2012 David Scott

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.

ribbonmenu's People

Contributors

aeefire avatar darvds avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ribbonmenu's Issues

Custom Adapter

Hello,

I love Your library, it looks awesome. I would like to dynamically set the icons of menuitems. Right now when I call:

MenuItem avatar = (MenuItem) mRibbonMenu.findViewById(R.id.ribbon_menu_avatar);
avatar.setTitle("hello world");

I get NullPointerException.

It would be also nice to be able to set custom adapter for the menu so I can style it like regular layout. Is that possible?

Tried to open sample with Eclipse, does not work

When importing the sample into Eclipse and running it, there are errors in scr/com.darvds.ribbonmenu.sample/RibbonsampleActivity.java

@OverRide
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(com.darvds.ribbonmenu.sample.R.layout.main);

        rbmView = (RibbonMenuView) findViewById(R.id.ribbonMenuView1);
        rbmView.setMenuClickCallback(this);
        rbmView.setMenuItems(R.menu.ribbon_menu);

        getActionBar().setDisplayHomeAsUpEnabled(true);
    }

"R.layout.main" have to be changed to "com.darvds.ribbonmenu.sample.R.layout.main" in order to fix the error bugs

CacheColorHint issue

Hi
Library looks very nice. I had a problem when using it on a pre-honeycomb device: awful black bleeding through the list whenever it is touched. This also happens on honeycomb+ devices if minSDKversion is set below honeycomb.
To get around it, all that's needed is to set the cacheColorHint to the same colour as the background on the ListView:
android:cacheColorHint="#303030"
android:background="#303030"
As described a long time ago, here: http://www.curious-creature.org/2008/12/22/why-is-my-list-black-an-android-optimization/
Annoying problem. Simple fix.
There is another small issue with setting the background in your code:

public void setBackgroundColor(int color){
        rbmListView.setBackgroundResource(color);

    }

That's kinda mis-named I think. You are overriding the method to set a colour in order to set a resource instead.

TAG

Hi there,

We are using your library in an android app. By the way your library is pretty good.

Would you be able to create a tag with the latest version so that we can reference it from our project?

thanks,

Mauricio

App Keeps Crashing

I having some difficulty getting this up and running. I'm new to Android app dev btw. Everything seems to be imported correctly but the app keeps crashing. The app loads if I uncomment this line in the mainActivity onCreate

getActionBar().setDisplayHomeAsUpEnabled(true);

Debug mode isn't showing me anything either. Any way you can help me out?

What about the Color?

Can anyone help me? I am trying to figure it out how to change the menu background color. No Sucess.
regards

Screenshots

Please add some screenshots of yours menu for better propagation of your project.

Naming conventions

Please stick to the Java / Android naming conventions. In this case, it would be good to rename the call back interface:

public interface OnRibbonMenuSelectedListener {
    public void onRibbonMenuItemClick(View item);
}
  • Class name starts with an upper-case letter
  • Class is a listener (as for instance the DialogInterface.OnClickListener)
  • Method name starts with a lower case-letter (and "on" to denote an event)
  • We pass the complete view if possible, not just the ID. That way you can store data within the view if needed (in the view tag for instance).

Error retriving item id

@OverRide
public void RibbonMenuItemClick(int itemId)

the itemid return "false".

to fix it you need to change

"callback.RibbonMenuItemClick(menuItems.get(position).id);"
to
"callback.RibbonMenuItemClick(position);"

LukeMovement.

Theming

I'm using Holo Dark in my application, which makes the text illegible. Adding 'android:theme="@android:style/Theme.Holo.Light"' to the RibbonMenuView does not help and there is no textColor attribute for this View.

Is there any solution for this? Thanks!

Missing license info

The project and the source files do not state what license they are available under. Right now, nobody is allowed to do anything with your code, unless they wish to violate your copyright over those files. If that is your intention, that's fine, though you might want to specifically mention in the README that this code is not available under any open source license, just to clear up confusion.

not handle screen rotation

  1. open (show) the ribbon menu
  2. rotate the device
  3. you can see that the ribbon menu is hidden <- it should be kept in the show state.

You can fix the problem by adding the following code in RibbonMenuView.

@Override protected void 
onRestoreInstanceState(Parcelable state)
{
    SavedState ss = (SavedState)state;
    super.onRestoreInstanceState(ss.getSuperState());

    if (ss.bShowMenu)
        showMenu();
    else
        hideMenu();
}

@Override protected Parcelable 
onSaveInstanceState()
{
    Parcelable superState = super.onSaveInstanceState();
    SavedState ss = new SavedState(superState);

    ss.bShowMenu = (rbmOutsideView.getVisibility() != View.GONE);

    return ss;
}

static class SavedState extends BaseSavedState {
    boolean bShowMenu;

    SavedState(Parcelable superState) {
        super(superState);
    }

    private SavedState(Parcel in) {
        super(in);
        bShowMenu = (in.readInt() == 1);
    }

    @Override
    public void writeToParcel(Parcel out, int flags) {
        super.writeToParcel(out, flags);
        out.writeInt(bShowMenu ? 1 : 0);
    }

    public static final Parcelable.Creator<SavedState> CREATOR
            = new Parcelable.Creator<SavedState>() {
        public SavedState createFromParcel(Parcel in) {
            return new SavedState(in);
        }

        public SavedState[] newArray(int size) {
            return new SavedState[size];
        }
    };
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.