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
297f5366
Commit
297f5366
authored
Nov 23, 2016
by
Willard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor refactoring, remove getAllData temporarily
parent
a168d5e4
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
2 additions
and
81 deletions
+2
-81
AppUtils.java
app/src/main/java/com/testapp/AppUtils.java
+0
-3
CanteeneoApiInterface.java
app/src/main/java/com/testapp/CanteeneoApiInterface.java
+1
-23
DishAdapter.java
app/src/main/java/com/testapp/DishAdapter.java
+0
-7
NavDrawerActivity.java
app/src/main/java/com/testapp/NavDrawerActivity.java
+0
-21
SearchActivity.java
app/src/main/java/com/testapp/SearchActivity.java
+1
-23
StallViewActivity.java
app/src/main/java/com/testapp/StallViewActivity.java
+0
-4
No files found.
app/src/main/java/com/testapp/AppUtils.java
View file @
297f5366
...
...
@@ -4,9 +4,6 @@ import android.content.Context;
import
android.net.ConnectivityManager
;
import
android.net.NetworkInfo
;
/**
* Created by candy on 10/20/16.
*/
public
class
AppUtils
{
public
static
boolean
isNetworkAvailable
(
Context
c
)
{
...
...
app/src/main/java/com/testapp/CanteeneoApiInterface.java
View file @
297f5366
package
com
.
testapp
;
import
com.testapp.entities.CData
;
import
com.testapp.entities.Cuisine
;
import
com.testapp.entities.Dish
;
import
com.testapp.entities.DishType
;
import
com.testapp.entities.Location
;
import
java.util.ArrayList
;
import
java.util.List
;
import
okhttp3.ResponseBody
;
import
retrofit2.Call
;
import
retrofit2.http.GET
;
import
retrofit2.http.Path
;
import
retrofit2.http.Query
;
/**
* Created by candy on 10/19/16.
*/
public
interface
CanteeneoApiInterface
{
@GET
(
"api/all"
)
Call
<
CData
>
getAll
();
@GET
(
"api/allBy"
)
Call
<
CData
>
getAllBy
(
@Query
(
"date"
)
String
date
);
@GET
(
"api/search/dish"
)
Call
<
List
<
Dish
>>
searchByName
(
@Query
(
"name"
)
String
name
,
@Query
(
"type_filters"
)
String
types
,
...
...
@@ -43,12 +29,4 @@ public interface CanteeneoApiInterface {
@GET
(
"api/cuisines"
)
Call
<
List
<
Cuisine
>>
getCuisines
();
// @GET("static/uploads/{filename}")
// Call<ResponseBody> downloadImage(@Path("filename") String filename);
// // updating favorites and reviews later on
// @POST("upload")
// Call<ResponseBody> sendAll(@Body sth sth);
}
app/src/main/java/com/testapp/DishAdapter.java
View file @
297f5366
...
...
@@ -4,19 +4,12 @@ import android.app.Activity;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.BaseAdapter
;
import
android.widget.Button
;
import
android.widget.CheckBox
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.squareup.picasso.Picasso
;
import
com.testapp.entities.Dish
;
import
java.util.ArrayList
;
/**
* Created by candy on 10/20/16.
*/
public
class
DishAdapter
extends
BaseAdapter
{
private
Activity
context
;
ArrayList
<
Dish
>
dishes
;
...
...
app/src/main/java/com/testapp/NavDrawerActivity.java
View file @
297f5366
...
...
@@ -5,9 +5,7 @@ import android.content.Intent;
import
android.os.Bundle
;
import
android.support.design.widget.FloatingActionButton
;
import
android.support.design.widget.Snackbar
;
import
android.support.v4.view.MenuItemCompat
;
import
android.support.v7.widget.SearchView
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.support.design.widget.NavigationView
;
...
...
@@ -18,7 +16,6 @@ import android.support.v7.app.AppCompatActivity;
import
android.support.v7.widget.Toolbar
;
import
android.view.Menu
;
import
android.view.MenuItem
;
import
android.widget.ArrayAdapter
;
import
android.widget.CheckBox
;
import
android.widget.LinearLayout
;
import
android.widget.ListView
;
...
...
@@ -26,12 +23,10 @@ import android.widget.Toast;
import
com.google.gson.Gson
;
import
com.google.gson.GsonBuilder
;
import
com.testapp.entities.CData
;
import
com.testapp.entities.Cuisine
;
import
com.testapp.entities.Dish
;
import
com.testapp.entities.DishType
;
import
com.testapp.entities.Location
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
...
...
@@ -195,25 +190,9 @@ public class NavDrawerActivity extends AppCompatActivity
adapter
=
new
DishAdapter
(
this
,
dishes
);
lv
.
setAdapter
(
adapter
);
getAllData
();
searchDish
(
dishName
);
}
private
void
getAllData
()
{
Call
<
CData
>
call
=
service
.
getAll
();
call
.
enqueue
(
new
Callback
<
CData
>()
{
@Override
public
void
onResponse
(
Call
<
CData
>
call
,
Response
<
CData
>
response
)
{
int
statusCode
=
response
.
code
();
CData
cdata
=
response
.
body
();
}
@Override
public
void
onFailure
(
Call
<
CData
>
call
,
Throwable
throwable
)
{
}
});
}
@Override
public
void
onBackPressed
()
{
DrawerLayout
drawer
=
(
DrawerLayout
)
findViewById
(
R
.
id
.
drawer_layout
);
...
...
app/src/main/java/com/testapp/SearchActivity.java
View file @
297f5366
...
...
@@ -2,11 +2,8 @@ package com.testapp;
import
android.content.Context
;
import
android.os.Bundle
;
import
android.support.design.widget.FloatingActionButton
;
import
android.support.design.widget.Snackbar
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.widget.Toolbar
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.CheckBox
;
import
android.widget.LinearLayout
;
...
...
@@ -14,20 +11,17 @@ import android.widget.ListView;
import
com.google.gson.Gson
;
import
com.google.gson.GsonBuilder
;
import
com.testapp.entities.CData
;
import
com.testapp.entities.Dish
;
import
java.io.File
;
import
java.io.IOException
;
import
java.lang.reflect.Array
;
import
java.util.ArrayList
;
import
java.util.List
;
import
okhttp3.Cache
;
import
okhttp3.Interceptor
;
import
okhttp3.OkHttpClient
;
import
okhttp3.ResponseBody
;
import
okhttp3.internal.Util
;
import
retrofit2.Call
;
import
retrofit2.Callback
;
import
retrofit2.Response
;
...
...
@@ -80,25 +74,9 @@ public class SearchActivity extends AppCompatActivity {
service
=
retrofit
.
create
(
CanteeneoApiInterface
.
class
);
getAllData
();
searchDish
(
dishName
);
}
private
void
getAllData
()
{
Call
<
CData
>
call
=
service
.
getAll
();
call
.
enqueue
(
new
Callback
<
CData
>()
{
@Override
public
void
onResponse
(
Call
<
CData
>
call
,
Response
<
CData
>
response
)
{
int
statusCode
=
response
.
code
();
CData
cdata
=
response
.
body
();
}
@Override
public
void
onFailure
(
Call
<
CData
>
call
,
Throwable
throwable
)
{
}
});
}
private
String
getChecked
(
int
layoutId
)
{
LinearLayout
checkboxes
=
(
LinearLayout
)
findViewById
(
layoutId
);
String
checked
=
""
;
...
...
app/src/main/java/com/testapp/StallViewActivity.java
View file @
297f5366
package
com
.
testapp
;
import
android.os.Bundle
;
import
android.support.design.widget.FloatingActionButton
;
import
android.support.design.widget.Snackbar
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.widget.Toolbar
;
import
android.view.MenuItem
;
import
android.view.View
;
public
class
StallViewActivity
extends
AppCompatActivity
{
...
...
@@ -25,7 +22,6 @@ public class StallViewActivity extends AppCompatActivity {
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
switch
(
item
.
getItemId
())
{
case
android
.
R
.
id
.
home
:
// app icon in action bar clicked; goto parent activity.
this
.
finish
();
return
true
;
default
:
...
...
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