Commit 99ed65ef by Kunj Gupta

UOFLMA-85 Fix : Login Screen, changed progress bar loading string.

parent 89670068
...@@ -21,6 +21,7 @@ import com.vsoft.uoflservicenow.api.managers.LoginApiManger; ...@@ -21,6 +21,7 @@ import com.vsoft.uoflservicenow.api.managers.LoginApiManger;
import com.vsoft.uoflservicenow.api.managers.UserApiManager; import com.vsoft.uoflservicenow.api.managers.UserApiManager;
import com.vsoft.uoflservicenow.db.models.UserApiValues; import com.vsoft.uoflservicenow.db.models.UserApiValues;
import com.vsoft.uoflservicenow.enums.SyncStatus; import com.vsoft.uoflservicenow.enums.SyncStatus;
import com.vsoft.uoflservicenow.utils.CatalogueLog;
import com.vsoft.uoflservicenow.utils.Constants; import com.vsoft.uoflservicenow.utils.Constants;
import com.vsoft.uoflservicenow.utils.DialogUtils; import com.vsoft.uoflservicenow.utils.DialogUtils;
import com.vsoft.uoflservicenow.utils.KeyboardUtil; import com.vsoft.uoflservicenow.utils.KeyboardUtil;
...@@ -114,8 +115,9 @@ public class LoginScreen extends Activity { ...@@ -114,8 +115,9 @@ public class LoginScreen extends Activity {
callLoginAPI(); callLoginAPI();
} }
private class LoginDetailsSendToServer extends AsyncTask<String, Void, SyncStatus> { private class LoginDetailsSendToServer extends AsyncTask<String, Integer, SyncStatus> {
private ProgressDialog progressDialog; private ProgressDialog progressDialog;
private static final int USER_DETAIL = 1;
private String userName; private String userName;
...@@ -123,7 +125,7 @@ public class LoginScreen extends Activity { ...@@ -123,7 +125,7 @@ public class LoginScreen extends Activity {
protected void onPreExecute() { protected void onPreExecute() {
super.onPreExecute(); super.onPreExecute();
progressDialog = new ProgressDialog(LoginScreen.this); progressDialog = new ProgressDialog(LoginScreen.this);
progressDialog.setMessage(getString(R.string.loading_string)); progressDialog.setMessage(getString(R.string.login_screen_logging_in_loading_string));
progressDialog.show(); progressDialog.show();
progressDialog.setCancelable(false); progressDialog.setCancelable(false);
} }
...@@ -139,6 +141,7 @@ public class LoginScreen extends Activity { ...@@ -139,6 +141,7 @@ public class LoginScreen extends Activity {
if (syncStatus != null) { if (syncStatus != null) {
if (syncStatus == SyncStatus.SUCCESS) { if (syncStatus == SyncStatus.SUCCESS) {
publishProgress(USER_DETAIL);
return UserApiManager.getUserDetailResponse(userName, new GetUserApiListener() { return UserApiManager.getUserDetailResponse(userName, new GetUserApiListener() {
@Override @Override
public void onDoneApiCall(List<UserApiValues> userValues) { public void onDoneApiCall(List<UserApiValues> userValues) {
...@@ -157,19 +160,28 @@ public class LoginScreen extends Activity { ...@@ -157,19 +160,28 @@ public class LoginScreen extends Activity {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
Toast.makeText(LoginScreen.this, R.string.login_screen_invalid_usernane_and_password_string, Toast.LENGTH_LONG).show(); Toast.makeText(LoginScreen.this, R.string.login_screen_invalid_username_and_password_string, Toast.LENGTH_LONG).show();
} }
}); });
} }
} }
} catch (Exception e) { } catch (Exception e) {
CatalogueLog.e("LoginScreen: LoginDetailsSendToServer: doInBackground: Exception: "+e);
} }
return syncStatus; return syncStatus;
} }
@Override @Override
protected void onProgressUpdate(Integer... values) {
super.onProgressUpdate(values);
if(values[0] == USER_DETAIL) {
progressDialog.setMessage(getString(R.string.login_screen_getting_user_detail_loading_string));
}
}
@Override
protected void onPostExecute(SyncStatus syncStatus) { protected void onPostExecute(SyncStatus syncStatus) {
super.onPostExecute(syncStatus); super.onPostExecute(syncStatus);
if (progressDialog != null && progressDialog.isShowing()) { if (progressDialog != null && progressDialog.isShowing()) {
......
...@@ -38,7 +38,9 @@ ...@@ -38,7 +38,9 @@
<!--Login Screen--> <!--Login Screen-->
<string name="login_screen_login_string">Login</string> <string name="login_screen_login_string">Login</string>
<string name="login_screen_invalid_usernane_and_password_string">Invalid username and password</string> <string name="login_screen_logging_in_loading_string">Logging in&#8230;</string>
<string name="login_screen_getting_user_detail_loading_string">Getting user details&#8230;</string>
<string name="login_screen_invalid_username_and_password_string">Invalid username and password</string>
<string name="server_not_reachable">Unable to connect to server. Please try again later.</string> <string name="server_not_reachable">Unable to connect to server. Please try again later.</string>
<string name="user_detail_not_available">Unable to fetch user details.</string> <string name="user_detail_not_available">Unable to fetch user details.</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment