io.vov.vitamio.utils.ContextUtils Java Examples
The following examples show how to use
io.vov.vitamio.utils.ContextUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Vitamio.java From react-native-android-vitamio with MIT License | 6 votes |
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; }
Example #2
Source File: Vitamio.java From Vitamio with Apache License 2.0 | 6 votes |
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; }
Example #3
Source File: Vitamio.java From BambooPlayer with Apache License 2.0 | 6 votes |
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; }
Example #4
Source File: Vitamio.java From video-player with MIT License | 5 votes |
/** * 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; }
Example #5
Source File: Vitamio.java From NetEasyNews with GNU General Public License v3.0 | 5 votes |
/** * 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; }
Example #6
Source File: Vitamio.java From MyHearts with Apache License 2.0 | 2 votes |
/** * 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; }
Example #7
Source File: Vitamio.java From HPlayer with Apache License 2.0 | 2 votes |
/** * 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; }