diff options
author | Artur Dryomov <artur.dryomov@gmail.com> | 2013-07-21 03:37:09 +0300 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-07-25 18:01:59 +0100 |
commit | 001552cc8a01ddc724856a905017937e735eee73 (patch) | |
tree | 3bdfcffa5480da2c933535945ac24f08033df405 /android | |
parent | ac546de39e59c8ecd18759a9f6b6bd02e4bcd02e (diff) |
Improve the ComputerCreationActivity.
* Allow using IP address as a name.
* Provide proper keyboards for typing name and address.
Change-Id: I86ca58282c81eb0705d6bc82b98b2aab94fbf676
Diffstat (limited to 'android')
4 files changed, 15 insertions, 12 deletions
diff --git a/android/sdremote/res/layout/activity_computer_creation.xml b/android/sdremote/res/layout/activity_computer_creation.xml index be1f31395436..4ef3f86a269f 100644 --- a/android/sdremote/res/layout/activity_computer_creation.xml +++ b/android/sdremote/res/layout/activity_computer_creation.xml @@ -8,7 +8,7 @@ <EditText android:id="@+id/edit_ip_address" android:singleLine="true" - android:inputType="text" + android:inputType="phone" android:hint="@string/hint_ip_address" android:layout_width="match_parent" android:layout_height="wrap_content"/> @@ -16,10 +16,18 @@ <EditText android:id="@+id/edit_name" android:singleLine="true" - android:inputType="text" + android:inputType="text|textCapSentences" android:hint="@string/hint_name" android:paddingTop="@dimen/padding_vertical_edit" android:layout_width="match_parent" android:layout_height="wrap_content"/> + <TextView + style="?textAppearanceSmall" + android:text="@string/message_name_notice" + android:gravity="center_horizontal" + android:paddingTop="@dimen/padding_vertical_notice" + android:layout_width="match_parent" + android:layout_height="wrap_content"/> + </LinearLayout>
\ No newline at end of file diff --git a/android/sdremote/res/values/dimens.xml b/android/sdremote/res/values/dimens.xml index b73555f52401..d4c2e5b07b04 100644 --- a/android/sdremote/res/values/dimens.xml +++ b/android/sdremote/res/values/dimens.xml @@ -15,6 +15,7 @@ <dimen name="padding_vertical_pin">10dp</dimen> <dimen name="padding_vertical_error_message">10dp</dimen> <dimen name="padding_vertical_edit">8dp</dimen> + <dimen name="padding_vertical_notice">16dp</dimen> <dimen name="margin_vertical_action_bar_divider">12dp</dimen> <dimen name="margin_slide">8dp</dimen> diff --git a/android/sdremote/res/values/strings.xml b/android/sdremote/res/values/strings.xml index 38252bb9a05c..072c406ea223 100644 --- a/android/sdremote/res/values/strings.xml +++ b/android/sdremote/res/values/strings.xml @@ -27,7 +27,7 @@ <string name="message_impress_wifi_enabling">You should enable experimental features at “Tools → Options → LibreOffice → Advanced” as well.</string> <string name="message_impress_pairing_check">If you have Bluetooth pairing issues check instructions related to your desktop OS.</string> <string name="message_ip_address_validation">You should type a valid IP address.</string> - <string name="message_name_validation">Name should not be empty.</string> + <string name="message_name_notice">Name is optional — IP address would be used instead if you wish.</string> <string name="hint_ip_address">IP address</string> <string name="hint_name">Name</string> diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerCreationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerCreationActivity.java index 76f33c6e4ccb..372e49bdb947 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerCreationActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerCreationActivity.java @@ -68,11 +68,9 @@ public class ComputerCreationActivity extends SherlockFragmentActivity implement public void onClick(View aView) { if (aView.equals(getCancelButton())) { cancelCreation(); - return; } - if (aView.equals(getSaveButton())) { saveServer(); } @@ -88,13 +86,13 @@ public class ComputerCreationActivity extends SherlockFragmentActivity implement if (!isIpAddressValid(aIpAddress)) { getIpAddressEdit().setError(getText(R.string.message_ip_address_validation)); + return; } if (TextUtils.isEmpty(aName)) { - getNameEdit().setError(getText(R.string.message_name_validation)); + finish(aIpAddress, aIpAddress); } - - if (isServerInformationValid(aIpAddress, aName)) { + else { finish(aIpAddress, aName); } } @@ -111,10 +109,6 @@ public class ComputerCreationActivity extends SherlockFragmentActivity implement return (EditText) findViewById(R.id.edit_name); } - private boolean isServerInformationValid(String aIpAddress, String aName) { - return isIpAddressValid(aIpAddress) && !TextUtils.isEmpty(aName); - } - private boolean isIpAddressValid(String aIpAddress) { return Patterns.IP_ADDRESS.matcher(aIpAddress).matches(); } |