Skip to content

Commit

Permalink
Add toast message in NotesFragment.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
Omware committed Feb 22, 2021
1 parent 8ad0543 commit 1f342f4
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 21 deletions.
6 changes: 1 addition & 5 deletions app/src/main/java/com/example/mynotes/model/Note.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import kotlinx.android.parcel.Parcelize
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import java.util.*

@Parcelize
@Entity(tableName = "note_table")
Expand All @@ -23,4 +19,4 @@ class Note(
@ColumnInfo(name = "description")
val description: String,

) : Parcelable
) : Parcelable
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.example.mynotes.ui.activities
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.findNavController
import androidx.navigation.ui.NavigationUI
import androidx.navigation.ui.setupActionBarWithNavController
import com.example.mynotes.R

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ import android.app.Application
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LiveData
import androidx.lifecycle.viewModelScope
import com.example.mynotes.database.NotesDao
import com.example.mynotes.database.NotesDatabase
import com.example.mynotes.model.Note
import com.example.mynotes.repository.NoteRepository
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.launch

class NotesViewModel(application: Application) : AndroidViewModel(application) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_notes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
xmlns:tools="http://schemas.android.com/tools">

<androidx.constraintlayout.widget.ConstraintLayout
android:configChanges="uiMode"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:configChanges="uiMode"
tools:context=".ui.fragments.notes.NotesFragment">

<androidx.recyclerview.widget.RecyclerView
Expand Down
16 changes: 8 additions & 8 deletions app/src/main/res/layout/fragment_update.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/update_title_txt"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
Expand All @@ -28,13 +25,13 @@
android:padding="12dp"
android:textColorHint="@android:color/darker_gray"
android:textSize="30sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="Autofill" />

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/update_desc_txt"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/update_title_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
Expand All @@ -46,11 +43,13 @@
android:lineSpacingExtra="5dp"
android:padding="12dp"
android:paddingBottom="64dp"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1" />
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/update_title_txt" />

<com.google.android.material.button.MaterialButton
android:id="@+id/update_note_btn"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="5dp"
Expand All @@ -62,6 +61,7 @@
android:textAllCaps="false"
android:textColor="@color/white"
android:theme="@style/Theme.MaterialComponents"
app:layout_constraintBottom_toBottomOf="parent"
tools:ignore="RtlCompat" />

</androidx.constraintlayout.widget.ConstraintLayout>
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/navigation/my_nav.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:id="@+id/notesFragment"
android:name="com.example.mynotes.ui.fragments.notes.NotesFragment"
android:label="Notes"
tools:layout="@layout/fragment_notes" >
tools:layout="@layout/fragment_notes">
<action
android:id="@+id/action_notesFragment_to_updateFragment"
app:destination="@id/updateFragment" />
Expand All @@ -21,7 +21,7 @@
android:id="@+id/updateFragment"
android:name="com.example.mynotes.ui.fragments.updatenote.UpdateFragment"
android:label="Update note"
tools:layout="@layout/fragment_update" >
tools:layout="@layout/fragment_update">
<action
android:id="@+id/action_updateFragment_to_notesFragment"
app:destination="@id/notesFragment" />
Expand All @@ -33,7 +33,7 @@
android:id="@+id/addNoteFragment"
android:name="com.example.mynotes.ui.fragments.addnote.AddNoteFragment"
android:label="Add note"
tools:layout="@layout/fragment_add_note" >
tools:layout="@layout/fragment_add_note">
<action
android:id="@+id/action_addNoteFragment_to_notesFragment"
app:destination="@id/notesFragment" />
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<resources>
<string name="app_name">My Notes</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="delete">Delete</string>
<string name="mode">Mode</string>
<string name="note_deleted">Note deleted</string>
Expand Down

0 comments on commit 1f342f4

Please sign in to comment.