Class RecipeEditContract


  • public class RecipeEditContract
    extends androidx.activity.result.contract.ActivityResultContract<Recipe,​android.util.Pair<java.lang.String,​Recipe>>
    Contract for launching a RecipeEditActivity
    • 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>
    • 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 for the recipe edit activity to be launched
      android.util.Pair<java.lang.String,​Recipe> parseResult​(int i, android.content.Intent intent)
      Parses the result from the recipe edit activity
      • 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

      • RecipeEditContract

        public RecipeEditContract()
    • Method Detail

      • createIntent

        @NonNull
        public android.content.Intent createIntent​(@NonNull
                                                   android.content.Context context,
                                                   Recipe recipe)
        Creates an intent for the recipe edit activity to be launched
        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 for the recipe
      • parseResult

        public android.util.Pair<java.lang.String,​Recipe> parseResult​(int i,
                                                                            @Nullable
                                                                            android.content.Intent intent)
        Parses the result from the recipe edit activity
        Specified by:
        parseResult in class androidx.activity.result.contract.ActivityResultContract<Recipe,​android.util.Pair<java.lang.String,​Recipe>>
        Parameters:
        i - result code of the activity
        intent - intent returned in the result
        Returns:
        a pair identifying that it is a recipe related activity and the recipe created by the edit activity