private void initSetting() {
   settings = PreferenceManager.getDefaultSharedPreferences(this);
   settings.registerOnSharedPreferenceChangeListener(this);
   manualSync = settings.getBoolean(PK.MANUAL_SYNC, false);
   themeType = StringUtils.parseInt(settings.getString(PK.THEME_KEY, ""), Themes.THEME_LIGHT);
   themeTmp = themeType;
 }
 @Override
 public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
   if (TextUtils.equals(key, PK.MANUAL_SYNC)) {
     manualSync = sharedPreferences.getBoolean(PK.MANUAL_SYNC, true);
   } else if (TextUtils.equals(key, PK.THEME_KEY)) {
     themeType =
         StringUtils.parseInt(sharedPreferences.getString(PK.THEME_KEY, ""), Themes.THEME_LIGHT);
   }
 }
 public boolean doDiff(Note noteRemote, Note noteLocal) {
   if (noteLocal.status != Status.SYNC_UPDATE) {
     noteRemote.content_old = noteRemote.content;
     return false;
   }
   if (TextUtils.equals(noteRemote.content, noteLocal.content)) {
     return false;
   }
   Diff_match_patch diff = new Diff_match_patch();
   String old =
       StringUtils.isEmpty(noteLocal.content_old) ? noteLocal.content : noteLocal.content_old;
   LinkedList<Patch> patch = diff.patch_make(old, noteRemote.content);
   Object[] res = diff.patch_apply(patch, noteLocal.content);
   String result = String.valueOf(res[0]);
   noteRemote.content = result;
   noteRemote.content_old = result;
   return true;
 }