Commit 75cdefb7 by npadhy

login screen in error messages and network status find

parents 2f329ed7 2831476e
Showing with 482 additions and 97 deletions
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -34,7 +34,7 @@ android { ...@@ -34,7 +34,7 @@ android {
minSdkVersion 15 minSdkVersion 15
targetSdkVersion 24 targetSdkVersion 24
versionCode 1 versionCode 1
versionName "0.0.6" versionName "0.0.7"
multiDexEnabled true multiDexEnabled true
} }
buildTypes { buildTypes {
......
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'android-apt'
android {
signingConfigs {
config {
keyAlias 'androiddebugkey'
keyPassword 'android'
storeFile file('/home/chaukadev/.android/debug.keystore')
storePassword 'android'
}
}
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.vsoft.uoflservicenow"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "0.0.7"
multiDexEnabled true
}
buildTypes {
debug {
applicationIdSuffix ".debug"
buildConfigField "int", "BUILD_TYPE_INT", "1"
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "int", "BUILD_TYPE_INT", "2"
signingConfig signingConfigs.config
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.squareup.retrofit2:retrofit:2.0.1'
compile 'com.squareup.retrofit2:converter-gson:2.0.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'
compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:1.0.1'
compile 'com.google.android.gms:play-services-analytics:9.2.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.2@aar') {
transitive = true;
}
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'android-apt'
android {
signingConfigs {
config {
keyAlias 'androiddebugkey'
keyPassword 'android'
storeFile file('/home/chaukadev/.android/debug.keystore')
storePassword 'android'
}
}
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.vsoft.uoflservicenow"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "0.0.5"
multiDexEnabled true
}
buildTypes {
debug {
applicationIdSuffix ".debug"
buildConfigField "int", "BUILD_TYPE_INT", "1"
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "int", "BUILD_TYPE_INT", "2"
signingConfig signingConfigs.config
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.squareup.retrofit2:retrofit:2.0.1'
compile 'com.squareup.retrofit2:converter-gson:2.0.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'
compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:1.0.1'
compile 'com.google.android.gms:play-services-analytics:9.2.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.2@aar') {
transitive = true;
}
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'android-apt'
android {
signingConfigs {
config {
keyAlias 'androiddebugkey'
keyPassword 'android'
storeFile file('/home/chaukadev/.android/debug.keystore')
storePassword 'android'
}
}
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.vsoft.uoflservicenow"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "0.0.6"
multiDexEnabled true
}
buildTypes {
debug {
applicationIdSuffix ".debug"
buildConfigField "int", "BUILD_TYPE_INT", "1"
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "int", "BUILD_TYPE_INT", "2"
signingConfig signingConfigs.config
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.squareup.retrofit2:retrofit:2.0.1'
compile 'com.squareup.retrofit2:converter-gson:2.0.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'
compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:1.0.1'
compile 'com.google.android.gms:play-services-analytics:9.2.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.2@aar') {
transitive = true;
}
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'android-apt'
android {
signingConfigs {
config {
keyAlias 'androiddebugkey'
keyPassword 'android'
storeFile file('/home/chaukadev/.android/debug.keystore')
storePassword 'android'
}
}
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.vsoft.uoflservicenow"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "0.0.7"
multiDexEnabled true
}
buildTypes {
debug {
applicationIdSuffix ".debug"
buildConfigField "int", "BUILD_TYPE_INT", "1"
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "int", "BUILD_TYPE_INT", "2"
signingConfig signingConfigs.config
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.squareup.retrofit2:retrofit:2.0.1'
compile 'com.squareup.retrofit2:converter-gson:2.0.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'
compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:1.0.1'
compile 'com.google.android.gms:play-services-analytics:9.2.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.2@aar') {
transitive = true;
}
}
...@@ -9,6 +9,7 @@ import android.widget.TextView; ...@@ -9,6 +9,7 @@ import android.widget.TextView;
import com.vsoft.uoflservicenow.R; import com.vsoft.uoflservicenow.R;
import com.vsoft.uoflservicenow.db.models.Incident; import com.vsoft.uoflservicenow.db.models.Incident;
import com.vsoft.uoflservicenow.utils.Util;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -68,7 +69,7 @@ public class MyIncidentsAdapter extends BaseAdapter { ...@@ -68,7 +69,7 @@ public class MyIncidentsAdapter extends BaseAdapter {
Incident incident = mIncidentList.get(position); Incident incident = mIncidentList.get(position);
holder.numberTextView.setText(incident.getNumber()); holder.numberTextView.setText(incident.getNumber());
holder.dateTextView.setText(incident.getOpenedAt()); holder.dateTextView.setText(Util.getDateTimeFromLong(incident.getOpenedAt()));
holder.shortDesTextView.setText(incident.getShortDescription()); holder.shortDesTextView.setText(incident.getShortDescription());
return convertView; return convertView;
......
...@@ -93,8 +93,7 @@ public class CatalogueVariableApiManager { ...@@ -93,8 +93,7 @@ public class CatalogueVariableApiManager {
JSONObject variableJsonObject = catalogueVariableJsonArray.getJSONObject(i); JSONObject variableJsonObject = catalogueVariableJsonArray.getJSONObject(i);
CatalogueVariable catalogueVariable = gson.fromJson(variableJsonObject.toString(), CatalogueVariable.class); CatalogueVariable catalogueVariable = gson.fromJson(variableJsonObject.toString(), CatalogueVariable.class);
catalogueVariable.parseJson(variableJsonObject); catalogueVariable.parseJson(variableJsonObject);
// if(catalogueVariable.getName()!=null) catalogueVariableList.add(catalogueVariable);
catalogueVariableList.add(catalogueVariable);
} }
listener.onDoneApiCall(catalogueVariableList); listener.onDoneApiCall(catalogueVariableList);
} else { } else {
......
...@@ -17,7 +17,6 @@ import java.util.List; ...@@ -17,7 +17,6 @@ import java.util.List;
* Created by Kunj on 12/8/16. * Created by Kunj on 12/8/16.
*/ */
public class CatalogueVariable { public class CatalogueVariable {
private long catalogue_item_id = -1;
@SerializedName("name") @SerializedName("name")
@Expose @Expose
...@@ -37,6 +36,9 @@ public class CatalogueVariable { ...@@ -37,6 +36,9 @@ public class CatalogueVariable {
@SerializedName("reference_table") @SerializedName("reference_table")
@Expose @Expose
private String referenceTable; private String referenceTable;
@SerializedName("order")
@Expose
private int order;
// @SerializedName("type") // @SerializedName("type")
// @Expose // @Expose
...@@ -44,14 +46,6 @@ public class CatalogueVariable { ...@@ -44,14 +46,6 @@ public class CatalogueVariable {
private List<VariableChoice> mVariableChoiceList; private List<VariableChoice> mVariableChoiceList;
public long getCatalogueItemId() {
return catalogue_item_id;
}
public void setCatalogueItemId(long catalogue_item_id) {
this.catalogue_item_id = catalogue_item_id;
}
/** /**
* *
* @return * @return
...@@ -148,6 +142,14 @@ public class CatalogueVariable { ...@@ -148,6 +142,14 @@ public class CatalogueVariable {
this.referenceTable = referenceTable; this.referenceTable = referenceTable;
} }
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public List<VariableChoice> getVariableChoiceList() { public List<VariableChoice> getVariableChoiceList() {
return mVariableChoiceList; return mVariableChoiceList;
} }
...@@ -202,18 +204,19 @@ public class CatalogueVariable { ...@@ -202,18 +204,19 @@ public class CatalogueVariable {
public static class Json { public static class Json {
public static final String SYS_ID = "sys_id"; public static final String SYS_ID = "sys_id";
public static final String TYPE = "type"; public static final String TYPE = "type";
public static final String ORDER = "order";
} }
@Override @Override
public String toString() { public String toString() {
return "CatalogueVariable{" + return "CatalogueVariable{" +
", catalogue_item_id=" + catalogue_item_id + "name='" + name + '\'' +
", name='" + name + '\'' +
", questionText='" + questionText + '\'' + ", questionText='" + questionText + '\'' +
", sysId='" + sysId + '\'' + ", sysId='" + sysId + '\'' +
", mandatory=" + mandatory + ", mandatory=" + mandatory +
", isNoneRequired=" + isNoneRequired + ", isNoneRequired=" + isNoneRequired +
", referenceTable='" + referenceTable + '\'' + ", referenceTable='" + referenceTable + '\'' +
", order=" + order +
", type=" + type + ", type=" + type +
", mVariableChoiceList=" + mVariableChoiceList + ", mVariableChoiceList=" + mVariableChoiceList +
'}'; '}';
......
...@@ -21,7 +21,7 @@ public class Incident { ...@@ -21,7 +21,7 @@ public class Incident {
private String shortDescription; private String shortDescription;
@SerializedName("opened_at") @SerializedName("opened_at")
// @Expose // @Expose
private String openedAt; private long openedAt;
@SerializedName("impact") @SerializedName("impact")
// @Expose // @Expose
private Impact impact; private Impact impact;
...@@ -34,11 +34,11 @@ public class Incident { ...@@ -34,11 +34,11 @@ public class Incident {
this.impact = impact; this.impact = impact;
} }
public String getOpenedAt() { public long getOpenedAt() {
return openedAt; return openedAt;
} }
public void setOpenedAt(String openedAt) { public void setOpenedAt(long openedAt) {
this.openedAt = openedAt; this.openedAt = openedAt;
} }
...@@ -68,7 +68,7 @@ public class Incident { ...@@ -68,7 +68,7 @@ public class Incident {
e.printStackTrace(); e.printStackTrace();
} }
this.setOpenedAt(Util.getDateTime(openedAt)); this.setOpenedAt(Util.getDateTimeForMyIncidentFromString(openedAt));
this.setImpact(Impact.from(impact)); this.setImpact(Impact.from(impact));
} }
......
...@@ -47,20 +47,11 @@ public enum Impact { ...@@ -47,20 +47,11 @@ public enum Impact {
} }
public static Impact from(int id) { public static Impact from(int id) {
for(int i = 0; i< Impact.values().length; i++) { for(int i = 0; i < Impact.values().length; i++) {
Impact impact = Impact.values()[i]; Impact impact = Impact.values()[i];
if(impact.id == id) if(impact.id == id)
return Impact.values()[i]; return Impact.values()[i];
} }
return UNKNOWN; return UNKNOWN;
} }
public static Impact from(String string) {
for(int i = 0; i< Impact.values().length; i++) {
Impact impact = Impact.values()[i];
if(impact.displayString.equals(string))
return Impact.values()[i];
}
return UNKNOWN;
}
} }
...@@ -49,6 +49,8 @@ import org.json.JSONException; ...@@ -49,6 +49,8 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List; import java.util.List;
import butterknife.BindView; import butterknife.BindView;
...@@ -133,6 +135,14 @@ public class CatalogueVariableScreen extends AppCompatActivity { ...@@ -133,6 +135,14 @@ public class CatalogueVariableScreen extends AppCompatActivity {
@Override @Override
public void onDoneApiCall(List<CatalogueVariable> catalogueVariableList) { public void onDoneApiCall(List<CatalogueVariable> catalogueVariableList) {
CatalogueLog.e("Data: catalogueVariableList: " + catalogueVariableList); CatalogueLog.e("Data: catalogueVariableList: " + catalogueVariableList);
Collections.sort(catalogueVariableList, new Comparator<CatalogueVariable>() {
@Override
public int compare(CatalogueVariable lhs, CatalogueVariable rhs) {
return (lhs.getOrder() - rhs.getOrder());
}
});
mCatalogueVariableList = catalogueVariableList; mCatalogueVariableList = catalogueVariableList;
if(!catalogueVariableList.isEmpty()) { if(!catalogueVariableList.isEmpty()) {
...@@ -211,7 +221,7 @@ public class CatalogueVariableScreen extends AppCompatActivity { ...@@ -211,7 +221,7 @@ public class CatalogueVariableScreen extends AppCompatActivity {
for (int i = 0; i < mCatalogueVariableList.size(); i++) { for (int i = 0; i < mCatalogueVariableList.size(); i++) {
CatalogueVariable catalogueVariable = mCatalogueVariableList.get(i); CatalogueVariable catalogueVariable = mCatalogueVariableList.get(i);
ViewType viewType = catalogueVariable.getType(); ViewType viewType = catalogueVariable.getType();
CatalogueLog.e("viewType: " + viewType); CatalogueLog.e("viewType: " + viewType + ", Order: "+catalogueVariable.getOrder());
if (catalogueVariable.getName() == null) { if (catalogueVariable.getName() == null) {
TextView nameNullView = new TextView(CatalogueVariableScreen.this); TextView nameNullView = new TextView(CatalogueVariableScreen.this);
nameNullView.setText(R.string.name_null_view_string); nameNullView.setText(R.string.name_null_view_string);
......
...@@ -4,6 +4,7 @@ import android.app.Activity; ...@@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.widget.GridView; import android.widget.GridView;
import com.google.android.gms.analytics.Tracker; import com.google.android.gms.analytics.Tracker;
...@@ -20,6 +21,8 @@ import butterknife.OnItemClick; ...@@ -20,6 +21,8 @@ import butterknife.OnItemClick;
* Created by Kunj on 11/8/16. * Created by Kunj on 11/8/16.
*/ */
public class HomeScreen extends Activity { public class HomeScreen extends Activity {
@BindView(R.id.tool_bar_view)
Toolbar mToolbar;
@BindView(R.id.home_screen_grid_view) GridView mGridView; @BindView(R.id.home_screen_grid_view) GridView mGridView;
@Override @Override
...@@ -29,9 +32,7 @@ public class HomeScreen extends Activity { ...@@ -29,9 +32,7 @@ public class HomeScreen extends Activity {
setContentView(R.layout.home_screen); setContentView(R.layout.home_screen);
ButterKnife.bind(this); ButterKnife.bind(this);
CatalogueApplication application = (CatalogueApplication) getApplication(); CatalogueApplication application = (CatalogueApplication) getApplication();
Tracker tracker = application.getDefaultTracker(); Tracker tracker = application.getDefaultTracker();
// Send initial screen view hit. // Send initial screen view hit.
Util.sendScreenName(tracker, getString(R.string.home_screen_string)); Util.sendScreenName(tracker, getString(R.string.home_screen_string));
......
...@@ -8,10 +8,12 @@ import android.content.SharedPreferences; ...@@ -8,10 +8,12 @@ import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ScrollView; import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.google.android.gms.analytics.Tracker; import com.google.android.gms.analytics.Tracker;
...@@ -22,7 +24,9 @@ import com.vsoft.uoflservicenow.api.managers.LoginApiManger; ...@@ -22,7 +24,9 @@ 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.Constants;
import com.vsoft.uoflservicenow.utils.KeyboardUtil; import com.vsoft.uoflservicenow.utils.KeyboardUtil;
import com.vsoft.uoflservicenow.utils.NetworkUtil;
import com.vsoft.uoflservicenow.utils.PrefManager; import com.vsoft.uoflservicenow.utils.PrefManager;
import com.vsoft.uoflservicenow.utils.Util; import com.vsoft.uoflservicenow.utils.Util;
...@@ -34,6 +38,7 @@ import java.util.List; ...@@ -34,6 +38,7 @@ import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import butterknife.internal.Utils;
/** /**
* Created by Kunj on 11/8/16. * Created by Kunj on 11/8/16.
...@@ -43,6 +48,8 @@ public class LoginScreen extends Activity { ...@@ -43,6 +48,8 @@ public class LoginScreen extends Activity {
@BindView(R.id.login_screen_username_edit_text) @BindView(R.id.login_screen_username_edit_text)
EditText userName; EditText userName;
@BindView(R.id.errormessage)
TextView errorMessage;
@BindView(R.id.login_screen_password_edit_text) @BindView(R.id.login_screen_password_edit_text)
EditText password; EditText password;
@BindView(R.id.login_scroll) @BindView(R.id.login_scroll)
...@@ -50,8 +57,7 @@ public class LoginScreen extends Activity { ...@@ -50,8 +57,7 @@ public class LoginScreen extends Activity {
private List<UserApiValues> mUserDetails; private List<UserApiValues> mUserDetails;
private PrefManager prefManager; private PrefManager prefManager;
private String userNameStrng, passwordStrng; private String userNameStrng, passwordStrng;
private String firstName, lastName, sysId; private String sysId;
private boolean isShow;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -61,7 +67,7 @@ public class LoginScreen extends Activity { ...@@ -61,7 +67,7 @@ public class LoginScreen extends Activity {
prefManager = PrefManager.getInstance(); prefManager = PrefManager.getInstance();
prefManager.init(LoginScreen.this); prefManager.init(LoginScreen.this);
ButterKnife.bind(this); ButterKnife.bind(this);
// CheckLoginValues(); CheckLoginValues();
KeyboardVisibilityEvent.setEventListener(LoginScreen.this, new KeyboardVisibilityEventListener() { KeyboardVisibilityEvent.setEventListener(LoginScreen.this, new KeyboardVisibilityEventListener() {
@Override @Override
...@@ -98,18 +104,25 @@ public class LoginScreen extends Activity { ...@@ -98,18 +104,25 @@ public class LoginScreen extends Activity {
userNameStrng = userName.getText().toString().trim(); userNameStrng = userName.getText().toString().trim();
passwordStrng = password.getText().toString().trim(); passwordStrng = password.getText().toString().trim();
if (TextUtils.isEmpty(userNameStrng)) { if (TextUtils.isEmpty(userNameStrng)) {
userName.setError(getResources().getString(R.string.user_error)); userName.setError(getResources().getString(R.string.user_error));
return;
} else if (!TextUtils.isEmpty(userNameStrng) && !TextUtils.isEmpty(passwordStrng)) {
KeyboardUtil.hideKeyboard(LoginScreen.this);
new LoginDetailsSendToServer().execute(userName.getText().toString().trim(), password.getText().toString().trim());
} }
if (TextUtils.isEmpty(passwordStrng)) {
password.setError(getResources().getString(R.string.pasw_error));
}
if (!TextUtils.isEmpty(userNameStrng) && !TextUtils.isEmpty(passwordStrng)) {
KeyboardUtil.hideKeyboard(LoginScreen.this);
boolean networkStatus = NetworkUtil.getConnectivityStatus(getApplicationContext());
if (networkStatus) {
new LoginDetailsSendToServer().execute(userName.getText().toString().trim(), password.getText().toString().trim());
} else {
errorMessage.setVisibility(View.VISIBLE);
errorMessage.setText("No NetWork Connection");
}
}
} }
class LoginDetailsSendToServer extends AsyncTask<String, Void, SyncStatus> { private class LoginDetailsSendToServer extends AsyncTask<String, Void, SyncStatus> {
private ProgressDialog progressDialog; private ProgressDialog progressDialog;
private String userName; private String userName;
...@@ -125,12 +138,11 @@ public class LoginScreen extends Activity { ...@@ -125,12 +138,11 @@ public class LoginScreen extends Activity {
@Override @Override
protected SyncStatus doInBackground(String... params) { protected SyncStatus doInBackground(String... params) {
String grantType = "password";
String clientId = "ac0dd3408c1031006907010c2cc6ef6d";
String clientSecret = "oklj6znxv3o9jmyn2mlp";
userName = params[0];//"a0kuma18"; userName = params[0];//"a0kuma18";
String password = params[1];//"v$0ftA$win"; String password = params[1];//"v$0ftA$win";
return LoginApiManger.submitLoginValues(grantType, clientId, clientSecret, userName, password); return LoginApiManger.submitLoginValues(Constants.GRANT_TYPE, Constants.CLIENT_ID, Constants
.CLIENT_SECRET, userName,
password);
} }
@Override @Override
...@@ -142,11 +154,13 @@ public class LoginScreen extends Activity { ...@@ -142,11 +154,13 @@ public class LoginScreen extends Activity {
if (syncStatus == SyncStatus.SUCCESS) { if (syncStatus == SyncStatus.SUCCESS) {
new UserApiDetails().execute(userName); new UserApiDetails().execute(userName);
} else { } else {
Toast.makeText(LoginScreen.this, "Invalid username and password", Toast.LENGTH_SHORT).show(); errorMessage.setVisibility(View.VISIBLE);
errorMessage.setText("Invalid username and password");
// Toast.makeText(LoginScreen.this, "Invalid username and password", Toast.LENGTH_SHORT).show();
} }
} }
class UserApiDetails extends AsyncTask<String, Void, SyncStatus> { private class UserApiDetails extends AsyncTask<String, Void, SyncStatus> {
private ProgressDialog progressDialog; private ProgressDialog progressDialog;
@Override @Override
...@@ -184,8 +198,6 @@ public class LoginScreen extends Activity { ...@@ -184,8 +198,6 @@ public class LoginScreen extends Activity {
startActivity(new Intent(LoginScreen.this, HomeScreen.class)); startActivity(new Intent(LoginScreen.this, HomeScreen.class));
finish(); finish();
} }
} else {
Toast.makeText(LoginScreen.this, "Invalid username and password", Toast.LENGTH_SHORT).show();
} }
} }
} }
......
...@@ -22,6 +22,8 @@ import com.vsoft.uoflservicenow.enums.SyncStatus; ...@@ -22,6 +22,8 @@ import com.vsoft.uoflservicenow.enums.SyncStatus;
import com.vsoft.uoflservicenow.utils.CatalogueLog; import com.vsoft.uoflservicenow.utils.CatalogueLog;
import com.vsoft.uoflservicenow.utils.Util; import com.vsoft.uoflservicenow.utils.Util;
import java.util.Collections;
import java.util.Comparator;
import java.util.List; import java.util.List;
import butterknife.BindView; import butterknife.BindView;
...@@ -134,10 +136,19 @@ public class MyIncidentScreen extends AppCompatActivity { ...@@ -134,10 +136,19 @@ public class MyIncidentScreen extends AppCompatActivity {
private void setData(final List<Incident> catalogueList) { private void setData(final List<Incident> catalogueList) {
MyIncidentsAdapter adapter = new MyIncidentsAdapter(MyIncidentScreen.this); MyIncidentsAdapter adapter = new MyIncidentsAdapter(MyIncidentScreen.this);
Collections.sort(catalogueList, new StringDateComparator());
adapter.setIncidentList(catalogueList); adapter.setIncidentList(catalogueList);
mListView.setAdapter(adapter); mListView.setAdapter(adapter);
} }
class StringDateComparator implements Comparator<Incident> {
public int compare(Incident lhs, Incident rhs) {
return lhs.getOpenedAt()>rhs.getOpenedAt() ? -1 : 1;
}
}
@Override @Override
public boolean onOptionsItemSelected(MenuItem menuItem) { public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() == android.R.id.home) { if (menuItem.getItemId() == android.R.id.home) {
......
...@@ -51,8 +51,9 @@ public class MyRequestActivity extends AppCompatActivity { ...@@ -51,8 +51,9 @@ public class MyRequestActivity extends AppCompatActivity {
setSupportActionBar(mToolbar); setSupportActionBar(mToolbar);
ActionBar actionBar = getSupportActionBar(); ActionBar actionBar = getSupportActionBar();
if (actionBar != null) { if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setElevation(0); actionBar.setElevation(0);
actionBar.setTitle(""); actionBar.setTitle(R.string.my_reques_string);
actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayShowTitleEnabled(true);
} }
...@@ -68,10 +69,6 @@ public class MyRequestActivity extends AppCompatActivity { ...@@ -68,10 +69,6 @@ public class MyRequestActivity extends AppCompatActivity {
} }
} }
@OnClick(R.id.nav_back)
public void backButtonClick() {
finish();
}
class FetchMyRequestData extends AsyncTask<String, Void, SyncStatus> { class FetchMyRequestData extends AsyncTask<String, Void, SyncStatus> {
private ProgressDialog progressDialog; private ProgressDialog progressDialog;
......
...@@ -74,14 +74,17 @@ public class ReportIncidentScreen extends AppCompatActivity { ...@@ -74,14 +74,17 @@ public class ReportIncidentScreen extends AppCompatActivity {
// Send initial screen view hit. // Send initial screen view hit.
Util.sendScreenName(tracker, actionBar.getTitle().toString()); Util.sendScreenName(tracker, actionBar.getTitle().toString());
String[] impactArrayValues = getResources().getStringArray(R.array.incident_impact_array);
// Creating adapter for spinner // Creating adapter for spinner
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.incident_impact_array)); ArrayAdapter<String> dataAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, impactArrayValues);
// Drop down layout style - list view with radio button // Drop down layout style - list view with radio button
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// attaching data adapter to spinner // attaching data adapter to spinner
mImpactSpinner.setAdapter(dataAdapter); mImpactSpinner.setAdapter(dataAdapter);
/*For default select item is Medium*/
mImpactSpinner.setSelection(2);
} }
@OnClick(R.id.incident_submit_text_view) @OnClick(R.id.incident_submit_text_view)
...@@ -136,7 +139,7 @@ public class ReportIncidentScreen extends AppCompatActivity { ...@@ -136,7 +139,7 @@ public class ReportIncidentScreen extends AppCompatActivity {
progressDialog.dismiss(); progressDialog.dismiss();
} }
if(syncStatus == SyncStatus.SUCCESS) { if(syncStatus == SyncStatus.SUCCESS) {
finish(); showSuccessDialog();
} else { } else {
showErrorDialog(R.string.failed_to_submit_form_string); showErrorDialog(R.string.failed_to_submit_form_string);
} }
...@@ -174,7 +177,7 @@ public class ReportIncidentScreen extends AppCompatActivity { ...@@ -174,7 +177,7 @@ public class ReportIncidentScreen extends AppCompatActivity {
private void getAllFromValues() { private void getAllFromValues() {
/*Form values*/ /*Form values*/
mImpact = Impact.from((String) mImpactSpinner.getSelectedItem()); mImpact = Impact.from(mImpactSpinner.getSelectedItemPosition());
mShortDescription = mShortDesEditText.getText().toString(); mShortDescription = mShortDesEditText.getText().toString();
} }
...@@ -190,4 +193,17 @@ public class ReportIncidentScreen extends AppCompatActivity { ...@@ -190,4 +193,17 @@ public class ReportIncidentScreen extends AppCompatActivity {
AlertDialog alert = builder.create(); AlertDialog alert = builder.create();
alert.show(); alert.show();
} }
private void showSuccessDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.incident_form_incident_successful_submission_string)
.setCancelable(false)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
}
});
AlertDialog alert = builder.create();
alert.show();
}
} }
...@@ -8,6 +8,13 @@ import com.vsoft.uoflservicenow.BuildConfig; ...@@ -8,6 +8,13 @@ import com.vsoft.uoflservicenow.BuildConfig;
*/ */
public class Constants { public class Constants {
public static final String GRANT_TYPE = "password";
public static final String CLIENT_ID = "ac0dd3408c1031006907010c2cc6ef6d";
public static final String CLIENT_SECRET = "oklj6znxv3o9jmyn2mlp";
public static final String TAG = "UofLCatalogue"; public static final String TAG = "UofLCatalogue";
public static final String[] month = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; public static final String[] month = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
......
...@@ -6,7 +6,7 @@ import android.util.Log; ...@@ -6,7 +6,7 @@ import android.util.Log;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
/** /**
* Created by npadhy on 9/6/2016. * Created by krishna on 9/6/2016.
*/ */
public class KeyboardUtil public class KeyboardUtil
{ {
......
package com.vsoft.uoflservicenow.utils;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
/**
* Created by npadhy on 9/7/2016.
*/
public class NetworkUtil {
/**
* getConnectivityStatus
*
* @param context
* @return
*/
public static boolean getConnectivityStatus(Context context) {
boolean networkFlag = false;
ConnectivityManager cm = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
if (null != activeNetwork) {
if (activeNetwork.getType() == ConnectivityManager.TYPE_WIFI) {
networkFlag = true;
return networkFlag;
}
if (activeNetwork.getType() == ConnectivityManager.TYPE_MOBILE) {
networkFlag = true;
return networkFlag;
}
}
return networkFlag;
}
}
package com.vsoft.uoflservicenow.utils; package com.vsoft.uoflservicenow.utils;
import android.content.Context; import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.text.InputType; import android.text.InputType;
import android.text.method.PasswordTransformationMethod; import android.text.method.PasswordTransformationMethod;
...@@ -271,7 +273,7 @@ public class Util { ...@@ -271,7 +273,7 @@ public class Util {
return dateFormat.format(timeStamp); return dateFormat.format(timeStamp);
} }
public static String getDateTime(String strDate) { public static long getDateTimeForMyIncidentFromString(String strDate) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);
Date date = null; Date date = null;
try { try {
...@@ -279,10 +281,7 @@ public class Util { ...@@ -279,10 +281,7 @@ public class Util {
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
return date.getTime();
SimpleDateFormat dateFormat = new SimpleDateFormat
("dd MMM, yyyy HH:mm", Locale.US);
return dateFormat.format(date.getTime());
} }
/*Record a screen view hit for the visible*/ /*Record a screen view hit for the visible*/
...@@ -295,4 +294,6 @@ public class Util { ...@@ -295,4 +294,6 @@ public class Util {
InputMethodManager imm =(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm =(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0); imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
} }
} }
...@@ -60,13 +60,27 @@ ...@@ -60,13 +60,27 @@
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:paddingTop="10dp" android:paddingTop="10dp"
android:paddingBottom="10dp" android:paddingBottom="10dp"
android:textColor="@android:color/white" android:textColor="@color/white"
android:background="@drawable/login_bg" android:background="@drawable/login_bg"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:textSize="@dimen/large_text_size" android:textSize="@dimen/large_text_size"
android:text="@string/login_screen_login_string" android:text="@string/login_screen_login_string"
android:textAlignment="center" /> android:textAlignment="center" />
<TextView
android:id="@+id/errormessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:textColor="@color/error_color"
android:textSize="@dimen/small_text_size"
android:text=""
android:gravity="center"
android:visibility="gone"
android:layout_gravity="center_horizontal"
/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge <merge
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/tool_bar_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:background="@color/white"
android:minHeight="?attr/actionBarSize"
android:padding="0dp"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp"/>
<GridView <GridView
android:id="@+id/home_screen_grid_view" android:id="@+id/home_screen_grid_view"
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -56,8 +56,8 @@ ...@@ -56,8 +56,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/normal_margin" android:layout_margin="@dimen/normal_margin"
android:paddingTop="@dimen/small_margin" android:background="@drawable/spinner_bg"
android:paddingBottom="@dimen/small_margin"/> style="@style/OverflowMenu"/>
<TextView <TextView
android:id="@+id/incident_impact_error_tv" android:id="@+id/incident_impact_error_tv"
...@@ -86,6 +86,7 @@ ...@@ -86,6 +86,7 @@
android:background="@drawable/list_view_item_bg_with_border" android:background="@drawable/list_view_item_bg_with_border"
android:gravity="start" android:gravity="start"
android:padding="@dimen/small_margin" android:padding="@dimen/small_margin"
android:inputType="textCapSentences|textMultiLine"
android:lines="4" /> android:lines="4" />
<TextView <TextView
......
...@@ -9,38 +9,20 @@ ...@@ -9,38 +9,20 @@
android:id="@+id/tool_bar_view" android:id="@+id/tool_bar_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@android:color/white" android:layout_margin="0dp"
android:background="@color/white"
android:minHeight="?attr/actionBarSize" android:minHeight="?attr/actionBarSize"
app:titleTextColor="@color/tool_bar_title_color"> android:padding="0dp"
<RelativeLayout app:contentInsetEnd="0dp"
android:layout_width="match_parent" app:contentInsetLeft="0dp"
android:layout_height="wrap_content" app:contentInsetRight="0dp"
android:layout_alignParentLeft="true"> app:contentInsetStart="0dp"/>
<ImageView
android:id="@+id/nav_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:src="@drawable/ic_arrow_back_black_24dp"
android:layout_alignParentLeft="true"
/>
<TextView
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:text="@string/my_reques_string"
android:textColor="@color/tool_bar_title_color" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<ListView <ListView
android:id="@+id/request_screen_list_view" android:id="@+id/request_screen_list_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_margin="10dp" android:layout_margin="10dp"
android:background="@android:color/white" android:background="@color/white"
android:divider="#8e8e8e" android:divider="#8e8e8e"
android:dividerHeight="0.5dp" android:dividerHeight="0.5dp"
android:padding="10dp" android:padding="10dp"
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
</array> </array>
<string-array name="incident_impact_array"> <string-array name="incident_impact_array">
<item>-None-</item> <item>-None-</item>
<item>High</item> <item>1 - High</item>
<item>Medium</item> <item>2 - Medium</item>
<item>Low</item> <item>3 - Low</item>
</string-array> </string-array>
</resources> </resources>
\ No newline at end of file
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<color name="home_screen_bg_color">@color/colorPrimary</color> <color name="home_screen_bg_color">@color/colorPrimary</color>
<color name="white">#ffffff</color>
<color name="screen_bg_color">#c2d1d3</color> <color name="screen_bg_color">#c2d1d3</color>
<color name="bg_border_color">#d6d6d6</color> <color name="bg_border_color">#d6d6d6</color>
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
<string name="incident_form_report_incident_text_string">Report Incident</string> <string name="incident_form_report_incident_text_string">Report Incident</string>
<string name="incident_form_top_text_string">Create an Incident record to report and request assistance with an issue you are having\n\nRequest assistance with an issue you are having. An incident record will be created and managed through to successful resolution. You will also be notified of progress.</string> <string name="incident_form_top_text_string">Create an Incident record to report and request assistance with an issue you are having\n\nRequest assistance with an issue you are having. An incident record will be created and managed through to successful resolution. You will also be notified of progress.</string>
<string name="incident_form_impact_text_string">Impact</string> <string name="incident_form_impact_text_string">Impact</string>
<string name="incident_form_incident_successful_submission_string">Your Incident has been reported successfully</string>
<string name="incident_form_describe_your_issue_text_string">Please Describe Your Issue below</string> <string name="incident_form_describe_your_issue_text_string">Please Describe Your Issue below</string>
<!--My Incidents--> <!--My Incidents-->
......
...@@ -7,6 +7,15 @@ ...@@ -7,6 +7,15 @@
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
<item name="actionOverflowMenuStyle">@style/OverflowMenu</item>
</style>
<style name="OverflowMenu" parent="Widget.AppCompat.PopupMenu.Overflow">
<!-- Required for pre-Lollipop. -->
<item name="overlapAnchor">false</item>
<!-- Required for Lollipop. -->
<item name="android:overlapAnchor">false</item>
</style> </style>
<style name="WhiteBackgroundStyle" parent="@style/Theme.AppCompat"> <style name="WhiteBackgroundStyle" parent="@style/Theme.AppCompat">
......
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