Android Open Source - TravelReminder Reminder Edit Arrival Time Picker Fragment






From Project

Back to project page TravelReminder.

License

The source code is released under:

GNU General Public License

If you think the Android project TravelReminder listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ganterd.travelreminder.fragments;
/* w  w w .ja  v a 2s. c o m*/
import android.app.Dialog;
import android.app.TimePickerDialog;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.text.format.DateFormat;
import android.widget.TimePicker;

import com.ganterd.travelreminder.Reminder;
import com.ganterd.travelreminder.RemindersHelper;

public class ReminderEditArrivalTimePickerFragment extends DialogFragment implements TimePickerDialog.OnTimeSetListener {
  public static final String ARG_REMINDER = "ARG_REMINDER";
  
  private Reminder reminder;
  private OnArrivalTimeUpdatedListener listener;
  
  public interface OnArrivalTimeUpdatedListener{
    public void newTimeSelected();
  }
  
  public static ReminderEditArrivalTimePickerFragment newInstance(Reminder reminder){
    ReminderEditArrivalTimePickerFragment f = new ReminderEditArrivalTimePickerFragment();
    
    Bundle args = new Bundle();
    args.putSerializable(ReminderEditArrivalTimePickerFragment.ARG_REMINDER, reminder);
    f.setArguments(args);
    
    return f;
  }
  
  public void setListener(OnArrivalTimeUpdatedListener l){
    this.listener = l;
  }

  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    Bundle args = getArguments();
    reminder = (Reminder)args.getSerializable(ReminderEditArrivalTimePickerFragment.ARG_REMINDER);
    
    int hour = this.reminder.getArrivalTimeHour();
    int minute = this.reminder.getArrivalTimeMinutes();
    
    return new TimePickerDialog(getActivity(), this, hour, minute, DateFormat.is24HourFormat(getActivity()));
  }
  
  public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
    this.reminder.setArrivalTime(hourOfDay, minute);
    RemindersHelper.saveReminder(this.reminder);
    listener.newTimeSelected();
  }
}




Java Source Code List

android.UnusedStub.java
com.ganterd.travelreminder.CreateTravelReminderActivity.java
com.ganterd.travelreminder.Directions.java
com.ganterd.travelreminder.MainActivity.java
com.ganterd.travelreminder.Reminder.java
com.ganterd.travelreminder.RemindersHelper.java
com.ganterd.travelreminder.adapters.MainActivityReminderListAdapter.java
com.ganterd.travelreminder.fragments.ReminderEditArrivalTimePickerFragment.java
com.ganterd.travelreminder.fragments.ReminderEditFragment.java
com.ganterd.travelreminder.fragments.ReminderEditLocationInfo.java
com.ganterd.travelreminder.fragments.ReminderEditTravelInfo.java
com.ganterd.travelreminder.interfaces.IReminder.java