// Path: smssync/src/main/java/org/addhen/smssync/presentation/view/ui/widget/TimePreferenceFragmentDialog.java
// public class TimePreferenceFragmentDialog extends PreferenceDialogFragmentCompat implements
//         TargetFragment {
// 
//     public static final String DIALOG_FRAGMENT_TAG
//             = "android.support.v7.preference.PreferenceFragment.DIALOG";
// 
//     // Fist picker field
//     private int lastHour = 0;
// 
//     // Second picker field
//     private int lastMinute = 0;
// 
//     private TimePicker picker = null;
// 
//     private PrefsFactory prefs;
// 
//     private ListPreferenceDialogFragmentCompat mListPreferenceDialogFragmentCompat;
// 
//     public TimePreferenceFragmentDialog() {
// 
//     }
// 
//     public static TimePreferenceFragmentDialog newInstance(String key) {
//         TimePreferenceFragmentDialog fragment = new TimePreferenceFragmentDialog();
//         Bundle bundle = new Bundle(1);
//         bundle.putString("key", key);
//         fragment.setArguments(bundle);
//         return fragment;
//     }
// 
//     protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
//         super.onPrepareDialogBuilder(builder);
//         TimePreference preference = this.getTimePreference();
//         builder.setPositiveButton(R.string.ok, (dialog, which) -> {
//             saveSelectedTime(preference);
//             dialog.dismiss();
//         });
//     }
// 
// 
//     @Override
//     protected View onCreateDialogView(Context context) {
//         prefs = App.getAppComponent().prefsFactory();
//         picker = new TimePicker(context);
//         return (picker);
//     }
// 
//     @Override
//     protected void onBindDialogView(View v) {
//         super.onBindDialogView(v);
//         picker.setIs24HourView(true);
//         TimePreference timePreference = this.getTimePreference();
//         picker.setCurrentHour(timePreference.getLastHour());
//         picker.setCurrentMinute(timePreference.getLastMinute());
//     }
// 
//     @Override
//     public void onDialogClosed(boolean positiveResult) {
//         TimePreference timePreference = this.getTimePreference();
//         if (positiveResult) {
//             saveSelectedTime(timePreference);
//         }
//     }
// 
//     private void saveSelectedTime(TimePreference timePreference) {
//         timePreference.setLastHour(picker.getCurrentHour());
//         timePreference.setLastMinute(picker.getCurrentMinute());
//         if (timePreference.callChangeListener(timePreference.getTimeValueAsString())) {
//             timePreference.persistStringValue(timePreference.getTimeValueAsString());
//             timePreference.saveTimeFrequency();
//         }
//     }
// 
//     private TimePreference getTimePreference() {
//         return (TimePreference) this.getPreference();
//     }
// 
//     @Override
//     public Preference findPreference(CharSequence charSequence) {
//         return getTimePreference();
//     }
// }


import org.addhen.smssync.R;
import org.addhen.smssync.presentation.view.ui.widget.TimePreference;
import org.addhen.smssync.presentation.view.ui.widget.TimePreferenceFragmentDialog;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v7.preference.Preference;
import android.support.v7.preference.SwitchPreferenceCompat;
/*
 * Copyright (c) 2010 - 2015 Ushahidi Inc
 * All rights reserved
 * Contact: team@ushahidi.com
 * Website: http://www.ushahidi.com
 * GNU Lesser General Public License Usage
 * This file may be used under the terms of the GNU Lesser
 * General Public License version 3 as published by the Free Software
 * Foundation and appearing in the file LICENSE.LGPL included in the
 * packaging of this file. Please review the following information to
 * ensure the GNU Lesser General Public License version 3 requirements
 * will be met: http://www.gnu.org/licenses/lgpl.html.
 *
 * If you have questions regarding the use of this file, please contact
 * Ushahidi developers at team@ushahidi.com.
 */

package org.addhen.smssync.presentation.view.ui.fragment;



/**
 * @author Ushahidi Team <team@ushahidi.com>
 */
