Merge "Make the ToggleSlider in the status bar settings panel show the right track when it's disabled."

This commit is contained in:
Joe Onorato
2010-12-08 15:51:27 -08:00
committed by Android (Google) Code Review
3 changed files with 35 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project
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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background"
android:drawable="@*android:drawable/scrubber_track_holo_dark" />
<item android:id="@android:id/secondaryProgress">
<scale android:scaleWidth="100%"
android:drawable="@*android:drawable/scrubber_track_holo_dark" />
</item>
<item android:id="@android:id/progress">
<scale android:scaleWidth="100%"
android:drawable="@*android:drawable/scrubber_track_holo_dark" />
</item>
</layer-list>

View File

@@ -24,10 +24,10 @@ import android.util.AttributeSet;
import android.util.Slog;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.CompoundButton;
import com.android.systemui.R;
@@ -77,13 +77,18 @@ public class ToggleSlider extends RelativeLayout
public void onCheckedChanged(CompoundButton toggle, boolean checked) {
Drawable thumb;
Drawable slider;
final Resources res = getContext().getResources();
if (checked) {
thumb = res.getDrawable(R.drawable.scrubber_control_disabled_holo);
slider = res.getDrawable(R.drawable.status_bar_settings_slider_disabled);
} else {
thumb = res.getDrawable(R.drawable.scrubber_control_holo);
slider = res.getDrawable(
com.android.internal.R.drawable.scrubber_progress_horizontal_holo_dark);
}
mSlider.setThumb(thumb);
mSlider.setProgressDrawable(slider);
if (mListener != null) {
mListener.onChanged(this, mTracking, checked, mSlider.getProgress());