Class ActivityResourceFinder

java.lang.Object
uk.co.samuelwall.materialtaptargetprompt.ActivityResourceFinder
All Implemented Interfaces:
ResourceFinder
Direct Known Subclasses:
DialogResourceFinder

public class ActivityResourceFinder
extends java.lang.Object
implements ResourceFinder
ResourceFinder implementation for Activity.
  • Constructor Summary

    Constructors
    Constructor Description
    ActivityResourceFinder​(android.app.Activity activity)  
  • Method Summary

    Modifier and Type Method Description
    android.view.View findViewById​(int resId)
    Finds a child view with the given identifier.
    android.content.Context getContext()
    Retrieve the Context that the prompt is running in.
    android.graphics.drawable.Drawable getDrawable​(int resId)
    Returns a drawable object associated with a particular resource ID and styled for the current theme.
    android.view.ViewGroup getPromptParentView()
    Get the view to add the prompt to.
    android.content.res.Resources getResources()
    Returns a Resources instance for the application's package.
    java.lang.String getString​(int resId)
    Returns a localized string from the application's package's default string table.
    android.content.res.Resources.Theme getTheme()
    Return the Theme object associated with ResourceFinder.getContext().
    android.content.res.TypedArray obtainStyledAttributes​(int resId, int[] attrs)
    Retrieve styled attribute information in ResourceFinder.getContext() theme.

    Methods inherited from class java.lang.Object

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

    • ActivityResourceFinder

      public ActivityResourceFinder​(@NonNull android.app.Activity activity)
  • Method Details

    • findViewById

      @Nullable public android.view.View findViewById​(@IdRes int resId)
      Description copied from interface: ResourceFinder
      Finds a child view with the given identifier. Returns null if the specified child view does not exist.
      Specified by:
      findViewById in interface ResourceFinder
      Parameters:
      resId - the identifier of the view to find
      Returns:
      The view with the given id or null.
    • getPromptParentView

      @NonNull public android.view.ViewGroup getPromptParentView()
      Description copied from interface: ResourceFinder
      Get the view to add the prompt to.
      Specified by:
      getPromptParentView in interface ResourceFinder
      Returns:
      The view to add the prompt to.
    • getContext

      @NonNull public android.content.Context getContext()
      Description copied from interface: ResourceFinder
      Retrieve the Context that the prompt is running in.
      Specified by:
      getContext in interface ResourceFinder
      Returns:
      Context The Context used by the prompt.
    • getResources

      @NonNull public android.content.res.Resources getResources()
      Description copied from interface: ResourceFinder
      Returns a Resources instance for the application's package.
      Specified by:
      getResources in interface ResourceFinder
      Returns:
      a Resources instance for the application's package
    • getTheme

      @NonNull public android.content.res.Resources.Theme getTheme()
      Description copied from interface: ResourceFinder
      Return the Theme object associated with ResourceFinder.getContext().
      Specified by:
      getTheme in interface ResourceFinder
    • getString

      @NonNull public java.lang.String getString​(@StringRes int resId)
      Description copied from interface: ResourceFinder
      Returns a localized string from the application's package's default string table.
      Specified by:
      getString in interface ResourceFinder
      Parameters:
      resId - Resource id for the string
      Returns:
      The string data associated with the resource, stripped of styled text information.
    • obtainStyledAttributes

      @NonNull public android.content.res.TypedArray obtainStyledAttributes​(@StyleRes int resId, @StyleableRes int[] attrs)
      Description copied from interface: ResourceFinder
      Retrieve styled attribute information in ResourceFinder.getContext() theme. See Resources.Theme.obtainStyledAttributes(int, int[]) for more information.
      Specified by:
      obtainStyledAttributes in interface ResourceFinder
      See Also:
      Resources.Theme.obtainStyledAttributes(int, int[])
    • getDrawable

      @Nullable public android.graphics.drawable.Drawable getDrawable​(@DrawableRes int resId)
      Description copied from interface: ResourceFinder
      Returns a drawable object associated with a particular resource ID and styled for the current theme.
      Specified by:
      getDrawable in interface ResourceFinder
      Parameters:
      resId - The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
      Returns:
      An object that can be used to draw this resource, or null if the resource could not be resolved.