mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +01:00
go back to having Ok and Cancel buttons: that's the way the built-in
prefs editors work. Dismiss == Cancel, again following the built-in.
This commit is contained in:
parent
02a96cdaa6
commit
077bc53e80
1 changed files with 14 additions and 25 deletions
|
@ -18,7 +18,6 @@ import junit.framework.Assert;
|
|||
public class EditColorPreference extends DialogPreference {
|
||||
|
||||
private Context m_context;
|
||||
private boolean m_cancel;
|
||||
private int m_curColor;
|
||||
|
||||
private class SBCL implements SeekBar.OnSeekBarChangeListener {
|
||||
|
@ -78,7 +77,6 @@ public class EditColorPreference extends DialogPreference {
|
|||
@Override
|
||||
protected void onBindDialogView( View view )
|
||||
{
|
||||
m_cancel = false;
|
||||
m_curColor = getPersistedColor();
|
||||
setOneByte( view, R.id.edit_red, 16 );
|
||||
setOneByte( view, R.id.edit_green, 8 );
|
||||
|
@ -91,23 +89,11 @@ public class EditColorPreference extends DialogPreference {
|
|||
@Override
|
||||
protected void onPrepareDialogBuilder( AlertDialog.Builder builder )
|
||||
{
|
||||
builder.setPositiveButton( null, null );
|
||||
builder.setNegativeButton( R.string.button_cancel,
|
||||
DialogInterface.OnClickListener lstnr =
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick( DialogInterface dg,
|
||||
int which )
|
||||
public void onClick( DialogInterface dialog, int which )
|
||||
{
|
||||
m_cancel = true;
|
||||
}
|
||||
} );
|
||||
super.onPrepareDialogBuilder( builder );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss( DialogInterface dialog )
|
||||
{
|
||||
if ( !m_cancel ) {
|
||||
int color = (getOneByte( dialog, R.id.edit_red ) << 16)
|
||||
| (getOneByte( dialog, R.id.edit_green ) << 8)
|
||||
| getOneByte( dialog, R.id.edit_blue );
|
||||
|
@ -115,6 +101,9 @@ public class EditColorPreference extends DialogPreference {
|
|||
persistInt( color );
|
||||
notifyChanged();
|
||||
}
|
||||
};
|
||||
builder.setPositiveButton( R.string.button_ok, lstnr );
|
||||
super.onPrepareDialogBuilder( builder );
|
||||
}
|
||||
|
||||
private void setOneByte( View parent, int id, int shift )
|
||||
|
|
Loading…
Add table
Reference in a new issue