Skip to content

Instantly share code, notes, and snippets.

View chenenyu's full-sized avatar
👷‍♂️
Flutter

chenenyu

👷‍♂️
Flutter
View GitHub Profile
@chenenyu
chenenyu / RealPathUtils.java
Created January 7, 2019 06:42
get real path from uri.
/**
* 从Uri中获取真实路径
* Created by chenenyu on 2018/12/24.
*/
public class RealPathUtils {
public static String getRealPath(Context context, Uri fileUri) {
String realPath;
// SDK >= 11 && SDK < 19
if (Build.VERSION.SDK_INT < 19) {
@chenenyu
chenenyu / Classpath.gradle
Created August 1, 2018 02:59
Android中获取classpath中的plugin依赖
project.rootProject.buildscript.configurations.each {
if (it.name == ScriptHandler.CLASSPATH_CONFIGURATION) { // classpath
it.resolvedConfiguration.firstLevelModuleDependencies.each {
println("${it.moduleGroup}:${it.moduleName}:${it.moduleVersion}")
}
}
}
@chenenyu
chenenyu / BootTime.java
Created July 20, 2018 03:27
获取应用启动时间
// 应用启动时间
private long getStartTime() throws Exception {
if (Build.VERSION.SDK_INT >= 24) {
return Process.getStartElapsedRealtime();
}
final String path = "/proc/" + Process.myPid() + "/stat";
final BufferedReader reader = new BufferedReader(new FileReader(path));
final String stat;
try {
stat = reader.readLine();