diff options
author | Artur Dryomov <artur.dryomov@gmail.com> | 2013-09-01 19:25:36 +0300 |
---|---|---|
committer | Artur Dryomov <artur.dryomov@gmail.com> | 2013-09-03 12:22:47 +0300 |
commit | b6f6147c9cf835a44a51baa9ea3d78718eb1f297 (patch) | |
tree | c8124639e7e3983e2e6ec0ed69c24e70c293b67d /android | |
parent | 837d6e5024897391a3b4351608f626d0b952e0da (diff) |
Add saving computer information on keyboard actions.
Change-Id: I84844a004d2d07809f024ed2e84abcbbba80fb99
Diffstat (limited to 'android')
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/activity/ComputerCreationActivity.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerCreationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerCreationActivity.java index 5ff79ac1b7a1..822d6e17e0e7 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerCreationActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerCreationActivity.java @@ -14,23 +14,27 @@ import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.util.Patterns; +import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.inputmethod.EditorInfo; import android.widget.EditText; +import android.widget.TextView; import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.SherlockFragmentActivity; import org.libreoffice.impressremote.util.Intents; import org.libreoffice.impressremote.R; -public class ComputerCreationActivity extends SherlockFragmentActivity implements View.OnClickListener { +public class ComputerCreationActivity extends SherlockFragmentActivity implements View.OnClickListener, TextView.OnEditorActionListener { @Override protected void onCreate(Bundle aSavedInstanceState) { super.onCreate(aSavedInstanceState); setContentView(R.layout.activity_computer_creation); setUpActionBar(); + setUpKeyboard(); } private void setUpActionBar() { @@ -85,6 +89,7 @@ public class ComputerCreationActivity extends SherlockFragmentActivity implement if (!isIpAddressValid(aIpAddress)) { getIpAddressEdit().setError(getText(R.string.message_ip_address_validation)); + getIpAddressEdit().requestFocus(); return; } @@ -117,6 +122,19 @@ public class ComputerCreationActivity extends SherlockFragmentActivity implement finish(); } + + private void setUpKeyboard() { + getNameEdit().setOnEditorActionListener(this); + } + + @Override + public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) { + if (actionId == EditorInfo.IME_ACTION_DONE) { + saveServer(); + } + + return false; + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |