diff --git a/.idea/libraries/animated_vector_drawable_23_3_0.xml b/.idea/libraries/animated_vector_drawable_23_3_0.xml index 4ba521e..d5460f1 100644 --- a/.idea/libraries/animated_vector_drawable_23_3_0.xml +++ b/.idea/libraries/animated_vector_drawable_23_3_0.xml @@ -6,8 +6,6 @@ - - diff --git a/.idea/libraries/appcompat_v7_23_3_0.xml b/.idea/libraries/appcompat_v7_23_3_0.xml index de5aaeb..0dbe7ef 100644 --- a/.idea/libraries/appcompat_v7_23_3_0.xml +++ b/.idea/libraries/appcompat_v7_23_3_0.xml @@ -9,8 +9,6 @@ - - diff --git a/.idea/libraries/design_23_3_0.xml b/.idea/libraries/design_23_3_0.xml index 1120123..441bb88 100644 --- a/.idea/libraries/design_23_3_0.xml +++ b/.idea/libraries/design_23_3_0.xml @@ -9,8 +9,6 @@ - - diff --git a/.idea/libraries/recyclerview_v7_23_3_0.xml b/.idea/libraries/recyclerview_v7_23_3_0.xml index 36865de..c4ab7de 100644 --- a/.idea/libraries/recyclerview_v7_23_3_0.xml +++ b/.idea/libraries/recyclerview_v7_23_3_0.xml @@ -4,13 +4,11 @@ - + - - diff --git a/.idea/libraries/support_annotations_23_3_0.xml b/.idea/libraries/support_annotations_23_3_0.xml index 118a0e7..e592bd6 100644 --- a/.idea/libraries/support_annotations_23_3_0.xml +++ b/.idea/libraries/support_annotations_23_3_0.xml @@ -1,12 +1,10 @@ - + - - diff --git a/.idea/libraries/support_v4_23_3_0.xml b/.idea/libraries/support_v4_23_3_0.xml index 62a2f14..a2479db 100644 --- a/.idea/libraries/support_v4_23_3_0.xml +++ b/.idea/libraries/support_v4_23_3_0.xml @@ -5,13 +5,11 @@ - + - - diff --git a/.idea/libraries/support_vector_drawable_23_3_0.xml b/.idea/libraries/support_vector_drawable_23_3_0.xml index b4ad228..7f87d23 100644 --- a/.idea/libraries/support_vector_drawable_23_3_0.xml +++ b/.idea/libraries/support_vector_drawable_23_3_0.xml @@ -6,8 +6,6 @@ - - diff --git a/.idea/libraries/volley_1_0_0.xml b/.idea/libraries/volley_1_0_0.xml index 81a83dd..8e317b7 100644 --- a/.idea/libraries/volley_1_0_0.xml +++ b/.idea/libraries/volley_1_0_0.xml @@ -1,8 +1,8 @@ - + diff --git a/.idea/misc.xml b/.idea/misc.xml index 5d19981..1a3eaff 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 caad4ec..91f0196 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 @@ -30,6 +30,7 @@ import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; +import android.widget.Toast; import com.android.volley.Response; import com.android.volley.VolleyError; @@ -75,19 +76,14 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba 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; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); - - // Set up the login form. -// mEmailView = (AutoCompleteTextView) findViewById(R.id.email); -// populateAutoComplete(); -// mUsernameView = (AutoCompleteTextView) findViewById(R.id.username); -// populateAutoComplete(); + this.self = this; mUsernameView = (EditText) findViewById(R.id.al_username); mPasswordView = (EditText) findViewById(R.id.al_password); @@ -101,14 +97,14 @@ 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 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() { @@ -188,25 +184,14 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba return; } showProgress(true); - - // Reset errors. -// mEmailView.setError(null); -// mUsernameView.setError(null); mPasswordView.setError(null); - // Store values at the time of the login attempt. - -// String email = mEmailView.getText().toString(); if (isParamsValid(mUsernameView.getText().toString(), mPasswordView.getText().toString())) { String username = mUsernameView.getText().toString(); String password = mPasswordView.getText().toString(); - boolean cancel = false; - View focusView = null; -// mAuthTask = new UserLoginTask(username, password); // TODO: RETRIEVE ? -// mAuthTask.execute((Void) null); // TODO: RETRIEVE ? // http request register JSONObject tempJson = new JSONObject(); @@ -218,37 +203,11 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba } VolleyUtilSingleton.getInstance(LoginActivity.this).post(BASE_URL + LOGIN_PATH, tempJson, onLoginSuccess, onLoginError); - - // Check for a valid password, if the user entered one. -// if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) { -// mPasswordView.setError(getString(R.string.error_invalid_password)); -// focusView = mPasswordView; -// cancel = true; -// } -// if (cancel) { -// // There was an error; don't attempt login and focus the first -// // form field with an error. -// focusView.requestFocus(); -// } else { -// // Show a progress spinner, and kick off a background task to -// // perform the user login attempt. -// -// } } else { showProgress(false); Log.d(TAG, "Invalid params - make sure username exist & password is 4 characters or more"); } - // Check for a valid username -// if (TextUtils.isEmpty(username)) { -// mUsernameView.setError(getString(R.string.error_field_required)); -// focusView = mUsernameView; -// cancel = true; -// } else if (!isEmailValid(username)) { -// mUsernameView.setError(getString(R.string.error_invalid_email)); -// focusView = mUsernameView; -// cancel = true; -// } } Response.Listener onLoginSuccess = new Response.Listener() { @@ -277,6 +236,7 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba @Override public void onErrorResponse(VolleyError error) { showProgress(false); + Toast.makeText(self , "Username Or Password Incorrect", Toast.LENGTH_LONG).show(); Log.d(TAG, "onLoginError: msg: " + error.getMessage()); } }; diff --git a/app/src/main/res/drawable/logo.png b/app/src/main/res/drawable/logo.png new file mode 100644 index 0000000..d5a01b8 Binary files /dev/null and b/app/src/main/res/drawable/logo.png differ diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index 36b63e7..aef3f68 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -1,79 +1,79 @@ - + - - + - - + android:paddingTop="56dp" + android:paddingLeft="24dp" + android:paddingRight="24dp"> - + + - + + + - - + + android:inputType="textEmailAddress" + android:hint="Usename" /> + -