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
39d51751
authored
Aug 30, 2016
by
Kunj Gupta
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
UOFLMA-38: My Incidents page is created.
parent
bb880d70
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
377 additions
and
4 deletions
app/src/main/AndroidManifest.xml
app/src/main/java/com/vsoft/uofl_catalogue/adapters/MyIncidentsAdapter.java
app/src/main/java/com/vsoft/uofl_catalogue/db/models/Incident.java
app/src/main/java/com/vsoft/uofl_catalogue/enums/Impact.java
app/src/main/java/com/vsoft/uofl_catalogue/ui/HomeScreen.java
app/src/main/java/com/vsoft/uofl_catalogue/ui/MyIncidentScreen.java
app/src/main/res/layout/catalogue_item_screen.xml
app/src/main/res/layout/catalogue_screen.xml
app/src/main/res/layout/my_incident_adapter.xml
app/src/main/res/layout/my_incidents_screen.xml
app/src/main/res/values/colors.xml
app/src/main/res/values/dimen.xml
app/src/main/res/values/strings.xml
app/src/main/AndroidManifest.xml
View file @
39d51751
...
@@ -75,6 +75,8 @@
...
@@ -75,6 +75,8 @@
android:name=
".ui.ReportIncidentScreen"
android:name=
".ui.ReportIncidentScreen"
android:screenOrientation=
"portrait"
android:screenOrientation=
"portrait"
android:windowSoftInputMode=
"stateHidden|adjustResize"
/>
android:windowSoftInputMode=
"stateHidden|adjustResize"
/>
<activity
android:name=
".ui.MyIncidentScreen"
android:screenOrientation=
"portrait"
/>
</application>
</application>
</manifest>
</manifest>
app/src/main/java/com/vsoft/uofl_catalogue/adapters/MyIncidentsAdapter.java
0 → 100644
View file @
39d51751
package
com
.
vsoft
.
uofl_catalogue
.
adapters
;
import
android.content.Context
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.BaseAdapter
;
import
android.widget.TextView
;
import
com.vsoft.uofl_catalogue.R
;
import
com.vsoft.uofl_catalogue.db.models.Incident
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Created by kunj on 11/8/16.
*/
public
class
MyIncidentsAdapter
extends
BaseAdapter
{
private
Context
mContext
;
private
final
List
<
Incident
>
mIncidentList
=
new
ArrayList
<>(
0
);
private
LayoutInflater
mInflater
;
public
MyIncidentsAdapter
(
Context
context
)
{
mContext
=
context
;
mInflater
=
(
LayoutInflater
)
mContext
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
}
public
void
setIncidentList
(
List
<
Incident
>
incidentList
)
{
mIncidentList
.
clear
();
if
(
incidentList
!=
null
)
mIncidentList
.
addAll
(
incidentList
);
notifyDataSetChanged
();
}
@Override
public
int
getCount
()
{
// TODO Auto-generated method stub
return
mIncidentList
.
size
();
}
@Override
public
Incident
getItem
(
int
position
)
{
// TODO Auto-generated method stub
return
mIncidentList
.
get
(
position
);
}
@Override
public
long
getItemId
(
int
position
)
{
// TODO Auto-generated method stub
return
position
;
}
@Override
public
View
getView
(
int
position
,
View
convertView
,
ViewGroup
parent
)
{
// TODO Auto-generated method stub
ViewHolder
holder
;
if
(
convertView
==
null
)
{
convertView
=
mInflater
.
inflate
(
R
.
layout
.
my_incident_adapter
,
parent
,
false
);
holder
=
new
ViewHolder
();
holder
.
numberTextView
=
(
TextView
)
convertView
.
findViewById
(
R
.
id
.
my_incident_adapter_number_tv
);
holder
.
shortDesTextView
=
(
TextView
)
convertView
.
findViewById
(
R
.
id
.
my_incident_adapter_short_des_tv
);
holder
.
dateTextView
=
(
TextView
)
convertView
.
findViewById
(
R
.
id
.
my_incident_adapter_date_tv
);
convertView
.
setTag
(
holder
);
}
else
{
holder
=
(
ViewHolder
)
convertView
.
getTag
();
}
Incident
incident
=
mIncidentList
.
get
(
position
);
holder
.
numberTextView
.
setText
(
incident
.
getNumber
());
holder
.
dateTextView
.
setText
(
incident
.
getOpenedAt
());
holder
.
shortDesTextView
.
setText
(
incident
.
getShortDescription
());
return
convertView
;
}
static
class
ViewHolder
{
private
TextView
numberTextView
;
private
TextView
shortDesTextView
;
private
TextView
dateTextView
;
}
}
\ No newline at end of file
app/src/main/java/com/vsoft/uofl_catalogue/db/models/Incident.java
0 → 100644
View file @
39d51751
package
com
.
vsoft
.
uofl_catalogue
.
db
.
models
;
import
com.google.gson.annotations.Expose
;
import
com.google.gson.annotations.SerializedName
;
import
com.vsoft.uofl_catalogue.enums.Impact
;
/**
* Created by Kunj on 11/8/16.
*/
public
class
Incident
{
@SerializedName
(
"number"
)
@Expose
private
String
number
;
@SerializedName
(
"short_description"
)
@Expose
private
String
shortDescription
;
@SerializedName
(
"opened_at"
)
// @Expose
private
String
openedAt
;
@SerializedName
(
"impact"
)
// @Expose
private
Impact
impact
;
public
Impact
getImpact
()
{
return
impact
;
}
public
void
setImpact
(
Impact
impact
)
{
this
.
impact
=
impact
;
}
public
String
getOpenedAt
()
{
return
openedAt
;
}
public
void
setOpenedAt
(
String
openedAt
)
{
this
.
openedAt
=
openedAt
;
}
public
String
getShortDescription
()
{
return
shortDescription
;
}
public
void
setShortDescription
(
String
shortDescription
)
{
this
.
shortDescription
=
shortDescription
;
}
public
String
getNumber
()
{
return
number
;
}
public
void
setNumber
(
String
number
)
{
this
.
number
=
number
;
}
public
static
final
class
IncidentBuilder
{
private
String
number
;
private
String
shortDescription
;
private
String
openedAt
;
private
Impact
impact
;
private
IncidentBuilder
()
{
}
public
static
IncidentBuilder
anIncident
()
{
return
new
IncidentBuilder
();
}
public
IncidentBuilder
setNumber
(
String
number
)
{
this
.
number
=
number
;
return
this
;
}
public
IncidentBuilder
setShortDescription
(
String
shortDescription
)
{
this
.
shortDescription
=
shortDescription
;
return
this
;
}
public
IncidentBuilder
setOpenedAt
(
String
openedAt
)
{
this
.
openedAt
=
openedAt
;
return
this
;
}
public
IncidentBuilder
setImpact
(
Impact
impact
)
{
this
.
impact
=
impact
;
return
this
;
}
public
IncidentBuilder
but
()
{
return
anIncident
().
setNumber
(
number
).
setShortDescription
(
shortDescription
).
setOpenedAt
(
openedAt
).
setImpact
(
impact
);
}
public
Incident
build
()
{
Incident
incident
=
new
Incident
();
incident
.
setNumber
(
number
);
incident
.
setShortDescription
(
shortDescription
);
incident
.
setOpenedAt
(
openedAt
);
incident
.
setImpact
(
impact
);
return
incident
;
}
}
@Override
public
String
toString
()
{
return
"Incident{"
+
"number='"
+
number
+
'\''
+
", shortDescription='"
+
shortDescription
+
'\''
+
", openedAt='"
+
openedAt
+
'\''
+
", impact="
+
impact
+
'}'
;
}
}
app/src/main/java/com/vsoft/uofl_catalogue/enums/Impact.java
0 → 100644
View file @
39d51751
package
com
.
vsoft
.
uofl_catalogue
.
enums
;
/**
* @since 1.0
* @author Kunj on 30/8/16.
*
*/
public
enum
Impact
{
HIGH
(
1
),
MEDIUM
(
2
),
LOW
(
3
);
int
id
;
Impact
(
int
id
)
{
this
.
id
=
id
;
}
public
static
int
getSyncStatus
(
Impact
status
)
{
return
status
.
id
;
}
public
int
getId
()
{
return
this
.
id
;
}
}
app/src/main/java/com/vsoft/uofl_catalogue/ui/HomeScreen.java
View file @
39d51751
...
@@ -33,6 +33,8 @@ public class HomeScreen extends Activity {
...
@@ -33,6 +33,8 @@ public class HomeScreen extends Activity {
startActivity
(
new
Intent
(
HomeScreen
.
this
,
ReportIncidentScreen
.
class
));
startActivity
(
new
Intent
(
HomeScreen
.
this
,
ReportIncidentScreen
.
class
));
}
else
if
(
position
==
1
)
{
}
else
if
(
position
==
1
)
{
startActivity
(
new
Intent
(
HomeScreen
.
this
,
CatalogueScreen
.
class
));
startActivity
(
new
Intent
(
HomeScreen
.
this
,
CatalogueScreen
.
class
));
}
else
if
(
position
==
2
)
{
startActivity
(
new
Intent
(
HomeScreen
.
this
,
MyIncidentScreen
.
class
));
}
}
}
}
}
}
app/src/main/java/com/vsoft/uofl_catalogue/ui/MyIncidentScreen.java
0 → 100644
View file @
39d51751
package
com
.
vsoft
.
uofl_catalogue
.
ui
;
import
android.os.Bundle
;
import
android.support.v7.app.ActionBar
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.widget.Toolbar
;
import
android.view.MenuItem
;
import
android.widget.ListView
;
import
com.vsoft.uofl_catalogue.CatalogueApplication
;
import
com.vsoft.uofl_catalogue.R
;
import
com.vsoft.uofl_catalogue.adapters.MyIncidentsAdapter
;
import
com.vsoft.uofl_catalogue.db.models.Incident
;
import
java.util.ArrayList
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
/**
* Created by kunj on 30/8/16.
*/
public
class
MyIncidentScreen
extends
AppCompatActivity
{
@BindView
(
R
.
id
.
tool_bar_view
)
Toolbar
mToolbar
;
@BindView
(
R
.
id
.
my_incidents_screen_list_view
)
ListView
mIncidentListView
;
private
CatalogueApplication
mApplication
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
// TODO Auto-generated method stub
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
my_incidents_screen
);
ButterKnife
.
bind
(
this
);
mApplication
=
(
CatalogueApplication
)
getApplication
();
setSupportActionBar
(
mToolbar
);
ActionBar
actionBar
=
getSupportActionBar
();
if
(
actionBar
!=
null
)
{
actionBar
.
setDisplayHomeAsUpEnabled
(
true
);
actionBar
.
setElevation
(
0
);
actionBar
.
setTitle
(
R
.
string
.
my_incidents_text_string
);
actionBar
.
setDisplayShowHomeEnabled
(
false
);
actionBar
.
setDisplayShowTitleEnabled
(
true
);
}
MyIncidentsAdapter
adapter
=
new
MyIncidentsAdapter
(
MyIncidentScreen
.
this
);
List
<
Incident
>
incidentList
=
new
ArrayList
<>(
5
);
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
Incident
incident
=
new
Incident
();
incident
.
setNumber
(
"INC000010"
);
incident
.
setShortDescription
(
"short description"
);
incident
.
setOpenedAt
(
"23 Aug 2016, 15.30PM"
);
incidentList
.
add
(
incident
);
}
adapter
.
setIncidentList
(
incidentList
);
mIncidentListView
.
setAdapter
(
adapter
);
}
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
menuItem
)
{
if
(
menuItem
.
getItemId
()
==
android
.
R
.
id
.
home
)
{
finish
();
}
return
super
.
onOptionsItemSelected
(
menuItem
);
}
}
app/src/main/res/layout/catalogue_item_screen.xml
View file @
39d51751
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
android:layout_margin=
"@dimen/normal_margin"
android:layout_margin=
"@dimen/normal_margin"
android:background=
"@android:color/white"
android:background=
"@android:color/white"
android:divider=
"@android:color/white"
android:divider=
"@android:color/white"
android:dividerHeight=
"@dimen/list_view_divider_height"
android:dividerHeight=
"@dimen/
catalogue_category_and_item_
list_view_divider_height"
android:padding=
"@dimen/normal_margin"
android:padding=
"@dimen/normal_margin"
android:scrollbars=
"none"
android:scrollbars=
"none"
android:visibility=
"gone"
/>
android:visibility=
"gone"
/>
...
...
app/src/main/res/layout/catalogue_screen.xml
View file @
39d51751
...
@@ -30,6 +30,6 @@
...
@@ -30,6 +30,6 @@
android:layout_margin=
"@dimen/normal_margin"
android:layout_margin=
"@dimen/normal_margin"
android:padding=
"@dimen/normal_margin"
android:padding=
"@dimen/normal_margin"
android:divider=
"@android:color/white"
android:divider=
"@android:color/white"
android:dividerHeight=
"@dimen/list_view_divider_height"
android:dividerHeight=
"@dimen/
catalogue_category_and_item_
list_view_divider_height"
android:scrollbars=
"none"
/>
android:scrollbars=
"none"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/my_incident_adapter.xml
0 → 100644
View file @
39d51751
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:padding=
"@dimen/small_margin"
>
<TextView
android:id=
"@+id/my_incident_adapter_number_tv"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textSize=
"@dimen/extra_normal_text_size"
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/my_incident_adapter_date_tv"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentRight=
"true"
android:textSize=
"@dimen/normal_text_size"
/>
<TextView
android:id=
"@+id/my_incident_adapter_short_des_tv"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/my_incident_adapter_number_tv"
android:layout_marginTop=
"@dimen/small_margin"
android:textSize=
"@dimen/normal_text_size"
android:lines=
"3"
android:ellipsize=
"end"
/>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/layout/my_incidents_screen.xml
0 → 100644
View file @
39d51751
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/screen_bg_color"
>
<android.support.v7.widget.Toolbar
android:id=
"@+id/tool_bar_view"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_margin=
"0dp"
android:background=
"@android:color/white"
android:minHeight=
"?attr/actionBarSize"
android:padding=
"0dp"
android:contentInsetEnd=
"0dp"
android:contentInsetRight=
"0dp"
android:contentInsetStart=
"0dp"
app:contentInsetEnd=
"0dp"
app:contentInsetLeft=
"0dp"
app:contentInsetRight=
"0dp"
app:contentInsetStart=
"0dp"
/>
<ListView
android:id=
"@+id/my_incidents_screen_list_view"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@android:color/white"
android:layout_margin=
"@dimen/normal_margin"
android:padding=
"@dimen/normal_margin"
android:divider=
"@color/divider_color"
android:dividerHeight=
"@dimen/list_view_divider_height"
android:scrollbars=
"none"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/values/colors.xml
View file @
39d51751
...
@@ -17,4 +17,5 @@
...
@@ -17,4 +17,5 @@
<color
name=
"back_button_bg_color"
>
#4f0307
</color>
<color
name=
"back_button_bg_color"
>
#4f0307
</color>
<color
name=
"submit_button_bg_color"
>
#e31b22
</color>
<color
name=
"submit_button_bg_color"
>
#e31b22
</color>
<color
name=
"divider_color"
>
#c9c8cc
</color>
</resources>
</resources>
app/src/main/res/values/dimen.xml
View file @
39d51751
...
@@ -11,7 +11,8 @@
...
@@ -11,7 +11,8 @@
<dimen
name=
"extra_normal_text_size"
>
24sp
</dimen>
<dimen
name=
"extra_normal_text_size"
>
24sp
</dimen>
<dimen
name=
"large_text_size"
>
20sp
</dimen>
<dimen
name=
"large_text_size"
>
20sp
</dimen>
<dimen
name=
"list_view_divider_height"
>
5dp
</dimen>
<dimen
name=
"catalogue_category_and_item_list_view_divider_height"
>
5dp
</dimen>
<dimen
name=
"list_view_divider_height"
>
1dp
</dimen>
<!--Home Screen-->
<!--Home Screen-->
<dimen
name=
"home_screen_item_height"
>
120dp
</dimen>
<dimen
name=
"home_screen_item_height"
>
120dp
</dimen>
...
...
app/src/main/res/values/strings.xml
View file @
39d51751
...
@@ -47,4 +47,6 @@
...
@@ -47,4 +47,6 @@
<string
name=
"incident_form_impact_text_string"
>
Impact
</string>
<string
name=
"incident_form_impact_text_string"
>
Impact
</string>
<string
name=
"incident_form_describe_your_issue_text_string"
>
Please Describe Your Issue below
</string>
<string
name=
"incident_form_describe_your_issue_text_string"
>
Please Describe Your Issue below
</string>
<!--My Incidents-->
<string
name=
"my_incidents_text_string"
>
My Incidents
</string>
</resources>
</resources>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment