summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/quicksettings/RingerModeTile.java
diff options
context:
space:
mode:
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/quicksettings/RingerModeTile.java')
-rw-r--r--packages/SystemUI/src/com/android/systemui/quicksettings/RingerModeTile.java37
1 files changed, 19 insertions, 18 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/quicksettings/RingerModeTile.java b/packages/SystemUI/src/com/android/systemui/quicksettings/RingerModeTile.java
index 2a6139c..f9d389d 100644
--- a/packages/SystemUI/src/com/android/systemui/quicksettings/RingerModeTile.java
+++ b/packages/SystemUI/src/com/android/systemui/quicksettings/RingerModeTile.java
@@ -1,13 +1,10 @@
package com.android.systemui.quicksettings;
-import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
-import android.content.IntentFilter;
import android.media.AudioManager;
import android.net.Uri;
-import android.os.Handler;
import android.os.Vibrator;
import android.provider.Settings;
import android.text.TextUtils;
@@ -39,27 +36,19 @@ public class RingerModeTile extends QuickSettingsTile {
private int mRingerValuesIndex;
private AudioManager mAudioManager;
- private Handler mHandler;
public RingerModeTile(Context context, LayoutInflater inflater,
QuickSettingsContainerView container, QuickSettingsController qsc) {
super(context, inflater, container, qsc);
mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
- mHandler = new Handler();
-
- // Load the available ringer modes
- updateSettings(mContext.getContentResolver());
-
- // Make sure we show the initial state correctly
- updateState();
// Tile actions
mOnClick = new View.OnClickListener() {
@Override
public void onClick(View v) {
toggleState();
- applyVibrationChanges();
+ updateResources();
}
};
@@ -79,21 +68,33 @@ public class RingerModeTile extends QuickSettingsTile {
@Override
public void onReceive(Context context, Intent intent) {
- applyVibrationChanges();
+ updateResources();
}
@Override
public void onChangeUri(ContentResolver resolver, Uri uri) {
updateSettings(mContext.getContentResolver());
- applyVibrationChanges();
+ updateResources();
+ }
+
+ @Override
+ void onPostCreate() {
+ // Load the available ringer modes
+ updateSettings(mContext.getContentResolver());
+
+ // Make sure we show the initial state correctly
+ updateTile();
+
+ super.onPostCreate();
}
- private void applyVibrationChanges(){
- updateState();
- updateQuickSettings();
+ @Override
+ public void updateResources() {
+ updateTile();
+ super.updateResources();
}
- protected void updateState() {
+ private synchronized void updateTile() {
// The title does not change
mLabel = mContext.getString(R.string.quick_settings_ringer_normal);