Java Code Examples for com.eveningoutpost.dexdrip.Home#activityVisible()
The following examples show how to use
com.eveningoutpost.dexdrip.Home#activityVisible() .
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: BgSendQueue.java From xDrip with GNU General Public License v3.0 | 4 votes |
public static void handleNewBgReading(final BgReading bgReading, String operation_type, Context context, boolean is_follower, boolean quick) { if (bgReading == null) { UserError.Log.wtf("BgSendQueue", "handleNewBgReading called with null bgReading!"); return; } final PowerManager.WakeLock wakeLock = JoH.getWakeLock("sendQueue", 120000); try { // Add to upload queue //if (!is_follower) { UploaderQueue.newEntry(operation_type, bgReading); //} // all this other UI stuff probably shouldn't be here but in lieu of a better method we keep with it.. if (!quick) { if (Home.activityVisible) { context.sendBroadcast(new Intent(Intents.ACTION_NEW_BG_ESTIMATE_NO_DATA)); } if (AppWidgetManager.getInstance(context).getAppWidgetIds(new ComponentName(context, xDripWidget.class)).length > 0) { //context.startService(new Intent(context, WidgetUpdateService.class)); JoH.startService(WidgetUpdateService.class); } } // emit local broadcast BroadcastGlucose.sendLocalBroadcast(bgReading); // TODO I don't really think this is needed anymore if (!quick && Pref.getBooleanDefaultFalse("excessive_wakelocks")) { // just keep it alive for 3 more seconds to allow the watch to be updated // dangling wakelock JoH.getWakeLock("broadcstNightWatch", 3000); } if (!quick) { NewDataObserver.newBgReading(bgReading, is_follower); } if ((!is_follower) && (Pref.getBoolean("plus_follow_master", false))) { if (Pref.getBoolean("display_glucose_from_plugin", false)) { // TODO does this currently ignore noise or is noise properly calculated on the follower? // munge bgReading for follower TODO will probably want extra option for this in future // TODO we maybe don't need deep clone for this! Check how value will be used below //GcmActivity.syncBGReading(PluggableCalibration.mungeBgReading(new Cloner().deepClone(bgReading))); GcmActivity.syncBGReading(PluggableCalibration.mungeBgReading(BgReading.fromJSON(bgReading.toJSON(true)))); } else { // send as is GcmActivity.syncBGReading(bgReading); } } // process the uploader queue if (JoH.ratelimit("start-sync-service", 30)) { JoH.startService(SyncService.class); } } finally { JoH.releaseWakeLock(wakeLock); } }
Example 2
Source File: BgSendQueue.java From xDrip-plus with GNU General Public License v3.0 | 4 votes |
public static void handleNewBgReading(final BgReading bgReading, String operation_type, Context context, boolean is_follower, boolean quick) { if (bgReading == null) { UserError.Log.wtf("BgSendQueue", "handleNewBgReading called with null bgReading!"); return; } final PowerManager.WakeLock wakeLock = JoH.getWakeLock("sendQueue", 120000); try { // Add to upload queue //if (!is_follower) { UploaderQueue.newEntry(operation_type, bgReading); //} // all this other UI stuff probably shouldn't be here but in lieu of a better method we keep with it.. if (!quick) { if (Home.activityVisible) { context.sendBroadcast(new Intent(Intents.ACTION_NEW_BG_ESTIMATE_NO_DATA)); } if (AppWidgetManager.getInstance(context).getAppWidgetIds(new ComponentName(context, xDripWidget.class)).length > 0) { //context.startService(new Intent(context, WidgetUpdateService.class)); JoH.startService(WidgetUpdateService.class); } } // emit local broadcast BroadcastGlucose.sendLocalBroadcast(bgReading); // TODO I don't really think this is needed anymore if (!quick && Pref.getBooleanDefaultFalse("excessive_wakelocks")) { // just keep it alive for 3 more seconds to allow the watch to be updated // dangling wakelock JoH.getWakeLock("broadcstNightWatch", 3000); } if (!quick) { NewDataObserver.newBgReading(bgReading, is_follower); } if ((!is_follower) && (Pref.getBoolean("plus_follow_master", false))) { if (Pref.getBoolean("display_glucose_from_plugin", false)) { // TODO does this currently ignore noise or is noise properly calculated on the follower? // munge bgReading for follower TODO will probably want extra option for this in future // TODO we maybe don't need deep clone for this! Check how value will be used below //GcmActivity.syncBGReading(PluggableCalibration.mungeBgReading(new Cloner().deepClone(bgReading))); GcmActivity.syncBGReading(PluggableCalibration.mungeBgReading(BgReading.fromJSON(bgReading.toJSON(true)))); } else { // send as is GcmActivity.syncBGReading(bgReading); } } // process the uploader queue if (JoH.ratelimit("start-sync-service", 30)) { JoH.startService(SyncService.class); } } finally { JoH.releaseWakeLock(wakeLock); } }