Added Script file chooser. Fixed the issue that background image setting not working
This commit is contained in:
@@ -208,6 +208,7 @@ public class PFile {
|
||||
a = -1;
|
||||
if (b < 0)
|
||||
b = fileName.length();
|
||||
// FIXME: 2017/4/3 StringOutOfBoundsException
|
||||
fileName = fileName.substring(a + 1, b);
|
||||
return fileName;
|
||||
}
|
||||
|
||||
@@ -34,8 +34,10 @@ public class FileUtils {
|
||||
if (cursor.moveToFirst()) {
|
||||
return cursor.getString(column_index);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Eat it
|
||||
} catch (Exception ignored) {
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
}
|
||||
} else if ("file".equalsIgnoreCase(uri.getScheme())) {
|
||||
return uri.getPath();
|
||||
|
||||
40
common/src/main/java/com/stardust/util/SdkVersionUtil.java
Normal file
40
common/src/main/java/com/stardust/util/SdkVersionUtil.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package com.stardust.util;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/4/3.
|
||||
*/
|
||||
|
||||
public class SdkVersionUtil {
|
||||
|
||||
private static final String[] SDK_VERSIONS = {
|
||||
"1.0", "1.1", "1.5", "1.6", "2.0", "2.0.1", "2.1.x", "2.2.x",
|
||||
"2.3", "2.3.3", "3.0.x", "3.1.x", "3.2", "4.0", "4.0.3", "4.1",
|
||||
"4.2", "4.3", "4.4.2", "4.4W", "5.0", "5.1", "6.0", "7.0", "7.1",
|
||||
"8.0"
|
||||
};
|
||||
|
||||
public static String sdkIntToString(int i) {
|
||||
if (i > 26) {
|
||||
return "Unknown";
|
||||
}
|
||||
return SDK_VERSIONS[i - 1];
|
||||
}
|
||||
|
||||
public static final class TestSuite {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
assertEquals("5.0", sdkIntToString(21));
|
||||
assertEquals("8.0", sdkIntToString(26));
|
||||
assertEquals("Unknown", sdkIntToString(27));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user