Loading AndroidManifest.xml +2 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,8 @@ <uses-permission android:name="android.permission.READ_USER_DICTIONARY" /> <uses-permission android:name="android.permission.WRITE_USER_DICTIONARY" /> <application android:label="@string/english_ime_name"> <application android:label="@string/english_ime_name" android:backupAgent="LatinIMEBackupAgent"> <!-- TODO: enable before donut release <supports-density android:density="120" /> <supports-density android:density="160" /> Loading src/com/android/inputmethod/latin/LatinIMEBackupAgent.java 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * Copyright (C) 2009 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.android.inputmethod.latin; import android.backup.BackupHelperAgent; import android.backup.SharedPreferencesBackupHelper; /** * Backs up the Latin IME shared preferences. */ public class LatinIMEBackupAgent extends BackupHelperAgent { public void onCreate() { addHelper("shared_pref", new SharedPreferencesBackupHelper(this, "com.android.inputmethod.latin_preferences")); } } src/com/android/inputmethod/latin/LatinIMESettings.java +19 −2 Original line number Diff line number Diff line Loading @@ -16,13 +16,16 @@ package com.android.inputmethod.latin; import android.backup.BackupManager; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.CheckBoxPreference; import android.preference.PreferenceActivity; import android.preference.PreferenceGroup; import android.text.AutoText; public class LatinIMESettings extends PreferenceActivity { public class LatinIMESettings extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener { private static final String QUICK_FIXES_KEY = "quick_fixes"; private static final String SHOW_SUGGESTIONS_KEY = "show_suggestions"; Loading @@ -37,6 +40,8 @@ public class LatinIMESettings extends PreferenceActivity { addPreferencesFromResource(R.xml.prefs); mQuickFixes = (CheckBoxPreference) findPreference(QUICK_FIXES_KEY); mShowSuggestions = (CheckBoxPreference) findPreference(SHOW_SUGGESTIONS_KEY); getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener( this); } @Override Loading @@ -50,4 +55,16 @@ public class LatinIMESettings extends PreferenceActivity { mShowSuggestions.setDependency(QUICK_FIXES_KEY); } } @Override protected void onDestroy() { getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener( this); super.onDestroy(); } public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { (new BackupManager(this)).dataChanged(); } } Loading
AndroidManifest.xml +2 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,8 @@ <uses-permission android:name="android.permission.READ_USER_DICTIONARY" /> <uses-permission android:name="android.permission.WRITE_USER_DICTIONARY" /> <application android:label="@string/english_ime_name"> <application android:label="@string/english_ime_name" android:backupAgent="LatinIMEBackupAgent"> <!-- TODO: enable before donut release <supports-density android:density="120" /> <supports-density android:density="160" /> Loading
src/com/android/inputmethod/latin/LatinIMEBackupAgent.java 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * Copyright (C) 2009 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.android.inputmethod.latin; import android.backup.BackupHelperAgent; import android.backup.SharedPreferencesBackupHelper; /** * Backs up the Latin IME shared preferences. */ public class LatinIMEBackupAgent extends BackupHelperAgent { public void onCreate() { addHelper("shared_pref", new SharedPreferencesBackupHelper(this, "com.android.inputmethod.latin_preferences")); } }
src/com/android/inputmethod/latin/LatinIMESettings.java +19 −2 Original line number Diff line number Diff line Loading @@ -16,13 +16,16 @@ package com.android.inputmethod.latin; import android.backup.BackupManager; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.CheckBoxPreference; import android.preference.PreferenceActivity; import android.preference.PreferenceGroup; import android.text.AutoText; public class LatinIMESettings extends PreferenceActivity { public class LatinIMESettings extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener { private static final String QUICK_FIXES_KEY = "quick_fixes"; private static final String SHOW_SUGGESTIONS_KEY = "show_suggestions"; Loading @@ -37,6 +40,8 @@ public class LatinIMESettings extends PreferenceActivity { addPreferencesFromResource(R.xml.prefs); mQuickFixes = (CheckBoxPreference) findPreference(QUICK_FIXES_KEY); mShowSuggestions = (CheckBoxPreference) findPreference(SHOW_SUGGESTIONS_KEY); getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener( this); } @Override Loading @@ -50,4 +55,16 @@ public class LatinIMESettings extends PreferenceActivity { mShowSuggestions.setDependency(QUICK_FIXES_KEY); } } @Override protected void onDestroy() { getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener( this); super.onDestroy(); } public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { (new BackupManager(this)).dataChanged(); } }