MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/shittyprogramming/comments/1d63ms2/private_fun_vibrate/
r/shittyprogramming • u/iLikeVideoGamesAndYT • Jun 02 '24
6 comments sorted by
6
And where's the shitty part? It isn't the prettiest code, but I've seen worse.
1 u/mvonballmo Jun 04 '24 Getting the vibrator before you even need to use it? Two deprecated calls? Build.VERSION_CODES.0 to determine behavior when the comment below explains it better? The odd placement of those comments? The reader's putting in a lot of work here. const isAtLeastApi26 = Build.VERSION.SDK_INT >= Build.VERSION_CODES.0 ...would be clearer and eliminate two comments.
1
Getting the vibrator before you even need to use it? Two deprecated calls? Build.VERSION_CODES.0 to determine behavior when the comment below explains it better? The odd placement of those comments? The reader's putting in a lot of work here.
vibrator
Build.VERSION_CODES.0
const isAtLeastApi26 = Build.VERSION.SDK_INT >= Build.VERSION_CODES.0
...would be clearer and eliminate two comments.
lol VIBRATOR_SERVICE
VIBRATOR_SERVICE
4 u/drawkbox Jun 03 '24 vibrate (long) unit 1 u/Anonymo2786 Jul 13 '24 edited Jul 13 '24 https://android.googlesource.com/platform/frameworks/base/+/8c4a8243c77bcbd434fb30587be2feffd2835728/core/java/android/content/Context.java#2001https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/content/Context.java;l=4770
4
vibrate (long) unit
https://android.googlesource.com/platform/frameworks/base/+/8c4a8243c77bcbd434fb30587be2feffd2835728/core/java/android/content/Context.java#2001
https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/content/Context.java;l=4770
2
Needs a bit of return early and often to remove nesting and code branching.
Why even get the vibrator service if vibrations not allowed...
6
u/space_fly Jun 02 '24
And where's the shitty part? It isn't the prettiest code, but I've seen worse.
6
u/tubbo Jun 02 '24
lol
VIBRATOR_SERVICE2
u/drawkbox Jun 03 '24
Needs a bit of return early and often to remove nesting and code branching.
Why even get the vibrator service if vibrations not allowed...