/** * Gets a property from the INI file. * * @param key. * @return String. */ public static String getProperty(String key) { long k = NativeHelper.toNativeString(key, false); long r = NativeHelper.call(0, "INI_GetProperty", k); String res = null; if (r != 0) { res = NativeHelper.getString(r, 4096, false); } NativeHelper.free(k); return res; }
/** * Gets the keys from the INI file. * * @return String. */ public static String[] getPropertyKeys() { long d = NativeHelper.call(0, "INI_GetDictionary"); int n = NativeHelper.getInt(d); long keyPtr = NativeHelper.getInt(d + (Native.IS_64 ? 16 : 12)); String[] res = new String[n]; for (int i = 0, offset = 0; i < n; i++, offset += NativeHelper.PTR_SIZE) { long ptr = NativeHelper.getPointer(keyPtr + offset); res[i] = NativeHelper.getString(ptr, 260, false); } return res; }
protected void shareInstallLog(File f) { if (!NativeHelper.isSdCardPresent()) { Toast.makeText(this, R.string.no_sdcard_message, Toast.LENGTH_LONG).show(); return; } final File fToSend = new File(NativeHelper.publicFiles, f.getName()); try { FileUtils.copyFile(f, fToSend); } catch (IOException e) { e.printStackTrace(); } Intent i = new Intent(android.content.Intent.ACTION_SEND); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); i.setType("text/plain"); i.putExtra(Intent.EXTRA_SUBJECT, "install.log from Lil' Debi"); i.putExtra( Intent.EXTRA_TEXT, "Attached is an log sent by Lil' Debi. For more info, see:\n" + "https://github.com/guardianproject/lildebi\n\n" + "manufacturer: " + Build.MANUFACTURER + "\n" + "model: " + Build.MODEL + "\n" + "product: " + Build.PRODUCT + "\n" + "brand: " + Build.BRAND + "\n" + "device: " + Build.DEVICE + "\n" + "board: " + Build.BOARD + "\n" + "ID: " + Build.ID + "\n" + "CPU ABI: " + Build.CPU_ABI + "\n" + "release: " + Build.VERSION.RELEASE + "\n" + "incremental: " + Build.VERSION.INCREMENTAL + "\n" + "codename: " + Build.VERSION.CODENAME + "\n" + "SDK: " + Build.VERSION.SDK_INT + "\n"); i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(fToSend)); startActivity(Intent.createChooser(i, "How do you want to share?")); }
/** Sets the splash screen background text colour. */ public static void setTextBgColor(int r, int g, int b) { NativeHelper.call(0, "SplashScreen_SetBbColor", r, g, b); }
/** Sets the splash screen text font. */ public static void setTextFont(String text, int height) { long ptr = NativeHelper.toNativeString(text, false); NativeHelper.call(0, "SplashScreen_SetTextFont", ptr, height); NativeHelper.free(ptr); }
/** Writes splash screen text. */ public static void setText(String text, int x, int y) { long ptr = NativeHelper.toNativeString(text, false); NativeHelper.call(0, "SplashScreen_SetText", ptr, x, y); NativeHelper.free(ptr); }
/** Closes the splash. */ public static void close() { NativeHelper.call(0, "SplashScreen_Close"); }
/** * Grabs the splash screen window handle. * * @return long. */ public static long getWindowHandle() { return NativeHelper.call(0, "SplashScreen_GetWindowHandle"); }