1
This commit is contained in:
@@ -14,6 +14,7 @@ import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.bean.RecommendFood;
|
||||
import com.example.ninefourone.nutritionmaster.modules.RecipeActivity.RecipeActivity;
|
||||
import com.example.ninefourone.nutritionmaster.utils.MessageUtils;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
@@ -23,7 +24,6 @@ import java.util.List;
|
||||
*/
|
||||
|
||||
public class RecommendAdapter extends BaseMultiItemQuickAdapter<RecommendFood, BaseViewHolder> {
|
||||
private int[] indexs = new int[]{0, 1, 1, 2};
|
||||
private Intent intent;
|
||||
|
||||
/**
|
||||
@@ -41,56 +41,33 @@ public class RecommendAdapter extends BaseMultiItemQuickAdapter<RecommendFood, B
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, final RecommendFood item) {
|
||||
intent = new Intent(mContext, RecipeActivity.class);
|
||||
intent.putExtra("SEND_OBJECT", item);
|
||||
ImageView imageView = helper.getView(R.id.recommend_item_imageview);
|
||||
View view = helper.getView(R.id.whole_layout);
|
||||
|
||||
Glide.with(mContext).load(item.getPicture()).into(imageView);
|
||||
|
||||
|
||||
switch (item.getItemType()) {
|
||||
case RecommendFood.TYPE_BIG:
|
||||
helper.setText(R.id.recommend_item_title, item.getTitle());
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case RecommendFood.TYPE_DETAIL:
|
||||
helper.setText(R.id.recommend_item_title, item.getTitle());
|
||||
helper.setText(R.id.recommend_item_description, item.getDescription());
|
||||
imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
LinearLayout detailClick = helper.getView(R.id.detail_click);
|
||||
|
||||
detailClick.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mContext).setTitle("小知识")
|
||||
.setMessage(item.getDescription()).setIcon(R.drawable.ic_add_recipe);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.setCanceledOnTouchOutside(true);
|
||||
dialog.setCancelable(true);
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
break;
|
||||
case RecommendFood.TYPE_MIDDLE:
|
||||
helper.setText(R.id.recommend_item_title, item.getTitle());
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
});
|
||||
break;
|
||||
View view = helper.getView(R.id.whole_layout);
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(mContext, RecipeActivity.class);
|
||||
intent.putExtra("SEND_OBJECT", item);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
});
|
||||
helper.setText(R.id.recommend_item_title, item.getTitle());
|
||||
if (item.getItemType() == RecommendFood.TYPE_DETAIL) {
|
||||
helper.setText(R.id.recommend_item_description, item.getDescription());
|
||||
LinearLayout detailClick = helper.getView(R.id.detail_click);
|
||||
detailClick.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mContext).setTitle("小知识")
|
||||
.setMessage(item.getDescription()).setIcon(R.drawable.ic_add_recipe);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.setCanceledOnTouchOutside(true);
|
||||
dialog.setCancelable(true);
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -104,6 +104,7 @@
|
||||
|
||||
<com.nightonke.boommenu.BoomMenuButton
|
||||
android:id="@+id/boom_menu_button"
|
||||
app:bmb_normalColor="#8cbc79"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<!--clipToPadding = false-->
|
||||
<!--令布局可以延伸到状态栏-->
|
||||
|
||||
<LinearLayout
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
@@ -72,12 +72,13 @@
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:text="营养成分"
|
||||
android:textColor="#000000"
|
||||
android:textColor="#fff"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
@@ -86,6 +87,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:textColor="#fff"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="单位:每100克"
|
||||
android:textSize="10sp" />
|
||||
@@ -121,6 +123,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="4.1克"
|
||||
android:textColor="#fff"
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -145,6 +148,7 @@
|
||||
android:id="@+id/fat_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#fff"
|
||||
android:text="4.1克"
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
@@ -170,6 +174,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="4.1克"
|
||||
android:textColor="#fff"
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -181,8 +186,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_button"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_back_button_white" />
|
||||
@@ -269,11 +274,15 @@
|
||||
android:background="#ffffff">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp" />
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
<com.nightonke.boommenu.BoomMenuButton
|
||||
android:id="@+id/boom_menu_button"
|
||||
@@ -283,6 +292,7 @@
|
||||
android:layout_alignParentRight="true"
|
||||
app:bmb_buttonEnum="ham"
|
||||
app:bmb_buttonPlaceEnum="buttonPlace_ham_1"
|
||||
app:bmb_normalColor="#8cbc79"
|
||||
app:bmb_piecePlaceEnum="piecePlace_ham_1" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#f9f9f6"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
@@ -11,6 +11,8 @@
|
||||
android:id="@+id/make_step_text_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="10dp"
|
||||
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="#212121"
|
||||
tools:text="@string/app_name" />
|
||||
|
||||
Reference in New Issue
Block a user