本文整理汇总了Java中io.vov.vitamio.utils.ContextUtils类的典型用法代码示例。如果您正苦于以下问题:Java ContextUtils类的具体用法?Java ContextUtils怎么用?Java ContextUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ContextUtils类属于io.vov.vitamio.utils包,在下文中一共展示了ContextUtils类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractLibs
import io.vov.vitamio.utils.ContextUtils; //导入依赖的package包/类
private static boolean extractLibs(Context ctx, int rawID) {
long begin = System.currentTimeMillis();
final int version = ContextUtils.getVersionCode(ctx);
Log.d("loadLibs start " + version);
File lock = new File(getLibraryPath() + LIBS_LOCK);
if (lock.exists())
lock.delete();
String libPath = copyCompressedLib(ctx, rawID, "libarm.so");
Log.d("copyCompressedLib time: " + (System.currentTimeMillis() - begin) / 1000.0);
boolean inited = native_initializeLibs(libPath, getLibraryPath(), String.valueOf(Vitamio.getVitamioType()));
new File(libPath).delete();
FileWriter fw = null;
try {
lock.createNewFile();
fw = new FileWriter(lock);
fw.write(String.valueOf(version));
return true;
} catch (IOException e) {
Log.e("Error creating lock file", e);
} finally {
Log.d("initializeNativeLibs: " + inited);
Log.d("loadLibs time: " + (System.currentTimeMillis() - begin) / 1000.0);
IOUtils.closeSilently(fw);
}
return false;
}
示例2: isInitialized
import io.vov.vitamio.utils.ContextUtils; //导入依赖的package包/类
/**
* Check if Vitamio is initialized at this device
*
* @param ctx Android Context
* @return true if the Vitamio has been initialized.
*/
@SuppressLint("NewApi")
public static boolean isInitialized(Context ctx) {
vitamioPackage = ctx.getPackageName();
if(VERSION.SDK_INT > 23) {
vitamioLibraryPath = ctx.getApplicationInfo().nativeLibraryDir + "/";
}else{
vitamioLibraryPath = ContextUtils.getDataDir(ctx) + "lib/";
}
return true;
}
示例3: isInitialized
import io.vov.vitamio.utils.ContextUtils; //导入依赖的package包/类
/**
* Check if Vitamio is initialized at this device
*
* @param ctx Android Context
* @return true if the Vitamio has been initialized.
*/
@SuppressLint("NewApi")
public static boolean isInitialized(Context ctx) {
vitamioPackage = ctx.getPackageName();
vitamioLibraryPath = ctx.getApplicationInfo().nativeLibraryDir + "/";
vitamioDataPath = ContextUtils.getDataDir(ctx) + "lib/";
browserlibraryPath = ctx.getApplicationContext().getDir("libs", Context.MODE_PRIVATE).getPath();
return true;
}
示例4: isInitialized
import io.vov.vitamio.utils.ContextUtils; //导入依赖的package包/类
/**
* Check if Vitamio is initialized at this device
*
* @param ctx Android Context
* @return true if the Vitamio has been initialized.
*/
public static boolean isInitialized(Context ctx) {
vitamioPackage = ctx.getPackageName();
vitamioLibraryPath = ContextUtils.getDataDir(ctx) + "lib/";
return true;
}