com.eveningoutpost.dexdrip.Tables.BgReadingTable Java Examples

The following examples show how to use com.eveningoutpost.dexdrip.Tables.BgReadingTable. 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: MenuActivity.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
private void updateTab() {

        String msg;
        final int offColor = Color.DKGRAY;
        final int onColor = Color.RED;

        addtreatmentbutton.setBackgroundColor(offColor);
        refreshdbbutton.setBackgroundColor(offColor);
        restartcollectorbutton.setBackgroundColor(offColor);
        xdripprefsbutton.setBackgroundColor(offColor);
        bloodtesttabbutton.setBackgroundColor(offColor);
        treatmenttabbutton.setBackgroundColor(offColor);
        calibrationtabbutton.setBackgroundColor(offColor);
        bgtabbutton.setBackgroundColor(offColor);

        switch (currenttab) {
            case "addtreatment":
                addtreatmentbutton.setBackgroundColor(onColor);
                startIntent(KeypadInputActivity.class);
                break;
            case "refreshdb":
                refreshdbbutton.setBackgroundColor(onColor);
                ListenerService.SendData(this, WEARABLE_INITTREATMENTS_PATH, null);
                msg = getResources().getString(R.string.notify_refreshdb);
                JoH.static_toast(xdrip.getAppContext(), msg, Toast.LENGTH_SHORT);
                break;
            case "restartcollector":
                restartcollectorbutton.setBackgroundColor(onColor);
                CollectionServiceStarter.startBtService(getApplicationContext());
                msg = getResources().getString(R.string.notify_collector_started, DexCollectionType.getDexCollectionType());
                JoH.static_toast(xdrip.getAppContext(), msg, Toast.LENGTH_SHORT);
                break;
            case "xdripprefs":
                xdripprefsbutton.setBackgroundColor(onColor);
                startIntent(NWPreferences.class);
                break;
            //View DB Tables:
            case "bloodtest":
                bloodtesttabbutton.setBackgroundColor(onColor);
                startIntent(BloodTestTable.class);// TODO get mgdl or mmol here
                break;
            case "treatments":
                treatmenttabbutton.setBackgroundColor(onColor);
                startIntent(TreatmentsTable.class);
                break;
            case "calibrations":
                calibrationtabbutton.setBackgroundColor(onColor);
                startIntent(CalibrationDataTable.class);
                break;
            case "bgreadings":
                bgtabbutton.setBackgroundColor(onColor);
                startIntent(BgReadingTable.class);
                break;
        }

    }
 
Example #2
Source File: MenuActivity.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
private void updateTab() {

        String msg;
        final int offColor = Color.DKGRAY;
        final int onColor = Color.RED;

        addtreatmentbutton.setBackgroundColor(offColor);
        refreshdbbutton.setBackgroundColor(offColor);
        restartcollectorbutton.setBackgroundColor(offColor);
        xdripprefsbutton.setBackgroundColor(offColor);
        bloodtesttabbutton.setBackgroundColor(offColor);
        treatmenttabbutton.setBackgroundColor(offColor);
        calibrationtabbutton.setBackgroundColor(offColor);
        bgtabbutton.setBackgroundColor(offColor);

        switch (currenttab) {
            case "addtreatment":
                addtreatmentbutton.setBackgroundColor(onColor);
                startIntent(KeypadInputActivity.class);
                break;
            case "refreshdb":
                refreshdbbutton.setBackgroundColor(onColor);
                ListenerService.SendData(this, WEARABLE_INITTREATMENTS_PATH, null);
                msg = getResources().getString(R.string.notify_refreshdb);
                JoH.static_toast(xdrip.getAppContext(), msg, Toast.LENGTH_SHORT);
                break;
            case "restartcollector":
                restartcollectorbutton.setBackgroundColor(onColor);
                CollectionServiceStarter.startBtService(getApplicationContext());
                msg = getResources().getString(R.string.notify_collector_started, DexCollectionType.getDexCollectionType());
                JoH.static_toast(xdrip.getAppContext(), msg, Toast.LENGTH_SHORT);
                break;
            case "xdripprefs":
                xdripprefsbutton.setBackgroundColor(onColor);
                startIntent(NWPreferences.class);
                break;
            //View DB Tables:
            case "bloodtest":
                bloodtesttabbutton.setBackgroundColor(onColor);
                startIntent(BloodTestTable.class);// TODO get mgdl or mmol here
                break;
            case "treatments":
                treatmenttabbutton.setBackgroundColor(onColor);
                startIntent(TreatmentsTable.class);
                break;
            case "calibrations":
                calibrationtabbutton.setBackgroundColor(onColor);
                startIntent(CalibrationDataTable.class);
                break;
            case "bgreadings":
                bgtabbutton.setBackgroundColor(onColor);
                startIntent(BgReadingTable.class);
                break;
        }

    }
 
