All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.robolectric.res.ResourceIds Maven / Gradle / Ivy

There is a newer version: 4.13
Show newest version
package org.robolectric.res;

/**
 * Utility class to that checks if a resource ID is a framework resource or application resource.
 */
public class ResourceIds {
  public static boolean isFrameworkResource(int resId) {
    return ((resId >>> 24) == 0x1);
  }

  public static int getPackageIdentifier(int resId) {
    return (resId >>> 24);
  }

  public static int getTypeIdentifier(int resId) {
    return (resId & 0x00FF0000) >>> 16;
  }

  public static int getEntryIdentifier(int resId) {
    return resId & 0x0000FFFF;
  }

  public static int makeIdentifer(int packageIdentifier, int typeIdentifier, int entryIdenifier) {
    return packageIdentifier << 24 | typeIdentifier << 16 | entryIdenifier;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy