diff --git a/res/layout/aliasadd.xml b/res/layout/aliasadd.xml
index 12958b0..b027435 100644
--- a/res/layout/aliasadd.xml
+++ b/res/layout/aliasadd.xml
@@ -22,12 +22,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
- android:text=""
android:layout_weight="1" />
adapter;
private ArrayList aliases;
+ private Button addButton;
private Button okButton;
@Override
@@ -36,6 +39,7 @@ public class AddAliasActivity extends Activity implements OnClickListener, OnIte
setContentView(R.layout.aliasadd);
aliasInput = (EditText) findViewById(R.id.alias);
+ aliasInput.addTextChangedListener(this);
adapter = new ArrayAdapter(this, R.layout.aliasitem);
@@ -43,7 +47,8 @@ public class AddAliasActivity extends Activity implements OnClickListener, OnIte
list.setAdapter(adapter);
list.setOnItemClickListener(this);
- ((Button) findViewById(R.id.add)).setOnClickListener(this);
+ addButton = (Button) findViewById(R.id.add);
+ addButton.setOnClickListener(this);
((Button) findViewById(R.id.cancel)).setOnClickListener(this);
okButton = (Button) findViewById(R.id.ok);
@@ -109,4 +114,16 @@ public class AddAliasActivity extends Activity implements OnClickListener, OnIte
AlertDialog alert = builder.create();
alert.show();
}
+
+ public void afterTextChanged(Editable s) {
+ // Do nothing.
+ }
+
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+ // Do nothing.
+ }
+
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+ addButton.setEnabled(aliasInput.getText().length() > 0);
+ }
}