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
| https://developer.android.com/training/data-storage/room/index.html#java | |
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
| import android.content.Intent | |
| import android.os.Bundle | |
| import android.os.Handler | |
| import android.os.Looper | |
| import androidx.appcompat.app.AppCompatActivity | |
| class SplashActivity : AppCompatActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) |
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
| package com.example.composetutorial | |
| import SampleData | |
| import android.content.res.Configuration | |
| import android.os.Bundle | |
| import android.widget.Space | |
| import androidx.activity.ComponentActivity | |
| import androidx.activity.compose.setContent | |
| import androidx.compose.foundation.Image | |
| import androidx.compose.foundation.border |
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
| /** | |
| * Returns a list containing the results of applying the given [transform] function | |
| * to each element in the original collection. | |
| * | |
| * @sample samples.collections.Collections.Transformations.map | |
| */ | |
| public inline fun <T, R> Iterable<T>.map(transform: (T) -> R): List<R> { | |
| return mapTo(ArrayList<R>(collectionSizeOrDefault(10)), transform) | |
| } |
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
| package collections | |
| data class Person( | |
| val name: String, | |
| val age: Int, | |
| val driversLicence: Boolean = false | |
| ) | |
| fun main() { | |
| conditionFunctions() | |
| emptyConditionFunctions() |
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
| /* | |
| there are five types of scope functions: makes your code clear, concise and more readable | |
| with | |
| let | |
| run | |
| apply | |
| also | |
| two main difference between them | |
| 1. the way to refer the context object -> either this or it |
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
| package basics | |
| /* | |
| 1. structure equality -> == or equals -> both are same here -> value comp -> equality of 2 object in terms of value | |
| 2. reference equality -> === -> memory location comparison -> two reference variable points to same object | |
| negative of == -> != | |
| negative of === -> !== |
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 MainActivity : AppCompatActivity() { | |
| private lateinit var navHostFragment: NavHostFragment | |
| private lateinit var appBarConfiguration: AppBarConfiguration | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| val binding = ActivityMainBinding.inflate(layoutInflater) | |
| setContentView(binding.root) |
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
| //fragment | |
| private lateinit var binding: DashboardBinding | |
| override fun onCreateView( | |
| inflater: LayoutInflater, | |
| container: ViewGroup?, | |
| savedInstanceState: Bundle? | |
| ): View? { |
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
| package com.example.coroutinelearning.database | |
| import android.content.Context | |
| import androidx.room.Database | |
| import androidx.room.Room | |
| import androidx.room.RoomDatabase | |
| import com.example.coroutinelearning.entity.User | |
| @Database(entities = [User::class], version = 1, exportSchema = false) | |
| abstract class AppDatabase: RoomDatabase() { |