OSDN Git Service

Fix an NPE in Volume dialog when notification volume is tied to ringer volume.
authorAmith Yamasani <yamasani@google.com>
Wed, 3 Feb 2010 17:46:47 +0000 (09:46 -0800)
committerAmith Yamasani <yamasani@google.com>
Wed, 3 Feb 2010 17:47:36 +0000 (09:47 -0800)
src/com/android/settings/RingerVolumePreference.java

index a546818..ddadbb6 100644 (file)
@@ -66,14 +66,7 @@ public class RingerVolumePreference extends VolumePreference implements
     @Override
     protected void onBindDialogView(View view) {
         super.onBindDialogView(view);
-     
-        mNotificationsUseRingVolumeCheckbox =
-                (CheckBox) view.findViewById(R.id.same_notification_volume);
-        mNotificationsUseRingVolumeCheckbox.setOnCheckedChangeListener(this);
-        mNotificationsUseRingVolumeCheckbox.setChecked(Settings.System.getInt(
-                getContext().getContentResolver(),
-                Settings.System.NOTIFICATIONS_USE_RING_VOLUME, 1) == 1);
-      
+
         for (int i = 0; i < SEEKBAR_ID.length; i++) {
             SeekBar seekBar = (SeekBar) view.findViewById(SEEKBAR_ID[i]);
             mSeekBarVolumizer[i] = new SeekBarVolumizer(getContext(), seekBar,
@@ -81,6 +74,12 @@ public class RingerVolumePreference extends VolumePreference implements
         }
 
         mNotificationVolumeTitle = (TextView) view.findViewById(R.id.notification_volume_title);
+        mNotificationsUseRingVolumeCheckbox =
+                (CheckBox) view.findViewById(R.id.same_notification_volume);
+        mNotificationsUseRingVolumeCheckbox.setOnCheckedChangeListener(this);
+        mNotificationsUseRingVolumeCheckbox.setChecked(Settings.System.getInt(
+                getContext().getContentResolver(),
+                Settings.System.NOTIFICATIONS_USE_RING_VOLUME, 1) == 1);
         setNotificationVolumeVisibility(!mNotificationsUseRingVolumeCheckbox.isChecked());
     }