Search in sources :

Example 1 with A

use of org.checkerframework.checker.units.qual.A in project EZMeal by Jake-Sokol2.

the class CategoryFragmentRepository method readRecipes.

public void readRecipes(RecipeCallback callback, String category, RetrievedRecipeLists recipeLists) {
    int numRecipesToQuery;
    int recipeSearchStartId;
    // the rest will be queried later
    if (recipeLists.getNumVerticalToQuery() == recipeLists.getNumRemainingVerticalRecipes()) {
        numRecipesToQuery = recipeLists.getNumVerticalToQuery() / 2;
        recipeSearchStartId = recipeLists.getRandomQueryId();
    } else // if this isn't the first time through, just query the rest of the remaining recipes starting where the first query ended
    // doing this guarantees that we will find all of the recipes we need
    {
        numRecipesToQuery = recipeLists.getNumRemainingVerticalRecipes();
        recipeSearchStartId = recipeLists.getVerticalEndId();
    }
    dbRecipes.whereArrayContains("categories", category).whereGreaterThanOrEqualTo("recipeId", recipeSearchStartId).orderBy("recipeId").limit(numRecipesToQuery).get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {

        @Override
        public void onComplete(@NonNull Task<QuerySnapshot> task) {
            List<VerticalRecipe> verticalList = new ArrayList<>();
            List<HorizontalRecipe> horizontalList = new ArrayList<>();
            List<RecyclerRecipe2> recyclerRecipe2List = new ArrayList<>();
            List<RecyclerRecipe2> horizontalRecyclerRecipe2List = new ArrayList<>();
            int startId = 0;
            int endId = 0;
            int i = 0;
            // todo: change for loop format, enhanced for isn't right for this
            for (QueryDocumentSnapshot document : task.getResult()) {
                double recipeIdDouble = document.getDouble("recipeId");
                int recipeIdInt = (int) recipeIdDouble;
                if (i == 0) {
                    // keep track of first recipeId for later queries
                    startId = recipeIdInt;
                } else {
                    // keep track of last recipeId for later queries
                    endId = recipeIdInt;
                }
                String imageUrl = document.getString("imageUrl");
                String title = document.getString("title");
                String recipeIdString = document.getId();
                boolean highlyRated = document.getBoolean("highlyRated");
                Double countRating = document.getDouble("countRating");
                Double avgRating;
                if (countRating != null) {
                    avgRating = document.getDouble("rating") / countRating;
                } else {
                    countRating = 0.0;
                    avgRating = 0.0;
                }
                if (Double.isNaN(avgRating)) {
                    avgRating = 0.0;
                }
                Integer totalRating = countRating.intValue();
                int sizeOfSet = recipeLists.getSetOfUniqueVerticalRecipes().size();
                recipeLists.addToSetOfUniqueVerticalRecipes(recipeIdInt);
                // duplicates cannot be added to Sets - only go ahead if we haven't found a duplicate recipe
                if (recipeLists.getSetOfUniqueVerticalRecipes().size() != sizeOfSet) {
                    if (// (viewModel.getNumOfRetrievedHighRatedRecipes() >= (halfMaxNumberOfHighRatedRecipes * 2)))
                    (!highlyRated) || ((recipeLists.getHorizontalList().size()) >= recipeLists.getNumHorizontalToQuery())) {
                        recipeLists.setNumRemainingVerticalRecipes(recipeLists.getNumRemainingVerticalRecipes() - 1);
                        RecyclerRecipe2 recyclerRecipe2 = new RecyclerRecipe2(category, recipeIdString, title, imageUrl, avgRating, "vertical", false, totalRating);
                        recyclerRecipe2List.add(recyclerRecipe2);
                        VerticalRecipe newRecipe = new VerticalRecipe(title, imageUrl, recipeIdString, avgRating, totalRating);
                        verticalList.add(newRecipe);
                    // /verticalRecipeIdList.add(recipeIdString);
                    // todo: may need to uncomment and convert this for onClick
                    // recipeId.add(recipeIdString);
                    } else // add to horizontal highly rated list instead of vertical recyclerview
                    {
                        // Set<Integer> setOfUniqueHighRatedRecipes = viewModel.getSetOfUniqueHighRatedRecipes();
                        int sizeOfHighRatedSetBefore = recipeLists.getSetOfUniqueHorizontalRecipes().size();
                        recipeLists.addToSetOfUniqueHorizontalRecipes(recipeIdInt);
                        // duplicates cannot be added to Sets - only go ahead if we haven't found a duplicate recipe
                        if (sizeOfHighRatedSetBefore != recipeLists.getSetOfUniqueHorizontalRecipes().size()) {
                            // viewModel.incrementNumOfRetrievedHighRatedRecipes(1);
                            // todo: may need to uncomment and convert, adding new private member to the class
                            // numOfRetrievedHighRatedRecipes++;
                            // highRatedTitles.add(title);
                            // highRatedImages.add(imageUrl);
                            // highRatedRecipeIdList.add(recipeIdString);
                            // highRatedRatings.add(avgRating);
                            HorizontalRecipe newRecipe = new HorizontalRecipe(title, imageUrl, recipeIdString, avgRating);
                            horizontalList.add(newRecipe);
                            // horizontalLists.get(horizontalLists.size() - 1).add(newRecipe);
                            // /horizontalRecipeIdList.add(recipeIdString);
                            RecyclerRecipe2 horizontalRecyclerRecipe2 = new RecyclerRecipe2(category, recipeIdString, title, imageUrl, avgRating, "Popular Recipe", true, totalRating);
                            horizontalRecyclerRecipe2List.add(horizontalRecyclerRecipe2);
                        // sqlDb.testDao().insertRecyclerRecipe2(recyclerRecipePopular2);
                        }
                    }
                }
                i++;
            }
            // recipeLists.appendVerticalList(verticalList);
            // recipeLists.appendHorizontalList(horizontalList);
            // recipeLists.setVerticalStartId(startId);
            // recipeLists.setVerticalEndId(endId);
            // todo: uncomment
            // callback.onCallback(verticalList, horizontalList, startId, endId);
            recipeLists.setVerticalStartId(startId);
            recipeLists.setVerticalEndId(endId);
            recipeLists.appendVerticalList(verticalList);
            recipeLists.appendHorizontalList(horizontalList);
            // recipeLists.setNumRemainingVerticalRecipes(verticalList.size() - recipeLists.getNumRemainingVerticalRecipes());
            // try to query all remaining vertical recipes in the opposite direction.  This could still fail to return all vertical recipes
            dbRecipes.whereArrayContains("categories", category).whereLessThan("recipeId", recipeLists.getRandomQueryId()).orderBy("recipeId").limit(recipeLists.getNumRemainingVerticalRecipes()).get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {

                @Override
                public void onComplete(@NonNull Task<QuerySnapshot> task) {
                    // int numRetrievedRecipes = numOfRetrievedRecipes; //viewModel.getNumOfRetrievedRecipes();
                    List<VerticalRecipe> verticalList = new ArrayList<>();
                    List<HorizontalRecipe> horizontalList = new ArrayList<>();
                    int startId = 0;
                    // todo: change for loop format, enhanced for isn't right for this
                    for (QueryDocumentSnapshot document : task.getResult()) {
                        double recipeIdDouble = document.getDouble("recipeId");
                        int recipeIdInt = (int) recipeIdDouble;
                        // here, startId refers to the entire query's start.  It is the left bound of all searched recipeId's
                        startId = recipeIdInt;
                        String imageUrl = document.getString("imageUrl");
                        String title = document.getString("title");
                        String recipeIdString = document.getId();
                        boolean highlyRated = document.getBoolean("highlyRated");
                        Double countRating = document.getDouble("countRating");
                        Double avgRating;
                        if (countRating != null) {
                            avgRating = document.getDouble("rating") / countRating;
                        } else {
                            countRating = 0.0;
                            avgRating = 0.0;
                        }
                        if (Double.isNaN(avgRating)) {
                            avgRating = 0.0;
                        }
                        Integer totalRating = countRating.intValue();
                        // Set<Integer> setOfUniqueRecipes = viewModel.getSetOfUniqueRecipes();
                        int sizeOfSet = recipeLists.getSetOfUniqueVerticalRecipes().size();
                        recipeLists.addToSetOfUniqueVerticalRecipes(recipeIdInt);
                        // duplicates cannot be added to Sets - only go ahead if we haven't found a duplicate recipe
                        if (recipeLists.getSetOfUniqueVerticalRecipes().size() != sizeOfSet) {
                            // only add recipe to the vertical recycler if its not highly rated or we've already filled the horizontal with the max number of recipes
                            if (// (viewModel.getNumOfRetrievedHighRatedRecipes() >= (halfMaxNumberOfHighRatedRecipes * 2)))
                            (!highlyRated) || ((recipeLists.getHorizontalList().size()) >= recipeLists.getNumHorizontalToQuery())) {
                                // viewModel.incrementNumOfRetrievedRecipesBy(1);
                                recipeLists.setNumRemainingVerticalRecipes(recipeLists.getNumRemainingVerticalRecipes() - 1);
                                // ratings.add(avgRating);
                                // totalRatingsCountList.add(totalRating);
                                RecyclerRecipe2 recyclerRecipe2 = new RecyclerRecipe2(category, recipeIdString, title, imageUrl, avgRating, "vertical", false, totalRating);
                                // recyclerRecipeList2.add(recyclerRecipe2);
                                recyclerRecipe2List.add(recyclerRecipe2);
                                // categoryFragmentModel.addItem(title, imageUrl, avgRating, totalRating);
                                VerticalRecipe newRecipe = new VerticalRecipe(title, imageUrl, recipeIdString, avgRating, totalRating);
                                verticalList.add(newRecipe);
                            // /verticalRecipeIdList.add(recipeIdString);
                            // verticalRecipes.add(newRecipe);
                            // todo: may need to uncomment and convert this for onClick
                            // recipeId.add(recipeIdString);
                            } else // add to horizontal highly rated list instead of vertical recyclerview
                            {
                                // Set<Integer> setOfUniqueHighRatedRecipes = viewModel.getSetOfUniqueHighRatedRecipes();
                                int sizeOfHighRatedSetBefore = recipeLists.getSetOfUniqueHorizontalRecipes().size();
                                recipeLists.addToSetOfUniqueHorizontalRecipes(recipeIdInt);
                                // duplicates cannot be added to Sets - only go ahead if we haven't found a duplicate recipe
                                if (sizeOfHighRatedSetBefore != recipeLists.getSetOfUniqueHorizontalRecipes().size()) {
                                    // viewModel.incrementNumOfRetrievedHighRatedRecipes(1);
                                    // todo: may need to uncomment and convert, adding new private member to the class
                                    // numOfRetrievedHighRatedRecipes++;
                                    // highRatedTitles.add(title);
                                    // highRatedImages.add(imageUrl);
                                    // highRatedRecipeIdList.add(recipeIdString);
                                    // highRatedRatings.add(avgRating);
                                    HorizontalRecipe newRecipe = new HorizontalRecipe(title, imageUrl, recipeIdString, avgRating);
                                    horizontalList.add(newRecipe);
                                    // /horizontalRecipeIdList.add(recipeIdString);
                                    // horizontalLists.get(horizontalLists.size() - 1).add(newRecipe);
                                    RecyclerRecipe2 horizontalRecyclerRecipe2 = new RecyclerRecipe2(category, recipeIdString, title, imageUrl, avgRating, "Popular Recipe", true, totalRating);
                                    horizontalRecyclerRecipe2List.add(horizontalRecyclerRecipe2);
                                // sqlDb.testDao().insertRecyclerRecipe2(recyclerRecipePopular2);
                                }
                            }
                        }
                    }
                    recipeLists.setVerticalStartId(startId);
                    recipeLists.appendVerticalList(verticalList);
                    recipeLists.appendHorizontalList(horizontalList);
                    // query the rest of the vertical recipes if necessary
                    if ((recipeLists.getNumRemainingVerticalRecipes() > 0) && (recipeLists.getNumRemainingVerticalRecipes() < recipeLists.getNumVerticalToQuery())) {
                        int numRecipesToQuery;
                        int recipeSearchStartId;
                        // the rest will be queried later
                        if (recipeLists.getNumVerticalToQuery() == recipeLists.getNumRemainingVerticalRecipes()) {
                            numRecipesToQuery = recipeLists.getNumVerticalToQuery() / 2;
                            recipeSearchStartId = recipeLists.getRandomQueryId();
                        } else // if this isn't the first time through, just query the rest of the remaining recipes starting where the first query ended
                        // doing this guarantees that we will find all of the recipes we need
                        {
                            numRecipesToQuery = recipeLists.getNumRemainingVerticalRecipes();
                            recipeSearchStartId = recipeLists.getVerticalEndId();
                        }
                        dbRecipes.whereArrayContains("categories", category).whereGreaterThanOrEqualTo("recipeId", recipeSearchStartId).orderBy("recipeId").limit(numRecipesToQuery).get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {

                            @Override
                            public void onComplete(@NonNull Task<QuerySnapshot> task) {
                                // int numRetrievedRecipes = numOfRetrievedRecipes; //viewModel.getNumOfRetrievedRecipes();
                                List<VerticalRecipe> verticalList = new ArrayList<>();
                                List<HorizontalRecipe> horizontalList = new ArrayList<>();
                                int startId = 0;
                                int endId = 0;
                                int i = 0;
                                // todo: change for loop format, enhanced for isn't right for this
                                for (QueryDocumentSnapshot document : task.getResult()) {
                                    double recipeIdDouble = document.getDouble("recipeId");
                                    int recipeIdInt = (int) recipeIdDouble;
                                    if (i == 0) {
                                        // keep track of first recipeId for later queries
                                        startId = recipeIdInt;
                                    } else {
                                        // keep track of last recipeId for later queries
                                        endId = recipeIdInt;
                                    }
                                    String imageUrl = document.getString("imageUrl");
                                    String title = document.getString("title");
                                    String recipeIdString = document.getId();
                                    boolean highlyRated = document.getBoolean("highlyRated");
                                    Double countRating = document.getDouble("countRating");
                                    Double avgRating;
                                    if (countRating != null) {
                                        avgRating = document.getDouble("rating") / countRating;
                                    } else {
                                        countRating = 0.0;
                                        avgRating = 0.0;
                                    }
                                    if (Double.isNaN(avgRating)) {
                                        avgRating = 0.0;
                                    }
                                    Integer totalRating = countRating.intValue();
                                    // Set<Integer> setOfUniqueRecipes = viewModel.getSetOfUniqueRecipes();
                                    int sizeOfSet = recipeLists.getSetOfUniqueVerticalRecipes().size();
                                    recipeLists.addToSetOfUniqueVerticalRecipes(recipeIdInt);
                                    // duplicates cannot be added to Sets - only go ahead if we haven't found a duplicate recipe
                                    if (recipeLists.getSetOfUniqueVerticalRecipes().size() != sizeOfSet) {
                                        // or we aren't in our first query (accounting for high rated recipes in the third query would force us to do recursion to ensure we get enough vertical recipes)
                                        if (// (viewModel.getNumOfRetrievedHighRatedRecipes() >= (halfMaxNumberOfHighRatedRecipes * 2)))
                                        (!highlyRated) || ((recipeLists.getHorizontalList().size()) >= recipeLists.getNumHorizontalToQuery()) || (numRecipesToQuery <= 0)) {
                                            // viewModel.incrementNumOfRetrievedRecipesBy(1);
                                            recipeLists.setNumRemainingVerticalRecipes(recipeLists.getNumRemainingVerticalRecipes() - 1);
                                            // ratings.add(avgRating);
                                            // totalRatingsCountList.add(totalRating);
                                            RecyclerRecipe2 recyclerRecipe2 = new RecyclerRecipe2(category, recipeIdString, title, imageUrl, avgRating, "vertical", false, totalRating);
                                            recyclerRecipe2List.add(recyclerRecipe2);
                                            // categoryFragmentModel.addItem(title, imageUrl, avgRating, totalRating);
                                            VerticalRecipe newRecipe = new VerticalRecipe(title, imageUrl, recipeIdString, avgRating, totalRating);
                                            verticalList.add(newRecipe);
                                        // /verticalRecipeIdList.add(recipeIdString);
                                        // verticalRecipes.add(newRecipe);
                                        // todo: may need to uncomment and convert this for onClick
                                        // recipeId.add(recipeIdString);
                                        } else // add to horizontal highly rated list instead of vertical recyclerview
                                        {
                                            // Set<Integer> setOfUniqueHighRatedRecipes = viewModel.getSetOfUniqueHighRatedRecipes();
                                            int sizeOfHighRatedSetBefore = recipeLists.getSetOfUniqueHorizontalRecipes().size();
                                            recipeLists.addToSetOfUniqueHorizontalRecipes(recipeIdInt);
                                            // duplicates cannot be added to Sets - only go ahead if we haven't found a duplicate recipe
                                            if (sizeOfHighRatedSetBefore != recipeLists.getSetOfUniqueHorizontalRecipes().size()) {
                                                // viewModel.incrementNumOfRetrievedHighRatedRecipes(1);
                                                // todo: may need to uncomment and convert, adding new private member to the class
                                                // numOfRetrievedHighRatedRecipes++;
                                                // highRatedTitles.add(title);
                                                // highRatedImages.add(imageUrl);
                                                // highRatedRecipeIdList.add(recipeIdString);
                                                // highRatedRatings.add(avgRating);
                                                HorizontalRecipe newRecipe = new HorizontalRecipe(title, imageUrl, recipeIdString, avgRating);
                                                horizontalList.add(newRecipe);
                                                // /horizontalRecipeIdList.add(recipeIdString);
                                                // horizontalLists.get(horizontalLists.size() - 1).add(newRecipe);
                                                RecyclerRecipe2 horizontalRecyclerRecipe2 = new RecyclerRecipe2(category, recipeIdString, title, imageUrl, avgRating, "Popular Recipe", true, totalRating);
                                                horizontalRecyclerRecipe2List.add(horizontalRecyclerRecipe2);
                                            // sqlDb.testDao().insertRecyclerRecipe2(recyclerRecipePopular2);
                                            }
                                        }
                                    }
                                    i++;
                                }
                                recipeLists.setVerticalEndId(endId);
                                recipeLists.appendVerticalList(verticalList);
                                recipeLists.appendHorizontalList(horizontalList);
                                // recipeLists.appendVerticalRecipeIdList(verticalRecipeIdList);
                                // recipeLists.appendHorizontalRecipeIdList(horizontalRecipeIdList);
                                recipeLists.setNumRemainingVerticalRecipes(recipeLists.getNumRemainingVerticalRecipes() - verticalList.size());
                                List<RecyclerRecipe2> tempList = new ArrayList<>();
                                // recyclerRecipe2List.addAll(horizontalRecyclerRecipe2List);
                                tempList.addAll(recyclerRecipe2List);
                                tempList.addAll(horizontalRecyclerRecipe2List);
                                roomRepository.insertAllRecyclerRecipe2(recyclerRecipe2List);
                                roomRepository.insertAllRecyclerRecipe2(horizontalRecyclerRecipe2List);
                                if (recipeLists.getHorizontalList().size() < recipeLists.getNumHorizontalToQuery()) {
                                    // search to the left of the left bound
                                    dbRecipes.whereArrayContains("categories", category).whereGreaterThan("recipeId", recipeLists.getVerticalStartId()).limit(recipeLists.getNumHorizontalToQuery() - recipeLists.getHorizontalList().size()).get().addOnCompleteListener(taskHorizontal -> {
                                        Log.i("queries", "queried outer");
                                        List<HorizontalRecipe> retrievedHorizontalList = retrieveHorizontal(recipeLists, category, "Popular Recipe", taskHorizontal);
                                        recipeLists.appendHorizontalList(retrievedHorizontalList);
                                        int numLeftToRetrieve = recipeLists.getNumHorizontalToQuery() - recipeLists.getHorizontalList().size();
                                        if (numLeftToRetrieve > 0) {
                                            // search to the right of the right bound
                                            dbRecipes.whereArrayContains("categories", category).whereLessThan("recipeId", recipeLists.getVerticalEndId()).limit(numLeftToRetrieve).get().addOnCompleteListener(taskSecondHorizontal -> {
                                                Log.i("queries", "queried inner");
                                                List<HorizontalRecipe> retrievedListInner = retrieveHorizontal(recipeLists, category, "Popular Recipe", taskSecondHorizontal);
                                                recipeLists.appendHorizontalList(retrievedListInner);
                                                callback.onCallback(recipeLists);
                                            // liveDataHorizontal.setValue(horizontalLists);
                                            });
                                        } else {
                                            callback.onCallback(recipeLists);
                                        }
                                    });
                                } else {
                                }
                            }
                        });
                    } else {
                        if (recipeLists.getHorizontalList().size() < recipeLists.getNumHorizontalToQuery()) {
                            // search to the left of the left bound
                            dbRecipes.whereArrayContains("categories", category).whereGreaterThan("recipeId", recipeLists.getVerticalStartId()).limit(recipeLists.getNumHorizontalToQuery()).get().addOnCompleteListener(taskHorizontal -> {
                                Log.i("queries", "queried outer");
                                List<HorizontalRecipe> retrievedHorizontalList = retrieveHorizontal(recipeLists, category, "Popular Recipe", taskHorizontal);
                                recipeLists.appendHorizontalList(retrievedHorizontalList);
                                int numLeftToRetrieve = recipeLists.getNumHorizontalToQuery() - recipeLists.getHorizontalList().size();
                                if (numLeftToRetrieve > 0) {
                                    // search to the right of the right bound
                                    dbRecipes.whereArrayContains("categories", category).whereLessThan("recipeId", recipeLists.getVerticalEndId()).limit(numLeftToRetrieve).get().addOnCompleteListener(taskSecondHorizontal -> {
                                        Log.i("queries", "queried inner");
                                        List<HorizontalRecipe> retrievedListInner = retrieveHorizontal(recipeLists, category, "Popular Recipe", taskSecondHorizontal);
                                        recipeLists.appendHorizontalList(retrievedListInner);
                                        callback.onCallback(recipeLists);
                                    // liveDataHorizontal.setValue(horizontalLists);
                                    });
                                } else {
                                    callback.onCallback(recipeLists);
                                }
                            });
                        }
                    }
                // recipeLists.appendVerticalList(verticalList);
                // recipeLists.appendHorizontalList(horizontalList);
                // recipeLists.setVerticalStartId(startId);
                // recipeLists.setVerticalEndId(endId);
                // callback.onCallback(verticalList, horizontalList, startId);
                // currentNumOfQueries = currentNumOfQueries + task.getResult().size() - 1;
                // number of reads to firebase - for preventing excessive and expensive reads
                // Log.i("number of queries", String.valueOf(currentNumOfQueries));
                // todo: change this to retrieveAndSaveRandomRecipesLessThan to improve randomness.  Make sure new functions does NOT create a new random number!  Pass in current random number instead
                // retrieveAndSaveRandomRecipesGreaterThanQuery(rand, numOfRecipes, halfMaxNumberOfHighRatedRecipes, individualQueryVerticalRecipeLimit, category, finalTotalRecursions);
                // todo: delete
                // categoryFragmentAdapter.notifyDataSetChanged();
                }
            });
        // currentNumOfQueries = currentNumOfQueries + task.getResult().size() - 1;
        // number of reads to firebase - for preventing excessive and expensive reads
        // Log.i("number of queries", String.valueOf(currentNumOfQueries));
        // todo: change this to retrieveAndSaveRandomRecipesLessThan to improve randomness.  Make sure new functions does NOT create a new random number!  Pass in current random number instead
        // retrieveAndSaveRandomRecipesGreaterThanQuery(rand, numOfRecipes, halfMaxNumberOfHighRatedRecipes, individualQueryVerticalRecipeLimit, category, finalTotalRecursions);
        // todo: delete
        // categoryFragmentAdapter.notifyDataSetChanged();
        }
    });
}
Also used : VerticalRecipe(com.example.ezmeal.FindRecipes.FindRecipesModels.VerticalRecipe) MutableLiveData(androidx.lifecycle.MutableLiveData) NonNull(androidx.annotation.NonNull) HorizontalRecipe(com.example.ezmeal.FindRecipes.FindRecipesModels.HorizontalRecipe) Random(java.util.Random) Callable(java.util.concurrent.Callable) Task(com.google.android.gms.tasks.Task) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) A(org.checkerframework.checker.units.qual.A) Recipe(com.example.ezmeal.roomDatabase.Recipe) QueryDocumentSnapshot(com.google.firebase.firestore.QueryDocumentSnapshot) VerticalRecipe(com.example.ezmeal.FindRecipes.FindRecipesModels.VerticalRecipe) CollectionReference(com.google.firebase.firestore.CollectionReference) Log(android.util.Log) ExecutorService(java.util.concurrent.ExecutorService) CategoryFragmentViewModel(com.example.ezmeal.FindRecipes.FindRecipesViewModels.CategoryFragmentViewModel) RetrievedRecipeLists(com.example.ezmeal.FindRecipes.FindRecipesModels.RetrievedRecipeLists) Set(java.util.Set) OnCompleteListener(com.google.android.gms.tasks.OnCompleteListener) Executors(java.util.concurrent.Executors) FirebaseFirestore(com.google.firebase.firestore.FirebaseFirestore) TimeUnit(java.util.concurrent.TimeUnit) QuerySnapshot(com.google.firebase.firestore.QuerySnapshot) CountDownLatch(java.util.concurrent.CountDownLatch) List(java.util.List) Application(android.app.Application) RecyclerRecipe2(com.example.ezmeal.roomDatabase.RecyclerRecipe2) Task(com.google.android.gms.tasks.Task) QueryDocumentSnapshot(com.google.firebase.firestore.QueryDocumentSnapshot) ArrayList(java.util.ArrayList) QuerySnapshot(com.google.firebase.firestore.QuerySnapshot) OnCompleteListener(com.google.android.gms.tasks.OnCompleteListener) NonNull(androidx.annotation.NonNull) ArrayList(java.util.ArrayList) List(java.util.List) HorizontalRecipe(com.example.ezmeal.FindRecipes.FindRecipesModels.HorizontalRecipe) RecyclerRecipe2(com.example.ezmeal.roomDatabase.RecyclerRecipe2)

