Тёмный
No video :(

How to Make a Draggable Music Knob in Jetpack Compose - Android Studio Tutorial 

Philipp Lackner
Подписаться 180 тыс.
Просмотров 26 тыс.
50% 1

In this video you will learn how you can create a music knob composable that you can rotate using drag gestures.
⭐ Get certificates for your future job
⭐ Save countless hours of time
⭐ 100% money back guarantee for 30 days
⭐ Become a professional Android developer now:
pl-coding.com/...
💻 Let me personally review your code and provide individual feedback, so it won't backfire and cost you a fortune in future:
elopage.com/s/...
Get the source code for this video here:
github.com/phi...
Regular programming advice on my Instagram page: / _philipplackner_
Checkout my GitHub: github.com/phi...
You like my free content? Here you can buy me a coffee:
www.buymeacoff...

Опубликовано:

 

6 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 53   
@codinginflow
@codinginflow 3 года назад
nice knob bro
@PhilippLackner
@PhilippLackner 3 года назад
Thanks bro
@ChrisAthanas
@ChrisAthanas 3 года назад
Florian in da house!
@Ayor88
@Ayor88 6 месяцев назад
your videos are gold for self learner !
@mehulbisht9708
@mehulbisht9708 3 года назад
When you posted that video that declared the end of the ongoing Web dev series on your channel, I really felt confused with your decision after that video, but the very next video you uploaded after that, I still remember the smile that you had when you started the series on Jetpack Compose. Compose is like irresistible for Philipp! Cheers! keep composing happily :)
@johanneshuotari
@johanneshuotari 3 года назад
The angle calculation solved my games ridiculous bug! Random dynamite got me this time, thanks.
@harshrastogi1996
@harshrastogi1996 7 месяцев назад
your videos helps me a lot whenever people ask me the resources to learn Android advice them to learn from the GOAT . U explain things very nicely sir ,really admire you a lot .This video was really amazing learned a lot from your videos LOVE FROM INDIA
@Javier_Chang
@Javier_Chang 3 года назад
I had checked your code, and thank you for your kindness to add knob photo on the source code, it allows me to create it easily.
@prateekkumar151
@prateekkumar151 2 года назад
Why he had to multiply by -1 to get the correct result? The correct explanation (might be wrong):- In normal trigonometry, we calculate the angle from the horizontal axis, but in android, the angle is calculated from the vertical axis. tan(@) = Base/Height What he assumed to be base was actually height in android. Also, in the android coordinate system, the top left corner is (0,0) So the correct way to calculate tan will be(assuming we are starting our calculation from 1st quadrant):- val height =touchX - centerX val base = centerY - touchY val radianAngle = atan2(height,base) val degreeAngle = radianAngle * (180f / PI).toFloat()
@SahilGargjava
@SahilGargjava 3 года назад
Just a suggestion, if you could try creating the custom composable element first then show all the custom parameters that can be passed into it. By this way I think we can understand better like okay this is why we are adding this parameter. Now what happens is I wouldn't be able to relate to the parameter usage in the beginning itself. Anyhow, great tutorials ❤️
@ShubhamSinghMusic
@ShubhamSinghMusic 2 года назад
+1
@valtteri_its_james
@valtteri_its_james Год назад
Mate, you are LEGEND!!!
@halvtysk
@halvtysk 2 года назад
Great example that covers a practical use of compose. However, my OCD doesn't like that when you turn the knob all the way to the bottom, there is still one bar that is green... :P
@rollebonmarquis7574
@rollebonmarquis7574 Год назад
I suppose, one more problem for your OCD: similar thing happens when you turn the knob to the half. there would be 11 active bars instead of 10, etc. The solution imho is simple though: color = if (index < numberActiveBars) barColor else Color.DarkGray. "< than" instead of in range.
@titkot96
@titkot96 2 года назад
You are making the best modern Android among YT, thank you so much!
@tonnie7079
@tonnie7079 2 года назад
Thanks for reminding me about the dreaded Trig fxns, they are not dreaded after all when you use them practically like in this knob.
@abdullahalqahtani3841
@abdullahalqahtani3841 3 года назад
Good work 👏. Can we have a tut on how to use google maps with jetpack compose?
@mohamedzahar7877
@mohamedzahar7877 6 дней назад
That was impressive 👏👏👏
@safsfsfdfgdg
@safsfsfdfgdg Год назад
The atan2 function takes Y coord first and in the code we took X coord first. I suspect that is the reason you had to negate the value. Also, I am curious why we did not add left coordinate to width/2 to compute centerX and likewise top coordinate to height / 2 to compute centerY?
@rollebonmarquis7574
@rollebonmarquis7574 Год назад
In regards to the second part, I think he doesn't add the left and the top coordinate to compute the center because the touch coordinate that we get from the "modifier.pointerInteropFilter {...}" seems to be in respect to the view itself as opposed to anything else (window/parent/etc.). At least that's the impression that I got, and, if that's the case, then size/2 is all that we need for the center (no need for offseting it).
@sokrates297
@sokrates297 3 года назад
Been waiting to make one of these for a long time!
@Blackops1990
@Blackops1990 Год назад
ThxWorks 100% just small changes starting @9:26 you'll get some red for Int convert and some Doubles + Float Converts. other then at all good
@leendeiri540
@leendeiri540 2 года назад
Great video thank you very much! The knob keeps rotating after it reaches the end and repeating the process from the beginning, is this the normal behavior or am I missing something? :D
@Kunal-jp8tn
@Kunal-jp8tn 2 года назад
Thank you so much for this video. Would really appreciate if you make another tutorials for the 'Side Effects & Effect Handlers'. It would be really helpful.
@Chintanparmar
@Chintanparmar 3 года назад
Commenting for better reach!
@rollebonmarquis7574
@rollebonmarquis7574 Год назад
If you don't want to use the minus sign in front of the angle, I think this should be working too: touchX = event.x touchY = event.y val angle = atan2(-(centerX - touchX), centerY - touchY) * (180f / PI).toFloat() That's also my answer as to why we need the minus. I don't think it has to do anything with the fact that the first param in kotlin function is y instead of x... Inho it has to do more with how we calculate dy in this case for example (the param that we pass to atan2). Here's one more calculation that seems to be working for me: val opposite: Float = touchX - centerX val adjacent: Float = (touchY - centerY) val angleRadians: Float = atan2(y = opposite, x = -adjacent) val angleDegrees: Float = (angleRadians * 180 / Math.PI).toFloat()
@harishgaming2274
@harishgaming2274 8 месяцев назад
Could you xplain y there is a - here?
@rollebonmarquis7574
@rollebonmarquis7574 8 месяцев назад
​@@harishgaming2274 probably, both the minus here and the minus in the video stem from the fact that the y axis in android coordinate system is flipped as opposed to a normal one.
@either-king
@either-king 4 месяца назад
@@rollebonmarquis7574 may be this angle representing tan inverse function to get angle ?
@tanjimahmed213
@tanjimahmed213 3 года назад
Thanks for your amazeing video
@vikrantghadge9356
@vikrantghadge9356 2 года назад
Just curious.. Can we not just add colored surfaces instead of manually drawing rectangle, calculating offsets by hand?
@hellosagar
@hellosagar 3 года назад
Great explanation
@PhilippLackner
@PhilippLackner 3 года назад
Glad you liked it
@harisai3580
@harisai3580 2 года назад
You are too great !
@junaidahsan66ify
@junaidahsan66ify 2 года назад
You are awesome bro
@toBeABetterTranslator
@toBeABetterTranslator 3 года назад
very intuitive!
@abhisekpattnaik2282
@abhisekpattnaik2282 2 месяца назад
I am learning Android developer and currently transition xml to compose but when creating modern ui and custom ui and animation then I am not able do that because my math is very so weak how to improve math skill also
@mustafaammar551
@mustafaammar551 3 года назад
WOW Very cool
@surajmaity6194
@surajmaity6194 Год назад
Amazing
@tamilcartoontv720
@tamilcartoontv720 3 года назад
Please Make video on following bro, 1.Jetpack Compose with Room Database 2.Jetpack Compose with Navigation Compose Crash Course 3.Jetpack Compose with most used UI (like Textfield, buttons, Dialog box, fab etc.. )Crash Course 4.Jetpack Compose Notification and Backround Services Crash Course 5.Jetpack Compose with Google Maps 6.Jetpack Compose with Exoplayer 7.Jetpack Compose with Firebase Authentication 8.Jetpack Compose with firestore etc.. Above all courses will help us a lot to learn Jetpack Compose bro.. So pls make it happen 🤗🤗
@mrjackson9137
@mrjackson9137 Год назад
just tested this out, maybe I did smth wrong but the knob is overscrolling when reaching 100% and then getting back to 0. Is that intentional behaviour?
@mdjahidulislam9205
@mdjahidulislam9205 3 года назад
Thanks a lot
@bhanuprakashtr2542
@bhanuprakashtr2542 3 года назад
Hi Philipp, I am working on android tv. Does jetpack compose support dpad events for android tv. if yes, Could you please make some vertical and grid layout videos for android tv. I have searched the internet no one has published jetpack compose related to android tv articles. if you're able to do it it is really appreciatable
@doniyorartikov5879
@doniyorartikov5879 3 года назад
Hello How saving to listview in sharedpreference with Kotlin ? I couldn't do it ,Can you help me ?
@mohitmotwani9256
@mohitmotwani9256 2 года назад
Thankssss
@crazythunder6196
@crazythunder6196 3 года назад
Make video about TrafficStats
@hinrichwrage3004
@hinrichwrage3004 2 года назад
Das ist verdammt viel Grün, aber eindeutig nicht hinter Deinen Ohren! :D
@topgearIQ
@topgearIQ 2 года назад
Sin cos tan 😁 Or knob rotary
@username-dh4tq
@username-dh4tq 2 года назад
#trimuda :
@amitmusic2m929
@amitmusic2m929 3 года назад
Amit music 🎶
@chad_the_stud
@chad_the_stud 2 года назад
this language is so overwhelming. It's just a volume knob and look at the amount of math and the code to make it
@PhilippLackner
@PhilippLackner 2 года назад
What has that to do with the language? 😂 You'll need this math in all languages
Далее
ПРОСТИ МЕНЯ, АСХАБ ТАМАЕВ
32:44
Просмотров 1,9 млн
Starman🫡
00:18
Просмотров 2,1 млн
Full Guide to Jetpack Compose Effect Handlers
24:56
Просмотров 92 тыс.
MAGNUS CARLSEN DEFEATS HANS NIEMANN!!!!!!
31:51
Просмотров 105 тыс.
Gestures in Jetpack Compose
31:33
Просмотров 23 тыс.
I've been using Redis wrong this whole time...
20:53
Просмотров 356 тыс.
When RESTful architecture isn't enough...
21:02
Просмотров 275 тыс.
ПРОСТИ МЕНЯ, АСХАБ ТАМАЕВ
32:44
Просмотров 1,9 млн