Debian Codegraph @

core/java/android/preference/SeekBarDialogPreference.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17 package android.preference;
18
19 import android.compat.annotation.UnsupportedAppUsage;
20 import android.content.Context;
21 import android.graphics.drawable.Drawable;
22 import android.util.AttributeSet;
23 import android.view.View;
24 import android.widget.ImageView;
25 import android.widget.SeekBar;
26
27 import com.android.internal.R;
28
29 /**
30 * @hide
31 *
32 * @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
33 * <a href="{@docRoot}reference/androidx/preference/package-summary.html">
34 * Preference Library</a> for consistent behavior across all devices. For more information on
35 * using the AndroidX Preference Library see
36 * <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
37 */
38 @Deprecated
39 public class SeekBarDialogPreference extends DialogPreference {
40 private final Drawable mMyIcon;
41
42 public SeekBarDialogPreference(
43 Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
44 super(context, attrs, defStyleAttr, defStyleRes);
45
46 createActionButtons();
47
48 // Steal the XML dialogIcon attribute's value
49 mMyIcon = getDialogIcon();
50
51 setDialogIcon(null);
52 }
53
54 public SeekBarDialogPreference(Context context, AttributeSet attrs, int defStyleAttr) {
55 this(context, attrs, defStyleAttr, 0);
56 }
57
58 @UnsupportedAppUsage
59 public SeekBarDialogPreference(Context context, AttributeSet attrs) {
60 this(context, attrs, R.attr.seekBarDialogPreferenceStyle);
61 }
62
63 public SeekBarDialogPreference(Context context) {
64 this(context, null);
65 }
66
67 // Allow subclasses to override the action buttons
68 public void createActionButtons() {
69 setPositiveButtonText(R.string.ok);
70 setNegativeButtonText(R.string.cancel);
71 }
72
73 @Override
74 protected void onBindDialogView(View view) {
75 super.onBindDialogView(view);
76
77 final ImageView iconView = (ImageView) view.findViewById(R.id.icon);
78 if (mMyIcon != null) {
79 iconView.setImageDrawable(mMyIcon);
80 } else {
81 iconView.setVisibility(View.GONE);
82 }
83 }
84
85 protected static SeekBar getSeekBar(View dialogView) {
86 return (SeekBar) dialogView.findViewById(R.id.seekbar);
87 }
88 }