Merge branch 'master' of https://github.com/sagidayan/TheSocialNotework-Android
# Conflicts: # app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/LoginActivity.java # app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/PersonalFragment.java
This commit is contained in:
parent
f7eb10433f
commit
6a37640637
6 changed files with 180 additions and 177 deletions
|
@ -53,7 +53,8 @@ public class GmapFragment extends Fragment implements OnMapReadyCallback {
|
|||
private final int MAX_ZOOM = 16, MIN_ZOOM = 9;
|
||||
|
||||
|
||||
public GmapFragment() {}
|
||||
public GmapFragment() {
|
||||
}
|
||||
|
||||
|
||||
public static GmapFragment newInstance(String param1, String param2) {
|
||||
|
@ -159,10 +160,6 @@ public class GmapFragment extends Fragment implements OnMapReadyCallback {
|
|||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private class getMarkersFromNotes extends AsyncTask<List<Note>, MarkerOptions, List<MarkerOptions>> {
|
||||
GoogleMap mMap;
|
||||
// GmapFragment gmap;
|
||||
|
@ -201,7 +198,7 @@ public class GmapFragment extends Fragment implements OnMapReadyCallback {
|
|||
.title(n.getTitle())
|
||||
.position(new LatLng(n.getLat(), n.getLon()))
|
||||
.snippet(n.getBody())
|
||||
.icon(BitmapDescriptorFactory.fromBitmap(Bitmap.createScaledBitmap(Utils.getBitmapFromURL(url),80,80,false)));
|
||||
.icon(BitmapDescriptorFactory.fromBitmap(Bitmap.createScaledBitmap(Utils.getBitmapFromURL(url), 80, 80, false)));
|
||||
publishProgress(mo);
|
||||
// );
|
||||
|
||||
|
|
|
@ -7,39 +7,39 @@ import android.os.AsyncTask;
|
|||
/**
|
||||
* Created by aranza on 7/2/2016.
|
||||
*/
|
||||
public class HeavyWorker extends AsyncTask< String , Context , Void > {
|
||||
public class HeavyWorker extends AsyncTask<String, Context, Void> {
|
||||
|
||||
private ProgressDialog progressDialog ;
|
||||
private Context targetCtx ;
|
||||
private ProgressDialog progressDialog;
|
||||
private Context targetCtx;
|
||||
|
||||
public HeavyWorker ( Context context ) {
|
||||
this.targetCtx = context ;
|
||||
progressDialog = new ProgressDialog ( targetCtx ) ;
|
||||
progressDialog.setCancelable ( false ) ;
|
||||
progressDialog.setMessage ( "Retrieving data..." ) ;
|
||||
progressDialog.setTitle ( "Please wait" ) ;
|
||||
progressDialog.setIndeterminate ( true ) ;
|
||||
public HeavyWorker(Context context) {
|
||||
this.targetCtx = context;
|
||||
progressDialog = new ProgressDialog(targetCtx);
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.setMessage("Retrieving data...");
|
||||
progressDialog.setTitle("Please wait");
|
||||
progressDialog.setIndeterminate(true);
|
||||
}
|
||||
|
||||
@ Override
|
||||
protected void onPreExecute ( ) {
|
||||
progressDialog.show ( ) ;
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
progressDialog.show();
|
||||
}
|
||||
|
||||
@ Override
|
||||
protected Void doInBackground ( String ... params ) {
|
||||
@Override
|
||||
protected Void doInBackground(String... params) {
|
||||
// Do Your WORK here
|
||||
|
||||
// MainActivity ps = (MainActivity) targetCtx;
|
||||
// ps.getAllNotes();
|
||||
|
||||
return null ;
|
||||
return null;
|
||||
}
|
||||
|
||||
@ Override
|
||||
protected void onPostExecute ( Void result ) {
|
||||
if(progressDialog != null && progressDialog.isShowing()){
|
||||
progressDialog.dismiss ( ) ;
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
if (progressDialog != null && progressDialog.isShowing()) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import android.widget.EditText;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
|
||||
|
@ -29,70 +30,71 @@ import java.util.Vector;
|
|||
public class LoginActivity extends AppCompatActivity implements View.OnClickListener, TextWatcher {
|
||||
|
||||
|
||||
// UI references.
|
||||
private EditText mUsernameView;
|
||||
private EditText mPasswordView;
|
||||
private TextView mRegisterButton;
|
||||
private Button mLoginButton;
|
||||
private final String TAG = "[TSN/LoginActivity]";
|
||||
private final String BASE_URL = "http://thesocialnotework-api.appspot.com/api";
|
||||
private final String LOGIN_PATH = "/login";
|
||||
private LoginActivity self; //this
|
||||
protected LinearLayout layout;
|
||||
// UI references.
|
||||
private EditText mUsernameView;
|
||||
private EditText mPasswordView;
|
||||
private TextView mRegisterButton;
|
||||
private Button mLoginButton;
|
||||
private final String TAG = "[TSN/LoginActivity]";
|
||||
private final String BASE_URL = "http://thesocialnotework-api.appspot.com/api";
|
||||
private final String LOGIN_PATH = "/login";
|
||||
private LoginActivity self; //this
|
||||
protected LinearLayout layout;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login);
|
||||
this.self = this;
|
||||
this.layout = (LinearLayout) findViewById(R.id.layout);
|
||||
this.mUsernameView = (EditText) findViewById(R.id.al_username);
|
||||
this.mUsernameView.addTextChangedListener(this);
|
||||
this.mPasswordView = (EditText) findViewById(R.id.al_password);
|
||||
this.mPasswordView.addTextChangedListener(this);
|
||||
removeFocuse();
|
||||
this.mRegisterButton = (TextView) findViewById(R.id.al_register_button);
|
||||
this.mRegisterButton.setOnClickListener(this);
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login);
|
||||
this.self = this;
|
||||
this.layout = (LinearLayout) findViewById(R.id.layout);
|
||||
this.mUsernameView = (EditText) findViewById(R.id.al_username);
|
||||
this.mUsernameView.addTextChangedListener(this);
|
||||
this.mPasswordView = (EditText) findViewById(R.id.al_password);
|
||||
this.mPasswordView.addTextChangedListener(this);
|
||||
removeFocuse();
|
||||
this.mRegisterButton = (TextView) findViewById(R.id.al_register_button);
|
||||
this.mRegisterButton.setOnClickListener(this);
|
||||
|
||||
this.mLoginButton = (Button) findViewById(R.id.al_login_button);
|
||||
this.mLoginButton.setOnClickListener(this);
|
||||
this.mLoginButton.setEnabled(false);
|
||||
this.mLoginButton = (Button) findViewById(R.id.al_login_button);
|
||||
this.mLoginButton.setOnClickListener(this);
|
||||
this.mLoginButton.setEnabled(false);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void removeFocuse() {
|
||||
// Remove Auto Focus from the Text Fields
|
||||
mUsernameView.clearFocus();
|
||||
mPasswordView.clearFocus();
|
||||
layout.setFocusable(true);
|
||||
layout.setFocusableInTouchMode(true);
|
||||
private void removeFocuse() {
|
||||
// Remove Auto Focus from the Text Fields
|
||||
mUsernameView.clearFocus();
|
||||
mPasswordView.clearFocus();
|
||||
layout.setFocusable(true);
|
||||
layout.setFocusableInTouchMode(true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Attempts to sign in or register the account specified by the login form.
|
||||
* If there are form errors (invalid email, missing fields, etc.), the
|
||||
* errors are presented and no actual login attempt is made.
|
||||
*/
|
||||
/**
|
||||
* Attempts to sign in or register the account specified by the login form.
|
||||
* If there are form errors (invalid email, missing fields, etc.), the
|
||||
* errors are presented and no actual login attempt is made.
|
||||
*/
|
||||
|
||||
private boolean isParamsValid(String username, String password) {
|
||||
Log.d(TAG, "user: " + username);
|
||||
Log.d(TAG, "pwd: " + password);
|
||||
private boolean isParamsValid(String username, String password) {
|
||||
Log.d(TAG, "user: " + username);
|
||||
Log.d(TAG, "pwd: " + password);
|
||||
|
||||
if(TextUtils.isEmpty(username) || !isUsernameValid(username) || TextUtils.isEmpty(password) || !isPasswordValid(password)) {
|
||||
if (TextUtils.isEmpty(username) || !isUsernameValid(username) || TextUtils.isEmpty(password) || !isPasswordValid(password)) {
|
||||
return false;
|
||||
} else{
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void attemptLogin() {
|
||||
Utils.showLoadingDialog(this, "Connecting", "Authenticating data");
|
||||
mPasswordView.setError(null);
|
||||
if (isParamsValid(mUsernameView.getText().toString(), mPasswordView.getText().toString())) {
|
||||
|
||||
String username = mUsernameView.getText().toString();
|
||||
String password = mPasswordView.getText().toString();
|
||||
String username = mUsernameView.getText().toString();
|
||||
String password = mPasswordView.getText().toString();
|
||||
|
||||
boolean cancel = false;
|
||||
// http request register
|
||||
|
@ -109,60 +111,60 @@ public class LoginActivity extends AppCompatActivity implements View.OnClickList
|
|||
Log.d(TAG, "Invalid params - make sure username exist & password is 4 characters or more");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Response.Listener<JSONObject> onLoginSuccess = new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
try {
|
||||
if (!response.isNull("user")) {
|
||||
Log.e(TAG, "onLoginSuccess => user exist"); // TODO: REMOVE console
|
||||
SharedPreferences sharedPref = self.getSharedPreferences(MainActivity.LOCAL_DATA_TSN, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sharedPref.edit();
|
||||
String id, password, email, avatar, username, likedNotes = "";
|
||||
|
||||
JSONArray likedNotes_JSON;
|
||||
id = response.getJSONObject("user").getString("id");
|
||||
password = response.getJSONObject("user").getString("password");
|
||||
username = response.getJSONObject("user").getString("username");
|
||||
avatar = response.getJSONObject("user").getString("avatar");
|
||||
email = response.getJSONObject("user").getString("email");
|
||||
likedNotes_JSON = response.getJSONObject("user").getJSONArray("liked_notes_id");
|
||||
for (int i = 0; i < likedNotes_JSON.length(); i++) {
|
||||
likedNotes += likedNotes_JSON.get(i);
|
||||
if (i != likedNotes_JSON.length() - 1) {
|
||||
likedNotes += User.LIKED_NOTES_DELIMETER;
|
||||
}
|
||||
}
|
||||
editor.putString("UserData", id+User.ATTARS_DELIMETER+username+User.ATTARS_DELIMETER+password+User.ATTARS_DELIMETER+email+User.ATTARS_DELIMETER+avatar+User.ATTARS_DELIMETER+likedNotes);
|
||||
editor.commit();
|
||||
Intent personalSpaceActivity = new Intent(LoginActivity.this, MainActivity.class);
|
||||
Bundle loginUserBundle = new Bundle();
|
||||
loginUserBundle.putString("UserData", id+User.ATTARS_DELIMETER+username+User.ATTARS_DELIMETER+password+User.ATTARS_DELIMETER+email+User.ATTARS_DELIMETER+avatar+User.ATTARS_DELIMETER+likedNotes);
|
||||
personalSpaceActivity.putExtras(loginUserBundle);
|
||||
Utils.dismissLoadingDialog();
|
||||
startActivity(personalSpaceActivity);
|
||||
} else {
|
||||
Utils.dismissLoadingDialog();
|
||||
Toast.makeText(self, "Username or Password are incorrect", Toast.LENGTH_LONG).show();
|
||||
self.mUsernameView.getText().clear();
|
||||
self.mPasswordView.getText().clear();
|
||||
self.removeFocuse();
|
||||
((TextView) findViewById(R.id.textView2)).setVisibility(View.INVISIBLE);
|
||||
Log.d(TAG, "No such user, " + response.get("user"));
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "onLoginSuccess:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Response.Listener<JSONObject> onLoginSuccess = new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
try {
|
||||
if (!response.isNull("user")) {
|
||||
Log.e(TAG, "onLoginSuccess => user exist"); // TODO: REMOVE console
|
||||
SharedPreferences sharedPref = self.getSharedPreferences(MainActivity.LOCAL_DATA_TSN, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sharedPref.edit();
|
||||
String id, password, email, avatar, username, likedNotes = "";
|
||||
|
||||
JSONArray likedNotes_JSON;
|
||||
id = response.getJSONObject("user").getString("id");
|
||||
password = response.getJSONObject("user").getString("password");
|
||||
username = response.getJSONObject("user").getString("username");
|
||||
avatar = response.getJSONObject("user").getString("avatar");
|
||||
email = response.getJSONObject("user").getString("email");
|
||||
likedNotes_JSON = response.getJSONObject("user").getJSONArray("liked_notes_id");
|
||||
for (int i = 0; i < likedNotes_JSON.length(); i++) {
|
||||
likedNotes += likedNotes_JSON.get(i);
|
||||
if (i != likedNotes_JSON.length() - 1) {
|
||||
likedNotes += User.LIKED_NOTES_DELIMETER;
|
||||
}
|
||||
}
|
||||
editor.putString("UserData", id + User.ATTARS_DELIMETER + username + User.ATTARS_DELIMETER + password + User.ATTARS_DELIMETER + email + User.ATTARS_DELIMETER + avatar + User.ATTARS_DELIMETER + likedNotes);
|
||||
editor.commit();
|
||||
Intent personalSpaceActivity = new Intent(LoginActivity.this, MainActivity.class);
|
||||
Bundle loginUserBundle = new Bundle();
|
||||
loginUserBundle.putString("UserData", id + User.ATTARS_DELIMETER + username + User.ATTARS_DELIMETER + password + User.ATTARS_DELIMETER + email + User.ATTARS_DELIMETER + avatar + User.ATTARS_DELIMETER + likedNotes);
|
||||
personalSpaceActivity.putExtras(loginUserBundle);
|
||||
Utils.dismissLoadingDialog();
|
||||
startActivity(personalSpaceActivity);
|
||||
} else {
|
||||
Utils.dismissLoadingDialog();
|
||||
Toast.makeText(self, "Username or Password are incorrect", Toast.LENGTH_LONG).show();
|
||||
self.mUsernameView.getText().clear();
|
||||
self.mPasswordView.getText().clear();
|
||||
self.removeFocuse();
|
||||
((TextView) findViewById(R.id.textView2)).setVisibility(View.INVISIBLE);
|
||||
Log.d(TAG, "No such user, " + response.get("user"));
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "onLoginSuccess:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Response.ErrorListener onLoginError = new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Utils.dismissLoadingDialog();
|
||||
Toast.makeText(self , "Username Or Password Incorrect", Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(self, "Username Or Password Incorrect", Toast.LENGTH_LONG).show();
|
||||
//Clean texts
|
||||
self.mUsernameView.getText().clear();
|
||||
self.mPasswordView.getText().clear();
|
||||
|
@ -173,50 +175,50 @@ public class LoginActivity extends AppCompatActivity implements View.OnClickList
|
|||
};
|
||||
|
||||
|
||||
private boolean isUsernameValid(String username) {
|
||||
return username.length() > 0;
|
||||
}
|
||||
|
||||
private boolean isPasswordValid(String password) {
|
||||
return password.length() > 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.al_login_button:
|
||||
//Do Login
|
||||
Log.d(TAG, "Login.......");
|
||||
attemptLogin();
|
||||
break;
|
||||
case R.id.al_register_button:
|
||||
//Do Register
|
||||
Log.d(TAG, "going to Register...page");
|
||||
Intent registerActivity = new Intent(LoginActivity.this, RegisterActivity.class);
|
||||
startActivity(registerActivity);
|
||||
break;
|
||||
private boolean isUsernameValid(String username) {
|
||||
return username.length() > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
if (isParamsValid(mUsernameView.getText().toString(), mPasswordView.getText().toString())) {
|
||||
((TextView) findViewById(R.id.textView2)).setVisibility(View.INVISIBLE);
|
||||
mLoginButton.setEnabled(true);
|
||||
} else {
|
||||
((TextView) findViewById(R.id.textView2)).setVisibility(View.VISIBLE);
|
||||
mLoginButton.setEnabled(false);
|
||||
private boolean isPasswordValid(String password) {
|
||||
return password.length() > 3;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.al_login_button:
|
||||
//Do Login
|
||||
Log.d(TAG, "Login.......");
|
||||
attemptLogin();
|
||||
break;
|
||||
case R.id.al_register_button:
|
||||
//Do Register
|
||||
Log.d(TAG, "going to Register...page");
|
||||
Intent registerActivity = new Intent(LoginActivity.this, RegisterActivity.class);
|
||||
startActivity(registerActivity);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
if (isParamsValid(mUsernameView.getText().toString(), mPasswordView.getText().toString())) {
|
||||
((TextView) findViewById(R.id.textView2)).setVisibility(View.INVISIBLE);
|
||||
mLoginButton.setEnabled(true);
|
||||
} else {
|
||||
((TextView) findViewById(R.id.textView2)).setVisibility(View.VISIBLE);
|
||||
mLoginButton.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,9 +3,11 @@ package com.android_app.matan.ara.sagi.thesocialnotework;
|
|||
/**
|
||||
* Created by aran on 5/26/16.
|
||||
*/
|
||||
import com.android.volley.toolbox.ImageLoader.ImageCache;
|
||||
import android.graphics.Bitmap;
|
||||
import android.support.v4.util.LruCache;
|
||||
|
||||
import com.android.volley.toolbox.ImageLoader.ImageCache;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.support.v4.util.LruCache;
|
||||
|
||||
/**
|
||||
* A class to extend the LruCache class - for better image caching
|
||||
|
|
|
@ -10,13 +10,16 @@ import android.widget.Button;
|
|||
import android.widget.EditText;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class RegisterActivity extends AppCompatActivity implements View.OnClickListener{
|
||||
public class RegisterActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
private EditText mUsernameView;
|
||||
private EditText mPasswordView;
|
||||
|
@ -58,12 +61,14 @@ public class RegisterActivity extends AppCompatActivity implements View.OnClickL
|
|||
private boolean isUsernameValid(String username) {
|
||||
return !TextUtils.isEmpty(username) && username.length() > 0;
|
||||
}
|
||||
|
||||
private boolean isPasswordValid(String password) {
|
||||
return !TextUtils.isEmpty(password) && password.length() > 3;
|
||||
}
|
||||
|
||||
private boolean isEmailValid(String email) {
|
||||
if(TextUtils.isEmpty(email))
|
||||
return false;
|
||||
if (TextUtils.isEmpty(email))
|
||||
return false;
|
||||
String expression = "^[\\w\\.-]+@([\\w\\-]+\\.)+[A-Z]{2,4}$";
|
||||
Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
|
||||
Matcher matcher = pattern.matcher(email);
|
||||
|
@ -91,7 +96,7 @@ public class RegisterActivity extends AppCompatActivity implements View.OnClickL
|
|||
} catch (Exception e) {
|
||||
Log.d(TAG, e.toString());
|
||||
}
|
||||
Log.d(TAG,"JSON: "+tempJson.toString());
|
||||
Log.d(TAG, "JSON: " + tempJson.toString());
|
||||
VolleyUtilSingleton.getInstance(RegisterActivity.this).post(BASE_URL + REG_PATH, tempJson, onRegisterSuccess, onRegisterError);
|
||||
} else {
|
||||
Utils.dismissLoadingDialog();
|
||||
|
@ -103,19 +108,19 @@ public class RegisterActivity extends AppCompatActivity implements View.OnClickL
|
|||
Response.Listener<JSONObject> onRegisterSuccess = new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
Log.d(TAG,"response: "+ response.toString());
|
||||
Log.d(TAG, "response: " + response.toString());
|
||||
Utils.dismissLoadingDialog();
|
||||
try {
|
||||
if(response.getString("message").equals("created")) {
|
||||
if (response.getString("message").equals("created")) {
|
||||
Log.d(TAG, "onRegisterSuccess => user created"); // TODO: REMOVE console
|
||||
Intent loginActivity = new Intent(RegisterActivity.this, LoginActivity.class);
|
||||
Toast.makeText(self, "You are now a social notework member - You May Login...", Toast.LENGTH_LONG).show();
|
||||
startActivity(loginActivity);
|
||||
} else {
|
||||
Toast.makeText(self , "Username is already taken. maybe: " + mUsernameView.getText().toString()+"_666 ? :)", Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(self, "Username is already taken. maybe: " + mUsernameView.getText().toString() + "_666 ? :)", Toast.LENGTH_LONG).show();
|
||||
Log.d(TAG, "Cannot create user, " + response.getString("message"));
|
||||
}
|
||||
}catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "onRegisterSuccess:" + e.getMessage());
|
||||
|
||||
}
|
||||
|
@ -126,14 +131,14 @@ public class RegisterActivity extends AppCompatActivity implements View.OnClickL
|
|||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Utils.dismissLoadingDialog();
|
||||
Toast.makeText(self , "Username is already taken. maybe: " + mUsernameView.getText().toString()+"_666 ? :)", Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(self, "Username is already taken. maybe: " + mUsernameView.getText().toString() + "_666 ? :)", Toast.LENGTH_LONG).show();
|
||||
Log.d(TAG, "onRegisterError: msg: " + error.getMessage());
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
switch(view.getId()){
|
||||
switch (view.getId()) {
|
||||
case R.id.ra_register_button:
|
||||
attemptRegister();
|
||||
break;
|
||||
|
@ -143,7 +148,7 @@ public class RegisterActivity extends AppCompatActivity implements View.OnClickL
|
|||
}
|
||||
}
|
||||
|
||||
private void returnToLogin(){
|
||||
private void returnToLogin() {
|
||||
Intent i = new Intent(RegisterActivity.this, LoginActivity.class);
|
||||
startActivity(i);
|
||||
finish();
|
||||
|
|
|
@ -30,8 +30,6 @@ public class Utils {
|
|||
public static ProgressDialog progress;
|
||||
|
||||
|
||||
|
||||
|
||||
public static Bitmap getBitmapFromURL(String imageUrl) {
|
||||
|
||||
try {
|
||||
|
@ -74,7 +72,6 @@ public class Utils {
|
|||
}
|
||||
|
||||
|
||||
|
||||
public static Note getNoteFromJsonObj(JSONObject noteObject, Date time) throws JSONException {
|
||||
// List<Note> listOfNotes = new ArrayList<>();
|
||||
|
||||
|
|
Loading…
Reference in a new issue