-
Notifications
You must be signed in to change notification settings - Fork 11
Implemented rooms db to store person's information and implemented insert function for db #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…sert function for db
|
Hey @omsurase, your code looks clean. Do you use GitHub Copilot? |
|
@noobshubham thanks a lot mate! and I don't use GitHub copilot, I used official rooms documentation for the most part (more like copy pasted from there XD) and the rest of the stuff was pretty much function callings |
ooho, cool! |
| import kotlinx.coroutines.GlobalScope | ||
| import kotlinx.coroutines.launch | ||
|
|
||
| class AddPeopleInfoActivity : AppCompatActivity() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plz implement the view model for insertion into the database and make use of View model coroutine scope instead of global scope. Also include a circular progress bar which will be displayed while the entry is inserted into the database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you elaborate about circular progress bar? i didn't get it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
U display the progress bar before u start the transaction to database and hide it as u complete the transaction
| fun insertPerson(person : Person) | ||
|
|
||
| @Query("SELECT * FROM person") | ||
| fun getPerson() : LiveData<List<Person>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here u can use Flow and get it as Live data in your View model
|
|
||
| } | ||
|
|
||
| private fun addPerson() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put in error messages if any fields are missing.
| app:layout_constraintRight_toRightOf="parent" | ||
| app:layout_constraintTop_toTopOf="parent" /> | ||
|
|
||
| <EditText |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refer to Material 3 implementation of Edit text.
https://m3.material.io/components/text-fields/overview
also put in input type for the type of input ur expecting.
Pull Request Template
Description
Programmed add person floating action button, on clicking add person button new activity is launched on which the user has to upload all the details of the person. A person's info is written in the database only when all the fields are filled. only function for inserting a person's information into the database is implemented.
I tried to record the screen of the app working on my phone but then there was no option to see the database on the phone.
and recording of my windows screen resulted in a suttery and large file that couldn't be uploaded.
Fixes #7
Type of change
Please delete options that are not relevant.
Checklist: