Android Open Source - iEtueri Time Picker Dialog Fragment






From Project

Back to project page iEtueri.

License

The source code is released under:

GNU General Public License

If you think the Android project iEtueri 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 utility;
/*from   ww w .  j a v  a  2s  .co  m*/
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.TimePickerDialog;
import android.app.TimePickerDialog.OnTimeSetListener;
import android.os.Bundle;
import android.text.format.DateFormat;
import android.widget.Button;
import android.widget.TimePicker;

/** This class is a view of Timer Picker dialog */
// TODO: Only for Buttons at this moment, in the future, for more View objects
public class TimePickerDialogFragment extends DialogFragment implements OnTimeSetListener {

  /** The handler of the dialog */
  private Button handler;

  @Override
  public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
    if (minute < 9)
      handler.setHint("" + hourOfDay + ":" + "0" + minute);
    else
      handler.setHint("" + hourOfDay + ":" + minute);
  }

  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    String[] sDate = handler.getHint().toString().split(":");
    int hour = Integer.valueOf(sDate[0]);
    int minute = Integer.valueOf(sDate[1]);

    // Check if minute have 1 or 2 digits
    if (minute < 9)
      handler.setHint("" + hour + ":" + "0" + minute);
    else
      handler.setHint("" + hour + ":" + minute);

    return new TimePickerDialog(getActivity(), this, hour, minute, DateFormat.is24HourFormat(getActivity()));
  }

  /** Set the handler */
  public void setHandler(Button handler) {
    this.handler = handler;
  }

}




Java Source Code List

courses.CourseDetailFragment.java
courses.Course.java
courses.CoursesAdapter.java
courses.CoursesFragment.java
courses.NewCourseFragment.java
exams.Exam.java
exams.ExamsAdapter.java
exams.ExamsFragment.java
exams.NewExamFragment.java
homework.HomeworkAdapter.java
homework.HomeworkFragment.java
homework.Homework.java
homework.NewHomeworkFragment.java
navigationdrawer.DrawerListAdapter.java
navigationdrawer.DrawerList.java
navigationdrawer.MainActivity.java
navigationdrawer.NavigationDrawerCallbacks.java
navigationdrawer.NavigationDrawerController.java
navigationdrawer.NavigationDrawerFragment.java
navigationdrawer.OpenBrowser.java
schedule.CalendarManager.java
schedule.Event.java
schedule.EventsManager.java
schedule.FindEvents.java
schedule.RefreshScheduleEventsData.java
schedule.ScheduleFragment.java
schedule.ScheduleTodayAdapter.java
subject.DetailSubjectFragment.java
subject.NewSubjectFragment.java
subject.SubjectFragment.java
subject.SubjectListAdapter.java
subject.Subject.java
today.NewEventRepetitionDialogFragment.java
today.NewEventTodayFragment.java
today.TodayFragment.java
utility.DatabaseContract.java
utility.DatabaseHelper.java
utility.DatePickerDialogFragment.java
utility.OnBackPressed.java
utility.OnClickButtonXml.java
utility.PriorityDialogFragment.java
utility.TimePickerDialogFragment.java