-
Notifications
You must be signed in to change notification settings - Fork 24
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 in capacity for a SortableListPreference #1
base: master
Are you sure you want to change the base?
Conversation
now, the items are displayed correctly, and are sorted, but not saved or loaded correctly.
preference if not checked.
Thanks for this. There is something wrong with the diff, however, possibly due to the edit that you are using doing strange things to whitespace/newlines. See here: http://stackoverflow.com/questions/6134066 Also, there are a few small style fixes I'd like to make. My branch is just one of many unofficially maintained copies of the original project so I understand if you don't have much reason to put a lot of time and effort into this pull request but I'm willing to work through these changes with you if you want. Let me know what suits you. |
Jamie, I'm certainly willing to put the effort into it. I put a fair bit of effort Ben On Mon, Dec 30, 2013 at 12:36 PM, Jamie Hewland [email protected]:
Ben Pearson |
Mine? More active? Cool. OK, so a few style notes on the changes overall:
if (true)
{
do.x();
} Should be: if (true) {
do.x();
} ...also you should avoid if/for statements with no braces as per the Android code style guidelines.
Style tweaks are obviously easier/quicker things for me to spot...actual code fixes take more time...but I will add a few in the diff. Thanks again. |
@@ -640,7 +640,7 @@ public ListAdapter getInputAdapter() { | |||
} | |||
} | |||
|
|||
private class AdapterWrapper implements WrapperListAdapter { | |||
private class AdapterWrapper extends BaseAdapter implements WrapperListAdapter { |
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.
Is there a reason for this change?
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.
This change will prevent a crash in the demo app. Warp just crashes without
it. Looking around, this seemed like the best solution, and it works well,
but if you have another one, I'm opened to it.
Ben.
On Mon, Dec 30, 2013 at 2:35 PM, Jamie Hewland [email protected]:
In library/src/com/mobeta/android/dslv/DragSortListView.java:
@@ -640,7 +640,7 @@ public ListAdapter getInputAdapter() {
}
}
- private class AdapterWrapper implements WrapperListAdapter {
- private class AdapterWrapper extends BaseAdapter implements WrapperListAdapter {
Is there a reason for this change?
—
Reply to this email directly or view it on GitHubhttps://github.com//pull/1/files#r8590130
.
Ben Pearson
http://www.kd7uiy.com
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'm just going to combine the rest of the comments into a single email.
- Yes, that blurb of code is required on KitKit, or else it will crash. If
you've seen a rash of releases recently "To fix a crash on KitKat", I bet
that's what it is. - I'm going to keep the exceptions in place, instead of returning -1. I'd
rather thrown an exception in the case that something isn't right, because
it's easier to debug exceptions. And the exception thrown has actually
saved me a few times when debugging... I did change it to
IllegalStateException, per your suggestion, however. - I'm not entirely sure what you meant about the space/tabs. I've
"corrected indentation" on Eclipse, hopefully that clears it up. - No problem being a stickler. Part of the reason I wanted to do this was
to get someone else to look at a major block of code that combines things
that I've never done before, and it helps to have a second set of eyes.
I've rarely had someone who actually was a stickler about code look at
mine, so... - The main setting blurb, was that about the comments there? Essentially,
they came from Android when you create a new project, but I can get rid of
them, if you want. I'm guessing it was the last line, the inherited
document, so I removed that. - As far as your project being one of the more active, well, I admittedly
looked at recent updates to pick one. Still, I'm planning on sticking with
your code base, should I update the code, so...
In addition to your changes, I made a few other changes as well, and tested
it out. Primarily, I ran Lint and cleaned up a few things, including
outside of the code I touched, so that's why a whole bunch of files were
touched. I also found a bug in another class, which caused a crash in
Background Handle. I'm not 100% confident of the fix, but it should do for
now...
Ben
On Mon, Dec 30, 2013 at 4:55 PM, Ben Pearson [email protected] wrote:
This change will prevent a crash in the demo app. Warp just crashes
without it. Looking around, this seemed like the best solution, and it
works well, but if you have another one, I'm opened to it.Ben.
On Mon, Dec 30, 2013 at 2:35 PM, Jamie Hewland [email protected]:
In library/src/com/mobeta/android/dslv/DragSortListView.java:
@@ -640,7 +640,7 @@ public ListAdapter getInputAdapter() {
}
}
- private class AdapterWrapper implements WrapperListAdapter {
- private class AdapterWrapper extends BaseAdapter implements WrapperListAdapter {
Is there a reason for this change?
—
Reply to this email directly or view it on GitHubhttps://github.com//pull/1/files#r8590130
.Ben Pearson
http://www.kd7uiy.com
Ben Pearson
http://www.kd7uiy.com
Apologies for being kind of a stickler... |
Handle, and probably other classes that extend DSLVFragment.
The change to the core library prevents a crash. As far as other changes:
In addition to your changes, I made a few other changes as well, and tested it out. Primarily, I ran Lint and cleaned up a few things, including outside of the code I touched, so that's why a whole bunch of files were touched. I also found a bug in another class, which caused a crash in Background Handle. I'm not 100% confident of the fix, but it should do for now... |
Cool, thanks this is looking good. I won't have time to look at this properly until probably late in the day tomorrow. |
Just curious if you've gotten to this anytime recently. Hope you had a good New Years! |
@@ -0,0 +1,271 @@ | |||
/* |
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.
Surely this should be in the library and not the demo app?
I can go ahead and make the move, I think you are right that it fits well as a library application. I'll do that shortly when I get a chance, hopefully this week. |
To put this in the main library will require more work that I'm going to be able to do for a while. Specifically, it needs to get references for the list item, and text handles, and while I'm confident I could do it, it'd take a while. Bottom line is, it works now as a reference, and if I find the time sometime soon I'll try and get it ported to the main library. I leave it up to you if you want to include it in your list of demo apps. |
Finished the process to convert DragSortListPreference to a part of the main library. It now doesn't depend on external resources, and can be controlled via styleables.
Had the time to finish it now, I now have DragSortListPreference, and an example of how to use it. The documentation should probably still be updated, but overall, it looks like it'll work. |
Thanks, looking good 👍 I'll review this properly over the weekend. Just two things before that:
|
Fix bug where an empty preference set would lead to an IllegalStateException
- Add check to onScroll in DragSortController in response to instances seen when these events were null.
Update to gradle 1.12 and update build tools [build]
I've added a new demo which I think will be of some interest. I know I'm planning on using it in my current project a couple of times. It's a SortableListPreference, which I've added to the demo activity. I think it will be of use to others, so I'm handing it back to you with the hopes that you can add it to your project, making it available for others to use as well.