Example usage for android.widget TimePicker getContext

List of usage examples for android.widget TimePicker getContext

Introduction

In this page you can find the example usage for android.widget TimePicker getContext.

Prototype

@ViewDebug.CapturedViewProperty
public final Context getContext() 

Source Link

Document

Returns the context the view is running in, through which it can access the current theme, resources, etc.

Usage

From source file:org.videolan.vlc.gui.TimePickerDialogFragment.java

@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
    if (!setTime) { //workaround for weird ICS&JB bug
        setTime = true;//  w  w  w  .  j  a  v  a2  s.  com
        return;
    }
    Calendar currentTime = Calendar.getInstance();
    Calendar sleepTime = Calendar.getInstance();
    sleepTime.set(Calendar.HOUR_OF_DAY, hourOfDay);
    sleepTime.set(Calendar.MINUTE, minute);
    sleepTime.set(Calendar.SECOND, 0);
    switch (action) {
    case ACTION_SLEEP:
        if (sleepTime.before(currentTime))
            sleepTime.roll(Calendar.DATE, true);

        AdvOptionsDialog.setSleep(view.getContext(), sleepTime);
        break;
    case ACTION_JUMP:
        long time = (long) ((hourOfDay * 60 + minute) * 60000);
        LibVLC.getExistingInstance().setTime(time);
        break;
    }
}