mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-11 11:44:59 -05:00
Disable "Ok" button on Add Channel, Add Command dialogs until something's actually been added or removed. I found myself hitting "ok" *before* "add" about four times before I figured out why it never worked. :)
This commit is contained in:
parent
4f7bdfe9bc
commit
367fe94dc6
@ -50,6 +50,7 @@ public class AddChannelActivity extends Activity implements OnClickListener, OnI
|
||||
private EditText channelInput;
|
||||
private ArrayAdapter<String> adapter;
|
||||
private ArrayList<String> channels;
|
||||
private Button okButton;
|
||||
|
||||
/**
|
||||
* On create
|
||||
@ -71,9 +72,12 @@ public class AddChannelActivity extends Activity implements OnClickListener, OnI
|
||||
list.setOnItemClickListener(this);
|
||||
|
||||
((Button) findViewById(R.id.add)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.ok)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.cancel)).setOnClickListener(this);
|
||||
|
||||
okButton = (Button) findViewById(R.id.ok);
|
||||
okButton.setOnClickListener(this);
|
||||
okButton.setEnabled(false);
|
||||
|
||||
channels = getIntent().getExtras().getStringArrayList(Extra.CHANNELS);
|
||||
|
||||
for (String channel : channels) {
|
||||
@ -92,6 +96,7 @@ public class AddChannelActivity extends Activity implements OnClickListener, OnI
|
||||
channels.add(channel);
|
||||
adapter.add(channel);
|
||||
channelInput.setText("#");
|
||||
okButton.setEnabled(true);
|
||||
break;
|
||||
case R.id.cancel:
|
||||
setResult(RESULT_CANCELED);
|
||||
@ -124,6 +129,7 @@ public class AddChannelActivity extends Activity implements OnClickListener, OnI
|
||||
case 0: // Remove
|
||||
adapter.remove(channel);
|
||||
channels.remove(channel);
|
||||
okButton.setEnabled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ public class AddCommandsActivity extends Activity implements OnClickListener, On
|
||||
private EditText commandInput;
|
||||
private ArrayAdapter<String> adapter;
|
||||
private ArrayList<String> commands;
|
||||
private Button okButton;
|
||||
|
||||
/**
|
||||
* On create
|
||||
@ -76,6 +77,10 @@ public class AddCommandsActivity extends Activity implements OnClickListener, On
|
||||
((Button) findViewById(R.id.ok)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.cancel)).setOnClickListener(this);
|
||||
|
||||
okButton = (Button) findViewById(R.id.ok);
|
||||
okButton.setOnClickListener(this);
|
||||
okButton.setEnabled(false);
|
||||
|
||||
commands = getIntent().getExtras().getStringArrayList(Extra.COMMANDS);
|
||||
|
||||
for (String command : commands) {
|
||||
@ -106,6 +111,7 @@ public class AddCommandsActivity extends Activity implements OnClickListener, On
|
||||
commands.add("/" + command);
|
||||
adapter.add("/" + command);
|
||||
commandInput.setText("/");
|
||||
okButton.setEnabled(true);
|
||||
break;
|
||||
case R.id.cancel:
|
||||
setResult(RESULT_CANCELED);
|
||||
@ -138,6 +144,7 @@ public class AddCommandsActivity extends Activity implements OnClickListener, On
|
||||
case 0: // Remove
|
||||
adapter.remove(command);
|
||||
commands.remove(command);
|
||||
okButton.setEnabled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user