connected with db
0
foodinder_app/.gitignore
vendored
Normal file → Executable file
0
foodinder_app/.idea/codeStyles/Project.xml
Normal file → Executable file
0
foodinder_app/.idea/gradle.xml
Normal file → Executable file
0
foodinder_app/.idea/misc.xml
Normal file → Executable file
0
foodinder_app/.idea/runConfigurations.xml
Normal file → Executable file
0
foodinder_app/.idea/vcs.xml
Normal file → Executable file
0
foodinder_app/app/.gitignore
vendored
Normal file → Executable file
5
foodinder_app/app/build.gradle
Normal file → Executable file
@ -31,9 +31,8 @@ dependencies {
|
||||
implementation 'com.android.support:cardview-v7:25.0.0'
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||
implementation 'com.google.api-client:google-api-client:1.30.6'
|
||||
implementation 'com.google.oauth-client:google-oauth-client-jetty:1.30.4'
|
||||
implementation 'com.google.apis:google-api-services-sheets:v4-rev9-1.22.0'
|
||||
implementation 'com.android.volley:volley:1.1.1'
|
||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||
}
|
||||
allprojects {
|
||||
repositories {
|
||||
|
0
foodinder_app/app/libs/android-card-stack-0.1.5.aar
Normal file → Executable file
0
foodinder_app/app/proguard-rules.pro
vendored
Normal file → Executable file
4
foodinder_app/app/src/main/AndroidManifest.xml
Normal file → Executable file
@ -4,10 +4,6 @@
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
|
12
foodinder_app/app/src/main/java/com/example/foodinder_app/CardItem.java
Normal file → Executable file
@ -2,21 +2,23 @@ package com.example.foodinder_app;
|
||||
|
||||
public class CardItem {
|
||||
|
||||
private int drawableId;
|
||||
private String drawableId;
|
||||
private String name;
|
||||
private String location;
|
||||
|
||||
public CardItem(int drawableId, String name, String location) {
|
||||
public CardItem(String drawableId, String name, String location) {
|
||||
this.drawableId = drawableId;
|
||||
this.name = name;
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public int getDrawableId() {
|
||||
public CardItem() {}
|
||||
|
||||
public String getDrawableId() {
|
||||
return drawableId;
|
||||
}
|
||||
|
||||
public void setDrawableId(int drawableId) {
|
||||
public void setDrawableId(String drawableId) {
|
||||
this.drawableId = drawableId;
|
||||
}
|
||||
|
||||
@ -31,4 +33,6 @@ public class CardItem {
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) { this.location = location; }
|
||||
}
|
||||
|
69
foodinder_app/app/src/main/java/com/example/foodinder_app/CardsAdapter.java
Normal file → Executable file
@ -1,9 +1,8 @@
|
||||
package com.example.foodinder_app;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -11,14 +10,18 @@ import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CardsAdapter extends BaseAdapter {
|
||||
|
||||
private Activity activity;
|
||||
private final static int AVATAR_WIDTH = 150;
|
||||
private final static int AVATAR_HEIGHT = 300;
|
||||
private final static int AVATAR_WIDTH = 1000;
|
||||
private final static int AVATAR_HEIGHT = 1000;
|
||||
private List<CardItem> data;
|
||||
private static final String TAG = Main2Activity.class.getName();
|
||||
Bitmap bitmap = null;
|
||||
|
||||
public CardsAdapter(Activity activity, List<CardItem> data) {
|
||||
this.data = data;
|
||||
@ -60,8 +63,7 @@ public class CardsAdapter extends BaseAdapter {
|
||||
//setting data to views
|
||||
holder.name.setText(getItem(position).getName());
|
||||
holder.location.setText(getItem(position).getLocation());
|
||||
holder.avatar.setImageBitmap(decodeSampledBitmapFromResource(activity.getResources(),
|
||||
getItem(position).getDrawableId(), AVATAR_WIDTH, AVATAR_HEIGHT));
|
||||
holder.avatar.setImageBitmap(decodeSampledBitmapFromResource(getItem(position).getDrawableId(), AVATAR_WIDTH, AVATAR_HEIGHT));
|
||||
|
||||
return convertView;
|
||||
}
|
||||
@ -78,40 +80,45 @@ public class CardsAdapter extends BaseAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId, int reqWidth, int reqHeight) {
|
||||
public void changeBitmap(Bitmap x) { bitmap = x; }
|
||||
|
||||
// First decode with inJustDecodeBounds=true to check dimensions
|
||||
final BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inJustDecodeBounds = true;
|
||||
BitmapFactory.decodeResource(res, resId, options);
|
||||
public Bitmap decodeSampledBitmapFromResource(final String src, int reqWidth, int reqHeight) {
|
||||
|
||||
// Calculate inSampleSize
|
||||
options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
|
||||
|
||||
// Decode bitmap with inSampleSize set
|
||||
options.inJustDecodeBounds = false;
|
||||
return BitmapFactory.decodeResource(res, resId, options);
|
||||
}
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
// a potentially time consuming task
|
||||
try {
|
||||
Bitmap y = Picasso.get().load(src).get();
|
||||
changeBitmap(y);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, ""+e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
public static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) {
|
||||
// Raw height and width of image
|
||||
final int height = options.outHeight;
|
||||
final int width = options.outWidth;
|
||||
int inSampleSize = 1;
|
||||
thread.start();
|
||||
|
||||
if (height > reqHeight || width > reqWidth) {
|
||||
Bitmap end = null;
|
||||
|
||||
final int halfHeight = height / 2;
|
||||
final int halfWidth = width / 2;
|
||||
|
||||
// Calculate the largest inSampleSize value that is a power of 2 and keeps both
|
||||
// height and width larger than the requested height and width.
|
||||
while ((halfHeight / inSampleSize) >= reqHeight
|
||||
&& (halfWidth / inSampleSize) >= reqWidth) {
|
||||
inSampleSize *= 2;
|
||||
int a =0;
|
||||
while (end==null) {
|
||||
a+=1;
|
||||
try {
|
||||
end = Bitmap.createScaledBitmap(bitmap, reqWidth, reqHeight, false);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return inSampleSize;
|
||||
bitmap = null;
|
||||
|
||||
return end;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
24
foodinder_app/app/src/main/java/com/example/foodinder_app/Main2Activity.java
Normal file → Executable file
@ -14,7 +14,6 @@ public class Main2Activity extends AppCompatActivity {
|
||||
private View button;
|
||||
private View button2;
|
||||
private TextView text;
|
||||
private SheetsQuickstart sheetsQuickstart;
|
||||
public static String stringen;
|
||||
|
||||
@Override
|
||||
@ -25,14 +24,17 @@ public class Main2Activity extends AppCompatActivity {
|
||||
button = findViewById(R.id.button);
|
||||
text = (TextView) findViewById(R.id.textView);
|
||||
button2 = findViewById(R.id.button2);
|
||||
sheetsQuickstart = new SheetsQuickstart();
|
||||
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view)
|
||||
{
|
||||
Intent intent = new Intent(Main2Activity.this, swipper.class);
|
||||
startActivity(intent);
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
Intent intent = new Intent(Main2Activity.this, swipper.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
|
||||
@ -40,19 +42,7 @@ public class Main2Activity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onClick(View view)
|
||||
{
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
stringen = sheetsQuickstart.return_sheet();
|
||||
} catch (IOException e) {
|
||||
stringen = "Problem";
|
||||
} catch (GeneralSecurityException e) {
|
||||
stringen = "Problem";
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
text.setText(stringen);
|
||||
text.setText("habas");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,108 +0,0 @@
|
||||
package com.example.foodinder_app;
|
||||
|
||||
import com.google.api.client.auth.oauth2.Credential;
|
||||
import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
|
||||
import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
|
||||
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
|
||||
import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
|
||||
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
|
||||
import com.google.api.client.http.javanet.NetHttpTransport;
|
||||
import com.google.api.client.json.JsonFactory;
|
||||
import com.google.api.client.json.jackson2.JacksonFactory;
|
||||
import com.google.api.client.util.store.FileDataStoreFactory;
|
||||
import com.google.api.services.sheets.v4.Sheets;
|
||||
import com.google.api.services.sheets.v4.SheetsScopes;
|
||||
import com.google.api.services.sheets.v4.model.ValueRange;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class SheetsQuickstart {
|
||||
private static final String APPLICATION_NAME = "@string/app_name";
|
||||
private static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();
|
||||
private static final String TOKENS_DIRECTORY_PATH = "tokens";
|
||||
|
||||
/**
|
||||
* Global instance of the scopes required by this quickstart.
|
||||
* If modifying these scopes, delete your previously saved tokens/ folder.
|
||||
*/
|
||||
private static final List<String> SCOPES = Collections.singletonList(SheetsScopes.SPREADSHEETS); //_READONLY
|
||||
private static final String CREDENTIALS_FILE_PATH = "/credentials.json";
|
||||
|
||||
/**
|
||||
* Creates an authorized Credential object.
|
||||
* @param HTTP_TRANSPORT The network HTTP Transport.
|
||||
* @return An authorized Credential object.
|
||||
* @throws IOException If the credentials.json file cannot be found.
|
||||
*/
|
||||
private static Credential getCredentials(final NetHttpTransport HTTP_TRANSPORT) throws IOException {
|
||||
// Load client secrets.
|
||||
InputStream in = SheetsQuickstart.class.getResourceAsStream(CREDENTIALS_FILE_PATH);
|
||||
if (in == null) {
|
||||
throw new FileNotFoundException("Resource not found: " + CREDENTIALS_FILE_PATH);
|
||||
}
|
||||
GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in));
|
||||
|
||||
// Build flow and trigger user authorization request.
|
||||
GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
|
||||
HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES)
|
||||
.setDataStoreFactory(new FileDataStoreFactory(new java.io.File(TOKENS_DIRECTORY_PATH)))
|
||||
.setAccessType("offline")
|
||||
.build();
|
||||
LocalServerReceiver receiver = new LocalServerReceiver.Builder().setPort(8888).build();
|
||||
return new AuthorizationCodeInstalledApp(flow, receiver).authorize("user");
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the names and majors of students in a sample spreadsheet:
|
||||
* https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit
|
||||
*/
|
||||
public String return_sheet() throws IOException, GeneralSecurityException {
|
||||
// Build a new authorized API client service.
|
||||
|
||||
final NetHttpTransport HTTP_TRANSPORT = new com.google.api.client.http.javanet.NetHttpTransport();
|
||||
final String spreadsheetId = "10nkzldxOYVa1OoFbdC8aLUGEqq3tgLsF-Jz_XlQfj0s";
|
||||
final String range = "(Interfejs + Logi uzytkownika)!D10";
|
||||
Sheets service = new Sheets.Builder(HTTP_TRANSPORT, JSON_FACTORY, getCredentials(HTTP_TRANSPORT))
|
||||
.setApplicationName(APPLICATION_NAME)
|
||||
.build();
|
||||
ValueRange response = service.spreadsheets().values()
|
||||
.get(spreadsheetId, range)
|
||||
.execute();
|
||||
List<List<Object>> values = response.getValues();
|
||||
|
||||
/*
|
||||
ValueRange requestBody = new ValueRange();
|
||||
requestBody.setValues(
|
||||
Arrays.asList(
|
||||
Arrays.asList("Row 1 Cell 1", "Row 1 Cell 2", "Row 1 Cell 3"),
|
||||
Arrays.asList("Row 2 Cell 1", "Row 2 Cell 2", "Row 2 Cell 3")));
|
||||
|
||||
Sheets.Spreadsheets.Values.Update request2 =
|
||||
service.spreadsheets().values().update(spreadsheetId, "(Interfejs + Logi użytkownika)!K32", requestBody).setValueInputOption("RAW"); //USER_ENTERED?
|
||||
request2.execute();
|
||||
*/
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
if (values == null || values.isEmpty()) {
|
||||
stringBuilder.append("No data found.");
|
||||
} else {
|
||||
stringBuilder.append("Name, Major");
|
||||
for (List row : values) {
|
||||
// Print columns A and E, which correspond to indices 0 and 4.
|
||||
stringBuilder.append(row.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
String string = stringBuilder.toString();
|
||||
return string;
|
||||
}
|
||||
}
|
||||
// [END sheets_quickstart]
|
200
foodinder_app/app/src/main/java/com/example/foodinder_app/swipper.java
Normal file → Executable file
@ -1,13 +1,32 @@
|
||||
package com.example.foodinder_app;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.volley.DefaultRetryPolicy;
|
||||
import com.android.volley.Request;
|
||||
import com.android.volley.RequestQueue;
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.RetryPolicy;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.JsonArrayRequest;
|
||||
import com.android.volley.toolbox.JsonObjectRequest;
|
||||
import com.android.volley.toolbox.StringRequest;
|
||||
import com.android.volley.toolbox.Volley;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import link.fls.swipestack.SwipeStack;
|
||||
|
||||
@ -15,10 +34,17 @@ public class swipper extends AppCompatActivity {
|
||||
|
||||
private SwipeStack cardStack;
|
||||
private CardsAdapter cardsAdapter;
|
||||
private ArrayList<CardItem> cardItems;
|
||||
private ArrayList<CardItem> cardItems = new ArrayList<>();
|
||||
private View btnCancel;
|
||||
private View btnLove;
|
||||
private int currentPosition;
|
||||
private RequestQueue mQueue;
|
||||
int i;
|
||||
CardItem card;
|
||||
String photo;
|
||||
String name;
|
||||
String description;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -29,26 +55,32 @@ public class swipper extends AppCompatActivity {
|
||||
btnCancel = findViewById(R.id.cancel);
|
||||
btnLove = findViewById(R.id.love);
|
||||
|
||||
mQueue = Volley.newRequestQueue(this);
|
||||
|
||||
setCardStackAdapter();
|
||||
currentPosition = 0;
|
||||
i = 0;
|
||||
|
||||
//Handling swipe event of Cards stack
|
||||
cardStack.setListener(new SwipeStack.SwipeStackListener() {
|
||||
@Override
|
||||
public void onViewSwipedToLeft(int position) {
|
||||
|
||||
Toast.makeText(swipper.this, "You liked " + cardItems.get(currentPosition).getName(),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
currentPosition = position + 1;
|
||||
|
||||
if (i!=0) {
|
||||
red();
|
||||
}
|
||||
i+=1;
|
||||
setCardStackAdapter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewSwipedToRight(int position) {
|
||||
|
||||
Toast.makeText(swipper.this, "You DON'T liked " + cardItems.get(currentPosition).getName(),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
currentPosition = position + 1;
|
||||
if (i!=0) {
|
||||
green();
|
||||
}
|
||||
i+=1;
|
||||
setCardStackAdapter();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -73,29 +105,31 @@ public class swipper extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void setCardStackAdapter() {
|
||||
cardItems = new ArrayList<>();
|
||||
|
||||
cardItems.add(new CardItem(R.drawable.a, "JedzenieA", "Jedzenie"));
|
||||
cardItems.add(new CardItem(R.drawable.b, "JedzenieB", "Jedzenie"));
|
||||
cardItems.add(new CardItem(R.drawable.c, "JedzenieC", "Jedzenie"));
|
||||
cardItems.add(new CardItem(R.drawable.d, "JedzenieD", "Jedzenie"));
|
||||
cardItems.add(new CardItem(R.drawable.e, "JedzenieE", "Jedzenie"));
|
||||
cardItems.add(new CardItem(R.drawable.f, "JedzenieF", "Jedzenie"));
|
||||
cardItems.add(new CardItem(R.drawable.g, "JedzenieG", "Jedzenie"));
|
||||
cardItems.add(new CardItem(R.drawable.h, "JedzenieH", "Jedzenie"));
|
||||
cardItems.add(new CardItem(R.drawable.i, "JedzenieI", "Jedzenie"));
|
||||
cardItems.add(new CardItem(R.drawable.j, "JedzenieJ", "Jedzenie"));
|
||||
cardItems.add(new CardItem(R.drawable.k, "JedzenieK", "Jedzenie"));
|
||||
cardItems.add(new CardItem(R.drawable.l, "JedzenieL", "Jedzenie"));
|
||||
cardItems.add(new CardItem(R.drawable.m, "JedzenieM", "Jedzenie"));
|
||||
cardItems.add(new CardItem(R.drawable.n, "JedzenieN", "Jedzenie"));
|
||||
cardItems.add(new CardItem(R.drawable.o, "JedzenieO", "Jedzenie"));
|
||||
cardItems.add(new CardItem(R.drawable.p, "JedzenieP", "Jedzenie"));
|
||||
cardItems.add(new CardItem(R.drawable.r, "JedzenieR", "Jedzenie"));
|
||||
|
||||
parseJSON();
|
||||
|
||||
|
||||
|
||||
SystemClock.sleep(1000);
|
||||
|
||||
Toast.makeText(swipper.this, photo + " " + name + " " + description,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
|
||||
if (i==0) {
|
||||
cardItems.add(new CardItem("https://im0-tub-com.yandex.net/i?id=5165d6043f5ca303aa3a791f91be3f9f&n=13&exp=1","pączki","lorem_ipsum"));
|
||||
}
|
||||
else {
|
||||
cardItems.add(new CardItem(photo,name,description));
|
||||
}
|
||||
|
||||
cardsAdapter = new CardsAdapter(this, cardItems);
|
||||
cardStack.setAdapter(cardsAdapter);
|
||||
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
cardStack.setAdapter(cardsAdapter);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -107,9 +141,117 @@ public class swipper extends AppCompatActivity {
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == R.id.reset) {
|
||||
cardStack.resetStack();
|
||||
currentPosition = 0;
|
||||
//cardStack.resetStack();
|
||||
//currentPosition = 0;
|
||||
restart();
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
//https://script.google.com/macros/s/AKfycbxhgRlgu_26AzjeAfJzgpvCRpQaFc47YM1Xyn2F/exec?action=red
|
||||
|
||||
|
||||
private void parseJSON() {
|
||||
String url = "https://script.google.com/macros/s/AKfycbxhgRlgu_26AzjeAfJzgpvCRpQaFc47YM1Xyn2F/exec?action=getItem";
|
||||
|
||||
JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, null,
|
||||
new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
try {
|
||||
JSONArray jarray = response.getJSONArray("item");
|
||||
|
||||
JSONObject jo = jarray.getJSONObject(0);
|
||||
|
||||
photo = jo.getString("photo");
|
||||
name = jo.getString("name");
|
||||
description = jo.getString("description");
|
||||
|
||||
|
||||
//Toast.makeText(swipper.this, photo + " " + name + " " + description,
|
||||
// Toast.LENGTH_SHORT).show();
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
|
||||
error.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
mQueue.add(request);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void green(){
|
||||
String url = "https://script.google.com/macros/s/AKfycbxhgRlgu_26AzjeAfJzgpvCRpQaFc47YM1Xyn2F/exec?action=green";
|
||||
|
||||
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
|
||||
new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String response) {
|
||||
|
||||
Log.d("strrrrr",">>"+response);
|
||||
}
|
||||
},
|
||||
new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
//displaying the error in toast if occurrs
|
||||
Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
mQueue.add(stringRequest);
|
||||
}
|
||||
|
||||
private void red(){
|
||||
String url = "https://script.google.com/macros/s/AKfycbxhgRlgu_26AzjeAfJzgpvCRpQaFc47YM1Xyn2F/exec?action=red";
|
||||
|
||||
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
|
||||
new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String response) {
|
||||
|
||||
Log.d("strrrrr",">>"+response);
|
||||
}
|
||||
},
|
||||
new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
//displaying the error in toast if occurrs
|
||||
Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
mQueue.add(stringRequest);
|
||||
}
|
||||
|
||||
|
||||
private void restart(){
|
||||
String url = "https://script.google.com/macros/s/AKfycbxhgRlgu_26AzjeAfJzgpvCRpQaFc47YM1Xyn2F/exec?action=restart";
|
||||
|
||||
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
|
||||
new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String response) {
|
||||
|
||||
Log.d("strrrrr",">>"+response);
|
||||
}
|
||||
},
|
||||
new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
//displaying the error in toast if occurrs
|
||||
Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
mQueue.add(stringRequest);
|
||||
}
|
||||
}
|
||||
|
BIN
foodinder_app/app/src/main/res/drawable-hdpi/green.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
foodinder_app/app/src/main/res/drawable-hdpi/red.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
foodinder_app/app/src/main/res/drawable-mdpi/green.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
foodinder_app/app/src/main/res/drawable-mdpi/red.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
foodinder_app/app/src/main/res/drawable-xhdpi/green.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
foodinder_app/app/src/main/res/drawable-xhdpi/red.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
foodinder_app/app/src/main/res/drawable-xxhdpi/green.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
foodinder_app/app/src/main/res/drawable-xxhdpi/red.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
foodinder_app/app/src/main/res/drawable-xxxhdpi/green.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
foodinder_app/app/src/main/res/drawable-xxxhdpi/red.png
Normal file
After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 9.5 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 10 KiB |
4
foodinder_app/app/src/main/res/layout/activity_main.xml
Normal file → Executable file
@ -34,7 +34,7 @@
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_toRightOf="@id/empty"
|
||||
android:contentDescription="@null"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
android:src="@drawable/green" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cancel"
|
||||
@ -44,7 +44,7 @@
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_toLeftOf="@id/empty"
|
||||
android:contentDescription="@null"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
android:src="@drawable/red" />
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
0
foodinder_app/app/src/main/res/layout/activity_main2.xml
Normal file → Executable file
0
foodinder_app/app/src/main/res/layout/item_card.xml
Normal file → Executable file
0
foodinder_app/app/src/main/res/menu/menu_main.xml
Normal file → Executable file
0
foodinder_app/app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
0
foodinder_app/app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
0
foodinder_app/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
0
foodinder_app/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
0
foodinder_app/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |