๐Ÿ”ฅ A powerful and polished, fully customizable modern Material Popup menu.

Overview

PowerMenu


๐Ÿ”ฅ A powerful and polished, fully customizable modern Material Popup menu.


Google
License API CI AndroidWeekly Medium Profile Javadoc


Download

Maven Central Jitpack

I really appreciate that ๐Ÿ”ฅ Power Menu is used in more than 240,000+ project's dependency all over the ๐ŸŒŽ world.

screenshot1903218121

Gradle

Add below codes to your root build.gradle file (not your module build.gradle file).

allprojects {
    repositories {
        mavenCentral()
    }
}

And add a dependency code to your module's build.gradle file.

dependencies {
  implementation "com.github.skydoves:powermenu:2.2.0"
}

Table of Contents

1. PowerMenu
2. Customizing Popup
3. Preference
4. Menu Effect
5. Dialogs
6. Anchor
7. Background
8. Avoid Memory leak
9. Functions
10. Lazy initialization in Kotlin

Usage

Basic example

This is a basic example on a screenshot. Here is how to create PowerMenu using PowerMenu.Builder.

PowerMenu powerMenu = new PowerMenu.Builder(context)
          .addItemList(list) // list has "Novel", "Poerty", "Art"
          .addItem(new PowerMenuItem("Journals", false)) // add an item.
          .addItem(new PowerMenuItem("Travel", false)) // aad an item list.
          .setAnimation(MenuAnimation.SHOWUP_TOP_LEFT) // Animation start point (TOP | LEFT).
          .setMenuRadius(10f) // sets the corner radius.
          .setMenuShadow(10f) // sets the shadow.
          .setTextColor(ContextCompat.getColor(context, R.color.md_grey_800))
          .setTextGravity(Gravity.CENTER)
          .setTextTypeface(Typeface.create("sans-serif-medium", Typeface.BOLD))
          .setSelectedTextColor(Color.WHITE)
          .setMenuColor(Color.WHITE)
          .setSelectedMenuColor(ContextCompat.getColor(context, R.color.colorPrimary))
          .setOnMenuItemClickListener(onMenuItemClickListener)
          .build();

We can add an item or an item list using PowerMenuItem class. This is how to initialize PowerMenuItem.

new PowerMenuItem("Travel");
new PowerMenuItem("Poetery", false); // item name, isSelected (default is false).
new PowerMenuItem("Art", R.drawable.icon_art) // item name, item menu icon.
new PowerMenuItem("Travel", R.drawable.icon_travel, true) // item name, item menu icon, isSelected .

The first argument is an item title, and the other is selected status.
If isSelected is true, the item's text and the background color will be changed by settings like below.

.setSelectedTextColor(Color.WHITE) // sets the color of the selected item text. 
.setSelectedMenuColor(ContextCompat.getColor(context, R.color.colorPrimary)) // sets the color of the selected menu item color.

OnMenuItemClickListener is for listening to the item click of the popup menu.

private OnMenuItemClickListener<PowerMenuItem> onMenuItemClickListener = new OnMenuItemClickListener<PowerMenuItem>() {
    @Override
    public void onItemClick(int position, PowerMenuItem item) {
        Toast.makeText(getBaseContext(), item.getTitle(), Toast.LENGTH_SHORT).show();
        powerMenu.setSelectedPosition(position); // change selected item
        powerMenu.dismiss();
    }
};

After implementing the listener, we should set using setOnMenuItemClickListener method.

.setOnMenuItemClickListener(onMenuItemClickListener)

The last, show the popup! Various show & dismiss methods.

powerMenu.showAsDropDown(view); // view is an anchor

Customizing Popup

We can customize item styles using CustomPowerMenu and your customized adapter.
Here is how to customize the popup item that has an icon.

custom0 gif0

Firstly, we should create our item model class.

public class IconPowerMenuItem {
    private Drawable icon;
    private String title;

    public IconPowerMenuItem(Drawable icon, String title) {
        this.icon = icon;
        this.title = title;
    }
 // --- skipped setter and getter methods
}

And we should create our customized XML layout and an adapter.
Custom Adapter should extend MenuBaseAdapter .

public class IconMenuAdapter extends MenuBaseAdapter<IconPowerMenuItem> {

