Class RecipeContract


  • public class RecipeContract
    extends androidx.activity.result.contract.ActivityResultContract<Recipe,​android.util.Pair<java.lang.String,​Recipe>>
    Contract for launching new activities that return a Recipe
    • Nested Class Summary

      • Nested classes/interfaces inherited from class androidx.activity.result.contract.ActivityResultContract

        androidx.activity.result.contract.ActivityResultContract.SynchronousResult<T extends java.lang.Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      RecipeContract()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      android.content.Intent createIntent​(android.content.Context context, Recipe recipe)
      Creates an intent that contains recipeRecipe
      android.util.Pair<java.lang.String,​Recipe> parseResult​(int i, android.content.Intent intent)
      Parse the response from the activity as required
      • Methods inherited from class androidx.activity.result.contract.ActivityResultContract

        getSynchronousResult
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RecipeContract

        public RecipeContract()
    • Method Detail

      • createIntent

        @NonNull
        public android.content.Intent createIntent​(@NonNull
                                                   android.content.Context context,
                                                   Recipe recipe)
        Creates an intent that contains recipeRecipe
        Specified by:
        createIntent in class androidx.activity.result.contract.ActivityResultContract<Recipe,​android.util.Pair<java.lang.String,​Recipe>>
        Parameters:
        context - context that launches the activity
        recipe - recipe to include in the intent
        Returns:
        the Intent created which contains the recipe.
      • parseResult

        public android.util.Pair<java.lang.String,​Recipe> parseResult​(int i,
                                                                            @Nullable
                                                                            android.content.Intent intent)
        Parse the response from the activity as required
        Specified by:
        parseResult in class androidx.activity.result.contract.ActivityResultContract<Recipe,​android.util.Pair<java.lang.String,​Recipe>>
        Parameters:
        i - a status code representing whether the activity succeeded or not
        intent - the intent returned by the activity upon completion
        Returns:
        null if activity was interrupted or failed to return anything