-
- All Implemented Interfaces:
-
org.readium.r2.lcp.LcpLicense.RenewListener
public final class MaterialRenewListener implements LcpLicense.RenewListener
A default implementation of the LcpLicense.RenewListener using Chrome Custom Tabs for presenting web pages and a Material Date Picker for choosing the renew date.
MaterialRenewListener must be initialized before its parent component is in a RESUMED state, because it needs to register an ActivityResultLauncher. Basically, create it in your Activity/Fragment's onCreate.
-
-
Constructor Summary
Constructors Constructor Description MaterialRenewListener(LcpLicense license, ActivityResultCaller caller, FragmentManager fragmentManager)
-
Method Summary
Modifier and Type Method Description DatepreferredEndDate(Date maximumDate)Called when the renew interaction allows to customize the end date programmatically. UnitopenWebPage(URL url)Called when the renew interaction uses an HTML web page. -
-
Constructor Detail
-
MaterialRenewListener
MaterialRenewListener(LcpLicense license, ActivityResultCaller caller, FragmentManager fragmentManager)
- Parameters:
license- LCP license which will be renewed.caller- Activity or Fragment used to register the ActivityResultLauncher.fragmentManager- FragmentManager used to present the date picker.
-
-
Method Detail
-
preferredEndDate
Date preferredEndDate(Date maximumDate)
Called when the renew interaction allows to customize the end date programmatically. You can prompt the user for the number of days to renew, for example.
The returned date can't exceed maximumDate.
-
openWebPage
Unit openWebPage(URL url)
Called when the renew interaction uses an HTML web page.
You should present the URL in a Chrome Custom Tab and terminate the function when the web page is dismissed by the user.
-
-
-
-