Skip to content

Instantly share code, notes, and snippets.

View safaorhan's full-sized avatar
👋
Hey.

Safa Orhan safaorhan

👋
Hey.
View GitHub Profile
@safaorhan
safaorhan / build.gradle
Created August 6, 2021 09:08
Retrofit Dependencies
implementation 'com.squareup.retrofit2:retrofit:2.9.0' // 1
implementation 'com.squareup.retrofit2:converter-gson:2.9.0' // 2
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1' // 3
// 1: Core Retrofit library
// 2: Converter to serialize / deserialize json
// 3: An optional interceptor to let you see request and response in your Logcat
// Don't forget to use the latest versions of the libraries above.
@safaorhan
safaorhan / AndroidManifest.xml
Created August 6, 2021 09:12
Adding internet permission
<manifest ...
<uses-permission android:name="android.permission.INTERNET" /> <!-- ADD THIS LINE -->
<application
...
@safaorhan
safaorhan / testf
Created March 2, 2022 09:26
Creates a test function
@Test
fun `$FUNCTION_NAME$`() {
$END$
}
@safaorhan
safaorhan / MainActivity.kt
Created April 21, 2022 19:25
Log the fragment back stack status with each change for debugging purposes.
// Adapted from: https://stackoverflow.com/a/67267584/3539594
private fun listenNavigationChanges() {
val navHost = supportFragmentManager.findFragmentById(R.id.container) as NavHostFragment
val navController = navHost.navController
navController.addOnDestinationChangedListener { _, destination, _ ->
val breadcrumb = navController
.backQueue
.map {
@safaorhan
safaorhan / uninstall-youtube.txt
Created July 6, 2023 06:28
How to uninstall YouTube app via adb
The first command uninstalls updates and clears data.
The second command uninstalls the system app all together.
Run commands in this order to get rid of YouTube forever.
--
adb uninstall com.google.android.youtube
adb shell pm uninstall --user 0 com.google.android.youtube