This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| fun Categories(){ | |
| Column( | |
| modifier = Modifier.fillMaxSize() | |
| .wrapContentSize(Alignment.Center) | |
| ) { | |
| Text(text = "Categories", | |
| fontSize = 18.sp, | |
| color = androidx.compose.ui.graphics.Color.Gray, | |
| fontWeight = androidx.compose.ui.text.font.FontWeight.Bold, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| fun Home(){ | |
| Column( | |
| modifier = Modifier.fillMaxSize() | |
| .wrapContentSize(Alignment.Center) | |
| ) { | |
| Text(text = "Home", | |
| fontSize = 18.sp, | |
| color = Color.Gray, | |
| fontWeight = androidx.compose.ui.text.font.FontWeight.Bold, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [libraries] | |
| androidx-material3 = { group = "androidx.compose.material3", name = "material3" } | |
| androidx-navigation= { group = "androidx.navigation",name = "navigation-compose" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ImageLoader.init(applicationContext) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CommonAnalytics.init(this) // ❌ from Activity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CommonAnalytics.init(applicationContext) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val dialog = AlertDialog.Builder(this).create() | |
| dialog.show() | |
| //if the Activity finishes, dialog still shown : (leaks) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| myLiveData.observe(this){ data -> | |
| // this refers to Activity | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyCustomView(context: Context):View(context){ | |
| init { | |
| Toast.makeText(context,"Hello Custom View",Toast.LENGTH_SHORT).show() | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MySafeHandler(activity: MyActivity) : Handler(Looper.getMainLooper()){ | |
| private val activityRef = WeakReference(activity) | |
| override fun handleMessage(msg: Message){ | |
| activityRef.get()?.let { activityRef -> | |
| // Safe to use | |
| } | |
| } | |
| } |