Merge branch 'wangtianrui' into develop
This commit is contained in:
@@ -70,5 +70,10 @@ dependencies {
|
||||
implementation 'com.github.czy1121:turncardlistview:1.0.0'
|
||||
//油表盘
|
||||
implementation 'com.github.lzyzsd:circleprogress:1.2.1'
|
||||
//glide
|
||||
// implementation 'com.github.bumptech.glide:glide:4.8.0'
|
||||
// annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
|
||||
implementation 'com.github.bumptech.glide:glide:3.8.0'
|
||||
implementation 'com.android.support:support-v4:19.1.0'
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class CardAdapter extends RecyclerView.Adapter<CardHolder> {
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
public void onBindViewHolder(CardHolder holder, int position) {
|
||||
holder.bindView(mList.get(position).getPictureId(), mList.get(position).getTitle(), position, context);
|
||||
holder.bindView(mList.get(position).getPictureId(), mList.get(position).getTitle(), context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,6 +9,7 @@ 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.modules.viewpagerfragments.customization.CustomizationActivity;
|
||||
import com.orhanobut.logger.Logger;
|
||||
@@ -40,9 +41,10 @@ public class CardHolder extends RecyclerView.ViewHolder {
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
public void bindView(int picId, String text, int index, final Context context) {
|
||||
public void bindView(int picId, String text, final Context context) {
|
||||
tvName.setText(text);
|
||||
ivPhoto.setImageDrawable(context.getDrawable(picId));
|
||||
// ivPhoto.setImageDrawable(context.getDrawable(picId));
|
||||
Glide.with(context).load(picId).into(ivPhoto);
|
||||
i = new Intent(context, CustomizationActivity.class);
|
||||
i.putExtra("SEND_CODE", text);
|
||||
// Logger.d(text);
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.example.ninefourone.nutritionmaster.adapter;
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/9/24.
|
||||
*/
|
||||
|
||||
public class CustomizationAdapter extends RecyclerView.Adapter<CardHolder> {
|
||||
@Override
|
||||
public CardHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(CardHolder holder, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.example.ninefourone.nutritionmaster.adapter;
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/9/24.
|
||||
*/
|
||||
|
||||
public class CustomizationHolder extends RecyclerView.ViewHolder {
|
||||
public CustomizationHolder(View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,9 @@ package com.example.ninefourone.nutritionmaster.adapter;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
@@ -36,18 +38,17 @@ public class RecommendAdapter extends BaseMultiItemQuickAdapter<RecommendFood, B
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, RecommendFood item) {
|
||||
ImageView imageView = helper.getView(R.id.recommend_item_imageview);
|
||||
Glide.with(mContext).load(R.drawable.food_test).into(imageView);
|
||||
switch (item.getItemType()) {
|
||||
case RecommendFood.TYPE_BIG:
|
||||
helper.setImageResource(R.id.recommend_item_imageview, R.drawable.food_test);
|
||||
helper.setText(R.id.recommend_item_title, "红烧肉");
|
||||
break;
|
||||
case RecommendFood.TYPE_DETAIL:
|
||||
helper.setImageResource(R.id.recommend_item_imageview, R.drawable.food_test);
|
||||
helper.setText(R.id.recommend_item_title, item.getTitle());
|
||||
helper.setText(R.id.recommend_item_description, item.getDescription());
|
||||
break;
|
||||
case RecommendFood.TYPE_MIDDLE:
|
||||
helper.setImageResource(R.id.recommend_item_imageview, R.drawable.food_test);
|
||||
helper.setText(R.id.recommend_item_title, "红烧");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ public class RecommendFragment extends BaseFragment {
|
||||
private GridLayoutManager manager;
|
||||
private int[] indexs = new int[]{0, 1, 1, 2};
|
||||
|
||||
|
||||
@Override
|
||||
public int getLayoutResId() {
|
||||
return R.layout.normal_recommend_fragment_layout;
|
||||
|
||||
@@ -7,24 +7,127 @@
|
||||
android:orientation="vertical"
|
||||
tools:context="com.example.ninefourone.nutritionmaster.modules.viewpagerfragments.customization.CustomizationActivity">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="11">
|
||||
android:layout_weight="11"
|
||||
android:orientation="vertical">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="17sp"
|
||||
tools:text="早餐" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/breakfast_energy_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="13sp"
|
||||
tools:text="528千卡" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/breakfast_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="17sp"
|
||||
tools:text="午餐" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lunch_energy_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="13sp"
|
||||
tools:text="528千卡" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/lunch_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="17sp"
|
||||
tools:text="晚餐" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dinner_energy_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="13sp"
|
||||
tools:text="528千卡" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/dinner_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#f5f5f5"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="0.03"
|
||||
android:background="@color/place_holder" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -40,8 +143,8 @@
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="15dp"
|
||||
android:src="@drawable/ic_exchange_customization" />
|
||||
|
||||
<TextView
|
||||
@@ -49,17 +152,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="换一批"
|
||||
android:textColor="#f0311e" />
|
||||
android:textColor="#f0311e"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</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:background="@color/place_holder" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
@@ -69,8 +166,8 @@
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="15dp"
|
||||
android:src="@drawable/ic_copy" />
|
||||
|
||||
<TextView
|
||||
@@ -78,7 +175,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="根据已吃卡路里刷新"
|
||||
android:textColor="#f0311e" />
|
||||
android:textColor="#f0311e"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
69
app/src/main/res/layout/customization_item.xml
Normal file
69
app/src/main/res/layout/customization_item.xml
Normal file
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
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>
|
||||
|
||||
|
||||
<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>
|
||||
@@ -21,6 +21,7 @@ buildscript {
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
google()
|
||||
jcenter()
|
||||
maven { url 'https://jitpack.io' }
|
||||
|
||||
Reference in New Issue
Block a user