Class ResourcesHelper

  • All Implemented Interfaces:

    
    public final class ResourcesHelper
    
                        

    Helper to handle resources used by the SDK given a selected language

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      ResourcesHelper(Context context)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Integer getColor(@ColorRes() Integer resourceId) Get Color from resource id
      final Float getDensity() Retrieve the DisplayMetrics density associated with the resources
      final Drawable getDrawable(@DrawableRes() Integer resourceId) Get Drawable from resource id
      final Typeface getFontTypeFaceByName(String resourceName) Get Font type face by its resource name
      final String getStringResourceByName(String resourceName, String language) Retrieve the string value corresponding to this key with the "didomi_" prefix in the specified language
      final Boolean isTablet() Check if device is a tablet
      • Methods inherited from class java.lang.Object

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

      • ResourcesHelper

        ResourcesHelper(Context context)
        Parameters:
        context - the application context
    • Method Detail

      • getColor

        @ColorInt() final Integer getColor(@ColorRes() Integer resourceId)

        Get Color from resource id

        Parameters:
        resourceId - the id as Int
      • getDensity

         final Float getDensity()

        Retrieve the DisplayMetrics density associated with the resources

      • getDrawable

         final Drawable getDrawable(@DrawableRes() Integer resourceId)

        Get Drawable from resource id

        Parameters:
        resourceId - the id as Int
      • getFontTypeFaceByName

         final Typeface getFontTypeFaceByName(String resourceName)

        Get Font type face by its resource name

        Parameters:
        resourceName - the name of the resource as String
      • getStringResourceByName

         final String getStringResourceByName(String resourceName, String language)

        Retrieve the string value corresponding to this key with the "didomi_" prefix in the specified language

        Parameters:
        resourceName - name of the resource, without the prefix.
        language - requested language of the translation