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
1310b51d
authored
Mar 20, 2018
by
Kunj Gupta
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Added Notification part and Device Registration API in Arrow.
parent
ab925e59
Show whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
398 additions
and
200 deletions
app/google-services.json
app/src/arrow/google-services.json
app/src/arrow/java/com/vsoft/servicenow/AppConfig.java
app/src/arrow/java/com/vsoft/servicenow/ui/HomeScreen.java
app/src/arrow/res/values/arrays.xml
app/src/ge/java/com/vsoft/servicenow/AppConfig.java
app/src/ge/java/com/vsoft/servicenow/ui/HomeScreen.java
app/src/main/AndroidManifest.xml
app/src/main/java/com/vsoft/servicenow/adapters/NotificationAdapter.java
app/src/main/java/com/vsoft/servicenow/api/interfaces/UserApi.java
app/src/main/java/com/vsoft/servicenow/api/listeners/put/PutDeviceRegistrationApiListener.java
app/src/main/java/com/vsoft/servicenow/api/managers/UserApiManager.java
app/src/main/java/com/vsoft/servicenow/db/DBManager.java
app/src/main/java/com/vsoft/servicenow/db/managers/NotificationsManager.java
app/src/main/java/com/vsoft/servicenow/db/models/Notifications.java
app/src/main/java/com/vsoft/servicenow/service/NotificationInstanceIdService.java
app/src/main/java/com/vsoft/servicenow/service/NotificationMessagingService.java
app/src/main/java/com/vsoft/servicenow/ui/CatalogueItemScreen.java
app/src/main/java/com/vsoft/servicenow/ui/CatalogueScreen.java
app/src/main/java/com/vsoft/servicenow/ui/CatalogueVariableScreen.java
app/src/main/java/com/vsoft/servicenow/ui/HandleNotificationActivity.java
app/src/main/java/com/vsoft/servicenow/ui/LoginScreen.java
app/src/main/java/com/vsoft/servicenow/ui/MyIncidentScreen.java
app/src/main/java/com/vsoft/servicenow/ui/MyRequestActivity.java
app/src/main/java/com/vsoft/servicenow/ui/NotificationScreen.java
app/src/main/java/com/vsoft/servicenow/ui/ReportIncidentScreen.java
app/src/main/java/com/vsoft/servicenow/utils/Constants.java
app/src/main/java/com/vsoft/servicenow/utils/DBConstants.java
app/src/main/res/layout/notification_adapter.xml
app/src/main/res/layout/notification_screen.xml
app/src/main/res/values/colors.xml
app/src/main/res/values/dimen.xml
app/src/main/res/values/strings.xml
app/google-services.json
View file @
1310b51d
{
"project_info"
:
{
"project_number"
:
"222593508124"
,
"firebase_url"
:
"https://v-soft-poc-apps.firebaseio.com"
,
"project_id"
:
"v-soft-poc-apps"
,
"storage_bucket"
:
"v-soft-poc-apps.appspot.com"
"project_number"
:
"593992849158"
,
"project_id"
:
"uofl-servicenow-android"
},
"client"
:
[
{
"client_info"
:
{
"mobilesdk_app_id"
:
"1:
222593508124:android:d77c1b70d2a38b4d
"
,
"mobilesdk_app_id"
:
"1:
593992849158:android:84f481659dc7e412
"
,
"android_client_info"
:
{
"package_name"
:
"com.vsoft.
servicenow.arrow.debug
"
"package_name"
:
"com.vsoft.
uoflservicenow
"
}
},
"oauth_client"
:
[
{
"client_id"
:
"222593508124-1jq94gaia4oahk321cd8ud74jv6tqgr3.apps.googleusercontent.com"
,
"client_type"
:
3
}
],
"oauth_client"
:
[],
"api_key"
:
[
{
"current_key"
:
"AIzaSy
ALtTZoenaAEMfqvBLlHRsAU4P_aoOYBL
g"
"current_key"
:
"AIzaSy
BEzc7fo12bQLx8CkogSGIb2j-vivdbJN
g"
}
],
"services"
:
{
"analytics_service"
:
{
"status"
:
1
"status"
:
2
,
"analytics_property"
:
{
"tracking_id"
:
"UA-83545030-1"
}
},
"appinvite_service"
:
{
"status"
:
1
,
"other_platform_oauth_client"
:
[]
},
"ads_service"
:
{
"status"
:
2
"status"
:
1
}
}
}
...
...
app/src/arrow/google-services.json
0 → 100644
View file @
1310b51d
{
"project_info"
:
{
"project_number"
:
"222593508124"
,
"firebase_url"
:
"https://v-soft-poc-apps.firebaseio.com"
,
"project_id"
:
"v-soft-poc-apps"
,
"storage_bucket"
:
"v-soft-poc-apps.appspot.com"
},
"client"
:
[
{
"client_info"
:
{
"mobilesdk_app_id"
:
"1:222593508124:android:d77c1b70d2a38b4d"
,
"android_client_info"
:
{
"package_name"
:
"com.vsoft.servicenow.arrow.debug"
}
},
"oauth_client"
:
[
{
"client_id"
:
"222593508124-1jq94gaia4oahk321cd8ud74jv6tqgr3.apps.googleusercontent.com"
,
"client_type"
:
3
}
],
"api_key"
:
[
{
"current_key"
:
"AIzaSyALtTZoenaAEMfqvBLlHRsAU4P_aoOYBLg"
}
],
"services"
:
{
"analytics_service"
:
{
"status"
:
1
},
"appinvite_service"
:
{
"status"
:
1
,
"other_platform_oauth_client"
:
[]
},
"ads_service"
:
{
"status"
:
2
}
}
}
],
"configuration_version"
:
"1"
}
\ No newline at end of file
app/src/arrow/java/com/vsoft/servicenow/AppConfig.java
View file @
1310b51d
...
...
@@ -5,7 +5,7 @@ package com.vsoft.servicenow;
*/
public
class
AppConfig
{
public
static
final
String
CHAT_SERVER_URL
=
"http://111.93.6.218:12910/"
;
//https://socket-io-chat.now.sh/";
public
static
final
String
CHAT_SERVER_URL
=
"http://111.93.6.218:12910/"
;
public
static
final
String
APP_INTERNAL_NAME
=
"Arrow"
;
...
...
app/src/arrow/java/com/vsoft/servicenow/ui/HomeScreen.java
View file @
1310b51d
package
com
.
vsoft
.
servicenow
.
ui
;
import
android.app.Notification
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.res.TypedArray
;
...
...
@@ -31,7 +32,7 @@ import butterknife.OnItemClick;
/**
* Created by Kunj on 11/8/16.
*/
public
class
HomeScreen
extends
AppCompat
Activity
{
public
class
HomeScreen
extends
HandleNotification
Activity
{
@BindView
(
R
.
id
.
tool_bar_view
)
Toolbar
mToolbar
;
@BindView
(
R
.
id
.
home_screen_grid_view
)
GridView
mGridView
;
...
...
@@ -73,6 +74,9 @@ public class HomeScreen extends AppCompatActivity {
Intent
intent
=
new
Intent
(
HomeScreen
.
this
,
ChatActivity
.
class
);
intent
.
putExtra
(
Constants
.
DATA_KEY_CHAT_USER_NAME
,
userFirstName
);
startActivity
(
intent
);
}
else
if
(
position
==
5
)
{
Intent
intent
=
new
Intent
(
HomeScreen
.
this
,
NotificationScreen
.
class
);
startActivity
(
intent
);
}
}
...
...
app/src/arrow/res/values/arrays.xml
View file @
1310b51d
...
...
@@ -6,6 +6,7 @@
<item>
My Incidents
</item>
<item>
My Requests
</item>
<item>
Chatbot
</item>
<item>
Notifications
</item>
</string-array>
<array
name=
"home_screen_icon_array"
>
<item>
@drawable/ic_myincident_icon
</item>
...
...
@@ -13,6 +14,7 @@
<item>
@drawable/ic_my_incidents_icon
</item>
<item>
@drawable/ic_my_requiest_icon
</item>
<item>
@drawable/ic_my_requiest_icon
</item>
<item>
@drawable/ic_my_requiest_icon
</item>
</array>
<string-array
name=
"incident_impact_array"
>
<item>
-None-
</item>
...
...
app/src/ge/java/com/vsoft/servicenow/AppConfig.java
View file @
1310b51d
...
...
@@ -7,6 +7,8 @@ public class AppConfig {
public
static
final
String
APP_INTERNAL_NAME
=
"GE"
;
public
static
final
String
CHAT_SERVER_URL
=
"http://111.93.6.218:12910/"
;
public
static
final
String
DOMAIN_PRODUCTION
=
"https://ven01199.service-now.com/"
;
public
static
final
String
DOMAIN_TEST
=
"https://geapplightrnd.service-now.com/"
;
...
...
app/src/ge/java/com/vsoft/servicenow/ui/HomeScreen.java
View file @
1310b51d
...
...
@@ -24,7 +24,7 @@ import butterknife.OnItemClick;
/**
* Created by Kunj on 11/8/16.
*/
public
class
HomeScreen
extends
AppCompatActivity
{
public
class
HomeScreen
extends
android
.
support
.
v7
.
app
.
AppCompatActivity
{
@BindView
(
R
.
id
.
tool_bar_view
)
Toolbar
mToolbar
;
@BindView
(
R
.
id
.
home_screen_grid_view
)
GridView
mGridView
;
...
...
app/src/main/AndroidManifest.xml
View file @
1310b51d
...
...
@@ -46,7 +46,6 @@
</compatible-screens>
<application
android:name=
"com.vsoft.servicenow.CatalogueApplication"
android:allowBackup=
"true"
android:icon=
"@mipmap/ic_launcher"
android:label=
"@string/app_name"
android:supportsRtl=
"true"
...
...
@@ -88,6 +87,9 @@
<activity
android:name=
"com.vsoft.servicenow.ui.MyIncidentScreen"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
"com.vsoft.servicenow.ui.NotificationScreen"
android:screenOrientation=
"portrait"
/>
<service
android:name=
".service.SyncService"
/>
...
...
app/src/main/java/com/vsoft/servicenow/adapters/NotificationAdapter.java
View file @
1310b51d
...
...
@@ -65,14 +65,9 @@ public class NotificationAdapter extends RecyclerView.Adapter<NotificationAdapte
// - replace the contents of the view with that element
final
Notifications
notifications
=
mNotificationsList
.
get
(
position
);
holder
.
titleTextView
.
setText
(
notifications
.
getTitle
());
holder
.
messageTextView
.
setText
(
notifications
.
getMessage
());
holder
.
dateTextView
.
setText
(
Util
.
getDateTimeStringForDisplay
(
notifications
.
getTime
()));
// holder.deleteImageView.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// showSuccessfulLogoutDialog(notifications);
// }
// });
holder
.
shortDesTextView
.
setText
(
notifications
.
getShortDescription
());
holder
.
priorityTextView
.
setText
(
notifications
.
getPriority
());
holder
.
createdByTextView
.
setText
(
notifications
.
getCreated_by
());
}
/**
...
...
@@ -87,19 +82,15 @@ public class NotificationAdapter extends RecyclerView.Adapter<NotificationAdapte
/**
* messageTextView: This is message text view.
*/
@BindView
(
R
.
id
.
notification_adapter_
message
_text_view
)
TextView
message
TextView
;
@BindView
(
R
.
id
.
notification_adapter_
short_des
_text_view
)
TextView
shortDes
TextView
;
/**
* dateTextView: This is date text view.
*/
@BindView
(
R
.
id
.
notification_adapter_date_text_view
)
TextView
dateTextView
;
/**
* deleteImageView: This is delete icon image view.
*/
// @BindView(R.id.notification_adapter_delete_image_view)
// ImageView deleteImageView;
@BindView
(
R
.
id
.
notification_adapter_priority_text_view
)
TextView
priorityTextView
;
@BindView
(
R
.
id
.
notification_adapter_created_by_text_view
)
TextView
createdByTextView
;
/**
* Constructor of NotificationHolder class.
*/
...
...
app/src/main/java/com/vsoft/servicenow/api/interfaces/UserApi.java
View file @
1310b51d
...
...
@@ -4,8 +4,12 @@ import com.vsoft.servicenow.utils.Constants;
import
okhttp3.ResponseBody
;
import
retrofit2.Call
;
import
retrofit2.http.Body
;
import
retrofit2.http.GET
;
import
retrofit2.http.PUT
;
import
retrofit2.http.Path
;
import
retrofit2.http.Query
;
import
retrofit2.http.Url
;
/**
...
...
@@ -14,11 +18,14 @@ import retrofit2.http.Query;
*
*/
public
interface
UserApi
{
String
DEVICE_TOKEN
=
"u_user_device_token"
;
// Get Catalogue API
@GET
(
Constants
.
URL_GET_USERDETAILS
)
Call
<
ResponseBody
>
getuserDetails
(
@Query
(
Constants
.
URL_PARAM_SYSPRM_USERNAME
)
String
sysparmQuery
);
@PUT
(
Constants
.
URL_PUT_DEVICE_REGISTERATION
)
Call
<
ResponseBody
>
putDeviceRegistration
(
@Path
(
"user_sys_id"
)
String
userSysId
,
@Body
String
body
);
}
app/src/main/java/com/vsoft/servicenow/api/listeners/put/PutDeviceRegistrationApiListener.java
0 → 100644
View file @
1310b51d
package
com
.
vsoft
.
servicenow
.
api
.
listeners
.
put
;
import
com.vsoft.servicenow.api.pojos.LoginApiResponse
;
/**
* @since 1.0
* @author Kunj on 11/8/16
*
*/
public
interface
PutDeviceRegistrationApiListener
{
void
onDoneApiCall
();
void
onFailApiCall
();
}
app/src/main/java/com/vsoft/servicenow/api/managers/UserApiManager.java
View file @
1310b51d
...
...
@@ -11,7 +11,9 @@ import com.google.gson.JsonParseException;
import
com.vsoft.servicenow.api.interfaces.UserApi
;
import
com.vsoft.servicenow.api.listeners.get.GetUserDetailApiListener
;
import
com.vsoft.servicenow.api.RestClient
;
import
com.vsoft.servicenow.api.listeners.put.PutDeviceRegistrationApiListener
;
import
com.vsoft.servicenow.db.models.UserApiValues
;
import
com.vsoft.servicenow.ui.LoginScreen
;
import
com.vsoft.servicenow.utils.CatalogueLog
;
import
com.vsoft.servicenow.utils.Constants
;
import
com.vsoft.servicenow.utils.PrefManager
;
...
...
@@ -120,4 +122,40 @@ public class UserApiManager {
}
}
public
static
void
putDeviceRegistration
(
Context
context
,
String
userSysId
,
PutDeviceRegistrationApiListener
listener
)
{
String
accessToken
=
PrefManager
.
getSharedPref
(
context
,
PrefManager
.
PREFERENCE_ACCESS_TOKEN
);
String
deviceToken
=
PrefManager
.
getSharedPref
(
context
,
Constants
.
PREFS_NOTIFICATION_TOKEN
);
if
(
accessToken
.
isEmpty
()
||
deviceToken
.
isEmpty
())
{
listener
.
onFailApiCall
();
return
;
}
JSONObject
jsonObject
=
new
JSONObject
();
try
{
jsonObject
.
put
(
UserApi
.
DEVICE_TOKEN
,
deviceToken
);
}
catch
(
JSONException
e
)
{
CatalogueLog
.
e
(
"putDeviceRegistration: JSONException: "
+
e
.
toString
());
}
final
Retrofit
retrofit
=
RestClient
.
getInitializedRestAdapter
(
accessToken
);
Call
<
ResponseBody
>
call
=
retrofit
.
create
(
UserApi
.
class
).
putDeviceRegistration
(
userSysId
,
jsonObject
.
toString
());
try
{
//Retrofit synchronous call
Response
<
ResponseBody
>
response
=
call
.
execute
();
if
(
response
.
isSuccessful
())
{
if
(
response
.
code
()
==
200
)
{
listener
.
onDoneApiCall
();
}
else
{
listener
.
onFailApiCall
();
}
}
else
{
listener
.
onFailApiCall
();
}
}
catch
(
IOException
e
)
{
listener
.
onFailApiCall
();
}
catch
(
NullPointerException
e
)
{
listener
.
onFailApiCall
();
}
}
}
app/src/main/java/com/vsoft/servicenow/db/DBManager.java
View file @
1310b51d
...
...
@@ -207,8 +207,9 @@ public class DBManager extends SQLiteOpenHelper implements DBConstants {
db
.
execSQL
(
"create table IF NOT EXISTS "
+
TABLE_NOTIFICATIONS
+
"("
+
NOTIFICATIONS_ID
+
" integer primary key autoincrement, "
+
NOTIFICATIONS_TITLE
+
" text, "
+
NOTIFICATIONS_MESSAGE
+
" text, "
+
NOTIFICATIONS_TIME
+
" DATETIME"
+
NOTIFICATIONS_SHORT_DES
+
" text, "
+
NOTIFICATIONS_PRIORITY
+
" text, "
+
NOTIFICATIONS_CREATED_BY
+
" text"
+
");"
);
}
}
app/src/main/java/com/vsoft/servicenow/db/managers/NotificationsManager.java
View file @
1310b51d
...
...
@@ -5,7 +5,9 @@ import android.database.Cursor;
import
android.database.sqlite.SQLiteDatabase
;
import
com.vsoft.servicenow.CatalogueApplication
;
import
com.vsoft.servicenow.db.models.Catalogue
;
import
com.vsoft.servicenow.db.models.Notifications
;
import
com.vsoft.servicenow.utils.CatalogueLog
;
import
com.vsoft.servicenow.utils.DBConstants
;
import
java.util.ArrayList
;
...
...
@@ -15,7 +17,7 @@ import java.util.List;
/**
* NotificationsManager: This is database manager class of notification,
* it will handle all the operation of database for notification.
* @author Kunj on
16-01-2017
.
* @author Kunj on
20-03-2018
.
*/
public
final
class
NotificationsManager
implements
DBConstants
{
...
...
@@ -57,10 +59,7 @@ public final class NotificationsManager implements DBConstants {
public
static
List
<
Notifications
>
getAllNotifications
()
{
SQLiteDatabase
db
=
CatalogueApplication
.
getDatabase
();
if
(
db
!=
null
)
{
Cursor
c
=
db
.
rawQuery
(
"select * from "
+
TABLE_NOTIFICATIONS
+
" ORDER BY "
+
DBConstants
.
NOTIFICATIONS_TIME
+
" DESC"
,
null
);
Cursor
c
=
db
.
rawQuery
(
"select * from "
+
TABLE_NOTIFICATIONS
,
null
);
ArrayList
<
Notifications
>
notificationsList
;
if
(
c
.
getCount
()
>
0
)
{
notificationsList
=
new
ArrayList
<>(
c
.
getCount
());
...
...
@@ -104,15 +103,18 @@ public final class NotificationsManager implements DBConstants {
private
static
void
fillAllNotificationDetails
(
Cursor
c
,
Notifications
.
NotificationsBuilder
builder
)
{
builder
.
setId
(
c
.
getLong
(
INDEX_NOTIFICATIONS_ID
));
builder
.
setTitle
(
c
.
getString
(
INDEX_NOTIFICATIONS_TITLE
));
builder
.
setMessage
(
c
.
getString
(
INDEX_NOTIFICATIONS_MESSAGE
));
builder
.
setTime
(
c
.
getLong
(
INDEX_NOTIFICATIONS_TIME
));
builder
.
setShortDes
(
c
.
getString
(
INDEX_NOTIFICATIONS_SHORT_DES
));
builder
.
setPriority
(
c
.
getString
(
INDEX_NOTIFICATIONS_PRIORITY
));
builder
.
setCreatedBy
(
c
.
getString
(
INDEX_NOTIFICATIONS_CREATED_BY
));
}
private
static
ContentValues
getContentValues
(
Notifications
notifications
)
{
CatalogueLog
.
e
(
"notification: "
+
notifications
);
ContentValues
cv
=
new
ContentValues
(
NOTIFICATIONS_COLUMN_COUNT
-
1
);
cv
.
put
(
NOTIFICATIONS_TITLE
,
notifications
.
getTitle
());
cv
.
put
(
NOTIFICATIONS_MESSAGE
,
notifications
.
getMessage
());
cv
.
put
(
NOTIFICATIONS_TIME
,
notifications
.
getTime
());
cv
.
put
(
NOTIFICATIONS_SHORT_DES
,
notifications
.
getShortDescription
());
cv
.
put
(
NOTIFICATIONS_PRIORITY
,
notifications
.
getPriority
());
cv
.
put
(
NOTIFICATIONS_CREATED_BY
,
notifications
.
getCreated_by
());
return
cv
;
}
}
app/src/main/java/com/vsoft/servicenow/db/models/Notifications.java
View file @
1310b51d
...
...
@@ -9,8 +9,9 @@ public final class Notifications {
private
long
id
=
-
1
;
private
String
title
;
private
String
message
;
private
long
time
;
private
String
shortDescription
;
private
String
created_by
;
private
String
priority
;
/**
* Default constructor.
...
...
@@ -34,30 +35,28 @@ public final class Notifications {
this
.
title
=
title
;
}
public
String
get
Message
()
{
return
message
;
public
String
get
ShortDescription
()
{
return
shortDescription
;
}
public
void
set
Message
(
String
message
)
{
this
.
message
=
message
;
public
void
set
ShortDescription
(
String
shortDescription
)
{
this
.
shortDescription
=
shortDescription
;
}
public
long
getTime
()
{
return
time
;
public
String
getCreated_by
()
{
return
created_by
;
}
public
void
set
Time
(
long
time
)
{
this
.
time
=
time
;
public
void
set
Created_by
(
String
created_by
)
{
this
.
created_by
=
created_by
;
}
@Override
public
String
toString
()
{
return
"Notifications{"
+
"id="
+
id
+
", title='"
+
title
+
'\''
+
", message='"
+
message
+
'\''
+
", time="
+
time
+
'}'
;
public
String
getPriority
()
{
return
priority
;
}
public
void
setPriority
(
String
priority
)
{
this
.
priority
=
priority
;
}
/**
...
...
@@ -66,8 +65,9 @@ public final class Notifications {
public
static
final
class
NotificationsBuilder
{
private
long
id
=
-
1
;
private
String
title
;
private
String
message
;
private
long
time
;
private
String
shortDescription
;
private
String
created_by
;
private
String
priority
;
private
NotificationsBuilder
()
{
}
...
...
@@ -96,18 +96,20 @@ public final class Notifications {
}
/**
* set
Time: This method will set the notification tim
e.
* set
Message: This method will set the notification messag
e.
*/
public
NotificationsBuilder
set
Time
(
long
notificationTime
)
{
this
.
time
=
notificationTime
;
public
NotificationsBuilder
set
ShortDes
(
String
shortDescription
)
{
this
.
shortDescription
=
shortDescription
;
return
this
;
}
/**
* setMessage: This method will set the notification message.
*/
public
NotificationsBuilder
setMessage
(
String
notificationMessage
)
{
this
.
message
=
notificationMessage
;
public
NotificationsBuilder
setCreatedBy
(
String
created_by
)
{
this
.
created_by
=
created_by
;
return
this
;
}
public
NotificationsBuilder
setPriority
(
String
priority
)
{
this
.
priority
=
priority
;
return
this
;
}
...
...
@@ -115,7 +117,7 @@ public final class Notifications {
* but: This method will return NotificationBuilder reference.
*/
public
NotificationsBuilder
but
()
{
return
aNotification
().
setId
(
id
).
setTitle
(
title
).
set
Message
(
message
).
setTime
(
time
);
return
aNotification
().
setId
(
id
).
setTitle
(
title
).
set
ShortDes
(
shortDescription
).
setPriority
(
priority
).
setCreatedBy
(
created_by
);
}
/**
...
...
@@ -125,8 +127,9 @@ public final class Notifications {
Notifications
notifications
=
new
Notifications
();
notifications
.
setId
(
id
);
notifications
.
setTitle
(
title
);
notifications
.
setMessage
(
message
);
notifications
.
setTime
(
time
);
notifications
.
setShortDescription
(
shortDescription
);
notifications
.
setPriority
(
priority
);
notifications
.
setCreated_by
(
created_by
);
return
notifications
;
}
}
...
...
app/src/main/java/com/vsoft/servicenow/service/NotificationInstanceIdService.java
View file @
1310b51d
...
...
@@ -4,11 +4,17 @@ import com.google.firebase.iid.FirebaseInstanceId;
import
com.google.firebase.iid.FirebaseInstanceIdService
;
import
com.google.gson.JsonObject
;
import
com.vsoft.servicenow.CatalogueApplication
;
import
com.vsoft.servicenow.api.interfaces.UserApi
;
import
com.vsoft.servicenow.api.listeners.put.PutDeviceRegistrationApiListener
;
import
com.vsoft.servicenow.api.managers.UserApiManager
;
import
com.vsoft.servicenow.db.models.Catalogue
;
import
com.vsoft.servicenow.utils.CatalogueLog
;
import
com.vsoft.servicenow.utils.Constants
;
import
com.vsoft.servicenow.utils.PrefManager
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
/**
* NotificationInstanceIdService: This is service class to get refresh token.
* @author kunj on 16/01/17.
...
...
@@ -23,22 +29,33 @@ public class NotificationInstanceIdService extends FirebaseInstanceIdService {
CatalogueLog
.
d
(
"Refreshed token: "
+
refreshedToken
);
PrefManager
.
setSharedPref
(
CatalogueApplication
.
getContext
(),
Constants
.
PREFS_NOTIFICATION_TOKEN
,
refreshedToken
);
sendRegistrationToServer
(
refreshedToken
);
}
private
void
sendRegistrationToServer
(
String
refreshedToken
)
{
String
userSysId
=
PrefManager
.
getSharedPref
(
CatalogueApplication
.
getContext
(),
PrefManager
.
PREFERENCE_SYS_ID
);
if
(
userSysId
==
null
||
userSysId
.
isEmpty
())
{
CatalogueLog
.
e
(
"NotificationInstanceIdService: sendRegistrationToServer: userSysId is null."
);
return
;
}
JSONObject
deviceJsonObject
=
new
JSONObject
();
// sendRegistrationToServer(refreshedToken);
try
{
deviceJsonObject
.
put
(
UserApi
.
DEVICE_TOKEN
,
refreshedToken
);
}
catch
(
JSONException
e
)
{
CatalogueLog
.
e
(
"NotificationInstanceIdService: JSONException: "
+
e
);
}
UserApiManager
.
putDeviceRegistration
(
CatalogueApplication
.
getContext
(),
userSysId
,
new
PutDeviceRegistrationApiListener
()
{
@Override
public
void
onDoneApiCall
()
{
CatalogueLog
.
e
(
"NotificationInstanceIdService: putDeviceRegistration: onDoneApiCall"
);
}
// private void sendRegistrationToServer(String refreshedToken) {
// long userId = SharedPreferencesStore.getSharedPrefLong(Constants.PREFS_LOGGED_IN_USER_ID);
// if (userId == -1) {
// OklahomaLog.e("NotificationInstanceIdService: sendRegistrationToServer: userId is -1.");
// return;
// }
//
// JsonObject deviceJsonObject = new JsonObject();
// deviceJsonObject.addProperty(Constants.POST_JSON_USER_ID, userId);
// deviceJsonObject.addProperty(Constants.POST_JSON_PUSH_NOTIFY_KEY, refreshedToken);
// deviceJsonObject.addProperty(Constants.POST_JSON_DEVICE_TYPE, Constants.DEVICE_TYPE);
// deviceJsonObject.addProperty(Constants.POST_JSON_TEMP_DEVICE_ID, "");
// DeviceRegistrationApiManager.postDeviceRegistration(deviceJsonObject);
// }
@Override
public
void
onFailApiCall
()
{
CatalogueLog
.
e
(
"NotificationInstanceIdService: putDeviceRegistration: onFailApiCall"
);
}
});
}
}
app/src/main/java/com/vsoft/servicenow/service/NotificationMessagingService.java
View file @
1310b51d
...
...
@@ -11,12 +11,16 @@ import android.support.v4.content.LocalBroadcastManager;
import
com.google.firebase.messaging.FirebaseMessagingService
;
import
com.google.firebase.messaging.RemoteMessage
;
import
com.vsoft.servicenow.CatalogueApplication
;
import
com.vsoft.servicenow.R
;
import
com.vsoft.servicenow.db.managers.NotificationsManager
;
import
com.vsoft.servicenow.db.models.Notifications
;
import
com.vsoft.servicenow.ui.NotificationScreen
;
import
com.vsoft.servicenow.utils.CatalogueLog
;
import
com.vsoft.servicenow.utils.Constants
;
import
com.vsoft.servicenow.utils.PrefManager
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.util.Map
;
...
...
@@ -28,7 +32,10 @@ import java.util.Map;
public
class
NotificationMessagingService
extends
FirebaseMessagingService
{
private
static
final
String
FCM_KEY_TITLE
=
"title"
;
private
static
final
String
FCM_KEY_MESSAGE
=
"body"
;
private
static
final
String
FCM_KEY_BODY
=
"body"
;
private
static
final
String
FCM_KEY_PRIORITY
=
"priority"
;
private
static
final
String
FCM_KEY_SHORT_DESCRIPTION
=
"short_description"
;
private
static
final
String
FCM_KEY_CREATED_BY
=
"created_by"
;
/**
* This is default constructor of NotificationMessagingService.
...
...
@@ -39,30 +46,37 @@ public class NotificationMessagingService extends FirebaseMessagingService {
@Override
public
void
onMessageReceived
(
RemoteMessage
remoteMessage
)
{
// long userId = SharedPreferences
// .getSharedPrefLong(Constants.PREFS_LOGGED_IN_USER_ID);
// if (userId != -1) {
CatalogueLog
.
e
(
"RemoteMessage: "
+
remoteMessage
.
toString
());
String
userSysId
=
PrefManager
.
getSharedPref
(
CatalogueApplication
.
getContext
(),
PrefManager
.
PREFERENCE_SYS_ID
);
if
(
userSysId
!=
null
&&
!
userSysId
.
isEmpty
())
{
Map
<
String
,
String
>
dataMap
=
remoteMessage
.
getData
();
CatalogueLog
.
e
(
"data: "
+
dataMap
.
toString
());
String
title
=
dataMap
.
get
(
FCM_KEY_TITLE
);
String
message
=
dataMap
.
get
(
FCM_KEY_MESSAGE
);
String
messageBody
=
dataMap
.
get
(
FCM_KEY_BODY
);
String
priority
=
null
,
shortDes
=
null
,
createdBy
=
null
;
try
{
JSONObject
jsonObject
=
new
JSONObject
(
messageBody
);
priority
=
jsonObject
.
getString
(
FCM_KEY_PRIORITY
);
shortDes
=
jsonObject
.
getString
(
FCM_KEY_SHORT_DESCRIPTION
);
createdBy
=
jsonObject
.
getString
(
FCM_KEY_CREATED_BY
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
Notifications
newNotification
=
new
Notifications
();
newNotification
.
setTitle
(
title
==
null
?
""
:
title
);
newNotification
.
setMessage
(
message
);
newNotification
.
setTime
(
System
.
currentTimeMillis
());
newNotification
.
setTitle
(
title
);
newNotification
.
setShortDescription
(
shortDes
);
newNotification
.
setPriority
(
priority
);
newNotification
.
setCreated_by
(
createdBy
);
NotificationsManager
.
save
(
newNotification
);
sendNotification
(
newNotification
);
sendLocalMessage
(
NotificationMessagingService
.
this
,
newNotification
);
//
}
}
}
private
void
sendLocalMessage
(
Context
context
,
Notifications
notifications
)
{
Intent
intent
=
new
Intent
(
Constants
.
BROADCAST_NOTIFICATION
);
intent
.
putExtra
(
Constants
.
DATA_KEY_NOTIFICATION_TITLE
,
notifications
.
getTitle
());
intent
.
putExtra
(
Constants
.
DATA_KEY_NOTIFICATION_MESSAGE
,
notifications
.
get
Message
());
intent
.
putExtra
(
Constants
.
DATA_KEY_NOTIFICATION_MESSAGE
,
notifications
.
get
ShortDescription
());
LocalBroadcastManager
.
getInstance
(
context
).
sendBroadcast
(
intent
);
}
...
...
app/src/main/java/com/vsoft/servicenow/ui/CatalogueItemScreen.java
View file @
1310b51d
...
...
@@ -44,7 +44,7 @@ import butterknife.OnClick;
/**
* Created by Kunj on 11/8/16.
*/
public
class
CatalogueItemScreen
extends
AppCompat
Activity
{
public
class
CatalogueItemScreen
extends
HandleNotification
Activity
{
@BindView
(
R
.
id
.
tool_bar_view
)
Toolbar
mToolbar
;
@BindView
(
R
.
id
.
catalogue_item_screen_list_view
)
ListView
mListView
;
...
...
app/src/main/java/com/vsoft/servicenow/ui/CatalogueScreen.java
View file @
1310b51d
...
...
@@ -41,7 +41,7 @@ import butterknife.OnClick;
/**
* Created by Kunj on 11/8/16.
*/
public
class
CatalogueScreen
extends
AppCompat
Activity
{
public
class
CatalogueScreen
extends
HandleNotification
Activity
{
@BindView
(
R
.
id
.
tool_bar_view
)
Toolbar
mToolbar
;
@BindView
(
R
.
id
.
catalogue_screen_list_view
)
ListView
mListView
;
...
...
app/src/main/java/com/vsoft/servicenow/ui/CatalogueVariableScreen.java
View file @
1310b51d
...
...
@@ -108,7 +108,7 @@ import butterknife.OnClick;
/**
* Created by Kunj on 11/8/16.
*/
public
class
CatalogueVariableScreen
extends
AppCompat
Activity
{
public
class
CatalogueVariableScreen
extends
HandleNotification
Activity
{
@BindView
(
R
.
id
.
tool_bar_view
)
Toolbar
mToolbar
;
@BindView
(
R
.
id
.
variable_screen_container_layout
)
LinearLayout
mContainerLayout
;
...
...
app/src/main/java/com/vsoft/servicenow/ui/HandleNotificationActivity.java
0 → 100644
View file @
1310b51d
package
com
.
vsoft
.
servicenow
.
ui
;
import
android.app.NotificationManager
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.support.v4.content.LocalBroadcastManager
;
import
android.support.v7.app.AlertDialog
;
import
android.support.v7.app.AppCompatActivity
;
import
com.vsoft.servicenow.R
;
import
com.vsoft.servicenow.utils.Constants
;
import
com.vsoft.servicenow.utils.Util
;
/**
* Created by chaukadev on 3/20/18.
*/
public
class
HandleNotificationActivity
extends
AppCompatActivity
{
@Override
public
void
onResume
()
{
super
.
onResume
();
LocalBroadcastManager
.
getInstance
(
HandleNotificationActivity
.
this
)
.
registerReceiver
(
mMessageReceiver
,
new
IntentFilter
(
Constants
.
BROADCAST_NOTIFICATION
));
}
@Override
public
void
onPause
()
{
LocalBroadcastManager
.
getInstance
(
HandleNotificationActivity
.
this
)
.
unregisterReceiver
(
mMessageReceiver
);
super
.
onPause
();
}
private
final
BroadcastReceiver
mMessageReceiver
=
new
BroadcastReceiver
()
{
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
//Cancel received notifications
final
NotificationManager
notificationManager
=
(
NotificationManager
)
getSystemService
(
Context
.
NOTIFICATION_SERVICE
);
notificationManager
.
cancelAll
();
//Play notification sound because Above we already cancel notifications.
// That's why we need to play explicitly
Util
.
playNotificationSound
(
HandleNotificationActivity
.
this
);
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
HandleNotificationActivity
.
this
);
builder
.
setMessage
(
intent
.
getStringExtra
(
Constants
.
DATA_KEY_NOTIFICATION_MESSAGE
))
.
setTitle
(
intent
.
getStringExtra
(
Constants
.
DATA_KEY_NOTIFICATION_TITLE
))
.
setCancelable
(
false
)
.
setPositiveButton
(
R
.
string
.
go_to_notification_string
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
id
)
{
startActivity
(
new
Intent
(
HandleNotificationActivity
.
this
,
NotificationScreen
.
class
));
}
})
.
setNegativeButton
(
R
.
string
.
ok_string
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
id
)
{
dialog
.
dismiss
();
}
});
AlertDialog
alert
=
builder
.
create
();
alert
.
show
();
}
};
}
app/src/main/java/com/vsoft/servicenow/ui/LoginScreen.java
View file @
1310b51d
...
...
@@ -3,6 +3,7 @@ package com.vsoft.servicenow.ui;
import
android.app.Activity
;
import
android.app.ProgressDialog
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.support.v4.content.LocalBroadcastManager
;
...
...
@@ -13,12 +14,15 @@ import android.widget.EditText;
import
android.widget.Toast
;
import
com.google.android.gms.analytics.Tracker
;
import
com.vsoft.servicenow.api.interfaces.UserApi
;
import
com.vsoft.servicenow.api.listeners.get.GetUserDetailApiListener
;
import
com.vsoft.servicenow.api.listeners.get.GetUserLoginApiListener
;
import
com.vsoft.servicenow.api.listeners.put.PutDeviceRegistrationApiListener
;
import
com.vsoft.servicenow.api.managers.LoginApiManager
;
import
com.vsoft.servicenow.api.managers.UserApiManager
;
import
com.vsoft.servicenow.api.pojos.LoginApiResponse
;
import
com.vsoft.servicenow.db.models.UserApiValues
;
import
com.vsoft.servicenow.utils.CatalogueLog
;
import
com.vsoft.servicenow.utils.Constants
;
import
com.vsoft.servicenow.utils.DialogUtils
;
import
com.vsoft.servicenow.utils.KeyboardUtil
;
...
...
@@ -27,6 +31,9 @@ import com.vsoft.servicenow.CatalogueApplication;
import
com.vsoft.servicenow.R
;
import
com.vsoft.servicenow.utils.PrefManager
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.util.List
;
import
butterknife.BindView
;
...
...
@@ -151,8 +158,19 @@ public class LoginScreen extends Activity {
UserApiManager
.
getUserDetailResponse
(
LoginScreen
.
this
,
userName
,
new
GetUserDetailApiListener
()
{
@Override
public
void
onDoneApiCall
(
List
<
UserApiValues
>
userValues
)
{
apiStatus
=
API_SUCCESS_USER_DETAIL
;
mUserDetails
=
userValues
;
UserApiManager
.
putDeviceRegistration
(
LoginScreen
.
this
,
userValues
.
get
(
0
).
getSysId
(),
new
PutDeviceRegistrationApiListener
()
{
@Override
public
void
onDoneApiCall
()
{
apiStatus
=
API_SUCCESS_USER_DETAIL
;
}
@Override
public
void
onFailApiCall
()
{
apiStatus
=
API_FAIL_USER_DETAIL
;
}
});
}
@Override
...
...
app/src/main/java/com/vsoft/servicenow/ui/MyIncidentScreen.java
View file @
1310b51d
...
...
@@ -39,7 +39,7 @@ import butterknife.OnItemClick;
/**
* Created by kunj on 30/8/16.
*/
public
class
MyIncidentScreen
extends
AppCompat
Activity
{
public
class
MyIncidentScreen
extends
HandleNotification
Activity
{
@BindView
(
R
.
id
.
tool_bar_view
)
Toolbar
mToolbar
;
@BindView
(
R
.
id
.
my_incidents_screen_list_view
)
ListView
mListView
;
...
...
app/src/main/java/com/vsoft/servicenow/ui/MyRequestActivity.java
View file @
1310b51d
...
...
@@ -39,7 +39,7 @@ import butterknife.OnItemClick;
/**
* Created by kvemulavada on 8/30/2016.
*/
public
class
MyRequestActivity
extends
AppCompat
Activity
{
public
class
MyRequestActivity
extends
HandleNotification
Activity
{
@BindView
(
R
.
id
.
tool_bar_view
)
Toolbar
mToolbar
;
@BindView
(
R
.
id
.
request_screen_list_view
)
ListView
mListView
;
...
...
app/src/main/java/com/vsoft/servicenow/ui/NotificationScreen.java
View file @
1310b51d
...
...
@@ -14,6 +14,7 @@ import android.support.v7.app.AppCompatActivity;
import
android.support.v7.widget.DividerItemDecoration
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.Toolbar
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.Window
;
...
...
@@ -48,6 +49,8 @@ public class NotificationScreen extends AppCompatActivity {
*/
@BindView
(
R
.
id
.
notification_screen_empty_text_view
)
TextView
mEmptyTextView
;
@BindView
(
R
.
id
.
tool_bar_view
)
Toolbar
mToolbar
;
private
NotificationAdapter
mAdapter
;
...
...
@@ -67,14 +70,10 @@ public class NotificationScreen extends AppCompatActivity {
builder
.
setMessage
(
intent
.
getStringExtra
(
Constants
.
DATA_KEY_NOTIFICATION_MESSAGE
))
.
setTitle
(
intent
.
getStringExtra
(
Constants
.
DATA_KEY_NOTIFICATION_TITLE
))
.
setCancelable
(
false
)
.
setPositiveButton
(
R
.
string
.
go_to_notification
_string
,
.
setPositiveButton
(
R
.
string
.
ok
_string
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
id
)
{
updateNotificationList
();
}
})
.
setNegativeButton
(
R
.
string
.
ok_string
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
id
)
{
dialog
.
dismiss
();
updateNotificationList
();
}
});
...
...
@@ -91,13 +90,13 @@ public class NotificationScreen extends AppCompatActivity {
ButterKnife
.
bind
(
this
);
final
ActionBar
actionBar
=
getSupportActionBar
();
if
(
actionBar
!=
null
)
{
setSupportActionBar
(
mToolbar
);
ActionBar
actionBar
=
getSupportActionBar
();
if
(
actionBar
!=
null
)
{
actionBar
.
setDisplayHomeAsUpEnabled
(
true
);
actionBar
.
setTitle
(
getResources
()
.
getString
(
R
.
string
.
notification_screen_action_bar_title_string
));
actionBar
.
setElevation
(
0
);
actionBar
.
setDisplayShowHomeEnabled
(
true
);
actionBar
.
setTitle
(
R
.
string
.
notification_screen_action_bar_title_string
);
actionBar
.
setDisplayShowHomeEnabled
(
false
);
actionBar
.
setDisplayShowTitleEnabled
(
true
);
}
...
...
@@ -153,14 +152,10 @@ public class NotificationScreen extends AppCompatActivity {
}
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
// Handle item selection
switch
(
item
.
getItemId
())
{
case
android
.
R
.
id
.
home
:
public
boolean
onOptionsItemSelected
(
MenuItem
menuItem
)
{
if
(
menuItem
.
getItemId
()
==
android
.
R
.
id
.
home
)
{
finish
();
return
true
;
default
:
return
super
.
onOptionsItemSelected
(
item
);
}
return
super
.
onOptionsItemSelected
(
menuItem
);
}
}
app/src/main/java/com/vsoft/servicenow/ui/ReportIncidentScreen.java
View file @
1310b51d
...
...
@@ -37,7 +37,7 @@ import butterknife.OnClick;
/**
* Created by kunj on 30/8/16.
*/
public
class
ReportIncidentScreen
extends
AppCompat
Activity
{
public
class
ReportIncidentScreen
extends
HandleNotification
Activity
{
@BindView
(
R
.
id
.
tool_bar_view
)
Toolbar
mToolbar
;
...
...
app/src/main/java/com/vsoft/servicenow/utils/Constants.java
View file @
1310b51d
...
...
@@ -30,11 +30,14 @@ public class Constants {
public
static
final
String
DATA_KEY_CATALOGUE_ITEM_DESCRIPTION
=
"catalogue_item_des"
;
public
static
final
String
DATA_KEY_CATALOGUE_ITEM_SHORT_DESCRIPTION
=
"catalogue_item_short_des"
;
public
static
final
String
DATA_KEY_CHAT_USER_NAME
=
"username"
;
public
static
final
String
DATA_KEY_NOTIFICATION_TITLE
=
"notification_title"
;
public
static
final
String
DATA_KEY_NOTIFICATION_MESSAGE
=
"notification_message"
;
/**
* Broadcast custom intent
*/
public
static
final
String
ACTION_SYNC
=
"action_sync"
;
public
static
final
String
BROADCAST_NOTIFICATION
=
"broadcast_notification"
;
/**
* Broadcast custom intent
...
...
@@ -146,6 +149,7 @@ public class Constants {
/*Login API */
public
static
final
String
URL_POST_LOGIN_ITEM
=
"/oauth_token.do"
;
public
static
final
String
URL_REFRESH_LOGIN
=
URL_POST_LOGIN_ITEM
;
public
static
final
String
URL_PUT_DEVICE_REGISTERATION
=
"api/now/table/sys_user/{user_sys_id}"
;
/*Catalogue Category API */
public
static
final
String
URL_GET_CATALOGUE
=
DOMAIN
+
AppConfig
.
URL_GET_CATALOGUE
;
...
...
@@ -171,18 +175,4 @@ public class Constants {
/*Chat Activity*/
public
static
final
String
CHAT_USER_API_URL
=
DOMAIN
+
URL_GET_USERDETAILS
.
substring
(
1
);
/**
* Broadcast String: broadcast notification.
*/
public
static
final
String
BROADCAST_NOTIFICATION
=
"broadcast_notification"
;
/**
* Intent String: Notification title.
*/
public
static
final
String
DATA_KEY_NOTIFICATION_TITLE
=
"notification_title"
;
/**
* Intent String: Notification message.
*/
public
static
final
String
DATA_KEY_NOTIFICATION_MESSAGE
=
"notification_message"
;
}
app/src/main/java/com/vsoft/servicenow/utils/DBConstants.java
View file @
1310b51d
...
...
@@ -16,6 +16,7 @@ public interface DBConstants {
String
TABLE_UI_POLICY_ACTION
=
"ui_policy_action"
;
String
TABLE_CATALOGUE_ITEM_INPUT
=
"input_catalogue_item"
;
String
TABLE_ATTACHMENT
=
"attachment"
;
String
TABLE_NOTIFICATIONS
=
"notifications"
;
String
ID
=
"_id"
;
String
SYS_ID
=
"sys_id"
;
...
...
@@ -345,45 +346,24 @@ public interface DBConstants {
int
ATTACHMENT_COLUMN_COUNT
=
6
;
/**
* Notification table name.
*/
String
TABLE_NOTIFICATIONS
=
"notifications"
;
/**
* NOTIFICATIONS_ID: Id column name for Notification table.
* Notification table
*/
String
NOTIFICATIONS_ID
=
ID
;
/**
* NOTIFICATIONS_TITLE: Time column name for Notification table.
*/
String
NOTIFICATIONS_TITLE
=
"title"
;
/**
* NOTIFICATIONS_MESSAGE: Message column name for Notification table.
*/
String
NOTIFICATIONS_MESSAGE
=
"message"
;
/**
* NOTIFICATIONS_TIME: Time column name for Notification table.
*/
String
NOTIFICATIONS_TIME
=
"time"
;
String
NOTIFICATIONS_SHORT_DES
=
"short_des"
;
String
NOTIFICATIONS_PRIORITY
=
"priority"
;
String
NOTIFICATIONS_CREATED_BY
=
"created_by"
;
/**
*
INDEX_NOTIFICATIONS_ID: Id indices for Notification table.
*
Notification table. *Use these only if you fetch all columns*
*/
int
INDEX_NOTIFICATIONS_ID
=
0
;
/**
* INDEX_NOTIFICATIONS_TITLE: Title indices for Notification table.
*/
int
INDEX_NOTIFICATIONS_TITLE
=
1
;
/**
* INDEX_NOTIFICATIONS_MESSAGE: Message indices for Notification table.
*/
int
INDEX_NOTIFICATIONS_MESSAGE
=
2
;
/**
* INDEX_NOTIFICATIONS_TIME: Time indices for Notification table.
*/
int
INDEX_NOTIFICATIONS_TIME
=
3
;
int
INDEX_NOTIFICATIONS_SHORT_DES
=
2
;
int
INDEX_NOTIFICATIONS_PRIORITY
=
3
;
int
INDEX_NOTIFICATIONS_CREATED_BY
=
4
;
/**
* NOTIFICATIONS_COLUMN_COUNT: Total column count for notification table.
*/
int
NOTIFICATIONS_COLUMN_COUNT
=
4
;
int
NOTIFICATIONS_COLUMN_COUNT
=
5
;
}
\ No newline at end of file
app/src/main/res/layout/notification_adapter.xml
View file @
1310b51d
...
...
@@ -8,37 +8,39 @@
android:paddingRight=
"@dimen/normal_margin"
android:paddingTop=
"@dimen/extra_large_margin"
>
<!--<ImageView
android:id="@+id/notification_adapter_delete_image_view"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/notification_delete"/>-->
<TextView
android:id=
"@+id/notification_adapter_title_text_view"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textColor=
"@android:color/black"
android:layout_marginRight=
"@dimen/small_margin"
android:textColor=
"@android:color/white"
android:textSize=
"@dimen/extra_normal_text_size"
/>
<TextView
android:id=
"@+id/notification_adapter_message_text_view"
android:id=
"@+id/notification_adapter_short_des_text_view"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/notification_adapter_title_text_view"
android:layout_marginTop=
"@dimen/small_margin"
android:textColor=
"@android:color/white"
android:textSize=
"@dimen/normal_text_size"
/>
<TextView
android:id=
"@+id/notification_adapter_priority_text_view"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/notification_adapter_short_des_text_view"
android:layout_marginTop=
"@dimen/small_margin"
android:textColor=
"@android:color/white"
android:textSize=
"@dimen/normal_text_size"
/>
<TextView
android:id=
"@+id/notification_adapter_
date
_text_view"
android:id=
"@+id/notification_adapter_
created_by
_text_view"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/notification_adapter_message_text_view"
android:layout_alignParentRight=
"true"
android:layout_below=
"@id/notification_adapter_priority_text_view"
android:layout_marginTop=
"@dimen/small_margin"
android:
layout_centerVertical=
"tru
e"
android:
textColor=
"@android:color/whit
e"
android:textSize=
"@dimen/normal_text_size"
/>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/layout/notification_screen.xml
View file @
1310b51d
<merge
xmlns:android=
"http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<include
layout=
"@layout/toolbar"
/>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
...
...
@@ -10,15 +16,16 @@
android:background=
"@color/colorPrimary"
android:divider=
"@color/list_divider_color"
android:dividerHeight=
"@dimen/list_divider_height"
android:scrollbars=
"vertical"
/>
android:scrollbars=
"vertical"
/>
<TextView
android:id=
"@+id/notification_screen_empty_text_view"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/colorPrimary"
android:gravity=
"center"
android:text=
"@string/notification_screen_empty_text_string"
android:textSize=
"@dimen/normal_text_size"
android:gravity=
"center"
android:visibility=
"gone"
/>
</merge>
\ No newline at end of file
android:visibility=
"gone"
/>
</FrameLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/values/colors.xml
View file @
1310b51d
...
...
@@ -24,6 +24,6 @@
<color
name=
"login_screen_login_button_background_color"
>
@color/colorPrimaryDark
</color>
<color
name=
"login_screen_edit_text_background_color"
>
@color/colorPrimaryDark
</color>
<!--
Setting
screen-->
<!--
Notification
screen-->
<color
name=
"list_divider_color"
>
@color/light_gray
</color>
</resources>
app/src/main/res/values/dimen.xml
View file @
1310b51d
...
...
@@ -44,6 +44,6 @@
<dimen
name=
"uofl_tool_bar_refresh_button_width"
>
35dp
</dimen>
<dimen
name=
"uofl_tool_bar_refresh_button_height"
>
35dp
</dimen>
<!--
Setting
screen-->
<!--
Notification
screen-->
<dimen
name=
"list_divider_height"
>
0.5dp
</dimen>
</resources>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
1310b51d
...
...
@@ -107,6 +107,5 @@
<!--Notifications-->
<string
name=
"notification_screen_action_bar_title_string"
>
Notifications
</string>
<string
name=
"notification_screen_empty_text_string"
>
No Notifications
</string>
<string
name=
"notification_screen_delete_msg_string"
>
Are you sure you want to delete?
</string>
<string
name=
"go_to_notification_string"
>
Go to Notification
</string>
</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