Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CS123-CanteeneoAndroid
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Willard Torres
CS123-CanteeneoAndroid
Commits
afd1dddb
Commit
afd1dddb
authored
Nov 24, 2016
by
lumisce
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add data to DishView
parent
fff5654f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
22 deletions
+59
-22
DishAdapter.java
app/src/main/java/com/testapp/DishAdapter.java
+1
-1
DishViewActivity.java
app/src/main/java/com/testapp/DishViewActivity.java
+23
-2
NavDrawerActivity.java
app/src/main/java/com/testapp/NavDrawerActivity.java
+21
-15
Dish.java
app/src/main/java/com/testapp/entities/Dish.java
+11
-1
content_dish_view.xml
app/src/main/res/layout/content_dish_view.xml
+3
-3
No files found.
app/src/main/java/com/testapp/DishAdapter.java
View file @
afd1dddb
...
...
@@ -25,7 +25,7 @@ public class DishAdapter extends BaseAdapter {
}
@Override
public
Object
getItem
(
int
position
)
{
public
Dish
getItem
(
int
position
)
{
return
dishes
.
get
(
position
);
}
...
...
app/src/main/java/com/testapp/DishViewActivity.java
View file @
afd1dddb
...
...
@@ -5,10 +5,13 @@ import android.os.Bundle;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.widget.Toolbar
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.widget.TextView
;
public
class
DishViewActivity
extends
AppCompatActivity
{
private
TextView
dishStall
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -20,14 +23,32 @@ public class DishViewActivity extends AppCompatActivity {
getSupportActionBar
().
setDisplayShowHomeEnabled
(
true
);
setTitle
(
"Dish Pls"
);
Intent
i
=
getIntent
();
TextView
dishStall
=
(
TextView
)
findViewById
(
R
.
id
.
dish_stall
);
TextView
dishName
=
(
TextView
)
findViewById
(
R
.
id
.
dish_name
);
dishName
.
setText
(
i
.
getStringExtra
(
"NAME"
));
TextView
dishPrice
=
(
TextView
)
findViewById
(
R
.
id
.
dish_price
);
dishPrice
.
setText
(
i
.
getStringExtra
(
"PRICE"
));
TextView
dishDesc
=
(
TextView
)
findViewById
(
R
.
id
.
dish_desc
);
dishDesc
.
setText
(
i
.
getStringExtra
(
"DESCRIPTION"
));
TextView
dishLocation
=
(
TextView
)
findViewById
(
R
.
id
.
dish_location
);
// TODO setDishLocation
dishStall
=
(
TextView
)
findViewById
(
R
.
id
.
dish_stall
);
dishStall
.
setText
(
i
.
getStringExtra
(
"STALLNAME"
));
if
(
dishStall
!=
null
)
{
dishStall
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
visitStall
();
}
});
}
}
public
void
visitStall
()
{
Intent
intent
=
new
Intent
(
this
,
StallViewActivity
.
class
);
intent
.
putExtra
(
"NAME"
,
dishStall
.
getText
());
startActivity
(
intent
);
}
...
...
app/src/main/java/com/testapp/NavDrawerActivity.java
View file @
afd1dddb
...
...
@@ -16,6 +16,7 @@ import android.support.v7.app.AppCompatActivity;
import
android.support.v7.widget.Toolbar
;
import
android.view.Menu
;
import
android.view.MenuItem
;
import
android.widget.AdapterView
;
import
android.widget.CheckBox
;
import
android.widget.LinearLayout
;
import
android.widget.ListView
;
...
...
@@ -106,6 +107,25 @@ public class NavDrawerActivity extends AppCompatActivity implements NavigationVi
populateFilter
(
service
.
getDishTypes
(),
R
.
id
.
type_checkboxes
);
populateFilter
(
service
.
getCuisines
(),
R
.
id
.
cuisine_checkboxes
);
populateFilter
(
service
.
getLocations
(),
R
.
id
.
location_checkboxes
);
ListView
lv
=
(
ListView
)
findViewById
(
R
.
id
.
listView
);
adapter
=
new
DishAdapter
(
this
,
dishes
);
lv
.
setAdapter
(
adapter
);
lv
.
setOnItemClickListener
(
new
AdapterView
.
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
AdapterView
<?>
parent
,
View
view
,
int
position
,
long
id
)
{
Intent
i
=
new
Intent
(
NavDrawerActivity
.
this
,
DishViewActivity
.
class
);
Dish
d
=
dishes
.
get
(
position
);
i
.
putExtra
(
"ID"
,
d
.
getId
());
i
.
putExtra
(
"NAME"
,
d
.
getName
());
i
.
putExtra
(
"PRICE"
,
d
.
getPrice
());
i
.
putExtra
(
"IMAGE"
,
d
.
getImagePath
());
i
.
putExtra
(
"DESCRIPTION"
,
d
.
getDescription
());
// TODO i.putExtra("LOCATION", getStall(stallname).getLocation)?????????????
i
.
putExtra
(
"STALLNAME"
,
d
.
getStallName
());
startActivity
(
i
);
}
});
}
public
<
T
extends
Filter
>
void
populateFilter
(
Call
<
List
<
T
>>
call
,
int
layout_id
)
{
...
...
@@ -134,18 +154,6 @@ public class NavDrawerActivity extends AppCompatActivity implements NavigationVi
}
public
void
goToSearchPage
(
String
query
)
{
String
dishName
=
query
;
ListView
lv
=
(
ListView
)
findViewById
(
R
.
id
.
listView
);
adapter
=
new
DishAdapter
(
this
,
dishes
);
lv
.
setAdapter
(
adapter
);
searchDish
(
dishName
);
}
@Override
public
void
onBackPressed
()
{
DrawerLayout
drawer
=
(
DrawerLayout
)
findViewById
(
R
.
id
.
drawer_layout
);
...
...
@@ -168,9 +176,7 @@ public class NavDrawerActivity extends AppCompatActivity implements NavigationVi
@Override
public
boolean
onQueryTextSubmit
(
String
query
)
{
goToSearchPage
(
query
);
searchDish
(
query
);
return
false
;
}
...
...
app/src/main/java/com/testapp/entities/Dish.java
View file @
afd1dddb
...
...
@@ -7,6 +7,7 @@ public class Dish {
int
id
;
String
name
;
double
price
;
String
description
;
@SerializedName
(
"image_path"
)
String
imagePath
;
...
...
@@ -14,11 +15,12 @@ public class Dish {
@SerializedName
(
"stall_name"
)
String
stallName
;
public
Dish
(
int
id
,
String
name
,
double
price
,
String
stallName
)
{
public
Dish
(
int
id
,
String
name
,
double
price
,
String
stallName
,
String
description
)
{
this
.
id
=
id
;
this
.
name
=
name
;
this
.
price
=
price
;
this
.
stallName
=
stallName
;
this
.
description
=
description
;
}
public
int
getId
()
{
...
...
@@ -60,4 +62,12 @@ public class Dish {
public
void
setStallName
(
String
stallName
)
{
this
.
stallName
=
stallName
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
}
app/src/main/res/layout/content_dish_view.xml
View file @
afd1dddb
...
...
@@ -47,7 +47,7 @@
android:text=
"Name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:id=
"@+id/
textView5
"
android:id=
"@+id/
dish_name
"
android:layout_weight=
"2"
android:textSize=
"18sp"
/>
...
...
@@ -55,7 +55,7 @@
android:text=
"Price"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:id=
"@+id/
textView6
"
android:id=
"@+id/
dish_price
"
android:layout_weight=
"1"
android:paddingTop=
"5dp"
/>
...
...
@@ -73,7 +73,7 @@
android:text=
"Location"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:id=
"@+id/
textView8
"
android:id=
"@+id/
dish_location
"
android:paddingTop=
"5dp"
android:layout_weight=
"1"
/>
...
...
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