Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to use the library #10

Closed
NateZ7 opened this issue Apr 5, 2018 · 6 comments
Closed

Error when trying to use the library #10

NateZ7 opened this issue Apr 5, 2018 · 6 comments

Comments

@NateZ7
Copy link

NateZ7 commented Apr 5, 2018

The library looks fantastic and I would like to use it.
I added the following to the build.gradle

implementation 'com.github.skydoves:powermenu:2.0.3

on onCreate I have the following code -

         powerMenu = new PowerMenu.Builder(this)
                .addItem(new PowerMenuItem("Settings", false))
                .addItem(new PowerMenuItem("Travel", false))
                .addItem(new PowerMenuItem("Logout", false))
                .setAnimation(MenuAnimation.SHOWUP_TOP_LEFT) // Animation start point (TOP | LEFT)
                .setMenuRadius(0f)
                .setMenuShadow(0f)
                .setTextColor(Color.BLACK)
                .setSelectedTextColor(Color.WHITE)
                .setMenuColor(Color.WHITE)
                .setSelectedMenuColor(Color.BLACK)
                .setOnMenuItemClickListener(new OnMenuItemClickListener<PowerMenuItem>() {
                    @Override
                    public void onItemClick(int position, PowerMenuItem item) {
                        Toast.makeText(getBaseContext(), item.getTitle(), Toast.LENGTH_SHORT).show();
                    }
                })
                .build();

        mMenuButton = (Button)findViewById(R.id.floating_menu_context);
        mMenuButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                powerMenu.showAsDropDown(view);
            }
        });

I get the following error :

Error:(339, 26) error: cannot access LifecycleObserver class file for android.arch.lifecycle.LifecycleObserver not found

any help ?
thanks !

@skydoves
Copy link
Owner

skydoves commented Apr 5, 2018

Make sure you have these added as gradle dependencies please.

 implementation "android.arch.lifecycle:livedata:1.1.1"
 implementation "android.arch.lifecycle:extensions:1.1.1"

Thanks!

@NateZ7
Copy link
Author

NateZ7 commented Apr 10, 2018

@skydoves Thanks !! It did the trick.

Another question, how do I change the font of the items inside the menu ?
Thanks, looks great so far.

@skydoves
Copy link
Owner

skydoves commented Apr 10, 2018

@NateZ7
If you want other fonts of the item, you should use CustomPowerMenu with your own customized item layout.

Thanks!

@NateZ7
Copy link
Author

NateZ7 commented Apr 10, 2018

@skydoves Isn't there any simpler way of doing so instead of creating custom class and adapter ?
Thanks !

@skydoves
Copy link
Owner

@NateZ7
Sorry. The only way is Customizing now.
Thank you!

@NateZ7
Copy link
Author

NateZ7 commented Apr 10, 2018

OK, I managed to do what I needed with the CustomPowerMenu, thanks for all the help, great lib !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants