gpodnetauth activity: hide keyboard on login press, restrict login to single line, add IME actions

This commit is contained in:
Domingos Lopes 2016-07-02 13:21:06 -04:00
parent 4b79da7175
commit 988e53d47d
2 changed files with 18 additions and 2 deletions

View File

@ -11,6 +11,8 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
@ -113,6 +115,9 @@ public class GpodnetAuthenticationActivity extends AppCompatActivity {
final TextView txtvError = (TextView) view.findViewById(R.id.txtvError);
final ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.progBarLogin);
password.setOnEditorActionListener((v, actionID, event) ->
actionID == EditorInfo.IME_ACTION_GO && login.performClick());
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -131,6 +136,11 @@ public class GpodnetAuthenticationActivity extends AppCompatActivity {
login.setEnabled(false);
progressBar.setVisibility(View.VISIBLE);
txtvError.setVisibility(View.GONE);
// hide the keyboard
InputMethodManager inputManager = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(login.getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}

View File

@ -33,7 +33,11 @@
android:layout_margin="8dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:cursorVisible="true"/>
android:cursorVisible="true"
android:maxLines="1"
android:inputType="text"
android:imeOptions="actionNext"
android:nextFocusForward="@id/etxtPassword"/>
<EditText
android:id="@+id/etxtPassword"
@ -45,7 +49,9 @@
android:layout_margin="8dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:cursorVisible="true"/>
android:cursorVisible="true"
android:imeOptions="actionGo"
android:imeActionLabel="@string/gpodnetauth_login_butLabel"/>
<Button
android:id="@+id/butLogin"