From 90d2438cb121b117483080b0c265043ffefdcca6 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Sun, 3 Jul 2016 15:36:31 +0300 Subject: [PATCH] Fixed Login - no Keyboard on start --- .../ara/sagi/thesocialnotework/LoginActivity.java | 13 +++++++++++-- app/src/main/res/layout/activity_login.xml | 6 ++++-- app/src/main/res/values/strings.xml | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/LoginActivity.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/LoginActivity.java index 91f0196..8b71b22 100644 --- a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/LoginActivity.java +++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/LoginActivity.java @@ -24,11 +24,14 @@ import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.View.OnClickListener; +import android.view.Window; +import android.view.WindowManager; import android.view.inputmethod.EditorInfo; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.EditText; +import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; @@ -78,13 +81,15 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba private final String LOGIN_PATH = "/login"; private LoginActivity self; - + protected LinearLayout layout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + //Remove title bar + this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_login); this.self = this; - + this.layout = (LinearLayout) findViewById(R.id.layout); mUsernameView = (EditText) findViewById(R.id.al_username); mPasswordView = (EditText) findViewById(R.id.al_password); mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() { @@ -117,6 +122,10 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba mLoginFormView = findViewById(R.id.login_form); mProgressView = findViewById(R.id.login_progress); + + // Remove Auto Focus from the Text Fields + layout.setFocusable(true); + layout.setFocusableInTouchMode(true); } private void populateAutoComplete() { diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index aef3f68..03073f0 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -14,7 +14,8 @@ android:layout_height="wrap_content" android:paddingTop="56dp" android:paddingLeft="24dp" - android:paddingRight="24dp"> + android:paddingRight="24dp" + android:id="@+id/layout"> + android:layout_gravity="center_horizontal" + android:contentDescription="@string/logo" /> PersonalSpaceActivity Private Public + Logo