Class Configuration

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Configuration()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean allowInvalidSignatures()
      Override if required, returning true if invalid signatures are allowed to apply configuration, or false if only a correct signature is acceptable.
      void automationAction​(java.lang.String action)
      Executes the action specified when automation testing using Espresso.
      void automationApply()
      Applies configuration properties to the app when automation testing using Espresso.
      void automationReset()
      Resets configuration properties to factory defaults (the values specified in your `Configuration` subclasses `reset` method) when automation testing using Espresso.
      java.lang.String description()
      Returns the textual representation of all properties.
      java.lang.String modifications()
      Returns the textual representation of all properties that have non default values.
      abstract java.lang.String publicKey()
      Override to return the public key for this application.
      void reset()
      Override if required to set default values into your properties.
      static Configuration sharedConfiguration()
      The singleton instance of the Configuration subclass.
      • Methods inherited from class java.lang.Object

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

      • Configuration

        protected Configuration()
    • Method Detail

      • sharedConfiguration

        @NonNull
        public static Configuration sharedConfiguration()
        The singleton instance of the Configuration subclass. The instance is automatically instantiated on application startup. It is permissible to have a multi-level class hierarchy if required. e.g. `AppConfiguration ‣ CommonConfiguration ‣ Configuration`.
        Returns:
        Singleton instance
      • allowInvalidSignatures

        public boolean allowInvalidSignatures()
        Override if required, returning true if invalid signatures are allowed to apply configuration, or false if only a correct signature is acceptable.

        It is best practice to make release builds to only allow correct signatures.

        Default implementation of allowInvalidSignatures returns true if a debugger is allowed to attach to the application. e.g. The AndroidManifest.xml's `android:debuggable` is `true`.

        Returns:
        true if invalid signatures are allowed to apply configuration, or false if only a correct signature is acceptable.
      • reset

        @CallSuper
        public void reset()
        Override if required to set default values into your properties. By default, sets properties as follows: String=null, int=0, float=0.0f, double=0.0, boolean=false. You should ensure that all reset values conform to minimum and maximum values, list entries and regular expressions. Any reset values not conforming will be output to the console.
         public void reset() {
           super.reset();
           this.decibelLimit = 5.1f;
           this.foregroundColorHex = "fa3bcc";
         }
         
      • publicKey

        @NonNull
        public abstract java.lang.String publicKey()
        Override to return the public key for this application. Use the Appfigurate app (Emulator or Google Play Store) to output the public key.
         public String publicKey() {
           // 41 36 87 71 0D 05
           return "-----BEGIN PUBLIC KEY-----\n"
             + "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4TZnKfGeXttN7Rr3eiAZ\n"
             + "PMEPsZvbo7lgIpMh6OjgBsoqkJJP0yXXLtpqsBCv8vm7RYqCn5+yfkiCQiXvkJBz\n"
             + "FSKmLF9EPR9l1H+32Id82dDuseD70D66puPUHjciEgmU18DpW2NVvTAykMwTEsiR\n"
             + "0h/ExBEhUe75qtwlVno8cMFbEfVtiGbKECvWIr122ED71T0Jt2Bcxqx1a7c1hPIV\n"
             + "RwLxIfWfE0+2rB9nJVPBgsTVPywibDvjio82FousyMDmvkAbMq5iyuyvJ0+5bATz\n"
             + "o12GEt5lSiQlCMzfmkWYBROMDCh27qGFVVo1XAUCVsMfsW9n4iQcoLAdUp/LI3B3\n"
             + "ywIDAQAB\n"
             + "-----END PUBLIC KEY-----\n";
         }
         
        Returns:
        public key
      • modifications

        @NonNull
        public java.lang.String modifications()
        Returns the textual representation of all properties that have non default values. Property names are shortened to camel case and appended with the non default value, except for String properties which omit the property name. Example: userInteractionTimeout=60.0 would be returned as "UIT=60.0".
        Returns:
        textual representation of non default values
      • description

        @NonNull
        public java.lang.String description()
        Returns the textual representation of all properties. Property names are shortened to camel case and appended with the value, except for String properties which omit the property name. Example: debugLog=5 would be returned as "DL=5".
        Returns:
        textual represention of all properties
      • automationApply

        public void automationApply()
        Applies configuration properties to the app when automation testing using Espresso. The `allowsInvalidSignatures` method must return `true`. The standard "Configuration applied" dialog will be suppressed.
      • automationReset

        public void automationReset()
        Resets configuration properties to factory defaults (the values specified in your `Configuration` subclasses `reset` method) when automation testing using Espresso. The `allowsInvalidSignatures` method must return `true`. The standard "Configuration reset" dialog will be suppressed.
      • automationAction

        public void automationAction​(java.lang.String action)
        Executes the action specified when automation testing using Espresso. The `allowsInvalidSignatures` method must return `true`. The standard "Configuration reset" dialog will be suppressed.
        Parameters:
        action - action to execute.