Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // On clicking Time picker
- public void setTime(View v){
- Calendar now = Calendar.getInstance();
- TimePickerDialog tpd = TimePickerDialog.newInstance(
- this,
- now.get(Calendar.HOUR_OF_DAY),
- now.get(Calendar.MINUTE),
- false
- );
- tpd.setThemeDark(false);
- tpd.show(getFragmentManager(), "Timepickerdialog");
- }
- // On clicking Date picker
- public void setDate(View v){
- Calendar now = Calendar.getInstance();
- DatePickerDialog dpd = DatePickerDialog.newInstance(
- this,
- now.get(Calendar.YEAR),
- now.get(Calendar.MONTH),
- now.get(Calendar.DAY_OF_MONTH)
- );
- dpd.show(getFragmentManager(), "Datepickerdialog");
- }
- mWaterCalendar = mCalendar;
- mFeedCalendar = mCalendar;
- mHarvestCalendar = mCalendar;
- etc.
- else if (radioWaterWeekly == radioWateringSchedule) {
- // Weekly Watering is selected
- mWaterCalendar.add(Calendar.DAY_OF_YEAR, 7);
- mTitle = "It's time for your weekly watering.";
- mRepeat = "true";
- mRepeatType = "Weekly";
- mRepeatTime = milWeek;
- Toast.makeText(GrowAssistantActivity.this, "Water Weekly Selected", Toast.LENGTH_SHORT).show();
- SetNotificationsButtonWater(v);
- }
- if (radioSoil == radioGrowMediumChoice) {
- // Soil is selected
- mHarvestCalendar.add(Calendar.DAY_OF_YEAR, 70);
- mFlushCalendar = mHarvestCalendar
- SetNotificationsButtonHarvestDay(v);
- mFlushCalendar.add(Calendar.DAY_OF_YEAR, -14);
- Toast.makeText(GrowAssistantActivity.this, "Soil Grow Selected", Toast.LENGTH_SHORT).show();
- SetNotificationsButtonFlush(v);
- }
- // WATERING REMINDERS - On clicking the set notifications button
- public void SetNotificationsButtonWater(View v){
- ReminderDatabase rb = new ReminderDatabase(this);
- mHour = mWaterCalendar.get(Calendar.HOUR_OF_DAY);
- mMinute = mWaterCalendar.get(Calendar.MINUTE);
- mYear = mWaterCalendar.get(Calendar.YEAR);
- mMonth = mWaterCalendar.get(Calendar.MONTH) + 1;
- mDay = mWaterCalendar.get(Calendar.DATE);
- mDate = mDay + "/" + mMonth + "/" + mYear;
- mRepeat = "true";
- // Creating Reminder
- int ID = rb.addReminder(new Reminder(mTitle, mDate, mTime, mRepeat, mRepeatNo, mRepeatType, mActive));
- // Create a new notification
- new AlarmReceiver().setRepeatAlarm(getApplicationContext(), mWaterCalendar, ID, mRepeatTime);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement