Package 

Class MaterialRenewListener

  • 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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Date preferredEndDate(Date maximumDate) Called when the renew interaction allows to customize the end date programmatically.
      Unit openWebPage(URL url) Called when the renew interaction uses an HTML web page.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.