app done
@ -6,17 +6,17 @@
|
|||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@drawable/healthcare_and_medical"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity android:name=".Main3Activity"></activity>
|
<activity android:name=".Main3Activity"
|
||||||
|
android:screenOrientation="portrait"></activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".Main2Activity"
|
android:name=".Main2Activity"
|
||||||
android:screenOrientation="portrait">
|
android:screenOrientation="portrait">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
@ -1,13 +1,99 @@
|
|||||||
package com.example.foodinder_app;
|
package com.example.foodinder_app;
|
||||||
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.os.Bundle;
|
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 {
|
public class Main3Activity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private ImageView image;
|
||||||
|
private TextView text;
|
||||||
|
int pom = 0;
|
||||||
|
String photo=null;
|
||||||
|
String name=null;
|
||||||
|
private RequestQueue mQueue;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main3);
|
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=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);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,10 +46,10 @@ public class Swipper extends AppCompatActivity {
|
|||||||
private RequestQueue mQueue;
|
private RequestQueue mQueue;
|
||||||
private Random random = new Random();
|
private Random random = new Random();
|
||||||
int i;
|
int i;
|
||||||
int j = Main2Activity.zmienna;
|
int j = Main2Activity.zmienna - 1;
|
||||||
String photo;
|
String photo;
|
||||||
String name;
|
String name;
|
||||||
final private String api = "https://script.google.com/macros/s/AKfycbxhgRlgu_26AzjeAfJzgpvCRpQaFc47YM1Xyn2F";
|
public static final String api = "https://script.google.com/macros/s/AKfycbxhgRlgu_26AzjeAfJzgpvCRpQaFc47YM1Xyn2F";
|
||||||
private int colorJeden = 0;
|
private int colorJeden = 0;
|
||||||
private int colorDwa = 0;
|
private int colorDwa = 0;
|
||||||
private int colorTrzy = 0;
|
private int colorTrzy = 0;
|
||||||
|
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 |
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 |
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 |
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 |
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 |
@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/jeden"
|
android:id="@+id/jeden"
|
||||||
android:layout_width="70dp"
|
android:layout_width="60dp"
|
||||||
android:layout_height="70dp"
|
android:layout_height="60dp"
|
||||||
android:padding="2dp"
|
android:padding="2dp"
|
||||||
android:layout_toLeftOf="@id/empty1"
|
android:layout_toLeftOf="@id/empty1"
|
||||||
android:contentDescription="@null" />
|
android:contentDescription="@null" />
|
||||||
@ -37,8 +37,8 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/dwa"
|
android:id="@+id/dwa"
|
||||||
android:layout_width="70dp"
|
android:layout_width="60dp"
|
||||||
android:layout_height="70dp"
|
android:layout_height="60dp"
|
||||||
android:padding="2dp"
|
android:padding="2dp"
|
||||||
android:layout_toLeftOf="@id/empty2"
|
android:layout_toLeftOf="@id/empty2"
|
||||||
android:contentDescription="@null" />
|
android:contentDescription="@null" />
|
||||||
@ -52,8 +52,8 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/trzy"
|
android:id="@+id/trzy"
|
||||||
android:layout_width="70dp"
|
android:layout_width="60dp"
|
||||||
android:layout_height="70dp"
|
android:layout_height="60dp"
|
||||||
android:padding="2dp"
|
android:padding="2dp"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:contentDescription="@null" />
|
android:contentDescription="@null" />
|
||||||
@ -67,8 +67,8 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/cztery"
|
android:id="@+id/cztery"
|
||||||
android:layout_width="70dp"
|
android:layout_width="60dp"
|
||||||
android:layout_height="70dp"
|
android:layout_height="60dp"
|
||||||
android:padding="2dp"
|
android:padding="2dp"
|
||||||
android:layout_toRightOf="@id/empty3"
|
android:layout_toRightOf="@id/empty3"
|
||||||
android:contentDescription="@null" />
|
android:contentDescription="@null" />
|
||||||
@ -82,8 +82,8 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/piec"
|
android:id="@+id/piec"
|
||||||
android:layout_width="70dp"
|
android:layout_width="60dp"
|
||||||
android:layout_height="70dp"
|
android:layout_height="60dp"
|
||||||
android:padding="2dp"
|
android:padding="2dp"
|
||||||
android:layout_toRightOf="@id/empty4"
|
android:layout_toRightOf="@id/empty4"
|
||||||
android:contentDescription="@null" />
|
android:contentDescription="@null" />
|
||||||
|
@ -1,9 +1,70 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".Main3Activity">
|
tools:context=".Main3Activity">
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
<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>
|
@ -6,4 +6,5 @@
|
|||||||
<string name="proposition" translatable="false">Danie dnia:</string>
|
<string name="proposition" translatable="false">Danie dnia:</string>
|
||||||
<string name="start" translatable="false">Rozpocznij</string>
|
<string name="start" translatable="false">Rozpocznij</string>
|
||||||
<string name="text" translatable="false">Wpisz liczbę dań jaką chcesz przeanalizować:</string>
|
<string name="text" translatable="false">Wpisz liczbę dań jaką chcesz przeanalizować:</string>
|
||||||
|
<string name="yourproposition">Najbardziej dopasowane danie:</string>
|
||||||
</resources>
|
</resources>
|
@ -5,4 +5,5 @@
|
|||||||
<string name="change">Change</string>
|
<string name="change">Change</string>
|
||||||
<string name="proposition">Dish of the day:</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="attentio">Please enter the number in the range of 5-99</string>
|
||||||
|
<string name="yourproposition">Your the best matched dish:</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -6,6 +6,15 @@
|
|||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
<item name="colorAccent">@color/colorAccent</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>
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1 +0,0 @@
|
|||||||
{"installed":{"client_id":"938133417828-a6lfc898k3di2e41uvab0q3825b3v0p7.apps.googleusercontent.com","project_id":"quickstart-1574691190977","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"Nfw-2UKc-zK81mm-AHTK3x4O","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}
|
|