Skip to content

Instantly share code, notes, and snippets.

View mkrupal09's full-sized avatar
🎯
Focusing

Krupal mkrupal09

🎯
Focusing
View GitHub Profile
Less Code : If you're developing app with traditinal approach you've to write too much code comparing to compose.
in imperative approach we've to create xml for layouts, declaring stying attributes,
extending custom classes - all this stuff eliminated using compose
Reusability : In imperative approach we
Multi screen : Compose works seaamlessly while working with multiple resolution screen as well foldable device using adaptive approach
Multi Platform : You can build multi platform app using compose. Rightnow it has Android, Desktop & Web support, still it's expanding with other platforms

General rules for Development

MVVM

ViewModel

  • Don’t pass context in viewmodel because main purpose of viewmodel is seperating ui releated stuff

  • Clearing the resources like if you’re executing some background task then you’ve responisilibty to clear or dispose them to avoid memory leaks I.e if you’re using rx then clear disposables inside onCleared function if you’re using coroutines then use appropriate scope like viewmodel scope

Unistall software
sudo apt-get remove <application_name>
complete unistall
sudo apt-get purge <package-name>

Rename Branch

git branch -m git branch -m

Delete Branch git branch -D <branch_name>

Remove Cache git rm -r --cached ./

@mkrupal09
mkrupal09 / Android libraries
Last active May 4, 2022 05:28
Android libraries
Audio Player
https://github.com/naman14/TimberX
Chat UI
https://github.com/stfalcon-studio/ChatKit
Inspect and modify what includes networks, databases, UIs, etc
https://github.com/whataa/pandora
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
package com.dc.retroapi.interceptor
import android.text.TextUtils
import android.util.Log
import com.dc.retroapi.annotations.RequestExclusionStrategy
import okhttp3.*
import okhttp3.ResponseBody.Companion.toResponseBody
package com.dc.retroapi.interceptor
import com.dc.retroapi.annotations.DataAsListResponse
import com.dc.retroapi.annotations.DataAsObjectResponse
import okhttp3.Interceptor
import okhttp3.Response
import okhttp3.ResponseBody.Companion.toResponseBody
import org.json.JSONArray
import org.json.JSONException
import org.json.JSONObject
// To combine list with other list
val list= arrayListOf("a1","a2","a3")
val list2= arrayListOf("b1","b2","b3")
list.zip(list2)
@mkrupal09
mkrupal09 / AndroidUtils.md
Last active April 27, 2020 06:05
Android utils

Generate Debug Key Signature

keytool -exportcert -alias androiddebugkey -storepass android -keystore ~/.android/debug.keystore -list -v

Generate Release Key Signature

keytool -list -v -keystore "/home/xyz/abc/keystore.jks" -alias -storepass -keypass

To add github project as dependency

repositories
{ 
package com.dc.app
import android.app.ActivityManager
import android.content.Context
import android.content.Context.ACTIVITY_SERVICE
import android.content.Intent
import android.content.IntentFilter
import android.os.BatteryManager.EXTRA_LEVEL
import android.os.BatteryManager.EXTRA_SCALE
import android.os.Build