diff options
author | Kenny Root <kenny@the-b.org> | 2009-08-23 20:50:28 +0000 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2009-08-23 20:50:28 +0000 |
commit | 44b8858d0c21d7e1e4dbe16195e4bc2b718117c6 (patch) | |
tree | 3a1c5e526eb5343d2549bb08c510cd7226491b8b | |
parent | 4964305192e660147248006978a2bdbe2ed72143 (diff) | |
download | connectbot-44b8858d0c21d7e1e4dbe16195e4bc2b718117c6.tar.gz connectbot-44b8858d0c21d7e1e4dbe16195e4bc2b718117c6.tar.bz2 connectbot-44b8858d0c21d7e1e4dbe16195e4bc2b718117c6.zip |
Validate Force Resize input are integers
git-svn-id: https://connectbot.googlecode.com/svn/trunk/connectbot@402 df292f66-193f-0410-a5fc-6d59da041ff2
-rw-r--r-- | AndroidManifest.xml | 2 | ||||
-rw-r--r-- | res/layout/dia_resize.xml | 6 | ||||
-rw-r--r-- | src/org/connectbot/ConsoleActivity.java | 15 |
3 files changed, 18 insertions, 5 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 390d5b6..7bff07b 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -2,7 +2,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.connectbot" android:versionName="1.6-dev" - android:versionCode="195"> + android:versionCode="196"> <application android:icon="@drawable/icon" diff --git a/res/layout/dia_resize.xml b/res/layout/dia_resize.xml index 49a7958..53011c6 100644 --- a/res/layout/dia_resize.xml +++ b/res/layout/dia_resize.xml @@ -30,7 +30,8 @@ android:layout_width="100dip" android:layout_height="wrap_content" android:singleLine="true" - android:numeric="integer" android:text="80"/> + android:numeric="integer" + android:text="80"/> <TextView android:layout_width="wrap_content" @@ -48,5 +49,6 @@ android:layout_width="100dip" android:layout_height="wrap_content" android:singleLine="true" - android:numeric="integer" android:text="25"/> + android:numeric="integer" + android:text="25"/> </LinearLayout> diff --git a/src/org/connectbot/ConsoleActivity.java b/src/org/connectbot/ConsoleActivity.java index 9223a18..803b84b 100644 --- a/src/org/connectbot/ConsoleActivity.java +++ b/src/org/connectbot/ConsoleActivity.java @@ -764,8 +764,19 @@ public class ConsoleActivity extends Activity { .setView(resizeView) .setPositiveButton(R.string.button_resize, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { - int width = Integer.parseInt(((EditText)resizeView.findViewById(R.id.width)).getText().toString()); - int height = Integer.parseInt(((EditText)resizeView.findViewById(R.id.height)).getText().toString()); + int width, height; + try { + width = Integer.parseInt(((EditText) resizeView + .findViewById(R.id.width)) + .getText().toString()); + height = Integer.parseInt(((EditText) resizeView + .findViewById(R.id.height)) + .getText().toString()); + } catch (NumberFormatException nfe) { + // TODO change this to a real dialog where we can + // make the input boxes turn red to indicate an error. + return; + } terminalView.forceSize(width, height); } |