Search in sources :

Example 21 with FirebaseFirestore

use of com.google.firebase.firestore.FirebaseFirestore in project House-Organizer by House-Organizer.

the class FirebaseTestsHelper method createTestTaskList.

/**
 * Need to create fake user before
 * @throws ExecutionException
 * @throws InterruptedException
 */
public static void createTestTaskList() throws ExecutionException, InterruptedException {
    // Get DB ref
    FirebaseFirestore db = FirebaseFirestore.getInstance();
    // Create task list instance
    User owner = new DummyUser("Test User", "0");
    com.github.houseorganizer.houseorganizer.Task taskToAdd = new com.github.houseorganizer.houseorganizer.Task(owner, "TestTask", "Testing");
    TaskList taskList = new TaskList(owner, "MyList", new ArrayList<>(Collections.singletonList(taskToAdd)));
    // Store instance on the database using a helper function
    // returns only after storing is done
    FirestoreTask.storeTaskList(taskList, db.collection("task lists"), "85IW3cYzxOo1YTWnNOQl");
}
Also used : Task(com.google.android.gms.tasks.Task) FirebaseFirestore(com.google.firebase.firestore.FirebaseFirestore) FirebaseUser(com.google.firebase.auth.FirebaseUser)

Aggregations

FirebaseFirestore (com.google.firebase.firestore.FirebaseFirestore)21 FirebaseAuth (com.google.firebase.auth.FirebaseAuth)6 HashMap (java.util.HashMap)6 Intent (android.content.Intent)5 Log (android.util.Log)4 FirebaseUser (com.google.firebase.auth.FirebaseUser)4 View (android.view.View)3 NonNull (androidx.annotation.NonNull)3 DocumentReference (com.google.firebase.firestore.DocumentReference)3 DocumentSnapshot (com.google.firebase.firestore.DocumentSnapshot)3 QuerySnapshot (com.google.firebase.firestore.QuerySnapshot)3 Constant (com.group1.swepproject.user.nochange.data.Constant)3 Test (org.junit.Test)3 Application (android.app.Application)2 Bitmap (android.graphics.Bitmap)2 Location (android.location.Location)2 Bundle (android.os.Bundle)2 MediaStore (android.provider.MediaStore)2 EditText (android.widget.EditText)2 TextView (android.widget.TextView)2