    @Override
    public View getView(int index, View view, ViewGroup viewGroup) {
        final Context context = viewGroup.getContext();

        if(view == null) {
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            view = inflater.inflate(R.layout.item_icon_menu, viewGroup, false);
        }

        IconPowerMenuItem item = (IconPowerMenuItem) getItem(index);
        final ImageView icon = view.findViewById(R.id.item_icon);
        icon.setImageDrawable(item.getIcon());
        final TextView title = view.findViewById(R.id.item_title);
        title.setText(item.getTitle());
        return super.getView(index, view, viewGroup);
    }
}

The last, create the CustomPowerMenu with the onMenuItemClickListener.

CustomPowerMenu customPowerMenu = new CustomPowerMenu.Builder<>(context, new IconMenuAdapter())
       .addItem(new IconPowerMenuItem(ContextCompat.getDrawable(context, R.drawable.ic_wechat), "WeChat"))
       .addItem(new IconPowerMenuItem(ContextCompat.getDrawable(context, R.drawable.ic_facebook), "Facebook"))
       .addItem(new IconPowerMenuItem(ContextCompat.getDrawable(context, R.drawable.ic_twitter), "Twitter"))
       .addItem(new IconPowerMenuItem(ContextCompat.getDrawable(context, R.drawable.ic_line), "Line"))
       .setOnMenuItemClickListener(onIconMenuItemClickListener)
       .setAnimation(MenuAnimation.SHOWUP_TOP_RIGHT)
       .setMenuRadius(10f)
       .setMenuShadow(10f)
       .build();
private OnMenuItemClickListener<IconPowerMenuItem> onIconMenuItemClickListener = new OnMenuItemClickListener<IconPowerMenuItem>() {
    @Override
    public void onItemClick(int position, IconPowerMenuItem item) {
        Toast.makeText(getBaseContext(), item.getTitle(), Toast.LENGTH_SHORT).show();
        iconMenu.dismiss();
    }
};

Preference

PowerMenu supports saving of the last selected menu and recovering as lifecycle.
Here is how to save and recover selected menu.

return new PowerMenu.Builder(context)
    // saves the position automatically when the menu is selected.
    // If we set the same preference name on the other PowerMenus, they will share the saving position.
   .setPreferenceName("HamburgerPowerMenu")

    // invokes the listener automatically that has the saved position arguments along the lifecycle rule.
    // lifecycle rules should be ON_CREATE, ON_START or ON_RESUME.
    // in the below codes, the onMenuClickListener will be invoked when onCreate lifecycle.
   .setLifecycleOwner(lifecycleOwner)
   .setInitializeRule(Lifecycle.Event.ON_CREATE, 0) // Lifecycle.Event and default position.
   --- skips ---

Here are the methods related to preference.

.getPreferenceName() // gets the preference name of PowerMenu.
.getPreferencePosition(int defaultPosition) // gets the saved preference position from the SharedPreferences.
.setPreferencePosition(int defaultPosition) // sets the preference position name for persistence manually.
.clearPreference() // clears the preference name of PowerMenu.

Menu Effect

We can give two types of circular revealed animation effect.

menu_effect01 menu_effect02
Here is how to create a menu effect simply.

.setCircularEffect(CircularEffect.BODY) // shows circular revealed effects for all body of the popup menu.
.setCircularEffect(CircularEffect.INNER) // Shows circular revealed effects for the content view of the popup menu.

Dialogs

We can create looks like dialogs using PowerMenu.

screenshot_2017-12-18-23-39-00 screenshot_2017-12-18-23-39-05

Here is an example of the normal dialog. Dialogs are composed of a header, footer, and body.

PowerMenu powerMenu = new PowerMenu.Builder(context)
           .setHeaderView(R.layout.layout_dialog_header) // header used for title
           .setFooterView(R.layout.layout_dialog_footer) // footer used for yes and no buttons
           .addItem(new PowerMenuItem("This is DialogPowerMenu", false)) // this is body
           .setLifecycleOwner(lifecycleOwner)
           .setAnimation(MenuAnimation.SHOW_UP_CENTER)
           .setMenuRadius(10f)
           .setMenuShadow(10f)
           .setWith(600)
           .setSelectedEffect(false)
           .build();

And we can create a customized dialog like below.

CustomPowerMenu customPowerMenu = new CustomPowerMenu.Builder<>(context, new CustomDialogMenuAdapter())
         setHeaderView(R.layout.layout_custom_dialog_header) // header used for title
        .setFooterView(R.layout.layout_custom_dialog_footer) // footer used for Read More and Close buttons
         // this is body
        .addItem(new NameCardMenuItem(ContextCompat.getDrawable(context, R.drawable.face3), "Sophie", context.getString(R.string.board3)))
        .setLifecycleOwner(lifecycleOwner)
        .setAnimation(MenuAnimation.SHOW_UP_CENTER)
        .setWith(800)
        .setMenuRadius(10f)
        .setMenuShadow(10f)
        .build();

