Last active
March 31, 2020 09:57
-
-
Save NikolaDespotoski/592a59e894aafb7c08ceef45e76a253b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@FragmentScope | |
class ChooseFilterContractor @Inject constructor(private val context: Context) : ActivityResultContractor<Unit, String> { | |
override fun createIntent(input: Unit): Intent = Intent(context, ChooseFilterActivity::class.java) | |
override fun parseResult(resultCode: Int, intent: Intent?): String = if (resultCode == Activity.RESULT_OK) { | |
intent?.getStringExtra(KEY_FILTER)?: error("Dispatched RESULT_OK, but no payload) | |
} else { | |
"" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment