-
-
Notifications
You must be signed in to change notification settings - Fork 590
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
Support drag and drop moving of favourites #970
Conversation
int currentPos = favAppsList.indexOf(id); | ||
if(currentPos == -1) { | ||
Log.e(TAG, "Couldn't find id in favAppsList"); | ||
// TODO: Perhaps we should throw a better error 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.
Logging should be fine
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.
Removed
public void setFavoritePosition(MainActivity context, String id, int position) { | ||
String favApps = PreferenceManager.getDefaultSharedPreferences(this.context). | ||
getString("favorite-apps-list", ""); | ||
List<String> favAppsList = new ArrayList<>(Arrays.asList(favApps.split(";"))); |
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 it would be safer to use DataHandler.getFavorites(), because some favorites might exist in the list but not have an associated POJO, which would make all your calculations wrong.
Using getFavorites, you should be able to compare with the Pojo id and get an index that is guaranteed correct
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.
Spoke offline, but because im actually getting the favourite by id from the string list in preferences im getting the right position so this isn't a problem.
getString("favorite-apps-list", ""); | ||
List<String> favAppsList = new ArrayList<>(Arrays.asList(favApps.split(";"))); | ||
|
||
return favAppsList.indexOf(id); |
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 comment here as above, you might have some weird use cases when users have an item in their favorits that they uninstalled since then, using getFavorites() should remove this problem
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.
As above
I've tested, and it's really good :) Just one small potential issue, but there is no ripple anymore when you click on a favorite. On a new device this isn't noticeable, but on older devices I think the feedback is important to know that the touch has registered. Do you think it can be added back? |
Additionally cleanup dismiss popup and tone up move sensitivity
@Neamar looked into the ripple effect, im not doing anything to explicitly remove it so im not sure how to keep it or bring it back. |
Does the popup still receive touch events now that you dismiss it on ACTION_DOWN? |
@TBog yeah it does |
Thanks! Works well :) |
Should we reopen #837 ? |
Closes #632, I hope.
Video
https://drive.google.com/open?id=1cq2OStUABtdbWB7LrSA-XTiNPZQv0VPG