Java Code Examples for com.eveningoutpost.dexdrip.Models.AlertType#time2Minutes()

The following examples show how to use com.eveningoutpost.dexdrip.Models.AlertType#time2Minutes() . 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: MissedReadingActivity.java    From xDrip-Experimental with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_missed_readings);
    mContext = this;
    
    viewTimeStart = (TextView) findViewById(R.id.missed_reading_time_start);
    viewTimeEnd = (TextView) findViewById(R.id.missed_reading_time_end);
    checkboxAllDay = (CheckBox) findViewById(R.id.missed_reading_all_day);
    checkboxEnableAlert = (CheckBox) findViewById(R.id.missed_reading_enable_alert);
    
    layoutTimeBetween = (LinearLayout) findViewById(R.id.missed_reading_time_between);
    timeInstructions = (LinearLayout) findViewById(R.id.missed_reading_instructions);
    timeInstructionsStart = (TextView) findViewById(R.id.missed_reading_instructions_start);
    timeInstructionsEnd = (TextView) findViewById(R.id.missed_reading_instructions_end);
    bgMissedMinutes = (EditText) findViewById(R.id.missed_reading_bg_minutes);
    viewAlertTime = (TextView) findViewById(R.id.missed_reading_text_alert_time);
    vieSelectTime = (TextView) findViewById(R.id.missed_reading_text_select_time);
    
    // Set the different controls
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    int startMinutes = prefs.getInt("missed_readings_start", 0);
    int endMinutes = prefs.getInt("missed_readings_end", 0);
    boolean enableAlert = prefs.getBoolean("bg_missed_alerts",false);
    boolean allDay = prefs.getBoolean("missed_readings_all_day",true);
    
    checkboxEnableAlert.setChecked(enableAlert);
    checkboxAllDay.setChecked(allDay);
    
    startHour = AlertType.time2Hours(startMinutes);
    startMinute = AlertType.time2Minutes(startMinutes);
    endHour = AlertType.time2Hours(endMinutes);
    endMinute = AlertType.time2Minutes(endMinutes);
    bgMissedMinutes.setText(prefs.getString("bg_missed_minutes", "30"));
    
    addListenerOnButtons();
    enableAllControls();
}
 
Example 2
Source File: MissedReadingActivity.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_missed_readings);
    mContext = this;
    
    viewTimeStart = (TextView) findViewById(R.id.missed_reading_time_start);
    viewTimeEnd = (TextView) findViewById(R.id.missed_reading_time_end);
    checkboxAllDay = (CheckBox) findViewById(R.id.missed_reading_all_day);
    checkboxEnableAlert = (CheckBox) findViewById(R.id.missed_reading_enable_alert);
    checkboxEnableReraise = (CheckBox) findViewById(R.id.missed_reading_enable_alerts_reraise);
    
    layoutTimeBetween = (LinearLayout) findViewById(R.id.missed_reading_time_between);
    timeInstructions = (LinearLayout) findViewById(R.id.missed_reading_instructions);
    timeInstructionsStart = (TextView) findViewById(R.id.missed_reading_instructions_start);
    timeInstructionsEnd = (TextView) findViewById(R.id.missed_reading_instructions_end);
    bgMissedMinutes = (EditText) findViewById(R.id.missed_reading_bg_minutes);
    bgMissedSnoozeMin = (EditText) findViewById(R.id.missed_reading_bg_snooze);
    bgMissedReraiseSec = (EditText) findViewById(R.id.missed_reading_reraise_sec);
    viewAlertTime = (TextView) findViewById(R.id.missed_reading_text_alert_time);
    viewSelectTime = (TextView) findViewById(R.id.missed_reading_text_select_time);
    viewSnoozeTime = (TextView) findViewById(R.id.missed_reading_bg_snooze_text);
    viewReraiseTime = (TextView) findViewById(R.id.missed_reading_reraise_sec_text);

    
    // Set the different controls
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    int startMinutes = prefs.getInt("missed_readings_start", 0);
    int endMinutes = prefs.getInt("missed_readings_end", 0);
    boolean enableAlert = prefs.getBoolean("bg_missed_alerts",false);
    boolean allDay = prefs.getBoolean("missed_readings_all_day",true);
    boolean enableReraise = prefs.getBoolean("bg_missed_alerts_enable_alerts_reraise",false);
    
    checkboxAllDay.setChecked(allDay);
    checkboxEnableAlert.setChecked(enableAlert);
    checkboxEnableReraise.setChecked(enableReraise);
    
    startHour = AlertType.time2Hours(startMinutes);
    startMinute = AlertType.time2Minutes(startMinutes);
    endHour = AlertType.time2Hours(endMinutes);
    endMinute = AlertType.time2Minutes(endMinutes);
    bgMissedMinutes.setText(prefs.getString("bg_missed_minutes", "30"));
    bgMissedSnoozeMin.setText("" + MissedReadingService.getOtherAlertSnoozeMinutes(prefs, "bg_missed_alerts"));
    bgMissedReraiseSec.setText(prefs.getString("bg_missed_alerts_reraise_sec", "60"));
    
    addListenerOnButtons();
    enableAllControls();
}
 
