Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Krishna Vemulavada
/
vera_2.1_app
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
49e2e455
authored
Sep 08, 2016
by
Kunj Gupta
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix - conflict issues.
parent
03b97a19
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
98 additions
and
176 deletions
app/build.gradle
app/src/main/java/com/vsoft/uoflservicenow/dialog/SelectReferenceDialog.java
app/src/main/java/com/vsoft/uoflservicenow/ui/CatalogueItemScreen.java
app/src/main/java/com/vsoft/uoflservicenow/ui/CatalogueScreen.java
app/src/main/java/com/vsoft/uoflservicenow/ui/CatalogueVariableScreen.java
app/src/main/java/com/vsoft/uoflservicenow/ui/HomeScreen.java
app/src/main/java/com/vsoft/uoflservicenow/ui/LoginScreen.java
app/src/main/java/com/vsoft/uoflservicenow/ui/MyIncidentScreen.java
app/src/main/java/com/vsoft/uoflservicenow/ui/MyRequestActivity.java
app/src/main/java/com/vsoft/uoflservicenow/ui/ReportIncidentScreen.java
app/src/main/java/com/vsoft/uoflservicenow/utils/DialogUtils.java
app/src/main/java/com/vsoft/uoflservicenow/utils/NetworkUtil.java
app/src/main/res/layout/activity_login.xml
app/src/main/res/values/colors.xml
app/src/main/res/values/strings.xml
app/build.gradle
View file @
49e2e455
...
@@ -62,7 +62,6 @@ dependencies {
...
@@ -62,7 +62,6 @@ dependencies {
compile
'com.jakewharton:butterknife:8.2.1'
compile
'com.jakewharton:butterknife:8.2.1'
apt
'com.jakewharton:butterknife-compiler:8.2.1'
apt
'com.jakewharton:butterknife-compiler:8.2.1'
compile
'com.android.support:cardview-v7:24.1.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.4.0'
compile
'com.google.android.gms:play-services-analytics:9.4.0'
compile
(
'com.crashlytics.sdk.android:crashlytics:2.6.2@aar'
)
{
compile
(
'com.crashlytics.sdk.android:crashlytics:2.6.2@aar'
)
{
transitive
=
true
;
transitive
=
true
;
...
...
app/src/main/java/com/vsoft/uoflservicenow/dialog/SelectReferenceDialog.java
View file @
49e2e455
...
@@ -28,6 +28,7 @@ import com.vsoft.uoflservicenow.db.models.Reference;
...
@@ -28,6 +28,7 @@ import com.vsoft.uoflservicenow.db.models.Reference;
import
com.vsoft.uoflservicenow.enums.SyncStatus
;
import
com.vsoft.uoflservicenow.enums.SyncStatus
;
import
com.vsoft.uoflservicenow.listeners.ReferenceListener
;
import
com.vsoft.uoflservicenow.listeners.ReferenceListener
;
import
com.vsoft.uoflservicenow.utils.Constants
;
import
com.vsoft.uoflservicenow.utils.Constants
;
import
com.vsoft.uoflservicenow.utils.DialogUtils
;
import
com.vsoft.uoflservicenow.utils.Util
;
import
com.vsoft.uoflservicenow.utils.Util
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -145,7 +146,7 @@ public class SelectReferenceDialog extends DialogFragment {
...
@@ -145,7 +146,7 @@ public class SelectReferenceDialog extends DialogFragment {
if
(
mApplication
.
isNetConnected
())
{
if
(
mApplication
.
isNetConnected
())
{
new
FetchReference
().
execute
(
mEditText
.
getText
().
toString
());
new
FetchReference
().
execute
(
mEditText
.
getText
().
toString
());
}
else
{
}
else
{
showErrorDialog
(
R
.
string
.
internet_validation_string
);
DialogUtils
.
showNoConnectionDialogWithCloseActivity
(
getActivity
()
);
}
}
}
}
return
false
;
return
false
;
...
...
app/src/main/java/com/vsoft/uoflservicenow/ui/CatalogueItemScreen.java
View file @
49e2e455
...
@@ -25,6 +25,7 @@ import com.vsoft.uoflservicenow.db.models.CatalogueItem;
...
@@ -25,6 +25,7 @@ import com.vsoft.uoflservicenow.db.models.CatalogueItem;
import
com.vsoft.uoflservicenow.enums.SyncStatus
;
import
com.vsoft.uoflservicenow.enums.SyncStatus
;
import
com.vsoft.uoflservicenow.utils.CatalogueLog
;
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.Util
;
import
com.vsoft.uoflservicenow.utils.Util
;
import
java.util.List
;
import
java.util.List
;
...
@@ -77,7 +78,7 @@ public class CatalogueItemScreen extends AppCompatActivity {
...
@@ -77,7 +78,7 @@ public class CatalogueItemScreen extends AppCompatActivity {
if
(
application
.
isNetConnected
())
{
if
(
application
.
isNetConnected
())
{
new
FetchCatalogueItem
().
execute
();
new
FetchCatalogueItem
().
execute
();
}
else
{
}
else
{
showErrorDialog
(
R
.
string
.
internet_validation_string
);
DialogUtils
.
showNoConnectionDialogWithCloseActivity
(
CatalogueItemScreen
.
this
);
}
}
}
}
...
...
app/src/main/java/com/vsoft/uoflservicenow/ui/CatalogueScreen.java
View file @
49e2e455
...
@@ -24,6 +24,7 @@ import com.vsoft.uoflservicenow.db.models.Catalogue;
...
@@ -24,6 +24,7 @@ import com.vsoft.uoflservicenow.db.models.Catalogue;
import
com.vsoft.uoflservicenow.enums.SyncStatus
;
import
com.vsoft.uoflservicenow.enums.SyncStatus
;
import
com.vsoft.uoflservicenow.utils.CatalogueLog
;
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.Util
;
import
com.vsoft.uoflservicenow.utils.Util
;
import
java.util.List
;
import
java.util.List
;
...
@@ -68,7 +69,7 @@ public class CatalogueScreen extends AppCompatActivity {
...
@@ -68,7 +69,7 @@ public class CatalogueScreen extends AppCompatActivity {
if
(
application
.
isNetConnected
())
{
if
(
application
.
isNetConnected
())
{
new
FetchCatalogue
().
execute
();
new
FetchCatalogue
().
execute
();
}
else
{
}
else
{
showErrorDialog
(
R
.
string
.
internet_validation_string
);
DialogUtils
.
showNoConnectionDialogWithCloseActivity
(
CatalogueScreen
.
this
);
}
}
}
}
...
...
app/src/main/java/com/vsoft/uoflservicenow/ui/CatalogueVariableScreen.java
View file @
49e2e455
...
@@ -43,6 +43,7 @@ import com.vsoft.uoflservicenow.listeners.ReferenceListener;
...
@@ -43,6 +43,7 @@ import com.vsoft.uoflservicenow.listeners.ReferenceListener;
import
com.vsoft.uoflservicenow.ui.supportviews.DateAndTimePickerFragment
;
import
com.vsoft.uoflservicenow.ui.supportviews.DateAndTimePickerFragment
;
import
com.vsoft.uoflservicenow.utils.CatalogueLog
;
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.TagObject
;
import
com.vsoft.uoflservicenow.utils.TagObject
;
import
com.vsoft.uoflservicenow.utils.Util
;
import
com.vsoft.uoflservicenow.utils.Util
;
...
@@ -113,7 +114,7 @@ public class CatalogueVariableScreen extends AppCompatActivity {
...
@@ -113,7 +114,7 @@ public class CatalogueVariableScreen extends AppCompatActivity {
if
(
mApplication
.
isNetConnected
())
{
if
(
mApplication
.
isNetConnected
())
{
new
FetchCatalogueVariable
().
execute
();
new
FetchCatalogueVariable
().
execute
();
}
else
{
}
else
{
showErrorDialog
(
R
.
string
.
internet_validation_string
);
DialogUtils
.
showNoConnectionDialogWithCloseActivity
(
CatalogueVariableScreen
.
this
);
}
}
}
}
...
@@ -394,7 +395,7 @@ public class CatalogueVariableScreen extends AppCompatActivity {
...
@@ -394,7 +395,7 @@ public class CatalogueVariableScreen extends AppCompatActivity {
if
(
mApplication
.
isNetConnected
())
{
if
(
mApplication
.
isNetConnected
())
{
new
SubmitForm
().
execute
();
new
SubmitForm
().
execute
();
}
else
{
}
else
{
showErrorDialog
(
R
.
string
.
internet_validation_string
);
DialogUtils
.
showNoConnectionDialogWithCloseActivity
(
CatalogueVariableScreen
.
this
);
}
}
}
}
...
...
app/src/main/java/com/vsoft/uoflservicenow/ui/HomeScreen.java
View file @
49e2e455
...
@@ -12,8 +12,6 @@ import com.google.android.gms.analytics.Tracker;
...
@@ -12,8 +12,6 @@ import com.google.android.gms.analytics.Tracker;
import
com.vsoft.uoflservicenow.CatalogueApplication
;
import
com.vsoft.uoflservicenow.CatalogueApplication
;
import
com.vsoft.uoflservicenow.R
;
import
com.vsoft.uoflservicenow.R
;
import
com.vsoft.uoflservicenow.adapters.HomeScreenAdapter
;
import
com.vsoft.uoflservicenow.adapters.HomeScreenAdapter
;
import
com.vsoft.uoflservicenow.utils.DialogUtils
;
import
com.vsoft.uoflservicenow.utils.NetworkUtil
;
import
com.vsoft.uoflservicenow.utils.Util
;
import
com.vsoft.uoflservicenow.utils.Util
;
import
butterknife.BindView
;
import
butterknife.BindView
;
...
@@ -24,10 +22,8 @@ import butterknife.OnItemClick;
...
@@ -24,10 +22,8 @@ import butterknife.OnItemClick;
* Created by Kunj on 11/8/16.
* Created by Kunj on 11/8/16.
*/
*/
public
class
HomeScreen
extends
AppCompatActivity
{
public
class
HomeScreen
extends
AppCompatActivity
{
@BindView
(
R
.
id
.
tool_bar_view
)
@BindView
(
R
.
id
.
tool_bar_view
)
Toolbar
mToolbar
;
Toolbar
mToolbar
;
@BindView
(
R
.
id
.
home_screen_grid_view
)
GridView
mGridView
;
@BindView
(
R
.
id
.
home_screen_grid_view
)
GridView
mGridView
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
@@ -59,31 +55,14 @@ public class HomeScreen extends AppCompatActivity {
...
@@ -59,31 +55,14 @@ public class HomeScreen extends AppCompatActivity {
@OnItemClick
(
R
.
id
.
home_screen_grid_view
)
@OnItemClick
(
R
.
id
.
home_screen_grid_view
)
void
gridViewItemClicked
(
int
position
)
{
void
gridViewItemClicked
(
int
position
)
{
boolean
networkStatus
=
NetworkUtil
.
getConnectivityStatus
(
getApplicationContext
());
if
(
position
==
0
)
{
if
(
position
==
0
)
{
if
(
networkStatus
)
{
startActivity
(
new
Intent
(
HomeScreen
.
this
,
ReportIncidentScreen
.
class
));
startActivity
(
new
Intent
(
HomeScreen
.
this
,
ReportIncidentScreen
.
class
));
}
else
{
DialogUtils
.
showNoConnectionDialog
(
HomeScreen
.
this
);
}
}
else
if
(
position
==
1
)
{
}
else
if
(
position
==
1
)
{
if
(
networkStatus
)
{
startActivity
(
new
Intent
(
HomeScreen
.
this
,
CatalogueScreen
.
class
));
startActivity
(
new
Intent
(
HomeScreen
.
this
,
CatalogueScreen
.
class
));
}
else
{
DialogUtils
.
showNoConnectionDialog
(
HomeScreen
.
this
);
}
}
else
if
(
position
==
2
)
{
}
else
if
(
position
==
2
)
{
if
(
networkStatus
)
{
startActivity
(
new
Intent
(
HomeScreen
.
this
,
MyIncidentScreen
.
class
));
startActivity
(
new
Intent
(
HomeScreen
.
this
,
MyIncidentScreen
.
class
));
}
else
{
DialogUtils
.
showNoConnectionDialog
(
HomeScreen
.
this
);
}
}
else
if
(
position
==
3
)
{
}
else
if
(
position
==
3
)
{
if
(
networkStatus
)
{
startActivity
(
new
Intent
(
HomeScreen
.
this
,
MyRequestActivity
.
class
));
startActivity
(
new
Intent
(
HomeScreen
.
this
,
MyRequestActivity
.
class
));
}
else
{
DialogUtils
.
showNoConnectionDialog
(
HomeScreen
.
this
);
}
}
}
}
}
}
}
app/src/main/java/com/vsoft/uoflservicenow/ui/LoginScreen.java
View file @
49e2e455
...
@@ -3,7 +3,6 @@ package com.vsoft.uoflservicenow.ui;
...
@@ -3,7 +3,6 @@ package com.vsoft.uoflservicenow.ui;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.app.ProgressDialog
;
import
android.app.ProgressDialog
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.os.AsyncTask
;
import
android.os.AsyncTask
;
...
@@ -12,8 +11,6 @@ import android.text.TextUtils;
...
@@ -12,8 +11,6 @@ import android.text.TextUtils;
import
android.view.KeyEvent
;
import
android.view.KeyEvent
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.EditText
;
import
android.widget.EditText
;
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
;
...
@@ -27,49 +24,40 @@ import com.vsoft.uoflservicenow.enums.SyncStatus;
...
@@ -27,49 +24,40 @@ import com.vsoft.uoflservicenow.enums.SyncStatus;
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
;
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
;
import
net.yslibrary.android.keyboardvisibilityevent.KeyboardVisibilityEvent
;
import
net.yslibrary.android.keyboardvisibilityevent.KeyboardVisibilityEventListener
;
import
java.util.List
;
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.
*/
*/
public
class
LoginScreen
extends
Activity
{
public
class
LoginScreen
extends
Activity
{
@BindView
(
R
.
id
.
login_screen_username_edit_text
)
@BindView
(
R
.
id
.
login_screen_username_edit_text
)
EditText
mUserNameEditText
;
EditText
userName
;
@BindView
(
R
.
id
.
login_screen_password_edit_text
)
EditText
mPasswordEditText
;
@BindView
(
R
.
id
.
errormessage
)
TextView
errorMessage
;
@BindView
(
R
.
id
.
login_screen_password_edit_text
)
EditText
password
;
@BindView
(
R
.
id
.
login_scroll
)
ScrollView
loginScrollview
;
private
List
<
UserApiValues
>
mUserDetails
;
private
List
<
UserApiValues
>
mUserDetails
;
private
PrefManager
prefManager
;
private
CatalogueApplication
mApplication
;
private
String
userNameStrng
,
passwordStrng
;
private
String
sysId
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
// TODO Auto-generated method stub
// TODO Auto-generated method stub
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_login
);
setContentView
(
R
.
layout
.
activity_login
);
prefManager
=
PrefManager
.
getInstance
();
prefManager
.
init
(
LoginScreen
.
this
);
ButterKnife
.
bind
(
this
);
ButterKnife
.
bind
(
this
);
mApplication
=
(
CatalogueApplication
)
getApplication
();
PrefManager
prefManager
=
PrefManager
.
getInstance
();
prefManager
.
init
(
LoginScreen
.
this
);
CheckLoginValues
();
CheckLoginValues
();
password
.
setOnKeyListener
(
new
View
.
OnKeyListener
()
{
mPasswordEditText
.
setOnKeyListener
(
new
View
.
OnKeyListener
()
{
public
boolean
onKey
(
View
v
,
int
keyCode
,
KeyEvent
event
)
{
public
boolean
onKey
(
View
v
,
int
keyCode
,
KeyEvent
event
)
{
if
(
event
.
getAction
()
==
KeyEvent
.
ACTION_DOWN
)
{
if
(
event
.
getAction
()
==
KeyEvent
.
ACTION_DOWN
)
{
switch
(
keyCode
)
{
switch
(
keyCode
)
{
...
@@ -85,20 +73,6 @@ public class LoginScreen extends Activity {
...
@@ -85,20 +73,6 @@ public class LoginScreen extends Activity {
}
}
});
});
KeyboardVisibilityEvent
.
setEventListener
(
LoginScreen
.
this
,
new
KeyboardVisibilityEventListener
()
{
@Override
public
void
onVisibilityChanged
(
boolean
isOpen
)
{
if
(
isOpen
)
{
loginScrollview
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
loginScrollview
.
fullScroll
(
ScrollView
.
FOCUS_DOWN
);
}
});
}
}
});
CatalogueApplication
application
=
(
CatalogueApplication
)
getApplication
();
CatalogueApplication
application
=
(
CatalogueApplication
)
getApplication
();
Tracker
tracker
=
application
.
getDefaultTracker
();
Tracker
tracker
=
application
.
getDefaultTracker
();
Util
.
sendScreenName
(
tracker
,
getString
(
R
.
string
.
login_screen_string
));
Util
.
sendScreenName
(
tracker
,
getString
(
R
.
string
.
login_screen_string
));
...
@@ -106,7 +80,7 @@ public class LoginScreen extends Activity {
...
@@ -106,7 +80,7 @@ public class LoginScreen extends Activity {
private
void
CheckLoginValues
()
{
private
void
CheckLoginValues
()
{
SharedPreferences
sharedPreferences
=
getSharedPreferences
(
PrefManager
.
PREFERENCES_USER_VALUES_KEY
,
Context
.
MODE_PRIVATE
);
SharedPreferences
sharedPreferences
=
getSharedPreferences
(
PrefManager
.
PREFERENCES_USER_VALUES_KEY
,
Context
.
MODE_PRIVATE
);
sysId
=
sharedPreferences
.
getString
(
PrefManager
.
PREFERENCE_SYS_ID
,
""
);
String
sysId
=
sharedPreferences
.
getString
(
PrefManager
.
PREFERENCE_SYS_ID
,
""
);
if
(!
TextUtils
.
isEmpty
(
sysId
))
{
if
(!
TextUtils
.
isEmpty
(
sysId
))
{
startActivity
(
new
Intent
(
LoginScreen
.
this
,
HomeScreen
.
class
));
startActivity
(
new
Intent
(
LoginScreen
.
this
,
HomeScreen
.
class
));
finish
();
finish
();
...
@@ -114,20 +88,19 @@ public class LoginScreen extends Activity {
...
@@ -114,20 +88,19 @@ public class LoginScreen extends Activity {
}
}
private
void
callLoginAPI
()
{
private
void
callLoginAPI
()
{
userNameStrng
=
userName
.
getText
().
toString
().
trim
();
String
userNameString
=
mUserNameEditText
.
getText
().
toString
().
trim
();
passwordStrng
=
password
.
getText
().
toString
().
trim
();
String
passwordString
=
mPasswordEditText
.
getText
().
toString
().
trim
();
if
(
TextUtils
.
isEmpty
(
userNameStrng
))
{
if
(
TextUtils
.
isEmpty
(
userNameStr
i
ng
))
{
userName
.
setError
(
getResources
().
getString
(
R
.
string
.
user_error
));
mUserNameEditText
.
setError
(
getResources
().
getString
(
R
.
string
.
user_error
));
}
}
if
(
TextUtils
.
isEmpty
(
passwordStrng
))
{
if
(
TextUtils
.
isEmpty
(
passwordStr
i
ng
))
{
password
.
setError
(
getResources
().
getString
(
R
.
string
.
pasw_error
));
mPasswordEditText
.
setError
(
getResources
().
getString
(
R
.
string
.
pasw_error
));
}
}
if
(!
TextUtils
.
isEmpty
(
userNameStr
ng
)
&&
!
TextUtils
.
isEmpty
(
passwordStr
ng
))
{
if
(!
TextUtils
.
isEmpty
(
userNameStr
ing
)
&&
!
TextUtils
.
isEmpty
(
passwordStri
ng
))
{
KeyboardUtil
.
hideKeyboard
(
LoginScreen
.
this
);
KeyboardUtil
.
hideKeyboard
(
LoginScreen
.
this
);
boolean
networkStatus
=
NetworkUtil
.
getConnectivityStatus
(
getApplicationContext
());
if
(
mApplication
.
isNetConnected
())
{
if
(
networkStatus
)
{
new
LoginDetailsSendToServer
().
execute
(
mUserNameEditText
.
getText
().
toString
().
trim
(),
mPasswordEditText
.
getText
().
toString
().
trim
());
new
LoginDetailsSendToServer
().
execute
(
userName
.
getText
().
toString
().
trim
(),
password
.
getText
().
toString
().
trim
());
}
else
{
}
else
{
DialogUtils
.
showNoConnectionDialog
(
LoginScreen
.
this
);
DialogUtils
.
showNoConnectionDialog
(
LoginScreen
.
this
);
}
}
...
@@ -180,16 +153,15 @@ public class LoginScreen extends Activity {
...
@@ -180,16 +153,15 @@ public class LoginScreen extends Activity {
}
}
if
(
syncStatus
!=
null
&&
syncStatus
==
SyncStatus
.
SUCCESS
)
{
if
(
syncStatus
!=
null
&&
syncStatus
==
SyncStatus
.
SUCCESS
)
{
if
(
mUserDetails
!=
null
)
{
if
(
mUserDetails
!=
null
)
{
String
first
n
ame
=
mUserDetails
.
get
(
0
).
getFirstName
();
String
first
N
ame
=
mUserDetails
.
get
(
0
).
getFirstName
();
String
las
rn
ame
=
mUserDetails
.
get
(
0
).
getLastName
();
String
las
tN
ame
=
mUserDetails
.
get
(
0
).
getLastName
();
String
sysid
=
mUserDetails
.
get
(
0
).
getSysId
();
String
sysid
=
mUserDetails
.
get
(
0
).
getSysId
();
PrefManager
.
saveUserDetailsInPreferences
(
LoginScreen
.
this
,
first
name
,
lasrn
ame
,
sysid
);
PrefManager
.
saveUserDetailsInPreferences
(
LoginScreen
.
this
,
first
Name
,
lastN
ame
,
sysid
);
startActivity
(
new
Intent
(
LoginScreen
.
this
,
HomeScreen
.
class
));
startActivity
(
new
Intent
(
LoginScreen
.
this
,
HomeScreen
.
class
));
finish
();
finish
();
}
}
}
else
{
}
else
{
errorMessage
.
setVisibility
(
View
.
VISIBLE
);
Toast
.
makeText
(
LoginScreen
.
this
,
R
.
string
.
login_screen_invalid_usernane_and_password_string
,
Toast
.
LENGTH_LONG
).
show
();
errorMessage
.
setText
(
"Invalid username and password"
);
}
}
}
}
}
}
...
...
app/src/main/java/com/vsoft/uoflservicenow/ui/MyIncidentScreen.java
View file @
49e2e455
...
@@ -20,6 +20,7 @@ import com.vsoft.uoflservicenow.api.managers.IncidentApiManager;
...
@@ -20,6 +20,7 @@ import com.vsoft.uoflservicenow.api.managers.IncidentApiManager;
import
com.vsoft.uoflservicenow.db.models.Incident
;
import
com.vsoft.uoflservicenow.db.models.Incident
;
import
com.vsoft.uoflservicenow.enums.SyncStatus
;
import
com.vsoft.uoflservicenow.enums.SyncStatus
;
import
com.vsoft.uoflservicenow.utils.CatalogueLog
;
import
com.vsoft.uoflservicenow.utils.CatalogueLog
;
import
com.vsoft.uoflservicenow.utils.DialogUtils
;
import
com.vsoft.uoflservicenow.utils.Util
;
import
com.vsoft.uoflservicenow.utils.Util
;
import
java.util.Collections
;
import
java.util.Collections
;
...
@@ -67,7 +68,7 @@ public class MyIncidentScreen extends AppCompatActivity {
...
@@ -67,7 +68,7 @@ public class MyIncidentScreen extends AppCompatActivity {
if
(
application
.
isNetConnected
())
{
if
(
application
.
isNetConnected
())
{
new
FetchIncident
().
execute
();
new
FetchIncident
().
execute
();
}
else
{
}
else
{
showErrorDialog
(
R
.
string
.
internet_validation_string
);
DialogUtils
.
showNoConnectionDialogWithCloseActivity
(
MyIncidentScreen
.
this
);
}
}
}
}
...
...
app/src/main/java/com/vsoft/uoflservicenow/ui/MyRequestActivity.java
View file @
49e2e455
...
@@ -19,12 +19,13 @@ import com.vsoft.uoflservicenow.api.listeners.get.GetMyRequestApiListener;
...
@@ -19,12 +19,13 @@ import com.vsoft.uoflservicenow.api.listeners.get.GetMyRequestApiListener;
import
com.vsoft.uoflservicenow.api.managers.MyRequestApiManager
;
import
com.vsoft.uoflservicenow.api.managers.MyRequestApiManager
;
import
com.vsoft.uoflservicenow.db.models.MyRequest
;
import
com.vsoft.uoflservicenow.db.models.MyRequest
;
import
com.vsoft.uoflservicenow.enums.SyncStatus
;
import
com.vsoft.uoflservicenow.enums.SyncStatus
;
import
com.vsoft.uoflservicenow.utils.DialogUtils
;
import
com.vsoft.uoflservicenow.utils.Util
;
import
com.vsoft.uoflservicenow.utils.Util
;
import
java.util.List
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
butterknife.ButterKnife
;
import
butterknife.OnClick
;
/**
/**
* Created by kvemulavada on 8/30/2016.
* Created by kvemulavada on 8/30/2016.
...
@@ -63,7 +64,7 @@ public class MyRequestActivity extends AppCompatActivity {
...
@@ -63,7 +64,7 @@ public class MyRequestActivity extends AppCompatActivity {
if
(
application
.
isNetConnected
())
{
if
(
application
.
isNetConnected
())
{
new
FetchMyRequestData
().
execute
();
new
FetchMyRequestData
().
execute
();
}
else
{
}
else
{
showErrorDialog
(
R
.
string
.
internet_validation_string
);
DialogUtils
.
showNoConnectionDialogWithCloseActivity
(
MyRequestActivity
.
this
);
}
}
}
}
class
FetchMyRequestData
extends
AsyncTask
<
String
,
Void
,
SyncStatus
>
{
class
FetchMyRequestData
extends
AsyncTask
<
String
,
Void
,
SyncStatus
>
{
...
...
app/src/main/java/com/vsoft/uoflservicenow/ui/ReportIncidentScreen.java
View file @
49e2e455
...
@@ -25,6 +25,7 @@ import com.vsoft.uoflservicenow.api.managers.IncidentApiManager;
...
@@ -25,6 +25,7 @@ import com.vsoft.uoflservicenow.api.managers.IncidentApiManager;
import
com.vsoft.uoflservicenow.db.models.Incident
;
import
com.vsoft.uoflservicenow.db.models.Incident
;
import
com.vsoft.uoflservicenow.enums.Impact
;
import
com.vsoft.uoflservicenow.enums.Impact
;
import
com.vsoft.uoflservicenow.enums.SyncStatus
;
import
com.vsoft.uoflservicenow.enums.SyncStatus
;
import
com.vsoft.uoflservicenow.utils.DialogUtils
;
import
com.vsoft.uoflservicenow.utils.PrefManager
;
import
com.vsoft.uoflservicenow.utils.PrefManager
;
import
com.vsoft.uoflservicenow.utils.Util
;
import
com.vsoft.uoflservicenow.utils.Util
;
...
@@ -101,7 +102,7 @@ public class ReportIncidentScreen extends AppCompatActivity {
...
@@ -101,7 +102,7 @@ public class ReportIncidentScreen extends AppCompatActivity {
}
}
}
}
}
else
{
}
else
{
showErrorDialog
(
R
.
string
.
internet_validation_string
);
DialogUtils
.
showNoConnectionDialogWithCloseActivity
(
ReportIncidentScreen
.
this
);
}
}
}
}
...
...
app/src/main/java/com/vsoft/uoflservicenow/utils/DialogUtils.java
View file @
49e2e455
package
com
.
vsoft
.
uoflservicenow
.
utils
;
package
com
.
vsoft
.
uoflservicenow
.
utils
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.support.v7.app.AlertDialog
;
import
android.support.v7.app.AlertDialog
;
import
android.view.ContextThemeWrapper
;
import
com.vsoft.uoflservicenow.R
;
import
com.vsoft.uoflservicenow.R
;
...
@@ -12,33 +12,50 @@ import com.vsoft.uoflservicenow.R;
...
@@ -12,33 +12,50 @@ import com.vsoft.uoflservicenow.R;
* Created by krishna on 9/7/2016.
* Created by krishna on 9/7/2016.
*/
*/
public
class
DialogUtils
{
public
class
DialogUtils
{
public
static
void
showNoConnectionDialog
(
final
Activity
activity
)
{
public
static
void
showNoConnectionDialog
(
final
Context
context
)
{
AlertDialog
.
Builder
alertDialogBuilder
=
new
AlertDialog
.
Builder
(
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
context
);
new
ContextThemeWrapper
(
activity
,
builder
.
setTitle
(
context
.
getString
(
R
.
string
.
connection_alert_dialog_title
));
android
.
R
.
style
.
Theme_Holo
));
builder
.
setMessage
(
R
.
string
.
connection_alert_dialog_message
)
alertDialogBuilder
.
setTitle
(
activity
.
getString
(
R
.
string
.
connection_alert_dialog_title
));
alertDialogBuilder
.
setMessage
(
R
.
string
.
connection_alert_dialog_message
)
.
setCancelable
(
true
)
.
setCancelable
(
true
)
.
setPositiveButton
(
.
setPositiveButton
(
context
.
getString
(
R
.
string
.
settings
),
activity
.
getString
(
R
.
string
.
settings
),
new
DialogInterface
.
OnClickListener
()
{
new
DialogInterface
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
public
void
onClick
(
DialogInterface
dialog
,
int
id
)
{
DialogInterface
dialog
,
context
.
startActivity
(
new
Intent
(
android
.
provider
.
Settings
.
ACTION_SETTINGS
));
int
id
)
{
activity
.
startActivity
(
new
Intent
(
android
.
provider
.
Settings
.
ACTION_SETTINGS
));
}
}
})
})
.
setNegativeButton
(
.
setNegativeButton
(
context
.
getString
(
R
.
string
.
cancel
),
activity
.
getString
(
R
.
string
.
cancel
),
new
DialogInterface
.
OnClickListener
()
{
new
DialogInterface
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
dialog
.
dismiss
();
}
}
});
});
AlertDialog
alertDialog
=
alertDialogBuilder
.
create
();
AlertDialog
alert
=
builder
.
create
();
alertDialog
.
show
();
alert
.
show
();
}
public
static
void
showNoConnectionDialogWithCloseActivity
(
final
Context
context
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
context
);
builder
.
setTitle
(
context
.
getString
(
R
.
string
.
connection_alert_dialog_title
));
builder
.
setMessage
(
R
.
string
.
connection_alert_dialog_message
)
.
setCancelable
(
false
)
.
setPositiveButton
(
context
.
getString
(
R
.
string
.
settings
),
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
id
)
{
context
.
startActivity
(
new
Intent
(
android
.
provider
.
Settings
.
ACTION_SETTINGS
));
((
Activity
)
context
).
finish
();
}
})
.
setNegativeButton
(
context
.
getString
(
R
.
string
.
cancel
),
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
((
Activity
)
context
).
finish
();
}
});
AlertDialog
alert
=
builder
.
create
();
alert
.
show
();
}
}
}
}
app/src/main/java/com/vsoft/uoflservicenow/utils/NetworkUtil.java
deleted
100644 → 0
View file @
03b97a19
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
;
}
}
app/src/main/res/layout/activity_login.xml
View file @
49e2e455
...
@@ -26,8 +26,8 @@
...
@@ -26,8 +26,8 @@
android:id=
"@+id/login_screen_username_edit_text"
android:id=
"@+id/login_screen_username_edit_text"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"
20dp
"
android:layout_marginLeft=
"
@dimen/extra_large_margin
"
android:layout_marginRight=
"
20dp
"
android:layout_marginRight=
"
@dimen/extra_large_margin
"
android:background=
"@drawable/username_under_bg_box"
android:background=
"@drawable/username_under_bg_box"
android:drawableLeft=
"@mipmap/ic_user_icon"
android:drawableLeft=
"@mipmap/ic_user_icon"
android:hint=
"Username"
android:hint=
"Username"
...
@@ -53,32 +53,17 @@
...
@@ -53,32 +53,17 @@
android:id=
"@+id/login_screen_login_text_view"
android:id=
"@+id/login_screen_login_text_view"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:
layout_gravity=
"left
"
android:
gravity=
"center
"
android:layout_marginTop=
"
10dp
"
android:layout_marginTop=
"
@dimen/normal_margin
"
android:layout_marginBottom=
"
10dp
"
android:layout_marginBottom=
"
@dimen/normal_margin
"
android:paddingTop=
"
10dp
"
android:paddingTop=
"
@dimen/normal_margin
"
android:paddingBottom=
"
10dp
"
android:paddingBottom=
"
@dimen/normal_margin
"
android:textColor=
"@color/white"
android:textColor=
"@
android:
color/white"
android:background=
"@drawable/login_bg"
android:background=
"@drawable/login_bg"
android:layout_marginLeft=
"
20dp
"
android:layout_marginLeft=
"
@dimen/extra_large_margin
"
android:layout_marginRight=
"
20dp
"
android:layout_marginRight=
"
@dimen/extra_large_margin
"
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"
/>
<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>
\ No newline at end of file
app/src/main/res/values/colors.xml
View file @
49e2e455
...
@@ -11,7 +11,6 @@
...
@@ -11,7 +11,6 @@
<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>
...
...
app/src/main/res/values/strings.xml
View file @
49e2e455
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
<string
name=
"error_string"
>
* Required
</string>
<string
name=
"error_string"
>
* Required
</string>
<string
name=
"none_string"
>
-None-
</string>
<string
name=
"none_string"
>
-None-
</string>
<string
name=
"search_for_reference_string"
>
Reference
</string>
<string
name=
"search_for_reference_string"
>
Reference
</string>
<string
name=
"internet_validation_string"
>
Please connect to internet and try again.
</string>
<string
name=
"home_screen_string"
>
Home Screen
</string>
<string
name=
"home_screen_string"
>
Home Screen
</string>
<string
name=
"login_screen_string"
>
Login Screen
</string>
<string
name=
"login_screen_string"
>
Login Screen
</string>
...
@@ -23,10 +22,6 @@
...
@@ -23,10 +22,6 @@
<string
name=
"requested"
>
Requested
</string>
<string
name=
"requested"
>
Requested
</string>
<string
name=
"rejected"
>
Rejected
</string>
<string
name=
"rejected"
>
Rejected
</string>
<string
name=
"user_error"
>
Please enter username
</string>
<string
name=
"pasw_error"
>
Please enter password
</string>
<string
name=
"date_string"
>
%1$s %2$s, %3$s
</string>
<string
name=
"date_string"
>
%1$s %2$s, %3$s
</string>
<string
name=
"date_and_time_string"
>
%1$s:%2$s
</string>
<string
name=
"date_and_time_string"
>
%1$s:%2$s
</string>
...
@@ -40,6 +35,9 @@
...
@@ -40,6 +35,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=
"user_error"
>
Please Enter UserName
</string>
<string
name=
"pasw_error"
>
Please Enter Password
</string>
<!--Variable Screen-->
<!--Variable Screen-->
<string
name=
"variable_form_misc_info_string"
>
%1$s [add %2$s]
</string>
<string
name=
"variable_form_misc_info_string"
>
%1$s [add %2$s]
</string>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment