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
0161f043
authored
Aug 29, 2016
by
Kunj Gupta
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
UOFLMA-26: Catalog items page is created.
parent
04189a83
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
136 additions
and
41 deletions
app/src/main/java/com/vsoft/uofl_catalogue/adapters/CatalogueCategoryAdapter.java
app/src/main/java/com/vsoft/uofl_catalogue/adapters/CatalogueCategoryItemAdapter.java
app/src/main/java/com/vsoft/uofl_catalogue/ui/CatalogueItemScreen.java
app/src/main/java/com/vsoft/uofl_catalogue/ui/CatalogueScreen.java
app/src/main/java/com/vsoft/uofl_catalogue/utils/Constants.java
app/src/main/res/layout/catalogue_category_item_adapter.xml
app/src/main/res/layout/catalogue_item_screen.xml
app/src/main/java/com/vsoft/uofl_catalogue/adapters/CatalogueCategoryAdapter.java
View file @
0161f043
...
...
@@ -71,7 +71,14 @@ public class CatalogueCategoryAdapter extends BaseAdapter {
Catalogue
catalogue
=
mCatalogueList
.
get
(
position
);
holder
.
titleTextView
.
setText
(
catalogue
.
getTitle
());
if
(!
catalogue
.
getDescription
().
isEmpty
())
{
holder
.
desTextView
.
setVisibility
(
View
.
VISIBLE
);
holder
.
desTextView
.
setText
(
catalogue
.
getDescription
());
}
else
{
holder
.
desTextView
.
setVisibility
(
View
.
GONE
);
holder
.
desTextView
.
setText
(
catalogue
.
getDescription
());
}
return
convertView
;
}
...
...
app/src/main/java/com/vsoft/uofl_catalogue/adapters/CatalogueCategoryItemAdapter.java
View file @
0161f043
...
...
@@ -28,10 +28,10 @@ public class CatalogueCategoryItemAdapter extends BaseAdapter {
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
}
public
void
setCatalogue
List
(
List
<
CatalogueItem
>
catalogue
List
)
{
public
void
setCatalogue
ItemList
(
List
<
CatalogueItem
>
catalogueItem
List
)
{
mCatalogueItemList
.
clear
();
if
(
catalogueList
!=
null
)
mCatalogueItemList
.
addAll
(
catalogueList
);
if
(
catalogue
Item
List
!=
null
)
mCatalogueItemList
.
addAll
(
catalogue
Item
List
);
notifyDataSetChanged
();
}
...
...
@@ -71,7 +71,13 @@ public class CatalogueCategoryItemAdapter extends BaseAdapter {
CatalogueItem
catalogueItem
=
mCatalogueItemList
.
get
(
position
);
holder
.
nameTextView
.
setText
(
catalogueItem
.
getName
());
if
(!
catalogueItem
.
getShortDescription
().
isEmpty
())
{
holder
.
desTextView
.
setVisibility
(
View
.
VISIBLE
);
holder
.
desTextView
.
setText
(
catalogueItem
.
getShortDescription
());
}
else
{
holder
.
desTextView
.
setVisibility
(
View
.
GONE
);
holder
.
desTextView
.
setText
(
catalogueItem
.
getShortDescription
());
}
return
convertView
;
}
...
...
app/src/main/java/com/vsoft/uofl_catalogue/ui/CatalogueItemScreen.java
View file @
0161f043
package
com
.
vsoft
.
uofl_catalogue
.
ui
;
import
android.app.Activity
;
import
android.app.ProgressDialog
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.support.v7.app.ActionBar
;
import
android.support.v7.app.AlertDialog
;
import
android.view.Gravity
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.widget.Toolbar
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.widget.AdapterView
;
import
android.widget.ListView
;
...
...
@@ -25,12 +27,19 @@ import com.vsoft.uofl_catalogue.utils.Constants;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
/**
* Created by Kunj on 11/8/16.
*/
public
class
CatalogueItemScreen
extends
Activity
{
public
class
CatalogueItemScreen
extends
AppCompatActivity
{
@BindView
(
R
.
id
.
tool_bar_view
)
Toolbar
mToolbar
;
@BindView
(
R
.
id
.
catalogue_item_screen_list_view
)
ListView
mListView
;
@BindView
(
R
.
id
.
catalogue_item_screen_empty_text_view
)
TextView
mEmptyTextView
;
private
String
mCatalogueSysId
;
private
String
mCatalogueSysId
,
mCatalogueTitle
;
private
List
<
CatalogueItem
>
mCatalogueItemList
;
private
CatalogueApplication
mApplication
;
...
...
@@ -39,12 +48,25 @@ public class CatalogueItemScreen extends Activity {
// TODO Auto-generated method stub
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
catalogue_item_screen
);
ButterKnife
.
bind
(
this
);
mApplication
=
(
CatalogueApplication
)
getApplication
();
mCatalogueSysId
=
getIntent
().
getExtras
().
getString
(
Constants
.
DATA_KEY_SYS_ID
);
mCatalogueTitle
=
getIntent
().
getExtras
().
getString
(
Constants
.
DATA_KEY_CATALOGUE_TITLE
);
Bundle
extras
=
getIntent
().
getExtras
();
if
(
extras
!=
null
)
{
mCatalogueSysId
=
extras
.
getString
(
Constants
.
DATA_KEY_SYS_ID
);
//The key argument here must match that used in the other activity
if
(
mCatalogueSysId
==
null
)
{
CatalogueLog
.
e
(
"CatalogueItemScreen: mCatalogueSysId is null"
);
}
setSupportActionBar
(
mToolbar
);
ActionBar
actionBar
=
getSupportActionBar
();
if
(
actionBar
!=
null
)
{
actionBar
.
setDisplayHomeAsUpEnabled
(
true
);
actionBar
.
setElevation
(
0
);
actionBar
.
setTitle
(
mCatalogueTitle
);
actionBar
.
setDisplayShowHomeEnabled
(
false
);
actionBar
.
setDisplayShowTitleEnabled
(
true
);
}
if
(
mApplication
.
isNetConnected
())
{
...
...
@@ -95,40 +117,43 @@ public class CatalogueItemScreen extends Activity {
progressDialog
.
dismiss
();
}
if
(
mCatalogueItemList
!=
null
)
{
createView
(
mCatalogueItemList
);
setData
(
);
}
}
}
private
void
createView
(
final
List
<
CatalogueItem
>
catalogueItemList
)
{
if
(!
catalogueItemList
.
isEmpty
())
{
ListView
listView
=
new
ListView
(
CatalogueItemScreen
.
this
);
private
void
setData
()
{
if
(!
mCatalogueItemList
.
isEmpty
())
{
mListView
.
setVisibility
(
View
.
VISIBLE
);
mEmptyTextView
.
setVisibility
(
View
.
GONE
);
CatalogueCategoryItemAdapter
adapter
=
new
CatalogueCategoryItemAdapter
(
CatalogueItemScreen
.
this
);
adapter
.
setCatalogue
List
(
c
atalogueItemList
);
l
istView
.
setAdapter
(
adapter
);
adapter
.
setCatalogue
ItemList
(
mC
atalogueItemList
);
mL
istView
.
setAdapter
(
adapter
);
setContentView
(
listView
);
listView
.
setOnItemClickListener
(
new
AdapterView
.
OnItemClickListener
()
{
mListView
.
setOnItemClickListener
(
new
AdapterView
.
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
AdapterView
<?>
parent
,
View
view
,
int
position
,
long
id
)
{
CatalogueLog
.
e
(
"OnItemClickListener: position: "
+
position
+
", Catalogue: "
+
c
atalogueItemList
.
get
(
position
));
CatalogueLog
.
e
(
"OnItemClickListener: position: "
+
position
+
", Catalogue: "
+
mC
atalogueItemList
.
get
(
position
));
Intent
intent
=
new
Intent
(
CatalogueItemScreen
.
this
,
CatalogueVariableScreen
.
class
);
intent
.
putExtra
(
Constants
.
DATA_KEY_SYS_ID
,
c
atalogueItemList
.
get
(
position
).
getSysId
());
intent
.
putExtra
(
Constants
.
DATA_KEY_CATALOGUE_ITEM_DESCRIPTION
,
c
atalogueItemList
.
get
(
position
).
getDescription
());
intent
.
putExtra
(
Constants
.
DATA_KEY_SYS_ID
,
mC
atalogueItemList
.
get
(
position
).
getSysId
());
intent
.
putExtra
(
Constants
.
DATA_KEY_CATALOGUE_ITEM_DESCRIPTION
,
mC
atalogueItemList
.
get
(
position
).
getDescription
());
startActivity
(
intent
);
}
});
}
else
{
/*There is no catalogue items*/
TextView
textView
=
new
TextView
(
CatalogueItemScreen
.
this
);
textView
.
setGravity
(
Gravity
.
CENTER
);
textView
.
setText
(
R
.
string
.
no_catalogue_item_string
);
setContentView
(
textView
);
mEmptyTextView
.
setVisibility
(
View
.
VISIBLE
);
mListView
.
setVisibility
(
View
.
GONE
);
}
}
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
menuItem
)
{
if
(
menuItem
.
getItemId
()
==
android
.
R
.
id
.
home
)
{
finish
();
}
return
super
.
onOptionsItemSelected
(
menuItem
);
}
}
app/src/main/java/com/vsoft/uofl_catalogue/ui/CatalogueScreen.java
View file @
0161f043
...
...
@@ -125,6 +125,7 @@ public class CatalogueScreen extends AppCompatActivity {
CatalogueLog
.
e
(
"OnItemClickListener: position: "
+
position
+
", Catalogue: "
+
catalogueList
.
get
(
position
));
Intent
intent
=
new
Intent
(
CatalogueScreen
.
this
,
CatalogueItemScreen
.
class
);
intent
.
putExtra
(
Constants
.
DATA_KEY_SYS_ID
,
catalogueList
.
get
(
position
).
getSysId
());
intent
.
putExtra
(
Constants
.
DATA_KEY_CATALOGUE_TITLE
,
catalogueList
.
get
(
position
).
getTitle
());
startActivity
(
intent
);
}
});
...
...
@@ -137,5 +138,4 @@ public class CatalogueScreen extends AppCompatActivity {
}
return
super
.
onOptionsItemSelected
(
menuItem
);
}
}
app/src/main/java/com/vsoft/uofl_catalogue/utils/Constants.java
View file @
0161f043
...
...
@@ -16,6 +16,7 @@ public class Constants {
*/
public
static
final
String
DATA_DATE_AND_TIME_PICKER_TITLE
=
"title"
;
public
static
final
String
DATA_KEY_SYS_ID
=
"sys_id"
;
public
static
final
String
DATA_KEY_CATALOGUE_TITLE
=
"catalogue_title"
;
public
static
final
String
DATA_KEY_CATALOGUE_ITEM_DESCRIPTION
=
"catalogue_item_des"
;
public
static
final
String
DATA_KEY_REFERENCE_TABLE_NAME
=
"table_name"
;
...
...
app/src/main/res/layout/catalogue_category_item_adapter.xml
View file @
0161f043
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/catalogue_item_content_layout"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:weightSum=
"10"
>
android:layout_height=
"@dimen/list_item_height"
android:weightSum=
"10"
android:paddingLeft=
"@dimen/small_margin"
android:paddingRight=
"@dimen/small_margin"
android:background=
"@drawable/background_with_border"
>
<ImageView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"3"
android:layout_gravity=
"center"
android:layout_weight=
"2.5"
android:src=
"@android:drawable/ic_dialog_dialer"
/>
android:src=
"@drawable/dummy_image"
/>
<LinearLayout
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"7
.5
"
android:layout_weight=
"7"
android:orientation=
"vertical"
android:padding=
"@dimen/small_margin"
>
android:layout_gravity=
"center"
android:paddingLeft=
"@dimen/small_margin"
>
<TextView
android:id=
"@+id/catalogue_category_item_adapter_name_tv"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:lines=
"1"
android:textSize=
"@dimen/normal_text_size"
/>
android:textSize=
"@dimen/normal_text_size"
android:textStyle=
"bold"
android:lines=
"1"
/>
<TextView
android:id=
"@+id/catalogue_category_item_adapter_des_tv"
...
...
@@ -33,7 +37,7 @@
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:lines=
"2"
android:
paddingTop=
"@dimen/small_margin
"
android:
textSize=
"@dimen/small_text_size
"
/>
android:
textSize=
"@dimen/small_text_size
"
android:
paddingTop=
"@dimen/small_margin
"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/catalogue_item_screen.xml
0 → 100644
View file @
0161f043
<?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"
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:layout_margin=
"0dp"
android:background=
"@android:color/white"
android:contentInsetEnd=
"0dp"
android:contentInsetRight=
"0dp"
android:contentInsetStart=
"0dp"
android:minHeight=
"?attr/actionBarSize"
android:padding=
"0dp"
app:contentInsetEnd=
"0dp"
app:contentInsetLeft=
"0dp"
app:contentInsetRight=
"0dp"
app:contentInsetStart=
"0dp"
/>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/screen_bg_color"
>
<ListView
android:id=
"@+id/catalogue_item_screen_list_view"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_margin=
"@dimen/normal_margin"
android:background=
"@android:color/white"
android:divider=
"@android:color/white"
android:dividerHeight=
"@dimen/list_view_divider_height"
android:padding=
"@dimen/normal_margin"
android:scrollbars=
"none"
android:visibility=
"gone"
/>
<TextView
android:id=
"@+id/catalogue_item_screen_empty_text_view"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@android:color/white"
android:gravity=
"center"
android:text=
"@string/no_catalogue_item_string"
android:textSize=
"@dimen/extra_normal_text_size"
/>
</FrameLayout>
</LinearLayout>
\ No newline at end of file
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