Anchor

We can show the popup menu as drop down to the anchor.

.showAsAnchorLeftTop(view) // showing the popup menu as left-top aligns to the anchor.
.showAsAnchorLeftBottom(view) // showing the popup menu as left-bottom aligns to the anchor.
.showAsAnchorRightTop(view) // using with .setAnimation(MenuAnimation.SHOWUP_TOP_RIGHT) looks better
.showAsAnchorRightBottom(view) // using with .setAnimation(MenuAnimation.SHOWUP_TOP_RIGHT) looks better
.showAsAnchorCenter(view) // using with .setAnimation(MenuAnimation.SHOW_UP_CENTER) looks better

or we can control the position of the popup menu using the below methods.

.getContentViewWidth() // return popup's measured width
.getContentViewHeight() // return popup's measured height

like this :

// showing the popup menu at the center of an anchor. This is the same using .showAsAnchorCenter.
hamburgerMenu.showAsDropDown(view, 
        view.getMeasuredWidth()/2 - hamburgerMenu.getContentViewWidth(), 
       -view.getMeasuredHeight()/2 - hamburgerMenu.getContentViewHeight());

Background

These are options for the background.

.setShowBackground(false) // do not showing background.
.setTouchInterceptor(onTouchListener) // sets the touch listener for the outside of popup.
.setFocusable(true) // makes focusing only on the menu popup.

Avoid Memory leak

Dialog, PopupWindow and etc.. have memory leak issue if not dismissed before activity or fragment are destroyed.
But Lifecycles are now integrated with the Support Library since Architecture Components 1.0 Stable released.
So we can solve the memory leak issue so easily.

Just use setLifecycleOwner method. Then dismiss method will be called automatically before activity or fragment would be destroyed.

.setLifecycleOwner(lifecycleOwner)

Lazy initialization in Kotlin

We can initialize the PowerMenu property lazily using powerMenu keyword and PowerMenu.Factory abstract class.
The powerMenu extension keyword can be used in Activity and Fragment.

class MainActivity : AppCompatActivity() {

  private val moreMenu by powerMenu(MoreMenuFactory::class)
  
  //..

We should create a factory class which extends PowerMenu.Factory.
An implementation class of the factory must have a default(non-argument) constructor.

class MoreMenuFactory : PowerMenu.Factory() {

