@@ -0,0 +1,2264 @@
+package com.andela.iworkout.preferences;%0A%0Aimport android.content.Context;%0Aimport android.content.res.TypedArray;%0Aimport android.preference.DialogPreference;%0Aimport android.util.AttributeSet;%0Aimport android.view.View;%0Aimport android.widget.TimePicker;%0A%0Apublic class TimePreference extends DialogPreference %7B%0A    private int lastHour = 0;%0A    private int lastMinute = 0;%0A    private TimePicker picker = null;%0A%0A    public static int getHour(String time) %7B%0A        String%5B%5D pieces = time.split(%22:%22);%0A%0A        return (Integer.parseInt(pieces%5B0%5D));%0A    %7D%0A%0A    public static int getMinute(String time) %7B%0A        String%5B%5D pieces = time.split(%22:%22);%0A%0A        return (Integer.parseInt(pieces%5B1%5D));%0A    %7D%0A%0A    public TimePreference(Context ctxt, AttributeSet attrs) %7B%0A        super(ctxt, attrs);%0A%0A        setPositiveButtonText(%22Set%22);%0A        setNegativeButtonText(%22Cancel%22);%0A    %7D%0A%0A    @Override%0A    protected View onCreateDialogView() %7B%0A        picker = new TimePicker(getContext());%0A%0A        return (picker);%0A    %7D%0A%0A    @Override%0A    protected void onBindDialogView(View v) %7B%0A        super.onBindDialogView(v);%0A%0A        picker.setCurrentHour(lastHour);%0A        picker.setCurrentMinute(lastMinute);%0A    %7D%0A%0A    @Override%0A    protected void onDialogClosed(boolean positiveResult) %7B%0A        super.onDialogClosed(positiveResult);%0A%0A        if (positiveResult) %7B%0A            lastHour = picker.getCurrentHour();%0A            lastMinute = picker.getCurrentMinute();%0A%0A            String time = String.valueOf(lastHour) + %22:%22 + String.valueOf(lastMinute);%0A%0A            if (callChangeListener(time)) %7B%0A                persistString(time);%0A            %7D%0A        %7D%0A    %7D%0A%0A    @Override%0A    protected Object onGetDefaultValue(TypedArray a, int index) %7B%0A        return (a.getString(index));%0A    %7D%0A%0A    @Override%0A    protected void onSetInitialValue(boolean restoreValue, Object defaultValue) %7B%0A        String time;%0A%0A        if (restoreValue) %7B%0A            if (defaultValue == null) %7B%0A                time = getPersistedString(%2200:00%22);%0A            %7D else %7B%0A                time = getPersistedString(defaultValue.toString());%0A            %7D%0A        %7D else %7B%0A            time = defaultValue.toString();%0A        %7D%0A%0A        lastHour = getHour(time);%0A        lastMinute = getMinute(time);%0A    %7D%0A%7D

Add TimePreference class to preference package