timroes / EnhancedListView

[DEPRECATED] An Android ListView with enhanced functionality (e.g. Swipe To Dismiss or Undo)
Other
463 stars 147 forks source link

Intuitive SwipeDirection names #37

Closed akohout closed 10 years ago

akohout commented 10 years ago

I just started using your library (great work btw), but I found your SwipeDirection enum constants confusing.

I had a look at your source code, have read the according JavaDoc and now I understand why they are called this way.

But wouldn't it be easier for "users" of your code to name them

SwipeDirection.RightToLeft
SwipeDirection.LeftToRight

This way, no one would be confused where the item will be moved to.

timroes commented 10 years ago

Yeah and it would be wrong names. Because that is exactly what these settings DON'T do, because it would be horrible for i18n. The settings lock the swiping to swiping from the text start to the text end (same as all the other Android settings for start and end values do, like paddingStart, drawableStart). So the above names are true for left-to-right languages, but for right-to-left languages its exactly the opposite (start is on the right side and end on the left). So naming the variables RightToLeft would be very confusing, since you cannot be sure, if I just coded crap and the settings totally ignore i18n and always lock to left-to-right no matter if you are in a LTR or RTL language, or if I just am LTR centric, and switch to start-from-end and just named the variables wrong. With the start and end values, this confusing is solved and naming style is the same as used everywhere else in the Android framework.

akohout commented 10 years ago

Ok, sounds plausible for me :-) Thanks for your detailed answer on this topic.