Commit 297f5366 authored by Willard's avatar Willard

Minor refactoring, remove getAllData temporarily

parent a168d5e4
......@@ -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) {
......
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);
}
......@@ -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;
......
......@@ -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);
......
......@@ -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 = "";
......
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:
......
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 to comment