// Path: app/src/main/java/me/wavever/ganklock/ui/fragment/SettingFragment.java
// 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();
//                     subscriber.onNext(new Select().from(GankDaily.class).count());
//                 }
//             }).subscribe(new Action1<Integer>() {
//                 @Override public void call(Integer count) {
//                     if (count == 0) {
//                         ToastUtil.showToastShort(getActivity(), "清除缓存成功~");
//                     } else {
//                         ToastUtil.showToastShort(getActivity(), "清除缓存失败~");
//                     }
//                 }
//             });
//         } else if (key.equals(getString(R.string.key_lock_style))) {
//             ToastUtil.showToastShort(getActivity(), "正在开发中哦");
//         }
//         return false;
//     }
// 
// 
//     @Override public void onDestroy() {
//         super.onDestroy();
//     }
// }


import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import me.wavever.ganklock.R;
import me.wavever.ganklock.ui.fragment.SettingFragment;
package me.wavever.ganklock.ui.activity;


/**
 * Created by wavever on 2016/2/23.
 */
public class SettingActivity extends BaseActivity {

    private Toolbar mToolbar;


    @Override protected int loadView() {
        return R.layout.activity_setting;
    }


    @Override protected void initView() {
        mToolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(mToolbar);
        setTitle(R.string.action_setting);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }


    @Override protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
// Path: app/src/main/java/me/wavever/ganklock/ui/fragment/SettingFragment.java
// 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();
//                     subscriber.onNext(new Select().from(GankDaily.class).count());
//                 }
//             }).subscribe(new Action1<Integer>() {
//                 @Override public void call(Integer count) {
//                     if (count == 0) {
//                         ToastUtil.showToastShort(getActivity(), "清除缓存成功~");
//                     } else {
//                         ToastUtil.showToastShort(getActivity(), "清除缓存失败~");
//                     }
//                 }
//             });
//         } else if (key.equals(getString(R.string.key_lock_style))) {
//             ToastUtil.showToastShort(getActivity(), "正在开发中哦");
//         }
//         return false;
//     }
// 
// 
//     @Override public void onDestroy() {
//         super.onDestroy();
//     }
// }


// Path: app/src/main/java/me/wavever/ganklock/ui/activity/SettingActivity.java
import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import me.wavever.ganklock.R;
import me.wavever.ganklock.ui.fragment.SettingFragment;

package me.wavever.ganklock.ui.activity;


/**
 * Created by wavever on 2016/2/23.
 */
public class SettingActivity extends BaseActivity {

    private Toolbar mToolbar;


    @Override protected int loadView() {
        return R.layout.activity_setting;
    }


    @Override protected void initView() {
        mToolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(mToolbar);
        setTitle(R.string.action_setting);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }


    @Override protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        replaceFragment(R.id.setting_container, new SettingFragment());