Skip to content

Commit bbba13a

Browse files
authored
Merge pull request #26 from SwikritiT/muna_branch
Muna branch
2 parents 80c6c7f + 40da058 commit bbba13a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2360
-824
lines changed

Diff for: Curry.php

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?php
2+
// $response=array();
3+
// $response['flag']=0;
4+
include("connection.php");
5+
6+
7+
if($_SERVER['REQUEST_METHOD']=='POST')
8+
{
9+
$inputDrinksList=$_POST['ingredients_array'];
10+
11+
$drinksArray=json_decode($inputDrinksList,true);
12+
//array_unique($inputDrinksList);
13+
$arringredient=array();
14+
$arringredientname=array();
15+
$drinksArray = array_column($drinksArray, 'name');
16+
$array_count=array_count_values($drinksArray);
17+
18+
foreach($array_count as $key => $value){
19+
20+
if($value=='2' OR $value=='4' ){
21+
foreach (array_keys($drinksArray, $key, true) as $unsetKey) {
22+
unset($drinksArray[$unsetKey]);
23+
}
24+
}
25+
}
26+
27+
print_r($drinksArray);
28+
29+
foreach ($drinksArray as $key => $value) {
30+
// print_r($value);
31+
// echo "\n";
32+
$sql= "SELECT * from `ingredient` WHERE ingredient_name='$value';";
33+
$result=mysqli_query($con,$sql);
34+
$resultCheck= mysqli_num_rows($result);
35+
if($resultCheck>0)
36+
{
37+
while($row=mysqli_fetch_assoc($result)){ //fetch_assoc fetches the data in an arrAY SO HERE ROW IS AN ARRAY
38+
39+
$id= $row['ingredient_id'];
40+
}
41+
42+
print_r($id);
43+
echo "\n";
44+
45+
$sql2="SELECT * FROM `can_be_made` WHERE ingredient_id='$id';";
46+
$result2=mysqli_query($con,$sql2);
47+
$resultCheck2= mysqli_num_rows($result2);
48+
if($resultCheck2>0)
49+
{
50+
while($row=mysqli_fetch_assoc($result2)){ //fetch_assoc fetches the data in an arrAY SO HERE ROW IS AN ARRAY
51+
52+
$arr= $row['recipe_id'];
53+
array_push($arringredient, $arr);
54+
//print_r($arr);
55+
}
56+
//echo "\n";
57+
58+
}
59+
}
60+
61+
# code...
62+
}
63+
sort($arringredient);
64+
print_r($arringredient);
65+
$dups = array();
66+
foreach(array_count_values($arringredient) as $val => $c)
67+
if($c > 1) $dups[] = $val;
68+
print_r($dups);
69+
70+
//to print recipe from database:
71+
72+
for($i=0;$i<count($dups);$i++)
73+
{
74+
75+
$sql3= "INSERT into `display` SELECT * from `recipe` WHERE recipe_id='$dups[$i]'&& category='Curry';";//&& category='Drinks'
76+
$result3=mysqli_query($con,$sql3);
77+
$resultCheck3= mysqli_num_rows($result3);
78+
79+
}
80+
81+
82+
83+
}
84+
85+
86+
?>

Diff for: app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ dependencies {
4343
compile 'com.android.support.constraint:constraint-layout:1.1.3'
4444
compile 'com.android.support:cardview-v7:28.0.0'
4545
compile 'com.android.support:recyclerview-v7:28.0.0'
46-
compile "com.android.support:gridlayout-v7:28.0.0"
46+
compile 'com.android.support:gridlayout-v7:28.0.0'
4747
compile 'com.android.support:design:28.0.0'
4848
compile 'com.github.bumptech.glide:glide:4.2.0'
49-
annotationProcessor 'com.github.bumptech.glide:compiler:4.2.0'
5049
compile 'com.mcxiaoke.volley:library:1.0.17'
5150
compile 'com.squareup.picasso:picasso:2.3.2'
5251
compile 'com.google.code.gson:gson:2.8.2'
5352
testCompile 'junit:junit:4.12'
5453
androidTestCompile 'com.android.support.test:runner:1.0.2'
5554
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.2'
55+
annotationProcessor 'com.github.bumptech.glide:compiler:4.2.0'
5656
}

Diff for: app/src/main/AndroidManifest.xml

+66-25
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
package="ellere.cooksmart">
44

55
<uses-permission android:name="android.permission.INTERNET" />
6-
<uses-permission android:name="android.permission.INTERNET" />
6+
7+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
78

89
<uses-feature
910
android:name="android.hardware.camera"
@@ -18,70 +19,110 @@
1819
android:roundIcon="@mipmap/ic_launcher_round"
1920
android:supportsRtl="true"
2021
android:theme="@style/AppMaterialTheme">
21-
<activity android:name=".HomePage">
22-
<intent-filter>
23-
<action android:name="android.intent.action.MAIN" />
22+
<activity android:name=".HomePage"
23+
android:configChanges="orientation"
24+
android:screenOrientation="portrait"
25+
>
26+
<!--<intent-filter>-->
27+
<!--<action android:name="android.intent.action.MAIN" />-->
2428

