Merge branch 'master' of https://git.wmi.amu.edu.pl/s396291/Foodinder
@ -1,62 +1,177 @@
|
||||
/** @OnlyCurrentDoc */
|
||||
//lorem ipsum
|
||||
|
||||
|
||||
function green() {
|
||||
var spreadsheet = SpreadsheetApp.getActive();
|
||||
spreadsheet.getRange('E28').activate();
|
||||
spreadsheet.setActiveSheet(spreadsheet.getSheetByName('(Uzytkownik+sesja) - dopasowania'), true);
|
||||
spreadsheet.getRange('E3').activate();
|
||||
spreadsheet.getRange('E4:P4').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
|
||||
spreadsheet.getRange('G3').activate();
|
||||
spreadsheet.getRange('G4:U4').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
|
||||
history();
|
||||
spreadsheet.getRange('L9').setValue('green');
|
||||
nodups();
|
||||
spreadsheet.setActiveSheet(spreadsheet.getSheetByName('(Interfejs + Logi uzytkownika)'), true);
|
||||
};
|
||||
|
||||
function red() {
|
||||
var spreadsheet = SpreadsheetApp.getActive();
|
||||
spreadsheet.getRange('E28').activate();
|
||||
spreadsheet.setActiveSheet(spreadsheet.getSheetByName('(Uzytkownik+sesja) - dopasowania'), true);
|
||||
spreadsheet.getRange('E3').activate();
|
||||
spreadsheet.getRange('E5:P5').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
|
||||
spreadsheet.getRange('G3').activate();
|
||||
spreadsheet.getRange('G5:U5').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
|
||||
history();
|
||||
spreadsheet.getRange('L9').setValue('red');
|
||||
nodups();
|
||||
spreadsheet.setActiveSheet(spreadsheet.getSheetByName('(Interfejs + Logi uzytkownika)'), true);
|
||||
};
|
||||
|
||||
|
||||
//zwraca "Service error: Spreadsheets" gdy są złe zakresy
|
||||
function history() {
|
||||
var spreadsheet = SpreadsheetApp.getActive();
|
||||
|
||||
spreadsheet.setActiveSheet(spreadsheet.getSheetByName('(Interfejs + Logi uzytkownika)'), true);
|
||||
|
||||
spreadsheet.getRange('N10').activate();
|
||||
spreadsheet.getRange('N9:Q41').moveTo(spreadsheet.getActiveRange());
|
||||
spreadsheet.getRange('N9').activate();
|
||||
spreadsheet.getRange('B10:E10').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
|
||||
//Przesuń historię o 1 w dół
|
||||
spreadsheet.getRange('L10').activate(); //??
|
||||
spreadsheet.getRange('L9:Q41').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false); //??
|
||||
//Dodaj nowy element do historii
|
||||
spreadsheet.getRange('M9').activate();
|
||||
spreadsheet.getRange('A10:E10').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
|
||||
};
|
||||
|
||||
function nodups(){
|
||||
//spreadsheet.setActiveSheet(spreadsheet.getSheetByName('(Uzytkownik+sesja) - dopasowania'), true);
|
||||
var spreadsheet = SpreadsheetApp.getActive();
|
||||
spreadsheet.setActiveSheet(spreadsheet.getSheetByName('(Interfejs + Logi uzytkownika)'), true);
|
||||
var ss = SpreadsheetApp.getActiveSpreadsheet();
|
||||
var sheet = ss.getActiveSheet();
|
||||
//var koor = spreadsheet.getRange('C12');
|
||||
var koordynaty = spreadsheet.getRange('(Interfejs + Logi uzytkownika)!C12').getValue();
|
||||
spreadsheet.setActiveSheet(spreadsheet.getSheetByName('(Uzytkownik+sesja) - dopasowania'), true);
|
||||
//spreadsheet.setActiveSheet(spreadsheet.getSheetByName('(Uzytkownik+sesja) - dopasowania'), true);
|
||||
var sheet = ss.getSheetByName('(Uzytkownik+sesja) - dopasowania');
|
||||
sheet.getRange(koordynaty,2).setValue('x');
|
||||
};
|
||||
|
||||
|
||||
function restart() {
|
||||
var spreadsheet = SpreadsheetApp.getActive();
|
||||
spreadsheet.setActiveSheet(spreadsheet.getSheetByName('(Interfejs + Logi uzytkownika)'), true);
|
||||
spreadsheet.getRange('N9:Q').activate();
|
||||
//Usuwanie historii
|
||||
spreadsheet.getRange('L9:Q').activate();
|
||||
spreadsheet.getSelection().getNextDataRange(SpreadsheetApp.Direction.DOWN).activate();
|
||||
spreadsheet.getActiveRangeList().clear({contentsOnly: true, skipFilteredRows: true});
|
||||
//Reset wag
|
||||
spreadsheet.setActiveSheet(spreadsheet.getSheetByName('(Uzytkownik+sesja) - dopasowania'), true);
|
||||
spreadsheet.getRange('G3').activate();
|
||||
spreadsheet.getRange('G2:R2').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
|
||||
spreadsheet.getRange('G2:U2').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
|
||||
//Reset duplikatów
|
||||
spreadsheet.getRange('B12:B').activate();
|
||||
var currentCell = spreadsheet.getCurrentCell();
|
||||
spreadsheet.getSelection().getNextDataRange(SpreadsheetApp.Direction.DOWN).activate();
|
||||
spreadsheet.getActiveRangeList().clear({contentsOnly: true, skipFilteredRows: true});
|
||||
//Powrót na interfejs
|
||||
spreadsheet.setActiveSheet(spreadsheet.getSheetByName('(Interfejs + Logi uzytkownika)'), true);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
function newuser() {
|
||||
var spreadsheet = SpreadsheetApp.getActive();
|
||||
spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Uzytkownicy'), true);
|
||||
spreadsheet.getRange('A1').activate();
|
||||
spreadsheet.getCurrentCell().getNextDataCell(SpreadsheetApp.Direction.DOWN).activate();
|
||||
//przesuń kursor o jedno miejsce w dół
|
||||
var cursor = spreadsheet.getActiveCell();
|
||||
var range = cursor.offset(1,0)
|
||||
spreadsheet.setActiveRange(range);
|
||||
//wklej nową parę Nazwa Uzytkownika - Klucz Uzytkownika
|
||||
spreadsheet.getRange('G1:H1').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
|
||||
|
||||
var cursor = spreadsheet.getActiveCell();
|
||||
|
||||
var dataArray = []
|
||||
var record ={};
|
||||
|
||||
record['user'] = cursor.getValue();
|
||||
|
||||
//przesuń kursor o jedno miejsce w prawo
|
||||
var range = cursor.offset(0,1);
|
||||
spreadsheet.setActiveRange(range);
|
||||
var cursor = spreadsheet.getActiveCell();
|
||||
|
||||
record['hash-pass'] = cursor.getValue();
|
||||
|
||||
|
||||
dataArray.push(record)
|
||||
var json = {};
|
||||
|
||||
json.item=dataArray;
|
||||
var result = JSON.stringify(json)
|
||||
return ContentService.createTextOutput(result).setMimeType(ContentService.MimeType.JSON);
|
||||
};
|
||||
|
||||
function doGet(e) {
|
||||
var action = e.parameter.action;
|
||||
var spreadsheet = SpreadsheetApp.getActive();
|
||||
var sheet = spreadsheet.getSheetByName('(Interfejs + Logi uzytkownika)');
|
||||
|
||||
if (action=='getItem') {
|
||||
return getItem(sheet);
|
||||
}
|
||||
|
||||
if (action=='evaluate') {
|
||||
return evaluate(sheet);
|
||||
}
|
||||
|
||||
if (action=='green') {
|
||||
return green('ok-green');
|
||||
}
|
||||
|
||||
if (action=='red') {
|
||||
return red('ok-red');
|
||||
}
|
||||
|
||||
if (action=='newuser') {
|
||||
return newuser();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function getItem(sheet) {
|
||||
var jo = {};
|
||||
var dataArray = [];
|
||||
var d10 = sheet.getRange('D10').getValue();
|
||||
var e10 = sheet.getRange('E10').getValue();
|
||||
var f10 = sheet.getRange('F10').getValue();
|
||||
|
||||
var record = {};
|
||||
record['photo'] = d10;
|
||||
record['name'] = e10;
|
||||
record['description'] = f10;
|
||||
|
||||
dataArray.push(record);
|
||||
|
||||
jo.item = dataArray;
|
||||
var result = JSON.stringify(jo);
|
||||
|
||||
return ContentService.createTextOutput(result).setMimeType(ContentService.MimeType.JSON);
|
||||
|
||||
};
|
||||
|
||||
function evaluate(sheet) {
|
||||
var jo = {};
|
||||
var dataArray = [];
|
||||
var d10 = sheet.getRange('W10').getValue();
|
||||
var e10 = sheet.getRange('X10').getValue();
|
||||
var f10 = sheet.getRange('Y10').getValue();
|
||||
|
||||
var record = {};
|
||||
record['photo'] = d10;
|
||||
record['name'] = e10;
|
||||
record['description'] = f10;
|
||||
|
||||
dataArray.push(record);
|
||||
|
||||
jo.item = dataArray;
|
||||
var result = JSON.stringify(jo);
|
||||
|
||||
restart();
|
||||
|
||||
return ContentService.createTextOutput(result).setMimeType(ContentService.MimeType.JSON);
|
||||
|
||||
};
|
||||
|
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
6
foodinder_app/app/build.gradle
Normal file → Executable file
@ -3,12 +3,16 @@ apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
packagingOptions {
|
||||
exclude 'META-INF/DEPENDENCIES'
|
||||
}
|
||||
compileSdkVersion 28
|
||||
buildToolsVersion "28.0.3"
|
||||
defaultConfig {
|
||||
applicationId "com.example.foodinder_app"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 28
|
||||
multiDexEnabled true
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
@ -27,6 +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.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
15
foodinder_app/app/src/main/AndroidManifest.xml
Normal file → Executable file
@ -2,20 +2,27 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.foodinder_app">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:icon="@drawable/healthcare_and_medical"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".Main2Activity">
|
||||
<activity android:name=".Main3Activity"
|
||||
android:screenOrientation="portrait"></activity>
|
||||
<activity
|
||||
android:name=".Main2Activity"
|
||||
android:screenOrientation="portrait">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".swipper">
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".Swipper"
|
||||
android:screenOrientation="portrait"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
63
foodinder_app/app/src/main/java/com/example/foodinder_app/CardItem.java
Normal file → Executable file
@ -1,23 +1,28 @@
|
||||
package com.example.foodinder_app;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.Log;
|
||||
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
public class CardItem {
|
||||
|
||||
private int drawableId;
|
||||
private static final String TAG = Main2Activity.class.getName();
|
||||
private final static int AVATAR_WIDTH = 1000;
|
||||
private final static int AVATAR_HEIGHT = 1000;
|
||||
private Bitmap drawable;
|
||||
private String name;
|
||||
private String location;
|
||||
Bitmap bitmap = null;
|
||||
|
||||
public CardItem(int drawableId, String name, String location) {
|
||||
this.drawableId = drawableId;
|
||||
public CardItem(String drawableId, String name) {
|
||||
this.drawable = setBitmapFromURL(drawableId, AVATAR_WIDTH, AVATAR_HEIGHT);
|
||||
this.name = name;
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public int getDrawableId() {
|
||||
return drawableId;
|
||||
}
|
||||
public CardItem() {}
|
||||
|
||||
public void setDrawableId(int drawableId) {
|
||||
this.drawableId = drawableId;
|
||||
public Bitmap getDrawable() {
|
||||
return drawable;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@ -28,7 +33,41 @@ public class CardItem {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
public void changeBitmap(Bitmap x) { bitmap = x; }
|
||||
|
||||
public Bitmap setBitmapFromURL (final String src, int reqWidth, int reqHeight) {
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
thread.start();
|
||||
|
||||
Bitmap end = null;
|
||||
|
||||
|
||||
int a =0;
|
||||
while (end==null) {
|
||||
a+=1;
|
||||
try {
|
||||
end = Bitmap.createScaledBitmap(bitmap, reqWidth, reqHeight, false);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bitmap = null;
|
||||
|
||||
return end;
|
||||
|
||||
}
|
||||
}
|
||||
|
50
foodinder_app/app/src/main/java/com/example/foodinder_app/CardsAdapter.java
Normal file → Executable file
@ -1,9 +1,6 @@
|
||||
package com.example.foodinder_app;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -16,8 +13,6 @@ 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 List<CardItem> data;
|
||||
|
||||
public CardsAdapter(Activity activity, List<CardItem> data) {
|
||||
@ -59,9 +54,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(getItem(position).getDrawable());
|
||||
|
||||
return convertView;
|
||||
}
|
||||
@ -69,49 +62,12 @@ public class CardsAdapter extends BaseAdapter {
|
||||
private class ViewHolder{
|
||||
private ImageView avatar;
|
||||
private TextView name;
|
||||
private TextView location;
|
||||
|
||||
public ViewHolder(View view) {
|
||||
avatar = (ImageView)view.findViewById(R.id.avatar);
|
||||
name = (TextView)view.findViewById(R.id.name);
|
||||
location = (TextView)view.findViewById(R.id.location);
|
||||
}
|
||||
}
|
||||
|
||||
public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId, int reqWidth, int reqHeight) {
|
||||
|
||||
// First decode with inJustDecodeBounds=true to check dimensions
|
||||
final BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inJustDecodeBounds = true;
|
||||
BitmapFactory.decodeResource(res, resId, options);
|
||||
|
||||
// Calculate inSampleSize
|
||||
options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
|
||||
|
||||
// Decode bitmap with inSampleSize set
|
||||
options.inJustDecodeBounds = false;
|
||||
return BitmapFactory.decodeResource(res, resId, options);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if (height > reqHeight || width > reqWidth) {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
return inSampleSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
148
foodinder_app/app/src/main/java/com/example/foodinder_app/Main2Activity.java
Normal file → Executable file
@ -1,28 +1,166 @@
|
||||
package com.example.foodinder_app;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Pair;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class Main2Activity extends AppCompatActivity {
|
||||
|
||||
private View button;
|
||||
private Button button;
|
||||
private EditText et;
|
||||
private ImageView avatar;
|
||||
private TextView name;
|
||||
public static String stringen;
|
||||
public static int zmienna = 10;
|
||||
private Random random = new Random();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main2);
|
||||
|
||||
button = findViewById(R.id.button);
|
||||
button = (Button) findViewById(R.id.buttonStart);
|
||||
button.setBackgroundColor(Color.RED);
|
||||
et = (EditText) findViewById(R.id.editText);
|
||||
et.addTextChangedListener(textWatcher);
|
||||
name = (TextView) findViewById(R.id.name2);
|
||||
avatar = (ImageView) findViewById(R.id.avatar2);
|
||||
|
||||
setCard();
|
||||
|
||||
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);
|
||||
//finish();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
TextWatcher textWatcher =new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
if(et.getText().length()>0) {
|
||||
int num = Integer.parseInt(et.getText().toString());
|
||||
if (num>=1 && num<=99)
|
||||
{
|
||||
//save the number
|
||||
zmienna = num;
|
||||
}
|
||||
else{
|
||||
Toast.makeText(Main2Activity.this,getResources().getString(R.string.attentio),Toast.LENGTH_SHORT).show();
|
||||
et.setText("");
|
||||
zmienna = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
private void setCard() {
|
||||
|
||||
Pair<String, String> p = returnRandomFromList();
|
||||
CardItem card = new CardItem(p.first, p.second);
|
||||
avatar.setImageBitmap(card.getDrawable());
|
||||
name.setText(card.getName());
|
||||
|
||||
}
|
||||
|
||||
private Pair<String, String> returnRandomFromList() {
|
||||
|
||||
List<Pair<String, String>> list = new ArrayList<Pair<String, String>>();
|
||||
list.add(Pair.create("https://media-cdn.tripadvisor.com/media/photo-o/0e/50/98/36/ali-baba-doner-kebab.jpg", "kebab"));
|
||||
list.add(Pair.create("https://roadtripbus.pl/wp-content/uploads/2019/01/frytki-belgijskie-przepis.jpg", "frytki"));
|
||||
list.add(Pair.create("http://greenlife.com.pl/wp-content/uploads/2014/01/Fotolia_37798945_Subscription_Monthly_M.jpg", "paluszki rybne"));
|
||||
list.add(Pair.create("http://cdn14.beszamel.smcloud.net/t/thumbs/660/441/1/user_photos/zapiekanka-z-pieczarkami-i-serem-przepis.jpg", "zapiekanka "));
|
||||
list.add(Pair.create("https://krosno24.pl/uploads/files/1278/pizza2859233_1280.jpg", "pizza"));
|
||||
list.add(Pair.create("https://bi.im-g.pl/im/97/cf/d6/z14077847M,Hot-dog.jpg", "hot dog"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/767x0/wrapy-z-kurczakiem-i-warzywami894020.jpg", "wrapy "));
|
||||
list.add(Pair.create("https://www.thespruceeats.com/thmb/KlbIb2jMzZnPeh5IzFvz10yDk5Y=/1813x1360/smart/filters:no_upscale()/vegetarian-bean-and-rice-burrito-recipe-3378550-9_preview-5b2417e1ff1b780037a58cda.jpeg", "buritto"));
|
||||
list.add(Pair.create("https://www.kwestiasmaku.com/sites/v123.kwestiasmaku.com/files/quesadillas_z_kurczakiem_01.jpg", "quesedilla "));
|
||||
list.add(Pair.create("https://primeburger.eu/wp-content/uploads/2018/10/2_prod_angus.jpg", "Burger"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/357x0/klasyczne-spaghetti-bolognese-z-pomidorami.jpg", "spagetti"));
|
||||
list.add(Pair.create("http://obiading.pl/wp-content/uploads/2013/08/lasagne.jpg", "lasagne"));
|
||||
list.add(Pair.create("https://ocdn.eu/pulscms-transforms/1/cR_ktkpTURBXy82Njc1OWY5MzRmNjgwZDNkMmMwNDIzNGRjMjkxMmNkZC5qcGeTlQMAzK_NFfDNDFeTBc0DFM0BvJUH2TIvcHVsc2Ntcy9NREFfLzE0MGIxY2ZlN2YwYWM1MmVkYzAxMGQ3MDk3OGU4NGJlLnBuZwDCAA", "zapiekanka makaronowa"));
|
||||
list.add(Pair.create("https://ocdn.eu/pulscms-transforms/1/Ll1ktkpTURBXy9hOGU3YmU5MjM5MTc2NTFkZjVjNGJjZTYwZWQxMTQyNC5qcGeTlQMAzLTNFoDNDKiTBc0DFM0BvJUH2TIvcHVsc2Ntcy9NREFfLzE0MGIxY2ZlN2YwYWM1MmVkYzAxMGQ3MDk3OGU4NGJlLnBuZwDCAA", "cannelloni"));
|
||||
list.add(Pair.create("https://kobietamag.pl/wp-content/uploads/2015/11/makaron-farfalle-z-dynia-pizmowa-orzechami-i-grana-padano.jpg", "farfalle"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/1440x1080/super-szybkie-tagliatelle-z-kurczakiem658590.jpg", "tagliatelle"));
|
||||
list.add(Pair.create("https://static.smaker.pl/photos/5/5/7/557b2c0fb2b8a9ad5d04bd81aaa17a61_367613_59ccc9e3e2f45_wm.jpg", "barszcz"));
|
||||
list.add(Pair.create("https://d3iamf8ydd24h9.cloudfront.net/pictures/articles/2018/02/39528-v-900x556.jpg", "żurek"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/767x0/grochowka.jpg", "grochówka"));
|
||||
list.add(Pair.create("https://zakochanewzupach.pl/wp-content/uploads/2017/05/ch%C5%82odnik-z-burak%C3%B3w-1-866x597.jpg", "chłodnik"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/767x0/zupa-pomidorowa.jpg", "zupa pomidorowa"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/767x0/classic-chicken-soup_a423933.jpg", "rosół"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/767x0/golabki.jpg", "gołąbki"));
|
||||
list.add(Pair.create("https://ocdn.eu/pulscms-transforms/1/KXvktkpTURBXy9jMzFlODhjYzk4YmMxNDhiODMyMzFiMzQ2ZGM2ZWI5My5qcGeTlQMAQs0ISc0EqZMFzQMUzQG8lQfZMi9wdWxzY21zL01EQV8vMTQwYjFjZmU3ZjBhYzUyZWRjMDEwZDcwOTc4ZTg0YmUucG5nAMIA", "kotlet schabowy"));
|
||||
list.add(Pair.create("https://i.wpimg.pl/O/555x385/i.wp.pl/a/f/kuchnia/58011461/-EDYSK_2-galerie_nowe-polskie_obiady-148476303.jpg", "kotlet mielony (zraz)"));
|
||||
list.add(Pair.create("https://static.gotujmy.pl/ZDJECIE_PRZEPISU_ETAP/karkowka-po-cygansku-z-lubczykiem-433571.jpg", "karkówka"));
|
||||
list.add(Pair.create("https://www.kuchniabazylii.pl/wp-content/uploads/2019/02/kurczak-w-kurkumie_przepis_1.jpg", "pierś kurczaka"));
|
||||
list.add(Pair.create("https://kuchnia-marty.pl/wp-content/uploads/2015/11/1553.900.jpg", "kopytka"));
|
||||
list.add(Pair.create("https://www.winiary.pl/image.ashx/kluski-slaskie-z-sosem-pieczeniowym.jpg?fileID=210145&width=800&height=1400&frame=False&bg=0&resize=1&crop=0&hRefill=0&vRefill=0&quality=84", "kluski śląskie"));
|
||||
list.add(Pair.create("https://kulinarneprzeboje.pl/wp-content/uploads/2018/08/DSC_0793-660x993.jpg", "knedle"));
|
||||
list.add(Pair.create("https://static.gotujmy.pl/ZDJECIE_PRZEPISU_ETAP/krokiety-z-miesem-grzybami-i-kapusta-415737.jpg", "krokiety z mięsem"));
|
||||
list.add(Pair.create("https://cookit.pl/Data/Images/zjemto.blox.pl/2015_slash_12_slash_Krokiety-z-kapusta-i-grzybami/l/-1540155321.jpg", "krokiety z kapustą i grzybami"));
|
||||
list.add(Pair.create("https://www.nalesniki.eu/wp-content/uploads/2015/02/nalesniki_z_serem.jpg", "naleśniki z serem"));
|
||||
list.add(Pair.create("https://d3iamf8ydd24h9.cloudfront.net/pictures/articles/2018/01/21290-v-900x556.jpg", "naleśniki z owocami"));
|
||||
list.add(Pair.create("https://static.gotujmy.pl/ZDJECIE_PRZEPISU_ETAP/gofry-z-bita-smietana-i-owocami-366132.jpg", "gofry z bitą śmietaną"));
|
||||
list.add(Pair.create("https://www.mniammniam.com/obrazki_mobile/sernik_latwyszybki1_mobile.jpg", "sernik"));
|
||||
list.add(Pair.create("https://www.przyslijprzepis.pl/media/cache/default_view/uploads/media/default/0001/13/2daa72a1a0a24e7dae3da924681d31e7929557a1.jpeg", "lody czekoladowe"));
|
||||
list.add(Pair.create("https://2.bp.blogspot.com/-KIAqdG_dEBc/W1CR4mRLcDI/AAAAAAAAUvA/ryRpfubKHCYe_DcRokWK1zHNm-rrJOCbQCLcBGAs/s1600/Domowe%2BLody%2B%25C5%259Bmietankowe%2Blody%2Bmleczne%2Blody%2Bsmietankowe%2Bnajlepsze%2Blody%2Bsmietankowe%2Bnajlepsze%2Blody%2B%25C5%259Bmietanowe%2Bdomowe%2Blody%2Bnajlepsze%2Bprzepis%2Bprzepis%2Bna%2Blody%2B0.jpg", "lody śmietankowe"));
|
||||
list.add(Pair.create("https://static.mojewypieki.com/upload/images/przepisy/Tiramisu/Tiramisu_01.jpg", "tiramisu"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/767x0/wuzetka6100240536839567.jpg", "wuzetka"));
|
||||
list.add(Pair.create("http://www.przepisykulinarne.info/wp-content/uploads/2015/01/jajecznica-z-boczkiem-2.jpg", "jajecznica"));
|
||||
list.add(Pair.create("https://ocdn.eu/pulscms-transforms/1/kHcktkqTURBXy85ZTRmMmRhMWE3NGMxOWI2ZTIwMjdlYTJiNmYxMzk0Yy5qcGVnk5UDAM0Jj80NVc0HgJMFzQMUzQG8lQfZMi9wdWxzY21zL01EQV8vMTQwYjFjZmU3ZjBhYzUyZWRjMDEwZDcwOTc4ZTg0YmUucG5nAMIA", "jajecznica bez mięsa"));
|
||||
list.add(Pair.create("https://d1doqjmisr497k.cloudfront.net/-/media/kamispl-2016/recipe/2000/tosty_z_szynka_i_serem_2000.jpg?vd=20180617T003946Z&ir=1&width=885&height=498&crop=auto&quality=75&speed=0&hash=B683193C23502612DDCBE5E63A072D72C5D6A0C6", "tost"));
|
||||
list.add(Pair.create("https://i.pinimg.com/474x/31/e4/9e/31e49eadb4c89d83045b0abcc4cd187b.jpg", "tost bez miesa"));
|
||||
list.add(Pair.create("https://www.eksperymentalnie.com/wp-content/uploads/2009/01/zupa_mleczna.jpg", "zupa mleczna"));
|
||||
list.add(Pair.create("https://www.mojegotowanie.pl/media/cache/default_view/uploads/media/default/0001/06/06c1ddd737685ab33c7e9e16312264390ff37ed5.jpeg", "omlet"));
|
||||
list.add(Pair.create("https://pliki.portalspozywczy.pl/i/08/79/02/087902_940.jpg", "kanapka"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/435x0/kanapka-z-gorgonzola-i-gruszka671748.jpg", "kanapka bez miesa"));
|
||||
list.add(Pair.create("http://jamiprzepisy.pl/wp-content/uploads/2009/05/kotlety_soczewicowe_2_1400.jpg", "kotlety z soczewicy"));
|
||||
list.add(Pair.create("https://www.przyslijprzepis.pl/media/cache/default_view/uploads/media/recipe/0006/16/c28f37349627c7dd1eb1944a1ef43c24b08ee155.jpeg", "kotlety z fasoli"));
|
||||
list.add(Pair.create("https://s3.party.pl/styl-zycia/zdrowie/odchudzanie-i-diety/zielony-wegetarianski-burger-437024-MT.jpg", "burger wege"));
|
||||
list.add(Pair.create("https://v.wpimg.pl/NzI4NDc0YRsoVjh3TEtsDmsObC0KEmJYPBZ0Zkx_YUx9ADZwWwNhHmdDPi0OV2AKJRt7fVsFeUJ8AWNpWgN9SH0Gf3BUHzkfLlUgNwhZYxg8RikhER4kCi4WMw==", "burger wege 2"));
|
||||
list.add(Pair.create("https://static.smaker.pl/photos/9/4/4/9442fbd2e845b0173b063c4ee272dccc_110705_57b497ef426c8_wm.jpg", "placki ziemniaczane"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/767x0/2277786.jpg", "ratatuj"));
|
||||
list.add(Pair.create("http://magicznyskladnik.pl/wp-content/uploads/2015/03/przepis-na-ziemniaki-pieczone-w-piekarniku-28-2.jpg", "pieczone ziemniaki"));
|
||||
list.add(Pair.create("https://www.winiary.pl/image.ashx/losos-z-koperkiem.jpg?fileID=43312&width=800&height=1400&frame=False&bg=0&resize=1&crop=0&hRefill=0&vRefill=0&quality=84", "łosos"));
|
||||
list.add(Pair.create("http://cdn30.beszamel.smcloud.net/t/thumbs/640/480/1/user_photos/18671/tani-dorsz-z-kauflandu-najlepszy-przepis.jpg", "dorsz"));
|
||||
list.add(Pair.create("https://rybyswiata.pl/wp-content/uploads/2013/10/halibut-niebieski-rybyswiata-pl.png", "halibut"));
|
||||
list.add(Pair.create("https://www.poezja-smaku.pl/wp-content/uploads/2012/07/aromatyczny-dorsz.jpg", "dorsz w panierce"));
|
||||
list.add(Pair.create("https://media-cdn.tripadvisor.com/media/photo-s/10/19/f2/0b/ryba-miruna-w-zlocistej.jpg", "miruna w panierce"));
|
||||
|
||||
|
||||
int index = random.nextInt(list.size());
|
||||
return list.get(11);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,99 @@
|
||||
package com.example.foodinder_app;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.support.annotation.UiThread;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Pair;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.volley.Request;
|
||||
import com.android.volley.RequestQueue;
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.JsonObjectRequest;
|
||||
import com.android.volley.toolbox.Volley;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class Main3Activity extends AppCompatActivity {
|
||||
|
||||
private ImageView image;
|
||||
private TextView text;
|
||||
int pom = 0;
|
||||
String photo=null;
|
||||
String name=null;
|
||||
private RequestQueue mQueue;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main3);
|
||||
|
||||
mQueue = Volley.newRequestQueue(this);
|
||||
|
||||
image = (ImageView) findViewById(R.id.avatar3);
|
||||
text = (TextView) findViewById(R.id.name3);
|
||||
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
while (photo==null) {
|
||||
parseJSON();
|
||||
SystemClock.sleep(1000);
|
||||
}
|
||||
|
||||
Main3Activity.this.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setCard();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void setCard() {
|
||||
|
||||
CardItem card = new CardItem(photo, name);
|
||||
image.setImageBitmap(card.getDrawable());
|
||||
text.setText(card.getName());
|
||||
|
||||
}
|
||||
|
||||
private void parseJSON() {
|
||||
String url = Swipper.api + "/exec?action=evaluate";
|
||||
|
||||
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");
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
|
||||
error.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
mQueue.add(request);
|
||||
|
||||
}
|
||||
}
|
372
foodinder_app/app/src/main/java/com/example/foodinder_app/Swipper.java
Executable file
@ -0,0 +1,372 @@
|
||||
package com.example.foodinder_app;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.volley.Request;
|
||||
import com.android.volley.RequestQueue;
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
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.List;
|
||||
import java.util.Random;
|
||||
|
||||
import link.fls.swipestack.SwipeStack;
|
||||
|
||||
public class Swipper extends AppCompatActivity {
|
||||
|
||||
private SwipeStack cardStack;
|
||||
private CardsAdapter cardsAdapter;
|
||||
private ArrayList<CardItem> cardItems = new ArrayList<>();
|
||||
private ImageView btnCancel;
|
||||
private ImageView btnLove;
|
||||
private ImageView jeden;
|
||||
private ImageView dwa;
|
||||
private ImageView trzy;
|
||||
private ImageView cztery;
|
||||
private ImageView piec;
|
||||
private int currentPosition;
|
||||
private RequestQueue mQueue;
|
||||
private Random random = new Random();
|
||||
int i;
|
||||
int j = Main2Activity.zmienna - 1;
|
||||
String photo;
|
||||
String name;
|
||||
public static final String api = "https://script.google.com/macros/s/AKfycbxhgRlgu_26AzjeAfJzgpvCRpQaFc47YM1Xyn2F";
|
||||
private int colorJeden = 0;
|
||||
private int colorDwa = 0;
|
||||
private int colorTrzy = 0;
|
||||
private int colorCztery = 0;
|
||||
private int colorPiec = 0;
|
||||
private int green = Color.rgb(106,193,89);
|
||||
private int red = Color.rgb(239,82,39);
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
cardStack = (SwipeStack) findViewById(R.id.container);
|
||||
btnCancel = (ImageView) findViewById(R.id.cancel);
|
||||
btnLove = (ImageView) findViewById(R.id.love);
|
||||
jeden = (ImageView) findViewById(R.id.jeden);
|
||||
dwa = (ImageView) findViewById(R.id.dwa);
|
||||
trzy = (ImageView) findViewById(R.id.trzy);
|
||||
cztery = (ImageView) findViewById(R.id.cztery);
|
||||
piec = (ImageView) findViewById(R.id.piec);
|
||||
|
||||
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) {
|
||||
currentPosition = position + 1;
|
||||
if (i!=0) {
|
||||
green();
|
||||
}
|
||||
if (i==j) {
|
||||
i=0;
|
||||
Intent intent = new Intent(Swipper.this, Main3Activity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
i+=1;
|
||||
changeImageStack(green);
|
||||
setCardStackAdapter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewSwipedToRight(int position) {
|
||||
currentPosition = position + 1;
|
||||
if (i!=0) {
|
||||
red();
|
||||
}
|
||||
if (i==j) {
|
||||
i=0;
|
||||
Intent intent = new Intent(Swipper.this, Main3Activity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
i+=1;
|
||||
changeImageStack(red);
|
||||
setCardStackAdapter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStackEmpty() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
btnCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
cardStack.swipeTopViewToRight();
|
||||
}
|
||||
});
|
||||
|
||||
btnLove.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
cardStack.swipeTopViewToLeft();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setCardStackAdapter() {
|
||||
|
||||
parseJSON();
|
||||
SystemClock.sleep(1000);
|
||||
|
||||
if (i==0) {
|
||||
Pair <String, String > pair = returnRandomFromList();
|
||||
cardItems.add(new CardItem(pair.first,pair.second));
|
||||
}
|
||||
else {
|
||||
cardItems.add(new CardItem(photo,name));
|
||||
}
|
||||
|
||||
cardsAdapter = new CardsAdapter(this, cardItems);
|
||||
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
cardStack.setAdapter(cardsAdapter);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void changeImageStack( int color ) {
|
||||
int size = cardsAdapter.getCount();
|
||||
Bitmap bitmapJeden = null;
|
||||
Bitmap bitmapDwa = null;
|
||||
Bitmap bitmapTrzy = null;
|
||||
Bitmap bitmapCztery = null;
|
||||
Bitmap bitmapPiec = null;
|
||||
colorPiec = colorCztery;
|
||||
colorCztery = colorTrzy;
|
||||
colorTrzy = colorDwa;
|
||||
colorDwa = colorJeden;
|
||||
colorJeden = color;
|
||||
try {
|
||||
bitmapJeden = cardsAdapter.getItem(size - 1).getDrawable();
|
||||
jeden.setImageBitmap(bitmapJeden);
|
||||
jeden.setBackgroundColor(colorJeden);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
try {
|
||||
bitmapDwa = cardsAdapter.getItem(size - 2).getDrawable();
|
||||
dwa.setImageBitmap(bitmapDwa);
|
||||
dwa.setBackgroundColor(colorDwa);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
try {
|
||||
bitmapTrzy = cardsAdapter.getItem(size - 3).getDrawable();
|
||||
trzy.setImageBitmap(bitmapTrzy);
|
||||
trzy.setBackgroundColor(colorTrzy);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
try {
|
||||
bitmapCztery = cardsAdapter.getItem(size - 4).getDrawable();
|
||||
cztery.setImageBitmap(bitmapCztery);
|
||||
cztery.setBackgroundColor(colorCztery);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
try {
|
||||
bitmapPiec = cardsAdapter.getItem(size - 5).getDrawable();
|
||||
piec.setImageBitmap(bitmapPiec);
|
||||
piec.setBackgroundColor(colorPiec);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void parseJSON() {
|
||||
//photo = null;
|
||||
//name = null;
|
||||
String url = api + "/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");
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
|
||||
error.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
mQueue.add(request);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void green(){
|
||||
String url = api + "/exec?action=green";
|
||||
|
||||
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
|
||||
new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String response) {
|
||||
}
|
||||
},
|
||||
new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
mQueue.add(stringRequest);
|
||||
}
|
||||
|
||||
private void red(){
|
||||
String url = api + "/exec?action=red";
|
||||
|
||||
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
|
||||
new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String response) {
|
||||
}
|
||||
},
|
||||
new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
mQueue.add(stringRequest);
|
||||
}
|
||||
|
||||
|
||||
private void restart(){
|
||||
String url = api + "/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);
|
||||
}
|
||||
|
||||
private Pair<String, String> returnRandomFromList() {
|
||||
|
||||
List <Pair<String, String>> list = new ArrayList <Pair<String, String>>();
|
||||
list.add(Pair.create("https://media-cdn.tripadvisor.com/media/photo-o/0e/50/98/36/ali-baba-doner-kebab.jpg", "kebab"));
|
||||
list.add(Pair.create("https://roadtripbus.pl/wp-content/uploads/2019/01/frytki-belgijskie-przepis.jpg", "frytki"));
|
||||
list.add(Pair.create("http://greenlife.com.pl/wp-content/uploads/2014/01/Fotolia_37798945_Subscription_Monthly_M.jpg", "paluszki rybne"));
|
||||
list.add(Pair.create("http://cdn14.beszamel.smcloud.net/t/thumbs/660/441/1/user_photos/zapiekanka-z-pieczarkami-i-serem-przepis.jpg", "zapiekanka "));
|
||||
list.add(Pair.create("https://krosno24.pl/uploads/files/1278/pizza2859233_1280.jpg", "pizza"));
|
||||
list.add(Pair.create("https://bi.im-g.pl/im/97/cf/d6/z14077847M,Hot-dog.jpg", "hot dog"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/767x0/wrapy-z-kurczakiem-i-warzywami894020.jpg", "wrapy "));
|
||||
list.add(Pair.create("https://www.thespruceeats.com/thmb/KlbIb2jMzZnPeh5IzFvz10yDk5Y=/1813x1360/smart/filters:no_upscale()/vegetarian-bean-and-rice-burrito-recipe-3378550-9_preview-5b2417e1ff1b780037a58cda.jpeg", "buritto"));
|
||||
list.add(Pair.create("https://www.kwestiasmaku.com/sites/v123.kwestiasmaku.com/files/quesadillas_z_kurczakiem_01.jpg", "quesedilla "));
|
||||
list.add(Pair.create("https://primeburger.eu/wp-content/uploads/2018/10/2_prod_angus.jpg", "Burger"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/357x0/klasyczne-spaghetti-bolognese-z-pomidorami.jpg", "spagetti"));
|
||||
list.add(Pair.create("http://obiading.pl/wp-content/uploads/2013/08/lasagne.jpg", "lasagne"));
|
||||
list.add(Pair.create("https://ocdn.eu/pulscms-transforms/1/cR_ktkpTURBXy82Njc1OWY5MzRmNjgwZDNkMmMwNDIzNGRjMjkxMmNkZC5qcGeTlQMAzK_NFfDNDFeTBc0DFM0BvJUH2TIvcHVsc2Ntcy9NREFfLzE0MGIxY2ZlN2YwYWM1MmVkYzAxMGQ3MDk3OGU4NGJlLnBuZwDCAA", "zapiekanka makaronowa"));
|
||||
list.add(Pair.create("https://ocdn.eu/pulscms-transforms/1/Ll1ktkpTURBXy9hOGU3YmU5MjM5MTc2NTFkZjVjNGJjZTYwZWQxMTQyNC5qcGeTlQMAzLTNFoDNDKiTBc0DFM0BvJUH2TIvcHVsc2Ntcy9NREFfLzE0MGIxY2ZlN2YwYWM1MmVkYzAxMGQ3MDk3OGU4NGJlLnBuZwDCAA", "cannelloni"));
|
||||
list.add(Pair.create("https://kobietamag.pl/wp-content/uploads/2015/11/makaron-farfalle-z-dynia-pizmowa-orzechami-i-grana-padano.jpg", "farfalle"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/1440x1080/super-szybkie-tagliatelle-z-kurczakiem658590.jpg", "tagliatelle"));
|
||||
list.add(Pair.create("https://static.smaker.pl/photos/5/5/7/557b2c0fb2b8a9ad5d04bd81aaa17a61_367613_59ccc9e3e2f45_wm.jpg", "barszcz"));
|
||||
list.add(Pair.create("https://d3iamf8ydd24h9.cloudfront.net/pictures/articles/2018/02/39528-v-900x556.jpg", "żurek"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/767x0/grochowka.jpg", "grochówka"));
|
||||
list.add(Pair.create("https://zakochanewzupach.pl/wp-content/uploads/2017/05/ch%C5%82odnik-z-burak%C3%B3w-1-866x597.jpg", "chłodnik"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/767x0/zupa-pomidorowa.jpg", "zupa pomidorowa"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/767x0/classic-chicken-soup_a423933.jpg", "rosół"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/767x0/golabki.jpg", "gołąbki"));
|
||||
list.add(Pair.create("https://ocdn.eu/pulscms-transforms/1/KXvktkpTURBXy9jMzFlODhjYzk4YmMxNDhiODMyMzFiMzQ2ZGM2ZWI5My5qcGeTlQMAQs0ISc0EqZMFzQMUzQG8lQfZMi9wdWxzY21zL01EQV8vMTQwYjFjZmU3ZjBhYzUyZWRjMDEwZDcwOTc4ZTg0YmUucG5nAMIA", "kotlet schabowy"));
|
||||
list.add(Pair.create("https://i.wpimg.pl/O/555x385/i.wp.pl/a/f/kuchnia/58011461/-EDYSK_2-galerie_nowe-polskie_obiady-148476303.jpg", "kotlet mielony (zraz)"));
|
||||
list.add(Pair.create("https://static.gotujmy.pl/ZDJECIE_PRZEPISU_ETAP/karkowka-po-cygansku-z-lubczykiem-433571.jpg", "karkówka"));
|
||||
list.add(Pair.create("https://www.kuchniabazylii.pl/wp-content/uploads/2019/02/kurczak-w-kurkumie_przepis_1.jpg", "pierś kurczaka"));
|
||||
list.add(Pair.create("https://kuchnia-marty.pl/wp-content/uploads/2015/11/1553.900.jpg", "kopytka"));
|
||||
list.add(Pair.create("https://www.winiary.pl/image.ashx/kluski-slaskie-z-sosem-pieczeniowym.jpg?fileID=210145&width=800&height=1400&frame=False&bg=0&resize=1&crop=0&hRefill=0&vRefill=0&quality=84", "kluski śląskie"));
|
||||
list.add(Pair.create("https://kulinarneprzeboje.pl/wp-content/uploads/2018/08/DSC_0793-660x993.jpg", "knedle"));
|
||||
list.add(Pair.create("https://static.gotujmy.pl/ZDJECIE_PRZEPISU_ETAP/krokiety-z-miesem-grzybami-i-kapusta-415737.jpg", "krokiety z mięsem"));
|
||||
list.add(Pair.create("https://cookit.pl/Data/Images/zjemto.blox.pl/2015_slash_12_slash_Krokiety-z-kapusta-i-grzybami/l/-1540155321.jpg", "krokiety z kapustą i grzybami"));
|
||||
list.add(Pair.create("https://www.nalesniki.eu/wp-content/uploads/2015/02/nalesniki_z_serem.jpg", "naleśniki z serem"));
|
||||
list.add(Pair.create("https://d3iamf8ydd24h9.cloudfront.net/pictures/articles/2018/01/21290-v-900x556.jpg", "naleśniki z owocami"));
|
||||
list.add(Pair.create("https://static.gotujmy.pl/ZDJECIE_PRZEPISU_ETAP/gofry-z-bita-smietana-i-owocami-366132.jpg", "gofry z bitą śmietaną"));
|
||||
list.add(Pair.create("https://www.mniammniam.com/obrazki_mobile/sernik_latwyszybki1_mobile.jpg", "sernik"));
|
||||
list.add(Pair.create("https://www.przyslijprzepis.pl/media/cache/default_view/uploads/media/default/0001/13/2daa72a1a0a24e7dae3da924681d31e7929557a1.jpeg", "lody czekoladowe"));
|
||||
list.add(Pair.create("https://2.bp.blogspot.com/-KIAqdG_dEBc/W1CR4mRLcDI/AAAAAAAAUvA/ryRpfubKHCYe_DcRokWK1zHNm-rrJOCbQCLcBGAs/s1600/Domowe%2BLody%2B%25C5%259Bmietankowe%2Blody%2Bmleczne%2Blody%2Bsmietankowe%2Bnajlepsze%2Blody%2Bsmietankowe%2Bnajlepsze%2Blody%2B%25C5%259Bmietanowe%2Bdomowe%2Blody%2Bnajlepsze%2Bprzepis%2Bprzepis%2Bna%2Blody%2B0.jpg", "lody śmietankowe"));
|
||||
list.add(Pair.create("https://static.mojewypieki.com/upload/images/przepisy/Tiramisu/Tiramisu_01.jpg", "tiramisu"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/767x0/wuzetka6100240536839567.jpg", "wuzetka"));
|
||||
list.add(Pair.create("http://www.przepisykulinarne.info/wp-content/uploads/2015/01/jajecznica-z-boczkiem-2.jpg", "jajecznica"));
|
||||
list.add(Pair.create("https://ocdn.eu/pulscms-transforms/1/kHcktkqTURBXy85ZTRmMmRhMWE3NGMxOWI2ZTIwMjdlYTJiNmYxMzk0Yy5qcGVnk5UDAM0Jj80NVc0HgJMFzQMUzQG8lQfZMi9wdWxzY21zL01EQV8vMTQwYjFjZmU3ZjBhYzUyZWRjMDEwZDcwOTc4ZTg0YmUucG5nAMIA", "jajecznica bez mięsa"));
|
||||
list.add(Pair.create("https://d1doqjmisr497k.cloudfront.net/-/media/kamispl-2016/recipe/2000/tosty_z_szynka_i_serem_2000.jpg?vd=20180617T003946Z&ir=1&width=885&height=498&crop=auto&quality=75&speed=0&hash=B683193C23502612DDCBE5E63A072D72C5D6A0C6", "tost"));
|
||||
list.add(Pair.create("https://i.pinimg.com/474x/31/e4/9e/31e49eadb4c89d83045b0abcc4cd187b.jpg", "tost bez miesa"));
|
||||
list.add(Pair.create("https://www.eksperymentalnie.com/wp-content/uploads/2009/01/zupa_mleczna.jpg", "zupa mleczna"));
|
||||
list.add(Pair.create("https://www.mojegotowanie.pl/media/cache/default_view/uploads/media/default/0001/06/06c1ddd737685ab33c7e9e16312264390ff37ed5.jpeg", "omlet"));
|
||||
list.add(Pair.create("https://pliki.portalspozywczy.pl/i/08/79/02/087902_940.jpg", "kanapka"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/435x0/kanapka-z-gorgonzola-i-gruszka671748.jpg", "kanapka bez miesa"));
|
||||
list.add(Pair.create("http://jamiprzepisy.pl/wp-content/uploads/2009/05/kotlety_soczewicowe_2_1400.jpg", "kotlety z soczewicy"));
|
||||
list.add(Pair.create("https://www.przyslijprzepis.pl/media/cache/default_view/uploads/media/recipe/0006/16/c28f37349627c7dd1eb1944a1ef43c24b08ee155.jpeg", "kotlety z fasoli"));
|
||||
list.add(Pair.create("https://s3.party.pl/styl-zycia/zdrowie/odchudzanie-i-diety/zielony-wegetarianski-burger-437024-MT.jpg", "burger wege"));
|
||||
list.add(Pair.create("https://v.wpimg.pl/NzI4NDc0YRsoVjh3TEtsDmsObC0KEmJYPBZ0Zkx_YUx9ADZwWwNhHmdDPi0OV2AKJRt7fVsFeUJ8AWNpWgN9SH0Gf3BUHzkfLlUgNwhZYxg8RikhER4kCi4WMw==", "burger wege 2"));
|
||||
list.add(Pair.create("https://static.smaker.pl/photos/9/4/4/9442fbd2e845b0173b063c4ee272dccc_110705_57b497ef426c8_wm.jpg", "placki ziemniaczane"));
|
||||
list.add(Pair.create("https://s3.przepisy.pl/przepisy3ii/img/variants/767x0/2277786.jpg", "ratatuj"));
|
||||
list.add(Pair.create("http://magicznyskladnik.pl/wp-content/uploads/2015/03/przepis-na-ziemniaki-pieczone-w-piekarniku-28-2.jpg", "pieczone ziemniaki"));
|
||||
list.add(Pair.create("https://www.winiary.pl/image.ashx/losos-z-koperkiem.jpg?fileID=43312&width=800&height=1400&frame=False&bg=0&resize=1&crop=0&hRefill=0&vRefill=0&quality=84", "łosos"));
|
||||
list.add(Pair.create("http://cdn30.beszamel.smcloud.net/t/thumbs/640/480/1/user_photos/18671/tani-dorsz-z-kauflandu-najlepszy-przepis.jpg", "dorsz"));
|
||||
list.add(Pair.create("https://rybyswiata.pl/wp-content/uploads/2013/10/halibut-niebieski-rybyswiata-pl.png", "halibut"));
|
||||
list.add(Pair.create("https://www.poezja-smaku.pl/wp-content/uploads/2012/07/aromatyczny-dorsz.jpg", "dorsz w panierce"));
|
||||
list.add(Pair.create("https://media-cdn.tripadvisor.com/media/photo-s/10/19/f2/0b/ryba-miruna-w-zlocistej.jpg", "miruna w panierce"));
|
||||
|
||||
|
||||
int index = random.nextInt(list.size());
|
||||
return list.get(index);
|
||||
}
|
||||
}
|
@ -1,115 +0,0 @@
|
||||
package com.example.foodinder_app;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import link.fls.swipestack.SwipeStack;
|
||||
|
||||
public class swipper extends AppCompatActivity {
|
||||
|
||||
private SwipeStack cardStack;
|
||||
private CardsAdapter cardsAdapter;
|
||||
private ArrayList<CardItem> cardItems;
|
||||
private View btnCancel;
|
||||
private View btnLove;
|
||||
private int currentPosition;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
cardStack = (SwipeStack) findViewById(R.id.container);
|
||||
btnCancel = findViewById(R.id.cancel);
|
||||
btnLove = findViewById(R.id.love);
|
||||
|
||||
setCardStackAdapter();
|
||||
currentPosition = 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;
|
||||
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStackEmpty() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
btnCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
cardStack.swipeTopViewToRight();
|
||||
}
|
||||
});
|
||||
|
||||
btnLove.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
cardStack.swipeTopViewToLeft();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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"));
|
||||
|
||||
|
||||
cardsAdapter = new CardsAdapter(this, cardItems);
|
||||
cardStack.setAdapter(cardsAdapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.menu_main, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == R.id.reset) {
|
||||
cardStack.resetStack();
|
||||
currentPosition = 0;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
BIN
foodinder_app/app/src/main/res/drawable-hdpi/green.png
Executable file
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 32 KiB |
BIN
foodinder_app/app/src/main/res/drawable-hdpi/map.png
Normal file
After Width: | Height: | Size: 252 KiB |
BIN
foodinder_app/app/src/main/res/drawable-hdpi/red.png
Executable file
After Width: | Height: | Size: 4.0 KiB |
BIN
foodinder_app/app/src/main/res/drawable-mdpi/green.png
Executable file
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 18 KiB |
BIN
foodinder_app/app/src/main/res/drawable-mdpi/map.png
Normal file
After Width: | Height: | Size: 132 KiB |
BIN
foodinder_app/app/src/main/res/drawable-mdpi/red.png
Executable file
After Width: | Height: | Size: 1.9 KiB |
BIN
foodinder_app/app/src/main/res/drawable-xhdpi/green.png
Executable file
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 23 KiB |
BIN
foodinder_app/app/src/main/res/drawable-xhdpi/map.png
Normal file
After Width: | Height: | Size: 297 KiB |
BIN
foodinder_app/app/src/main/res/drawable-xhdpi/red.png
Executable file
After Width: | Height: | Size: 2.4 KiB |
BIN
foodinder_app/app/src/main/res/drawable-xxhdpi/green.png
Executable file
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 92 KiB |
BIN
foodinder_app/app/src/main/res/drawable-xxhdpi/map.png
Normal file
After Width: | Height: | Size: 730 KiB |
BIN
foodinder_app/app/src/main/res/drawable-xxhdpi/red.png
Executable file
After Width: | Height: | Size: 11 KiB |
BIN
foodinder_app/app/src/main/res/drawable-xxxhdpi/green.png
Executable file
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 143 KiB |
BIN
foodinder_app/app/src/main/res/drawable-xxxhdpi/map.png
Normal file
After Width: | Height: | Size: 1.1 MiB |
BIN
foodinder_app/app/src/main/res/drawable-xxxhdpi/red.png
Executable 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 |
91
foodinder_app/app/src/main/res/layout/activity_main.xml
Normal file → Executable file
@ -12,9 +12,84 @@
|
||||
<link.fls.swipestack.SwipeStack
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="500dp"
|
||||
android:layout_height="400dp"
|
||||
app:stack_rotation="0" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_below="@+id/container">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/jeden"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:padding="2dp"
|
||||
android:layout_toLeftOf="@id/empty1"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/empty1"
|
||||
android:layout_width="10dp"
|
||||
android:layout_toLeftOf="@id/dwa"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dwa"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:padding="2dp"
|
||||
android:layout_toLeftOf="@id/empty2"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/empty2"
|
||||
android:layout_width="10dp"
|
||||
android:layout_toLeftOf="@id/trzy"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/trzy"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:padding="2dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/empty3"
|
||||
android:layout_width="10dp"
|
||||
android:layout_toRightOf="@id/trzy"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cztery"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:padding="2dp"
|
||||
android:layout_toRightOf="@id/empty3"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/empty4"
|
||||
android:layout_width="10dp"
|
||||
android:layout_toRightOf="@id/cztery"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/piec"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:padding="2dp"
|
||||
android:layout_toRightOf="@id/empty4"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -22,29 +97,29 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/empty"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/love"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_centerInParent="true"
|
||||
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"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_toLeftOf="@id/empty"
|
||||
android:contentDescription="@null"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
android:src="@drawable/red" />
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
96
foodinder_app/app/src/main/res/layout/activity_main2.xml
Normal file → Executable file
@ -1,19 +1,93 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".Main2Activity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="40dp"
|
||||
android:text="@string/proposition" />
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/pom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_below="@id/textView2"
|
||||
android:background="@android:color/white"
|
||||
android:orientation="vertical"
|
||||
app:cardCornerRadius="7dp"
|
||||
app:cardElevation="4dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/avatar2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp"
|
||||
android:layout_marginBottom="75dp"
|
||||
android:contentDescription="@null"
|
||||
android:scaleType="fitXY" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="75dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:gravity="center|left"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name2"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/colorPrimaryDark"
|
||||
android:textAlignment="center"
|
||||
android:textSize="18dp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_below="@id/pom"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20dp"
|
||||
android:text="@string/text" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_below="@id/textView"
|
||||
android:textSize="20dp"
|
||||
android:textColor="@color/black"
|
||||
android:textAlignment="center"
|
||||
android:text="10"
|
||||
android:inputType="numberDecimal" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="New Activity Click"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
android:id="@+id/buttonStart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_below="@id/editText"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="25dp"
|
||||
android:text="@string/start" />
|
||||
|
||||
</RelativeLayout>
|
70
foodinder_app/app/src/main/res/layout/activity_main3.xml
Normal file
@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".Main3Activity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="25dp"
|
||||
android:text="@string/yourproposition" />
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/pom3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_below="@id/textView3"
|
||||
android:background="@android:color/white"
|
||||
android:orientation="vertical"
|
||||
app:cardCornerRadius="7dp"
|
||||
app:cardElevation="4dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/avatar3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:layout_marginBottom="75dp"
|
||||
android:contentDescription="@null"
|
||||
android:scaleType="fitXY" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="75dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:gravity="center|left"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name3"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/colorPrimaryDark"
|
||||
android:textAlignment="center"
|
||||
android:textSize="18dp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/map"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@id/pom3"
|
||||
app:srcCompat="@drawable/map"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
11
foodinder_app/app/src/main/res/layout/item_card.xml
Normal file → Executable file
@ -17,7 +17,7 @@
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="350dp"
|
||||
android:layout_height="300dp"
|
||||
android:layout_marginBottom="75dp"
|
||||
android:contentDescription="@null"
|
||||
android:scaleType="fitXY" />
|
||||
@ -35,16 +35,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/colorPrimaryDark"
|
||||
android:textAlignment="center"
|
||||
android:textSize="18dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/location"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/colorPrimaryDark"
|
||||
android:textSize="14dp"
|
||||
android:textStyle="normal" />
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
</FrameLayout>
|
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 |
10
foodinder_app/app/src/main/res/values-pl-rPL/strings.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">Foodinder</string>
|
||||
<string name="attentio" translatable="false">Proszę wybrać liczbę z przedziału 5-99</string>
|
||||
<string name="change" translatable="false">Zmień</string>
|
||||
<string name="proposition" translatable="false">Danie dnia:</string>
|
||||
<string name="start" translatable="false">Rozpocznij</string>
|
||||
<string name="text" translatable="false">Wpisz liczbę dań jaką chcesz przeanalizować:</string>
|
||||
<string name="yourproposition">Najbardziej dopasowane danie:</string>
|
||||
</resources>
|
0
foodinder_app/app/src/main/res/values-w820dp/dimens.xml
Normal file → Executable file
4
foodinder_app/app/src/main/res/values/colors.xml
Normal file → Executable file
@ -3,4 +3,8 @@
|
||||
<color name="colorPrimary">#FF0000</color>
|
||||
<color name="colorPrimaryDark">#FF0000</color>
|
||||
<color name="colorAccent">#FF0000</color>
|
||||
<color name="yellow">#FFFF00</color>
|
||||
<color name="black">#000000</color>
|
||||
<color name="red">#FF0000</color>
|
||||
<color name="white">#FFFFFF</color>
|
||||
</resources>
|
||||
|
4
foodinder_app/app/src/main/res/values/dimens.xml
Normal file → Executable file
@ -2,4 +2,8 @@
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
<dimen name="item1_height">80dp</dimen>
|
||||
<dimen name="item1_width">80dp</dimen>
|
||||
<dimen name="item2_height">120dp</dimen>
|
||||
<dimen name="item2_width">120dp</dimen>
|
||||
</resources>
|
||||
|
8
foodinder_app/app/src/main/res/values/strings.xml
Normal file → Executable file
@ -1,3 +1,9 @@
|
||||
<resources>
|
||||
<string name="app_name">Foodinder</string>
|
||||
<string name="app_name" translatable="false">Foodinder</string>
|
||||
<string name="start">Start</string>
|
||||
<string name="text">Enter the number of dishes to be analyzed:</string>
|
||||
<string name="change">Change</string>
|
||||
<string name="proposition">Dish of the day:</string>
|
||||
<string name="attentio">Please enter the number in the range of 5-99</string>
|
||||
<string name="yourproposition">Your the best matched dish:</string>
|
||||
</resources>
|
||||
|
9
foodinder_app/app/src/main/res/values/styles.xml
Normal file → Executable file
@ -6,6 +6,15 @@
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
<item name="android:navigationBarColor">@color/colorPrimaryDark</item>
|
||||
</style>
|
||||
|
||||
<style name="App2Theme" parent="android:Theme.Light.NoTitleBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
<item name="android:navigationBarColor">@color/colorPrimaryDark</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
2
foodinder_app/build.gradle
Normal file → Executable file
@ -7,7 +7,7 @@ buildscript {
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.5.2'
|
||||
classpath 'com.android.tools.build:gradle:3.5.3'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|