Loading core/java/android/view/VolumePanel.java +89 −92 Original line number Diff line number Diff line Loading @@ -27,8 +27,6 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.media.AudioManager; import android.media.AudioService; import android.media.AudioSystem; Loading Loading @@ -58,10 +56,8 @@ import java.util.HashMap; * * @hide */ public class VolumePanel extends Handler implements OnSeekBarChangeListener, View.OnClickListener, VolumeController { private static final String TAG = "VolumePanel"; public class VolumePanel extends Handler implements VolumeController { private static final String TAG = VolumePanel.class.getSimpleName(); private static boolean LOGD = false; /** Loading Loading @@ -189,7 +185,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie this.iconMuteRes = iconMuteRes; this.show = show; } }; } // List of stream types and their order private static final StreamResources[] STREAMS = { Loading Loading @@ -256,14 +252,14 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie } public VolumePanel(final Context context, AudioService volumeService) { public VolumePanel(Context context, AudioService volumeService) { mContext = context; mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); mAudioService = volumeService; // For now, only show master volume if master volume is supported final boolean useMasterVolume = context.getResources().getBoolean( R.bool.config_useMasterVolume); final Resources res = context.getResources(); final boolean useMasterVolume = res.getBoolean(R.bool.config_useMasterVolume); if (useMasterVolume) { for (int i = 0; i < STREAMS.length; i++) { StreamResources streamRes = STREAMS[i]; Loading @@ -271,29 +267,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie } } final TypedArray a = context.obtainStyledAttributes(null, com.android.internal.R.styleable.AlertDialog, com.android.internal.R.attr.alertDialogStyle, 0); final Drawable background = a.getDrawable(R.styleable.AlertDialog_fullBright); a.recycle(); final LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE); mView = inflater.inflate(R.layout.volume_adjust, null); mView.setBackground(background); mView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { resetTimeout(); return false; } }); mPanel = (ViewGroup) mView.findViewById(R.id.visible_panel); mSliderGroup = (ViewGroup) mView.findViewById(R.id.slider_group); mMoreButton = mView.findViewById(R.id.expand_button); mDivider = mView.findViewById(R.id.expand_button_divider); mDialog = new Dialog(context, R.style.Theme_Panel_Volume) { mDialog = new Dialog(context) { @Override public boolean onTouchEvent(MotionEvent event) { if (isShowing() && event.getAction() == MotionEvent.ACTION_OUTSIDE && Loading @@ -305,8 +279,24 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie } }; mDialog.setTitle("Volume control"); // No need to localize mDialog.setContentView(mView); // Change some window properties final Window window = mDialog.getWindow(); final LayoutParams lp = window.getAttributes(); lp.token = null; // Offset from the top lp.y = res.getDimensionPixelOffset(R.dimen.volume_panel_top); lp.type = LayoutParams.TYPE_VOLUME_OVERLAY; lp.windowAnimations = R.style.Animation_VolumePanel; window.setAttributes(lp); window.setGravity(Gravity.TOP); window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); window.requestFeature(Window.FEATURE_NO_TITLE); window.addFlags(LayoutParams.FLAG_NOT_FOCUSABLE | LayoutParams.FLAG_NOT_TOUCH_MODAL | LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH); mDialog.setCanceledOnTouchOutside(true); mDialog.setContentView(R.layout.volume_adjust); mDialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { Loading @@ -315,40 +305,38 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie } }); // Change some window properties final Window window = mDialog.getWindow(); window.setGravity(Gravity.TOP); mDialog.create(); final LayoutParams lp = window.getAttributes(); lp.token = null; // Offset from the top lp.y = mContext.getResources().getDimensionPixelOffset(R.dimen.volume_panel_top); lp.type = LayoutParams.TYPE_VOLUME_OVERLAY; lp.width = LayoutParams.WRAP_CONTENT; lp.height = LayoutParams.WRAP_CONTENT; window.setAttributes(lp); window.addFlags(LayoutParams.FLAG_NOT_FOCUSABLE | LayoutParams.FLAG_NOT_TOUCH_MODAL | LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH); mView = window.findViewById(R.id.content); mView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { resetTimeout(); return false; } }); mPanel = (ViewGroup) mView.findViewById(R.id.visible_panel); mSliderGroup = (ViewGroup) mView.findViewById(R.id.slider_group); mMoreButton = mView.findViewById(R.id.expand_button); mDivider = mView.findViewById(R.id.expand_button_divider); mToneGenerators = new ToneGenerator[AudioSystem.getNumStreamTypes()]; mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); mVoiceCapable = context.getResources().getBoolean(R.bool.config_voice_capable); mShowCombinedVolumes = !mVoiceCapable && !useMasterVolume; // If we don't want to show multiple volumes, hide the settings button and divider // If we don't want to show multiple volumes, hide the settings button // and divider. mShowCombinedVolumes = !mVoiceCapable && !useMasterVolume; if (!mShowCombinedVolumes) { mMoreButton.setVisibility(View.GONE); mDivider.setVisibility(View.GONE); } else { mMoreButton.setOnClickListener(this); mMoreButton.setOnClickListener(mClickListener); } final boolean masterVolumeOnly = context.getResources().getBoolean( R.bool.config_useMasterVolume); final boolean masterVolumeKeySounds = mContext.getResources().getBoolean( R.bool.config_useVolumeKeySounds); final boolean masterVolumeOnly = res.getBoolean(R.bool.config_useMasterVolume); final boolean masterVolumeKeySounds = res.getBoolean(R.bool.config_useVolumeKeySounds); mPlayMasterStreamTones = masterVolumeOnly && masterVolumeKeySounds; listenToRingerMode(); Loading Loading @@ -444,7 +432,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie final int plusOne = (streamType == AudioSystem.STREAM_BLUETOOTH_SCO || streamType == AudioSystem.STREAM_VOICE_CALL) ? 1 : 0; sc.seekbarView.setMax(getStreamMaxVolume(streamType) + plusOne); sc.seekbarView.setOnSeekBarChangeListener(this); sc.seekbarView.setOnSeekBarChangeListener(mSeekListener); sc.seekbarView.setTag(sc); mStreamControls.put(streamType, sc); } Loading Loading @@ -506,10 +494,6 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie } } private boolean isExpanded() { return mMoreButton.getVisibility() != View.VISIBLE; } private void expand() { final int count = mSliderGroup.getChildCount(); for (int i = 0; i < count; i++) { Loading Loading @@ -547,6 +531,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie obtainMessage(MSG_VOLUME_CHANGED, streamType, flags).sendToTarget(); } @Override public void postRemoteVolumeChanged(int streamType, int flags) { if (hasMessages(MSG_REMOTE_VOLUME_CHANGED)) return; synchronized (this) { Loading @@ -558,6 +543,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie obtainMessage(MSG_REMOTE_VOLUME_CHANGED, streamType, flags).sendToTarget(); } @Override public void postRemoteSliderVisibility(boolean visible) { obtainMessage(MSG_SLIDER_VISIBILITY_CHANGED, AudioService.STREAM_REMOTE_MUSIC, visible ? 1 : 0).sendToTarget(); Loading @@ -574,6 +560,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie * as a request to update the volume), the application will likely set a new volume. If the UI * is still up, we need to refresh the display to show this new value. */ @Override public void postHasNewRemotePlaybackInfo() { if (hasMessages(MSG_REMOTE_VOLUME_UPDATE_IF_SHOWN)) return; // don't create or prevent resources to be freed, if they disappear, this update came too Loading Loading @@ -753,7 +740,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie int stream = (streamType == AudioService.STREAM_REMOTE_MUSIC) ? -1 : streamType; // when the stream is for remote playback, use -1 to reset the stream type evaluation mAudioManager.forceVolumeControlStream(stream); mDialog.setContentView(mView); // Showing dialog - use collapsed state if (mShowCombinedVolumes) { collapse(); Loading Loading @@ -885,6 +872,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie .setMessage(com.android.internal.R.string.safe_media_volume_warning) .setPositiveButton(com.android.internal.R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mAudioService.disableSafeMediaVolume(); } Loading Loading @@ -1041,8 +1029,9 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie sendMessage(obtainMessage(MSG_TIMEOUT)); } public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { private final OnSeekBarChangeListener mSeekListener = new OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { final Object tag = seekBar.getTag(); if (fromUser && tag instanceof StreamControl) { StreamControl sc = (StreamControl) tag; Loading @@ -1053,27 +1042,35 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie resetTimeout(); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { final Object tag = seekBar.getTag(); if (tag instanceof StreamControl) { StreamControl sc = (StreamControl) tag; // because remote volume updates are asynchronous, AudioService might have received // a new remote volume value since the finger adjusted the slider. So when the // progress of the slider isn't being tracked anymore, adjust the slider to the last // "published" remote volume value, so the UI reflects the actual volume. // Because remote volume updates are asynchronous, AudioService // might have received a new remote volume value since the // finger adjusted the slider. So when the progress of the // slider isn't being tracked anymore, adjust the slider to the // last "published" remote volume value, so the UI reflects the // actual volume. if (sc.streamType == AudioService.STREAM_REMOTE_MUSIC) { seekBar.setProgress(getStreamVolume(AudioService.STREAM_REMOTE_MUSIC)); } } } }; private final View.OnClickListener mClickListener = new View.OnClickListener() { @Override public void onClick(View v) { if (v == mMoreButton) { expand(); } resetTimeout(); } }; } core/res/res/layout/volume_adjust.xml +29 −33 Original line number Diff line number Diff line Loading @@ -14,14 +14,11 @@ limitations under the License. --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="448dp" android:layout_height="wrap_content"> <LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/visible_panel" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> android:orientation="horizontal" android:layout_width="300dp" android:layout_height="wrap_content"> <LinearLayout android:id="@+id/slider_group" Loading Loading @@ -52,4 +49,3 @@ android:src="@drawable/ic_sysbar_quicksettings" /> </LinearLayout> </FrameLayout> No newline at end of file core/res/res/layout/volume_adjust_item.xml +2 −1 Original line number Diff line number Diff line Loading @@ -33,8 +33,9 @@ <SeekBar style="?android:attr/seekBarStyle" android:id="@+id/seekbar" android:layout_width="252dp" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:padding="16dip" android:layout_marginEnd="16dip" /> Loading core/res/res/values/symbols.xml +1 −1 Original line number Diff line number Diff line Loading @@ -1254,7 +1254,6 @@ <java-symbol type="style" name="TextAppearance.SlidingTabNormal" /> <java-symbol type="style" name="Theme.DeviceDefault.Dialog.NoFrame" /> <java-symbol type="style" name="Theme.IconMenu" /> <java-symbol type="style" name="Theme.Panel.Volume" /> <java-symbol type="attr" name="mediaRouteButtonStyle" /> <java-symbol type="attr" name="externalRouteEnabledDrawable" /> Loading Loading @@ -1836,5 +1835,6 @@ <java-symbol type="attr" name="subtitleTextAppearance" /> <java-symbol type="drawable" name="ic_lock_bugreport" /> <java-symbol type="id" name="icon_frame" /> <java-symbol type="style" name="Animation.VolumePanel" /> </resources> core/res/res/values/themes.xml +0 −5 Original line number Diff line number Diff line Loading @@ -892,11 +892,6 @@ please see themes_device_defaults.xml. <item name="android:windowCloseOnTouchOutside">false</item> </style> <style name="Theme.Panel.Volume"> <item name="android:windowAnimationStyle">@android:style/Animation.VolumePanel</item> <item name="android:windowCloseOnTouchOutside">true</item> </style> <!-- Default theme with an Action Bar. --> <style name="Theme.WithActionBar"> <item name="android:windowActionBar">true</item> Loading Loading
core/java/android/view/VolumePanel.java +89 −92 Original line number Diff line number Diff line Loading @@ -27,8 +27,6 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.media.AudioManager; import android.media.AudioService; import android.media.AudioSystem; Loading Loading @@ -58,10 +56,8 @@ import java.util.HashMap; * * @hide */ public class VolumePanel extends Handler implements OnSeekBarChangeListener, View.OnClickListener, VolumeController { private static final String TAG = "VolumePanel"; public class VolumePanel extends Handler implements VolumeController { private static final String TAG = VolumePanel.class.getSimpleName(); private static boolean LOGD = false; /** Loading Loading @@ -189,7 +185,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie this.iconMuteRes = iconMuteRes; this.show = show; } }; } // List of stream types and their order private static final StreamResources[] STREAMS = { Loading Loading @@ -256,14 +252,14 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie } public VolumePanel(final Context context, AudioService volumeService) { public VolumePanel(Context context, AudioService volumeService) { mContext = context; mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); mAudioService = volumeService; // For now, only show master volume if master volume is supported final boolean useMasterVolume = context.getResources().getBoolean( R.bool.config_useMasterVolume); final Resources res = context.getResources(); final boolean useMasterVolume = res.getBoolean(R.bool.config_useMasterVolume); if (useMasterVolume) { for (int i = 0; i < STREAMS.length; i++) { StreamResources streamRes = STREAMS[i]; Loading @@ -271,29 +267,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie } } final TypedArray a = context.obtainStyledAttributes(null, com.android.internal.R.styleable.AlertDialog, com.android.internal.R.attr.alertDialogStyle, 0); final Drawable background = a.getDrawable(R.styleable.AlertDialog_fullBright); a.recycle(); final LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE); mView = inflater.inflate(R.layout.volume_adjust, null); mView.setBackground(background); mView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { resetTimeout(); return false; } }); mPanel = (ViewGroup) mView.findViewById(R.id.visible_panel); mSliderGroup = (ViewGroup) mView.findViewById(R.id.slider_group); mMoreButton = mView.findViewById(R.id.expand_button); mDivider = mView.findViewById(R.id.expand_button_divider); mDialog = new Dialog(context, R.style.Theme_Panel_Volume) { mDialog = new Dialog(context) { @Override public boolean onTouchEvent(MotionEvent event) { if (isShowing() && event.getAction() == MotionEvent.ACTION_OUTSIDE && Loading @@ -305,8 +279,24 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie } }; mDialog.setTitle("Volume control"); // No need to localize mDialog.setContentView(mView); // Change some window properties final Window window = mDialog.getWindow(); final LayoutParams lp = window.getAttributes(); lp.token = null; // Offset from the top lp.y = res.getDimensionPixelOffset(R.dimen.volume_panel_top); lp.type = LayoutParams.TYPE_VOLUME_OVERLAY; lp.windowAnimations = R.style.Animation_VolumePanel; window.setAttributes(lp); window.setGravity(Gravity.TOP); window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); window.requestFeature(Window.FEATURE_NO_TITLE); window.addFlags(LayoutParams.FLAG_NOT_FOCUSABLE | LayoutParams.FLAG_NOT_TOUCH_MODAL | LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH); mDialog.setCanceledOnTouchOutside(true); mDialog.setContentView(R.layout.volume_adjust); mDialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { Loading @@ -315,40 +305,38 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie } }); // Change some window properties final Window window = mDialog.getWindow(); window.setGravity(Gravity.TOP); mDialog.create(); final LayoutParams lp = window.getAttributes(); lp.token = null; // Offset from the top lp.y = mContext.getResources().getDimensionPixelOffset(R.dimen.volume_panel_top); lp.type = LayoutParams.TYPE_VOLUME_OVERLAY; lp.width = LayoutParams.WRAP_CONTENT; lp.height = LayoutParams.WRAP_CONTENT; window.setAttributes(lp); window.addFlags(LayoutParams.FLAG_NOT_FOCUSABLE | LayoutParams.FLAG_NOT_TOUCH_MODAL | LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH); mView = window.findViewById(R.id.content); mView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { resetTimeout(); return false; } }); mPanel = (ViewGroup) mView.findViewById(R.id.visible_panel); mSliderGroup = (ViewGroup) mView.findViewById(R.id.slider_group); mMoreButton = mView.findViewById(R.id.expand_button); mDivider = mView.findViewById(R.id.expand_button_divider); mToneGenerators = new ToneGenerator[AudioSystem.getNumStreamTypes()]; mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); mVoiceCapable = context.getResources().getBoolean(R.bool.config_voice_capable); mShowCombinedVolumes = !mVoiceCapable && !useMasterVolume; // If we don't want to show multiple volumes, hide the settings button and divider // If we don't want to show multiple volumes, hide the settings button // and divider. mShowCombinedVolumes = !mVoiceCapable && !useMasterVolume; if (!mShowCombinedVolumes) { mMoreButton.setVisibility(View.GONE); mDivider.setVisibility(View.GONE); } else { mMoreButton.setOnClickListener(this); mMoreButton.setOnClickListener(mClickListener); } final boolean masterVolumeOnly = context.getResources().getBoolean( R.bool.config_useMasterVolume); final boolean masterVolumeKeySounds = mContext.getResources().getBoolean( R.bool.config_useVolumeKeySounds); final boolean masterVolumeOnly = res.getBoolean(R.bool.config_useMasterVolume); final boolean masterVolumeKeySounds = res.getBoolean(R.bool.config_useVolumeKeySounds); mPlayMasterStreamTones = masterVolumeOnly && masterVolumeKeySounds; listenToRingerMode(); Loading Loading @@ -444,7 +432,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie final int plusOne = (streamType == AudioSystem.STREAM_BLUETOOTH_SCO || streamType == AudioSystem.STREAM_VOICE_CALL) ? 1 : 0; sc.seekbarView.setMax(getStreamMaxVolume(streamType) + plusOne); sc.seekbarView.setOnSeekBarChangeListener(this); sc.seekbarView.setOnSeekBarChangeListener(mSeekListener); sc.seekbarView.setTag(sc); mStreamControls.put(streamType, sc); } Loading Loading @@ -506,10 +494,6 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie } } private boolean isExpanded() { return mMoreButton.getVisibility() != View.VISIBLE; } private void expand() { final int count = mSliderGroup.getChildCount(); for (int i = 0; i < count; i++) { Loading Loading @@ -547,6 +531,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie obtainMessage(MSG_VOLUME_CHANGED, streamType, flags).sendToTarget(); } @Override public void postRemoteVolumeChanged(int streamType, int flags) { if (hasMessages(MSG_REMOTE_VOLUME_CHANGED)) return; synchronized (this) { Loading @@ -558,6 +543,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie obtainMessage(MSG_REMOTE_VOLUME_CHANGED, streamType, flags).sendToTarget(); } @Override public void postRemoteSliderVisibility(boolean visible) { obtainMessage(MSG_SLIDER_VISIBILITY_CHANGED, AudioService.STREAM_REMOTE_MUSIC, visible ? 1 : 0).sendToTarget(); Loading @@ -574,6 +560,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie * as a request to update the volume), the application will likely set a new volume. If the UI * is still up, we need to refresh the display to show this new value. */ @Override public void postHasNewRemotePlaybackInfo() { if (hasMessages(MSG_REMOTE_VOLUME_UPDATE_IF_SHOWN)) return; // don't create or prevent resources to be freed, if they disappear, this update came too Loading Loading @@ -753,7 +740,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie int stream = (streamType == AudioService.STREAM_REMOTE_MUSIC) ? -1 : streamType; // when the stream is for remote playback, use -1 to reset the stream type evaluation mAudioManager.forceVolumeControlStream(stream); mDialog.setContentView(mView); // Showing dialog - use collapsed state if (mShowCombinedVolumes) { collapse(); Loading Loading @@ -885,6 +872,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie .setMessage(com.android.internal.R.string.safe_media_volume_warning) .setPositiveButton(com.android.internal.R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mAudioService.disableSafeMediaVolume(); } Loading Loading @@ -1041,8 +1029,9 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie sendMessage(obtainMessage(MSG_TIMEOUT)); } public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { private final OnSeekBarChangeListener mSeekListener = new OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { final Object tag = seekBar.getTag(); if (fromUser && tag instanceof StreamControl) { StreamControl sc = (StreamControl) tag; Loading @@ -1053,27 +1042,35 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie resetTimeout(); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { final Object tag = seekBar.getTag(); if (tag instanceof StreamControl) { StreamControl sc = (StreamControl) tag; // because remote volume updates are asynchronous, AudioService might have received // a new remote volume value since the finger adjusted the slider. So when the // progress of the slider isn't being tracked anymore, adjust the slider to the last // "published" remote volume value, so the UI reflects the actual volume. // Because remote volume updates are asynchronous, AudioService // might have received a new remote volume value since the // finger adjusted the slider. So when the progress of the // slider isn't being tracked anymore, adjust the slider to the // last "published" remote volume value, so the UI reflects the // actual volume. if (sc.streamType == AudioService.STREAM_REMOTE_MUSIC) { seekBar.setProgress(getStreamVolume(AudioService.STREAM_REMOTE_MUSIC)); } } } }; private final View.OnClickListener mClickListener = new View.OnClickListener() { @Override public void onClick(View v) { if (v == mMoreButton) { expand(); } resetTimeout(); } }; }
core/res/res/layout/volume_adjust.xml +29 −33 Original line number Diff line number Diff line Loading @@ -14,14 +14,11 @@ limitations under the License. --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="448dp" android:layout_height="wrap_content"> <LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/visible_panel" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> android:orientation="horizontal" android:layout_width="300dp" android:layout_height="wrap_content"> <LinearLayout android:id="@+id/slider_group" Loading Loading @@ -52,4 +49,3 @@ android:src="@drawable/ic_sysbar_quicksettings" /> </LinearLayout> </FrameLayout> No newline at end of file
core/res/res/layout/volume_adjust_item.xml +2 −1 Original line number Diff line number Diff line Loading @@ -33,8 +33,9 @@ <SeekBar style="?android:attr/seekBarStyle" android:id="@+id/seekbar" android:layout_width="252dp" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:padding="16dip" android:layout_marginEnd="16dip" /> Loading
core/res/res/values/symbols.xml +1 −1 Original line number Diff line number Diff line Loading @@ -1254,7 +1254,6 @@ <java-symbol type="style" name="TextAppearance.SlidingTabNormal" /> <java-symbol type="style" name="Theme.DeviceDefault.Dialog.NoFrame" /> <java-symbol type="style" name="Theme.IconMenu" /> <java-symbol type="style" name="Theme.Panel.Volume" /> <java-symbol type="attr" name="mediaRouteButtonStyle" /> <java-symbol type="attr" name="externalRouteEnabledDrawable" /> Loading Loading @@ -1836,5 +1835,6 @@ <java-symbol type="attr" name="subtitleTextAppearance" /> <java-symbol type="drawable" name="ic_lock_bugreport" /> <java-symbol type="id" name="icon_frame" /> <java-symbol type="style" name="Animation.VolumePanel" /> </resources>
core/res/res/values/themes.xml +0 −5 Original line number Diff line number Diff line Loading @@ -892,11 +892,6 @@ please see themes_device_defaults.xml. <item name="android:windowCloseOnTouchOutside">false</item> </style> <style name="Theme.Panel.Volume"> <item name="android:windowAnimationStyle">@android:style/Animation.VolumePanel</item> <item name="android:windowCloseOnTouchOutside">true</item> </style> <!-- Default theme with an Action Bar. --> <style name="Theme.WithActionBar"> <item name="android:windowActionBar">true</item> Loading