| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 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 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 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 |
|
| 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 |
|
| 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 |
} |