2 * Copyright (C) 2007 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.android.settings;
19 import android.content.Context;
20 import android.graphics.drawable.Drawable;
21 import android.util.AttributeSet;
22 import android.view.View;
23 import android.widget.ImageView;
24 import android.widget.SeekBar;
27 * Based on frameworks/base/core/java/android/preference/SeekBarDialogPreference.java
28 * except uses support lib preferences.
30 public class SeekBarDialogPreference extends CustomDialogPreference {
31 private final Drawable mMyIcon;
33 public SeekBarDialogPreference(Context context, AttributeSet attrs) {
34 super(context, attrs);
35 setDialogLayoutResource(R.layout.preference_dialog_seekbar_material);
37 createActionButtons();
39 // Steal the XML dialogIcon attribute's value
40 mMyIcon = getDialogIcon();
45 public SeekBarDialogPreference(Context context) {
49 // Allow subclasses to override the action buttons
50 public void createActionButtons() {
51 setPositiveButtonText(android.R.string.ok);
52 setNegativeButtonText(android.R.string.cancel);
56 protected void onBindDialogView(View view) {
57 super.onBindDialogView(view);
59 final ImageView iconView = (ImageView) view.findViewById(android.R.id.icon);
60 if (mMyIcon != null) {
61 iconView.setImageDrawable(mMyIcon);
63 iconView.setVisibility(View.GONE);
67 protected static SeekBar getSeekBar(View dialogView) {
68 return (SeekBar) dialogView.findViewById(R.id.seekbar);