Commit f0c0b0e4 by Kunj Gupta

Fixed the android flavour issue.

parent 0a9002c5
Showing with 1202 additions and 1173 deletions
package com.vsoft.servicenow;
import com.vsoft.servicenow.menu.ChatMenuItemData;
import com.vsoft.servicenow.menu.HomeScreenMenuItemData;
import com.vsoft.servicenow.menu.MyIncidentMenuItemData;
import com.vsoft.servicenow.menu.MyRequestMenuItemData;
import com.vsoft.servicenow.menu.NotificationMenuItemData;
import com.vsoft.servicenow.menu.OrderServicesMenuItemData;
import com.vsoft.servicenow.menu.ReportIncidentMenuItemData;
import java.util.Arrays;
import java.util.List;
/**
* Created by Kunj on 3/23/18.
*/
public class MenuProvider {
public static final List<HomeScreenMenuItemData> MENU_ITEMS = Arrays.asList(
new ReportIncidentMenuItemData.Builder()
.setTitle(R.string.home_screen_report_incident_title)
.setMenuIconResId(R.string.home_screen_report_incident_icon)
.build(),
new OrderServicesMenuItemData.Builder()
.setTitle(R.string.home_screen_order_services_title)
.setMenuIconResId(R.string.home_screen_order_services_icon)
.build(),
new MyIncidentMenuItemData.Builder()
.setTitle(R.string.home_screen_my_incidents_title)
.setMenuIconResId(R.string.home_screen_my_incidents_icon)
.build(),
new MyRequestMenuItemData.Builder()
.setTitle(R.string.home_screen_report_incident_title)
.setMenuIconResId(R.string.home_screen_my_request_icon)
.build(),
new ChatMenuItemData.Builder()
.setTitle(R.string.home_screen_chat_title)
.setMenuIconResId(R.string.home_screen_chat_icon)
.build(),
new NotificationMenuItemData.Builder()
.setTitle(R.string.home_screen_notification_title)
.setMenuIconResId(R.string.home_screen_notification_icon)
.build()
);
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/home_screen_adapter_image_view"
android:layout_width="@dimen/home_screen_image_height"
android:layout_height="@dimen/home_screen_image_height"
android:layout_centerHorizontal="true"
android:scaleType="centerCrop" />
<TextView
android:id="@+id/home_screen_adapter_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_below="@+id/home_screen_adapter_image_view"
android:gravity="center"
android:textColor="@android:color/white"
android:textSize="@dimen/homescreen_text_size" />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="home_screen_array">
<item>Report Incident</item>
<item>Order Services</item>
<item>My Incidents</item>
<item>My Requests</item>
<item>Chatbot</item>
<item>Notifications</item>
</string-array>
<array name="home_screen_icon_array">
<item>@drawable/report_incident</item>
<item>@drawable/order_serivces</item>
<item>@drawable/my_incidents</item>
<item>@drawable/my_requests</item>
<item>@drawable/chatbot</item>
<item>@drawable/my_requests</item>
</array>
<string-array name="incident_impact_array">
<item>-None-</item>
<item>1 - High</item>
<item>2 - Medium</item>
<item>3 - Low</item>
</string-array>
<array name="username_colors">
<item>@color/username0</item>
<item>@color/username1</item>
<item>@color/username2</item>
<item>@color/username3</item>
<item>@color/username4</item>
<item>@color/username5</item>
<item>@color/username6</item>
<item>@color/username7</item>
<item>@color/username8</item>
<item>@color/username9</item>
<item>@color/username10</item>
<item>@color/username11</item>
</array>
</resources>
\ No newline at end of file
......@@ -11,21 +11,4 @@
<!--Login Screen-->
<color name="login_screen_login_button_background_color">@color/colorPrimaryDark</color>
<color name="login_screen_edit_text_background_color">@color/colorPrimaryDark</color>
<!--Chatbot Screen-->
<color name="username0">#e21400</color>
<color name="username1">#91580f</color>
<color name="username2">#f8a700</color>
<color name="username3">#f78b00</color>
<color name="username4">#58dc00</color>
<color name="username5">#287b00</color>
<color name="username6">#a8f07a</color>
<color name="username7">#4ae8c4</color>
<color name="username8">#3b88eb</color>
<color name="username9">#3824aa</color>
<color name="username10">#a700ff</color>
<color name="username11">#d300e7</color>
<color name="hr_background_chat_color">#f7fcfc</color>
<color name="user_background_chat_color">#e6f3f5</color>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="spacing">8dp</dimen>
<dimen name="chat_margin">40dp</dimen>
<!--SPEECH RECOGNIZER-->
<dimen name="progressMsgMargin">10dp</dimen>
<!--Home Screen-->
<dimen name="home_screen_image_height">150dp</dimen>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">GE Appliances</string>
<!--Chat Related String-->
<string name="chat_activity_label">Vera</string>
<string name="action_leave">Leave</string>
<string name="action_send">Send</string>
<string name="prompt_message">Message</string>
<!--Home Screen Option-->
<!--Start-->
<string name="home_screen_report_incident_title">Report Incident</string>
<string name="home_screen_report_incident_icon">report_incident</string>
<string name="connect">Connected</string>
<string name="disconnect">Disconnected, Please check your internet connection</string>
<string name="error_connect">Failed to connect</string>
<string name="unauthorized_user">Unauthorized User</string>
<string name="home_screen_order_services_title">Order Services</string>
<string name="home_screen_order_services_icon">order_serivces</string>
<!-- messages -->
<string name="message_welcome">Chat with HR Bot</string>
<plurals name="message_participants">
<item quantity="one">there\'s %d participant</item>
<item quantity="other">there are %d participants</item>
</plurals>
<string name="message_user_joined">%s joined</string>
<string name="message_user_left">%s left</string>
<string name="user_action_typing">is typing</string>
<string name="home_screen_my_incidents_title">My Incidents</string>
<string name="home_screen_my_incidents_icon">my_incidents</string>
<!--Speech Recognizer-->
<string name="ds_listening">Listening…</string>
<string name="ds_internet_not_enabled">Internet is not enabled</string>
<string name="ds_mic_permissions_required">Please provide microphone permissions</string>
<string name="ds_unknown_error">Unknown error</string>
<string name="ds_progress_layout_error">Unable to add speech progress view</string>
<string name="ds_confirm">Confirm</string>
<string name="ds_retry">Retry</string>
<string-array name="droid_speech_errors">
<item>Network Timeout</item>
<item>Network Error</item>
<item>Audio Error</item>
<item>Server Error</item>
<item>Client Error</item>
<item>Speech Timeout</item>
<item>No match</item>
<item>Speech Recognizer busy</item>
<item>Insufficient permissions</item>
</string-array>
<string name="home_screen_my_request_title">My Requests</string>
<string name="home_screen_my_request_icon">my_requests</string>
<string name="home_screen_chat_title">Chatbot</string>
<string name="home_screen_chat_icon">chatbot</string>
<string name="home_screen_notification_title">Notifications</string>
<string name="home_screen_notification_icon">notifications</string>
<!--End-->
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="windowNoTitle">true</item>
<item name="actionOverflowMenuStyle">@style/OverflowMenu</item>
<style name="HomeBackgroundStyle" parent="@style/Theme.AppCompat">
<item name="android:background">@drawable/home_background</item>
</style>
<style name="OverflowMenu" parent="Widget.AppCompat.PopupMenu.Overflow">
<!-- Required for pre-Lollipop. -->
<item name="overlapAnchor">false</item>
<!-- Required for Lollipop. -->
<item name="android:overlapAnchor">false</item>
</style>
<style name="WhiteBackgroundStyle" parent="@style/Theme.AppCompat">
<item name="android:background">@android:color/white</item>
</style>
<style name="LightBackgroundStyle" parent="@style/Theme.AppCompat">
<item name="android:background">@color/screen_bg_color</item>
</style>
<style name="DatePickerCustomDialog" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@android:color/white</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowNoTitle">true</item>
<item name="editTextStyle">@android:style/Widget.EditText</item>
</style>
<style name="CustomDialog">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
</resources>
{
"project_info": {
"project_number": "957773681882",
"firebase_url": "https://vosft-ge.firebaseio.com",
"project_id": "vosft-ge",
"storage_bucket": "vosft-ge.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:957773681882:android:90c2e6c83d0908f5",
"android_client_info": {
"package_name": "com.vsoft.servicenow.ge.debug"
}
},
"oauth_client": [
{
"client_id": "957773681882-go7d0rln03htjche50s07m9r73mqgiu0.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.vsoft.servicenow.ge.debug",
"certificate_hash": "5369fc4c8024379da200c54f6f889559c45b60d2"
}
},
{
"client_id": "957773681882-rl34anslfron5f8epo6d0u0uten6bh4p.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyBN1ZaTBm2S2hBWfajKGq60FtaZzo0ESAs"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 2,
"other_platform_oauth_client": [
{
"client_id": "957773681882-rl34anslfron5f8epo6d0u0uten6bh4p.apps.googleusercontent.com",
"client_type": 3
}
]
},
"ads_service": {
"status": 2
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:957773681882:android:7cdac4a20e2cb330",
"android_client_info": {
"package_name": "com.vsoft.uoflservicenow.debug"
}
},
"oauth_client": [
{
"client_id": "957773681882-5vohjmciupgpv35utrukqv7kijek2lm4.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.vsoft.uoflservicenow.debug",
"certificate_hash": "5369fc4c8024379da200c54f6f889559c45b60d2"
}
},
{
"client_id": "957773681882-rl34anslfron5f8epo6d0u0uten6bh4p.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyBN1ZaTBm2S2hBWfajKGq60FtaZzo0ESAs"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 2,
"other_platform_oauth_client": [
{
"client_id": "957773681882-rl34anslfron5f8epo6d0u0uten6bh4p.apps.googleusercontent.com",
"client_type": 3
}
]
},
"ads_service": {
"status": 2
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:957773681882:android:04163e834a73b6ef",
"android_client_info": {
"package_name": "com.vsoft.servicenow.citrix.debug"
}
},
"oauth_client": [
{
"client_id": "957773681882-fardpbm81ihjnlmfb0ns8nure98cgijm.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.vsoft.servicenow.citrix.debug",
"certificate_hash": "5369fc4c8024379da200c54f6f889559c45b60d2"
}
},
{
"client_id": "957773681882-rl34anslfron5f8epo6d0u0uten6bh4p.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyBN1ZaTBm2S2hBWfajKGq60FtaZzo0ESAs"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 2,
"other_platform_oauth_client": [
{
"client_id": "957773681882-rl34anslfron5f8epo6d0u0uten6bh4p.apps.googleusercontent.com",
"client_type": 3
}
]
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}
\ No newline at end of file
......@@ -7,6 +7,8 @@ public class AppConfig {
public static final String APP_INTERNAL_NAME = "Citrix";
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://ven01199.service-now.com/";
......
package com.vsoft.servicenow;
import com.vsoft.servicenow.menu.HomeScreenMenuItemData;
import com.vsoft.servicenow.menu.MyIncidentMenuItemData;
import com.vsoft.servicenow.menu.MyRequestMenuItemData;
import com.vsoft.servicenow.menu.OrderServicesMenuItemData;
import com.vsoft.servicenow.menu.ReportIncidentMenuItemData;
import java.util.Arrays;
import java.util.List;
/**
* Created by Kunj on 3/23/18.
*/
public class MenuProvider {
public static final List<HomeScreenMenuItemData> MENU_ITEMS = Arrays.asList(
new ReportIncidentMenuItemData.Builder()
.setTitle(R.string.home_screen_report_incident_title)
.setMenuIconResId(R.string.home_screen_report_incident_icon)
.build(),
new OrderServicesMenuItemData.Builder()
.setTitle(R.string.home_screen_order_services_title)
.setMenuIconResId(R.string.home_screen_order_services_icon)
.build(),
new MyIncidentMenuItemData.Builder()
.setTitle(R.string.home_screen_my_incidents_title)
.setMenuIconResId(R.string.home_screen_my_incidents_icon)
.build(),
new MyRequestMenuItemData.Builder()
.setTitle(R.string.home_screen_report_incident_title)
.setMenuIconResId(R.string.home_screen_my_request_icon)
.build()
);
}
package com.vsoft.servicenow.ui;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import com.google.android.gms.analytics.Tracker;
import com.vsoft.servicenow.CatalogueApplication;
import com.vsoft.servicenow.R;
import com.vsoft.servicenow.utils.PrefManager;
import com.vsoft.servicenow.utils.Util;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
* Created by Kunj on 11/8/16.
*/
public class HomeScreen extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.home_screen);
ButterKnife.bind(this);
CatalogueApplication application = (CatalogueApplication) getApplication();
Tracker tracker = application.getDefaultTracker();
// Send initial screen view hit.
Util.sendScreenName(tracker, getString(R.string.home_screen_string));
}
@OnClick(R.id.home_screen_order_service)
void orderServiceClicked() {
startActivity(new Intent(HomeScreen.this, CatalogueScreen.class));
}
@OnClick(R.id.home_screen_my_incident)
void myIncidentClicked() {
startActivity(new Intent(HomeScreen.this, MyIncidentScreen.class));
}
@OnClick(R.id.home_screen_my_request)
void myRequestClicked() {
startActivity(new Intent(HomeScreen.this, MyRequestActivity.class));
}
@OnClick(R.id.home_screen_report_incident)
void reportIncidentClicked() {
startActivity(new Intent(HomeScreen.this, ReportIncidentScreen.class));
}
@OnClick(R.id.home_screen_logout_image_view)
void logoutOnClicked() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.home_screen_logout_confirmation_msg_string)
.setCancelable(false)
.setPositiveButton(R.string.ok_string, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_ACCESS_TOKEN, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_REFRESH_TOKEN, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_LAST_NAME, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_SYS_ID, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_FIRST_NAME, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_USER_ID, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_USER_FULL_NAME, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_USER_EMAIL_ID, "");
Intent loginIntent = new Intent(HomeScreen.this, LoginScreen.class);
loginIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(loginIntent);
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
AlertDialog alert = builder.create();
alert.show();
}
}
<?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:layout_width="match_parent"
android:layout_height="match_parent"
style = "@style/LightBackgroundStyle"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/tool_bar_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/black"
android:minHeight="?attr/actionBarSize"
app:titleTextColor="@color/tool_bar_title_color"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetRight="0dp"
app:contentInsetEnd="0dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/small_margin"
android:layout_marginRight="@dimen/small_margin">
<ImageView
android:id="@+id/nav_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:src="@drawable/home_icon" />
<TextView
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:text="@string/app_name"
android:textColor="@android:color/white" />
<ImageView
android:id="@+id/home_screen_logout_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/logout_icon" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="@dimen/extra_large_margin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/home_screen_report_incident"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/report_incident"/>
<ImageView
android:id="@+id/home_screen_order_service"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/order_services"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="@dimen/extra_large_margin">
<ImageView
android:id="@+id/home_screen_my_incident"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/my_incidents"/>
<ImageView
android:id="@+id/home_screen_my_request"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/my_requests"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/home_screen_adapter_image_view"
android:layout_width="@dimen/home_screen_image_height"
android:layout_height="@dimen/home_screen_image_height"
android:layout_centerHorizontal="true"
android:scaleType="centerCrop" />
<TextView
android:id="@+id/home_screen_adapter_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_below="@+id/home_screen_adapter_image_view"
android:gravity="center"
android:textColor="@android:color/white"
android:textSize="@dimen/homescreen_text_size" />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="home_screen_icon_array">
<item>@drawable/report_incident</item>
<item>@drawable/order_services</item>
<item>@drawable/my_incidents</item>
<item>@drawable/my_requests</item>
</array>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="incident_from_short_description_text_limit">160</integer>
<!--Home Screen-->
<dimen name="home_screen_image_height">150dp</dimen>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">Citrix ServiceNow</string>
<!--Home Screen Option-->
<!--Start-->
<string name="home_screen_report_incident_title">Report Incident</string>
<string name="home_screen_report_incident_icon">report_incident</string>
<string name="home_screen_order_services_title">Order Services</string>
<string name="home_screen_order_services_icon">order_services</string>
<string name="home_screen_my_incidents_title">My Incidents</string>
<string name="home_screen_my_incidents_icon">my_incidents</string>
<string name="home_screen_my_request_title">My Requests</string>
<string name="home_screen_my_request_icon">my_requests</string>
<!--End-->
</resources>
......@@ -25,4 +25,7 @@
<item name="actionMenuTextColor">@android:color/white</item>
</style>
<style name="HomeBackgroundStyle" parent="@style/Theme.AppCompat">
<item name="android:background">@color/screen_bg_color</item>
</style>
</resources>
{
"project_info": {
"project_number": "957773681882",
"firebase_url": "https://vosft-ge.firebaseio.com",
"project_id": "vosft-ge",
"storage_bucket": "vosft-ge.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:957773681882:android:90c2e6c83d0908f5",
"android_client_info": {
"package_name": "com.vsoft.servicenow.ge.debug"
}
},
"oauth_client": [
{
"client_id": "957773681882-go7d0rln03htjche50s07m9r73mqgiu0.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.vsoft.servicenow.ge.debug",
"certificate_hash": "5369fc4c8024379da200c54f6f889559c45b60d2"
}
},
{
"client_id": "957773681882-rl34anslfron5f8epo6d0u0uten6bh4p.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyBN1ZaTBm2S2hBWfajKGq60FtaZzo0ESAs"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 2,
"other_platform_oauth_client": [
{
"client_id": "957773681882-rl34anslfron5f8epo6d0u0uten6bh4p.apps.googleusercontent.com",
"client_type": 3
}
]
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}
\ No newline at end of file
package com.vsoft.servicenow;
import com.vsoft.servicenow.menu.HomeScreenMenuItemData;
import com.vsoft.servicenow.menu.MyIncidentMenuItemData;
import com.vsoft.servicenow.menu.MyRequestMenuItemData;
import com.vsoft.servicenow.menu.OrderServicesMenuItemData;
import com.vsoft.servicenow.menu.ReportIncidentMenuItemData;
import java.util.Arrays;
import java.util.List;
/**
* Created by Kunj on 3/23/18.
*/
public class MenuProvider {
public static final List<HomeScreenMenuItemData> MENU_ITEMS = Arrays.asList(
new ReportIncidentMenuItemData.Builder()
.setTitle(R.string.home_screen_report_incident_title)
.setMenuIconResId(R.string.home_screen_report_incident_icon)
.build(),
new OrderServicesMenuItemData.Builder()
.setTitle(R.string.home_screen_order_services_title)
.setMenuIconResId(R.string.home_screen_order_services_icon)
.build(),
new MyIncidentMenuItemData.Builder()
.setTitle(R.string.home_screen_my_incidents_title)
.setMenuIconResId(R.string.home_screen_my_incidents_icon)
.build(),
new MyRequestMenuItemData.Builder()
.setTitle(R.string.home_screen_report_incident_title)
.setMenuIconResId(R.string.home_screen_my_request_icon)
.build()
);
}
package com.vsoft.servicenow.adapters;
import android.content.Context;
import android.content.res.TypedArray;
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.servicenow.R;
/**
* Created by kunj on 18/8/16.
*/
public class HomeScreenAdapter extends BaseAdapter {
private final LayoutInflater mInflater;
private final String[] mGridValues;
private final TypedArray icons;
//Constructor to initialize values
public HomeScreenAdapter(Context mContext, String[ ] mGridValues,TypedArray icons) {
this.mGridValues = mGridValues;
this.icons=icons;
mInflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
// Number of times getVariableViewContainer method call depends upon mGridValues.length
return mGridValues.length;
}
@Override
public String getItem(int position) {
return mGridValues[position];
}
@Override
public long getItemId(int position) {
return position;
}
// Number of times getVariableViewContainer method call depends upon mGridValues.length
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.home_screen_adapter, parent, false);
holder = new ViewHolder();
holder.textview = (TextView) convertView.findViewById(R.id.home_screen_adapter_text_view);
holder.imageView = (ImageView) convertView.findViewById(R.id.home_screen_adapter_image_view);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.textview.setText(mGridValues[position]);
holder.imageView.setImageResource(icons.getResourceId(position, -1));
return convertView;
}
static class ViewHolder {
private TextView textview;
private ImageView imageView;
}
}
package com.vsoft.servicenow.ui;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.widget.GridView;
import com.google.android.gms.analytics.Tracker;
import com.vsoft.servicenow.utils.Util;
import com.vsoft.servicenow.CatalogueApplication;
import com.vsoft.servicenow.R;
import com.vsoft.servicenow.adapters.HomeScreenAdapter;
import com.vsoft.servicenow.utils.PrefManager;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.OnItemClick;
/**
* Created by Kunj on 11/8/16.
*/
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;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.home_screen);
ButterKnife.bind(this);
CatalogueApplication application = (CatalogueApplication) getApplication();
Tracker tracker = application.getDefaultTracker();
// Send initial screen view hit.
Util.sendScreenName(tracker, getString(R.string.home_screen_string));
String[] gridValuesArray = getResources().getStringArray(R.array.home_screen_array);
TypedArray gridViewIcons = getResources().obtainTypedArray(R.array.home_screen_icon_array);
HomeScreenAdapter adapter = new HomeScreenAdapter(this, gridValuesArray, gridViewIcons);
mGridView.setAdapter(adapter);
}
@OnItemClick(R.id.home_screen_grid_view)
void gridViewItemClicked(int position) {
if (position == 0) {
startActivity(new Intent(HomeScreen.this, ReportIncidentScreen.class));
} else if (position == 1) {
startActivity(new Intent(HomeScreen.this, CatalogueScreen.class));
} else if (position == 2) {
startActivity(new Intent(HomeScreen.this, MyIncidentScreen.class));
} else if (position == 3) {
startActivity(new Intent(HomeScreen.this, MyRequestActivity.class));
}
}
@OnClick(R.id.home_screen_logout_image_view)
void logoutOnClicked() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.home_screen_logout_confirmation_msg_string)
.setCancelable(false)
.setPositiveButton(R.string.ok_string, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_ACCESS_TOKEN, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_REFRESH_TOKEN, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_LAST_NAME, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_SYS_ID, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_FIRST_NAME, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_USER_ID, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_USER_FULL_NAME, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_USER_EMAIL_ID, "");
Intent loginIntent = new Intent(HomeScreen.this, LoginScreen.class);
loginIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(loginIntent);
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
AlertDialog alert = builder.create();
alert.show();
}
}
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
card_view:cardBackgroundColor="@color/item_gb_color"
card_view:cardCornerRadius="8dp"
card_view:cardElevation="10dp"
card_view:cardUseCompatPadding="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/small_margin"
android:background="@color/item_gb_color">
<ImageView
android:id="@+id/home_screen_adapter_image_view"
android:layout_width="@dimen/home_screen_image_height"
android:layout_height="@dimen/home_screen_image_height"
android:layout_centerHorizontal="true"
android:layout_margin="@dimen/home_screen_image_margin" />
<TextView
android:id="@+id/home_screen_adapter_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/home_screen_adapter_image_view"
android:gravity="center"
android:textColor="@android:color/white"
android:textSize="@dimen/homescreen_text_size" />
</RelativeLayout>
</android.support.v7.widget.CardView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="home_screen_array">
<item>Report Incident</item>
<item>Order Services</item>
<item>My Incidents</item>
<item>My Requests</item>
</string-array>
<array name="home_screen_icon_array">
<item>@drawable/ic_myincident_icon</item>
<item>@drawable/ic_order_service_icon</item>
<item>@drawable/ic_my_incidents_icon</item>
<item>@drawable/ic_my_requiest_icon</item>
</array>
<string-array name="incident_impact_array">
<item>-None-</item>
<item>1 - High</item>
<item>2 - Medium</item>
<item>3 - Low</item>
</string-array>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--Margins-->
<dimen name="large_text_size">18sp</dimen>
<!--Text size-->
<dimen name="small_text_size">12sp</dimen>
<dimen name="normal_text_size">16sp</dimen>
<dimen name="extra_normal_text_size">20sp</dimen>
<dimen name="homescreen_text_size">18sp</dimen>
<dimen name="catalogue_category_and_item_list_view_divider_height">5dp</dimen>
<dimen name="list_view_divider_height">1dp</dimen>
<!--Home Screen-->
<dimen name="home_screen_image_margin">10dp</dimen>
<dimen name="home_screen_image_height">70dp</dimen>
<dimen name="list_item_height">100dp</dimen>
<!--Margins-->
<dimen name="small_margin">5dp</dimen>
<dimen name="normal_margin">10dp</dimen>
<dimen name="large_margin">15dp</dimen>
<dimen name="extra_large_margin">20dp</dimen>
<!--Text size-->
<dimen name="ruquest_status_text_size">15sp</dimen>
<dimen name="ruquest_descps_text_size">18sp</dimen>
<!-- MyRequest Activity-->
<dimen name="my_request_top">15dp</dimen>
<dimen name="my_request_left">15dp</dimen>
<dimen name="my_request_right">10dp</dimen>
<dimen name="my_request_new_top">18dp</dimen>
<dimen name="my_request_text_bottom">2dp</dimen>
<!--Report Incident screen-->
<dimen name="impact_spinner_drop_down_height">50dp</dimen>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="incident_from_short_description_text_limit">160</integer>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">GE Appliances</string>
<string name="set_string">Set</string>
<string name="submit_string">Submit</string>
<string name="back_string">Back</string>
<string name="error_string">* Required</string>
<string name="none_string">-None-</string>
<string name="yes_string">Yes</string>
<string name="no_string">No</string>
<string name="ok_string">Ok</string>
<string name="search_for_reference_string">Reference</string>
<string name="home_screen_string">Home Screen</string>
<string name="login_screen_string">Login Screen</string>
<!--Home Screen Option-->
<!--Start-->
<string name="home_screen_report_incident_title">Report Incident</string>
<string name="home_screen_report_incident_icon">ic_myincident_icon</string>
<string name="loading_string">Loading&#8230;</string>
<string name="select_date_string">Select Date</string>
<string name="select_date_and_time_string">Select Date &#038; Time</string>
<string name="home_screen_order_services_title">Order Services</string>
<string name="home_screen_order_services_icon">ic_order_service_icon</string>
<string name="name_null_view_string">Not rendering (name not available)</string>
<string name="view_not_implemented_string">Not Implemented: %s</string>
<string name="home_screen_my_incidents_title">My Incidents</string>
<string name="home_screen_my_incidents_icon">ic_my_incidents_icon</string>
<string name="approved">Approved</string>
<string name="notrequest">Not Yet Requested</string>
<string name="requested">Requested</string>
<string name="rejected">Rejected</string>
<string name="date_string">%1$s %2$s, %3$s</string>
<string name="date_and_time_string">%1$s:%2$s</string>
<!--Failed to fetch-->
<string name="failed_to_fetch_catalogue_category_string">Failed to fetch Catalogue Category.</string>
<string name="failed_to_fetch_my_request_string">Failed to fetch requests</string>
<string name="failed_to_fetch_catalogue_category_items_string">Failed to fetch Catalogue Category Items.</string>
<string name="failed_to_fetch_catalogue_form_string">Failed to fetch Form.</string>
<string name="failed_to_fetch_reference_string">Failed to fetch References.</string>
<string name="failed_to_submit_form_string">Failed to submit form.</string>
<string name="failed_to_fetch_incident_string">Failed to fetch incidents.</string>
<string name="failed_to_fetch_user_detail_string">Failed to fetch User Details.</string>
<!--Login Screen-->
<string name="prompt_relogin_login_expired">Login expired, please login again&#8230;</string>
<string name="login_screen_login_string">Login</string>
<string name="login_screen_logging_in_loading_string">Logging in&#8230;</string>
<string name="login_screen_getting_user_detail_loading_string">Getting user details&#8230;</string>
<string name="login_screen_invalid_username_and_password_string">Invalid username and password</string>
<string name="user_detail_not_available">Unable to fetch user details.</string>
<string name="user_error">Please enter username</string>
<string name="pasw_error">Please enter password</string>
<string name="username_string">Username</string>
<string name="password_string">Password</string>
<!--Variable Screen-->
<string name="variable_form_misc_info_string">%1$s [add %2$.2f]</string>
<string name="variable_form_header_string">Submit Order</string>
<string name="variable_form_view_mandatory_sign_string">&lt;font color="#FF0000"&gt;*&lt;/font&gt;</string>
<string name="variable_form_reference_dialog_title_string">Search \'%s\'</string>
<string name="variable_form_radio_text_string">%d</string>
<string name="variable_form_ui_page_button_label_string">Add Attachment</string>
<string name="variable_form_ui_page_no_selected_attachment_string">Not Selected</string>
<string name="custom_setting_storage_permission_dialog_msg_string">To use this feature, please go to Settings -> Apps -> %s -> Permissions and enable \'Storage\' permission</string>
<string name="variable_form_back_navigation_string">Are you sure you want to navigate away?</string>
<string name="variable_form_order_successful_submission_string">Your Order has been submitted successfully</string>
<string name="variable_form_reference_no_result_string">No Result</string>
<string name="Variable_form_short_description_anchor_line_break_css"><![CDATA[
<style>
a {
word-break: break-all;
}
</style>
]]></string>
<!--Catalogue Item Screen-->
<string name="no_catalogue_item_string">No Catalogue Items&#8230;</string>
<!--Catalogue Screen-->
<string name="catalogue_category_string">Order Services</string>
<string name="my_reques_string">My Requests</string>
<!--Incident screen-->
<string name="incident_form_report_incident_text_string">Report Incident</string>
<string name="incident_form_top_text_string">Create an Incident record to report and request assistance with an issue you are having\n\nRequest assistance with an issue you are having. An incident record will be created and managed through to successful resolution. You will also be notified of progress.</string>
<string name="incident_form_impact_text_string">Impact &lt;font color="#FF0000"&gt;*&lt;/font&gt;</string>
<string name="incident_form_describe_your_issue_text_string">Please Describe Your Issue below &lt;font color="#FF0000"&gt;*&lt;/font&gt;(Max %d)</string>
<string name="incident_item_text_string"><![CDATA[<b>Number: </b>%1$s<br><br><b>Opened: </b>%2$s<br><br><b>Short Description: </b>%3$s]]></string>
<string name="incident_form_short_description_limit_error_text_string">Max limit exceeded by %d</string>
<!--My Incidents-->
<string name="my_incidents_text_string">My Incidents</string>
<string name="my_incidents_item_text_string"><![CDATA[<b>Number: </b>%1$s<br><br><b>Item: </b>%2$s<br><br><b>Updated: </b>%3$s<br><br><b>Request: </b>%4$s<br><br><b>Opened by: </b>%5$s<br><br><b>Stage: </b>%6$s]]></string>
<string name="connection_alert_dialog_title">No Connection Available</string>
<string name="connection_alert_dialog_message">Please check your device settings to ensure you have a working internet connection.</string>
<string name="cancel">Cancel</string>
<string name="settings">Settings</string>
<!--Catalogue Variable form screen - key for pre fill value-->
<string name="catalogue_user_full_name">full_name</string>
<string name="catalogue_user_id">user_id</string>
<string name="catalogue_user_email_id">email_address</string>
<!--Home Screen-->
<string name="home_screen_logout_confirmation_msg_string">Are you sure you want to logout?</string>
<string name="home_screen_my_request_title">My Requests</string>
<string name="home_screen_my_request_icon">ic_my_requiest_icon</string>
<!--End-->
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="windowNoTitle">true</item>
<item name="actionOverflowMenuStyle">@style/OverflowMenu</item>
<style name="HomeBackgroundStyle" parent="@style/Theme.AppCompat">
<item name="android:background">@color/home_screen_bg_color</item>
</style>
<style name="OverflowMenu" parent="Widget.AppCompat.PopupMenu.Overflow">
<!-- Required for pre-Lollipop. -->
<item name="overlapAnchor">false</item>
<!-- Required for Lollipop. -->
<item name="android:overlapAnchor">false</item>
</style>
<style name="WhiteBackgroundStyle" parent="@style/Theme.AppCompat">
<item name="android:background">@android:color/white</item>
</style>
<style name="LightBackgroundStyle" parent="@style/Theme.AppCompat">
<item name="android:background">@color/screen_bg_color</item>
</style>
<style name="DatePickerCustomDialog" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@android:color/white</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowNoTitle">true</item>
<item name="editTextStyle">@android:style/Widget.EditText</item>
</style>
<style name="CustomDialog">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
</resources>
......@@ -23,6 +23,7 @@ import com.vsoft.servicenow.ui.LoginScreen;
import com.vsoft.servicenow.utils.CatalogueLog;
import com.vsoft.servicenow.utils.Constants;
import com.vsoft.servicenow.utils.PrefManager;
import com.vsoft.servicenow.utils.Util;
import java.net.URISyntaxException;
......@@ -36,14 +37,6 @@ public class CatalogueApplication extends Application {
private Tracker mTracker;
private Socket mSocket;
{
try {
mSocket = IO.socket(AppConfig.CHAT_SERVER_URL);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
private BroadcastReceiver mSyncBroadCastSyncReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
......@@ -94,6 +87,10 @@ public class CatalogueApplication extends Application {
/*Database is created*/
initializeDatabase();
if(Util.isChatItemEnabled()) {
initializeSocket();
}
}
@Override
......@@ -138,6 +135,13 @@ public class CatalogueApplication extends Application {
return netInfo != null && netInfo.isConnected();
}
private void initializeSocket() {
try {
mSocket = IO.socket(AppConfig.CHAT_SERVER_URL);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
public Socket getSocket() {
return mSocket;
}
......
......@@ -10,6 +10,10 @@ import android.widget.ImageView;
import android.widget.TextView;
import com.vsoft.servicenow.R;
import com.vsoft.servicenow.menu.HomeScreenMenuItemData;
import com.vsoft.servicenow.utils.Constants;
import java.util.List;
/**
* Created by kunj on 18/8/16.
......@@ -17,26 +21,26 @@ import com.vsoft.servicenow.R;
public class HomeScreenAdapter extends BaseAdapter {
private final LayoutInflater mInflater;
private final String[] mGridValues;
private final TypedArray icons;
private Context mContext;
private List<HomeScreenMenuItemData> mHomeScreenMenuItemDataList;
//Constructor to initialize values
public HomeScreenAdapter(Context mContext, String[ ] mGridValues,TypedArray icons) {
this.mGridValues = mGridValues;
this.icons=icons;
mInflater = (LayoutInflater) mContext
public HomeScreenAdapter(Context context, List<HomeScreenMenuItemData> homeScreenMenuItemDataList) {
mContext = context;
mHomeScreenMenuItemDataList = homeScreenMenuItemDataList;
mInflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
// Number of times getVariableViewContainer method call depends upon mGridValues.length
return mGridValues.length;
return mHomeScreenMenuItemDataList.size();
}
@Override
public String getItem(int position) {
return mGridValues[position];
public HomeScreenMenuItemData getItem(int position) {
return mHomeScreenMenuItemDataList.get(position);
}
@Override
......@@ -47,24 +51,27 @@ public class HomeScreenAdapter extends BaseAdapter {
// Number of times getVariableViewContainer method call depends upon mGridValues.length
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
HomeScreenMenuItemData homeScreenMenuItemData = mHomeScreenMenuItemDataList.get(position);
if (convertView == null) {
convertView = mInflater.inflate(R.layout.home_screen_adapter, parent, false);
holder = new ViewHolder();
// holder.textview = (TextView) convertView.findViewById(R.id.home_screen_adapter_text_view);
holder.imageView = (ImageView) convertView.findViewById(R.id.home_screen_adapter_image_view);
holder.imageView = convertView.findViewById(R.id.home_screen_adapter_image_view);
holder.textview = convertView.findViewById(R.id.home_screen_adapter_text_view);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
//holder.textview.setText(mGridValues[position]);
holder.imageView.setImageResource(icons.getResourceId(position, -1));
holder.textview.setText(homeScreenMenuItemData.getTitleResId());
int imageResId = mContext.getResources().getIdentifier(mContext.getString(homeScreenMenuItemData.getMenuIconName()), "drawable", mContext.getPackageName());
holder.imageView.setImageResource(imageResId);
return convertView;
}
static class ViewHolder {
private static class ViewHolder {
private TextView textview;
private ImageView imageView;
}
......
......@@ -8,6 +8,7 @@ import android.preference.PreferenceManager;
import com.vsoft.servicenow.utils.Constants;
import com.vsoft.servicenow.utils.DBConstants;
import com.vsoft.servicenow.utils.Util;
/**
......@@ -42,8 +43,10 @@ public class DBManager extends SQLiteOpenHelper implements DBConstants {
createAttachmentTable(db);
createIncidentInputTable(db);
if(Util.isNotificationsItemEnabled()) {
createNotificationsTable(db);
}
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
......
package com.vsoft.servicenow.menu;
import android.os.Parcel;
import android.os.Parcelable;
import com.vsoft.servicenow.chat.ChatActivity;
import com.vsoft.servicenow.ui.ReportIncidentScreen;
/**
* Created by Kunj on 23/03/18.
*/
public class ChatMenuItemData extends HomeScreenMenuItemData implements Parcelable {
protected ChatMenuItemData() {
}
protected ChatMenuItemData(Parcel in) {
super(in);
}
public static final Creator<ChatMenuItemData> CREATOR = new Creator<ChatMenuItemData>() {
@Override
public ChatMenuItemData createFromParcel(Parcel in) {
return new ChatMenuItemData(in);
}
@Override
public ChatMenuItemData[] newArray(int size) {
return new ChatMenuItemData[size];
}
};
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags);
}
@Override
public int describeContents() {
return 0;
}
public static class Builder extends HomeScreenMenuItemData.Builder<Builder> {
public Builder() {
item = new ChatMenuItemData();
setFragment(ChatActivity.class);
}
}
}
package com.vsoft.servicenow.menu;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by chaukadev on 3/23/18.
*/
public class HomeScreenMenuItemData implements Parcelable {
private int titleResId;
private int menuIconName;
private Class activity;
protected HomeScreenMenuItemData(Parcel in) {
titleResId = in.readInt();
menuIconName = in.readInt();
activity = (Class) in.readValue(Class.class.getClassLoader());
}
protected HomeScreenMenuItemData() {
}
public static final Creator<HomeScreenMenuItemData> CREATOR = new Creator<HomeScreenMenuItemData>() {
@Override
public HomeScreenMenuItemData createFromParcel(Parcel in) {
return new HomeScreenMenuItemData(in);
}
@Override
public HomeScreenMenuItemData[] newArray(int size) {
return new HomeScreenMenuItemData[size];
}
};
public int getTitleResId() {
return titleResId;
}
public int getMenuIconName() {
return menuIconName;
}
public Class getActivity() {
return activity;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(titleResId);
dest.writeInt(menuIconName);
}
@SuppressWarnings("unchecked")
static class Builder<T extends Builder> {
protected HomeScreenMenuItemData item;
public Builder() {
item = new HomeScreenMenuItemData();
}
public T setTitle(int titleResId) {
item.titleResId = titleResId;
return (T) this;
}
public T setMenuIconResId(int menuIconResId) {
item.menuIconName = menuIconResId;
return (T) this;
}
public T setFragment(Class fragment) {
item.activity = fragment;
return (T) this;
}
public HomeScreenMenuItemData build() {
return item;
}
}
}
package com.vsoft.servicenow.menu;
import android.os.Parcel;
import android.os.Parcelable;
import com.vsoft.servicenow.ui.MyIncidentScreen;
import com.vsoft.servicenow.ui.ReportIncidentScreen;
/**
* Created by Kunj on 23/03/18.
*/
public class MyIncidentMenuItemData extends HomeScreenMenuItemData implements Parcelable {
protected MyIncidentMenuItemData() {
}
protected MyIncidentMenuItemData(Parcel in) {
super(in);
}
public static final Creator<MyIncidentMenuItemData> CREATOR = new Creator<MyIncidentMenuItemData>() {
@Override
public MyIncidentMenuItemData createFromParcel(Parcel in) {
return new MyIncidentMenuItemData(in);
}
@Override
public MyIncidentMenuItemData[] newArray(int size) {
return new MyIncidentMenuItemData[size];
}
};
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags);
}
@Override
public int describeContents() {
return 0;
}
public static class Builder extends HomeScreenMenuItemData.Builder<Builder> {
public Builder() {
item = new MyIncidentMenuItemData();
setFragment(MyIncidentScreen.class);
}
}
}
package com.vsoft.servicenow.menu;
import android.os.Parcel;
import android.os.Parcelable;
import com.vsoft.servicenow.ui.MyRequestActivity;
import com.vsoft.servicenow.ui.ReportIncidentScreen;
/**
* Created by Kunj on 23/03/18.
*/
public class MyRequestMenuItemData extends HomeScreenMenuItemData implements Parcelable {
protected MyRequestMenuItemData() {
}
protected MyRequestMenuItemData(Parcel in) {
super(in);
}
public static final Creator<MyRequestMenuItemData> CREATOR = new Creator<MyRequestMenuItemData>() {
@Override
public MyRequestMenuItemData createFromParcel(Parcel in) {
return new MyRequestMenuItemData(in);
}
@Override
public MyRequestMenuItemData[] newArray(int size) {
return new MyRequestMenuItemData[size];
}
};
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags);
}
@Override
public int describeContents() {
return 0;
}
public static class Builder extends HomeScreenMenuItemData.Builder<Builder> {
public Builder() {
item = new MyRequestMenuItemData();
setFragment(MyRequestActivity.class);
}
}
}
package com.vsoft.servicenow.menu;
import android.os.Parcel;
import android.os.Parcelable;
import com.vsoft.servicenow.chat.ChatActivity;
import com.vsoft.servicenow.ui.NotificationScreen;
/**
* Created by Kunj on 23/03/18.
*/
public class NotificationMenuItemData extends HomeScreenMenuItemData implements Parcelable {
protected NotificationMenuItemData() {
}
protected NotificationMenuItemData(Parcel in) {
super(in);
}
public static final Creator<NotificationMenuItemData> CREATOR = new Creator<NotificationMenuItemData>() {
@Override
public NotificationMenuItemData createFromParcel(Parcel in) {
return new NotificationMenuItemData(in);
}
@Override
public NotificationMenuItemData[] newArray(int size) {
return new NotificationMenuItemData[size];
}
};
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags);
}
@Override
public int describeContents() {
return 0;
}
public static class Builder extends HomeScreenMenuItemData.Builder<Builder> {
public Builder() {
item = new NotificationMenuItemData();
setFragment(NotificationScreen.class);
}
}
}
package com.vsoft.servicenow.menu;
import android.os.Parcel;
import android.os.Parcelable;
import com.vsoft.servicenow.ui.CatalogueScreen;
import com.vsoft.servicenow.ui.ReportIncidentScreen;
/**
* Created by Kunj on 23/03/18.
*/
public class OrderServicesMenuItemData extends HomeScreenMenuItemData implements Parcelable {
protected OrderServicesMenuItemData() {
}
protected OrderServicesMenuItemData(Parcel in) {
super(in);
}
public static final Creator<OrderServicesMenuItemData> CREATOR = new Creator<OrderServicesMenuItemData>() {
@Override
public OrderServicesMenuItemData createFromParcel(Parcel in) {
return new OrderServicesMenuItemData(in);
}
@Override
public OrderServicesMenuItemData[] newArray(int size) {
return new OrderServicesMenuItemData[size];
}
};
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags);
}
@Override
public int describeContents() {
return 0;
}
public static class Builder extends HomeScreenMenuItemData.Builder<Builder> {
public Builder() {
item = new OrderServicesMenuItemData();
setFragment(CatalogueScreen.class);
}
}
}
package com.vsoft.servicenow.menu;
import android.os.Parcel;
import android.os.Parcelable;
import com.vsoft.servicenow.ui.ReportIncidentScreen;
/**
* Created by Kunj on 23/03/18.
*/
public class ReportIncidentMenuItemData extends HomeScreenMenuItemData implements Parcelable {
protected ReportIncidentMenuItemData() {
}
protected ReportIncidentMenuItemData(Parcel in) {
super(in);
}
public static final Creator<ReportIncidentMenuItemData> CREATOR = new Creator<ReportIncidentMenuItemData>() {
@Override
public ReportIncidentMenuItemData createFromParcel(Parcel in) {
return new ReportIncidentMenuItemData(in);
}
@Override
public ReportIncidentMenuItemData[] newArray(int size) {
return new ReportIncidentMenuItemData[size];
}
};
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags);
}
@Override
public int describeContents() {
return 0;
}
public static class Builder extends HomeScreenMenuItemData.Builder<Builder> {
public Builder() {
item = new ReportIncidentMenuItemData();
setFragment(ReportIncidentScreen.class);
}
}
}
......@@ -11,6 +11,7 @@ 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 com.vsoft.servicenow.utils.Util;
import org.json.JSONException;
import org.json.JSONObject;
......@@ -29,8 +30,10 @@ public class NotificationInstanceIdService extends FirebaseInstanceIdService {
CatalogueLog.d("Refreshed token: " + refreshedToken);
PrefManager.setSharedPref(CatalogueApplication.getContext(), Constants.PREFS_NOTIFICATION_TOKEN, refreshedToken);
if(Util.isNotificationsItemEnabled()) {
sendRegistrationToServer(refreshedToken);
}
}
private void sendRegistrationToServer(String refreshedToken) {
String userSysId = PrefManager.getSharedPref(CatalogueApplication.getContext(), PrefManager.PREFERENCE_SYS_ID);
......
......@@ -7,13 +7,16 @@ import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.widget.GridView;
import com.google.android.gms.analytics.Tracker;
import com.vsoft.servicenow.chat.ChatActivity;
import com.vsoft.servicenow.utils.Util;
import com.vsoft.servicenow.CatalogueApplication;
import com.vsoft.servicenow.MenuProvider;
import com.vsoft.servicenow.R;
import com.vsoft.servicenow.adapters.HomeScreenAdapter;
import com.vsoft.servicenow.chat.ChatActivity;
import com.vsoft.servicenow.menu.HomeScreenMenuItemData;
import com.vsoft.servicenow.utils.PrefManager;
import com.vsoft.servicenow.utils.Util;
import butterknife.BindView;
import butterknife.ButterKnife;
......@@ -43,31 +46,16 @@ public class HomeScreen extends HandleNotificationActivity {
// Send initial screen view hit.
Util.sendScreenName(tracker, getString(R.string.home_screen_string));
String[] gridValuesArray = getResources().getStringArray(R.array.home_screen_array);
TypedArray gridViewIcons = getResources().obtainTypedArray(R.array.home_screen_icon_array);
HomeScreenAdapter adapter = new HomeScreenAdapter(this, gridValuesArray, gridViewIcons);
HomeScreenAdapter adapter = new HomeScreenAdapter(this, MenuProvider.MENU_ITEMS);
mGridView.setAdapter(adapter);
}
@OnItemClick(R.id.home_screen_grid_view)
void gridViewItemClicked(int position) {
if (position == 0) {
startActivity(new Intent(HomeScreen.this, ReportIncidentScreen.class));
} else if (position == 1) {
startActivity(new Intent(HomeScreen.this, CatalogueScreen.class));
} else if (position == 2) {
startActivity(new Intent(HomeScreen.this, MyIncidentScreen.class));
} else if (position == 3) {
startActivity(new Intent(HomeScreen.this, MyRequestActivity.class));
} else if (position == 4) {
// perform the user login attempt.
Intent intent = new Intent(HomeScreen.this, ChatActivity.class);
startActivity(intent);
} else if (position == 5) {
Intent intent = new Intent(HomeScreen.this, NotificationScreen.class);
HomeScreenMenuItemData homeScreenMenuItemData = MenuProvider.MENU_ITEMS.get(position);
Intent intent = new Intent(this, homeScreenMenuItemData.getActivity());
startActivity(intent);
}
}
@OnClick(R.id.home_screen_logout_image_view)
void logoutOnClicked() {
......
......@@ -159,7 +159,7 @@ public class LoginScreen extends Activity {
@Override
public void onDoneApiCall(List<UserApiValues> userValues) {
mUserDetails = userValues;
if(Util.isNotificationsItemEnabled()) {
UserApiManager.putDeviceRegistration(LoginScreen.this, userValues.get(0).getSysId(), new PutDeviceRegistrationApiListener() {
@Override
public void onDoneApiCall() {
......@@ -171,6 +171,9 @@ public class LoginScreen extends Activity {
apiStatus = API_FAIL_USER_DETAIL;
}
});
} else {
apiStatus = API_SUCCESS_USER_DETAIL;
}
}
@Override
......
......@@ -30,12 +30,15 @@ import android.widget.TextView;
import com.google.android.gms.analytics.HitBuilders;
import com.google.android.gms.analytics.Tracker;
import com.vsoft.servicenow.CatalogueApplication;
import com.vsoft.servicenow.MenuProvider;
import com.vsoft.servicenow.R;
import com.vsoft.servicenow.db.models.CatalogueVariable;
import com.vsoft.servicenow.db.models.Reference;
import com.vsoft.servicenow.db.models.VariableChoice;
import com.vsoft.servicenow.db.models.VariableViewContainer;
import com.vsoft.servicenow.enums.ViewType;
import com.vsoft.servicenow.menu.ChatMenuItemData;
import com.vsoft.servicenow.menu.NotificationMenuItemData;
import java.io.IOException;
import java.text.ParseException;
......@@ -640,16 +643,6 @@ public class Util {
return result;
}
/**
* getDateTimeStringForDisplay: This method will convert long value to define date format string.
* */
public static String getDateTimeStringForDisplay(long dateTime) {
SimpleDateFormat format = new SimpleDateFormat("MMMM dd 'at' hh:mm aa");
return format.format(dateTime);
}
/**
* playNotificationSound: This method will play default notification sound.
* */
......@@ -678,4 +671,20 @@ public class Util {
e.printStackTrace();
}
}
public static boolean isNotificationsItemEnabled() {
for(int i = 0; i< MenuProvider.MENU_ITEMS.size(); i++) {
if(MenuProvider.MENU_ITEMS.get(i) instanceof NotificationMenuItemData)
return true;
}
return false;
}
public static boolean isChatItemEnabled() {
for(int i=0; i<MenuProvider.MENU_ITEMS.size(); i++) {
if(MenuProvider.MENU_ITEMS.get(i) instanceof ChatMenuItemData)
return true;
}
return false;
}
}
......@@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/home_background"
style="@style/HomeBackgroundStyle"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
......@@ -12,11 +12,11 @@
android:layout_height="wrap_content"
android:background="@android:color/white"
android:minHeight="?attr/actionBarSize"
app:titleTextColor="@color/tool_bar_title_color"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetRight="0dp"
app:contentInsetEnd="0dp">
app:contentInsetStart="0dp"
app:titleTextColor="@color/tool_bar_title_color">
<RelativeLayout
android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/home_screen_adapter_image_view"
android:layout_width="150dp"
android:layout_height="150dp"
android:src="@drawable/chatbot"
android:scaleType="centerCrop"
android:layout_centerHorizontal="true"
/>
<!--<TextView-->
<!--android:id="@+id/home_screen_adapter_text_view"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_below="@+id/home_screen_adapter_image_view"-->
<!--android:gravity="center"-->
<!--android:textColor="@android:color/white"-->
<!--android:textSize="@dimen/homescreen_text_size" />-->
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="home_screen_array">
<item>Report Incident</item>
<item>Order Services</item>
<item>My Incidents</item>
<item>My Requests</item>
</string-array>
<array name="home_screen_icon_array">
<item>@drawable/ic_myincident_icon</item>
<item>@drawable/ic_order_service_icon</item>
<item>@drawable/ic_my_incidents_icon</item>
<item>@drawable/ic_my_requiest_icon</item>
</array>
<string-array name="incident_impact_array">
<item>-None-</item>
<item>1 - High</item>
<item>2 - Medium</item>
<item>3 - Low</item>
</string-array>
<!--Chat Screen User Name Colors-->
<array name="username_colors">
<item>@color/username0</item>
<item>@color/username1</item>
<item>@color/username2</item>
<item>@color/username3</item>
<item>@color/username4</item>
<item>@color/username5</item>
<item>@color/username6</item>
<item>@color/username7</item>
<item>@color/username8</item>
<item>@color/username9</item>
<item>@color/username10</item>
<item>@color/username11</item>
</array>
</resources>
\ No newline at end of file
......@@ -26,4 +26,21 @@
<!--Notification screen-->
<color name="list_divider_color">@color/light_gray</color>
<!--Chatbot Screen-->
<color name="username0">#e21400</color>
<color name="username1">#91580f</color>
<color name="username2">#f8a700</color>
<color name="username3">#f78b00</color>
<color name="username4">#58dc00</color>
<color name="username5">#287b00</color>
<color name="username6">#a8f07a</color>
<color name="username7">#4ae8c4</color>
<color name="username8">#3b88eb</color>
<color name="username9">#3824aa</color>
<color name="username10">#a700ff</color>
<color name="username11">#d300e7</color>
<color name="hr_background_chat_color">#f7fcfc</color>
<color name="user_background_chat_color">#e6f3f5</color>
</resources>
......@@ -46,4 +46,13 @@
<!--Notification screen-->
<dimen name="list_divider_height">0.5dp</dimen>
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="spacing">8dp</dimen>
<dimen name="chat_margin">40dp</dimen>
<!--SPEECH RECOGNIZER-->
<dimen name="progressMsgMargin">10dp</dimen>
</resources>
\ No newline at end of file
......@@ -108,4 +108,45 @@
<string name="notification_screen_action_bar_title_string">Notifications</string>
<string name="notification_screen_empty_text_string">No Notifications</string>
<string name="go_to_notification_string">Go to Notification</string>
<!--Chat Related String-->
<string name="chat_activity_label">Vera</string>
<string name="action_leave">Leave</string>
<string name="action_send">Send</string>
<string name="prompt_message">Message</string>
<string name="connect">Connected</string>
<string name="disconnect">Disconnected, Please check your internet connection</string>
<string name="error_connect">Failed to connect</string>
<string name="unauthorized_user">Unauthorized User</string>
<!-- messages -->
<string name="message_welcome">Chat with HR Bot</string>
<plurals name="message_participants">
<item quantity="one">there\'s %d participant</item>
<item quantity="other">there are %d participants</item>
</plurals>
<string name="message_user_joined">%s joined</string>
<string name="message_user_left">%s left</string>
<string name="user_action_typing">is typing</string>
<!--Speech Recognizer-->
<string name="ds_listening">Listening…</string>
<string name="ds_internet_not_enabled">Internet is not enabled</string>
<string name="ds_mic_permissions_required">Please provide microphone permissions</string>
<string name="ds_unknown_error">Unknown error</string>
<string name="ds_progress_layout_error">Unable to add speech progress view</string>
<string name="ds_confirm">Confirm</string>
<string name="ds_retry">Retry</string>
<string-array name="droid_speech_errors">
<item>Network Timeout</item>
<item>Network Error</item>
<item>Audio Error</item>
<item>Server Error</item>
<item>Client Error</item>
<item>Speech Timeout</item>
<item>No match</item>
<item>Speech Recognizer busy</item>
<item>Insufficient permissions</item>
</string-array>
</resources>
{
"project_info": {
"project_number": "957773681882",
"firebase_url": "https://vosft-ge.firebaseio.com",
"project_id": "vosft-ge",
"storage_bucket": "vosft-ge.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:957773681882:android:90c2e6c83d0908f5",
"android_client_info": {
"package_name": "com.vsoft.servicenow.uofl.debug"
}
},
"oauth_client": [
{
"client_id": "957773681882-go7d0rln03htjche50s07m9r73mqgiu0.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.vsoft.servicenow.uofl.debug",
"certificate_hash": "5369fc4c8024379da200c54f6f889559c45b60d2"
}
},
{
"client_id": "957773681882-rl34anslfron5f8epo6d0u0uten6bh4p.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyBN1ZaTBm2S2hBWfajKGq60FtaZzo0ESAs"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 2,
"other_platform_oauth_client": [
{
"client_id": "957773681882-rl34anslfron5f8epo6d0u0uten6bh4p.apps.googleusercontent.com",
"client_type": 3
}
]
},
"ads_service": {
"status": 2
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:957773681882:android:7cdac4a20e2cb330",
"android_client_info": {
"package_name": "com.vsoft.uoflservicenow.debug"
}
},
"oauth_client": [
{
"client_id": "957773681882-5vohjmciupgpv35utrukqv7kijek2lm4.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.vsoft.uoflservicenow.debug",
"certificate_hash": "5369fc4c8024379da200c54f6f889559c45b60d2"
}
},
{
"client_id": "957773681882-rl34anslfron5f8epo6d0u0uten6bh4p.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyBN1ZaTBm2S2hBWfajKGq60FtaZzo0ESAs"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 2,
"other_platform_oauth_client": [
{
"client_id": "957773681882-rl34anslfron5f8epo6d0u0uten6bh4p.apps.googleusercontent.com",
"client_type": 3
}
]
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}
\ No newline at end of file
......@@ -7,6 +7,8 @@ public class AppConfig {
public static final String APP_INTERNAL_NAME = "V-Portal";
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://ven01199.service-now.com/";//"https://uofltest.service-now.com/";
......
package com.vsoft.servicenow;
import com.vsoft.servicenow.menu.HomeScreenMenuItemData;
import com.vsoft.servicenow.menu.MyIncidentMenuItemData;
import com.vsoft.servicenow.menu.MyRequestMenuItemData;
import com.vsoft.servicenow.menu.OrderServicesMenuItemData;
import com.vsoft.servicenow.menu.ReportIncidentMenuItemData;
import java.util.Arrays;
import java.util.List;
/**
* Created by Kunj on 3/23/18.
*/
public class MenuProvider {
public static final List<HomeScreenMenuItemData> MENU_ITEMS = Arrays.asList(
new ReportIncidentMenuItemData.Builder()
.setTitle(R.string.home_screen_report_incident_title)
.setMenuIconResId(R.string.home_screen_report_incident_icon)
.build(),
new OrderServicesMenuItemData.Builder()
.setTitle(R.string.home_screen_order_services_title)
.setMenuIconResId(R.string.home_screen_order_services_icon)
.build(),
new MyIncidentMenuItemData.Builder()
.setTitle(R.string.home_screen_my_incidents_title)
.setMenuIconResId(R.string.home_screen_my_incidents_icon)
.build(),
new MyRequestMenuItemData.Builder()
.setTitle(R.string.home_screen_report_incident_title)
.setMenuIconResId(R.string.home_screen_my_request_icon)
.build()
);
}
package com.vsoft.servicenow.adapters;
import android.content.Context;
import android.content.res.TypedArray;
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.servicenow.R;
/**
* Created by kunj on 18/8/16.
*/
public class HomeScreenAdapter extends BaseAdapter {
private final LayoutInflater mInflater;
private final String[] mGridValues;
private final TypedArray icons;
//Constructor to initialize values
public HomeScreenAdapter(Context mContext, String[ ] mGridValues,TypedArray icons) {
this.mGridValues = mGridValues;
this.icons=icons;
mInflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
// Number of times getVariableViewContainer method call depends upon mGridValues.length
return mGridValues.length;
}
@Override
public String getItem(int position) {
return mGridValues[position];
}
@Override
public long getItemId(int position) {
return position;
}
// Number of times getVariableViewContainer method call depends upon mGridValues.length
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.home_screen_adapter, parent, false);
holder = new ViewHolder();
holder.textview = (TextView) convertView.findViewById(R.id.home_screen_adapter_text_view);
holder.imageView = (ImageView) convertView.findViewById(R.id.home_screen_adapter_image_view);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.textview.setText(mGridValues[position]);
holder.imageView.setImageResource(icons.getResourceId(position, -1));
return convertView;
}
static class ViewHolder {
private TextView textview;
private ImageView imageView;
}
}
package com.vsoft.servicenow.ui;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.widget.GridView;
import com.google.android.gms.analytics.Tracker;
import com.vsoft.servicenow.utils.Util;
import com.vsoft.servicenow.CatalogueApplication;
import com.vsoft.servicenow.R;
import com.vsoft.servicenow.adapters.HomeScreenAdapter;
import com.vsoft.servicenow.utils.PrefManager;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.OnItemClick;
/**
* Created by Kunj on 11/8/16.
*/
public class HomeScreen extends AppCompatActivity {
@BindView(R.id.tool_bar_view) Toolbar mToolbar;
@BindView(R.id.home_screen_grid_view) GridView mGridView;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.home_screen);
ButterKnife.bind(this);
CatalogueApplication application = (CatalogueApplication) getApplication();
Tracker tracker = application.getDefaultTracker();
// Send initial screen view hit.
Util.sendScreenName(tracker, getString(R.string.home_screen_string));
String[] gridValuesArray = getResources().getStringArray(R.array.home_screen_array);
TypedArray gridViewIcons = getResources().obtainTypedArray(R.array.home_screen_icon_array);
HomeScreenAdapter adapter = new HomeScreenAdapter(this, gridValuesArray, gridViewIcons);
mGridView.setAdapter(adapter);
}
@OnItemClick(R.id.home_screen_grid_view)
void gridViewItemClicked(int position) {
if (position == 0) {
startActivity(new Intent(HomeScreen.this, ReportIncidentScreen.class));
} else if (position == 1) {
startActivity(new Intent(HomeScreen.this, CatalogueScreen.class));
} else if (position == 2) {
startActivity(new Intent(HomeScreen.this, MyIncidentScreen.class));
} else if (position == 3) {
startActivity(new Intent(HomeScreen.this, MyRequestActivity.class));
}
}
@OnClick(R.id.home_screen_logout_image_view)
void logoutOnClicked() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.home_screen_logout_confirmation_msg_string)
.setCancelable(false)
.setPositiveButton(R.string.ok_string, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_ACCESS_TOKEN, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_REFRESH_TOKEN, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_LAST_NAME, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_SYS_ID, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_FIRST_NAME, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_USER_ID, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_USER_FULL_NAME, "");
PrefManager.setSharedPref(HomeScreen.this, PrefManager.PREFERENCE_USER_EMAIL_ID, "");
Intent loginIntent = new Intent(HomeScreen.this, LoginScreen.class);
loginIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(loginIntent);
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
AlertDialog alert = builder.create();
alert.show();
}
}
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
card_view:cardBackgroundColor="@color/item_gb_color"
card_view:cardCornerRadius="8dp"
card_view:cardElevation="10dp"
card_view:cardUseCompatPadding="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/small_margin"
android:background="@color/item_gb_color">
<ImageView
android:id="@+id/home_screen_adapter_image_view"
android:layout_width="@dimen/home_screen_image_height"
android:layout_height="@dimen/home_screen_image_height"
android:layout_centerHorizontal="true"
android:layout_margin="@dimen/home_screen_image_margin" />
<TextView
android:id="@+id/home_screen_adapter_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/home_screen_adapter_image_view"
android:gravity="center"
android:textColor="@android:color/white"
android:textSize="@dimen/homescreen_text_size" />
</RelativeLayout>
</android.support.v7.widget.CardView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="home_screen_array">
<item>Report Incident</item>
<item>Order Services</item>
<item>My Incidents</item>
<item>My Requests</item>
</string-array>
<array name="home_screen_icon_array">
<item>@drawable/ic_myincident_icon</item>
<item>@drawable/ic_order_service_icon</item>
<item>@drawable/ic_my_incidents_icon</item>
<item>@drawable/ic_my_requiest_icon</item>
</array>
<string-array name="incident_impact_array">
<item>-None-</item>
<item>1 - High</item>
<item>2 - Medium</item>
<item>3 - Low</item>
</string-array>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--Margins-->
<dimen name="large_text_size">18sp</dimen>
<!--Text size-->
<dimen name="small_text_size">12sp</dimen>
<dimen name="normal_text_size">16sp</dimen>
<dimen name="extra_normal_text_size">20sp</dimen>
<dimen name="homescreen_text_size">18sp</dimen>
<dimen name="catalogue_category_and_item_list_view_divider_height">5dp</dimen>
<dimen name="list_view_divider_height">1dp</dimen>
<!--Home Screen-->
<dimen name="home_screen_image_margin">10dp</dimen>
<dimen name="home_screen_image_height">70dp</dimen>
<dimen name="list_item_height">100dp</dimen>
<!--Margins-->
<dimen name="small_margin">5dp</dimen>
<dimen name="normal_margin">10dp</dimen>
<dimen name="large_margin">15dp</dimen>
<dimen name="extra_large_margin">20dp</dimen>
<!--Text size-->
<dimen name="ruquest_status_text_size">15sp</dimen>
<dimen name="ruquest_descps_text_size">18sp</dimen>
<!-- MyRequest Activity-->
<dimen name="my_request_top">15dp</dimen>
<dimen name="my_request_left">15dp</dimen>
<dimen name="my_request_right">10dp</dimen>
<dimen name="my_request_new_top">18dp</dimen>
<dimen name="my_request_text_bottom">2dp</dimen>
<!--Report Incident screen-->
<dimen name="impact_spinner_drop_down_height">50dp</dimen>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="incident_from_short_description_text_limit">160</integer>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">V-Portal</string>
<string name="set_string">Set</string>
<string name="submit_string">Submit</string>
<string name="back_string">Back</string>
<string name="error_string">* Required</string>
<string name="none_string">-None-</string>
<string name="yes_string">Yes</string>
<string name="no_string">No</string>
<string name="ok_string">Ok</string>
<string name="search_for_reference_string">Reference</string>
<string name="home_screen_string">Home Screen</string>
<string name="login_screen_string">Login Screen</string>
<!--Home Screen Option-->
<!--Start-->
<string name="home_screen_report_incident_title">Report Incident</string>
<string name="home_screen_report_incident_icon">ic_myincident_icon</string>
<string name="loading_string">Loading&#8230;</string>
<string name="select_date_string">Select Date</string>
<string name="select_date_and_time_string">Select Date &#038; Time</string>
<string name="home_screen_order_services_title">Order Services</string>
<string name="home_screen_order_services_icon">ic_order_service_icon</string>
<string name="name_null_view_string">Not rendering (name not available)</string>
<string name="view_not_implemented_string">Not Implemented: %s</string>
<string name="home_screen_my_incidents_title">My Incidents</string>
<string name="home_screen_my_incidents_icon">ic_my_incidents_icon</string>
<string name="approved">Approved</string>
<string name="notrequest">Not Yet Requested</string>
<string name="requested">Requested</string>
<string name="rejected">Rejected</string>
<string name="date_string">%1$s %2$s, %3$s</string>
<string name="date_and_time_string">%1$s:%2$s</string>
<!--Failed to fetch-->
<string name="failed_to_fetch_catalogue_category_string">Failed to fetch Catalogue Category.</string>
<string name="failed_to_fetch_my_request_string">Failed to fetch requests</string>
<string name="failed_to_fetch_catalogue_category_items_string">Failed to fetch Catalogue Category Items.</string>
<string name="failed_to_fetch_catalogue_form_string">Failed to fetch Form.</string>
<string name="failed_to_fetch_reference_string">Failed to fetch References.</string>
<string name="failed_to_submit_form_string">Failed to submit form.</string>
<string name="failed_to_fetch_incident_string">Failed to fetch incidents.</string>
<string name="failed_to_fetch_user_detail_string">Failed to fetch User Details.</string>
<!--Login Screen-->
<string name="prompt_relogin_login_expired">Login expired, please login again&#8230;</string>
<string name="login_screen_login_string">Login</string>
<string name="login_screen_logging_in_loading_string">Logging in&#8230;</string>
<string name="login_screen_getting_user_detail_loading_string">Getting user details&#8230;</string>
<string name="login_screen_invalid_username_and_password_string">Invalid username and password</string>
<string name="user_detail_not_available">Unable to fetch user details.</string>
<string name="user_error">Please enter username</string>
<string name="pasw_error">Please enter password</string>
<string name="username_string">Username</string>
<string name="password_string">Password</string>
<!--Variable Screen-->
<string name="variable_form_misc_info_string">%1$s [add %2$.2f]</string>
<string name="variable_form_header_string">Submit Order</string>
<string name="variable_form_view_mandatory_sign_string">&lt;font color="#FF0000"&gt;*&lt;/font&gt;</string>
<string name="variable_form_reference_dialog_title_string">Search \'%s\'</string>
<string name="variable_form_radio_text_string">%d</string>
<string name="variable_form_ui_page_button_label_string">Add Attachment</string>
<string name="variable_form_ui_page_no_selected_attachment_string">Not Selected</string>
<string name="custom_setting_storage_permission_dialog_msg_string">To use this feature, please go to Settings -> Apps -> %s -> Permissions and enable \'Storage\' permission</string>
<string name="variable_form_back_navigation_string">Are you sure you want to navigate away?</string>
<string name="variable_form_order_successful_submission_string">Your Order has been submitted successfully</string>
<string name="variable_form_reference_no_result_string">No Result</string>
<string name="Variable_form_short_description_anchor_line_break_css"><![CDATA[
<style>
a {
word-break: break-all;
}
</style>
]]></string>
<!--Catalogue Item Screen-->
<string name="no_catalogue_item_string">No Catalogue Items&#8230;</string>
<!--Catalogue Screen-->
<string name="catalogue_category_string">Order Services</string>
<string name="my_reques_string">My Requests</string>
<!--Incident screen-->
<string name="incident_form_report_incident_text_string">Report Incident</string>
<string name="incident_form_top_text_string">Create an Incident record to report and request assistance with an issue you are having\n\nRequest assistance with an issue you are having. An incident record will be created and managed through to successful resolution. You will also be notified of progress.</string>
<string name="incident_form_impact_text_string">Impact &lt;font color="#FF0000"&gt;*&lt;/font&gt;</string>
<string name="incident_form_describe_your_issue_text_string">Please Describe Your Issue below &lt;font color="#FF0000"&gt;*&lt;/font&gt;(Max %d)</string>
<string name="incident_item_text_string"><![CDATA[<b>Number: </b>%1$s<br><br><b>Opened: </b>%2$s<br><br><b>Short Description: </b>%3$s]]></string>
<string name="incident_form_short_description_limit_error_text_string">Max limit exceeded by %d</string>
<!--My Incidents-->
<string name="my_incidents_text_string">My Incidents</string>
<string name="my_incidents_item_text_string"><![CDATA[<b>Number: </b>%1$s<br><br><b>Item: </b>%2$s<br><br><b>Updated: </b>%3$s<br><br><b>Request: </b>%4$s<br><br><b>Opened by: </b>%5$s<br><br><b>Stage: </b>%6$s]]></string>
<string name="connection_alert_dialog_title">No Connection Available</string>
<string name="connection_alert_dialog_message">Please check your device settings to ensure you have a working internet connection.</string>
<string name="cancel">Cancel</string>
<string name="settings">Settings</string>
<!--Catalogue Variable form screen - key for pre fill value-->
<string name="catalogue_user_full_name">full_name</string>
<string name="catalogue_user_id">user_id</string>
<string name="catalogue_user_email_id">email_address</string>
<!--Home Screen-->
<string name="home_screen_logout_confirmation_msg_string">Are you sure you want to logout?</string>
<string name="home_screen_my_request_title">My Requests</string>
<string name="home_screen_my_request_icon">ic_my_requiest_icon</string>
<!--End-->
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="windowNoTitle">true</item>
<item name="actionOverflowMenuStyle">@style/OverflowMenu</item>
<style name="HomeBackgroundStyle" parent="@style/Theme.AppCompat">
<item name="android:background">@color/home_screen_bg_color</item>
</style>
<style name="OverflowMenu" parent="Widget.AppCompat.PopupMenu.Overflow">
<!-- Required for pre-Lollipop. -->
<item name="overlapAnchor">false</item>
<!-- Required for Lollipop. -->
<item name="android:overlapAnchor">false</item>
</style>
<style name="WhiteBackgroundStyle" parent="@style/Theme.AppCompat">
<item name="android:background">@android:color/white</item>
</style>
<style name="LightBackgroundStyle" parent="@style/Theme.AppCompat">
<item name="android:background">@color/screen_bg_color</item>
</style>
<style name="DatePickerCustomDialog" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@android:color/white</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowNoTitle">true</item>
<item name="editTextStyle">@android:style/Widget.EditText</item>
</style>
<style name="CustomDialog">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment