[embedyt] https://www.youtube.com/watch?v=RFFu3dP5JDk[/embedyt]
Links & Dependenciesactivity_main.xmlnote_item.xmlNote.javanew_note_menu.xml
Firebase console:
FirebaseUI GitHub page with dependencies & instructions:
github.com/firebase/FirebaseUI-Android
Other dependencies:
developer.android.com/topic/libraries/support-library/packages#v7-cardview
developer.android.com/topic/libraries/support-library/packages#design
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <android.support.v7.widget.RecyclerView android:id="@+id/recycler_view" android:layout_width="match_parent" android:layout_height="match_parent" /> <android.support.design.widget.FloatingActionButton android:id="@+id/button_add_note" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="16dp" android:src="@drawable/ic_add" /> </android.support.design.widget.CoordinatorLayout>
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginEnd="8dp" android:layout_marginStart="8dp" android:layout_marginTop="8dp" app:cardBackgroundColor="#FFFFE8"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:padding="8dp"> <TextView android:id="@+id/text_view_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentStart="true" android:layout_toStartOf="@id/text_view_priority" android:ellipsize="end" android:maxLines="1" android:text="Title" android:textAppearance="@style/TextAppearance.AppCompat.Large" /> <TextView android:id="@+id/text_view_priority" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentEnd="true" android:layout_alignParentTop="true" android:text="1" android:textAppearance="@style/TextAppearance.AppCompat.Large" /> <TextView android:id="@+id/text_view_description" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentStart="true" android:layout_below="@id/text_view_title" android:text="Description" /> </RelativeLayout> </android.support.v7.widget.CardView>
package com.codinginflow.firebaseui_firestoreexample; public class Note { private String title; private String description; private int priority; public Note() { //empty constructor needed } public Note(String title, String description, int priority) { this.title = title; this.description = description; this.priority = priority; } public String getTitle() { return title; } public String getDescription() { return description; } public int getPriority() { return priority; } }
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/save_note" android:icon="@drawable/ic_save" android:title="Save" app:showAsAction="ifRoom" /> </menu>