// Path: app/src/main/java/me/wavever/ganklock/model/bean/GankDaily.java
// @Table(name = "GankDaily")
// public class GankDaily extends Model {
//     @SerializedName(value = "_id")
//     @Column(name = "_id")
//     public String _id;
//     @SerializedName(value = "publishedAt")
//     @Column(name = "publishedAt")
//     public String publishedAt;
//     @SerializedName(value = "title")
//     @Column(name = "title")
//     public String title;
//     @SerializedName(value = "content")
//     @Column(name = "content")
//     public String content;//妹纸图的url
// }
// 
// Path: app/src/main/java/me/wavever/ganklock/utils/ToastUtil.java
// public class ToastUtil {
// 
//     private static Toast sToast;
// 
//     public static void showToastShort(Context context, String content) {
//         if (sToast == null) {
//             sToast = Toast.makeText(context, content, Toast.LENGTH_SHORT);
//         } else {
//             sToast.setText(content);
//         }
//         sToast.show();
//     }
// 
//     public static void showToastLong(Context context, String content) {
//         if (sToast == null) {
//             sToast = Toast.makeText(context, content, Toast.LENGTH_LONG);
//         } else {
//             sToast.setText(content);
//         }
//         sToast.show();
//     }
// 
//     public static void showToastShort(Context context, int resId) {
//         showToastShort(context, context.getResources().getString(resId));
//     }
// 
//     public static void showToastLong(Context context, int resId) {
//         showToastLong(context, context.getResources().getString(resId));
//     }
// }


import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import com.activeandroid.query.Delete;
import com.activeandroid.query.Select;
import me.wavever.ganklock.R;
import me.wavever.ganklock.model.bean.GankDaily;
import me.wavever.ganklock.utils.ToastUtil;
import rx.Observable;
import rx.Subscriber;
import rx.Subscription;
import rx.functions.Action1;
package me.wavever.ganklock.ui.fragment;


/**
 * Created by wavever on 2016/2/23.
 */
public class SettingFragment extends PreferenceFragment
    implements Preference.OnPreferenceChangeListener,
    Preference.OnPreferenceClickListener {

    private Subscription subscription;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.preferences);
        findPreference(getString(R.string.key_lock_style)).setOnPreferenceClickListener(this);
        findPreference(getString(R.string.key_shake_feed_back)).setOnPreferenceChangeListener(this);
        findPreference("key_clear_cache").setOnPreferenceClickListener(this);
    }


    @Override
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        String key = preference.getKey();
        if (key.equals(getString(R.string.key_shake_feed_back))) {
            if ((Boolean) newValue) {
            } else {
            }
        }
        return true;
    }

    @Override
    public boolean onPreferenceClick(Preference preference) {
        String key = preference.getKey();
        if (key.equals(getString(R.string.key_clear_cache))) {
            Observable.create(new Observable.OnSubscribe<Integer>() {
                @Override public void call(Subscriber<? super Integer> subscriber) {
// Path: app/src/main/java/me/wavever/ganklock/model/bean/GankDaily.java
// @Table(name = "GankDaily")
// public class GankDaily extends Model {
//     @SerializedName(value = "_id")
//     @Column(name = "_id")
//     public String _id;
//     @SerializedName(value = "publishedAt")
//     @Column(name = "publishedAt")
//     public String publishedAt;
//     @SerializedName(value = "title")
//     @Column(name = "title")
//     public String title;
//     @SerializedName(value = "content")
//     @Column(name = "content")
//     public String content;//妹纸图的url
// }
// 
// Path: app/src/main/java/me/wavever/ganklock/utils/ToastUtil.java
// public class ToastUtil {
// 
//     private static Toast sToast;
// 
//     public static void showToastShort(Context context, String content) {
//         if (sToast == null) {
//             sToast = Toast.makeText(context, content, Toast.LENGTH_SHORT);
//         } else {
//             sToast.setText(content);
//         }
//         sToast.show();
//     }
// 
//     public static void showToastLong(Context context, String content) {
//         if (sToast == null) {
//             sToast = Toast.makeText(context, content, Toast.LENGTH_LONG);
//         } else {
//             sToast.setText(content);
//         }
//         sToast.show();
//     }
// 
//     public static void showToastShort(Context context, int resId) {
//         showToastShort(context, context.getResources().getString(resId));
//     }
// 
//     public static void showToastLong(Context context, int resId) {
//         showToastLong(context, context.getResources().getString(resId));
//     }
// }


// Path: app/src/main/java/me/wavever/ganklock/ui/fragment/SettingFragment.java
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import com.activeandroid.query.Delete;
import com.activeandroid.query.Select;
import me.wavever.ganklock.R;
import me.wavever.ganklock.model.bean.GankDaily;
import me.wavever.ganklock.utils.ToastUtil;
import rx.Observable;
import rx.Subscriber;
import rx.Subscription;
import rx.functions.Action1;

package me.wavever.ganklock.ui.fragment;


/**
 * Created by wavever on 2016/2/23.
 */
public class SettingFragment extends PreferenceFragment
    implements Preference.OnPreferenceChangeListener,
    Preference.OnPreferenceClickListener {

    private Subscription subscription;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.preferences);
        findPreference(getString(R.string.key_lock_style)).setOnPreferenceClickListener(this);
        findPreference(getString(R.string.key_shake_feed_back)).setOnPreferenceChangeListener(this);
        findPreference("key_clear_cache").setOnPreferenceClickListener(this);
    }


    @Override
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        String key = preference.getKey();
        if (key.equals(getString(R.string.key_shake_feed_back))) {
            if ((Boolean) newValue) {
            } else {
            }
        }
        return true;
    }

    @Override
    public boolean onPreferenceClick(Preference preference) {
        String key = preference.getKey();
        if (key.equals(getString(R.string.key_clear_cache))) {
            Observable.create(new Observable.OnSubscribe<Integer>() {
                @Override public void call(Subscriber<? super Integer> subscriber) {
                    new Delete().from(GankDaily.class).execute();