-
Notifications
You must be signed in to change notification settings - Fork 59
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
Add a way to customize popup padding #44
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the lines mentioned in the comment and this should be ready to merge :)
@@ -7,6 +7,10 @@ | |||
<item name="mpm_secondaryTextColor">@color/mpm_black_54_opacity</item> | |||
<item name="mpm_activeIconColor">@color/mpm_black_54_opacity</item> | |||
<item name="mpm_separatorColor">@color/mpm_black_12_opacity</item> | |||
<item name="mpm_paddingBottom">@dimen/mpm_popup_menu_vertical_padding</item> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is the default and padding is now set programmatically in MaterialRecyclerViewPopupWindow
then the following lines can be removed from mpm_popup_menu.xml
:
android:paddingTop="@dimen/mpm_popup_menu_vertical_padding"
android:paddingBottom="@dimen/mpm_popup_menu_vertical_padding"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -316,6 +316,23 @@ class DarkActivity : AppCompatActivity() { | |||
popupMenu.show(this@DarkActivity, view) | |||
} | |||
|
|||
@OnClick(R.id.customPaddingTextView) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding a sample as well!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem, although I would suggest you to try and combine Dark/Light activities and their layouts. Right now adding new items to sample is kind of annoying since you have to add everything 2 times. Base abstract class with methods that ask for correct style where necessary could be enough.
But that's just a small suggestion :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you. I mean, that's what I would normally do in a normal project.
However, I've noticed that the more complicated the sample app is the higher the likelihood that people won't follow what's going on (had some weird questions on some other projects on GitHub...). That's why I went for this awful duplication in the first place :/
It is easier, for complete beginners especially, to just look at the sample code and e.g. copy it to your project.
Fixed all issues |
Added few attributes that allow users to customize the popup padding via style:
mpm_paddingBottom
mpm_paddingLeft
mpm_paddingRight
mpm_paddingTop
Example