public class TaskSettingsFragment extends BasePreferenceFragmentCompat implements
        SharedPreferences.OnSharedPreferenceChangeListener {

    public static final String TASK_SETTINGS_FRAGMENT = "task_settings_fragment";

    public static final String TASK_CHECK = "task_check_preference";

    public static final String TASK_CHECK_TIMES = "task_check_times";

    public static final String MESSAGE_RESULTS_API = "message_results_api_preference";

    private SwitchPreferenceCompat mTaskCheck;

    private TimePreference mTaskCheckTimes;

    private SwitchPreferenceCompat mEnableMessageResultsAPI;

    public TaskSettingsFragment() {
        // Do nothing
    }

    @Override
    public void onCreatePreferences(Bundle bundle, String key) {
        addPreferencesFromResource(R.xml.task_preferences);
    }

    @Override
    public void onDisplayPreferenceDialog(Preference preference) {
        if (preference instanceof TimePreference) {
// Path: smssync/src/main/java/org/addhen/smssync/presentation/view/ui/widget/TimePreferenceFragmentDialog.java
// public class TimePreferenceFragmentDialog extends PreferenceDialogFragmentCompat implements
//         TargetFragment {
// 
//     public static final String DIALOG_FRAGMENT_TAG
//             = "android.support.v7.preference.PreferenceFragment.DIALOG";
// 
//     // Fist picker field
//     private int lastHour = 0;
// 
//     // Second picker field
//     private int lastMinute = 0;
// 
//     private TimePicker picker = null;
// 
//     private PrefsFactory prefs;
// 
//     private ListPreferenceDialogFragmentCompat mListPreferenceDialogFragmentCompat;
// 
//     public TimePreferenceFragmentDialog() {
// 
//     }
// 
//     public static TimePreferenceFragmentDialog newInstance(String key) {
//         TimePreferenceFragmentDialog fragment = new TimePreferenceFragmentDialog();
//         Bundle bundle = new Bundle(1);
//         bundle.putString("key", key);
//         fragment.setArguments(bundle);
//         return fragment;
//     }
// 
//     protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
//         super.onPrepareDialogBuilder(builder);
//         TimePreference preference = this.getTimePreference();
//         builder.setPositiveButton(R.string.ok, (dialog, which) -> {
//             saveSelectedTime(preference);
//             dialog.dismiss();
//         });
//     }
// 
// 
//     @Override
//     protected View onCreateDialogView(Context context) {
//         prefs = App.getAppComponent().prefsFactory();
//         picker = new TimePicker(context);
//         return (picker);
//     }
// 
//     @Override
//     protected void onBindDialogView(View v) {
//         super.onBindDialogView(v);
//         picker.setIs24HourView(true);
//         TimePreference timePreference = this.getTimePreference();
//         picker.setCurrentHour(timePreference.getLastHour());
//         picker.setCurrentMinute(timePreference.getLastMinute());
//     }
// 
//     @Override
//     public void onDialogClosed(boolean positiveResult) {
//         TimePreference timePreference = this.getTimePreference();
//         if (positiveResult) {
//             saveSelectedTime(timePreference);
//         }
//     }
// 
//     private void saveSelectedTime(TimePreference timePreference) {
//         timePreference.setLastHour(picker.getCurrentHour());
//         timePreference.setLastMinute(picker.getCurrentMinute());
//         if (timePreference.callChangeListener(timePreference.getTimeValueAsString())) {
//             timePreference.persistStringValue(timePreference.getTimeValueAsString());
//             timePreference.saveTimeFrequency();
//         }
//     }
// 
//     private TimePreference getTimePreference() {
//         return (TimePreference) this.getPreference();
//     }
// 
//     @Override
//     public Preference findPreference(CharSequence charSequence) {
//         return getTimePreference();
//     }
// }


// Path: smssync/src/main/java/org/addhen/smssync/presentation/view/ui/fragment/TaskSettingsFragment.java
import org.addhen.smssync.R;
import org.addhen.smssync.presentation.view.ui.widget.TimePreference;
import org.addhen.smssync.presentation.view.ui.widget.TimePreferenceFragmentDialog;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v7.preference.Preference;
import android.support.v7.preference.SwitchPreferenceCompat;

/*
 * Copyright (c) 2010 - 2015 Ushahidi Inc
 * All rights reserved
 * Contact: team@ushahidi.com
 * Website: http://www.ushahidi.com
 * GNU Lesser General Public License Usage
 * This file may be used under the terms of the GNU Lesser
 * General Public License version 3 as published by the Free Software
 * Foundation and appearing in the file LICENSE.LGPL included in the
 * packaging of this file. Please review the following information to
 * ensure the GNU Lesser General Public License version 3 requirements
 * will be met: http://www.gnu.org/licenses/lgpl.html.
 *
 * If you have questions regarding the use of this file, please contact
 * Ushahidi developers at team@ushahidi.com.
 */

package org.addhen.smssync.presentation.view.ui.fragment;



/**
 * @author Ushahidi Team <team@ushahidi.com>
 */
public class TaskSettingsFragment extends BasePreferenceFragmentCompat implements
        SharedPreferences.OnSharedPreferenceChangeListener {

    public static final String TASK_SETTINGS_FRAGMENT = "task_settings_fragment";

    public static final String TASK_CHECK = "task_check_preference";

    public static final String TASK_CHECK_TIMES = "task_check_times";

    public static final String MESSAGE_RESULTS_API = "message_results_api_preference";

    private SwitchPreferenceCompat mTaskCheck;

    private TimePreference mTaskCheckTimes;

    private SwitchPreferenceCompat mEnableMessageResultsAPI;

    public TaskSettingsFragment() {
        // Do nothing
    }

    @Override
    public void onCreatePreferences(Bundle bundle, String key) {
        addPreferencesFromResource(R.xml.task_preferences);
    }

    @Override
    public void onDisplayPreferenceDialog(Preference preference) {
        if (preference instanceof TimePreference) {
            DialogFragment dialogFragment = TimePreferenceFragmentDialog.newInstance(