diff --git a/.idea/libraries/animated_vector_drawable_23_3_0.xml b/.idea/libraries/animated_vector_drawable_23_3_0.xml index d5460f1..17f57e0 100644 --- a/.idea/libraries/animated_vector_drawable_23_3_0.xml +++ b/.idea/libraries/animated_vector_drawable_23_3_0.xml @@ -1,11 +1,12 @@ - + + diff --git a/.idea/libraries/appcompat_v7_23_3_0.xml b/.idea/libraries/appcompat_v7_23_3_0.xml index 0dbe7ef..570c386 100644 --- a/.idea/libraries/appcompat_v7_23_3_0.xml +++ b/.idea/libraries/appcompat_v7_23_3_0.xml @@ -4,11 +4,12 @@ - + + diff --git a/.idea/libraries/design_23_3_0.xml b/.idea/libraries/design_23_3_0.xml index 441bb88..5c6ebc6 100644 --- a/.idea/libraries/design_23_3_0.xml +++ b/.idea/libraries/design_23_3_0.xml @@ -4,11 +4,12 @@ - + + diff --git a/.idea/libraries/recyclerview_v7_23_3_0.xml b/.idea/libraries/recyclerview_v7_23_3_0.xml index c4ab7de..4538017 100644 --- a/.idea/libraries/recyclerview_v7_23_3_0.xml +++ b/.idea/libraries/recyclerview_v7_23_3_0.xml @@ -4,11 +4,12 @@ - + + diff --git a/.idea/libraries/support_annotations_23_3_0.xml b/.idea/libraries/support_annotations_23_3_0.xml index e592bd6..d428581 100644 --- a/.idea/libraries/support_annotations_23_3_0.xml +++ b/.idea/libraries/support_annotations_23_3_0.xml @@ -1,10 +1,11 @@ - + + diff --git a/.idea/libraries/support_v4_23_3_0.xml b/.idea/libraries/support_v4_23_3_0.xml index a2479db..0daf0b5 100644 --- a/.idea/libraries/support_v4_23_3_0.xml +++ b/.idea/libraries/support_v4_23_3_0.xml @@ -5,11 +5,12 @@ - + + diff --git a/.idea/libraries/support_vector_drawable_23_3_0.xml b/.idea/libraries/support_vector_drawable_23_3_0.xml index 7f87d23..8dc998c 100644 --- a/.idea/libraries/support_vector_drawable_23_3_0.xml +++ b/.idea/libraries/support_vector_drawable_23_3_0.xml @@ -6,6 +6,7 @@ + diff --git a/.idea/misc.xml b/.idea/misc.xml index 1a3eaff..5d19981 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -37,7 +37,7 @@ - + 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 8b71b22..c2da56a 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 @@ -74,24 +74,34 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba private EditText mPasswordView; private View mProgressView; private View mLoginFormView; + private TextView mRegisterButton; + private Button mLoginButton; + private final String TAG = "Login Activity"; private final String BASE_URL = "http://thesocialnotework-api.appspot.com/api"; private final String LOGIN_PATH = "/login"; + private final String REG_PATH = "/register"; 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); + mLoginFormView = findViewById(R.id.login_form); + mProgressView = findViewById(R.id.login_progress); + showProgress(false); + + // Remove Auto Focus from the Text Fields + layout.setFocusable(true); + layout.setFocusableInTouchMode(true); + mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) { @@ -102,30 +112,28 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba return false; } }); -// Button mRegisterButton = (Button) findViewById(R.id.al_register_button); -// mRegisterButton.setOnClickListener(new OnClickListener() { -// @Override -// public void onClick(View view) { -// Log.d(TAG, "Register....... this section under construction"); -// //attemptRegister(); // TODO : implement -// } -// }); - Button mEmailSignInButton = (Button) findViewById(R.id.al_login_button); - mEmailSignInButton.setOnClickListener(new OnClickListener() { + mRegisterButton = (TextView) findViewById(R.id.al_register_button); + mRegisterButton.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + Log.d(TAG, "Register....... this section under construction"); + //attemptRegister(); // TODO : implement + } + }); + + mLoginButton = (Button) findViewById(R.id.al_login_button); + mLoginButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { Log.d(TAG, "Login......."); + showProgress(false); attemptLogin(); } }); 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() { @@ -201,6 +209,8 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba String username = mUsernameView.getText().toString(); String password = mPasswordView.getText().toString(); + boolean cancel = false; + View focusView = null; // http request register JSONObject tempJson = new JSONObject(); @@ -223,7 +233,6 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba @Override public void onResponse(JSONObject response) { try { - // if(response.get("user") != null) { if(!response.isNull("user")) { Log.e(TAG, "onLoginSuccess => user exist"); // TODO: REMOVE console Intent personalSpaceActivity = new Intent(LoginActivity.this, PersonalSpaceActivity.class); diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index 03073f0..61f42f2 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -43,7 +43,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textEmailAddress" - android:hint="Usename" /> + android:hint="Username" /> @@ -69,7 +69,7 @@ android:padding="12dp" android:text="Login"/> - Password Login Register + No account yet? Create one for FREE Sign in This email address is invalid This password is too short