-
Notifications
You must be signed in to change notification settings - Fork 145
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
Fixed a little thing in licenses text loading and added some methods for customization #30
Conversation
public void show() { | ||
create().show(); | ||
} | ||
|
||
public void show(int themeResourceId) { | ||
create(themeResourceId); |
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 think you are missing the show() call here
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.
You're right. Fixed.
Could you please also implement this for the Fragment? |
I already thought to this and I'll try to do this; if it works, I'll commit it too. |
OK, it works with dialogfragment; maybe you'd like to check the code... |
}); | ||
final AlertDialog.Builder builder; | ||
if (mThemeResourceId != 0) { | ||
builder = new AlertDialog.Builder(new ContextThemeWrapper |
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 line break
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.
Yes, because you can simply override those inside your resources.
Maybe, but I'm still only using the FragmentActivitys. IMHO to have consistent behavior through all platform versions you should always use the Fragments from the support library. |
Okay, just one little thing left: could you please squash all the commits into one? (see http://rebaseandsqua.sh/ for more info) |
Tried that script bit it says no local chance to save... Could it be an idea to do a new pull request? |
No, try this http://davidwalsh.name/squash-commits-git |
…d license text parsing
I couldn't manage to squash the commits like you suggested, so I rolled back to your last commit and made only one commit; maybe it's not the most straightforward way, but I think it should work. |
Just a few other questions:
|
|
|
Regarding you latest commit: I don't like the massive code duplications. Please improve this by reusing more code (like with show and createAndShow -> should be create().show()). Also please use delegating constructors to remove duplication. |
First, sorry for the late response; second, it was an IllegalStateException( "You can not set Dialog's OnCancelListener or OnDismissListener"); third, I'll try to optimize the code, where possible... |
Optimization done: source code is now 48 lines lighter, if I'm not wrong; I used delegating constructors like you recommended and I also fixed some really ugly bug (my fault, honestly) in show() and createAndShow() methods. Shall I commit? |
Sure, let me see it. |
Pushed commit. |
I have reviewed your changes. I've made some changes to replace the excess of constructors with a builder class. Can you please checkout https://github.com/PSDev/LicensesDialog/tree/pr/30 and report back if your theme handling still works? Also it would be great if you could rebase this pull-request onto this branch and add a sample to the sample module. |
Looks good; just a thing: in the Builder class I think the method should be setDividerColor(final int dividerColor) as well as the local variable should be mDividerColor since the passed argument is assumed to be actually the color value, not its I'd (and I don't see anywhere a line of code which does int dividerColor = getResources.getColor(mDividerColorId);). Hence if a developer passes a color id I think it wouldn't work and it would be really sad. So, I think you should either change those names or retrieve the color somewhere in the code (or even better create an overload to allow both the usages). |
Tried and in fact it doesn't work with a color id. Oh, and in LicensesDialogFragment's onCreateDialog it should be .show(), not .create() (last line); the divider color isn't set otherwise. |
Any news about this pull request? |
Sorry, I have been very busy. I'll try to take a look at it soon. |
OK, if you want I could commit the necessary fixes in the meantime. |
I added custom theme samples and proposed fixes and additions for some things and committed and made a pull request on the pr/30 branch, as you asked. It should be quite good now, I think. |
I merged your PR to my branch - will take a final look at it soon and hopefully do the release this week. |
Manually merged |
Fixed missing space in while construct during licenses text loading (I don't think it's done that way on purpose) and added three methods to customize the dialog theme and title divider with some tricks found on the Web.