Example 3
Source File: MissedReadingActivity.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_missed_readings);
    mContext = this;
    
    viewTimeStart = (TextView) findViewById(R.id.missed_reading_time_start);
    viewTimeEnd = (TextView) findViewById(R.id.missed_reading_time_end);
    checkboxAllDay = (CheckBox) findViewById(R.id.missed_reading_all_day);
    checkboxEnableAlert = (CheckBox) findViewById(R.id.missed_reading_enable_alert);
    checkboxEnableReraise = (CheckBox) findViewById(R.id.missed_reading_enable_alerts_reraise);
    
    layoutTimeBetween = (LinearLayout) findViewById(R.id.missed_reading_time_between);
    timeInstructions = (LinearLayout) findViewById(R.id.missed_reading_instructions);
    timeInstructionsStart = (TextView) findViewById(R.id.missed_reading_instructions_start);
    timeInstructionsEnd = (TextView) findViewById(R.id.missed_reading_instructions_end);
    bgMissedMinutes = (EditText) findViewById(R.id.missed_reading_bg_minutes);
    bgMissedSnoozeMin = (EditText) findViewById(R.id.missed_reading_bg_snooze);
    bgMissedReraiseSec = (EditText) findViewById(R.id.missed_reading_reraise_sec);
    viewAlertTime = (TextView) findViewById(R.id.missed_reading_text_alert_time);
    viewSelectTime = (TextView) findViewById(R.id.missed_reading_text_select_time);
    viewSnoozeTime = (TextView) findViewById(R.id.missed_reading_bg_snooze_text);
    viewReraiseTime = (TextView) findViewById(R.id.missed_reading_reraise_sec_text);

    
    // Set the different controls
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    int startMinutes = prefs.getInt("missed_readings_start", 0);
    int endMinutes = prefs.getInt("missed_readings_end", 0);
    boolean enableAlert = prefs.getBoolean("bg_missed_alerts",false);
    boolean allDay = prefs.getBoolean("missed_readings_all_day",true);
    boolean enableReraise = prefs.getBoolean("bg_missed_alerts_enable_alerts_reraise",false);
    
    checkboxAllDay.setChecked(allDay);
    checkboxEnableAlert.setChecked(enableAlert);
    checkboxEnableReraise.setChecked(enableReraise);
    
    startHour = AlertType.time2Hours(startMinutes);
    startMinute = AlertType.time2Minutes(startMinutes);
    endHour = AlertType.time2Hours(endMinutes);
    endMinute = AlertType.time2Minutes(endMinutes);
    bgMissedMinutes.setText(prefs.getString("bg_missed_minutes", "30"));
    bgMissedSnoozeMin.setText("" + MissedReadingService.getOtherAlertSnoozeMinutes(prefs, "bg_missed_alerts"));
    bgMissedReraiseSec.setText(prefs.getString("bg_missed_alerts_reraise_sec", "60"));
    
    addListenerOnButtons();
    enableAllControls();
}