@Override public boolean onItemMove(int source, int destination) { if (JoH.ratelimit("on item move", 5)) { showReminderDialog(null, reminders.get(source), 0); } return true; }
@Override public void onStopDiscoveryFailed(String serviceType, int errorCode) { if (JoH.ratelimit("mdns-onStopDiscoveryFailed", 10)) { myStopServiceDiscovery(); } }
public static void start() { // TODO consider how inevitable task could change dynamic of this instead of rate limit if (JoH.ratelimit("start-notifications",10)) { JoH.startService(Notifications.class); } }
public static Bitmap getBitmap(final String text, int fillColor, final String arrow) { try { final int width = (int) xdrip.getAppContext().getResources().getDimension(android.R.dimen.notification_large_icon_width); final int height = (int) xdrip.getAppContext().getResources().getDimension(android.R.dimen.notification_large_icon_height); return getBitmap(text, fillColor, arrow, width, height); } catch (Exception e) { if (JoH.ratelimit("icon-failure", 60)) { UserError.Log.e(TAG, "Cannot create number icon dimensions: " + e); } return null; } }
public static void immortality() { if (enabled()) { if (JoH.ratelimit("pendiq-auto-start-service", 30)) { JoH.startService(PendiqService.class); } } }
public static void startServiceAndResendDataIfNeeded(final long since) { if (isEnabled()) { if (JoH.ratelimit("wear-resend-data", 60)) { startServiceAndResendData(since); } } }
public static Bitmap getBitmap(final String text, int fillColor, final String arrow) { try { final int width = (int) xdrip.getAppContext().getResources().getDimension(android.R.dimen.notification_large_icon_width); final int height = (int) xdrip.getAppContext().getResources().getDimension(android.R.dimen.notification_large_icon_height); return getBitmap(text, fillColor, arrow, width, height); } catch (Exception e) { if (JoH.ratelimit("icon-failure", 60)) { UserError.Log.e(TAG, "Cannot create number icon dimensions: " + e); } return null; } }
private static byte[] nn(final byte[] array) { if (array == null) { if (JoH.ratelimit("never-null", 60)) { UserError.Log.wtf("NeverNullOb1", "Attempt to pass null!!! " + JoH.backTrace()); return new byte[1]; } } return array; }
private static byte[] nn(final byte[] array) { if (array == null) { if (JoH.ratelimit("never-null", 60)) { UserError.Log.wtf("NeverNullOb1", "Attempt to pass null!!! " + JoH.backTrace()); return new byte[1]; } } return array; }
protected static byte[] nn(final byte[] array) { if (array == null) { if (JoH.ratelimit("never-null", 60)) { UserError.Log.wtf("NeverNullG5Base", "Attempt to pass null!!! " + JoH.backTrace()); return new byte[1]; } } return array; }
public static void niceRestartBluetooth(Context context) { if (!isOngoingCall()) { if (ratelimit("joh-restart-bluetooth", 600)) { restartBluetooth(context); } } }
public static boolean setStoredFirmwareBytes(String transmitterId, byte[] data, boolean from_bluetooth) { if (from_bluetooth) UserError.Log.e(TAG, "Store: VersionRX dbg: " + JoH.bytesToHex(data)); if (transmitterId.length() != 6) return false; if (data.length < 10) return false; if (JoH.ratelimit("store-firmware-bytes", 60)) { PersistentStore.setBytes("g5-firmware-" + transmitterId, data); } return true; }
public static boolean setStoredFirmwareBytes(String transmitterId, byte[] data, boolean from_bluetooth) { if (from_bluetooth) UserError.Log.e(TAG, "Store: VersionRX dbg: " + JoH.bytesToHex(data)); if (transmitterId.length() != 6) return false; if (data.length < 10) return false; if (JoH.ratelimit("store-firmware-bytes", 60)) { PersistentStore.setBytes("g5-firmware-" + transmitterId, data); } return true; }
private void initWearTreatments() { long startTime = new Date().getTime() - (60000 * 60 * 24 * 3);//3 days if (JoH.ratelimit("watch_init_wear_treatments_data", 60)) { Log.d(TAG, "initWearTreatments clear treatments and re-init from startTime=" + JoH.dateTimeText(startTime)); sendNotification(CLEAR_TREATMENTS_PATH, "clearTreatments");//this necessary to ensure deleted treatments are cleared sendWearTreatmentsData(sendTreatmentsCount, startTime); sendWearBloodTestData(sendTreatmentsCount, startTime); sendWearCalibrationData(sendTreatmentsCount, startTime); sendWearBgData(sendTreatmentsCount, startTime); } else Log.d(TAG, "Skip initWearTreatments due to exceeding ratelimit"); }
private void initWearTreatments() { long startTime = new Date().getTime() - (60000 * 60 * 24 * 3);//3 days if (JoH.ratelimit("watch_init_wear_treatments_data", 60)) { Log.d(TAG, "initWearTreatments clear treatments and re-init from startTime=" + JoH.dateTimeText(startTime)); sendNotification(CLEAR_TREATMENTS_PATH, "clearTreatments");//this necessary to ensure deleted treatments are cleared sendWearTreatmentsData(sendTreatmentsCount, startTime); sendWearBloodTestData(sendTreatmentsCount, startTime); sendWearCalibrationData(sendTreatmentsCount, startTime); sendWearBgData(sendTreatmentsCount, startTime); } else Log.d(TAG, "Skip initWearTreatments due to exceeding ratelimit"); }
@Override public void run() { if (JoH.ratelimit("nightscout-manual-poll", 15)) { startSyncService(100); JoH.static_toast_short("Polling"); if (TidepoolEntry.enabled()) { TidepoolUploader.doLogin(true); } } } }));
public static void launchDownloadRest() { if (Pref.getBooleanDefaultFalse("cloud_storage_api_enable") && Pref.getBooleanDefaultFalse("cloud_storage_api_download_enable")) { if (JoH.ratelimit("cloud_treatment_download", 60)) { final NightscoutUploader uploader = new NightscoutUploader(xdrip.getAppContext()); uploader.downloadRest(500); } } }
public static void launchDownloadRest() { if (Pref.getBooleanDefaultFalse("cloud_storage_api_enable") && Pref.getBooleanDefaultFalse("cloud_storage_api_download_enable")) { if (JoH.ratelimit("cloud_treatment_download", 60)) { final NightscoutUploader uploader = new NightscoutUploader(xdrip.getAppContext()); uploader.downloadRest(500); } } }
private static void uploadToShare(BgReading bgReading, boolean is_follower) { if ((!is_follower) && (Pref.getBooleanDefaultFalse("share_upload"))) { if (JoH.ratelimit("sending-to-share-upload", 10)) { UserError.Log.d("ShareRest", "About to call ShareRest!!"); String receiverSn = Pref.getString("share_key", "SM00000000").toUpperCase(); BgUploader bgUploader = new BgUploader(xdrip.getAppContext()); bgUploader.upload(new ShareUploadPayload(receiverSn, bgReading)); } } } }
@Override protected void onCreate(Bundle savedInstanceState) { evaluateColors(false); super.onCreate(savedInstanceState); setContentView(R.layout.activity_statistics); decorView = getWindow().getDecorView(); assignButtonNames(); initPagerAndIndicator(); setButtonColors(); registerButtonListeners(); if (JoH.ratelimit("statistics-startup",5)) showStartupInfo(); }