Example #3
Source File: NavDrawerBuilder.java    From xDrip-Experimental with GNU General Public License v3.0 4 votes vote down vote up
public NavDrawerBuilder(Context aContext) {
    context = aContext;
    boolean xDripViewer = XDripViewer.isxDripViewerMode(aContext);
    
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    boolean IUnderstand = prefs.getBoolean("I_understand", false);
    if (IUnderstand == false) {
        this.nav_drawer_options.add("Settings");
        this.nav_drawer_intents.add(new Intent(context, Preferences.class));
        return;
    }

    this.nav_drawer_options.add(Home.menu_name);
    this.nav_drawer_intents.add(new Intent(context, Home.class));
    if (is_active_sensor) {
        this.nav_drawer_options.add("Calibration Graph");
        this.nav_drawer_intents.add(new Intent(context, CalibrationGraph.class));
    }

    if (prefs.getBoolean("show_data_tables", false)) {
        this.nav_drawer_options.add("BG Data Table");
        this.nav_drawer_intents.add(new Intent(context, BgReadingTable.class));
        this.nav_drawer_options.add("Calibration Data Table");
        this.nav_drawer_intents.add(new Intent(context, CalibrationDataTable.class));
    }

    if(!xDripViewer) {
        if(is_active_sensor) {
            if(!CollectionServiceStarter.isBTShare(context)) {
                if (last_two_bgReadings.size() > 1) {
                    if (last_two_calibrations.size() > 1) {
                        if (bGreadings_in_last_30_mins.size() >= 2) {
                            if (time_now - last_two_calibrations.get(0).timestamp < (1000 * 60 * 60)) { //Put steps in place to discourage over calibration
                                this.nav_drawer_options.add(CalibrationOverride.menu_name);
                                this.nav_drawer_intents.add(new Intent(context, CalibrationOverride.class));
                            } else {
                                this.nav_drawer_options.add(AddCalibration.menu_name);
                                this.nav_drawer_intents.add(new Intent(context, AddCalibration.class));
                            }
                        } else {
                            this.nav_drawer_options.add("Cannot Calibrate right now");
                            this.nav_drawer_intents.add(new Intent(context, Home.class));
                        }
                    } else {
                        this.nav_drawer_options.add(DoubleCalibrationActivity.menu_name);
                        this.nav_drawer_intents.add(new Intent(context, DoubleCalibrationActivity.class));
                    }
                }
            }
            this.nav_drawer_options.add(StopSensor.menu_name);
            this.nav_drawer_intents.add(new Intent(context, StopSensor.class));
        } else {
            this.nav_drawer_options.add(StartNewSensor.menu_name);
            this.nav_drawer_intents.add(new Intent(context, StartNewSensor.class));
        }
    }

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) {
        if(CollectionServiceStarter.isBteWixelorWifiandBtWixel(context) || CollectionServiceStarter.isDexbridgeWixelorWifiandDexbridgeWixel(context)|| CollectionServiceStarter.isBTShare(context) ) {
            this.nav_drawer_options.add(BluetoothScan.menu_name);
            this.nav_drawer_intents.add(new Intent(context, BluetoothScan.class));
        }
    }

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) {
        this.nav_drawer_options.add(SystemStatus.menu_name);
        this.nav_drawer_intents.add(new Intent(context, SystemStatus.class));
    }

    boolean bg_alerts = prefs.getBoolean("bg_alerts_from_main_menu", false);
    if (bg_alerts) {
        this.nav_drawer_options.add(AlertList.menu_name);
        this.nav_drawer_intents.add(new Intent(context, AlertList.class));
    }
    this.nav_drawer_options.add(SnoozeActivity.menu_name);
    this.nav_drawer_intents.add(new Intent(context, SnoozeActivity.class));

    this.nav_drawer_options.add(StatsActivity.MENU_NAME);
    this.nav_drawer_intents.add(new Intent(context, StatsActivity.class));

    this.nav_drawer_options.add(BGHistory.menu_name);
    this.nav_drawer_intents.add(new Intent(context, BGHistory.class));

    this.nav_drawer_options.add("Settings");
    this.nav_drawer_intents.add(new Intent(context, Preferences.class));
}
 
Example #4
Source File: NavDrawerBuilder.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
private List<Intent> nav_drawer_intents() {
        List<Intent> options = new ArrayList<Intent>();
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        boolean IUnderstand = prefs.getBoolean("I_understand", false);
        if(IUnderstand == false) {
            options.add(new Intent(context, SettingsActivity.class));
            return options;
        }

        options.add(new Intent(context, Home.class));
        if(is_active_sensor) {
            options.add(new Intent(context, CalibrationGraph.class));
        }
        options.add(new Intent(context, BgReadingTable.class));
        options.add(new Intent(context, CalibrationDataTable.class));
//        options.add(new Intent(context, SensorDataTable.class));


        if(is_active_sensor) {
            if(!CollectionServiceStarter.isBTShare(context)) {
                if (last_two_bgReadings.size() > 1) {
                    if (last_two_calibrations.size() > 1) {
                        if (bGreadings_in_last_30_mins.size() >= 2) {
                            if (time_now - last_two_calibrations.get(0).timestamp < (1000 * 60 * 60)) { //Put steps in place to discourage over calibration
                                options.add(new Intent(context, CalibrationOverride.class));
                            } else {
                                options.add(new Intent(context, AddCalibration.class));
                            }
                        } else {
                            options.add(new Intent(context, Home.class));
                        }
                        if (last_two_calibrations.get(0).slope >= 1.4 || last_two_calibrations.get(0).slope <= 0.5) {
                            options.add(new Intent(context, DoubleCalibrationActivity.class));
                        }
                    } else {
                        options.add(new Intent(context, DoubleCalibrationActivity.class));
                    }
                }
            }
            options.add(new Intent(context, StopSensor.class));
        } else { options.add(new Intent(context, StartNewSensor.class)); }
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) {
            if(CollectionServiceStarter.isBTWixel(context) || CollectionServiceStarter.isBTShare(context)) {
                options.add(new Intent(context, BluetoothScan.class));
            }
        }
        options.add(new Intent(context, SystemStatus.class));
//        options.add(new Intent(context, SettingsActivity.class));
        options.add(new Intent(context, Preferences.class));
//        options.add(new Intent(context, FakeNumbers.class));
//        options.add(new Intent(context, DoubleCalibrationActivity.class));
//        options.add(new Intent(context, ShareTest.class));
        return options;
    }