• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.robolectric.res;
2 
3 /**
4  * Utility class to that checks if a resource ID is a framework resource or application resource.
5  */
6 public class ResourceIds {
isFrameworkResource(int resId)7   public static boolean isFrameworkResource(int resId) {
8     return ((resId >>> 24) == 0x1);
9   }
10 
getPackageIdentifier(int resId)11   public static int getPackageIdentifier(int resId) {
12     return (resId >>> 24);
13   }
14 
getTypeIdentifier(int resId)15   public static int getTypeIdentifier(int resId) {
16     return (resId & 0x00FF0000) >>> 16;
17   }
18 
getEntryIdentifier(int resId)19   public static int getEntryIdentifier(int resId) {
20     return resId & 0x0000FFFF;
21   }
22 
makeIdentifer(int packageIdentifier, int typeIdentifier, int entryIdenifier)23   public static int makeIdentifer(int packageIdentifier, int typeIdentifier, int entryIdenifier) {
24     return packageIdentifier << 24 | typeIdentifier << 16 | entryIdenifier;
25   }
26 }