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
89c051e8
authored
Aug 31, 2016
by
Krishna Vemulavada
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
userApi integrartion in login
parent
bb880d70
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
1001 additions
and
9 deletions
app/src/main/AndroidManifest.xml
app/src/main/java/com/vsoft/uofl_catalogue/adapters/MyRequestAdapter.java
app/src/main/java/com/vsoft/uofl_catalogue/api/interfaces/LoginApi.java
app/src/main/java/com/vsoft/uofl_catalogue/api/interfaces/MyRequestApi.java
app/src/main/java/com/vsoft/uofl_catalogue/api/interfaces/UserApi.java
app/src/main/java/com/vsoft/uofl_catalogue/api/listeners/get/GetMyRequestApiListener.java
app/src/main/java/com/vsoft/uofl_catalogue/api/listeners/get/GetUserApiListener.java
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/MyRequestApiManager.java
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/UserApiManager.java
app/src/main/java/com/vsoft/uofl_catalogue/db/models/MyRequest.java
app/src/main/java/com/vsoft/uofl_catalogue/db/models/UserApiValues.java
app/src/main/java/com/vsoft/uofl_catalogue/ui/HomeScreen.java
app/src/main/java/com/vsoft/uofl_catalogue/ui/LoginScreen.java
app/src/main/java/com/vsoft/uofl_catalogue/ui/MyRequestActivity.java
app/src/main/java/com/vsoft/uofl_catalogue/utils/Constants.java
app/src/main/java/com/vsoft/uofl_catalogue/utils/PrefManager.java
app/src/main/res/drawable/circle.xml
app/src/main/res/layout/request_list_item.xml
app/src/main/res/layout/request_list_screen.xml
app/src/main/res/values/strings.xml
app/src/main/res/values/styles.xml
app/src/main/AndroidManifest.xml
View file @
89c051e8
...
@@ -75,6 +75,10 @@
...
@@ -75,6 +75,10 @@
android:name=
".ui.ReportIncidentScreen"
android:name=
".ui.ReportIncidentScreen"
android:screenOrientation=
"portrait"
android:screenOrientation=
"portrait"
android:windowSoftInputMode=
"stateHidden|adjustResize"
/>
android:windowSoftInputMode=
"stateHidden|adjustResize"
/>
<activity
android:name=
".ui.MyRequestActivity"
android:screenOrientation=
"portrait"
android:windowSoftInputMode=
"stateHidden|adjustResize"
/>
</application>
</application>
</manifest>
</manifest>
app/src/main/java/com/vsoft/uofl_catalogue/adapters/MyRequestAdapter.java
0 → 100644
View file @
89c051e8
package
com
.
vsoft
.
uofl_catalogue
.
adapters
;
import
android.content.Context
;
import
android.graphics.Color
;
import
android.graphics.drawable.GradientDrawable
;
import
android.support.v4.content.ContextCompat
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.BaseAdapter
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.vsoft.uofl_catalogue.R
;
import
com.vsoft.uofl_catalogue.db.models.Catalogue
;
import
com.vsoft.uofl_catalogue.db.models.MyRequest
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Created by kvemulavada on 8/30/2016.
*/
public
class
MyRequestAdapter
extends
BaseAdapter
{
private
Context
mContext
;
private
final
List
<
MyRequest
>
mReqList
=
new
ArrayList
<>(
0
);
private
LayoutInflater
mInflater
;
public
MyRequestAdapter
(
Context
context
)
{
mContext
=
context
;
mInflater
=
(
LayoutInflater
)
mContext
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
}
public
void
setRequestList
(
List
<
MyRequest
>
myreqList
)
{
mReqList
.
clear
();
if
(
myreqList
!=
null
)
mReqList
.
addAll
(
myreqList
);
notifyDataSetChanged
();
}
@Override
public
int
getCount
()
{
// TODO Auto-generated method stub
return
mReqList
.
size
();
}
@Override
public
MyRequest
getItem
(
int
position
)
{
// TODO Auto-generated method stub
return
mReqList
.
get
(
position
);
}
@Override
public
long
getItemId
(
int
position
)
{
// TODO Auto-generated method stub
return
position
;
}
@Override
public
View
getView
(
int
position
,
View
convertView
,
ViewGroup
parent
)
{
// TODO Auto-generated method stub
ViewHolder
holder
;
if
(
convertView
==
null
)
{
convertView
=
mInflater
.
inflate
(
R
.
layout
.
request_list_item
,
parent
,
false
);
holder
=
new
ViewHolder
();
holder
.
number
=
(
TextView
)
convertView
.
findViewById
(
R
.
id
.
number
);
holder
.
dueDate
=
(
TextView
)
convertView
.
findViewById
(
R
.
id
.
dueDate
);
holder
.
shotrDescription
=
(
TextView
)
convertView
.
findViewById
(
R
.
id
.
shotrDescription
);
holder
.
approval
=
(
TextView
)
convertView
.
findViewById
(
R
.
id
.
approval
);
holder
.
statusIndicator
=
(
ImageView
)
convertView
.
findViewById
(
R
.
id
.
approval_image
);
convertView
.
setTag
(
holder
);
}
else
{
holder
=
(
ViewHolder
)
convertView
.
getTag
();
}
MyRequest
req
=
mReqList
.
get
(
position
);
holder
.
number
.
setText
(
req
.
getNumber
());
String
dueDate
=
"Due : "
+
req
.
getDueDate
();
holder
.
dueDate
.
setText
(
dueDate
);
holder
.
shotrDescription
.
setText
(
req
.
getShotrDescription
());
holder
.
approval
.
setText
(
req
.
getApproval
());
if
(!
req
.
getApproval
().
isEmpty
())
{
if
(
req
.
getApproval
().
equalsIgnoreCase
(
"requested"
))
{
((
GradientDrawable
)
holder
.
statusIndicator
.
getBackground
()).
setColor
(
Color
.
parseColor
(
"#FFB400"
));
//holder.statusIndicator.setBackgroundColor(Color.parseColor("#FFB400"));
}
else
if
(
req
.
getApproval
().
equalsIgnoreCase
(
"not requested"
))
{
((
GradientDrawable
)
holder
.
statusIndicator
.
getBackground
()).
setColor
(
Color
.
parseColor
(
"#5CE1ED"
));
// holder.statusIndicator.setBackgroundColor(Color.parseColor("#5CE1ED"));
}
else
if
(
req
.
getApproval
().
equalsIgnoreCase
(
"approved"
))
{
// holder.statusIndicator.setBackgroundColor(Color.parseColor("#06D323"));
((
GradientDrawable
)
holder
.
statusIndicator
.
getBackground
()).
setColor
(
Color
.
parseColor
(
"#06D323"
));
}
else
{
// holder.statusIndicator.setBackgroundColor(Color.parseColor("#FF0000"));
((
GradientDrawable
)
holder
.
statusIndicator
.
getBackground
()).
setColor
(
Color
.
parseColor
(
"#FF0000"
));
}
}
return
convertView
;
}
static
class
ViewHolder
{
private
TextView
number
;
private
TextView
dueDate
;
private
TextView
shotrDescription
;
private
TextView
approval
;
private
ImageView
statusIndicator
;
}
}
\ No newline at end of file
app/src/main/java/com/vsoft/uofl_catalogue/api/interfaces/LoginApi.java
View file @
89c051e8
...
@@ -19,7 +19,7 @@ import retrofit2.http.Url;
...
@@ -19,7 +19,7 @@ import retrofit2.http.Url;
/**
/**
* @since 1.0
* @since 1.0
* @author
Kunj
on 11/8/16.
* @author
krishna
on 11/8/16.
*
*
*/
*/
public
interface
LoginApi
{
public
interface
LoginApi
{
...
@@ -30,7 +30,6 @@ public interface LoginApi {
...
@@ -30,7 +30,6 @@ public interface LoginApi {
Call
<
ResponseBody
>
postLoginValues
(
@Field
(
LoginItem
.
Json
.
GRANT_TYPE
)
String
grantType
,
@Field
(
LoginItem
.
Json
.
CLIENT_ID
)
String
clientId
,
Call
<
ResponseBody
>
postLoginValues
(
@Field
(
LoginItem
.
Json
.
GRANT_TYPE
)
String
grantType
,
@Field
(
LoginItem
.
Json
.
CLIENT_ID
)
String
clientId
,
@Field
(
LoginItem
.
Json
.
CLIENT_CECRET
)
String
clientSecret
,
@Field
(
LoginItem
.
Json
.
USER_NAME
)
String
userName
,
@Field
(
LoginItem
.
Json
.
CLIENT_CECRET
)
String
clientSecret
,
@Field
(
LoginItem
.
Json
.
USER_NAME
)
String
userName
,
@Field
(
LoginItem
.
Json
.
PASSWORD
)
String
password
);
@Field
(
LoginItem
.
Json
.
PASSWORD
)
String
password
);
}
}
app/src/main/java/com/vsoft/uofl_catalogue/api/interfaces/MyRequestApi.java
0 → 100644
View file @
89c051e8
package
com
.
vsoft
.
uofl_catalogue
.
api
.
interfaces
;
import
com.vsoft.uofl_catalogue.db.models.CatalogueItem
;
import
com.vsoft.uofl_catalogue.db.models.CatalogueVariable
;
import
com.vsoft.uofl_catalogue.db.models.Reference
;
import
com.vsoft.uofl_catalogue.utils.Constants
;
import
okhttp3.ResponseBody
;
import
retrofit2.Call
;
import
retrofit2.http.Body
;
import
retrofit2.http.GET
;
import
retrofit2.http.POST
;
import
retrofit2.http.Query
;
import
retrofit2.http.Url
;
/**
* @since 1.0
* @author Kunj on 11/8/16.
*
*/
public
interface
MyRequestApi
{
// Get Catalogue API
@GET
(
Constants
.
URL_GET_MYREQUEST
)
Call
<
ResponseBody
>
getMyrequest
(
@Query
(
Constants
.
URL_PARAM_SYSPRM_QUERY
)
String
sysparmQuery
);
}
app/src/main/java/com/vsoft/uofl_catalogue/api/interfaces/UserApi.java
0 → 100644
View file @
89c051e8
package
com
.
vsoft
.
uofl_catalogue
.
api
.
interfaces
;
import
com.vsoft.uofl_catalogue.utils.Constants
;
import
okhttp3.ResponseBody
;
import
retrofit2.Call
;
import
retrofit2.http.GET
;
import
retrofit2.http.Query
;
/**
* @since 1.0
* @author Kunj on 11/8/16.
*
*/
public
interface
UserApi
{
// Get Catalogue API
@GET
(
Constants
.
URL_GET_USERDETAILS
)
Call
<
ResponseBody
>
getuserDetails
(
@Query
(
Constants
.
URL_PARAM_SYSPRM_USERNAME
)
String
sysparmQuery
);
}
app/src/main/java/com/vsoft/uofl_catalogue/api/listeners/get/GetMyRequestApiListener.java
0 → 100644
View file @
89c051e8
package
com
.
vsoft
.
uofl_catalogue
.
api
.
listeners
.
get
;
import
com.vsoft.uofl_catalogue.db.models.Catalogue
;
import
com.vsoft.uofl_catalogue.db.models.MyRequest
;
import
java.util.List
;
/**
* @since 1.0
* @author Kunj on 11/8/16
*
*/
public
interface
GetMyRequestApiListener
{
void
onDoneApiCall
(
List
<
MyRequest
>
catalogueList
);
}
app/src/main/java/com/vsoft/uofl_catalogue/api/listeners/get/GetUserApiListener.java
0 → 100644
View file @
89c051e8
package
com
.
vsoft
.
uofl_catalogue
.
api
.
listeners
.
get
;
import
com.vsoft.uofl_catalogue.db.models.MyRequest
;
import
com.vsoft.uofl_catalogue.db.models.UserApiValues
;
import
java.util.List
;
/**
* @since 1.0
* @author Kunj on 11/8/16
*
*/
public
interface
GetUserApiListener
{
void
onDoneApiCall
(
List
<
UserApiValues
>
userValues
);
}
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/MyRequestApiManager.java
0 → 100644
View file @
89c051e8
package
com
.
vsoft
.
uofl_catalogue
.
api
.
managers
;
import
com.google.gson.Gson
;
import
com.google.gson.GsonBuilder
;
import
com.google.gson.JsonDeserializationContext
;
import
com.google.gson.JsonDeserializer
;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonParseException
;
import
com.vsoft.uofl_catalogue.api.RestClient
;
import
com.vsoft.uofl_catalogue.api.interfaces.CatalogueApi
;
import
com.vsoft.uofl_catalogue.api.interfaces.MyRequestApi
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetCatalogueApiListener
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetMyRequestApiListener
;
import
com.vsoft.uofl_catalogue.db.models.Catalogue
;
import
com.vsoft.uofl_catalogue.db.models.MyRequest
;
import
com.vsoft.uofl_catalogue.enums.SyncStatus
;
import
com.vsoft.uofl_catalogue.utils.CatalogueLog
;
import
com.vsoft.uofl_catalogue.utils.Constants
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.io.IOException
;
import
java.lang.reflect.Type
;
import
java.util.ArrayList
;
import
java.util.List
;
import
okhttp3.ResponseBody
;
import
retrofit2.Call
;
import
retrofit2.Response
;
import
retrofit2.Retrofit
;
/**
* Created by kvemulavada on 8/30/2016.
*/
public
class
MyRequestApiManager
{
public
static
SyncStatus
getMyrequests
(
GetMyRequestApiListener
listener
)
{
StringBuilder
stringBuilder
=
new
StringBuilder
();
stringBuilder
.
append
(
MyRequest
.
Json
.
URL_PARAM_CATALOGUE_SYSPRM_QUERY_VALUE
);
final
Retrofit
retrofit
=
RestClient
.
getInitializedRestAdapter
(
Constants
.
API_AUTH_PARAM_USER_NAME
,
Constants
.
API_AUTH_PARAM_PASSWORD
);
Call
<
ResponseBody
>
call
=
retrofit
.
create
(
MyRequestApi
.
class
).
getMyrequest
(
stringBuilder
.
toString
());
try
{
//Retrofit synchronous call
Response
<
ResponseBody
>
response
=
call
.
execute
();
if
(
response
.
isSuccessful
())
{
try
{
JSONObject
jsonObject
=
new
JSONObject
(
response
.
body
().
string
());
JSONObject
error
=
jsonObject
.
optJSONObject
(
Constants
.
RESPONSE_ERROR_OBJECT_NAME
);
if
(
error
==
null
)
{
JSONArray
catalogueJsonArray
=
jsonObject
.
getJSONArray
(
Constants
.
RESPONSE_RESULT_OBJECT_NAME
);
if
(
catalogueJsonArray
.
length
()
>
0
)
{
Gson
gson
=
new
GsonBuilder
()
.
excludeFieldsWithoutExposeAnnotation
()
.
registerTypeAdapter
(
long
.
class
,
new
JsonDeserializer
<
Long
>()
{
@Override
public
Long
deserialize
(
JsonElement
json
,
Type
typeOfT
,
JsonDeserializationContext
context
)
throws
JsonParseException
{
long
value
=
0
;
try
{
value
=
json
.
getAsLong
();
}
catch
(
NumberFormatException
e
)
{
CatalogueLog
.
d
(
"CatalogueApiManager: getCatalogues: deserialize: long.class: NumberFormatException: "
);
}
return
value
;
}
})
.
registerTypeAdapter
(
int
.
class
,
new
JsonDeserializer
<
Integer
>()
{
@Override
public
Integer
deserialize
(
JsonElement
json
,
Type
typeOfT
,
JsonDeserializationContext
context
)
throws
JsonParseException
{
int
value
=
0
;
try
{
value
=
json
.
getAsInt
();
}
catch
(
NumberFormatException
e
)
{
CatalogueLog
.
d
(
"CatalogueApiManager: getCatalogues: deserialize: int.class: NumberFormatException: "
);
}
return
value
;
}
})
.
registerTypeAdapter
(
float
.
class
,
new
JsonDeserializer
<
Float
>()
{
@Override
public
Float
deserialize
(
JsonElement
json
,
Type
typeOfT
,
JsonDeserializationContext
context
)
throws
JsonParseException
{
float
value
=
0
;
try
{
value
=
json
.
getAsFloat
();
}
catch
(
NumberFormatException
e
)
{
CatalogueLog
.
e
(
"CatalogueApiManager: getCatalogues: deserialize: float.class: NumberFormatException: "
,
e
);
}
return
value
;
}
})
.
create
();
List
<
MyRequest
>
catalogueList
=
new
ArrayList
<>(
catalogueJsonArray
.
length
());
for
(
int
i
=
0
;
i
<
catalogueJsonArray
.
length
();
i
++)
{
JSONObject
expenseJsonObject
=
catalogueJsonArray
.
getJSONObject
(
i
);
MyRequest
catalogue
=
gson
.
fromJson
(
expenseJsonObject
.
toString
(),
MyRequest
.
class
);
catalogueList
.
add
(
catalogue
);
}
listener
.
onDoneApiCall
(
catalogueList
);
}
else
{
listener
.
onDoneApiCall
(
new
ArrayList
<
MyRequest
>(
0
));
}
return
SyncStatus
.
SUCCESS
;
}
else
return
SyncStatus
.
FAIL
;
}
catch
(
JSONException
e
)
{
CatalogueLog
.
e
(
"CatalogueApiManager: getCatalogues: onResponse: "
,
e
);
return
SyncStatus
.
FAIL
;
}
catch
(
IOException
e
)
{
CatalogueLog
.
e
(
"CatalogueApiManager: getCatalogues: onResponse: "
,
e
);
return
SyncStatus
.
FAIL
;
}
}
else
{
return
SyncStatus
.
FAIL
;
}
}
catch
(
IOException
e
)
{
CatalogueLog
.
e
(
"CatalogueApiManager: getCatalogues: IOException: "
,
e
);
return
SyncStatus
.
FAIL
;
}
catch
(
NullPointerException
e
)
{
CatalogueLog
.
e
(
"CatalogueApiManager: getCatalogues: NullPointerException: "
,
e
);
return
SyncStatus
.
FAIL
;
}
}
}
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/UserApiManager.java
0 → 100644
View file @
89c051e8
package
com
.
vsoft
.
uofl_catalogue
.
api
.
managers
;
import
com.google.gson.Gson
;
import
com.google.gson.GsonBuilder
;
import
com.google.gson.JsonDeserializationContext
;
import
com.google.gson.JsonDeserializer
;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonParseException
;
import
com.vsoft.uofl_catalogue.api.RestClient
;
import
com.vsoft.uofl_catalogue.api.interfaces.MyRequestApi
;
import
com.vsoft.uofl_catalogue.api.interfaces.UserApi
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetMyRequestApiListener
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetUserApiListener
;
import
com.vsoft.uofl_catalogue.db.models.MyRequest
;
import
com.vsoft.uofl_catalogue.db.models.UserApiValues
;
import
com.vsoft.uofl_catalogue.enums.SyncStatus
;
import
com.vsoft.uofl_catalogue.utils.CatalogueLog
;
import
com.vsoft.uofl_catalogue.utils.Constants
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.io.IOException
;
import
java.lang.reflect.Type
;
import
java.util.ArrayList
;
import
java.util.List
;
import
okhttp3.ResponseBody
;
import
retrofit2.Call
;
import
retrofit2.Response
;
import
retrofit2.Retrofit
;
/**
* Created by kvemulavada on 8/31/2016.
*/
public
class
UserApiManager
{
public
static
SyncStatus
getUserDetailResponse
(
String
userName
,
GetUserApiListener
listener
)
{
final
Retrofit
retrofit
=
RestClient
.
getInitializedRestAdapter
(
Constants
.
API_AUTH_PARAM_USER_NAME
,
Constants
.
API_AUTH_PARAM_PASSWORD
);
Call
<
ResponseBody
>
call
=
retrofit
.
create
(
UserApi
.
class
).
getuserDetails
(
userName
);
try
{
//Retrofit synchronous call
Response
<
ResponseBody
>
response
=
call
.
execute
();
if
(
response
.
isSuccessful
())
{
try
{
JSONObject
jsonObject
=
new
JSONObject
(
response
.
body
().
string
());
JSONObject
error
=
jsonObject
.
optJSONObject
(
Constants
.
RESPONSE_ERROR_OBJECT_NAME
);
if
(
error
==
null
)
{
JSONArray
catalogueJsonArray
=
jsonObject
.
getJSONArray
(
Constants
.
RESPONSE_RESULT_OBJECT_NAME
);
if
(
catalogueJsonArray
.
length
()
>
0
)
{
Gson
gson
=
new
GsonBuilder
()
.
excludeFieldsWithoutExposeAnnotation
()
.
registerTypeAdapter
(
long
.
class
,
new
JsonDeserializer
<
Long
>()
{
@Override
public
Long
deserialize
(
JsonElement
json
,
Type
typeOfT
,
JsonDeserializationContext
context
)
throws
JsonParseException
{
long
value
=
0
;
try
{
value
=
json
.
getAsLong
();
}
catch
(
NumberFormatException
e
)
{
CatalogueLog
.
d
(
"CatalogueApiManager: getCatalogues: deserialize: long.class: NumberFormatException: "
);
}
return
value
;
}
})
.
registerTypeAdapter
(
int
.
class
,
new
JsonDeserializer
<
Integer
>()
{
@Override
public
Integer
deserialize
(
JsonElement
json
,
Type
typeOfT
,
JsonDeserializationContext
context
)
throws
JsonParseException
{
int
value
=
0
;
try
{
value
=
json
.
getAsInt
();
}
catch
(
NumberFormatException
e
)
{
CatalogueLog
.
d
(
"CatalogueApiManager: getCatalogues: deserialize: int.class: NumberFormatException: "
);
}
return
value
;
}
})
.
registerTypeAdapter
(
float
.
class
,
new
JsonDeserializer
<
Float
>()
{
@Override
public
Float
deserialize
(
JsonElement
json
,
Type
typeOfT
,
JsonDeserializationContext
context
)
throws
JsonParseException
{
float
value
=
0
;
try
{
value
=
json
.
getAsFloat
();
}
catch
(
NumberFormatException
e
)
{
CatalogueLog
.
e
(
"CatalogueApiManager: getCatalogues: deserialize: float.class: NumberFormatException: "
,
e
);
}
return
value
;
}
})
.
create
();
List
<
UserApiValues
>
catalogueList
=
new
ArrayList
<>(
catalogueJsonArray
.
length
());
for
(
int
i
=
0
;
i
<
catalogueJsonArray
.
length
();
i
++)
{
JSONObject
expenseJsonObject
=
catalogueJsonArray
.
getJSONObject
(
i
);
UserApiValues
catalogue
=
gson
.
fromJson
(
expenseJsonObject
.
toString
(),
UserApiValues
.
class
);
catalogueList
.
add
(
catalogue
);
}
listener
.
onDoneApiCall
(
catalogueList
);
}
else
{
listener
.
onDoneApiCall
(
new
ArrayList
<
UserApiValues
>(
0
));
}
return
SyncStatus
.
SUCCESS
;
}
else
return
SyncStatus
.
FAIL
;
}
catch
(
JSONException
e
)
{
CatalogueLog
.
e
(
"CatalogueApiManager: getCatalogues: onResponse: "
,
e
);
return
SyncStatus
.
FAIL
;
}
catch
(
IOException
e
)
{
CatalogueLog
.
e
(
"CatalogueApiManager: getCatalogues: onResponse: "
,
e
);
return
SyncStatus
.
FAIL
;
}
}
else
{
return
SyncStatus
.
FAIL
;
}
}
catch
(
IOException
e
)
{
CatalogueLog
.
e
(
"CatalogueApiManager: getCatalogues: IOException: "
,
e
);
return
SyncStatus
.
FAIL
;
}
catch
(
NullPointerException
e
)
{
CatalogueLog
.
e
(
"CatalogueApiManager: getCatalogues: NullPointerException: "
,
e
);
return
SyncStatus
.
FAIL
;
}
}
}
app/src/main/java/com/vsoft/uofl_catalogue/db/models/MyRequest.java
0 → 100644
View file @
89c051e8
package
com
.
vsoft
.
uofl_catalogue
.
db
.
models
;
import
com.google.gson.annotations.Expose
;
import
com.google.gson.annotations.SerializedName
;
/**
* Created by kvemulavada on 8/30/2016.
*/
public
class
MyRequest
{
@SerializedName
(
"number"
)
@Expose
private
String
number
;
@SerializedName
(
"due_date"
)
@Expose
private
String
dueDate
;
@SerializedName
(
"short_description"
)
@Expose
private
String
shotrDescription
;
@SerializedName
(
"approval"
)
@Expose
String
approval
;
public
String
getNumber
()
{
return
number
;
}
public
void
setNumber
(
String
number
)
{
this
.
number
=
number
;
}
public
String
getDueDate
()
{
return
dueDate
;
}
public
void
setDueDate
(
String
dueDate
)
{
this
.
dueDate
=
dueDate
;
}
public
String
getShotrDescription
()
{
return
shotrDescription
;
}
public
void
setShotrDescription
(
String
shotrDescription
)
{
this
.
shotrDescription
=
shotrDescription
;
}
public
String
getApproval
()
{
return
approval
;
}
public
void
setApproval
(
String
approval
)
{
this
.
approval
=
approval
;
}
public
static
class
Json
{
public
static
final
String
URL_PARAM_CATALOGUE_SYSPRM_QUERY_VALUE
=
"request.requested_for=javascript:gs.getUserID()"
;
}
}
app/src/main/java/com/vsoft/uofl_catalogue/db/models/UserApiValues.java
0 → 100644
View file @
89c051e8
package
com
.
vsoft
.
uofl_catalogue
.
db
.
models
;
import
com.google.gson.annotations.Expose
;
import
com.google.gson.annotations.SerializedName
;
/**
* Created by kvemulavada on 8/31/2016.
*/
public
class
UserApiValues
{
@SerializedName
(
"first_name"
)
@Expose
private
String
firstName
;
@SerializedName
(
"last_name"
)
@Expose
private
String
lastName
;
@SerializedName
(
"sys_id"
)
@Expose
private
String
sysId
;
public
String
getFirstName
()
{
return
firstName
;
}
public
void
setFirstName
(
String
firstName
)
{
this
.
firstName
=
firstName
;
}
public
String
getLastName
()
{
return
lastName
;
}
public
void
setLastName
(
String
lastName
)
{
this
.
lastName
=
lastName
;
}
public
String
getSysId
()
{
return
sysId
;
}
public
void
setSysId
(
String
sysId
)
{
this
.
sysId
=
sysId
;
}
}
app/src/main/java/com/vsoft/uofl_catalogue/ui/HomeScreen.java
View file @
89c051e8
package
com
.
vsoft
.
uofl_catalogue
.
ui
;
package
com
.
vsoft
.
uofl_catalogue
.
ui
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.widget.GridView
;
import
android.widget.GridView
;
import
com.vsoft.uofl_catalogue.R
;
import
com.vsoft.uofl_catalogue.R
;
import
com.vsoft.uofl_catalogue.adapters.HomeScreenAdapter
;
import
com.vsoft.uofl_catalogue.adapters.HomeScreenAdapter
;
import
com.vsoft.uofl_catalogue.utils.PrefManager
;
import
butterknife.BindView
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
butterknife.ButterKnife
;
...
@@ -16,13 +19,19 @@ import butterknife.OnItemClick;
...
@@ -16,13 +19,19 @@ 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
{
private
String
firstName
,
lastName
,
sysId
;
@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
)
{
// TODO Auto-generated method stub
// TODO Auto-generated method stub
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
home_screen
);
setContentView
(
R
.
layout
.
home_screen
);
SharedPreferences
sharedPreferences
=
getSharedPreferences
(
PrefManager
.
PREFERENCES_USER_VALUES_KEY
,
Context
.
MODE_PRIVATE
);
firstName
=
sharedPreferences
.
getString
(
PrefManager
.
PREFERENCES_FIRST_NAME
,
""
);
lastName
=
sharedPreferences
.
getString
(
PrefManager
.
PREFERENCE_LAST_NAME
,
""
);
sysId
=
sharedPreferences
.
getString
(
PrefManager
.
PREFERENCE_SYS_ID
,
""
);
ButterKnife
.
bind
(
this
);
ButterKnife
.
bind
(
this
);
mGridView
.
setAdapter
(
new
HomeScreenAdapter
(
this
,
getResources
().
getStringArray
(
R
.
array
.
home_screen_array
),
getResources
().
obtainTypedArray
(
R
.
array
.
home_screen_icon_array
)));
mGridView
.
setAdapter
(
new
HomeScreenAdapter
(
this
,
getResources
().
getStringArray
(
R
.
array
.
home_screen_array
),
getResources
().
obtainTypedArray
(
R
.
array
.
home_screen_icon_array
)));
}
}
...
@@ -33,6 +42,8 @@ public class HomeScreen extends Activity {
...
@@ -33,6 +42,8 @@ public class HomeScreen extends Activity {
startActivity
(
new
Intent
(
HomeScreen
.
this
,
ReportIncidentScreen
.
class
));
startActivity
(
new
Intent
(
HomeScreen
.
this
,
ReportIncidentScreen
.
class
));
}
else
if
(
position
==
1
)
{
}
else
if
(
position
==
1
)
{
startActivity
(
new
Intent
(
HomeScreen
.
this
,
CatalogueScreen
.
class
));
startActivity
(
new
Intent
(
HomeScreen
.
this
,
CatalogueScreen
.
class
));
}
else
if
(
position
==
3
)
{
startActivity
(
new
Intent
(
HomeScreen
.
this
,
MyRequestActivity
.
class
));
}
}
}
}
}
}
app/src/main/java/com/vsoft/uofl_catalogue/ui/LoginScreen.java
View file @
89c051e8
...
@@ -9,8 +9,17 @@ import android.widget.EditText;
...
@@ -9,8 +9,17 @@ import android.widget.EditText;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.vsoft.uofl_catalogue.R
;
import
com.vsoft.uofl_catalogue.R
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetMyRequestApiListener
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetUserApiListener
;
import
com.vsoft.uofl_catalogue.api.managers.LoginApiManger
;
import
com.vsoft.uofl_catalogue.api.managers.LoginApiManger
;
import
com.vsoft.uofl_catalogue.api.managers.MyRequestApiManager
;
import
com.vsoft.uofl_catalogue.api.managers.UserApiManager
;
import
com.vsoft.uofl_catalogue.db.models.MyRequest
;
import
com.vsoft.uofl_catalogue.db.models.UserApiValues
;
import
com.vsoft.uofl_catalogue.enums.SyncStatus
;
import
com.vsoft.uofl_catalogue.enums.SyncStatus
;
import
com.vsoft.uofl_catalogue.utils.PrefManager
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
butterknife.ButterKnife
;
...
@@ -26,12 +35,16 @@ public class LoginScreen extends Activity {
...
@@ -26,12 +35,16 @@ public class LoginScreen extends Activity {
EditText
userName
;
EditText
userName
;
@BindView
(
R
.
id
.
login_screen_password_edit_text
)
@BindView
(
R
.
id
.
login_screen_password_edit_text
)
EditText
password
;
EditText
password
;
private
List
<
UserApiValues
>
mUserDetails
;
private
PrefManager
prefManager
;
@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
.
login_screen
);
setContentView
(
R
.
layout
.
login_screen
);
prefManager
=
PrefManager
.
getInstance
();
prefManager
.
init
(
LoginScreen
.
this
);
ButterKnife
.
bind
(
this
);
ButterKnife
.
bind
(
this
);
}
}
...
@@ -44,6 +57,7 @@ public class LoginScreen extends Activity {
...
@@ -44,6 +57,7 @@ public class LoginScreen extends Activity {
class
LoginDetailsSendToServer
extends
AsyncTask
<
String
,
Void
,
SyncStatus
>
{
class
LoginDetailsSendToServer
extends
AsyncTask
<
String
,
Void
,
SyncStatus
>
{
private
ProgressDialog
progressDialog
;
private
ProgressDialog
progressDialog
;
private
String
userName
;
@Override
@Override
protected
void
onPreExecute
()
{
protected
void
onPreExecute
()
{
super
.
onPreExecute
();
super
.
onPreExecute
();
...
@@ -55,12 +69,13 @@ public class LoginScreen extends Activity {
...
@@ -55,12 +69,13 @@ public class LoginScreen extends Activity {
@Override
@Override
protected
SyncStatus
doInBackground
(
String
...
params
)
{
protected
SyncStatus
doInBackground
(
String
...
params
)
{
String
grant
_t
ype
=
"password"
;
String
grant
T
ype
=
"password"
;
String
client
_i
d
=
"ac0dd3408c1031006907010c2cc6ef6d"
;
String
client
I
d
=
"ac0dd3408c1031006907010c2cc6ef6d"
;
String
client
_s
ecret
=
"oklj6znxv3o9jmyn2mlp"
;
String
client
S
ecret
=
"oklj6znxv3o9jmyn2mlp"
;
String
usern
ame
=
params
[
0
];
//"a0kuma18";
userN
ame
=
params
[
0
];
//"a0kuma18";
String
password
=
params
[
1
];
//"v$0ftA$win";
String
password
=
params
[
1
];
//"v$0ftA$win";
SyncStatus
syncStatus
=
LoginApiManger
.
submitLoginValues
(
grant_type
,
client_id
,
client_secret
,
username
,
password
);
SyncStatus
syncStatus
=
LoginApiManger
.
submitLoginValues
(
grantType
,
clientId
,
clientSecret
,
userName
,
password
);
return
syncStatus
;
return
syncStatus
;
}
}
...
@@ -71,10 +86,56 @@ public class LoginScreen extends Activity {
...
@@ -71,10 +86,56 @@ public class LoginScreen extends Activity {
progressDialog
.
dismiss
();
progressDialog
.
dismiss
();
}
}
if
(
syncStatus
==
SyncStatus
.
SUCCESS
)
{
if
(
syncStatus
==
SyncStatus
.
SUCCESS
)
{
startActivity
(
new
Intent
(
LoginScreen
.
this
,
HomeScreen
.
class
));
new
UserApiDetails
().
execute
(
userName
);
//startActivity(new Intent(LoginScreen.this, HomeScreen.class));
}
else
{
}
else
{
Toast
.
makeText
(
LoginScreen
.
this
,
"Invalid username and password"
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
LoginScreen
.
this
,
"Invalid username and password"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
}
}
class
UserApiDetails
extends
AsyncTask
<
String
,
Void
,
SyncStatus
>
{
private
ProgressDialog
progressDialog
;
@Override
protected
void
onPreExecute
()
{
super
.
onPreExecute
();
progressDialog
=
new
ProgressDialog
(
LoginScreen
.
this
);
progressDialog
.
setMessage
(
getString
(
R
.
string
.
loading_string
));
progressDialog
.
show
();
progressDialog
.
setCancelable
(
false
);
}
@Override
protected
SyncStatus
doInBackground
(
String
...
params
)
{
String
userName
=
params
[
0
];
SyncStatus
syncStatus
=
UserApiManager
.
getUserDetailResponse
(
userName
,
new
GetUserApiListener
()
{
@Override
public
void
onDoneApiCall
(
List
<
UserApiValues
>
userValues
)
{
mUserDetails
=
userValues
;
}
});
return
syncStatus
;
}
@Override
protected
void
onPostExecute
(
SyncStatus
syncStatus
)
{
super
.
onPostExecute
(
syncStatus
);
if
(
progressDialog
!=
null
&&
progressDialog
.
isShowing
())
{
progressDialog
.
dismiss
();
}
if
(
syncStatus
==
SyncStatus
.
SUCCESS
)
{
if
(
mUserDetails
!=
null
)
{
String
firstname
=
mUserDetails
.
get
(
0
).
getFirstName
();
String
lasrname
=
mUserDetails
.
get
(
0
).
getLastName
();
String
sysid
=
mUserDetails
.
get
(
0
).
getSysId
();
PrefManager
.
saveUserDetailsInPreferences
(
LoginScreen
.
this
,
firstname
,
lasrname
,
sysid
);
startActivity
(
new
Intent
(
LoginScreen
.
this
,
HomeScreen
.
class
));
}
}
else
{
Toast
.
makeText
(
LoginScreen
.
this
,
"Invalid username and password"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
}
}
}
}
}
app/src/main/java/com/vsoft/uofl_catalogue/ui/MyRequestActivity.java
0 → 100644
View file @
89c051e8
package
com
.
vsoft
.
uofl_catalogue
.
ui
;
import
android.app.ProgressDialog
;
import
android.content.DialogInterface
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.support.v7.app.ActionBar
;
import
android.support.v7.app.AlertDialog
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.widget.Toolbar
;
import
android.view.MenuItem
;
import
android.widget.ListView
;
import
com.vsoft.uofl_catalogue.CatalogueApplication
;
import
com.vsoft.uofl_catalogue.R
;
import
com.vsoft.uofl_catalogue.adapters.MyRequestAdapter
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetMyRequestApiListener
;
import
com.vsoft.uofl_catalogue.api.managers.MyRequestApiManager
;
import
com.vsoft.uofl_catalogue.db.models.MyRequest
;
import
com.vsoft.uofl_catalogue.enums.SyncStatus
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
/**
* Created by kvemulavada on 8/30/2016.
*/
public
class
MyRequestActivity
extends
AppCompatActivity
{
@BindView
(
R
.
id
.
tool_bar_view
)
Toolbar
mToolbar
;
@BindView
(
R
.
id
.
request_screen_list_view
)
ListView
mListView
;
private
List
<
MyRequest
>
mMyrequestList
;
private
CatalogueApplication
mApplication
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
// TODO Auto-generated method stub
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
request_list_screen
);
ButterKnife
.
bind
(
this
);
mApplication
=
(
CatalogueApplication
)
getApplication
();
setSupportActionBar
(
mToolbar
);
ActionBar
actionBar
=
getSupportActionBar
();
if
(
actionBar
!=
null
)
{
actionBar
.
setDisplayHomeAsUpEnabled
(
true
);
actionBar
.
setElevation
(
0
);
actionBar
.
setTitle
(
R
.
string
.
my_reques_string
);
actionBar
.
setTitle
(
R
.
string
.
my_reques_string
);
actionBar
.
setDisplayShowHomeEnabled
(
false
);
actionBar
.
setDisplayShowTitleEnabled
(
true
);
}
if
(
mApplication
.
isNetConnected
())
{
new
FetchMyRequestData
().
execute
();
}
else
{
showErrorDialog
(
R
.
string
.
internet_validation_string
);
}
}
class
FetchMyRequestData
extends
AsyncTask
<
String
,
Void
,
SyncStatus
>
{
private
ProgressDialog
progressDialog
;
@Override
protected
void
onPreExecute
()
{
super
.
onPreExecute
();
progressDialog
=
new
ProgressDialog
(
MyRequestActivity
.
this
);
progressDialog
.
setMessage
(
getString
(
R
.
string
.
loading_string
));
progressDialog
.
show
();
progressDialog
.
setCancelable
(
false
);
}
@Override
protected
SyncStatus
doInBackground
(
String
...
params
)
{
SyncStatus
syncStatus
=
MyRequestApiManager
.
getMyrequests
(
new
GetMyRequestApiListener
()
{
@Override
public
void
onDoneApiCall
(
List
<
MyRequest
>
requestList
)
{
mMyrequestList
=
requestList
;
}
});
return
syncStatus
;
}
@Override
protected
void
onPostExecute
(
SyncStatus
syncStatus
)
{
super
.
onPostExecute
(
syncStatus
);
if
(
progressDialog
!=
null
&&
progressDialog
.
isShowing
())
{
progressDialog
.
dismiss
();
}
if
(
syncStatus
==
SyncStatus
.
SUCCESS
)
{
if
(
mMyrequestList
!=
null
)
setData
(
mMyrequestList
);
}
else
{
showErrorDialog
(
R
.
string
.
failed_to_fetch_catalogue_category_string
);
}
}
}
private
void
setData
(
final
List
<
MyRequest
>
reqList
)
{
MyRequestAdapter
adapter
=
new
MyRequestAdapter
(
MyRequestActivity
.
this
);
adapter
.
setRequestList
(
reqList
);
mListView
.
setAdapter
(
adapter
);
}
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
menuItem
)
{
if
(
menuItem
.
getItemId
()
==
android
.
R
.
id
.
home
)
{
finish
();
}
return
super
.
onOptionsItemSelected
(
menuItem
);
}
private
void
showErrorDialog
(
int
message
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
this
);
builder
.
setMessage
(
message
)
.
setCancelable
(
false
)
.
setPositiveButton
(
android
.
R
.
string
.
ok
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
id
)
{
finish
();
}
});
AlertDialog
alert
=
builder
.
create
();
alert
.
show
();
}
}
app/src/main/java/com/vsoft/uofl_catalogue/utils/Constants.java
View file @
89c051e8
...
@@ -25,6 +25,7 @@ public class Constants {
...
@@ -25,6 +25,7 @@ public class Constants {
*/
*/
public
static
final
String
URL_PARAM_SYSPRM_QUERY
=
"sysparm_query"
;
public
static
final
String
URL_PARAM_SYSPRM_QUERY
=
"sysparm_query"
;
public
static
final
String
URL_PARAM_SYSPRM_FIELDS
=
"sysparm_fields"
;
public
static
final
String
URL_PARAM_SYSPRM_FIELDS
=
"sysparm_fields"
;
public
static
final
String
URL_PARAM_SYSPRM_USERNAME
=
"user_name"
;
/**
/**
* Debug logs
* Debug logs
...
@@ -112,4 +113,7 @@ public class Constants {
...
@@ -112,4 +113,7 @@ public class Constants {
public
static
final
String
URL_POST_CATALOGUE_ITEM
=
"api/uno33/uofl_mobile"
;
public
static
final
String
URL_POST_CATALOGUE_ITEM
=
"api/uno33/uofl_mobile"
;
public
static
final
String
URL_GET_REFERENCE
=
API_PATH
;
public
static
final
String
URL_GET_REFERENCE
=
API_PATH
;
public
static
final
String
URL_POST_LOGIN_ITEM
=
"/oauth_token.do"
;
public
static
final
String
URL_POST_LOGIN_ITEM
=
"/oauth_token.do"
;
public
static
final
String
URL_GET_MYREQUEST
=
API_PATH
+
"sc_req_item"
;
public
static
final
String
URL_GET_USERDETAILS
=
API_PATH
+
"sys_user"
;
}
}
app/src/main/java/com/vsoft/uofl_catalogue/utils/PrefManager.java
0 → 100644
View file @
89c051e8
package
com
.
vsoft
.
uofl_catalogue
.
utils
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.preference.PreferenceManager
;
/**
* Created by krishna on 08-31-2016.
*/
public
class
PrefManager
{
private
static
volatile
PrefManager
pSelf
=
null
;
String
TAG
=
PrefManager
.
class
.
getSimpleName
();
public
SharedPreferences
sharedPref
=
null
;
private
SharedPreferences
.
Editor
editor
=
null
;
//Login Preferences
public
static
final
String
PREFERENCES_USER_VALUES_KEY
=
"UserPrefs"
;
public
static
final
String
PREFERENCES_FIRST_NAME
=
"firstName"
;
public
static
final
String
PREFERENCE_LAST_NAME
=
"lastName"
;
public
static
final
String
PREFERENCE_SYS_ID
=
"sysId"
;
public
static
PrefManager
getInstance
(){
if
(
pSelf
==
null
){
synchronized
(
PrefManager
.
class
){
if
(
pSelf
==
null
){
pSelf
=
new
PrefManager
();
}
}
}
return
pSelf
;
}
/**
* save username and password in shared preferences
* @param context
* @param firstname
* @param lastname
* @param sysid
*/
public
static
void
saveUserDetailsInPreferences
(
Context
context
,
String
firstname
,
String
lastname
,
String
sysid
)
{
SharedPreferences
sharedPreferences
=
context
.
getSharedPreferences
(
PREFERENCES_USER_VALUES_KEY
,
Context
.
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
sharedPreferences
.
edit
();
/**
* some times we are getting a username with white space
* so we just removed here
*/
editor
.
putString
(
PREFERENCES_FIRST_NAME
,
firstname
);
editor
.
putString
(
PREFERENCE_LAST_NAME
,
lastname
);
editor
.
putString
(
PREFERENCE_SYS_ID
,
sysid
);
editor
.
commit
();
}
public
void
init
(
Context
context
){
sharedPref
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
editor
=
sharedPref
.
edit
();
}
//! Generic function to get boolean value for specified key.
public
boolean
getPrefValueBoolean
(
String
mKey
,
boolean
defValue
){
return
sharedPref
.
getBoolean
(
mKey
,
defValue
);
}
//! Generic function to get int value for specified key.
public
int
getPrefValueInt
(
String
mKey
,
int
defValue
){
return
sharedPref
.
getInt
(
mKey
,
defValue
);
}
//! Generic function to string value for specified key.
public
String
getPrefValueString
(
String
mKey
,
String
defValue
){
return
sharedPref
.
getString
(
mKey
,
defValue
);
}
public
Long
getPrefValueLong
(
String
mKey
,
Long
defValue
){
return
sharedPref
.
getLong
(
mKey
,
defValue
);
}
public
void
putPrefValueBoolean
(
String
mKey
,
boolean
mValue
){
editor
.
putBoolean
(
mKey
,
mValue
);
editor
.
commit
();
}
public
void
putPrefValueInt
(
String
mKey
,
int
mValue
){
editor
.
putInt
(
mKey
,
mValue
);
editor
.
commit
();
}
public
void
putPrefValueString
(
String
mKey
,
String
mValue
){
editor
.
putString
(
mKey
,
mValue
);
editor
.
commit
();
}
public
void
putLong
(
String
mKey
,
long
mValue
){
editor
.
putLong
(
mKey
,
mValue
);
editor
.
commit
();
}
}
app/src/main/res/drawable/circle.xml
0 → 100644
View file @
89c051e8
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"oval"
>
<solid
android:color=
"#666666"
/>
<size
android:width=
"120dp"
android:height=
"120dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/layout/request_list_item.xml
0 → 100644
View file @
89c051e8
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#ffffff"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Large Text"
android:id=
"@+id/number"
android:textSize=
"20dp"
android:textStyle=
"bold"
android:layout_alignParentTop=
"true"
android:layout_alignParentLeft=
"true"
android:layout_alignParentStart=
"true"
android:layout_marginTop=
"15dp"
android:layout_marginLeft=
"15dp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Large Text"
android:id=
"@+id/dueDate"
android:textColor=
"#8e8e8e"
android:textSize=
"15dp"
android:layout_marginTop=
"15dp"
android:layout_below=
"@+id/number"
android:layout_marginRight=
"15dp"
android:layout_alignParentRight=
"true"
android:layout_alignBaseline=
"@+id/number"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Large Text"
android:id=
"@+id/shotrDescription"
android:textSize=
"20dp"
android:textColor=
"#000000"
android:textStyle=
"bold"
android:layout_marginTop=
"15dp"
android:layout_below=
"@+id/number"
android:layout_alignLeft=
"@+id/number"
android:layout_alignStart=
"@+id/number"
/>
<ImageView
android:layout_width=
"15dp"
android:layout_height=
"15dp"
android:id=
"@+id/approval_image"
android:background=
"@drawable/circle"
android:layout_alignTop=
"@+id/approval"
android:layout_alignLeft=
"@+id/shotrDescription"
android:layout_alignStart=
"@+id/shotrDescription"
android:layout_marginBottom=
"15dp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Large Text"
android:id=
"@+id/approval"
android:textSize=
"15dp"
android:textColor=
"#8e8e8e"
android:layout_marginLeft=
"10dp"
android:layout_marginTop=
"20dp"
android:layout_toRightOf=
"@+id/approval_image"
android:layout_below=
"@+id/shotrDescription"
/>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/layout/request_list_screen.xml
0 → 100644
View file @
89c051e8
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/screen_bg_color"
>
<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=
"@android:color/white"
android:minHeight=
"?attr/actionBarSize"
android:padding=
"0dp"
android:contentInsetEnd=
"0dp"
android:contentInsetRight=
"0dp"
android:contentInsetStart=
"0dp"
app:contentInsetEnd=
"0dp"
app:contentInsetLeft=
"0dp"
app:contentInsetRight=
"0dp"
app:contentInsetStart=
"0dp"
/>
<ListView
android:id=
"@+id/request_screen_list_view"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@android:color/white"
android:layout_margin=
"8dp"
android:padding=
"10dp"
android:divider=
"#8e8e8e"
android:dividerHeight=
"0.5dp"
android:scrollbars=
"none"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
89c051e8
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
<!--Catalogue Screen-->
<!--Catalogue Screen-->
<string
name=
"catalogue_category_string"
>
Catalogue Category
</string>
<string
name=
"catalogue_category_string"
>
Catalogue Category
</string>
<string
name=
"my_reques_string"
>
My Requests
</string>
<!--Incident screen-->
<!--Incident screen-->
<string
name=
"incident_form_report_incident_text_string"
>
Report Incident
</string>
<string
name=
"incident_form_report_incident_text_string"
>
Report Incident
</string>
...
...
app/src/main/res/values/styles.xml
View file @
89c051e8
...
@@ -26,4 +26,5 @@
...
@@ -26,4 +26,5 @@
<item
name=
"android:windowNoTitle"
>
true
</item>
<item
name=
"android:windowNoTitle"
>
true
</item>
<item
name=
"android:windowContentOverlay"
>
@null
</item>
<item
name=
"android:windowContentOverlay"
>
@null
</item>
</style>
</style>
</resources>
</resources>
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