25-
<category android:name="android.intent.category.LAUNCHER" />
26-
</intent-filter>
29+
<!--<category android:name="android.intent.category.LAUNCHER" />-->
30+
<!--</intent-filter>-->
2731

2832
</activity>
29-
<activity android:name=".Breakfast">
33+
<activity android:name=".Breakfast"
34+
android:configChanges="orientation"
35+
android:screenOrientation="portrait">
3036
<!--<intent-filter>-->
3137
<!--<action android:name="android.intent.action.MAIN" />-->
3238

3339
<!--<category android:name="android.intent.category.LAUNCHER" />-->
3440
<!--</intent-filter>-->
3541
</activity>
36-
<activity android:name=".Snacks" />
37-
<activity android:name=".Dinner" />
38-
<activity android:name=".Curry" />
39-
<activity android:name=".Dessert" />
40-
<activity android:name=".Drinks" >
42+
<activity android:name=".Snacks"
43+
android:configChanges="orientation"
44+
android:screenOrientation="portrait"/>
45+
<activity android:name=".Dinner"
46+
android:configChanges="orientation"
47+
android:screenOrientation="portrait"/>
48+
<activity android:name=".Curry"
49+
android:configChanges="orientation"
50+
android:screenOrientation="portrait"/>
51+
<activity android:name=".Dessert"
52+
android:configChanges="orientation"
53+
android:screenOrientation="portrait"/>
54+
<activity android:name=".Drinks"
55+
android:configChanges="orientation"
56+
android:screenOrientation="portrait">
4157
<!--<intent-filter>-->
4258
<!--<action android:name="android.intent.action.MAIN" />-->
4359

4460
<!--<category android:name="android.intent.category.LAUNCHER" />-->
4561
<!--</intent-filter>-->
4662
</activity>
47-
<activity android:name=".SignUp" />
48-
<activity android:name=".FirstPage">
49-
<!--<intent-filter>-->
50-
<!--<action android:name="android.intent.action.MAIN" />-->
63+
<activity android:name=".SignUp"
64+
android:noHistory="true"
65+
android:configChanges="orientation"
66+
android:screenOrientation="portrait"/>
67+
<activity android:name=".FirstPage"
68+
android:launchMode="singleTask"
69+
android:clearTaskOnLaunch="true"
70+
android:configChanges="orientation"
71+
android:screenOrientation="portrait">
72+
<intent-filter>
73+
<action android:name="android.intent.action.MAIN" />
5174

52-
<!--<category android:name="android.intent.category.LAUNCHER" />-->
53-
<!--</intent-filter>-->
75+
<category android:name="android.intent.category.LAUNCHER" />
76+
</intent-filter>
5477
</activity>
55-
<activity android:name=".Login">
78+
<activity android:name=".Login"
79+
android:noHistory="true"
80+
android:configChanges="orientation"
81+
android:screenOrientation="portrait">
5682
<!--<intent-filter>-->
5783
<!--<action android:name="android.intent.action.MAIN" />-->
5884

5985
<!--<category android:name="android.intent.category.LAUNCHER" />-->
6086
<!--</intent-filter>-->
6187
</activity>
62-
<activity android:name=".Breakfast_homepage">
88+
<activity android:name=".Breakfast_homepage"
89+
android:configChanges="orientation"
90+
android:screenOrientation="portrait">
6391
<!--<intent-filter>-->
6492
<!--<action android:name="android.intent.action.MAIN" />-->
6593

6694
<!--<category android:name="android.intent.category.LAUNCHER" />-->
6795
<!--</intent-filter>-->
6896

6997
</activity>
70-
<activity android:name=".Curry_homepage">
98+
<activity android:name=".Curry_homepage"
99+
android:configChanges="orientation"
100+
android:screenOrientation="portrait">
71101

72102
</activity>
73-
<activity android:name=".Drinks_homepage">
103+
<activity android:name=".Drinks_homepage"
104+
android:configChanges="orientation"
105+
android:screenOrientation="portrait">
74106

75107
</activity>
76-
<activity android:name=".Snacks_homepage">
108+
<activity android:name=".Snacks_homepage"
109+
android:configChanges="orientation"
110+
android:screenOrientation="portrait">
77111

78112
</activity>
79-
<activity android:name=".Dessert_homepage">
113+
<activity android:name=".Dessert_homepage"
114+
android:configChanges="orientation"
115+
android:screenOrientation="portrait">
80116

81117
</activity>
82-
<activity android:name=".Dinner_homepage">
118+
<activity android:name=".Dinner_homepage"
119+
android:configChanges="orientation"
120+
android:screenOrientation="portrait">
83121

84122
</activity>
123+
<activity android:name=".Profile"
124+
android:configChanges="orientation"
125+
android:screenOrientation="portrait"/>
85126

86127

87128
</application>

Diff for: app/src/main/java/ellere/cooksmart/API_creator.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
*/
66

77
public class API_creator {
8-
public static String BASE_URL="http://192.168.1.75/cooksmart/";
8+
public static String BASE_URL="http://192.168.1.66/cooksmart/";
99
public static int count=0;
10+
public static String instruction="Instructions:\n";
11+
public static String ingredient ="Ingredients:\n";
1012
}
1113

0 commit comments

Comments
 (0)