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 possibility to use QuantityStrings for the toolbar #39
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.
I have a problem here:
I've copied setTitles()
from the builder and overloaded it with my quantity-string-res. It's working fine but only if the caller (sample-app) defines both setTitles()
-methods.
If not (just using the new quantity-one), the list is empty and the app runs into an Exception when Builder#build()
is reached:
rxjava's SafeSubscriber#onNext()
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.trim()' on a null object reference
Any idea?
@@ -90,7 +90,8 @@ private void setUpAdapter(List<String> strings) { | |||
|
|||
MultiChoiceToolbar multiChoiceToolbar = | |||
new MultiChoiceToolbar.Builder(SampleToolbarActivity.this, toolbar) | |||
.setTitles(toolbarTitle(), "item selected") | |||
.setTitles(toolbarTitle(), "item selected") // TODO crashing when removed !? |
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.
Can't remove this. Otherwise the list is empty?!
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.
Looks like there is an issue with the way i'm populating the data with RXjava check out that piece of code, it's just generating some items.
@@ -31,13 +33,13 @@ | |||
} | |||
} | |||
|
|||
void updateToolbar(int itemNumber) throws IllegalStateException { | |||
if (itemNumber == ZERO) { | |||
void updateToolbar(int selectedItemCount) throws IllegalStateException { |
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 need to change the name.
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.
The variable-name wasn't clear to be so I changed it. I think this is clearer now.
I can revert it, if you like. Should I?
@@ -90,7 +90,8 @@ private void setUpAdapter(List<String> strings) { | |||
|
|||
MultiChoiceToolbar multiChoiceToolbar = | |||
new MultiChoiceToolbar.Builder(SampleToolbarActivity.this, toolbar) | |||
.setTitles(toolbarTitle(), "item selected") | |||
.setTitles(toolbarTitle(), "item selected") // TODO crashing when removed !? |
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.
Just keep the plural, remove the other one.
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.
Yeah - tried that of course but then it isn't working. When only keeping the plural-setTitles() I get an exception and the list is empty (no adapter added). See comment above.
|
Everything seems fine and working now.
@dvdciri What do you mean? Should I increase |
Yes, exactly also, squash everything into a single commit with testing and stuff and i don't know why i can't see the test running on this PR, can you create a branch under my repo in feature/branch_name? Not sure if have the access though Provide enough info on the commit message |
@@ -147,7 +147,7 @@ public void testMultiChoiceToolbar() { | |||
.perform(RecyclerViewActions.actionOnItemAtPosition(0, longClick())); | |||
|
|||
onView(allOf(isAssignableFrom(TextView.class), withParent(isAssignableFrom(Toolbar.class)))) | |||
.check(matches(withText(containsString("1")))); | |||
.check(matches(withText(containsString("One")))); |
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 shouldn't change this test because this was checking that the item number has changed to the correct, create some new test, with the specific plural scenarios about the feature that you added and make sure al the tests instrumental and unit are passing!
@@ -238,7 +238,7 @@ public void testSingleClickModeOptionMenu() { | |||
|
|||
//Check the toolbar as well | |||
onView(allOf(isAssignableFrom(TextView.class), withParent(isAssignableFrom(Toolbar.class)))) | |||
.check(matches(withText(containsString("1")))); | |||
.check(matches(withText(containsString("One")))); |
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.
Same here
Sry, didn't check all tests. Should be fine now. I've add a switch to Something left now? |
You mean to have only one (merge-) commit with all changes in your history once merged? Can't you rebase right here from the PR? If not, what's the best practice to get this work? Merge into my fork and use a cherry-pick on the merge-commit for the PR into your project? Wouldn't this result in a new PR (and close of this one)?
Already wondered. Do you have a check for the branch-name (like "starts with feature/")?
No, it seems like I don't have enough permissions for that |
Nope, no check for branch name, is not running because is not a branch under my repo.. weird.
So everything under the sample package, a part from the instrumental testing should not be touched , try to keep everything as simple as possible |
The changes I made to the sample are only needed to get an activity using the new method. As I did not replaced the original So, what do you want? An additional Activity using the new plural- |
The it's fine. I'll review everything again later on. We need to find a way to run CircleCI on it. |
If I get it right, CircleCI should run checks for PR of a fork automatically. But yes, it's obviously not working. https://circleci.com/docs/fork-pr-builds/ I found this - seems like it's possible that CircleCI doesn't recognize this project as OpenSource !? |
Yeah looks like is not recognising it as OpenSource but we need to run CircleCI on it before i can merge it. |
I'm not familiar with CircleCI and cannot help you with that - maybe create a bug on their tracker? |
I got an answer from @ ecgreb (lostzen/lost#94 (comment)):
@dvdciri can you check that? |
Done, enabled it! Let's see |
Do we need to do an other push to this branch to get it triggered? |
Can you do an interactive git squash into a single commit? so we trigger the build? |
So it looks running now :) But I'm not happy with the way I squashed the commits. I used the workflow from http://stackoverflow.com/a/25357146 which worked fine (other than rebase, which results in one conflict after an other) but I needed to force-push. Is there a non-rebase, non-force-push way to squash a whole branch into one commit to contribute to a foreign project (just like this case here)? I think the squash-merge in this very PR here would do the trick, right? |
That's the only way, you have conflict because is rewriting the history and adding one commit in the other on top of the branch you reabsed. |
Yeah, think so. But just to make sure I get it right: Squash-Merging a PR in github would work too, right? https://help.github.com/articles/configuring-commit-squashing-for-pull-requests/ |
Yes, correct! I would just do one change, don't add the possibility to change the mode via UI through the option menu, just keep the logic for the test but remove the changes done to the menu, option menu clicked and what need to change accordingly. Other that that LGTM! |
That won't work as your unit-tests rely on the toolbar showing "1", remember? So I need to leave |
Right.. then just show a toast in the Case that the use clicks on the option menu explaining what he've just enabled/disabled, cause ATM you're just doing the logic bug at least a feedback for the user is needed |
All done. Ready to merge? PS: Will you create a new release so I can use this new feature right now? ;-) |
Not sure when i'm gonna do a release, but will definitely happen sometimes soon. Thanks |
closes #31 #33