public void updateCurrentBgInfo() { final TextView notificationText = (TextView) findViewById(R.id.notices); if (BgGraphBuilder.isXLargeTablet(getApplicationContext())) { notificationText.setTextSize(40); } notificationText.setText(""); notificationText.setTextColor(Color.RED); isBTWixel = CollectionServiceStarter.isBTWixel(getApplicationContext()); isDexbridgeWixel = CollectionServiceStarter.isDexbridgeWixel(getApplicationContext()); isBTShare = CollectionServiceStarter.isBTShare(getApplicationContext()); isWifiWixel = CollectionServiceStarter.isWifiWixel(getApplicationContext()); if (isBTShare) { updateCurrentBgInfoForBtShare(notificationText); } if (isBTWixel || isDexbridgeWixel) { updateCurrentBgInfoForBtBasedWixel(notificationText); } if (isWifiWixel) { updateCurrentBgInfoForWifiWixel(notificationText); } if (prefs.getLong("alerts_disabled_until", 0) > new Date().getTime()) { notificationText.append("\n ALERTS CURRENTLY DISABLED"); } mNavigationDrawerFragment = (NavigationDrawerFragment) getFragmentManager().findFragmentById(R.id.navigation_drawer); mNavigationDrawerFragment.setUp( R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout), menu_name, this); }
@Override protected void onListItemClick(ListView l, View v, int position, long id) { Log.d(TAG, "Item Clicked"); final BluetoothDevice device = mLeDeviceListAdapter.getDevice(position); if (device == null || device.getName() == null) return; Toast.makeText(this, R.string.connecting_to_device, Toast.LENGTH_LONG).show(); ActiveBluetoothDevice btDevice = new Select().from(ActiveBluetoothDevice.class).orderBy("_ID desc").executeSingle(); final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); prefs.edit().putString("last_connected_device_address", device.getAddress()).apply(); if (btDevice == null) { ActiveBluetoothDevice newBtDevice = new ActiveBluetoothDevice(); newBtDevice.name = device.getName(); newBtDevice.address = device.getAddress(); newBtDevice.save(); } else { btDevice.name = device.getName(); btDevice.address = device.getAddress(); btDevice.save(); } if (device.getName().toLowerCase().contains("dexcom")) { if (!CollectionServiceStarter.isBTShare(getApplicationContext())) { prefs.edit().putString("dex_collection_method", "DexcomShare").apply(); prefs.edit().putBoolean("calibration_notifications", false).apply(); } if (prefs.getString("share_key", "SM00000000").compareTo("SM00000000") == 0 || prefs.getString("share_key", "SM00000000").length() < 10) { requestSerialNumber(prefs); } else returnToHome(); } else if (device.getName().toLowerCase().contains("bridge")) { if (!CollectionServiceStarter.isDexbridgeWixel(getApplicationContext())) prefs.edit().putString("dex_collection_method", "DexbridgeWixel").apply(); if (prefs.getString("dex_txid", "00000").compareTo("00000") == 0 || prefs.getString("dex_txid", "00000").length() < 5) { requestTransmitterId(prefs); } else returnToHome(); } else if (device.getName().toLowerCase().contains("drip")) { if (!(CollectionServiceStarter.isBTWixel(getApplicationContext()) || CollectionServiceStarter.isWifiandBTWixel(getApplicationContext()))) { prefs.edit().putString("dex_collection_method", "BluetoothWixel").apply(); } returnToHome(); } else { returnToHome(); } }
private void updateCurrentBgInfo() { setupCharts(); final TextView notificationText = (TextView) findViewById(R.id.notices); if (BgGraphBuilder.isXLargeTablet(getApplicationContext())) { notificationText.setTextSize(40); } notificationText.setText(""); notificationText.setTextColor(Color.RED); boolean isBTWixel = CollectionServiceStarter.isBTWixel(getApplicationContext()); boolean isDexbridgeWixel = CollectionServiceStarter.isDexbridgeWixel(getApplicationContext()); boolean isWifiBluetoothWixel = CollectionServiceStarter.isWifiandBTWixel(getApplicationContext()); isBTShare = CollectionServiceStarter.isBTShare(getApplicationContext()); boolean isWifiWixel = CollectionServiceStarter.isWifiWixel(getApplicationContext()); alreadyDisplayedBgInfoCommon = false; // reset flag if (isBTShare) { updateCurrentBgInfoForBtShare(notificationText); } if (isBTWixel || isDexbridgeWixel || isWifiBluetoothWixel) { updateCurrentBgInfoForBtBasedWixel(notificationText); } if (isWifiWixel || isWifiBluetoothWixel) { updateCurrentBgInfoForWifiWixel(notificationText); } if (prefs.getLong("alerts_disabled_until", 0) > new Date().getTime()) { notificationText.append("\n ALL ALERTS CURRENTLY DISABLED"); } else if (prefs.getLong("low_alerts_disabled_until", 0) > new Date().getTime() && prefs.getLong("high_alerts_disabled_until", 0) > new Date().getTime()) { notificationText.append("\n LOW AND HIGH ALERTS CURRENTLY DISABLED"); } else if (prefs.getLong("low_alerts_disabled_until", 0) > new Date().getTime()) { notificationText.append("\n LOW ALERTS CURRENTLY DISABLED"); } else if (prefs.getLong("high_alerts_disabled_until", 0) > new Date().getTime()) { notificationText.append("\n HIGH ALERTS CURRENTLY DISABLED"); } NavigationDrawerFragment navigationDrawerFragment = (NavigationDrawerFragment) getFragmentManager().findFragmentById(R.id.navigation_drawer); navigationDrawerFragment.setUp( R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout), menu_name, this); }