Fixed Login - no Keyboard on start

This commit is contained in:
Sagi Dayan 2016-07-03 15:36:31 +03:00
parent 0817d86fce
commit 90d2438cb1
3 changed files with 16 additions and 4 deletions

View file

@ -24,11 +24,14 @@ import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView; import android.widget.AutoCompleteTextView;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -78,13 +81,15 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba
private final String LOGIN_PATH = "/login"; private final String LOGIN_PATH = "/login";
private LoginActivity self; private LoginActivity self;
protected LinearLayout layout;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
//Remove title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_login); setContentView(R.layout.activity_login);
this.self = this; this.self = this;
this.layout = (LinearLayout) findViewById(R.id.layout);
mUsernameView = (EditText) findViewById(R.id.al_username); mUsernameView = (EditText) findViewById(R.id.al_username);
mPasswordView = (EditText) findViewById(R.id.al_password); mPasswordView = (EditText) findViewById(R.id.al_password);
mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() { mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@ -117,6 +122,10 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba
mLoginFormView = findViewById(R.id.login_form); mLoginFormView = findViewById(R.id.login_form);
mProgressView = findViewById(R.id.login_progress); mProgressView = findViewById(R.id.login_progress);
// Remove Auto Focus from the Text Fields
layout.setFocusable(true);
layout.setFocusableInTouchMode(true);
} }
private void populateAutoComplete() { private void populateAutoComplete() {

View file

@ -14,7 +14,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="56dp" android:paddingTop="56dp"
android:paddingLeft="24dp" android:paddingLeft="24dp"
android:paddingRight="24dp"> android:paddingRight="24dp"
android:id="@+id/layout">
<!-- Login progress --> <!-- Login progress -->
<ProgressBar <ProgressBar
@ -29,7 +30,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="72dp" android:layout_height="72dp"
android:layout_marginBottom="24dp" android:layout_marginBottom="24dp"
android:layout_gravity="center_horizontal" /> android:layout_gravity="center_horizontal"
android:contentDescription="@string/logo" />
<!-- Email Label --> <!-- Email Label -->
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout

View file

@ -18,5 +18,6 @@
<string name="title_activity_personal_space">PersonalSpaceActivity</string> <string name="title_activity_personal_space">PersonalSpaceActivity</string>
<string name="nvf_private_label">Private</string> <string name="nvf_private_label">Private</string>
<string name="nvf_public_label">Public</string> <string name="nvf_public_label">Public</string>
<string name="logo">Logo</string>
</resources> </resources>