Skip to content

Commit 1f342f4

Browse files
committed
Add toast message in NotesFragment.kt
1 parent 8ad0543 commit 1f342f4

File tree

7 files changed

+13
-21
lines changed

7 files changed

+13
-21
lines changed

app/src/main/java/com/example/mynotes/model/Note.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ import androidx.room.ColumnInfo
55
import androidx.room.Entity
66
import androidx.room.PrimaryKey
77
import kotlinx.android.parcel.Parcelize
8-
import java.time.LocalDate
9-
import java.time.LocalDateTime
10-
import java.time.LocalTime
11-
import java.util.*
128

139
@Parcelize
1410
@Entity(tableName = "note_table")
@@ -23,4 +19,4 @@ class Note(
2319
@ColumnInfo(name = "description")
2420
val description: String,
2521

26-
) : Parcelable
22+
) : Parcelable

app/src/main/java/com/example/mynotes/ui/activities/MainActivity.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package com.example.mynotes.ui.activities
33
import android.os.Bundle
44
import androidx.appcompat.app.AppCompatActivity
55
import androidx.navigation.findNavController
6-
import androidx.navigation.ui.NavigationUI
76
import androidx.navigation.ui.setupActionBarWithNavController
87
import com.example.mynotes.R
98

app/src/main/java/com/example/mynotes/viewmodel/NotesViewModel.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ import android.app.Application
44
import androidx.lifecycle.AndroidViewModel
55
import androidx.lifecycle.LiveData
66
import androidx.lifecycle.viewModelScope
7-
import com.example.mynotes.database.NotesDao
87
import com.example.mynotes.database.NotesDatabase
98
import com.example.mynotes.model.Note
109
import com.example.mynotes.repository.NoteRepository
1110
import kotlinx.coroutines.Dispatchers
12-
import kotlinx.coroutines.Dispatchers.IO
1311
import kotlinx.coroutines.launch
1412

1513
class NotesViewModel(application: Application) : AndroidViewModel(application) {

app/src/main/res/layout/fragment_notes.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
xmlns:tools="http://schemas.android.com/tools">
55

66
<androidx.constraintlayout.widget.ConstraintLayout
7-
android:configChanges="uiMode"
87
android:layout_width="match_parent"
98
android:layout_height="match_parent"
9+
android:configChanges="uiMode"
1010
tools:context=".ui.fragments.notes.NotesFragment">
1111

1212
<androidx.recyclerview.widget.RecyclerView

app/src/main/res/layout/fragment_update.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99

1010
<com.google.android.material.textfield.TextInputEditText
1111
android:id="@+id/update_title_txt"
12-
app:layout_constraintEnd_toEndOf="parent"
13-
app:layout_constraintStart_toStartOf="parent"
14-
app:layout_constraintTop_toTopOf="parent"
1512
android:layout_width="match_parent"
1613
android:layout_height="wrap_content"
1714
android:layout_marginStart="16dp"
@@ -28,13 +25,13 @@
2825
android:padding="12dp"
2926
android:textColorHint="@android:color/darker_gray"
3027
android:textSize="30sp"
28+
app:layout_constraintEnd_toEndOf="parent"
29+
app:layout_constraintStart_toStartOf="parent"
30+
app:layout_constraintTop_toTopOf="parent"
3131
tools:ignore="Autofill" />
3232

3333
<com.google.android.material.textfield.TextInputEditText
3434
android:id="@+id/update_desc_txt"
35-
app:layout_constraintEnd_toEndOf="parent"
36-
app:layout_constraintStart_toStartOf="parent"
37-
app:layout_constraintTop_toBottomOf="@+id/update_title_txt"
3835
android:layout_width="match_parent"
3936
android:layout_height="wrap_content"
4037
android:layout_marginStart="16dp"
@@ -46,11 +43,13 @@
4643
android:lineSpacingExtra="5dp"
4744
android:padding="12dp"
4845
android:paddingBottom="64dp"
49-
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1" />
46+
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
47+
app:layout_constraintEnd_toEndOf="parent"
48+
app:layout_constraintStart_toStartOf="parent"
49+
app:layout_constraintTop_toBottomOf="@+id/update_title_txt" />
5050

5151
<com.google.android.material.button.MaterialButton
5252
android:id="@+id/update_note_btn"
53-
app:layout_constraintBottom_toBottomOf="parent"
5453
android:layout_width="match_parent"
5554
android:layout_height="wrap_content"
5655
android:layout_marginHorizontal="5dp"
@@ -62,6 +61,7 @@
6261
android:textAllCaps="false"
6362
android:textColor="@color/white"
6463
android:theme="@style/Theme.MaterialComponents"
64+
app:layout_constraintBottom_toBottomOf="parent"
6565
tools:ignore="RtlCompat" />
6666

6767
</androidx.constraintlayout.widget.ConstraintLayout>

app/src/main/res/navigation/my_nav.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
android:id="@+id/notesFragment"
1010
android:name="com.example.mynotes.ui.fragments.notes.NotesFragment"
1111
android:label="Notes"
12-
tools:layout="@layout/fragment_notes" >
12+
tools:layout="@layout/fragment_notes">
1313
<action
1414
android:id="@+id/action_notesFragment_to_updateFragment"
1515
app:destination="@id/updateFragment" />
@@ -21,7 +21,7 @@
2121
android:id="@+id/updateFragment"
2222
android:name="com.example.mynotes.ui.fragments.updatenote.UpdateFragment"
2323
android:label="Update note"
24-
tools:layout="@layout/fragment_update" >
24+
tools:layout="@layout/fragment_update">
2525
<action
2626
android:id="@+id/action_updateFragment_to_notesFragment"
2727
app:destination="@id/notesFragment" />
@@ -33,7 +33,7 @@
3333
android:id="@+id/addNoteFragment"
3434
android:name="com.example.mynotes.ui.fragments.addnote.AddNoteFragment"
3535
android:label="Add note"
36-
tools:layout="@layout/fragment_add_note" >
36+
tools:layout="@layout/fragment_add_note">
3737
<action
3838
android:id="@+id/action_addNoteFragment_to_notesFragment"
3939
app:destination="@id/notesFragment" />

app/src/main/res/values/strings.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<resources>
22
<string name="app_name">My Notes</string>
3-
<!-- TODO: Remove or change this placeholder text -->
43
<string name="delete">Delete</string>
54
<string name="mode">Mode</string>
65
<string name="note_deleted">Note deleted</string>

0 commit comments

Comments
 (0)