gpodnetauth activity: hide keyboard on login press, restrict login to single line, add IME actions
This commit is contained in:
parent
4b79da7175
commit
988e53d47d
@ -11,6 +11,8 @@ import android.util.Log;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.inputmethod.EditorInfo;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
@ -113,6 +115,9 @@ public class GpodnetAuthenticationActivity extends AppCompatActivity {
|
|||||||
final TextView txtvError = (TextView) view.findViewById(R.id.txtvError);
|
final TextView txtvError = (TextView) view.findViewById(R.id.txtvError);
|
||||||
final ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.progBarLogin);
|
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() {
|
login.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@ -131,6 +136,11 @@ public class GpodnetAuthenticationActivity extends AppCompatActivity {
|
|||||||
login.setEnabled(false);
|
login.setEnabled(false);
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
txtvError.setVisibility(View.GONE);
|
txtvError.setVisibility(View.GONE);
|
||||||
|
// hide the keyboard
|
||||||
|
InputMethodManager inputManager = (InputMethodManager)
|
||||||
|
getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
inputManager.hideSoftInputFromWindow(login.getWindowToken(),
|
||||||
|
InputMethodManager.HIDE_NOT_ALWAYS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,11 @@
|
|||||||
android:layout_margin="8dp"
|
android:layout_margin="8dp"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:focusableInTouchMode="true"
|
android:focusableInTouchMode="true"
|
||||||
android:cursorVisible="true"/>
|
android:cursorVisible="true"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:inputType="text"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:nextFocusForward="@id/etxtPassword"/>
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/etxtPassword"
|
android:id="@+id/etxtPassword"
|
||||||
@ -45,7 +49,9 @@
|
|||||||
android:layout_margin="8dp"
|
android:layout_margin="8dp"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:focusableInTouchMode="true"
|
android:focusableInTouchMode="true"
|
||||||
android:cursorVisible="true"/>
|
android:cursorVisible="true"
|
||||||
|
android:imeOptions="actionGo"
|
||||||
|
android:imeActionLabel="@string/gpodnetauth_login_butLabel"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/butLogin"
|
android:id="@+id/butLogin"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user