  override fun create(context: Context, lifecycle: LifecycleOwner?): PowerMenu {
    return createPowerMenu(context) {
      addItem(PowerMenuItem("Novel", true))
      addItem(PowerMenuItem("Poetry", false))
      setAutoDismiss(true)
      setLifecycleOwner(lifecycle)
      setAnimation(MenuAnimation.SHOWUP_TOP_LEFT)
      setTextColor(ContextCompat.getColor(context, R.color.md_grey_800))
      setTextSize(12)
      setTextGravity(Gravity.CENTER)
      setTextTypeface(Typeface.create("sans-serif-medium", Typeface.BOLD))
      setSelectedTextColor(Color.WHITE)
      setMenuColor(Color.WHITE)
      setInitializeRule(Lifecycle.Event.ON_CREATE, 0)
    }
  }
}

Functions

PowerMenu methods

.addItemList(list) // add a PowerMenuItem list.
.addItem(new PowerMenuItem("Journals", false)) // add a PowerMenuItem.
.addItem(3, new PowerMenuItem("Travel", false)) // add a PowerMenuItem at position 3.
.setLifecycleOwner(lifecycleOwner) // set LifecycleOwner for preventing memory leak.
.setWith(300) // sets the popup width size.
.setHeight(400) // sets the popup height size.
.setMenuRadius(10f) // sets the popup corner radius.
.setMenuShadow(10f) // sets the popup shadow.
.setDivider(new ColorDrawable(ContextCompat.getColor(context, R.color.md_blue_grey_300))) // sets a divider.
.setDividerHeight(1) // sets the divider height.
.setAnimation(MenuAnimation.FADE) // sets animations of the popup. It will start up when the popup is showing.
.setTextColor(ContextCompat.getColor(context, R.color.md_grey_800)) // sets the color of the default item text.
.setTextSize(12) // sets a text size of the item text
.setTextGravity(Gravity.CENTER) // sets a gravity of the item text.
.setTextTypeface(Typeface.create("sans-serif-medium", Typeface.BOLD)) // sets a typeface of the item text
.setSelectedTextColor(Color.WHITE) // sets the color of the selected item text.
.setMenuColor(Color.WHITE) // sets the color of the menu item color.
.setSelectedMenuColor(ContextCompat.getColor(context, R.color.colorPrimary)) // sets the color of the selected menu item color.
.setSelectedEffect(false) // sets the selected effects what changing colors of the selected menu item.
.setOnMenuItemClickListener(onMenuItemClickListener) // sets an item click listener.
.setOnDismissListener(OnDismissedListener onDismissListener) // sets a menu dismiss listener.
.setHeaderView(View view) //  sets the header view of the popup menu list.
.setHeaderView(int layout) // sets the header view of the popup menu using layout.
.setFooterView(View view) // sets the footer view of the popup menu list.
.setFooterView(int layout) // sets the footer view of the popup menu using layout.
.setSelection(int position) // sets the selected position of the popup menu. It can be used for scrolling as the position.
.getSelectedPosition() // gets the selected item position. if not selected before, returns -1 .
.getHeaderView() // gets the header view of the popup menu list.
.getFooterView() // gets the footer view of the popup menu list.
.getMenuListView() // gets the ListView of the popup menu.

Background methods

.setBackgroundAlpha(0.7f) // sets the alpha of the background.
.setBackgroundColor(Color.GRAY) // sets the color of the background.
.setShowBackground(false) // sets the background is showing or not.
.setOnBackgroundClickListener(onClickListener) // sets the background click listener of the background.

Show & Dismiss

.showAsDropDown(View anchor); // showing the popup menu as drop down to the anchor.
.showAsDropDown(View anchor, -370, 0); // showing the popup menu as drop down to the anchor with x-off and y-off.
.showAtCenter(View layout); // showing the popup menu as center aligns to the anchor.
.showAtCenter(View layout, 0, 0); // showing the popup menu as center aligns to the anchor with x-off and y-off.
.showAtLocation(View anchor, int xOff, int yOff) // showing the popup menu as center aligns to the anchor with x-off and y-off.
.showAtLocation(View anchor, int gravity, int xOff, int yOff) // showing the popup menu to the specific location to the anchor with Gravity.
.isShowing(); // gets the popup is showing or not.
.dismiss(); // dismiss the popup.

Find this library useful? โค๏ธ

Support it by joining stargazers for this repository. โญ
And follow me for my next creations! ๐Ÿคฉ

License

Copyright 2017 skydoves

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.
Comments
  • powerMenu.isShowing() method null pointer exeption.

    powerMenu.isShowing() method null pointer exeption.

    
    
    public class GuestProfileFragment extends Fragment {
        PowerMenu powerMenu;
    
     @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
            View view = inflater.inflate(R.layout.fragment_guest_profile, container, false);
         
           powerMenu = new PowerMenu.Builder(getContext())
                    .addItem(new PowerMenuItem(getString(R.string.block), false))
                    .addItem(new PowerMenuItem(getString(R.string.report), false))
                    .setAnimation(MenuAnimation.SHOWUP_TOP_RIGHT)
                    .setMenuRadius(10f)
                    .setMenuShadow(10f)
                    .setTextColor(getResources().getColor(R.color.md_grey_800))
                    .setSelectedTextColor(Color.WHITE)
                    .setMenuColor(Color.WHITE)
                    .setSelectedMenuColor(getResources().getColor(R.color.colorPrimary))
                    .setOnMenuItemClickListener(new OnMenuItemClickListener<PowerMenuItem>() {
                        @Override
                        public void onItemClick(int position, PowerMenuItem item) {
                            Toast.makeText(getContext(),item.getTitle(),Toast.LENGTH_SHORT).show();
                            powerMenu.dismiss();
                        }
                    })
                    .build();
       
            return view;
        }
    
