Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
Merge "Migrate Vibrate setting from previous versions if needed"
Browse files Browse the repository at this point in the history
  • Loading branch information
jshuma authored and Android (Google) Code Review committed Mar 25, 2010
2 parents 33f7b38 + 9258283 commit 7a0b928
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/com/android/mms/ui/MessagingPreferenceActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceCategory;
Expand Down Expand Up @@ -64,6 +66,7 @@ public class MessagingPreferenceActivity extends PreferenceActivity {
private Preference mMmsLimitPref;
private Preference mManageSimPref;
private Preference mClearHistoryPref;
private ListPreference mVibrateWhenPref;
private Recycler mSmsRecycler;
private Recycler mMmsRecycler;
private static final int CONFIRM_CLEAR_SEARCH_HISTORY_DIALOG = 3;
Expand All @@ -77,6 +80,7 @@ protected void onCreate(Bundle icicle) {
mSmsLimitPref = findPreference("pref_key_sms_delete_limit");
mMmsLimitPref = findPreference("pref_key_mms_delete_limit");
mClearHistoryPref = findPreference("pref_key_mms_clear_history");
mVibrateWhenPref = (ListPreference) findPreference(NOTIFICATION_VIBRATE_WHEN);

if (!MmsApp.getApplication().getTelephonyManager().hasIccCard()) {
// No SIM card, remove the SIM-related prefs
Expand All @@ -95,6 +99,16 @@ protected void onCreate(Bundle icicle) {
storageOptions.removePreference(findPreference("pref_key_mms_delete_limit"));
}

// If needed, migrate vibration setting from a previous version
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
if (!sharedPreferences.contains(NOTIFICATION_VIBRATE_WHEN) &&
sharedPreferences.contains(NOTIFICATION_VIBRATE)) {
int stringId = sharedPreferences.getBoolean(NOTIFICATION_VIBRATE, false) ?
R.string.prefDefault_vibrate_true :
R.string.prefDefault_vibrate_false;
mVibrateWhenPref.setValue(getString(stringId));
}

mSmsRecycler = Recycler.getSmsRecycler();
mMmsRecycler = Recycler.getMmsRecycler();

Expand Down

0 comments on commit 7a0b928

Please sign in to comment.