1
This commit is contained in:
@@ -11,6 +11,7 @@ import com.example.ninefourone.nutritionmaster.bean.MyUser;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.bean.Occupation;
|
||||
import com.example.ninefourone.nutritionmaster.bean.Physique;
|
||||
import com.example.ninefourone.nutritionmaster.utils.CalculateUtils;
|
||||
import com.example.ninefourone.nutritionmaster.utils.ConstantUtils;
|
||||
import com.example.ninefourone.nutritionmaster.utils.WebUtil;
|
||||
import com.google.gson.Gson;
|
||||
@@ -48,6 +49,10 @@ public class NutritionMaster extends Application {
|
||||
public static Element element = null;
|
||||
public static Illness illness = null;
|
||||
|
||||
public static Element calculatedElement = null;
|
||||
|
||||
public static int randomSeed = CalculateUtils.getWeek();
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
|
||||
@@ -10,9 +10,11 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.example.ninefourone.nutritionmaster.NutritionMaster;
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.bean.DailyCard;
|
||||
import com.example.ninefourone.nutritionmaster.modules.viewpagerfragments.customization.CustomizationActivity;
|
||||
import com.example.ninefourone.nutritionmaster.utils.MessageUtils;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -45,15 +47,17 @@ public class CardHolder extends RecyclerView.ViewHolder {
|
||||
public void bindView(int picId, DailyCard dailyCard, final Context context) {
|
||||
tvName.setText(dailyCard.getTitle());
|
||||
tvSign.setText(dailyCard.getDescription());
|
||||
// ivPhoto.setImageDrawable(context.getDrawable(picId));
|
||||
Glide.with(context).load(picId).into(ivPhoto);
|
||||
i = new Intent(context, CustomizationActivity.class);
|
||||
i.putExtra("SEND_CODE", dailyCard.getTitle());
|
||||
// Logger.d(text);
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
context.startActivity(i);
|
||||
if (NutritionMaster.physique == null || NutritionMaster.occupation == null) {
|
||||
MessageUtils.MakeToast("填写信息才能使用哦~");
|
||||
} else {
|
||||
context.startActivity(i);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,25 +1,45 @@
|
||||
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 com.example.ninefourone.nutritionmaster.bean.FoodMenu;
|
||||
import com.example.ninefourone.nutritionmaster.modules.viewpagerfragments.customization.CustomizationActivity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/9/24.
|
||||
*/
|
||||
|
||||
public class CustomizationAdapter extends RecyclerView.Adapter<CardHolder> {
|
||||
@Override
|
||||
public CardHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
return null;
|
||||
public class CustomizationAdapter extends RecyclerView.Adapter<CustomizationHolder> {
|
||||
private ArrayList<FoodMenu> mList;
|
||||
private Context context;
|
||||
private int flag;
|
||||
|
||||
public CustomizationAdapter(ArrayList<FoodMenu> mList, Context context, int flag) {
|
||||
this.mList = mList;
|
||||
this.context = context;
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(CardHolder holder, int position) {
|
||||
public CustomizationHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.customization_item, parent, false);
|
||||
return new CustomizationHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(CustomizationHolder holder, int position) {
|
||||
holder.bindView(mList.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 0;
|
||||
return mList.size();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,76 @@ package com.example.ninefourone.nutritionmaster.adapter;
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.example.ninefourone.nutritionmaster.NutritionMaster;
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.bean.Element;
|
||||
import com.example.ninefourone.nutritionmaster.bean.FoodMenu;
|
||||
import com.example.ninefourone.nutritionmaster.modules.viewpagerfragments.customization.CustomizationActivity;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/9/24.
|
||||
*/
|
||||
|
||||
public class CustomizationHolder extends RecyclerView.ViewHolder {
|
||||
@BindView(R.id.customization_item_image)
|
||||
ImageView customizationItemImage;
|
||||
@BindView(R.id.food_name)
|
||||
TextView foodName;
|
||||
@BindView(R.id.food_quantity)
|
||||
TextView foodQuantity;
|
||||
@BindView(R.id.arch)
|
||||
ImageView arch;
|
||||
@BindView(R.id.food_energy)
|
||||
TextView foodEnergy;
|
||||
|
||||
public CustomizationHolder(View itemView) {
|
||||
super(itemView);
|
||||
ButterKnife.bind(this, itemView);
|
||||
}
|
||||
|
||||
public void bindView(FoodMenu foodMenu) {
|
||||
Glide.with(itemView.getContext()).load(foodMenu.getImage_url()).into(customizationItemImage);
|
||||
foodName.setText(foodMenu.getName());
|
||||
try {
|
||||
Element element = NutritionMaster.element.calculateData(NutritionMaster.user);
|
||||
double calorieQuantity = element.getCalorie() - NutritionMaster.user.getEaten_elements().getCalorie();
|
||||
double quantity = calorieQuantity / foodMenu.getCalorie();
|
||||
Random random = new Random((int) foodMenu.getElements().getCalorie());
|
||||
if (quantity > 200) {
|
||||
quantity = 150 + random.nextInt(50);
|
||||
} else if (quantity < 50) {
|
||||
quantity = 50 + random.nextInt(50);
|
||||
}
|
||||
// Logger.d(foodMenu.getCalorie());
|
||||
int energy = (int) (foodMenu.getElements().getCalorie() * quantity / 100);
|
||||
energy = checkEnergy(energy);
|
||||
foodEnergy.setText(energy + "千卡");
|
||||
foodQuantity.setText((int) quantity + "克");
|
||||
|
||||
} catch (CloneNotSupportedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private int checkEnergy(int energy) {
|
||||
if (energy < 30) {
|
||||
return checkEnergy(energy * 2);
|
||||
} else if (energy > 250) {
|
||||
return checkEnergy(energy - 50);
|
||||
} else {
|
||||
return energy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,6 +129,62 @@ public class Element implements Cloneable {
|
||||
thiamine = elementsBean.getThiamine();
|
||||
}
|
||||
|
||||
public Element(FoodMenu.ElementsBean elementsBean) {
|
||||
calorie = elementsBean.getCalorie();
|
||||
carbohydrate = (float) elementsBean.getCarbohydrate();
|
||||
fat = (float) elementsBean.getFat();
|
||||
protein = (float) elementsBean.getProtein();
|
||||
cellulose = (float) elementsBean.getCellulose();
|
||||
vitaminA = (float) elementsBean.getVitaminA();
|
||||
vitaminB1 = elementsBean.getVitaminB1();
|
||||
vitaminB2 = (float) elementsBean.getVitaminB2();
|
||||
vitaminB6 = elementsBean.getVitaminB6();
|
||||
vitaminC = (float) elementsBean.getVitaminC();
|
||||
vitaminE = (float) elementsBean.getVitaminE();
|
||||
carotene = (float) elementsBean.getCarotene();
|
||||
cholesterol = (float) elementsBean.getCholesterol();
|
||||
Mg = (float) elementsBean.getMg();
|
||||
Ca = (float) elementsBean.getCa();
|
||||
Fe = (float) elementsBean.getFe();
|
||||
Zn = (float) elementsBean.getZn();
|
||||
Cu = (float) elementsBean.getCu();
|
||||
Mn = (float) elementsBean.getMn();
|
||||
K = (float) elementsBean.getK();
|
||||
P = (float) elementsBean.getP();
|
||||
Na = (float) elementsBean.getNa();
|
||||
Se = (float) elementsBean.getSe();
|
||||
niacin = (float) elementsBean.getNiacin();
|
||||
thiamine = (float) elementsBean.getThiamine();
|
||||
}
|
||||
|
||||
public Element(Element elementsBean) {
|
||||
calorie = elementsBean.getCalorie();
|
||||
carbohydrate = elementsBean.getCarbohydrate();
|
||||
fat = elementsBean.getFat();
|
||||
protein = elementsBean.getProtein();
|
||||
cellulose = elementsBean.getCellulose();
|
||||
vitaminA = elementsBean.getVitaminA();
|
||||
vitaminB1 = elementsBean.getVitaminB1();
|
||||
vitaminB2 = elementsBean.getVitaminB2();
|
||||
vitaminB6 = elementsBean.getVitaminB6();
|
||||
vitaminC = elementsBean.getVitaminC();
|
||||
vitaminE = elementsBean.getVitaminE();
|
||||
carotene = elementsBean.getCarotene();
|
||||
cholesterol = elementsBean.getCholesterol();
|
||||
Mg = elementsBean.getMg();
|
||||
Ca = elementsBean.getCa();
|
||||
Fe = elementsBean.getFe();
|
||||
Zn = elementsBean.getZn();
|
||||
Cu = elementsBean.getCu();
|
||||
Mn = elementsBean.getMn();
|
||||
K = elementsBean.getK();
|
||||
P = elementsBean.getP();
|
||||
Na = elementsBean.getNa();
|
||||
Se = elementsBean.getSe();
|
||||
niacin = elementsBean.getNiacin();
|
||||
thiamine = elementsBean.getThiamine();
|
||||
}
|
||||
|
||||
public Element(Occupation.ElementsBean elementsBean) {
|
||||
calorie = elementsBean.getCalorie();
|
||||
carbohydrate = elementsBean.getCarbohydrate();
|
||||
|
||||
@@ -1,21 +1,36 @@
|
||||
package com.example.ninefourone.nutritionmaster.modules.viewpagerfragments.customization;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.NutritionMaster;
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.adapter.CustomizationAdapter;
|
||||
import com.example.ninefourone.nutritionmaster.base.BaseActivity;
|
||||
import com.example.ninefourone.nutritionmaster.bean.Element;
|
||||
import com.example.ninefourone.nutritionmaster.bean.FoodMenu;
|
||||
import com.example.ninefourone.nutritionmaster.bean.FoodMenuLight;
|
||||
import com.example.ninefourone.nutritionmaster.utils.CalculateUtils;
|
||||
import com.example.ninefourone.nutritionmaster.utils.WebUtil;
|
||||
import com.google.gson.Gson;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class CustomizationActivity extends BaseActivity {
|
||||
|
||||
@@ -43,11 +58,30 @@ public class CustomizationActivity extends BaseActivity {
|
||||
LinearLayout changeButton;
|
||||
@BindView(R.id.copy_button)
|
||||
LinearLayout copyButton;
|
||||
@BindView(R.id.tool_bar_title)
|
||||
TextView toolBarTitle;
|
||||
|
||||
private ArrayList<FoodMenu> breakfastList = new ArrayList<>();
|
||||
private ArrayList<FoodMenu> lunchList = new ArrayList<>();
|
||||
private ArrayList<FoodMenu> dinnerList = new ArrayList<>();
|
||||
|
||||
|
||||
private CustomizationAdapter breakfastAdapter;
|
||||
private CustomizationAdapter lunchAdapter;
|
||||
private CustomizationAdapter dinnerAdapter;
|
||||
|
||||
private int start;
|
||||
private String text;
|
||||
|
||||
private int breakfastCalorie = 0;
|
||||
private int lunchCalorie = 0;
|
||||
private int dinnerCalorie = 0;
|
||||
|
||||
private int suger = 0;
|
||||
private int protein = 0;
|
||||
private int fat = 0;
|
||||
private int calorie = 0;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -61,10 +95,24 @@ public class CustomizationActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public void initViews(Bundle savedInstanceState) {
|
||||
loadData();
|
||||
String text = getIntent().getStringExtra("SEND_CODE");
|
||||
text = getIntent().getStringExtra("SEND_CODE");
|
||||
Logger.d(text);
|
||||
toolBarTitle.setText(text);
|
||||
|
||||
breakfastAdapter = new CustomizationAdapter(breakfastList, this, 0);
|
||||
dinnerAdapter = new CustomizationAdapter(dinnerList, this, 1);
|
||||
lunchAdapter = new CustomizationAdapter(lunchList, this, 2);
|
||||
|
||||
breakfastRecyclerView.setAdapter(breakfastAdapter);
|
||||
dinnerRecyclerView.setAdapter(dinnerAdapter);
|
||||
lunchRecyclerView.setAdapter(lunchAdapter);
|
||||
|
||||
breakfastRecyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
dinnerRecyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
lunchRecyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
|
||||
loadData();
|
||||
refreshUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,6 +128,71 @@ public class CustomizationActivity extends BaseActivity {
|
||||
@Override
|
||||
public void loadData() {
|
||||
super.loadData();
|
||||
final WebUtil webUtil = WebUtil.getInstance();
|
||||
webUtil.getMenusByElements(getElementLimit(), new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
String json = response.body().string();
|
||||
FoodMenuLight[] foodMenus = new Gson().fromJson(json, FoodMenuLight[].class);
|
||||
Logger.d(foodMenus.length);
|
||||
Random random = new Random(NutritionMaster.randomSeed + CalculateUtils.title2Int(text));
|
||||
start = random.nextInt(foodMenus.length - 50);
|
||||
for (int i = start; i < start + 50; i++) {
|
||||
webUtil.getMenu(foodMenus[i].getName(), new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
String json = response.body().string();
|
||||
FoodMenu foodMenu = new Gson().fromJson(json, FoodMenu.class);
|
||||
if (foodMenu.getIs_breakfast() == 1) {
|
||||
if (breakfastList.size() < 1) {
|
||||
breakfastList.add(foodMenu);
|
||||
}
|
||||
} else {
|
||||
if (foodMenu.getName().contains("汤") || foodMenu.getName().contains("糕")
|
||||
|| foodMenu.getImage_url().equals("0") || foodMenu.getName().contains("汁")
|
||||
|| foodMenu.getName().contains("茶")) {
|
||||
|
||||
} else {
|
||||
if (lunchList.size() == 0) {
|
||||
lunchList.add(foodMenu);
|
||||
} else if (dinnerList.size() == 0) {
|
||||
dinnerList.add(foodMenu);
|
||||
} else if (lunchList.size() < 3) {
|
||||
lunchList.add(foodMenu);
|
||||
} else if (dinnerList.size() < 3) {
|
||||
dinnerList.add(foodMenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
lunchRecyclerView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
breakfastAdapter.notifyDataSetChanged();
|
||||
dinnerAdapter.notifyDataSetChanged();
|
||||
lunchAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
thread.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -92,4 +205,63 @@ public class CustomizationActivity extends BaseActivity {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Double> getElementLimit() {
|
||||
Map<String, Double> params = new HashMap<>();
|
||||
try {
|
||||
Element calculated = NutritionMaster.element.calculateData(NutritionMaster.user);
|
||||
params.put("calorie", (calculated.getCalorie() - NutritionMaster.user.getEaten_elements().getCalorie()) / 8);
|
||||
params.put("fat", (calculated.getFat() - NutritionMaster.user.getEaten_elements().getFat()) / 8);
|
||||
|
||||
|
||||
Logger.d((calculated.getCalorie() - NutritionMaster.user.getEaten_elements().getCalorie()));
|
||||
Logger.d(calculated.getFat() - NutritionMaster.user.getEaten_elements().getFat());
|
||||
Logger.d((calculated.getCarbohydrate() - NutritionMaster.user.getEaten_elements().getCarbohydrate()));
|
||||
Logger.d(calculated.getProtein() - NutritionMaster.user.getEaten_elements().getProtein());
|
||||
} catch (CloneNotSupportedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载元素总量
|
||||
*/
|
||||
public void refreshUI() {
|
||||
// Logger.d(flag);
|
||||
// if (flag == 0) {
|
||||
// breakfastCalorie += calorie;
|
||||
// breakfastEnergyText.setText((int) breakfastCalorie + "千卡");
|
||||
// } else if (flag == 1) {
|
||||
// lunchCalorie += calorie;
|
||||
// lunchEnergyText.setText(lunchCalorie + "千卡");
|
||||
// } else {
|
||||
// dinnerCalorie += calorie;
|
||||
// dinnerEnergyText.setText(dinnerCalorie + "千卡");
|
||||
// }
|
||||
// calorieText.setText(breakfastCalorie + lunchCalorie + dinnerCalorie + "");
|
||||
// this.suger += suger;
|
||||
// this.fat += fat;
|
||||
// this.protein = protein;
|
||||
// sugerText.setText(this.suger + "");
|
||||
// fatText.setText(this.fat + "");
|
||||
// proteinText.setText(this.protein + "");
|
||||
try {
|
||||
Element element = NutritionMaster.element.calculateData(NutritionMaster.user);
|
||||
suger = (int) (element.getCarbohydrate() - NutritionMaster.user.getEaten_elements().getCarbohydrate());
|
||||
sugerText.setText(suger + "");
|
||||
fat = (int) (element.getFat() - NutritionMaster.user.getEaten_elements().getFat());
|
||||
fatText.setText(fat + "");
|
||||
calorie = (int) (element.getCalorie() - NutritionMaster.user.getEaten_elements().getCalorie());
|
||||
calorieText.setText(calorie + "");
|
||||
protein = (int) (element.getProtein() - NutritionMaster.user.getEaten_elements().getProtein());
|
||||
proteinText.setText(protein+"");
|
||||
} catch (CloneNotSupportedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class CustomizationFragment extends BaseFragment {
|
||||
for (int i = 1; i < CalculateUtils.getWeek(); i++) {
|
||||
// mDataList.add("周" + ConstantUtils.arab2Chinese(i) + "美食普");
|
||||
DailyCard dailyCard = new DailyCard(
|
||||
"周" + ConstantUtils.arab2Chinese(i) + "美食普",
|
||||
"周" + ConstantUtils.arab2Chinese(i) + "美食谱",
|
||||
ConstantUtils.dailyDescibes[i - 1],
|
||||
picList[i - 1]
|
||||
);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.example.ninefourone.nutritionmaster.utils;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.NutritionMaster;
|
||||
import com.example.ninefourone.nutritionmaster.bean.ClassifyResult;
|
||||
import com.example.ninefourone.nutritionmaster.bean.Element;
|
||||
import com.example.ninefourone.nutritionmaster.bean.FoodMenu;
|
||||
@@ -89,6 +90,36 @@ public class CalculateUtils {
|
||||
return week;
|
||||
}
|
||||
|
||||
public static int title2Int(String text) {
|
||||
String temp = text.substring(1, 2);
|
||||
Logger.d(temp);
|
||||
if (temp.equals("一")) {
|
||||
return 1;
|
||||
} else if (temp.equals("二")) {
|
||||
return 2;
|
||||
} else if (temp.equals("三")) {
|
||||
return 3;
|
||||
} else if (temp.equals("四")) {
|
||||
return 4;
|
||||
} else if (temp.equals("五")) {
|
||||
return 5;
|
||||
} else if (temp.equals("六")) {
|
||||
return 6;
|
||||
} else {
|
||||
return 7;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得秒
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static int getSecond() {
|
||||
Calendar c = Calendar.getInstance();
|
||||
return c.get(Calendar.SECOND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 性别转数字
|
||||
*
|
||||
@@ -224,4 +255,6 @@ public class CalculateUtils {
|
||||
userElement.add(physiqueElement, -1);
|
||||
return userElement;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,26 @@
|
||||
tools:context="com.example.ninefourone.nutritionmaster.modules.viewpagerfragments.customization.CustomizationActivity">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@color/colorPrimary"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tool_bar_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:textColor="#fff"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="@string/app_name" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
@@ -18,12 +38,12 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#fff"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="#08d966"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
@@ -32,7 +52,7 @@
|
||||
android:layout_marginLeft="15dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="早餐"
|
||||
android:textColor="#fff"
|
||||
android:textColor="#181818"
|
||||
android:textSize="17sp" />
|
||||
|
||||
|
||||
@@ -51,15 +71,16 @@
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/breakfast_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#eae8e8">
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="#f4f2f2"
|
||||
android:paddingTop="5dp">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="#08d966"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
@@ -68,7 +89,7 @@
|
||||
android:layout_marginLeft="15dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="午餐"
|
||||
android:textColor="#fff"
|
||||
android:textColor="#1a1919"
|
||||
android:textSize="17sp" />
|
||||
|
||||
|
||||
@@ -87,15 +108,16 @@
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/lunch_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#eae8e8">
|
||||
android:layout_height="230dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="#f4f2f2"
|
||||
android:paddingTop="5dp">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="#08d966"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
@@ -104,7 +126,7 @@
|
||||
android:layout_marginLeft="15dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="晚餐"
|
||||
android:textColor="#fff"
|
||||
android:textColor="#161616"
|
||||
android:textSize="17sp" />
|
||||
|
||||
|
||||
@@ -123,8 +145,10 @@
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/dinner_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#eae8e8">
|
||||
android:layout_height="230dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="#f4f2f2"
|
||||
android:paddingTop="5dp">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_margin="2dp"
|
||||
app:cardCornerRadius="15dp">
|
||||
|
||||
<RelativeLayout
|
||||
@@ -68,6 +68,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_toLeftOf="@id/arch"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="11sp"
|
||||
tools:text="365千卡" />
|
||||
</RelativeLayout>
|
||||
|
||||
Reference in New Issue
Block a user