diff options
author | Deepanshu Gupta <deepanshu@google.com> | 2014-08-04 14:01:07 -0700 |
---|---|---|
committer | Deepanshu Gupta <deepanshu@google.com> | 2014-08-05 14:34:56 -0700 |
commit | 70d1574db986610232d59ee1406d7532f71812f5 (patch) | |
tree | 6057434370ccc7bbfb3454d5008c4de4db4b13f6 /tools/layoutlib/bridge | |
parent | b0d767dcf17dd393646b8fc3e8c9f46dfe12e230 (diff) | |
download | frameworks_base-70d1574db986610232d59ee1406d7532f71812f5.zip frameworks_base-70d1574db986610232d59ee1406d7532f71812f5.tar.gz frameworks_base-70d1574db986610232d59ee1406d7532f71812f5.tar.bz2 |
Get filename from File faster
Use the direct call from a File object to get the filename instead of
going through Path which depends on Java 7 making the LayoutLib tests
incompatible with Java 6.
Change-Id: I815895eedbc10245ee09bdb53b11e5548b076aad
Diffstat (limited to 'tools/layoutlib/bridge')
-rw-r--r-- | tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/intensive/Main.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/intensive/Main.java b/tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/intensive/Main.java index 4af07dd..31b3e25 100644 --- a/tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/intensive/Main.java +++ b/tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/intensive/Main.java @@ -116,17 +116,16 @@ public class Main { } File[] possibleSdks = sdkDir.listFiles(new FileFilter() { @Override - public boolean accept(File pathname) { - return pathname.isDirectory() && pathname.getAbsolutePath().contains("android-sdk"); + public boolean accept(File path) { + return path.isDirectory() && path.getAbsolutePath().contains("android-sdk"); } }); for (File possibleSdk : possibleSdks) { File platformsDir = new File(possibleSdk, "platforms"); File[] platforms = platformsDir.listFiles(new FileFilter() { @Override - public boolean accept(File pathname) { - return pathname.isDirectory() - && pathname.toPath().getFileName().toString().startsWith("android-"); + public boolean accept(File path) { + return path.isDirectory() && path.getName().startsWith("android-"); } }); if (platforms == null || platforms.length == 0) { @@ -137,10 +136,8 @@ public class Main { @Override public int compare(File o1, File o2) { final int MAX_VALUE = 1000; - String suffix1 = o1.toPath().getFileName().toString() - .substring("android-".length()); - String suffix2 = o2.toPath().getFileName().toString() - .substring("android-".length()); + String suffix1 = o1.getName().substring("android-".length()); + String suffix2 = o2.getName().substring("android-".length()); int suff1, suff2; try { suff1 = Integer.parseInt(suffix1); |