Aggregations

Application (android.app.Application)1 Log (android.util.Log)1 NonNull (androidx.annotation.NonNull)1 MutableLiveData (androidx.lifecycle.MutableLiveData)1 HorizontalRecipe (com.example.ezmeal.FindRecipes.FindRecipesModels.HorizontalRecipe)1 RetrievedRecipeLists (com.example.ezmeal.FindRecipes.FindRecipesModels.RetrievedRecipeLists)1 VerticalRecipe (com.example.ezmeal.FindRecipes.FindRecipesModels.VerticalRecipe)1 CategoryFragmentViewModel (com.example.ezmeal.FindRecipes.FindRecipesViewModels.CategoryFragmentViewModel)1 Recipe (com.example.ezmeal.roomDatabase.Recipe)1 RecyclerRecipe2 (com.example.ezmeal.roomDatabase.RecyclerRecipe2)1 OnCompleteListener (com.google.android.gms.tasks.OnCompleteListener)1 Task (com.google.android.gms.tasks.Task)1 CollectionReference (com.google.firebase.firestore.CollectionReference)1 FirebaseFirestore (com.google.firebase.firestore.FirebaseFirestore)1 QueryDocumentSnapshot (com.google.firebase.firestore.QueryDocumentSnapshot)1 QuerySnapshot (com.google.firebase.firestore.QuerySnapshot)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Random (java.util.Random)1