okhttp
This commit is contained in:
29
.idea/codeStyles/Project.xml
generated
Normal file
29
.idea/codeStyles/Project.xml
generated
Normal file
@@ -0,0 +1,29 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<Objective-C-extensions>
|
||||
<file>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
|
||||
</file>
|
||||
<class>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
|
||||
</class>
|
||||
<extensions>
|
||||
<pair source="cpp" header="h" fileNamingConvention="NONE" />
|
||||
<pair source="c" header="h" fileNamingConvention="NONE" />
|
||||
</extensions>
|
||||
</Objective-C-extensions>
|
||||
</code_scheme>
|
||||
</component>
|
||||
@@ -70,10 +70,15 @@ dependencies {
|
||||
implementation 'com.github.czy1121:turncardlistview:1.0.0'
|
||||
//油表盘
|
||||
implementation 'com.github.lzyzsd:circleprogress:1.2.1'
|
||||
|
||||
//glide
|
||||
// implementation 'com.github.bumptech.glide:glide:4.8.0'
|
||||
// annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
|
||||
implementation 'com.github.bumptech.glide:glide:3.8.0'
|
||||
implementation 'com.android.support:support-v4:19.1.0'
|
||||
|
||||
|
||||
//okhttp 网络通信库
|
||||
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
|
||||
// json解析库
|
||||
implementation 'com.google.code.gson:gson:2.8.5'
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.example.ninefourone.nutritionmaster.bean;
|
||||
|
||||
public class FoodMaterial {
|
||||
/**
|
||||
* menu : 西红柿鸡蛋汤
|
||||
* quantity : 适量
|
||||
* material : 西红柿
|
||||
*/
|
||||
|
||||
private String menu;
|
||||
private String quantity;
|
||||
private String material;
|
||||
|
||||
public String getMenu() {
|
||||
return menu;
|
||||
}
|
||||
|
||||
public void setMenu(String menu) {
|
||||
this.menu = menu;
|
||||
}
|
||||
|
||||
public String getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(String quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public String getMaterial() {
|
||||
return material;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FoodMaterial{" +
|
||||
"menu='" + menu + '\'' +
|
||||
", quantity='" + quantity + '\'' +
|
||||
", material='" + material + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
public void setMaterial(String material) {
|
||||
|
||||
|
||||
this.material = material;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.example.ninefourone.nutritionmaster.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FoodMenu {
|
||||
|
||||
/**
|
||||
* flavor : 咸鲜味
|
||||
* calorie : 234
|
||||
* name : 雪丽对虾
|
||||
* technology : 炸
|
||||
* image_url : http://s1.ig.meishij.net/p/20091012/fed63858e633540c8df73e62692520fb_150x150.jpg
|
||||
* cook_quantity : [{"menu":"雪丽对虾","quantity":"500","material":"对虾"},{"menu":"雪丽对虾","quantity":"60","material":"鸡蛋清"},{"menu":"雪丽对虾","quantity":"100","material":"生菜(团叶)"},{"menu":"雪丽对虾","quantity":"80","material":"猪油(炼制)"},{"menu":"雪丽对虾","quantity":"30","material":"淀粉(玉米)"},{"menu":"雪丽对虾","quantity":"50","material":"小麦面粉"},{"menu":"雪丽对虾","quantity":"4","material":"盐"},{"menu":"雪丽对虾","quantity":"2","material":"胡椒粉"},{"menu":"雪丽对虾","quantity":"20","material":"料酒"},{"menu":"雪丽对虾","quantity":"35","material":"椒盐"},{"menu":"雪丽对虾","quantity":"35","material":"番茄酱"}]
|
||||
* practice : ['1. 将对虾洗净,剪去须、腿,去头、去壳(留尾段壳),挑出沙肠后洗净;', '2. 从虾体内侧剞2~3刀,放在碗内,充分搅打,打至起雪白泡沫;', '3. 再加少许盐、淀粉、面粉拌匀,即成蛋清稠糊(又叫雪丽,高丽糊);', '4. 将锅架在火上,放油烧至五六成热,将腌好的虾沥去水,轻轻扑上淀粉,放在雪丽蛋清糊碗中拖过,裹满糊料后放入温油锅用中;', '5. 小火炸,炸至膨松成熟(不可炸上色)捞出;', '6. 将虾尾朝着盘的中央,排在盘中,再在盘的周围放些焯烫断生的绿色蔬菜;', '7. 食用时蘸花椒盐、番茄酱。']
|
||||
* menuclassification_set : ["家常菜谱","补阳食谱","阳痿早泄食谱","不孕不育食谱","青少年食谱"]
|
||||
*/
|
||||
|
||||
private String flavor;
|
||||
private int calorie;
|
||||
private String name;
|
||||
private String technology;
|
||||
private String image_url;
|
||||
private String practice;
|
||||
private List<CookQuantityBean> cook_quantity;
|
||||
private List<String> menuclassification_set;
|
||||
|
||||
public String getFlavor() {
|
||||
return flavor;
|
||||
}
|
||||
|
||||
public void setFlavor(String flavor) {
|
||||
this.flavor = flavor;
|
||||
}
|
||||
|
||||
public int getCalorie() {
|
||||
return calorie;
|
||||
}
|
||||
|
||||
public void setCalorie(int calorie) {
|
||||
this.calorie = calorie;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getTechnology() {
|
||||
return technology;
|
||||
}
|
||||
|
||||
public void setTechnology(String technology) {
|
||||
this.technology = technology;
|
||||
}
|
||||
|
||||
public String getImage_url() {
|
||||
return image_url;
|
||||
}
|
||||
|
||||
public void setImage_url(String image_url) {
|
||||
this.image_url = image_url;
|
||||
}
|
||||
|
||||
public String getPractice() {
|
||||
return practice;
|
||||
}
|
||||
|
||||
public void setPractice(String practice) {
|
||||
this.practice = practice;
|
||||
}
|
||||
|
||||
public List<CookQuantityBean> getCook_quantity() {
|
||||
return cook_quantity;
|
||||
}
|
||||
|
||||
public void setCook_quantity(List<CookQuantityBean> cook_quantity) {
|
||||
this.cook_quantity = cook_quantity;
|
||||
}
|
||||
|
||||
public List<String> getMenuclassification_set() {
|
||||
return menuclassification_set;
|
||||
}
|
||||
|
||||
public void setMenuclassification_set(List<String> menuclassification_set) {
|
||||
this.menuclassification_set = menuclassification_set;
|
||||
}
|
||||
|
||||
public static class CookQuantityBean {
|
||||
/**
|
||||
* menu : 雪丽对虾
|
||||
* quantity : 500
|
||||
* material : 对虾
|
||||
*/
|
||||
|
||||
private String menu;
|
||||
private String quantity;
|
||||
private String material;
|
||||
|
||||
public String getMenu() {
|
||||
return menu;
|
||||
}
|
||||
|
||||
public void setMenu(String menu) {
|
||||
this.menu = menu;
|
||||
}
|
||||
|
||||
public String getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(String quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public String getMaterial() {
|
||||
return material;
|
||||
}
|
||||
|
||||
public void setMaterial(String material) {
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CookQuantityBean{" +
|
||||
"menu='" + menu + '\'' +
|
||||
", quantity='" + quantity + '\'' +
|
||||
", material='" + material + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FoodMenu{" +
|
||||
"flavor='" + flavor + '\'' +
|
||||
", calorie=" + calorie +
|
||||
", name='" + name + '\'' +
|
||||
", technology='" + technology + '\'' +
|
||||
", image_url='" + image_url + '\'' +
|
||||
", practice='" + practice + '\'' +
|
||||
", cook_quantity=" + cook_quantity +
|
||||
", menuclassification_set=" + menuclassification_set +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.example.ninefourone.nutritionmaster.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MenuClassification {
|
||||
|
||||
/**
|
||||
* classification : 川菜
|
||||
* cure_occupation : []
|
||||
* menu_effect : ["三色鲍脯","三色鸡酪","三菇冬瓜汤","三菌烩蛇段","三鲜乌鱼汤","三鲜参片汤","三鲜猪肝汤","下饭的素版麻婆豆腐","丝瓜鱼肚卷","五更豆酥鱼","元鱼烧鸡","冬苋菜豆腐汤","冬菜排骨汤","凉拌马齿苋","凉粉","十全乌鸡汤","南瓜蹄花汤","南瓜鲜带","咖喱兔肉","四川凉面","四川水煮牛肉","四川腊味香肠","回锅肉","园林香液鸡","多味瓜卷","大蒜烧鳝鱼","天麻乳鸽盅","奶油鱼肚","姜汁墨斗鱼丝","姜汁蹄花","姜芽炒兔丝","宫保肉丁","家常热味肘子","家常牛蹄筋","家常田鸡","家常臊子鱼","小笼牛肉","小米椒爆仔兔","尖椒北极贝","尖椒炒鲫鱼","川味砂锅之萝卜羊排","川蒜烧鲶鱼","巴国三菌蛇段汤","巴国冬瓜盅","巴国南瓜汤","巴国大排","巴国家常扣肉","巴国寨子鸡","巴国燕翅羹","巴国片皮鸭","巴国腊味拼盘","巴国辣香蛇","巴国钵钵兔","巴国风味兔","带丝全鸭","干煸兔丝","干煸冬笋","干煸青椒苦瓜","干豇豆排骨汤","干贝三圆","开水菜头","怪味鹿肉","扣肉仔兔","拌侧耳根","拌猪耳朵","旱蒸全鸡","时蔬肉丸汤","明炉三菌甲鱼汤","明炉三鲜鱼头汤","明炉什锦菊花锅","明炉酸萝卜鱼片汤","明虾烧粉丝","朝天锅","松仁鸡米","板栗烧凤翅","果味脯酥鱼","果蔬牛蛙","椒盐八炸鸡","椒盐脆鳝","椒盐蛇衣","椒盐鹅黄肉","椒麻腰片","正宗经典川菜麻婆豆腐","水煮牛柳","水煮财鱼","水豆豉鸭舌","永川豉汁排骨","泡椒圣子王","泡椒羊杂","泡椒鳝鱼","泡蛋汤","泡豇豆煸鲫鱼","洋参乌鸡汤","活捉青笋尖","海带卷","海带肘子汤","海白菜烧猪耳","淮杞牛鞭汤","清水菜头","清汤燕窝","清汤鱿鱼方","清炖羊肉汤","清蒸花鲢鱼头","清蒸鲫鱼3","滑嫩牛肉丝","滑炒蟹肉","火爆腰花2","火锅鸡","炖节瓜盅","炝圆白菜卷","炝豆芽菜","炮筒鳝鱼","炸桃腰","炸脆鳝","烩三色鱼丸","烩两色虾丸","煎焖虾饼","煎苦瓜鸡粒饼","熏豆腐干","熘鸡丝","猕猴桃甜烧白","玛瑙豆腐汤","珊瑚鱼条","生菜大明虾","番茄土豆丝","番茄炖兔","番茄炖鸡","番茄虾仁","番茄鸡蛋竹荪汤","白果乌鸡汤","白油猪肝","盐烧蟹","盐白菜爆鸭舌","砂锅鱼头汤","空心菜炝玉米","竹荪蝴蝶鱼肚汤","粉蒸泥鳅","粉蒸肥肠","粉蒸辣鲫鱼","糖醋茄饼","素牛肉","素蒸咸烧白","素鸡豆花","红烧刺参","红烧豆腐鳝段","红烧鱼肉","红烧鸭/红烧鸭子","红苕粉烧鳝鱼","绍子海参","羊杂汤","老干妈爆鸭舌","肉片汤","肚条豆芽汤","脆皮肠头","腊肉炖萝卜","腊肉绿豆汤","芙蓉红","芙蓉蒸海蟹","芝麻海参排","芝麻脊片","芥末扇贝","花椒油拌鲜芦笋","花菇油菜心","芳香排骨","芽菜烧肚条","苦瓜蒸肉丸","萝卜炖羊排","葱油滑菇","葱烧鲫鱼","葱茸竹荪","葱辣大虾","蒜汁时蔬","蒜烧海蟹","蒸渣肉","蒸芋头","蕉条茄子","虫草龟蛇汤","蜜柚烧牛蛙","西芹香辣兔","解馋瘦身菜宫保杏鲍菇","豆瓣活鲤","豆瓣鲜鱼面","豆瓣鲤鱼","豆腐丸子","豆腐虾仁","豆腐鲤鱼","豆花鱼","豆茸扣肉","豆豉鱼","豉汁蟠龙鳗","贵妃鸡翼","软炸兔糕","软炸烧白","辣味狗肉","辣味茄子","酒醉桃仁","酥炸大豆糕","酥炸茄饼","酥炸虾排","酥炸金片","酥炸鸭片","酱油鸡","酱烧冬笋","酱烧小黄鱼","酱蛤蜊","酸菜双瓜汤","酸菜蹄筋汤","酸菜鲈鱼汤","酸萝卜马蹄炖鸭","酸辣五丝汤","酸辣韭黄蛋花汤","醋烹土豆丝","金钩烘蛋","金银脑花","银鱼掐菜","锅烧肉","雪银虾饼","雪魔芋烧鹅掌","青椒玉米","青椒茄泥","青菜狮子头","香炸粉蒸肉","香炸麻辣牛排","香菇鱼块","香辣鲫鱼","香酥蛇段","魔芋海参","鱼仔蛋烩萝卜","鱼香回锅鸭","鱼香排骨","鱼香煎羊排","鱼香瓦块鱼","鱼香番茄过江","鱼香虾糕","鲍鱼鸽蛋","鲜熘竹荪蛋","鲜菜鱼皮","鸡蓉鲍片","麻辣牛筋","麻辣牛肉丁","麻辣牛肉干","麻辣牛肉条","麻辣香水鱼","麻香耗儿鱼","黄焖海参","黄瓜皮蛋汤","黄豆芽排骨汤","龙井鲍片"]
|
||||
*/
|
||||
|
||||
private String classification;
|
||||
private List<?> cure_occupation;
|
||||
private List<String> menu_effect;
|
||||
|
||||
public String getClassification() {
|
||||
return classification;
|
||||
}
|
||||
|
||||
public void setClassification(String classification) {
|
||||
this.classification = classification;
|
||||
}
|
||||
|
||||
public List<?> getCure_occupation() {
|
||||
return cure_occupation;
|
||||
}
|
||||
|
||||
public void setCure_occupation(List<?> cure_occupation) {
|
||||
this.cure_occupation = cure_occupation;
|
||||
}
|
||||
|
||||
public List<String> getMenu_effect() {
|
||||
return menu_effect;
|
||||
}
|
||||
|
||||
public void setMenu_effect(List<String> menu_effect) {
|
||||
this.menu_effect = menu_effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MenuClassification{" +
|
||||
"classification='" + classification + '\'' +
|
||||
", cure_occupation=" + cure_occupation +
|
||||
", menu_effect=" + menu_effect +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
package com.example.ninefourone.nutritionmaster.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MyUser {
|
||||
|
||||
/**
|
||||
* id : 7
|
||||
* physical_name : 平和质
|
||||
* password : password
|
||||
* last_login : null
|
||||
* is_superuser : false
|
||||
* username : okhttptest
|
||||
* first_name :
|
||||
* last_name :
|
||||
* email :
|
||||
* is_staff : false
|
||||
* is_active : false
|
||||
* date_joined : 2018-09-24T15:13:09.298590+08:00
|
||||
* sex : 1
|
||||
* occupation_name : 程序员
|
||||
* groups : []
|
||||
* user_permissions : []
|
||||
*/
|
||||
|
||||
private int id;
|
||||
private String physical_name;
|
||||
private String password;
|
||||
private Object last_login;
|
||||
private boolean is_superuser;
|
||||
private String username;
|
||||
private String first_name;
|
||||
private String last_name;
|
||||
private String email;
|
||||
private boolean is_staff;
|
||||
private boolean is_active;
|
||||
private String date_joined;
|
||||
private int sex;
|
||||
private String occupation_name;
|
||||
private List<?> groups;
|
||||
private List<?> user_permissions;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPhysical_name() {
|
||||
return physical_name;
|
||||
}
|
||||
|
||||
public void setPhysical_name(String physical_name) {
|
||||
this.physical_name = physical_name;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Object getLast_login() {
|
||||
return last_login;
|
||||
}
|
||||
|
||||
public void setLast_login(Object last_login) {
|
||||
this.last_login = last_login;
|
||||
}
|
||||
|
||||
public boolean isIs_superuser() {
|
||||
return is_superuser;
|
||||
}
|
||||
|
||||
public void setIs_superuser(boolean is_superuser) {
|
||||
this.is_superuser = is_superuser;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getFirst_name() {
|
||||
return first_name;
|
||||
}
|
||||
|
||||
public void setFirst_name(String first_name) {
|
||||
this.first_name = first_name;
|
||||
}
|
||||
|
||||
public String getLast_name() {
|
||||
return last_name;
|
||||
}
|
||||
|
||||
public void setLast_name(String last_name) {
|
||||
this.last_name = last_name;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public boolean isIs_staff() {
|
||||
return is_staff;
|
||||
}
|
||||
|
||||
public void setIs_staff(boolean is_staff) {
|
||||
this.is_staff = is_staff;
|
||||
}
|
||||
|
||||
public boolean isIs_active() {
|
||||
return is_active;
|
||||
}
|
||||
|
||||
public void setIs_active(boolean is_active) {
|
||||
this.is_active = is_active;
|
||||
}
|
||||
|
||||
public String getDate_joined() {
|
||||
return date_joined;
|
||||
}
|
||||
|
||||
public void setDate_joined(String date_joined) {
|
||||
this.date_joined = date_joined;
|
||||
}
|
||||
|
||||
public int getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(int sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public String getOccupation_name() {
|
||||
return occupation_name;
|
||||
}
|
||||
|
||||
public void setOccupation_name(String occupation_name) {
|
||||
this.occupation_name = occupation_name;
|
||||
}
|
||||
|
||||
public List<?> getGroups() {
|
||||
return groups;
|
||||
}
|
||||
|
||||
public void setGroups(List<?> groups) {
|
||||
this.groups = groups;
|
||||
}
|
||||
|
||||
public List<?> getUser_permissions() {
|
||||
return user_permissions;
|
||||
}
|
||||
|
||||
public void setUser_permissions(List<?> user_permissions) {
|
||||
this.user_permissions = user_permissions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MyUser{" +
|
||||
"id=" + id +
|
||||
", physical_name='" + physical_name + '\'' +
|
||||
", password='" + password + '\'' +
|
||||
", last_login=" + last_login +
|
||||
", is_superuser=" + is_superuser +
|
||||
", username='" + username + '\'' +
|
||||
", first_name='" + first_name + '\'' +
|
||||
", last_name='" + last_name + '\'' +
|
||||
", email='" + email + '\'' +
|
||||
", is_staff=" + is_staff +
|
||||
", is_active=" + is_active +
|
||||
", date_joined='" + date_joined + '\'' +
|
||||
", sex=" + sex +
|
||||
", occupation_name='" + occupation_name + '\'' +
|
||||
", groups=" + groups +
|
||||
", user_permissions=" + user_permissions +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.example.ninefourone.nutritionmaster.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Occupation {
|
||||
|
||||
/**
|
||||
* occupation_name : 电力工程师
|
||||
* menuclassification_set : ["接触电离辐射人员食谱","防癌抗癌食谱","明目食谱","关节炎食谱","壮腰健肾食谱"]
|
||||
*/
|
||||
|
||||
private String occupation_name;
|
||||
private List<String> menuclassification_set;
|
||||
|
||||
public String getOccupation_name() {
|
||||
return occupation_name;
|
||||
}
|
||||
|
||||
public void setOccupation_name(String occupation_name) {
|
||||
this.occupation_name = occupation_name;
|
||||
}
|
||||
|
||||
public List<String> getMenuclassification_set() {
|
||||
return menuclassification_set;
|
||||
}
|
||||
|
||||
public void setMenuclassification_set(List<String> menuclassification_set) {
|
||||
this.menuclassification_set = menuclassification_set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Occupation{" +
|
||||
"occupation_name='" + occupation_name + '\'' +
|
||||
", menuclassification_set=" + menuclassification_set +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.example.ninefourone.nutritionmaster.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Physique {
|
||||
/**
|
||||
* physical_name : 气虚质
|
||||
* cure_material : ["人参","人参须","去芯莲子","去芯莲子(3~4人份)","土茯苓","土茯苓(4~5个人量)","山药","山药(干)","山药(或淮山)","山药,薏米,芡实1:1:1","已经去芯的莲子","干莲子","怀山药","扁豆","新鲜人参","新鲜莲子","无心莲子","毛山药","淮山药片","清补凉(淮山、枸杞、莲子、百合、玉竹、薏米、红枣)","炒扁豆","炒白术","焦白术","白扁豆","白术","白茯苓","白莲子","福建建宁莲子(想安神效果莲子可多放)","芡实","芡实米","芡实米(鲜)","花旗参","花旗参(西洋参)","茯苓","茯苓(2人份)","莲子","莲子心","铁杆山药","铁棍山药","鲜莲子 \u2026\u2026","黄芪"]
|
||||
*/
|
||||
|
||||
private String physical_name;
|
||||
private List<String> cure_material;
|
||||
|
||||
public String getPhysical_name() {
|
||||
return physical_name;
|
||||
}
|
||||
|
||||
public void setPhysical_name(String physical_name) {
|
||||
this.physical_name = physical_name;
|
||||
}
|
||||
|
||||
public List<String> getCure_material() {
|
||||
return cure_material;
|
||||
}
|
||||
|
||||
public void setCure_material(List<String> cure_material) {
|
||||
this.cure_material = cure_material;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Physique{" +
|
||||
"physical_name='" + physical_name + '\'' +
|
||||
", cure_material=" + cure_material +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
package com.example.ninefourone.nutritionmaster.utils;
|
||||
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.FormBody;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class WebUtils {
|
||||
/**
|
||||
* 获取菜谱信息
|
||||
* {
|
||||
* "flavor": "咸鲜味",
|
||||
* "calorie": 234,
|
||||
* "name": "雪丽对虾",
|
||||
* "technology": "炸",
|
||||
* "image_url": "http://s1.ig.meishij.net/p/20091012/fed63858e633540c8df73e62692520fb_150x150.jpg",
|
||||
* "cook_quantity": [
|
||||
* {
|
||||
* "menu": "雪丽对虾",
|
||||
* "quantity": "500",
|
||||
* "material": "对虾"
|
||||
* },
|
||||
* {
|
||||
* "menu": "雪丽对虾",
|
||||
* "quantity": "60",
|
||||
* "material": "鸡蛋清"
|
||||
* },
|
||||
* }
|
||||
*/
|
||||
public static void getMenu(String menuName, Callback callback) {
|
||||
OkHttpClient mClient = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("http://120.77.182.38/menus/" + menuName + "/").build();
|
||||
mClient.newCall(request).enqueue(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某食材可以做的菜
|
||||
* [
|
||||
* {
|
||||
* "menu": "西红柿鸡蛋汤",
|
||||
* "quantity": "适量",
|
||||
* "material": "西红柿"
|
||||
* },
|
||||
* {
|
||||
* "menu": "瘦身版红菜汤",
|
||||
* "quantity": "4-5片",
|
||||
* "material": "西红柿"
|
||||
* },
|
||||
* {
|
||||
* "menu": "西红柿炖豆腐",
|
||||
* "quantity": "三个",
|
||||
* "material": "西红柿"
|
||||
* },
|
||||
* ]
|
||||
*
|
||||
* @param materialName
|
||||
* @param callback
|
||||
*/
|
||||
public static void getFoodMaterial(String materialName, Callback callback) {
|
||||
OkHttpClient mClient = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("http://120.77.182.38/foodmaterial/" + materialName + "/").build();
|
||||
mClient.newCall(request).enqueue(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某菜谱分类对应的菜
|
||||
* {
|
||||
* "classification": "川菜",
|
||||
* "cure_occupation": [],
|
||||
* "menu_effect": [
|
||||
* "三色鲍脯",
|
||||
* "三色鸡酪",
|
||||
* "三菇冬瓜汤",
|
||||
* "三菌烩蛇段",
|
||||
* "三鲜乌鱼汤",
|
||||
* "三鲜参片汤",
|
||||
* "三鲜猪肝汤",
|
||||
* "下饭的素版麻婆豆腐",
|
||||
* "丝瓜鱼肚卷",
|
||||
* "五更豆酥鱼",
|
||||
* "元鱼烧鸡",
|
||||
* "冬苋菜豆腐汤",
|
||||
* "冬菜排骨汤",
|
||||
*/
|
||||
public static void getMenuClassification(String classificationName, Callback callback) {
|
||||
OkHttpClient mClient = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("http://120.77.182.38/menuclassification/" + classificationName + "/").build();
|
||||
mClient.newCall(request).enqueue(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取职业需要的菜谱分类
|
||||
* {
|
||||
* "occupation_name": "电力工程师",
|
||||
* "menuclassification_set": [
|
||||
* "接触电离辐射人员食谱",
|
||||
* "防癌抗癌食谱",
|
||||
* "明目食谱",
|
||||
* "关节炎食谱",
|
||||
* "壮腰健肾食谱"
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
public static void getOccupation(String occupationName, Callback callback) {
|
||||
OkHttpClient mClient = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("http://120.77.182.38/occupation/" + occupationName + "/").build();
|
||||
mClient.newCall(request).enqueue(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取体质需要的食材
|
||||
* {
|
||||
* "physical_name": "气虚质",
|
||||
* "cure_material": [
|
||||
* "人参",
|
||||
* "人参须",
|
||||
* "去芯莲子",
|
||||
* "去芯莲子(3~4人份)",
|
||||
* "土茯苓",
|
||||
* ...
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
public static void getPhysique(String physiqueName, Callback callback) {
|
||||
OkHttpClient mClient = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("http://120.77.182.38/physique/" + physiqueName + "/").build();
|
||||
mClient.newCall(request).enqueue(callback);
|
||||
}
|
||||
|
||||
public static void getUser(String username, Callback callback) {
|
||||
OkHttpClient mClient = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("http://120.77.182.38/myuser/" + username + "/").build();
|
||||
mClient.newCall(request).enqueue(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注意在回调中处理username重复的情况
|
||||
*/
|
||||
public static void postUser(String username, String password, String sex, @Nullable String occupationName, @Nullable String physicalName, Callback callback) {
|
||||
RequestBody formBody = new FormBody.Builder()
|
||||
.add("username", username)
|
||||
.add("password", password)
|
||||
.add("sex", sex)
|
||||
.add("occupation_name", occupationName == null ? "" : occupationName)
|
||||
.add("physical_name", physicalName == null ? "" : physicalName)
|
||||
.build();
|
||||
Request request = new Request.Builder()
|
||||
.url("http://120.77.182.38/myuser/")
|
||||
.post(formBody)
|
||||
.build();
|
||||
|
||||
OkHttpClient mClient = new OkHttpClient();
|
||||
mClient.newCall(request).enqueue(callback);
|
||||
}
|
||||
|
||||
public static void changeUserPassword(String username, String password, Callback callback) {
|
||||
String url = "http://120.77.182.38/myuser/" + username + "/";
|
||||
RequestBody formBody = new FormBody.Builder()
|
||||
.add("username", username)
|
||||
.add("password", password)
|
||||
.build();
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.put(formBody)
|
||||
.build();
|
||||
|
||||
OkHttpClient mClient = new OkHttpClient();
|
||||
mClient.newCall(request).enqueue(callback);
|
||||
}
|
||||
|
||||
public static void changeUserOccupation(String username,String password, String occupation, Callback callback) {
|
||||
String url = "http://120.77.182.38/myuser/" + username + "/";
|
||||
RequestBody formBody = new FormBody.Builder()
|
||||
.add("username", username)
|
||||
.add("password",password)
|
||||
.add("occupation", occupation)
|
||||
.build();
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.put(formBody)
|
||||
.build();
|
||||
|
||||
OkHttpClient mClient = new OkHttpClient();
|
||||
mClient.newCall(request).enqueue(callback);
|
||||
}
|
||||
|
||||
public static void changeUserPhysique(String username,String password, String physique, Callback callback) {
|
||||
String url = "http://120.77.182.38/myuser/" + username + "/";
|
||||
RequestBody formBody = new FormBody.Builder()
|
||||
.add("username", username)
|
||||
.add("password",password)
|
||||
.add("physique", physique)
|
||||
.build();
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.put(formBody)
|
||||
.build();
|
||||
|
||||
OkHttpClient mClient = new OkHttpClient();
|
||||
mClient.newCall(request).enqueue(callback);
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
/*WebUtils.getMenu("雪丽对虾", new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
FoodMenu menu = new Gson().fromJson(response.body().string(), FoodMenu.class);
|
||||
System.out.println(menu);
|
||||
}
|
||||
});*/
|
||||
|
||||
/* WebUtils.getFoodMaterial("西红柿", new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
String json = response.body().string();
|
||||
FoodMaterial[] foodMaterialList = new Gson().fromJson(json, FoodMaterial[].class);
|
||||
System.out.println(Arrays.toString(foodMaterialList));
|
||||
}
|
||||
});*/
|
||||
|
||||
/*WebUtils.getMenuClassification("川菜", new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
MenuClassification classification = new Gson().fromJson(response.body().string(), MenuClassification.class);
|
||||
System.out.println(classification);
|
||||
}
|
||||
});*/
|
||||
|
||||
/*WebUtils.getOccupation("程序员", new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
System.out.println(response.body().string());
|
||||
}
|
||||
});*/
|
||||
|
||||
/*WebUtils.getPhysique("气虚质", new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
System.out.println(new Gson().fromJson(response.body().string(),Physique.class));
|
||||
}
|
||||
});*/
|
||||
|
||||
/*WebUtils.getUser("okhttptest", new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
System.out.println(new Gson().fromJson(response.body().string(),MyUser.class));
|
||||
}
|
||||
});*/
|
||||
|
||||
WebUtils.changeUserOccupation("updatatest","1234" ,"气虚质", new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
System.out.println(response.body().string());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||
classpath 'com.android.tools.build:gradle:3.1.3'
|
||||
|
||||
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
||||
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
#Sun Aug 26 10:42:35 CST 2018
|
||||
#Mon Sep 24 22:10:39 CST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
|
||||
|
||||
Reference in New Issue
Block a user