webutil
This commit is contained in:
@@ -263,6 +263,6 @@
|
||||
* POST新建用户信息`params`示例
|
||||
|
||||
* 1♂ 0♀
|
||||
* `occupation_name`,`physique`的值必须和数据库对应
|
||||
* `occupation_name`,`physical_name`的值必须和数据库对应
|
||||
|
||||

|
||||
|
||||
@@ -83,4 +83,7 @@ dependencies {
|
||||
// json解析库
|
||||
implementation 'com.google.code.gson:gson:2.8.5'
|
||||
|
||||
//横向picker
|
||||
compile 'com.github.adityagohad:HorizontalPicker:1.0.1'
|
||||
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".camera.FoodMaterialCamera" />
|
||||
<activity android:name=".camera.ClassifierCamera" />
|
||||
|
||||
<receiver
|
||||
android:name=".step.StepStarter"
|
||||
@@ -55,10 +55,11 @@
|
||||
<activity android:name=".modules.viewpagerfragments.customization.CustomizationActivity" />
|
||||
<activity android:name=".modules.information.InformationActivity" />
|
||||
<activity android:name=".modules.RecipeActivity.RecipeActivity" />
|
||||
<activity
|
||||
android:name=".LoginActivity"
|
||||
android:label="@string/title_activity_login" />
|
||||
<activity android:name=".modules.addinformation.AddInformationActivity"></activity>
|
||||
<!-- <activity -->
|
||||
<!-- android:name=".LoginActivity" -->
|
||||
<!-- android:label="@string/title_activity_login" /> -->
|
||||
<activity android:name=".modules.addinformation.AddInformationActivity" />
|
||||
<activity android:name=".modules.classifyresult.DishResultActivity"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -4,16 +4,25 @@ import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.bean.FoodMenu;
|
||||
import com.example.ninefourone.nutritionmaster.bean.MyUser;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.bean.Occupation;
|
||||
import com.example.ninefourone.nutritionmaster.utils.ConstantUtils;
|
||||
import com.example.ninefourone.nutritionmaster.utils.WebUtils;
|
||||
import com.example.ninefourone.nutritionmaster.utils.WebUtil;
|
||||
import com.google.gson.Gson;
|
||||
import com.orhanobut.logger.AndroidLogAdapter;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
@@ -35,7 +44,6 @@ public class NutritionMaster extends Application {
|
||||
super.onCreate();
|
||||
mInstance = this;
|
||||
init();
|
||||
initUser();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,6 +88,15 @@ public class NutritionMaster extends Application {
|
||||
}
|
||||
});
|
||||
initOccupations();
|
||||
initUser();
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
initBD();
|
||||
}
|
||||
});
|
||||
thread.start();
|
||||
|
||||
}
|
||||
|
||||
public static NutritionMaster getInstance() {
|
||||
@@ -109,7 +126,7 @@ public class NutritionMaster extends Application {
|
||||
*/
|
||||
private void initOccupations() {
|
||||
|
||||
WebUtils.getAllOccupations(new Callback() {
|
||||
WebUtil.getAllOccupations(new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -118,7 +135,6 @@ public class NutritionMaster extends Application {
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
Occupation[] occupations = new Gson().fromJson(response.body().string(), Occupation[].class);
|
||||
// Logger.d(Arrays.toString(occupations));
|
||||
for (int i = 0; i < occupations.length; i++) {
|
||||
ConstantUtils.occupationList.add(occupations[i].getOccupation_name());
|
||||
}
|
||||
@@ -128,4 +144,58 @@ public class NutritionMaster extends Application {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* BDAPI init
|
||||
*/
|
||||
private void initBD() {
|
||||
ConstantUtils.BD_ACCESS_TOKEN = getAccessToken();
|
||||
// Logger.d(ConstantUtils.BD_ACCESS_TOKEN);
|
||||
}
|
||||
|
||||
|
||||
private String getAccessToken() {
|
||||
String authHost = "https://aip.baidubce.com/oauth/2.0/token?";
|
||||
String ak = ConstantUtils.BD_API_KEY;
|
||||
String sk = ConstantUtils.BD_SECRET_KEY;
|
||||
String getAccessTokenUrl = authHost
|
||||
// 1. grant_type为固定参数
|
||||
+ "grant_type=client_credentials"
|
||||
// 2. 官网获取的 API Key
|
||||
+ "&client_id=" + ak
|
||||
// 3. 官网获取的 Secret Key
|
||||
+ "&client_secret=" + sk;
|
||||
try {
|
||||
URL realUrl = new URL(getAccessTokenUrl);
|
||||
// 打开和URL之间的连接
|
||||
HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
connection.connect();
|
||||
// 获取所有响应头字段
|
||||
Map<String, List<String>> map = connection.getHeaderFields();
|
||||
// 遍历所有的响应头字段
|
||||
for (String key : map.keySet()) {
|
||||
System.err.println(key + "--->" + map.get(key));
|
||||
}
|
||||
// 定义 BufferedReader输入流来读取URL的响应
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
String result = "";
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result += line;
|
||||
}
|
||||
/**
|
||||
* 返回结果示例
|
||||
*/
|
||||
// System.err.println("result:" + result);
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
String access_token = jsonObject.getString("access_token");
|
||||
// Logger.d(access_token);
|
||||
return access_token;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.example.ninefourone.nutritionmaster.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/10/5.
|
||||
*/
|
||||
|
||||
public class PickerAdapter extends RecyclerView.Adapter<PickerHolder> {
|
||||
private ArrayList<String> list;
|
||||
private Context context;
|
||||
|
||||
public PickerAdapter(ArrayList<String> list, Context context) {
|
||||
super();
|
||||
this.list = list;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PickerHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.picker_item, parent, false);
|
||||
return new PickerHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(PickerHolder holder, int position) {
|
||||
holder.bindView(list.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.example.ninefourone.nutritionmaster.adapter;
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/10/5.
|
||||
*/
|
||||
|
||||
public class PickerHolder extends RecyclerView.ViewHolder {
|
||||
@BindView(R.id.picker_item)
|
||||
TextView pickerItem;
|
||||
|
||||
public PickerHolder(View itemView) {
|
||||
super(itemView);
|
||||
ButterKnife.bind(this, itemView);
|
||||
}
|
||||
|
||||
public void bindView(String text) {
|
||||
pickerItem.setText(text);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.example.ninefourone.nutritionmaster.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.NutritionMaster;
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.bean.ClassifyResult;
|
||||
import com.example.ninefourone.nutritionmaster.modules.classifyresult.DishResultActivity;
|
||||
import com.example.ninefourone.nutritionmaster.utils.CalculateUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import travel.ithaka.android.horizontalpickerlib.PickerLayoutManager;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/10/5.
|
||||
*/
|
||||
|
||||
public class ResultListAdapter extends RecyclerView.Adapter<ResultListHolder> {
|
||||
private ArrayList<ClassifyResult> mList;
|
||||
private Context context;
|
||||
private PickerLayoutManager pickerLayoutManager;
|
||||
|
||||
public ResultListAdapter(ArrayList<ClassifyResult> list, Context context) {
|
||||
super();
|
||||
mList = list;
|
||||
this.context = context;
|
||||
mList = CalculateUtils.getDishQuantity(mList, NutritionMaster.user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultListHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.dish_result_item, parent, false);
|
||||
pickerLayoutManager = new PickerLayoutManager(context, PickerLayoutManager.HORIZONTAL, false);
|
||||
return new ResultListHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ResultListHolder holder, int position) {
|
||||
holder.bindView(mList.get(position), pickerLayoutManager, (DishResultActivity) context, position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.example.ninefourone.nutritionmaster.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.widget.LinearSnapHelper;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.SnapHelper;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.bean.ClassifyResult;
|
||||
import com.example.ninefourone.nutritionmaster.modules.classifyresult.DishResultActivity;
|
||||
import com.example.ninefourone.nutritionmaster.utils.ConstantUtils;
|
||||
import com.example.ninefourone.nutritionmaster.utils.MessageUtils;
|
||||
import com.github.siyamed.shapeimageview.CircularImageView;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import travel.ithaka.android.horizontalpickerlib.PickerLayoutManager;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/10/5.
|
||||
*/
|
||||
|
||||
public class ResultListHolder extends RecyclerView.ViewHolder {
|
||||
@BindView(R.id.image)
|
||||
ImageView image;
|
||||
@BindView(R.id.name)
|
||||
TextView name;
|
||||
@BindView(R.id.picker)
|
||||
RecyclerView picker;
|
||||
|
||||
private PickerAdapter pickerAdapter;
|
||||
private Context context;
|
||||
|
||||
public ResultListHolder(View itemView) {
|
||||
super(itemView);
|
||||
ButterKnife.bind(this, itemView);
|
||||
context = itemView.getContext();
|
||||
}
|
||||
|
||||
public void bindView(ClassifyResult classifyResult, PickerLayoutManager pickerLayoutManager,
|
||||
final DishResultActivity dishResultActivity,final int position) {
|
||||
pickerLayoutManager.setChangeAlpha(true);
|
||||
pickerLayoutManager.setScaleDownBy(0.99f);
|
||||
pickerLayoutManager.setScaleDownDistance(0.8f);
|
||||
picker.setLayoutManager(pickerLayoutManager);
|
||||
SnapHelper snapHelper = new LinearSnapHelper();
|
||||
snapHelper.attachToRecyclerView(picker);
|
||||
pickerAdapter = new PickerAdapter(ConstantUtils.dishPicerData, context);
|
||||
picker.setAdapter(pickerAdapter);
|
||||
picker.setNestedScrollingEnabled(false);
|
||||
picker.scrollToPosition(48);
|
||||
picker.smoothScrollBy(10, 0);
|
||||
|
||||
pickerLayoutManager.setOnScrollStopListener(new PickerLayoutManager.onScrollStopListener() {
|
||||
@Override
|
||||
public void selectedView(View view) {
|
||||
String text = ((TextView) view).getText().toString();
|
||||
// MessageUtils.MakeToast(text);
|
||||
dishResultActivity.refreshData(Integer.valueOf(text),position);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
name.setText(classifyResult.getName());
|
||||
Glide.with(context).load("http://s2.boohee.cn/house/food_big/big_photo20155149534910631.jpg").into(image);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.NutritionMaster;
|
||||
import com.example.ninefourone.nutritionmaster.bean.MyUser;
|
||||
import com.example.ninefourone.nutritionmaster.utils.WebUtil;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import butterknife.ButterKnife;
|
||||
@@ -18,6 +19,7 @@ import butterknife.Unbinder;
|
||||
public abstract class BaseActivity extends AppCompatActivity {
|
||||
private Unbinder unbinder;
|
||||
protected MyUser user;
|
||||
private WebUtil webUtil;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
@@ -26,10 +28,13 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
setContentView(getLayoutId());
|
||||
unbinder = ButterKnife.bind(this);
|
||||
initViews(savedInstanceState);
|
||||
webUtil = new WebUtil();
|
||||
initToolBar();
|
||||
|
||||
}
|
||||
|
||||
public WebUtil getWebUtil() {
|
||||
return webUtil;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置布局layout
|
||||
@@ -94,7 +99,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
|
||||
protected void upUser() {
|
||||
NutritionMaster.user = user;
|
||||
Logger.d("用户信息已改"+NutritionMaster.user.toString());
|
||||
Logger.d("用户信息已改" + NutritionMaster.user.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.view.ViewGroup;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.NutritionMaster;
|
||||
import com.example.ninefourone.nutritionmaster.bean.MyUser;
|
||||
import com.example.ninefourone.nutritionmaster.utils.WebUtil;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import butterknife.ButterKnife;
|
||||
@@ -27,6 +28,8 @@ public abstract class BaseFragment extends Fragment {
|
||||
protected boolean isPrepared;
|
||||
protected boolean isVisible;
|
||||
private Unbinder unbinder;
|
||||
private WebUtil webUtil;
|
||||
|
||||
|
||||
public abstract
|
||||
@LayoutRes
|
||||
@@ -44,10 +47,15 @@ public abstract class BaseFragment extends Fragment {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
initView(savedInstanceState);
|
||||
webUtil = new WebUtil();
|
||||
this.user = NutritionMaster.user;
|
||||
}
|
||||
|
||||
|
||||
public WebUtil getWebUtil() {
|
||||
return webUtil;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化自己的ui
|
||||
*
|
||||
@@ -157,7 +165,7 @@ public abstract class BaseFragment extends Fragment {
|
||||
|
||||
protected void upUser() {
|
||||
NutritionMaster.user = user;
|
||||
Logger.d("用户信息已改"+NutritionMaster.user.toString());
|
||||
Logger.d("用户信息已改" + NutritionMaster.user.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.example.ninefourone.nutritionmaster.bean;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.utils.WebUtil;
|
||||
import com.google.gson.Gson;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.Response;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/10/4.
|
||||
*/
|
||||
|
||||
public class ClassifyResult implements Serializable {
|
||||
|
||||
private String imgPath;
|
||||
private double probability;
|
||||
private String name;
|
||||
private double calorie;
|
||||
private Boolean has_calorie;
|
||||
private double quantity = -1;
|
||||
private FoodMenu foodMenu;
|
||||
|
||||
|
||||
public void getMenu() {
|
||||
WebUtil webUtil = new WebUtil();
|
||||
webUtil.getMenu("素红烧肉", new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
name = "-1";
|
||||
Logger.e("我们数据库没有这个菜");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
FoodMenu menu = new Gson().fromJson(response.body().string(), FoodMenu.class);
|
||||
foodMenu = menu;
|
||||
Logger.d(name + "|" + menu);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public FoodMenu getFoodMenu() {
|
||||
return foodMenu;
|
||||
}
|
||||
|
||||
public void setFoodMenu(FoodMenu foodMenu) {
|
||||
this.foodMenu = foodMenu;
|
||||
}
|
||||
|
||||
public double getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(double quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public String getImgPath() {
|
||||
return imgPath;
|
||||
}
|
||||
|
||||
public void setImgPath(String imgPath) {
|
||||
this.imgPath = imgPath;
|
||||
}
|
||||
|
||||
public double getProbability() {
|
||||
return probability;
|
||||
}
|
||||
|
||||
public void setProbability(double probability) {
|
||||
this.probability = probability;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public double getCalorie() {
|
||||
return calorie;
|
||||
}
|
||||
|
||||
public void setCalorie(double calorie) {
|
||||
this.calorie = calorie;
|
||||
}
|
||||
|
||||
public Boolean getHas_calorie() {
|
||||
return has_calorie;
|
||||
}
|
||||
|
||||
public void setHas_calorie(Boolean has_calorie) {
|
||||
this.has_calorie = has_calorie;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name + ";置信度" + probability + ";卡路里" + calorie;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.example.ninefourone.nutritionmaster.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class FoodMenu {
|
||||
|
||||
public class FoodMenu implements Serializable {
|
||||
|
||||
/**
|
||||
* flavor : 五香味
|
||||
|
||||
@@ -52,6 +52,11 @@ public class MyUser {
|
||||
private List<?> user_permissions;
|
||||
private List<?> illness;
|
||||
|
||||
public MyUser() {
|
||||
height = new Integer(0);
|
||||
occupation_name = "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MyUser{" +
|
||||
@@ -80,11 +85,11 @@ public class MyUser {
|
||||
'}';
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@@ -120,11 +125,11 @@ public class MyUser {
|
||||
this.last_login = last_login;
|
||||
}
|
||||
|
||||
public boolean isIs_superuser() {
|
||||
public Boolean getIs_superuser() {
|
||||
return is_superuser;
|
||||
}
|
||||
|
||||
public void setIs_superuser(boolean is_superuser) {
|
||||
public void setIs_superuser(Boolean is_superuser) {
|
||||
this.is_superuser = is_superuser;
|
||||
}
|
||||
|
||||
@@ -160,19 +165,19 @@ public class MyUser {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public boolean isIs_staff() {
|
||||
public Boolean getIs_staff() {
|
||||
return is_staff;
|
||||
}
|
||||
|
||||
public void setIs_staff(boolean is_staff) {
|
||||
public void setIs_staff(Boolean is_staff) {
|
||||
this.is_staff = is_staff;
|
||||
}
|
||||
|
||||
public boolean isIs_active() {
|
||||
public Boolean getIs_active() {
|
||||
return is_active;
|
||||
}
|
||||
|
||||
public void setIs_active(boolean is_active) {
|
||||
public void setIs_active(Boolean is_active) {
|
||||
this.is_active = is_active;
|
||||
}
|
||||
|
||||
@@ -184,43 +189,43 @@ public class MyUser {
|
||||
this.date_joined = date_joined;
|
||||
}
|
||||
|
||||
public int getSex() {
|
||||
public Integer getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(int sex) {
|
||||
public void setSex(Integer sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
public Integer getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(int age) {
|
||||
public void setAge(Integer age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
public Integer getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(int height) {
|
||||
public void setHeight(Integer height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public int getWeight() {
|
||||
public Integer getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(int weight) {
|
||||
public void setWeight(Integer weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public int getBmi() {
|
||||
public Integer getBmi() {
|
||||
return bmi;
|
||||
}
|
||||
|
||||
public void setBmi(int bmi) {
|
||||
public void setBmi(Integer bmi) {
|
||||
this.bmi = bmi;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.example.ninefourone.nutritionmaster.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/10/5.
|
||||
*/
|
||||
|
||||
public class ResultList implements Serializable {
|
||||
|
||||
private ArrayList<ClassifyResult> results;
|
||||
|
||||
public ResultList(ArrayList<ClassifyResult> results) {
|
||||
super();
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
public ArrayList<ClassifyResult> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
public void setResults(ArrayList<ClassifyResult> results) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于Intent传递
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String log = "";
|
||||
for (int i = 0; i < results.size(); i++) {
|
||||
log += results.get(i).getName() + ";卡路里" +results.get(i).getCalorie() + "\n";
|
||||
}
|
||||
return log;
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,13 @@ package com.example.ninefourone.nutritionmaster.camera;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.hardware.Camera;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.Display;
|
||||
import android.util.Base64;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
@@ -17,9 +18,20 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.bean.ClassifyResult;
|
||||
import com.example.ninefourone.nutritionmaster.modules.classifyresult.DishResultActivity;
|
||||
import com.example.ninefourone.nutritionmaster.utils.ConstantUtils;
|
||||
import com.example.ninefourone.nutritionmaster.utils.MessageUtils;
|
||||
import com.example.ninefourone.nutritionmaster.utils.WebUtil;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
@@ -28,7 +40,11 @@ import butterknife.OnClick;
|
||||
* Created by ScorpioMiku on 2018/9/3.
|
||||
*/
|
||||
|
||||
public class FoodMaterialCamera extends AppCompatActivity {
|
||||
public class ClassifierCamera extends AppCompatActivity {
|
||||
|
||||
public static int MATERAIL_CODE = 0;
|
||||
public static int DISH_CODE = 1;
|
||||
|
||||
@BindView(R.id.camera_preview)
|
||||
FrameLayout mCameraLayout;
|
||||
@BindView(R.id.results_text_view)
|
||||
@@ -37,20 +53,22 @@ public class FoodMaterialCamera extends AppCompatActivity {
|
||||
ImageView moreTakePhotoButtonCapture;
|
||||
@BindView(R.id.more_takephoto_ok)
|
||||
ImageView moreTakephotoOk;
|
||||
@BindView(R.id.more_camera_cover_linearlayout)
|
||||
FrameLayout moreCameraCoverLinearlayout;
|
||||
@BindView(R.id.camera_cover_linearlayout)
|
||||
FrameLayout cameraCoverLinearlayout;
|
||||
|
||||
private Camera mCamera;
|
||||
private CameraPreview mPreview;
|
||||
private int mCameraId = Camera.CameraInfo.CAMERA_FACING_BACK;
|
||||
|
||||
private int widthPixel;
|
||||
private float heightPixel;
|
||||
private ArrayList<ClassifyResult> resultList = new ArrayList<>();
|
||||
|
||||
private int code = -1;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Intent intent = getIntent();
|
||||
code = intent.getIntExtra("CODE", -1);
|
||||
//取消toolbar
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
//设置全屏
|
||||
@@ -59,9 +77,6 @@ public class FoodMaterialCamera extends AppCompatActivity {
|
||||
//注意:上面两个设置必须写在setContentView前面
|
||||
setContentView(R.layout.cameras_layout);
|
||||
ButterKnife.bind(this);
|
||||
Display display = getWindowManager().getDefaultDisplay();
|
||||
widthPixel = display.getWidth();
|
||||
heightPixel = display.getHeight() * (14.0f / 16);
|
||||
|
||||
if (!checkCameraHardware(this)) {
|
||||
MessageUtils.MakeToast("不支持相机");
|
||||
@@ -101,13 +116,6 @@ public class FoodMaterialCamera extends AppCompatActivity {
|
||||
if (null == mCamera) {
|
||||
mCamera = getCameraInstance();
|
||||
mPreview = new CameraPreview(this, mCamera);
|
||||
// mPreview.setOnTouchListener(new View.OnTouchListener() {
|
||||
// @Override
|
||||
// public boolean onTouch(View v, MotionEvent event) {
|
||||
// mCamera.autoFocus(null);
|
||||
// return false;
|
||||
// }
|
||||
// });
|
||||
mCameraLayout.addView(mPreview);
|
||||
mCamera.startPreview();
|
||||
}
|
||||
@@ -124,8 +132,10 @@ public class FoodMaterialCamera extends AppCompatActivity {
|
||||
c = Camera.open();
|
||||
|
||||
Camera.Parameters mParameters = c.getParameters();
|
||||
Logger.d(widthPixel+", "+heightPixel);
|
||||
mParameters.setPictureSize(widthPixel, (int) heightPixel);
|
||||
List<Camera.Size> sizes = mParameters.getSupportedPreviewSizes();
|
||||
|
||||
mParameters.setPictureSize(2048, 1536);
|
||||
mParameters.setPreviewSize(2048, 1536);
|
||||
c.setParameters(mParameters);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -152,7 +162,46 @@ public class FoodMaterialCamera extends AppCompatActivity {
|
||||
private Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() {
|
||||
@Override
|
||||
public void onPictureTaken(final byte[] data, Camera camera) {
|
||||
MessageUtils.MakeToast("拍照!");
|
||||
try {
|
||||
String imgStr = Base64.encodeToString(data, Base64.DEFAULT);
|
||||
String imgParam = URLEncoder.encode(imgStr, "UTF-8");
|
||||
final String param = "image=" + imgParam + "&top_num=" + 1;
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String result = null;
|
||||
try {
|
||||
if (code == 0) {
|
||||
result = WebUtil.HttpPost(ConstantUtils.BD_DISH_URL,
|
||||
ConstantUtils.BD_ACCESS_TOKEN, param);
|
||||
} else if (code == 1) {
|
||||
result = WebUtil.HttpPost(ConstantUtils.BD_DISH_URL,
|
||||
ConstantUtils.BD_ACCESS_TOKEN, param);
|
||||
} else {
|
||||
Logger.e("拍照code为-1");
|
||||
}
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
ClassifyResult classifyResult = new ClassifyResult();
|
||||
JSONArray resultObject = jsonObject.getJSONArray("result");
|
||||
jsonObject = resultObject.getJSONObject(0);
|
||||
classifyResult.setCalorie(jsonObject.getInt("calorie"));
|
||||
classifyResult.setHas_calorie(jsonObject.getBoolean("has_calorie"));
|
||||
classifyResult.setProbability(jsonObject.getDouble("probability"));
|
||||
classifyResult.setName(jsonObject.getString("name"));
|
||||
classifyResult.getMenu();
|
||||
// Logger.d(classifyResult);
|
||||
resultList.add(classifyResult);
|
||||
refreshUI();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
thread.start();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// MessageUtils.MakeToast("拍照!");
|
||||
mCamera.startPreview();
|
||||
}
|
||||
};
|
||||
@@ -168,8 +217,16 @@ public class FoodMaterialCamera extends AppCompatActivity {
|
||||
switch (view.getId()) {
|
||||
case R.id.more_take_photo_button_capture:
|
||||
mCamera.autoFocus(mAutoFocusCallback);
|
||||
cameraCoverLinearlayout.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case R.id.more_takephoto_ok:
|
||||
Intent intent = new Intent(ClassifierCamera.this, DishResultActivity.class);
|
||||
intent.putExtra("LIST", resultList);
|
||||
// intent.putExtra("LIST", ConstantUtils.testData);
|
||||
startActivity(intent);
|
||||
resultList.clear();
|
||||
refreshUI();
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -209,4 +266,19 @@ public class FoodMaterialCamera extends AppCompatActivity {
|
||||
}
|
||||
camera.setDisplayOrientation(result);
|
||||
}
|
||||
|
||||
|
||||
private void refreshUI() {
|
||||
resultsTextView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String text = "";
|
||||
for (int i = 0; i < resultList.size(); i++) {
|
||||
text += resultList.get(i).getName() + " ";
|
||||
}
|
||||
resultsTextView.setText(text);
|
||||
cameraCoverLinearlayout.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -211,11 +211,11 @@ public class CardItemTouchCallBack extends ItemTouchHelper.Callback {
|
||||
*/
|
||||
@Override
|
||||
public float getSwipeEscapeVelocity(float defaultValue) {
|
||||
Log.d(TAG, "getSwipeEscapeVelocity: " + defaultValue);
|
||||
View topView = mRecyclerView.getChildAt(mRecyclerView.getChildCount() - 1);
|
||||
if (isUpOrDown(topView)) { //如果是向上或者向下滑动
|
||||
return Float.MAX_VALUE; //就返回阈值为很大
|
||||
}
|
||||
// Log.d(TAG, "getSwipeEscapeVelocity: " + defaultValue);
|
||||
// View topView = mRecyclerView.getChildAt(mRecyclerView.getChildCount() - 1);
|
||||
// if (isUpOrDown(topView)) { //如果是向上或者向下滑动
|
||||
// return Float.MAX_VALUE; //就返回阈值为很大
|
||||
// }
|
||||
return super.getSwipeEscapeVelocity(defaultValue);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,13 +19,12 @@ import android.widget.TextView;
|
||||
|
||||
import com.ToxicBakery.viewpager.transforms.CubeOutTransformer;
|
||||
import com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.cb.ratingbar.CBRatingBar;
|
||||
import com.example.ninefourone.nutritionmaster.NutritionMaster;
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.adapter.HomePagerAdapter;
|
||||
import com.example.ninefourone.nutritionmaster.base.BaseActivity;
|
||||
import com.example.ninefourone.nutritionmaster.camera.FoodMaterialCamera;
|
||||
import com.example.ninefourone.nutritionmaster.camera.ClassifierCamera;
|
||||
import com.example.ninefourone.nutritionmaster.modules.addinformation.AddInformationActivity;
|
||||
import com.example.ninefourone.nutritionmaster.modules.addinformation.AddPhysiqueActivity;
|
||||
import com.example.ninefourone.nutritionmaster.modules.information.InformationActivity;
|
||||
@@ -316,14 +315,24 @@ public class MainActivity extends BaseActivity {
|
||||
@Override
|
||||
public void onBoomButtonClick(int index) {
|
||||
Intent cameraIntent = new Intent(MainActivity.this,
|
||||
FoodMaterialCamera.class);
|
||||
ClassifierCamera.class);
|
||||
cameraIntent.putExtra("CODE", ClassifierCamera.MATERAIL_CODE);
|
||||
startActivity(cameraIntent);
|
||||
}
|
||||
});
|
||||
boomMenuButton.addBuilder(builder);
|
||||
HamButton.Builder builder2 = new HamButton.Builder()
|
||||
.normalImageRes(R.drawable.foods)
|
||||
.normalTextRes(R.string.food_title);
|
||||
.normalTextRes(R.string.food_title)
|
||||
.listener(new OnBMClickListener() {
|
||||
@Override
|
||||
public void onBoomButtonClick(int index) {
|
||||
Intent cameraIntent = new Intent(MainActivity.this,
|
||||
ClassifierCamera.class);
|
||||
cameraIntent.putExtra("CODE", ClassifierCamera.DISH_CODE);
|
||||
startActivity(cameraIntent);
|
||||
}
|
||||
});
|
||||
boomMenuButton.addBuilder(builder2);
|
||||
}
|
||||
|
||||
@@ -332,7 +341,7 @@ public class MainActivity extends BaseActivity {
|
||||
* 初始化个人信息界面(UI)
|
||||
*/
|
||||
private void initInforView() {
|
||||
// Logger.d(NutritionMaster.user.toString());
|
||||
|
||||
adderInfor.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
|
||||
if (NutritionMaster.user.getHeight() != 0) {
|
||||
showInformation.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.base.BaseActivity;
|
||||
import com.example.ninefourone.nutritionmaster.bean.MyUser;
|
||||
import com.example.ninefourone.nutritionmaster.modules.MainActivity;
|
||||
import com.example.ninefourone.nutritionmaster.utils.CalculateUtils;
|
||||
import com.example.ninefourone.nutritionmaster.utils.ConstantUtils;
|
||||
import com.example.ninefourone.nutritionmaster.utils.MessageUtils;
|
||||
|
||||
@@ -148,14 +149,14 @@ public class AddInformationActivity extends BaseActivity {
|
||||
public void onClick(View v) {
|
||||
|
||||
if (ageTextView.getText().toString().equals("年龄") || weightTextView.getText().toString().equals("体重")
|
||||
|| sexTextView.getText().toString().equals("性别") || heightTextView.getText().toString().equals("身高")||
|
||||
|| sexTextView.getText().toString().equals("性别") || heightTextView.getText().toString().equals("身高") ||
|
||||
occupationTextView.getText().toString().equals("职业")) {
|
||||
MessageUtils.MakeToast("请点击图片填写所有信息");
|
||||
} else {
|
||||
user.setHeight(Integer.valueOf(heightTextView.getText().toString().split("c")[0]));
|
||||
user.setWeight(Integer.valueOf(weightTextView.getText().toString().split("k")[0]));
|
||||
user.setAge(Integer.valueOf(ageTextView.getText().toString().split("岁")[0]));
|
||||
user.setSex(sexTextView.getText().toString());
|
||||
user.setSex(CalculateUtils.sex2int(sexTextView.getText().toString()));
|
||||
user.setOccupation_name(occupationTextView.getText().toString());
|
||||
upUser();
|
||||
MessageUtils.MakeToast("信息填写成功");
|
||||
|
||||
@@ -390,7 +390,7 @@ public class AddPhysiqueActivity extends BaseActivity {
|
||||
phy.setMentality(ConstantUtils.physiquesMentalitys[maxIndex]);
|
||||
phy.setMatters(ConstantUtils.physiquesMatters[maxIndex]);
|
||||
phy.setImageUrl(ConstantUtils.physiquesImageUrls[maxIndex]);
|
||||
user.setPhysique(phy);
|
||||
user.setPhysical_name(physique);
|
||||
upUser();
|
||||
loadInformation(phy);
|
||||
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.example.ninefourone.nutritionmaster.modules.classifyresult;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.adapter.ResultListAdapter;
|
||||
import com.example.ninefourone.nutritionmaster.base.BaseActivity;
|
||||
import com.example.ninefourone.nutritionmaster.bean.ClassifyResult;
|
||||
import com.example.ninefourone.nutritionmaster.utils.ConstantUtils;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
||||
public class DishResultActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.recycler_view)
|
||||
RecyclerView recyclerView;
|
||||
@BindView(R.id.calorie)
|
||||
TextView calorie;
|
||||
@BindView(R.id.suger)
|
||||
TextView suger;
|
||||
@BindView(R.id.fat)
|
||||
TextView fat;
|
||||
@BindView(R.id.protein)
|
||||
TextView protein;
|
||||
@BindView(R.id.ok_button)
|
||||
Button okButton;
|
||||
|
||||
|
||||
private ArrayList<ClassifyResult> results;
|
||||
private ResultListAdapter resultListAdapter;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.activity_dish_result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initViews(Bundle savedInstanceState) {
|
||||
Intent intent = getIntent();
|
||||
results = (ArrayList<ClassifyResult>) intent.getSerializableExtra("LIST");
|
||||
// for (int i = 0; i < results.size(); i++) {
|
||||
// Logger.d(results.get(i));
|
||||
// }
|
||||
results = ConstantUtils.testData;
|
||||
resultListAdapter = new ResultListAdapter(results, this);
|
||||
recyclerView.setAdapter(resultListAdapter);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initToolBar() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPointerCaptureChanged(boolean hasCapture) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 能量根据选择的来变
|
||||
*
|
||||
* @param quantity
|
||||
*/
|
||||
public void refreshData(int quantity, int positon) {
|
||||
float calorieSum = 0;
|
||||
float fatSum = 0;
|
||||
float sugarSum = 0;
|
||||
float proteinSum = 0;
|
||||
ClassifyResult temp = results.get(positon);
|
||||
temp.setQuantity(quantity);
|
||||
results.set(positon, temp);
|
||||
for (int i = 0; i < results.size(); i++) {
|
||||
calorieSum += results.get(i).getCalorie() * results.get(i).getQuantity() / 100;
|
||||
fatSum += results.get(i).getCalorie() * results.get(i).getQuantity() / 100;
|
||||
calorieSum += results.get(i).getCalorie() * results.get(i).getQuantity() / 100;
|
||||
calorieSum += results.get(i).getCalorie() * results.get(i).getQuantity() / 100;
|
||||
}
|
||||
calorie.setText((int)calorieSum + "");
|
||||
protein.setText((int)proteinSum + "");
|
||||
fat.setText((int)fatSum + "");
|
||||
suger.setText((int)sugarSum + "");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +1,32 @@
|
||||
package com.example.ninefourone.nutritionmaster.modules.information;
|
||||
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
public class InformationActivity extends AppCompatActivity {
|
||||
|
||||
@BindView(R.id.back_button)
|
||||
ImageView backButton;
|
||||
@BindView(R.id.title_text)
|
||||
TextView titleText;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_information);
|
||||
ButterKnife.bind(this);
|
||||
}
|
||||
|
||||
@OnClick(R.id.back_button)
|
||||
public void onViewClicked() {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,52 @@
|
||||
package com.example.ninefourone.nutritionmaster.modules.viewpagerfragments.customization;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.base.BaseActivity;
|
||||
import com.example.ninefourone.nutritionmaster.bean.FoodMenu;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
public class CustomizationActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.breakfast_energy_text)
|
||||
TextView breakfastEnergyText;
|
||||
@BindView(R.id.breakfast_recycler_view)
|
||||
RecyclerView breakfastRecyclerView;
|
||||
@BindView(R.id.lunch_energy_text)
|
||||
TextView lunchEnergyText;
|
||||
@BindView(R.id.lunch_recycler_view)
|
||||
RecyclerView lunchRecyclerView;
|
||||
@BindView(R.id.dinner_energy_text)
|
||||
TextView dinnerEnergyText;
|
||||
@BindView(R.id.dinner_recycler_view)
|
||||
RecyclerView dinnerRecyclerView;
|
||||
@BindView(R.id.calorie_text)
|
||||
TextView calorieText;
|
||||
@BindView(R.id.fat_text)
|
||||
TextView fatText;
|
||||
@BindView(R.id.suger_text)
|
||||
TextView sugerText;
|
||||
@BindView(R.id.protein_text)
|
||||
TextView proteinText;
|
||||
@BindView(R.id.change_button)
|
||||
LinearLayout changeButton;
|
||||
@BindView(R.id.copy_button)
|
||||
LinearLayout copyButton;
|
||||
|
||||
private ArrayList<FoodMenu> breakfastList = new ArrayList<>();
|
||||
private ArrayList<FoodMenu> lunchList = new ArrayList<>();
|
||||
private ArrayList<FoodMenu> dinnerList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -27,6 +61,7 @@ public class CustomizationActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public void initViews(Bundle savedInstanceState) {
|
||||
loadData();
|
||||
String text = getIntent().getStringExtra("SEND_CODE");
|
||||
Logger.d(text);
|
||||
}
|
||||
@@ -40,4 +75,20 @@ public class CustomizationActivity extends BaseActivity {
|
||||
public void onPointerCaptureChanged(boolean hasCapture) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadData() {
|
||||
super.loadData();
|
||||
|
||||
}
|
||||
|
||||
@OnClick({R.id.change_button, R.id.copy_button})
|
||||
public void onViewClicked(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.change_button:
|
||||
break;
|
||||
case R.id.copy_button:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.example.ninefourone.nutritionmaster.base.BaseFragment;
|
||||
import com.example.ninefourone.nutritionmaster.bean.RecommendFood;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
@@ -22,6 +23,9 @@ import android.view.LayoutInflater;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.Response;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/8/26.
|
||||
@@ -84,20 +88,12 @@ public class RecommendFragment extends BaseFragment {
|
||||
recyclerView.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
Logger.d("加载数据");
|
||||
for (int i = 0; i < 6; i++) {
|
||||
RecommendFood recommendFood = new RecommendFood(1, "烧肉", "好吃", indexs[i % 4]);
|
||||
adapter.getData().add(recommendFood);
|
||||
}
|
||||
adapter.loadMoreComplete();
|
||||
// Logger.d("开始加载");
|
||||
addData();
|
||||
}
|
||||
|
||||
}, 1000);
|
||||
}
|
||||
}, recyclerView);
|
||||
// adapter.disableLoadMoreIfNotFullPage();
|
||||
adapter.setEnableLoadMore(true);
|
||||
adapter.setHeaderView(LayoutInflater.from(getContext()).
|
||||
inflate(R.layout.recommend_head, (ViewGroup) recyclerView.getParent(), false));
|
||||
@@ -126,17 +122,42 @@ public class RecommendFragment extends BaseFragment {
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载数据
|
||||
* 初始化数据
|
||||
* 病 、 体质 、 职业
|
||||
* 0-4 5-7 8-10
|
||||
*/
|
||||
@Override
|
||||
protected void loadData() {
|
||||
super.loadData();
|
||||
for (int i = 0; i < 11; i++) {
|
||||
RecommendFood recommendFood = new RecommendFood(1, "烧肉", "好吃", indexs[i % 4]);
|
||||
int flag = indexs[i % 4];
|
||||
RecommendFood recommendFood = new RecommendFood(1, "烧肉", "好吃", flag);
|
||||
datas.add(recommendFood);
|
||||
// if (flag == 2) {
|
||||
//
|
||||
// } else {
|
||||
//
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载新数据
|
||||
*/
|
||||
private void addData() {
|
||||
// Logger.d("加载数据");
|
||||
for (int i = 0; i < 7; i++) {
|
||||
int flag = indexs[i % 4];
|
||||
if (flag == 2) {
|
||||
|
||||
} else {
|
||||
RecommendFood recommendFood = new RecommendFood(1, "烧肉", "好吃", flag);
|
||||
adapter.getData().add(recommendFood);
|
||||
}
|
||||
}
|
||||
adapter.loadMoreComplete();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断数据是否加载完了(服务器没了)
|
||||
*
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.example.ninefourone.nutritionmaster.utils;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.bean.ClassifyResult;
|
||||
import com.example.ninefourone.nutritionmaster.bean.MyUser;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
@@ -69,7 +72,47 @@ public class CalculateUtils {
|
||||
*/
|
||||
public static int getWeek() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
Logger.d( calendar.get(Calendar.DAY_OF_WEEK));
|
||||
return calendar.get(Calendar.DAY_OF_WEEK)-1;
|
||||
// Logger.d( calendar.get(Calendar.DAY_OF_WEEK));
|
||||
return calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 性别转数字
|
||||
* @param sex
|
||||
* @return
|
||||
*/
|
||||
public static int sex2int(String sex) {
|
||||
if (sex.equals("男")) {
|
||||
return 1;
|
||||
} else if (sex.equals("女")) {
|
||||
return 0;
|
||||
} else {
|
||||
Logger.e("不男不女");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算每个食物吃多少
|
||||
*
|
||||
* @param classifyResultArrayList
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static ArrayList<ClassifyResult> getDishQuantity(
|
||||
ArrayList<ClassifyResult> classifyResultArrayList, MyUser user) {
|
||||
double calorieSum = 0;
|
||||
double[] calories = new double[classifyResultArrayList.size()];
|
||||
double[] quantitys = new double[classifyResultArrayList.size()];
|
||||
float baseQuantity = 600f;
|
||||
for (int i = 0; i < classifyResultArrayList.size(); i++) {
|
||||
calorieSum += classifyResultArrayList.get(i).getCalorie();
|
||||
calories[i] = classifyResultArrayList.get(i).getCalorie();
|
||||
}
|
||||
for (int i = 0; i < classifyResultArrayList.size(); i++) {
|
||||
classifyResultArrayList.get(i).setQuantity(calories[i] / calorieSum * baseQuantity);
|
||||
}
|
||||
return classifyResultArrayList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.example.ninefourone.nutritionmaster.utils;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.bean.ClassifyResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
@@ -11,6 +13,7 @@ public class ConstantUtils {
|
||||
public static String[] dailyDescibes = {"快乐陪周一", "幸运伴周二", "轻松有周三", "温馨携周四",
|
||||
"愉悦同周五", "休闲找周六", "潇洒属周日"};
|
||||
|
||||
|
||||
public static String arab2Chinese(int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
@@ -267,4 +270,32 @@ public class ConstantUtils {
|
||||
"平和质人阴阳气血平衡,药膳调理不可偏补、贪补,以保持人体阴阳平衡状态最为紧要。所谓“不伤不扰,顺其自然”。"
|
||||
};
|
||||
|
||||
public static String BD_API_KEY = "GQfoj7AUUhj67ocHuwvA8G5q";
|
||||
public static String BD_APP_ID = "14346167";
|
||||
public static String BD_SECRET_KEY = "EEXe6pG7QGVdrqDM8eR0S3RY2WPf4Gwn";
|
||||
public static String BD_ACCESS_TOKEN = "";
|
||||
|
||||
public static String BD_DISH_URL = "https://aip.baidubce.com/rest/2.0/image-classify/v2/dish";
|
||||
|
||||
public static ArrayList<ClassifyResult> testData = new ArrayList<>();
|
||||
|
||||
static {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
ClassifyResult classifyResult = new ClassifyResult();
|
||||
classifyResult.setName("酱肉丝" + i);
|
||||
classifyResult.setProbability(0.5 + i);
|
||||
classifyResult.setCalorie(274 + i * 10);
|
||||
testData.add(classifyResult);
|
||||
}
|
||||
}
|
||||
|
||||
public static ArrayList<String> dishPicerData = new ArrayList<>();
|
||||
|
||||
static {
|
||||
for (int i = 0; i <= 700; i++) {
|
||||
if (i % 2 == 0) {
|
||||
dishPicerData.add(i + "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ package com.example.ninefourone.nutritionmaster.utils;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.NutritionMaster;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/8/26.
|
||||
@@ -13,4 +16,6 @@ public class MessageUtils {
|
||||
public static void MakeToast(String message) {
|
||||
Toast.makeText(NutritionMaster.getInstance(), message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,21 @@
|
||||
package com.example.ninefourone.nutritionmaster.utils;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@@ -22,7 +36,7 @@ public class WebUtil {
|
||||
private static WebUtil instance = new WebUtil();
|
||||
private OkHttpClient mClient = new OkHttpClient();
|
||||
|
||||
private WebUtil() {
|
||||
public WebUtil() {
|
||||
}
|
||||
|
||||
public static WebUtil getInstance() {
|
||||
@@ -408,6 +422,54 @@ public class WebUtil {
|
||||
mClient.newCall(request).enqueue(callback);
|
||||
}
|
||||
|
||||
public static String HttpPost(String requestUrl, String accessToken, String params) throws Exception {
|
||||
System.out.println(params);
|
||||
String generalUrl = "";
|
||||
generalUrl = requestUrl + "?access_token=" + accessToken;
|
||||
System.out.println("发送的连接为:" + generalUrl);
|
||||
URL url = new URL(generalUrl);
|
||||
// 打开和URL之间的连接
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
System.out.println("打开链接,开始发送请求" + new Date().getTime() / 1000);
|
||||
connection.setRequestMethod("POST");
|
||||
// 设置通用的请求属性
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
connection.setRequestProperty("Connection", "Keep-Alive");
|
||||
connection.setUseCaches(false);
|
||||
connection.setDoOutput(true);
|
||||
connection.setDoInput(true);
|
||||
|
||||
// 得到请求的输出流对象
|
||||
DataOutputStream out = new DataOutputStream(connection.getOutputStream());
|
||||
out.writeBytes(params);
|
||||
out.flush();
|
||||
out.close();
|
||||
|
||||
// 建立实际的连接
|
||||
connection.connect();
|
||||
// 获取所有响应头字段
|
||||
Map<String, List<String>> headers = connection.getHeaderFields();
|
||||
// 遍历所有的响应头字段
|
||||
for (String key : headers.keySet()) {
|
||||
System.out.println(key + "--->" + headers.get(key));
|
||||
}
|
||||
// 定义 BufferedReader输入流来读取URL的响应
|
||||
BufferedReader in = null;
|
||||
if (requestUrl.contains("nlp"))
|
||||
in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "GBK"));
|
||||
else
|
||||
in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
|
||||
String result = "";
|
||||
String getLine;
|
||||
while ((getLine = in.readLine()) != null) {
|
||||
result += getLine;
|
||||
}
|
||||
in.close();
|
||||
System.out.println("请求结束" + new Date().getTime() / 1000);
|
||||
System.out.println("result:" + result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Map<String, Double> params = new HashMap<>();
|
||||
params.put("calorie", 100.0);
|
||||
BIN
app/src/main/res/drawable/camera_bg.jpg
Normal file
BIN
app/src/main/res/drawable/camera_bg.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
6
app/src/main/res/drawable/ic_calorie.xml
Normal file
6
app/src/main/res/drawable/ic_calorie.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<vector android:height="24dp" android:viewportHeight="1024.0"
|
||||
android:viewportWidth="1024.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#8b37c1" android:pathData="M504.3,998.4h-11.8c-150.5,0 -258,-43 -319.5,-128 -41.5,-57.3 -61.4,-132.6 -61.4,-230.4 0,-160.3 112.1,-411.1 427.5,-588.8l45.1,-25.6 -23,46.6c-28.2,56.8 -8.7,142.8 10.8,180.7C614.4,224.3 655.4,204.8 675.8,195.1c5.1,-2.6 9.2,-4.1 11.8,-5.6l58.9,-31.2 -37.9,54.8c-47.1,68.1 -43.5,154.1 -37.4,192 101.9,-49.7 185.9,-52.2 189.4,-52.2l60.9,-1.5 -52.2,31.2c-5.6,3.1 -125.4,79.4 -63,289.8 33.3,102.4 -22.5,214 -75.3,255 -42.5,34.8 -102.9,71.2 -226.8,71.2zM518.7,100.4C242.7,269.3 143.4,494.1 143.4,640c0,91.1 17.9,160.3 55.3,211.5 55.3,75.8 154.1,114.7 293.9,114.7 121.9,2 178.7,-31.2 218.1,-64 44.5,-34.8 93.2,-133.1 65,-220.7 -46.1,-154.6 -1.5,-245.2 36.9,-290.3 -36.4,7.2 -88.6,21.5 -144.9,51.7l-12.3,6.7 -8.2,-11.3c-6.7,-9.2 -27.6,-107 10.2,-197.6 -23,11.8 -51.7,28.2 -80.4,49.2l-12.3,9.2 -9.7,-11.8c-24.1,-30.7 -49.7,-115.7 -36.4,-186.9z"/>
|
||||
<path android:fillColor="#B83EFF" android:pathData="M702,841.7c-24.1,40.4 -139.8,90.6 -237.6,88.6 -108.5,9.2 -195.6,-40.4 -222.2,-92.7 -74.2,-144.9 32.8,-239.1 26.6,-228.4 -5.6,10.8 -7.2,133.1 111.6,181.2C307.2,702 415.2,517.1 510.5,477.7c-48.6,179.2 87,263.7 87,263.7s27.6,18.9 66.6,-171c74.8,91.1 77.8,230.4 37.9,271.4z"/>
|
||||
<path android:fillColor="#3c3043" android:pathData="M438.3,947.2c-103.9,0 -182.8,-49.2 -209.9,-102.4 -67.6,-132.6 5.6,-229.4 29.2,-247.8 11.8,-9.2 21,-2.6 22.5,-1l10.2,8.7 -6.1,11.3c-2.6,12.3 -1,87 60.9,135.7 -5.6,-25.1 -5.1,-54.3 3.1,-86 21.5,-86 90.6,-175.1 157.7,-202.8l30.2,-12.3 -8.7,31.2c-38.9,143.4 48.1,222.2 73.2,241.2 7.2,-9.2 25.6,-43 49.2,-156.2l6.7,-33.3 21.5,26.6c76.3,94.7 84.5,240.1 37.4,291.3 -28.7,44.5 -146.9,97.3 -249.9,95.2 -9.2,0.5 -18.4,0.5 -27.1,0.5zM253.4,653.8c-19.5,34.8 -37.9,96.3 3.1,176.6 24.1,47.1 104.4,92.2 206.8,84h2c95.7,2 203.8,-47.6 223.2,-80.9l2.6,-3.1c30.2,-30.7 30.2,-137.7 -17.9,-220.2 -27.1,118.8 -49.2,140.8 -63.5,146.4 -7.2,3.1 -14.8,2 -20.5,-1.5 -0.5,-0.5 -126.5,-80.9 -100.9,-245.8 -47.6,34.3 -93.7,100.9 -109.6,164.4 -7.7,31.2 -11.8,75.3 14.3,107l39.9,48.6 -58.4,-23.6c-68.6,-27.6 -99.3,-78.3 -112.1,-115.7 -4.1,-12.3 -7.2,-24.6 -9.2,-36.4zM606.2,727.6c0.5,0 0.5,0.5 0.5,0.5 0,-0.5 -0.5,-0.5 -0.5,-0.5zM283.6,616.4c-0.5,0.5 0,0.5 0,0zM284.2,615.4z"/>
|
||||
</vector>
|
||||
@@ -1,6 +1,6 @@
|
||||
<vector android:height="24dp" android:viewportHeight="1024.0"
|
||||
android:viewportWidth="1024.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#f0311e" android:pathData="M896,64h-576v64h576v640h64V64z"/>
|
||||
<path android:fillColor="#f0311e" android:pathData="M512,384h192v64h-192zM256,576h448v64h-448zM256,768h448v64h-448z"/>
|
||||
<path android:fillColor="#f0311e" android:pathData="M320,192l-192,192v576h704L832,192h-512zM320,281.6L320,384h-102.4l102.4,-102.4zM768,896h-576v-448h192v-192h384v640z"/>
|
||||
<path android:fillColor="#363534" android:pathData="M896,64h-576v64h576v640h64V64z"/>
|
||||
<path android:fillColor="#363534" android:pathData="M512,384h192v64h-192zM256,576h448v64h-448zM256,768h448v64h-448z"/>
|
||||
<path android:fillColor="#363534" android:pathData="M320,192l-192,192v576h704L832,192h-512zM320,281.6L320,384h-102.4l102.4,-102.4zM768,896h-576v-448h192v-192h384v640z"/>
|
||||
</vector>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<vector android:height="24dp" android:viewportHeight="1024.0"
|
||||
android:viewportWidth="1024.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#f0311e" android:pathData="M574.6,807.8H381.2c-68.3,0 -125.2,-56.9 -125.2,-125.2V193.4c0,-34.1 -28.4,-62.6 -62.6,-62.6 -34.1,0 -62.6,28.4 -62.6,62.6v534.8c0,119.5 96.7,210.5 210.5,210.5h233.2c34.1,0 62.6,-28.4 62.6,-62.6s-28.4,-68.3 -62.6,-68.3z"/>
|
||||
<path android:fillColor="#f0311e" android:pathData="M682.7,85.3H449.4c-34.1,0 -68.3,28.4 -68.3,62.6s28.4,62.6 62.6,62.6h193.4c68.3,0 125.2,56.9 125.2,125.2v489.2c0,34.1 28.4,62.6 62.6,62.6 34.1,0 62.6,-28.4 62.6,-62.6V295.8c5.7,-113.8 -85.3,-210.5 -204.8,-210.5z"/>
|
||||
<path android:fillColor="#f0311e" android:pathData="M1001.2,659.9c-28.4,-28.4 -68.3,-28.4 -91,0l-125.2,125.2c-28.4,28.4 -28.4,68.3 0,91 28.4,28.4 68.3,28.4 91,0l125.2,-125.2c28.4,-22.8 28.4,-68.3 0,-91z"/>
|
||||
<path android:fillColor="#f0311e" android:pathData="M233.2,147.9c-22.8,-28.4 -62.6,-28.4 -91,0L17.1,273.1c-28.4,28.4 -28.4,68.3 0,91 28.4,28.4 68.3,28.4 91,0l125.2,-125.2c28.4,-22.8 28.4,-68.3 0,-91z"/>
|
||||
<path android:fillColor="#363534" android:pathData="M574.6,807.8H381.2c-68.3,0 -125.2,-56.9 -125.2,-125.2V193.4c0,-34.1 -28.4,-62.6 -62.6,-62.6 -34.1,0 -62.6,28.4 -62.6,62.6v534.8c0,119.5 96.7,210.5 210.5,210.5h233.2c34.1,0 62.6,-28.4 62.6,-62.6s-28.4,-68.3 -62.6,-68.3z"/>
|
||||
<path android:fillColor="#363534" android:pathData="M682.7,85.3H449.4c-34.1,0 -68.3,28.4 -68.3,62.6s28.4,62.6 62.6,62.6h193.4c68.3,0 125.2,56.9 125.2,125.2v489.2c0,34.1 28.4,62.6 62.6,62.6 34.1,0 62.6,-28.4 62.6,-62.6V295.8c5.7,-113.8 -85.3,-210.5 -204.8,-210.5z"/>
|
||||
<path android:fillColor="#363534" android:pathData="M1001.2,659.9c-28.4,-28.4 -68.3,-28.4 -91,0l-125.2,125.2c-28.4,28.4 -28.4,68.3 0,91 28.4,28.4 68.3,28.4 91,0l125.2,-125.2c28.4,-22.8 28.4,-68.3 0,-91z"/>
|
||||
<path android:fillColor="#363534" android:pathData="M233.2,147.9c-22.8,-28.4 -62.6,-28.4 -91,0L17.1,273.1c-28.4,28.4 -28.4,68.3 0,91 28.4,28.4 68.3,28.4 91,0l125.2,-125.2c28.4,-22.8 28.4,-68.3 0,-91z"/>
|
||||
</vector>
|
||||
|
||||
6
app/src/main/res/drawable/ic_fat.xml
Normal file
6
app/src/main/res/drawable/ic_fat.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<vector android:height="24dp" android:viewportHeight="1024.0"
|
||||
android:viewportWidth="1024.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#DCFFFF" android:pathData="M512,512m-512,0a512,512 0,1 0,1024 0,512 512,0 1,0 -1024,0Z"/>
|
||||
<path android:fillColor="#2EDEDC" android:pathData="M331.4,757.8c-11.2,0 -22.3,-1.9 -33.5,-5.6 -24.2,-7.4 -44.7,-26.1 -57.7,-54 -20.5,-42.8 -22.3,-85.6 -3.7,-128.5 5.6,-11.2 13,-26.1 22.3,-41 22.3,-41 55.9,-95 41,-124.7 -5.6,-11.2 -14.9,-20.5 -24.2,-29.8 -16.8,-16.8 -35.4,-48.4 -31.7,-67 1.9,-11.2 7.4,-13 11.2,-16.8 3.7,-3.7 7.4,-7.4 16.8,-9.3 7.4,-1.9 26.1,0 26.1,0 63.3,7.4 122.9,31.7 169.4,68.9 48.4,39.1 83.8,91.2 98.7,152.7 16.8,59.6 1.9,115.4 -42.8,162 -35.4,37.2 -87.5,67 -147.1,83.8 -14.9,5.6 -31.7,9.3 -44.7,9.3zM714.9,763.3c-14.9,0 -31.7,-3.7 -48.4,-13 -20.5,-11.2 -37.2,-27.9 -50.3,-46.5 -14.9,-20.5 -20.5,-42.8 -18.6,-61.4 3.7,-27.9 16.8,-54 27.9,-78.2 13,-27.9 26.1,-54 26.1,-81.9 0,0 5.6,-16.8 11.2,-18.6 5.6,-3.7 16.8,9.3 16.8,9.3 9.3,14.9 24.2,33.5 41,50.3 39.1,46.5 83.8,98.7 78.2,150.8 -1.9,26.1 -16.8,52.1 -44.7,72.6 -9.3,13 -24.2,16.8 -39.1,16.8z"/>
|
||||
<path android:fillColor="#DCFFFF" android:pathData="M443.1,670.3l-14.9,-24.2 3.7,-3.7c33.5,-37.2 55.9,-67 46.5,-111.7l22.3,-9.3c7.4,29.8 3.7,59.6 -9.3,87.5 -11.2,22.3 -27.9,41 -42.8,57.7 -3.7,1.9 -5.6,1.9 -5.6,3.7z"/>
|
||||
</vector>
|
||||
@@ -1,4 +1,5 @@
|
||||
<vector android:height="24dp" android:viewportHeight="1024.0"
|
||||
android:viewportWidth="1024.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#ffffff" android:pathData="M512,62.4c-248.3,0 -449.6,201.3 -449.6,449.6s201.3,449.6 449.6,449.6 449.6,-201.3 449.6,-449.6S760.3,62.4 512,62.4zM728.1,403.9 L478.8,653.3c-4.6,4.6 -10.6,6.9 -16.6,6.9s-12,-2.3 -16.6,-6.9c-37.4,-37.4 -149.6,-149.6 -149.6,-149.6 -9.2,-9.2 -9.2,-24.1 0,-33.2 9.2,-9.2 24.1,-9.2 33.2,0l133,109.5 232.7,-209.2c9.2,-9.2 24.1,-9.2 33.2,0C737.3,379.9 737.3,394.8 728.1,403.9z"/>
|
||||
<path android:fillColor="#4fa67c" android:pathData="M512,512m-512,0a512,512 0,1 0,1024 0,512 512,0 1,0 -1024,0Z"/>
|
||||
<path android:fillColor="#FFFFFF" android:pathData="M227.5,554.3l112.6,-92.2 92.2,92.2s174.1,-163.8 322.6,-250.9v61.4c-204.8,189.4 -332.8,394.2 -332.8,394.2l-194.6,-204.8z"/>
|
||||
</vector>
|
||||
|
||||
5
app/src/main/res/drawable/ic_protein.xml
Normal file
5
app/src/main/res/drawable/ic_protein.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:viewportHeight="1024.0"
|
||||
android:viewportWidth="1024.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#DCFFFF" android:pathData="M512,512m-512,0a512,512 0,1 0,1024 0,512 512,0 1,0 -1024,0Z"/>
|
||||
<path android:fillColor="#2EDEDC" android:pathData="M679.6,376.1s9.3,5.6 16.8,20.5c9.3,14.9 18.6,39.1 20.5,81.9 0,5.6 3.7,9.3 9.3,11.2h3.7c5.6,0 11.2,-5.6 11.2,-11.2 -3.7,-95 -50.3,-121 -50.3,-122.9 0,0 -1.9,0 -1.9,-1.9 -5.6,-1.9 -11.2,1.9 -14.9,7.4 0,7.4 1.9,13 5.6,14.9zM620,538.1c-5.6,-70.7 -37.2,-145.2 -83.8,-195.5 42.8,-35.4 91.2,-52.1 137.8,-39.1 91.2,27.9 130.3,176.9 96.8,292.3 -33.5,115.4 -128.5,163.8 -219.7,137.8 -3.7,0 -3.7,-1.9 -7.4,-3.7 52.1,-37.2 85.6,-104.3 76.3,-191.8zM426.4,363.1s9.3,3.7 24.2,13c13,9.3 31.7,29.8 48.4,68.9 1.9,3.7 7.4,7.4 11.2,7.4 1.9,0 3.7,0 3.7,-1.9 5.6,-3.7 9.3,-9.3 5.6,-16.8 -37.2,-87.5 -89.4,-95 -89.4,-95h-1.9c-5.6,0 -9.3,5.6 -9.3,13 -1.9,5.6 3.7,11.2 7.4,11.2zM394.7,297.9c95,-9.3 184.3,117.3 193.6,238.3s-61.4,199.2 -156.4,208.5c-95,9.3 -178.7,-57.7 -189.9,-176.9 -7.4,-122.9 57.7,-262.5 152.7,-270z"/>
|
||||
</vector>
|
||||
10
app/src/main/res/drawable/ic_sugar.xml
Normal file
10
app/src/main/res/drawable/ic_sugar.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector android:height="24dp" android:viewportHeight="1024.0"
|
||||
android:viewportWidth="1024.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF694B" android:pathData="M894.9,375.3c-12.9,-40.1 77.6,-66.8 38.8,-109.3 -46.7,-51.2 -105.7,10.5 -108.9,-20.6s-33,-97 -77.4,-50.4c-48.3,50.7 -41.1,108.5 -41.1,108.5l5.9,12.9c-72.8,-47 -192.4,-41.8 -300.9,20.8 -108.6,62.7 -173,164 -168.4,250.6l-4.8,-7.6s-44.6,-37.5 -113.4,-24.6c-63.3,11.8 -24.3,72.7 0.1,92.3s-59.5,35.5 -42,102.5c14.5,55.7 86.1,-5.6 112.7,27 19.9,24.4 -5.8,74.4 37.8,66.8 71.4,-12.5 98.5,-116 98.5,-116l-12.6,-19.9c73.5,40.3 187.3,32.7 290.8,-27.1 97,-56 158.7,-142.8 167.6,-222.5l1.8,3.9s101.5,33.6 151,-19.4c30.1,-32.2 -25.8,-37.9 -35.5,-67.9z"/>
|
||||
<path android:fillColor="#E5391C" android:pathData="M707.8,285.3l-6.4,52.4s39.5,50.5 37.8,87.7c-3.5,76 -63.9,146.7 -153.7,198.6 -97.5,56.3 -205.2,71.3 -272.1,26.8 -23.1,-15.4 -59.1,-73.7 -57.4,-73.7l-25.8,-4.2 -14.8,-6.2c-7.1,167.2 93.2,187.6 99.9,187.3l6.6,-44c73.5,38.8 186,30.8 288.4,-28.3 99.9,-57.7 161,-136.7 166.9,-218.2 0,0 22.9,5 30.6,6.4 7.1,1.3 16,2.1 16,2.1 9.3,-150.3 -109.3,-186.7 -116,-186.7z"/>
|
||||
<path android:fillColor="#FFFFFF" android:pathData="M845.5,281.7c3,28.6 52.9,-20.8 97.2,10.5 1.5,-8.2 -0.5,-16.8 -9.1,-26.2 -34.1,-37.3 -74.6,-14.7 -95.3,-11.8 4,9.9 6.4,19.8 7.2,27.5zM726.9,338.2c-0.7,-8.5 -2.9,-60.4 41.3,-106.8 21.2,-22.2 39,-18.8 52.2,-5.8 -10.3,-31.8 -36.8,-68.6 -73,-30.5 -48.3,50.7 -41.1,108.5 -41.1,108.5l19.7,43 0.9,-8.4zM254.5,606.1l-15.7,-27.3s-45.2,-36 -114,-23.1c-43.9,8.2 -38.5,40 -23,65.3 3.3,-10.7 13,-19.3 33,-23 68.8,-12.8 113.4,24.6 113.4,24.6l3,4.8 3.3,-21.3zM91.1,766.7c6.5,-45.5 64.5,-59.6 43.7,-76.4 -5.5,-4.5 -11.7,-11.1 -17.4,-18.7 -17.1,15.3 -45.5,37.2 -34.6,78.9 1.8,7.3 4.7,12.5 8.3,16.2z"/>
|
||||
<path android:fillColor="#FFE200" android:pathData="M336.1,389.3c-1.5,6 21,337.5 21,337.5s108,12 111,6 -18,-418.5 -18,-418.5 -112.5,69 -114,75z"/>
|
||||
<path android:fillColor="#FFFFFF" android:pathData="M759.8,365.1c-54.9,-95 -210.9,-107.7 -348.5,-28.2 -127.8,73.8 -194.5,200.9 -159.5,294.8 -2.1,-85.6 61.9,-184.4 168.6,-246C558,306.3 714,318.9 768.8,414c3.9,6.8 7.1,13.9 9.7,21.1 -0.5,-24.9 -6.4,-48.6 -18.7,-70z"/>
|
||||
<path android:fillColor="#FFE200" android:pathData="M556.6,293.3c-1.5,6 25.5,406.5 25.5,406.5s99,-63 102,-69 -21,-336 -21,-336 -105,-7.5 -106.5,-1.5z"/>
|
||||
<path android:fillColor="#662F0A" android:pathData="M930.4,388c-8,-5.9 -16.3,-12 -18.3,-18.2 -2.3,-7 6.7,-16.9 19.5,-30.1 18.1,-18.6 48.3,-49.7 15.4,-85.8 -34.9,-38.2 -76.7,-26.6 -99.2,-20.3 -2,0.6 -4.2,1.2 -6.4,1.7 -4.7,-23.5 -20.1,-62 -49.6,-72.1 -13.5,-4.5 -34.3,-4.9 -57.5,19.4 -34.8,36.5 -43.9,76.4 -45.9,100.6 -78.2,-31.3 -186.6,-20.5 -284.7,36.2 -8.6,5 -11.5,16 -6.6,24.6 5,8.6 16,11.6 24.6,6.6 2.3,-1.3 4.6,-2.4 6.8,-3.6l20.6,369c-26.7,1.9 -52.1,0.2 -75.1,-5.4L356.6,398c3.7,-3.3 7.4,-6.7 11.3,-9.9 7.7,-6.4 8.7,-17.7 2.4,-25.3 -6.4,-7.7 -17.7,-8.7 -25.3,-2.4 -109,90.4 -148.6,215.3 -96.4,303.8 15.5,26.3 38.2,46.6 65.4,61.2 -3.5,11.9 -28.8,91.6 -83.8,101.3 -3.2,0.5 -5.1,0.5 -5.6,0.8 -1,-3 -1.5,-10.3 -1.7,-15.3 -0.8,-14.2 -1.8,-31.8 -13.3,-45.9 -18.7,-22.9 -47.6,-17.3 -70.9,-12.6 -33.1,6.6 -35.5,3.7 -38.4,-7.6 -6.9,-26.6 6.4,-40.9 26,-58.2 11,-9.7 21.4,-18.9 21.1,-32.9 -0.1,-5.6 -2.2,-13.7 -11.2,-21 -14.9,-12 -30.4,-37.3 -27.3,-49.6 1.6,-6.5 11.4,-9.6 19.2,-11.1 16.6,-3.1 33.2,-3.2 49.2,-0.2 9.8,1.8 19.2,-4.6 21,-14.4s-4.6,-19.2 -14.4,-21c-20.5,-3.8 -41.5,-3.8 -62.4,0.2 -33,6.1 -44.1,23.9 -47.5,37.6 -7.6,30.2 16.2,64.1 33.4,80.8 -1.6,1.5 -3.4,3.1 -4.9,4.4 -17.5,15.4 -50,44.2 -37,94.2 12.3,47.2 54.8,38.9 80.3,33.8 18.1,-3.6 31.3,-5.6 35.9,0 4.1,5.1 4.7,15.3 5.3,25.2 0.8,14.6 1.8,31.1 15,41.5 6.3,5 13.9,7.4 23.3,7.4 3.5,0 7.3,-0.4 11.3,-1.1 71,-12.5 102.8,-96.9 110.8,-122.1 25.2,8.3 53.2,12.5 82.6,12.5 61.3,0 129,-18.2 192.4,-55.6 40,-23.6 74.7,-52.5 103.2,-85.8 6.4,-7.5 5.6,-18.9 -2,-25.4 -7.5,-6.4 -18.9,-5.6 -25.4,2 -0.1,0.1 -0.1,0.2 -0.2,0.2l-14.9,-268.3c25.5,11.9 46.5,29.4 60.2,52.7 25.3,42.9 23.5,98.1 -5,155.4 -4.4,8.9 -0.8,19.7 8.1,24.1 2.6,1.3 5.3,1.9 8,1.9 6.6,0 13,-3.7 16.1,-10 33.6,-67.6 35,-136.7 3.7,-189.7 -12.5,-21.1 -29.6,-38.3 -50,-52 0,-0.2 0.1,-0.4 0.1,-0.6 -0.2,-2 -5.1,-50.5 36.3,-94 5.5,-5.8 13.4,-12.2 19.8,-10.1 12,4.1 24.7,30.9 26.7,49.9 1.2,11.5 6.9,17.6 11.5,20.8 11.6,7.9 25,4.2 39.1,0.3 25.2,-7 44.5,-10.4 63,9.9 7.8,8.6 9,12.1 -14.6,36.4 -16.5,17 -37.1,38.1 -28,66.3 5.6,17.3 19.8,27.8 31.3,36.2 4.5,3.3 11.2,8.2 12.2,8.5 0,0 -0.5,1.9 -4.1,5.6 -20.8,22.3 -55.1,25.3 -79.9,23.9 -9.4,-0.7 -18.4,7 -19,17 -0.6,9.9 7,18.4 17,19 4.2,0.2 8.3,0.4 12.3,0.4 41.1,0 74.1,-12.2 95.9,-35.7 10.1,-10.9 14.5,-21.5 13.5,-32.5 -1.9,-16.5 -15.2,-26.3 -26.9,-34.9zM279.5,645.8c-34.6,-58.7 -16,-141.8 43,-212.6l14.6,264.3c-24.2,-11.9 -44.2,-29.1 -57.6,-51.7zM463.7,329.7c25.3,-10.8 50.7,-18.6 75.6,-23.2l21.1,381.3c-25.3,11 -50.7,18.9 -75.5,23.6l-21.2,-381.7zM663.6,622.2c-18.1,16.1 -38,30.8 -59.7,43.7 -2.8,1.6 -5.6,3 -8.3,4.5l-20.4,-368.2c25.1,-1.6 49.1,0 71,5l17.4,315z"/>
|
||||
</vector>
|
||||
5
app/src/main/res/drawable/ic_take_photo.xml
Normal file
5
app/src/main/res/drawable/ic_take_photo.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:viewportHeight="1024.0"
|
||||
android:viewportWidth="1024.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#1db127" android:pathData="M591.9,434.4a114.3,114.3 0,0 1,21.1 32l1.4,-0.4L705.4,806C800.9,743 864,634.9 864,512a353.6,353.6 0,0 0,-8.8 -77.6zM845.1,398.9a352.8,352.8 0,0 0,-146.2 -184.8L514,398.9zM434.8,595.8l-0.3,0.3 -2.8,-2.8c-1.2,-1.1 -2.3,-2.3 -3.4,-3.4L196.1,357.6A349.9,349.9 0,0 0,160 512c0,91.7 35.4,175 92.9,237.6l225.1,-130a114.5,114.5 0,0 1,-43.2 -23.8zM568,608.2l0.2,0.3 -289,166.9C341.2,830.3 422.5,864 512,864a349.7,349.7 0,0 0,161.6 -39.5l-68,-253.8a115,115 0,0 1,-37.6 37.5zM423.8,439.1l-0.1,-0.1 0.8,-0.8a112.4,112.4 0,0 1,8.3 -8.4l233.7,-233.7A349.3,349.3 0,0 0,512 160c-125.8,0 -235.8,66.2 -298,165.3l183,183a111.9,111.9 0,0 1,26.8 -69.2z"/>
|
||||
<path android:fillColor="#34a13c" android:pathData="M512,0C229.2,0 0,229.2 0,512s229.2,512 512,512 512,-229.2 512,-512S794.8,0 512,0zM817.5,817.5a430.4,430.4 0,1 1,92.6 -137.3,430.7 430.7,0 0,1 -92.6,137.3z"/>
|
||||
</vector>
|
||||
@@ -12,6 +12,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="11"
|
||||
android:background="#eae8e8"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
@@ -22,6 +23,7 @@
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="#08d966"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
@@ -29,8 +31,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="17sp"
|
||||
tools:text="早餐" />
|
||||
android:text="早餐"
|
||||
android:textColor="#fff"
|
||||
android:textSize="17sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
@@ -48,22 +51,25 @@
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/breakfast_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#eae8e8">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="#08d966"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="17sp"
|
||||
tools:text="午餐" />
|
||||
android:text="午餐"
|
||||
android:textColor="#fff"
|
||||
android:textSize="17sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
@@ -81,22 +87,25 @@
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/lunch_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#eae8e8">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="#08d966"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="17sp"
|
||||
tools:text="晚餐" />
|
||||
android:text="晚餐"
|
||||
android:textColor="#fff"
|
||||
android:textSize="17sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
@@ -114,11 +123,200 @@
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/dinner_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#eae8e8">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:padding="15dp"
|
||||
app:cardCornerRadius="20dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#e0efd5"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:src="@drawable/ic_calorie" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="卡路里:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/calorie_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="500" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="千卡" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:src="@drawable/ic_fat" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="脂肪:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fat_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="500" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="克" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:src="@drawable/ic_sugar" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="糖:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/suger_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="500" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="克" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:src="@drawable/ic_protein" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="蛋白质:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/protein_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="500" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="克" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<LinearLayout
|
||||
@@ -136,6 +334,7 @@
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/change_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
@@ -152,13 +351,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="换一批"
|
||||
android:textColor="#f0311e"
|
||||
android:textColor="#363534"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/copy_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
@@ -174,8 +374,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="根据已吃卡路里刷新"
|
||||
android:textColor="#f0311e"
|
||||
android:text="复制到饮食记录"
|
||||
android:textColor="#363534"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
218
app/src/main/res/layout/activity_dish_result.xml
Normal file
218
app/src/main/res/layout/activity_dish_result.xml
Normal file
@@ -0,0 +1,218 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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"
|
||||
android:background="#54be82"
|
||||
android:orientation="vertical"
|
||||
tools:context="com.example.ninefourone.nutritionmaster.modules.classifyresult.DishResultActivity">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_weight="0.5"
|
||||
android:gravity="center"
|
||||
android:text="信息清单"
|
||||
android:textColor="#fff"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_weight="0.9"
|
||||
app:cardCornerRadius="15dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#50b67c"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="卡路里总和"
|
||||
android:textColor="#fff" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/calorie_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="大卡"
|
||||
android:textColor="#fff" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/calorie"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="7dp"
|
||||
android:layout_toLeftOf="@+id/calorie_tag"
|
||||
android:text="大卡"
|
||||
android:textColor="#fff" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="碳水化合物"
|
||||
android:textColor="#fff" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sugar_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="克"
|
||||
android:textColor="#fff" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/suger"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="7dp"
|
||||
android:layout_toLeftOf="@+id/sugar_tag"
|
||||
android:text="大卡"
|
||||
android:textColor="#fff" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_weight="0.005"
|
||||
android:alpha="0.7"
|
||||
android:background="#d7d6d6" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="脂肪"
|
||||
android:textColor="#fff" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fat_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="克"
|
||||
android:textColor="#fff" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fat"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="7dp"
|
||||
android:layout_toLeftOf="@+id/fat_tag"
|
||||
android:text="大卡"
|
||||
android:textColor="#fff" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="蛋白质"
|
||||
android:textColor="#fff" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/protein_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="克"
|
||||
android:textColor="#fff" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/protein"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="7dp"
|
||||
android:layout_toLeftOf="@+id/protein_tag"
|
||||
android:text="大卡"
|
||||
android:textColor="#fff" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="0.8"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
android:id="@+id/ok_button"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="#76c47e"
|
||||
android:text="确认提交到已吃清单"
|
||||
android:textColor="#f7f4f4" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
@@ -30,6 +30,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:gravity="center"
|
||||
android:textColor="#fff"
|
||||
android:textSize="18sp"
|
||||
tools:text="@string/app_name" />
|
||||
|
||||
</FrameLayout>
|
||||
@@ -39,15 +41,15 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:alpha="0.2"
|
||||
android:background="#8a515050">
|
||||
android:alpha="0.5"
|
||||
android:background="@drawable/camera_bg">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/more_take_photo_button_capture"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/selector" />
|
||||
android:src="@drawable/ic_take_photo" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/more_takephoto_ok"
|
||||
@@ -63,7 +65,7 @@
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/more_camera_cover_linearlayout"
|
||||
android:id="@+id/camera_cover_linearlayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:alpha="0.3"
|
||||
|
||||
@@ -1,69 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<android.support.v7.widget.CardView 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="60dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/customization_item_image"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:scaleType="centerCrop"
|
||||
tools:src="@drawable/food_test" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_toRightOf="@id/customization_item_image"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/food_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#000000"
|
||||
android:textSize="14sp"
|
||||
tools:text="馒头" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/food_quantity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#504e4e"
|
||||
android:textSize="11sp"
|
||||
tools:text="1个(大)" />
|
||||
</LinearLayout>
|
||||
|
||||
android:layout_height="70dp"
|
||||
android:layout_margin="5dp"
|
||||
app:cardCornerRadius="15dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center_vertical">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/arch"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:src="@drawable/ic_right_arch" />
|
||||
android:id="@+id/customization_item_image"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:scaleType="centerCrop"
|
||||
tools:src="@drawable/food_test" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/food_energy"
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_toLeftOf="@id/arch"
|
||||
android:textSize="11sp"
|
||||
tools:text="365千卡" />
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_toRightOf="@id/customization_item_image"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/food_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#000000"
|
||||
android:textSize="14sp"
|
||||
tools:text="馒头" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/food_quantity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#504e4e"
|
||||
android:textSize="11sp"
|
||||
tools:text="1个(大)" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/arch"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:src="@drawable/ic_right_arch" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/food_energy"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_toLeftOf="@id/arch"
|
||||
android:textSize="11sp"
|
||||
tools:text="365千卡" />
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
62
app/src/main/res/layout/dish_result_item.xml
Normal file
62
app/src/main/res/layout/dish_result_item.xml
Normal file
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.widget.CardView 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="80dp"
|
||||
android:layout_margin="5dp"
|
||||
app:cardCornerRadius="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#fff"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="60dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:alpha="0.8"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
app:cardCornerRadius="30dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
tools:src="@drawable/food_test" />
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="15dp"
|
||||
android:textColor="#535252"
|
||||
tools:text="麻婆豆腐" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/picker"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:clipToPadding="false">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
@@ -8,5 +8,6 @@
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#d2e4cb"
|
||||
android:gravity="center" />
|
||||
</LinearLayout>
|
||||
8
app/src/main/res/layout/picker_item.xml
Normal file
8
app/src/main/res/layout/picker_item.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/picker_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="13dp"
|
||||
android:gravity="center"
|
||||
android:textSize="15sp" />
|
||||
@@ -25,7 +25,7 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_weight="0"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
app:cardCornerRadius="20dp">
|
||||
|
||||
<LinearLayout
|
||||
android:background="#dcffe1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
@@ -51,7 +52,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textSize="10sp"
|
||||
android:textSize="12sp"
|
||||
tools:text="红烧肉是最美味的菜了!超级好吃!" />
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
<android.support.v7.widget.CardView 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="160dp"
|
||||
android:layout_width="165dp"
|
||||
android:layout_height="@dimen/recommend_item_default_hight"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/recommend_margin"
|
||||
android:layout_weight="1"
|
||||
app:cardElevation="0dp"
|
||||
app:cardCornerRadius="20dp">
|
||||
app:cardCornerRadius="20dp"
|
||||
app:cardElevation="0dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/whole_layout"
|
||||
android:layout_width="match_parent"
|
||||
@@ -25,7 +27,7 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_weight="0"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
@@ -42,5 +44,4 @@
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
@@ -2,12 +2,6 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/id_action_exchange"
|
||||
android:icon="@drawable/ic_exchange"
|
||||
android:title="切换"
|
||||
app:showAsAction="always"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/id_action_record"
|
||||
android:icon="@drawable/ic_record"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<dimen name="icon_size">20dp</dimen>
|
||||
|
||||
<dimen name="recommend_item_default_hight">100dp</dimen>
|
||||
<dimen name="recommend_item_big_height">180dp</dimen>
|
||||
<dimen name="recommend_item_big_height">150dp</dimen>
|
||||
<dimen name="recommend_margin">5dp</dimen>
|
||||
|
||||
|
||||
|
||||
9
todaystepcounterlib/.gitignore
vendored
9
todaystepcounterlib/.gitignore
vendored
@@ -1 +1,10 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
|
||||
Reference in New Issue
Block a user