Merge change I8a575e49 into eclair

* changes:
  Fix CustomLocale to work with soft keyboard.
This commit is contained in:
Android (Google) Code Review
2009-10-01 16:54:48 -04:00
2 changed files with 2 additions and 18 deletions

View File

@@ -21,7 +21,7 @@
android:paddingLeft="8dip" android:paddingLeft="8dip"
android:paddingRight="8dip"> android:paddingRight="8dip">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/new_locale_label" /> android:text="@string/new_locale_label" />
<EditText <EditText

View File

@@ -31,8 +31,7 @@ import android.widget.EditText;
* "en_US") via an intent with a "locale" extra string and a "select" extra * "en_US") via an intent with a "locale" extra string and a "select" extra
* boolean. * boolean.
*/ */
public class NewLocaleDialog extends Activity public class NewLocaleDialog extends Activity implements View.OnClickListener {
implements View.OnClickListener, View.OnKeyListener {
public static final String INTENT_EXTRA_LOCALE = "locale"; public static final String INTENT_EXTRA_LOCALE = "locale";
public static final String INTENT_EXTRA_SELECT = "select"; public static final String INTENT_EXTRA_SELECT = "select";
@@ -55,13 +54,9 @@ public class NewLocaleDialog extends Activity
mButtonAdd = (Button) findViewById(R.id.add); mButtonAdd = (Button) findViewById(R.id.add);
mButtonAdd.setOnClickListener(this); mButtonAdd.setOnClickListener(this);
mButtonAdd.setEnabled(false);
mButtonAddSelect = (Button) findViewById(R.id.add_and_select); mButtonAddSelect = (Button) findViewById(R.id.add_and_select);
mButtonAddSelect.setOnClickListener(this); mButtonAddSelect.setOnClickListener(this);
mButtonAddSelect.setEnabled(false);
mEditText.setOnKeyListener(this);
} }
public void onClick(View v) { public void onClick(View v) {
@@ -79,15 +74,4 @@ public class NewLocaleDialog extends Activity
finish(); finish();
} }
public boolean onKey(View v, int keyCode, KeyEvent event) {
boolean isEmpty = TextUtils.isEmpty(mEditText.getText());
if (isEmpty != mWasEmpty) {
mWasEmpty = isEmpty;
mButtonAdd.setEnabled(!isEmpty);
mButtonAddSelect.setEnabled(!isEmpty);
}
return false;
}
} }