    public void backpress(){
            if(powerMenu.isShowing()){
                powerMenu.dismiss();
            }
            else{
                getFragmentManager().popBackStack();
            }
        }
    
    }
    

    This code give me null pointer exception how to fix this?

    I saw your code u used PowerMenuUtil class but that class doesnt show up .

    one more thing

    this is the only dependency i use implementation "com.github.skydoves:powermenu:2.0.5"

    opened by uzaysan 10
  • Release File

    Release File

    Hi. I can't sync gradle by adding implementation "com.github.skydoves:powermenu:2.0.5". I searched a lot, but i wasn't successful.

    Would you please place ZIP or AAR file of your library in releases? Thanks in advance.

    opened by rkarimi88 9
  • Fix focus state

    Fix focus state

    ๐ŸŽฏ Goal

    When launching a menu, it currently does get focus which makes it impossible to access when using keyboard navigation

    ๐Ÿ›  Implementation details

    I simply set the window to be focusable

    โœ๏ธ Explain examples

    Example is no navigable through keyboard when using .isFocusable

    Preparing a pull request for review

    Ensure your change is properly formatted by running:

    $ ./gradlew spotlessApply
    

    Then dump binary APIs of this library that is public in sense of Kotlin visibilities and ensures that the public binary API wasn't changed in a way that makes this change binary incompatible.

    ./gradlew apiDump
    

    Please correct any failures before requesting a review.

    Code reviews

    All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose. Consult GitHub Help for more information on using pull requests.

    opened by sebastienrouif 7
  • click for menu item is not happening on Custom Power Menu

    click for menu item is not happening on Custom Power Menu

    I tried integrating Power menu in my project but the click is not happening. I tried keeping an log also but its not going inside loop. customPowerMenu = new CustomPowerMenu.Builder<>(MapsActivityNew.this, new IconMenuAdapter()) .setWith(550) .setHeight(780) .addItem(new MapMenuFilter(false, "XXXX")) .addItem(new MapMenuFilter(false, "XXXX")) .setAnimation(MenuAnimation.SHOWUP_BOTTOM_RIGHT) .setMenuRadius(10f) .setMenuShadow(10f) .build();

    private OnMenuItemClickListener onIconMenuItemClickListener = new OnMenuItemClickListener() { @Override public void onItemClick(int position, MapMenuFilter item) { Log.e("Selected",item.getFilterName()+" << >> "+position); } };

    opened by dileepkantapop 7
  • PopupMenu BackGround is missing

    PopupMenu BackGround is missing

    Is your feature request related to a problem?

    A clear and concise description of what the problem is.

    Describe the solution you'd like:

    A clear and concise description of what you want to happen.

    Describe alternatives you've considered:

    A clear description of any alternative solutions you've considered.

    opened by mirzaalicdz 6
  • Error when trying to use the library

    Error when trying to use the library

    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 !

    opened by NateZ7 6
  • Wrong position in RecyclerView

    Wrong position in RecyclerView

    screenshot_1521524357

    The menu is attached to the "Productive" TextView, it looks fine on other list items, but when clicked on the last shown item in list, it ties to expand into the space remaining below the item instead of top.

    contextMenu.showAsDropDown(view, 0, 0);

    opened by zenkhas 6
  • error run app in emulator

    error run app in emulator

    Hi. When I add 'implementation "com.github.skydoves:powermenu:2.0.5"' build or running app become failed with this error : "Compilation failed; see the compiler error output for details." what should I do?? I use android studio 3.1.3 / min_sdk = 18/target_sdk=27 / buildToolsVersion= '27.0.3' Thank you.

    opened by SadeghRahmaniB 5
  • show as anchor from center

    show as anchor from center

    I have a view that has width of match_parent it's also my view anchor, I want toshow my pop-up from this view's center but it either show up from left or right

    opened by egek92 5
  • PowerMenu hides the virtual keyboard

    PowerMenu hides the virtual keyboard

    Please complete the following information:

    • Library Version : 2.2.0
    • Affected Device(s) : All

    Describe the Bug:

    To display search history, I use a PowerMenu when the user taps the search field.

    At the same time, the device's virtual keyboard appears... behind the PowerMenu, which prevents the user from typing (see below screenshot; it's even more obvious on smaller screen resolutions).

    image

    Expected Behavior:

    PowerMenu is displayed behind the virtual keyboard, and not the other way around.

    opened by RobbWatershed 4
  • Don't cover Android virtual keyboard

    Don't cover Android virtual keyboard

    Guidelines

    Prevent PowerMenu from covering the Android virtual keyboard (#90) Successfuly tested with the sample app

    Types of changes

    What types of changes does your code introduce?

    • [x] Bugfix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

    Preparing a pull request for review

    Ensure your change is properly formatted by running:

    $ ./gradlew spotlessApply
    

    Please correct any failures before requesting a review.

    opened by RobbWatershed 3
  • strict mode violation exception prevention

    strict mode violation exception prevention

    Please complete the following information:

    Library Version 2.2.0 Android 11.0 Describe the Bug:

    Using the CustomPowerMenu.Builder and having Strict mode enabled in our Android app we get StrictMode policy violation; ~duration=453 ms: android.os.strictmode.DiskReadViolation exception when trying to inflate our view

    Expected Behavior:

    Is it possible to provide a way of using for the CustomPowerMenu.Builder which uses AbstractPowerMenu which uses MenuPreferenceManager but NOT read or write to sharedPrefs from within MenuPreferenceManager as it currently stands, so as to avoid the StrictMode policy violation; ~duration=453 ms: android.os.strictmode.DiskReadViolation

    opened by yanioaioan 4
  • StrictMode policy violation; ~duration=453 ms: android.os.strictmode.DiskReadViolation exception

    StrictMode policy violation; ~duration=453 ms: android.os.strictmode.DiskReadViolation exception

    Please complete the following information:

    • Library Version 2.2.0
    • Android 11.0

    Describe the Bug:

    Using the CustomPowerMenu.Builder and having Strict mode enabled in our Android app we get StrictMode policy violation; ~duration=453 ms: android.os.strictmode.DiskReadViolation exception when trying to inflate our view

    Expected Behavior:

    Is it possible to provide a way of using for the CustomPowerMenu.Builder which uses AbstractPowerMenu which uses MenuPreferenceManager but NOT read or write to sharedPrefs from within MenuPreferenceManager as it currently stands, so as to avoid the StrictMode policy violation; ~duration=453 ms: android.os.strictmode.DiskReadViolation

    opened by yanioaioan 0
  • The IconPowerMenuItem does not respect the aspect ratio of the image and expects a square image.

    The IconPowerMenuItem does not respect the aspect ratio of the image and expects a square image.

    Is your feature request related to a problem? Currently the IconPowerMenuItem does not respect the aspect ratio of the image and expects a square image.

    Describe the solution you'd like: Would help if we can add support for adjustViewBounds on Icon.

    Describe alternatives you've considered: Right now the only solution is to use CustomPowerMenu.

    opened by ajeet-inspify 0
Releases(2.2.2)
  • 2.2.2(Dec 19, 2022)

    What's Changed

    • Fix focus state by @sebastienrouif in https://github.com/skydoves/PowerMenu/pull/97
    • Update AGP to 7.3.1 and gradle to 7.6 by @skydoves in https://github.com/skydoves/PowerMenu/pull/98
    • Convert PowerMenuItem to kotlin file and add iconContentDescription property by @skydoves in https://github.com/skydoves/PowerMenu/pull/99

    Full Changelog: https://github.com/skydoves/PowerMenu/compare/2.2.1...2.2.2

    Source code(tar.gz)
    Source code(zip)
  • 2.2.1(Oct 16, 2022)

    What's Changed

    • Update dependencies by @skydoves in https://github.com/skydoves/PowerMenu/pull/83
    • Don't cover the Android virtual keyboard by @RobbWatershed in https://github.com/skydoves/PowerMenu/pull/91
    • Update dependencies and Gradle to 7.5.1 by @skydoves in https://github.com/skydoves/PowerMenu/pull/94
    • Implement icon drawable to the PowerMenuItem by @skydoves in https://github.com/skydoves/PowerMenu/pull/95
    • Migrate maven publication scripts by @skydoves in https://github.com/skydoves/PowerMenu/pull/96

    New Contributors

    • @RobbWatershed made their first contribution in https://github.com/skydoves/PowerMenu/pull/91

    Full Changelog: https://github.com/skydoves/PowerMenu/compare/2.2.0...2.2.1

    Source code(tar.gz)
    Source code(zip)
  • 2.2.0(Jul 12, 2021)

    ๐ŸŽ‰ Released a new version 2.2.0! ๐ŸŽ‰

    What's New?

    • Correct item index with header (#73).
    • Added a new lazy powerMenu() View extension for using on custom views. (b8d21b2, aa932cc)
    • Added setLifecycleOwnerFromContext() internally for getting a lifecycleOwner from a context.
    Source code(tar.gz)
    Source code(zip)
  • 2.1.9(Dec 2, 2020)

    ๐ŸŽ‰ Released a new version 2.1.9! ๐ŸŽ‰

    What's New?

    • Added setIsMaterial(Boolean) functionality. The PowerMenu and CustomPowerMenu uses CardView instead of the MaterialCardView. If we set the isMaterial(true) function, they will be inflated with the MaterialCardView.
    • Changed previous layout resources naming conventions. (29b023c)
    • Refactored internal codes.
    Source code(tar.gz)
    Source code(zip)
  • 2.1.8(Nov 20, 2020)

    ๐ŸŽ‰ Released a new version 2.1.8! ๐ŸŽ‰

    What's New?

    • Refactord ActivityPowerMenuLazy and FragmentPowerMenuLazy and add documentations internally.
    • Fixed showPopup() internal conditions for showing popup safely in the Activity.
    • Updated Gradle build tool version to 4.1.1 internally.
    • Removed kotlin-android-extensions plugin.
    Source code(tar.gz)
    Source code(zip)
    powermenu-2.1.8.aar(93.80 KB)
  • 2.1.7(Oct 24, 2020)

  • 2.1.6(Oct 7, 2020)

    ๐ŸŽ‰ Released a new version 2.1.6! ๐ŸŽ‰

    What's New?

    • Allow stroke through MaterialCardView styling (#64).
    • Added setIconSize, setIconPadding, setIconColor functionalities to PowerMenu.Builder.
    • Replace compound drawable icon to imageView for aligning accurately.
    Source code(tar.gz)
    Source code(zip)
    powermenu-2.1.6.aar(113.49 KB)
  • 2.1.5(Sep 26, 2020)

  • 2.1.4(Sep 20, 2020)

    ๐ŸŽ‰ Released a new version 2.1.4! ๐ŸŽ‰

    What's New?

    • Changed String type related functions (setTitle) to CharSequence in PowerMenuItem.
    • Updated kotlin version to 1.4.10 stable internally.
    • FragmentPowerMenuLazy use viewLifecycleOwner instead of fragment's lifecycleOwner.
    • Used JvmSynthetic for hiding kotlin lambda related functions in Java APIs.
    Source code(tar.gz)
    Source code(zip)
    powermenu-2.1.4.aar(93.82 KB)
  • 2.1.3(May 19, 2020)

    ๐ŸŽ‰ Released a new version 2.1.3 ๐ŸŽ‰

    What's new?

    • setBackgroundSystemUiVisibility in builders support (#56)
    • Added setDismissIfShowAgain functionality.
    • Use ViewBinding instead of findViewById for improving performance and null safety.
    • Added lifecycle-common-java8 for processing lifecycle annotations.
    Source code(tar.gz)
    Source code(zip)
    powermenu-2.1.3.aar(92.70 KB)
  • 2.1.2(Aug 28, 2019)

    • Refactor internal codes & modifiers.
    • implemented setTextColorResource, setMenuColorResource, setSelectedTextColorResource, setBackgroundColorResource to the PowerMenu.Builder and CustomPowerMenu.Builder. We can set the color by resource.

    before

    .setTextColor(ContextCompat.getColor(context, R.color.md_grey_800))
    

    after

    .setTextColorResource(R.color.md_grey_800)
    
    Source code(tar.gz)
    Source code(zip)
    powermenu-2.1.2.aar(91.76 KB)
  • 2.1.1(Aug 16, 2019)

    Released version 2.1.1.

    Added the kotlin dependency.

    Implementations

    • PowerMenu extensions.
    • Lazy initialization on Activity and Fragment.
    • Can create an instance of the PowerMenu using kotlin-dsl (createPowerMenu keyword).
    • PowerMenu's Show functions can be executed without any onClickListeners or ViewtreeObservers.
    • Removed rectricTo AbstractPowerMenu.
    Source code(tar.gz)
    Source code(zip)
    powermenu-2.1.1.aar(90.91 KB)
  • v2.1.0(May 2, 2019)

  • v2.0.9(Apr 18, 2019)

Owner
Jaewoong Eum
Android and open source software engineer.โค๏ธ Digital Nomad. Love coffee, music, magic tricks, and writing poems. Coffee Driven Development
Jaewoong Eum
Dynamic Speedometer and Gauge for Android. amazing, powerful, and multi shape :zap:

SpeedView Dynamic Speedometer, Gauge for Android. amazing, powerful, and multi shape โšก , you can change (colors, bar width, shape, text, font ...every

Anas Altair 1.2k Jan 7, 2023
Android Country Picker is a Kotlin-first, flexible and powerful Android library that allows to integrate Country Picker with just a few lines.

1. Add dependency dependencies { implementation 'com.hbb20:android-country-picker:X.Y.Z' } For latest version, 2. Decide your use-case

Harsh B. Bhakta 65 Dec 6, 2022
AndroidPhotoFilters aims to provide fast, powerful and flexible image processing instrument for creating awesome effects on any image media.

PhotoFiltersSDK PhotoFiltersSDK aims to provide fast, powerful and flexible image processing instrument for creating awesome effects on any image medi

Zomato 2.5k Dec 23, 2022
A simple and customizable Android full-screen image viewer with shared image transition support, "pinch to zoom" and "swipe to dismiss" gestures

Stfalcon ImageViewer A simple and customizable full-screen image viewer with shared image transition support, "pinch to zoom" and "swipe to dismiss" g

Stfalcon LLC 1.9k Jan 5, 2023
KdGaugeView is a simple and customizable Gauge / Speedometer control for Android.

KdGaugeView KDGaugeView is a simple and customizable gauge control for Android inspired by LMGaugeView Motivation I need some clean Guage view for my

Saurabh kumar 60 Feb 6, 2022
Customizable bounce animation for any view like in Clash Royale app

Bounceview-Android Customizable bounce animation for any view updation Getting Started In your build.gradle dependencies { implementation 'hari.bo

Hariprasanth S 149 Nov 18, 2022
Sophisticated and cool intro with Material Motion Animation

โ˜ฏ๏ธSophisticated and cool intro with Material Motion Animations(No more viewpager transformer)

Ranbir Singh 34 Sep 8, 2022
โ˜ฏ๏ธSophisticated and cool intro with Material Motion Animations(No more viewpager transformer or Memory leak)

Material Intro Sophisticated and cool intro with Material Motion Animations. Who's using Material Intro? ?? Check out who's using Material Intro Inclu

Ranbir Singh 34 Sep 8, 2022
Implementation of Ripple effect from Material Design for Android API 9+

RippleEffect ExpandableLayout provides an easy way to create a view called header with an expandable view. Both view are external layout to allow a ma

Robin Chutaux 4.9k Dec 30, 2022
Android library for material scrolling techniques.

material-scrolling Android library for material scrolling techniques. Features Easily implement material scrolling techniques with RecyclerView. Custo

Satoru Fujiwara 601 Nov 29, 2022
Material image loading implementation

MaterialImageLoading Material image loading implementation Sample And have a look on a sample Youtube Video : Youtube Link [] (https://www.youtube.com

Florent CHAMPIGNY 392 Nov 17, 2022
Animate a strike over any image to indicate on/off states. As seen in the Material Guidelines.

StrikedImageView Animate a strike over any image to indicate on/off states. As seen in the Material Guidelines. Gradle allprojects { repositories

null 9 Sep 21, 2022
Cute library to implement SearchView in a Material Design Approach

MaterialSearchView Cute library to implement SearchView in a Material Design Approach. Works from Android API 14 (ICS) and above. #Native version Mayb

Miguel Catalan Baรฑuls 3.8k Jan 3, 2023
๐Ÿ’ Metaphor is the library to easily add Material Motion animations

Metaphor Metaphor is the library to easily add Material Motion animations. Who's using Metaphor? ?? Check out who's using Metaphor Include in your pro

Ranbir Singh 132 Dec 25, 2022
Add Animatable Material Components in Android Jetpack Compose. Create jetpack compose animations painless.

AnimatableCompose Add Animatable Material Components in Android Jetpack Compose. Create jetpack compose animation painless. What you can create from M

Emir Demirli 12 Jan 2, 2023
Render After Effects animations natively on Android and iOS, Web, and React Native

Lottie for Android, iOS, React Native, Web, and Windows Lottie is a mobile library for Android and iOS that parses Adobe After Effects animations expo

Airbnb 33.5k Jan 4, 2023
A Simple Todo app design in Flutter to keep track of your task on daily basis. Its build on BLoC Pattern. You can add a project, labels, and due-date to your task also you can sort your task on the basis of project, label, and dates

WhatTodo Life can feel overwhelming. But it doesnโ€™t have to. A Simple To-do app design in flutter to keep track of your task on daily basis. You can a

Burhanuddin Rashid 1k Jan 1, 2023
Chandrasekar Kuppusamy 799 Nov 14, 2022
FilePicker is a small and fast file selector library that is constantly evolving with the goal of rapid integration, high customization, and configurability~

Android File Picker ??๏ธ ไธญๆ–‡็ฎ€ไฝ“ Well, it doesn't have a name like Rocky, Cosmos or Fish. Android File Picker, like its name, is a local file selector fra

null 786 Jan 6, 2023