詹子聪 преди 5 години
родител
ревизия
389bbe2588

+ 5 - 0
app/src/main/AndroidManifest.xml

@@ -86,6 +86,11 @@
             android:configChanges="orientation|screenSize|keyboardHidden"
             android:screenOrientation="landscape"
             android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen" />
+
+        <activity
+            android:name=".ui.home.goods.detail.GoodsDetailActivity"
+            android:screenOrientation="portrait"
+            android:theme="@style/TextInputStyle" />
     </application>
 
 </manifest>

+ 7 - 2
app/src/main/java/com/itant/shibei/ui/home/goods/GoodsAdapter.java

@@ -23,6 +23,7 @@ import com.itant.shibei.base.ItemLongClickListener;
 import com.itant.shibei.manager.UserInfoManager;
 import com.itant.shibei.tool.StringTool;
 import com.itant.shibei.ui.TabActivity;
+import com.itant.shibei.ui.home.goods.detail.GoodsDetailActivity;
 import com.itant.shibei.ui.home.goods.play.VideoPlayActivity;
 import com.makeramen.roundedimageview.RoundedImageView;
 import com.miekir.common.utils.ToastTool;
@@ -55,7 +56,8 @@ public class GoodsAdapter extends BaseQuickAdapter<GoodsBean, BaseViewHolder> {
         holder.setText(R.id.tv_see_num, goodsBean.seeNum==null ? "0" : StringTool.getNumberString(goodsBean.seeNum));
 
         holder.setOnClickListener(R.id.cv_goods, v -> {
-            if (!UserInfoManager.getInstance().getBeiUser().isVip) {
+            // todo
+            if (UserInfoManager.getInstance().getBeiUser().isVip) {
                 ToastTool.showShort("请先激活会员");
                 if (mContext instanceof TabActivity) {
                     ((TabActivity) mContext).setCurrentPage(2);
@@ -68,7 +70,10 @@ public class GoodsAdapter extends BaseQuickAdapter<GoodsBean, BaseViewHolder> {
                 return;
             }
 
-            // todo 跳到详情界面
+            // 跳到详情界面
+            Intent detailIntent = new Intent(mContext, GoodsDetailActivity.class);
+            detailIntent.putExtra(GoodsDetailActivity.KEY_GOODS, goodsBean);
+            mContext.startActivity(detailIntent);
         });
 
         // 解决图片错乱

+ 101 - 0
app/src/main/java/com/itant/shibei/ui/home/goods/detail/GoodsDetailActivity.java

@@ -0,0 +1,101 @@
+package com.itant.shibei.ui.home.goods.detail;
+
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.itant.shibei.R;
+import com.itant.shibei.base.BaseBeiActivity;
+import com.itant.shibei.tool.StringTool;
+import com.itant.shibei.ui.home.goods.GoodsBean;
+
+/**
+ * Copyright (C), 2019-2020, Miekir
+ *
+ * @author Miekir
+ * @date 2020/9/1 18:18
+ * Description: 详情界面
+ */
+public class GoodsDetailActivity extends BaseBeiActivity implements View.OnClickListener {
+    public static final String KEY_GOODS = "goods";
+    private TextView tv_title;
+    private TextView tv_good_comment;
+    private TextView tv_ding;
+    private TextView tv_cai;
+    private TextView tv_see_num;
+    private ImageView iv_fav;
+
+    private GoodsBean mGoodsBean;
+
+    @Override
+    public int getLayoutID() {
+        return R.layout.activity_goods_detail;
+    }
+
+    @Override
+    public void initViews(Bundle savedInstanceState) {
+        setTitle("详情");
+        mGoodsBean = (GoodsBean) getIntent().getSerializableExtra(KEY_GOODS);
+        if (mGoodsBean == null) {
+            return;
+        }
+
+        tv_title = findViewById(R.id.tv_title);
+        tv_good_comment = findViewById(R.id.tv_good_comment);
+        tv_ding = findViewById(R.id.tv_ding);
+        tv_cai = findViewById(R.id.tv_cai);
+        tv_see_num = findViewById(R.id.tv_see_num);
+
+        tv_title.setText(mGoodsBean.title);
+        tv_good_comment.setText(StringTool.getPercent(mGoodsBean.dingNum, mGoodsBean.dingNum + mGoodsBean.caiNum));
+        tv_ding.setText(StringTool.getNumberString(mGoodsBean.dingNum));
+        tv_cai.setText(StringTool.getNumberString(mGoodsBean.caiNum));
+        tv_see_num.setText(mGoodsBean.seeNum == null ? "0" : StringTool.getNumberString(mGoodsBean.seeNum));
+
+        // 图片
+        /*RoundedImageView aciv_goods = findViewById(R.id.aciv_goods);
+        if (!mGoodsBean.coverImageUrl.startsWith("http")) {
+            mGoodsBean.coverImageUrl = BuildConfig.BASE_URL + mGoodsBean.coverImageUrl;
+        }
+        Glide.with(this).load(mGoodsBean.coverImageUrl)
+                .thumbnail(0.1f)
+                .into(new SimpleTarget<Drawable>() {
+                    @Override
+                    public void onResourceReady(Drawable resource, Transition<? super Drawable> transition) {
+                        if (resource == null) {
+                            aciv_goods.setImageResource(R.mipmap.logo_gray);
+                            return;
+                        }
+
+                        aciv_goods.setScaleType(ImageView.ScaleType.CENTER_CROP);
+                        aciv_goods.setImageDrawable(resource);
+                    }
+                });*/
+
+        iv_fav = findViewById(R.id.iv_fav);
+        iv_fav.setOnClickListener(this);
+        findViewById(R.id.iv_ding).setOnClickListener(this);
+        findViewById(R.id.iv_cai).setOnClickListener(this);
+
+        // todo 多图与磁力、描述
+    }
+
+    @Override
+    public void onClick(View v) {
+        switch (v.getId()) {
+            case R.id.iv_ding:
+                // todo 顶
+                break;
+            case R.id.iv_cai:
+                // todo 踩
+                break;
+            case R.id.iv_fav:
+                // todo 收藏
+                iv_fav.setImageResource(R.mipmap.fav_yes);
+                break;
+            default:
+                break;
+        }
+    }
+}

+ 160 - 0
app/src/main/res/layout/activity_goods_detail.xml

@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:fitsSystemWindows="true"
+    android:orientation="vertical">
+
+    <include layout="@layout/view_toolbar" />
+
+
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center_vertical"
+            android:orientation="vertical"
+            android:paddingStart="@dimen/margin_default"
+            android:paddingEnd="@dimen/margin_default">
+
+            <!--标题-->
+            <TextView
+                android:id="@+id/tv_title"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="@dimen/margin_default"
+                android:layout_marginBottom="@dimen/margin_default"
+                android:ellipsize="end"
+                android:maxLines="3"
+                android:textColor="@color/black"
+                android:textSize="@dimen/text_sub_title" />
+
+            <!--todo 详情 字号小一点-->
+
+            <include layout="@layout/view_divider_slight" />
+            <!--好评-->
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="@dimen/margin_s"
+                android:layout_marginBottom="@dimen/margin_s"
+                android:gravity="center_vertical"
+                android:orientation="horizontal">
+
+                <ImageView
+                    android:id="@+id/iv_ding"
+                    android:layout_width="30dp"
+                    android:layout_height="30dp"
+                    android:rotation="180"
+                    android:src="@mipmap/ding"
+                    android:tint="@color/red_droid" />
+
+                <TextView
+                    android:id="@+id/tv_ding"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginStart="@dimen/margin_sss"
+                    android:ellipsize="end"
+                    android:singleLine="true"
+                    android:textColor="@color/gray_text_s"
+                    android:textSize="@dimen/text_shop_name" />
+
+                <ImageView
+                    android:id="@+id/iv_cai"
+                    android:layout_width="30dp"
+                    android:layout_height="30dp"
+                    android:layout_marginStart="@dimen/margin_default"
+                    android:src="@mipmap/ding"
+                    android:tint="@color/green_logo" />
+
+                <TextView
+                    android:id="@+id/tv_cai"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginStart="@dimen/margin_sss"
+                    android:ellipsize="end"
+                    android:singleLine="true"
+                    android:textColor="@color/gray_text_s"
+                    android:textSize="@dimen/text_shop_name" />
+
+                <ImageView
+                    android:layout_width="14dp"
+                    android:layout_height="14dp"
+                    android:layout_marginStart="@dimen/margin_default"
+                    android:src="@mipmap/see"
+                    android:tint="@color/black_text_comfortable"
+                    android:visibility="gone" />
+
+                <TextView
+                    android:id="@+id/tv_see_num"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginStart="@dimen/margin_ss"
+                    android:ellipsize="end"
+                    android:singleLine="true"
+                    android:textColor="@color/gray_text_s"
+                    android:textSize="@dimen/text_shop_name"
+                    android:visibility="gone" />
+
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginStart="@dimen/margin_default"
+                    android:background="@drawable/shape_purple_tag_gradient"
+                    android:paddingStart="@dimen/margin_tag"
+                    android:paddingTop="@dimen/padding_tag"
+                    android:paddingEnd="@dimen/margin_tag"
+                    android:paddingBottom="@dimen/padding_tag"
+                    android:text=" 好评 "
+                    android:textColor="@color/white_slight"
+                    android:textSize="@dimen/text_sss" />
+
+                <TextView
+                    android:id="@+id/tv_good_comment"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:background="@drawable/shape_purple_stroke_right"
+                    android:ellipsize="end"
+                    android:paddingStart="@dimen/margin_tag"
+                    android:paddingTop="@dimen/padding_tag"
+                    android:paddingEnd="@dimen/margin_tag"
+                    android:paddingBottom="@dimen/padding_tag"
+                    android:singleLine="true"
+                    android:text="100%"
+                    android:textColor="@color/black_text"
+                    android:textSize="@dimen/text_sss"
+                    android:textStyle="bold" />
+
+
+                <Space
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1" />
+
+                <ImageView
+                    android:id="@+id/iv_fav"
+                    android:layout_width="22dp"
+                    android:layout_height="22dp"
+                    android:layout_marginStart="@dimen/margin_default"
+                    android:src="@mipmap/fav_no" />
+
+
+            </LinearLayout>
+
+            <include layout="@layout/view_divider_slight" />
+
+            <!--todo 图片-->
+            <androidx.recyclerview.widget.RecyclerView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:nestedScrollingEnabled="false"/>
+
+
+
+
+        </LinearLayout>
+    </ScrollView>
+</LinearLayout>

+ 103 - 98
app/src/main/res/layout/item_goods.xml

@@ -22,132 +22,137 @@
             android:gravity="center_vertical"
             android:orientation="vertical"
             android:padding="@dimen/margin_s">
+            <!--标题-->
+            <TextView
+                android:id="@+id/tv_title"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginBottom="@dimen/margin_ss"
+                android:ellipsize="end"
+                android:maxLines="3"
+                android:textColor="@color/black"
+                android:textSize="@dimen/text_normal_p" />
 
             <FrameLayout
                 android:id="@+id/fl_video_play"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content">
+
                 <com.makeramen.roundedimageview.RoundedImageView
                     android:id="@+id/aciv_goods"
                     android:layout_width="match_parent"
                     android:layout_height="@dimen/height_cover"
                     android:scaleType="centerInside"
-                    app:riv_corner_radius="4dp"
-                    android:src="@mipmap/logo_gray"/>
+                    android:src="@mipmap/logo_gray"
+                    app:riv_corner_radius="4dp" />
 
                 <ImageView
                     android:id="@+id/iv_video_play"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_gravity="center"
-                    android:src="@mipmap/video_play"/>
+                    android:src="@mipmap/video_play"
+                    android:visibility="gone" />
             </FrameLayout>
 
+            <!--好评-->
             <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:orientation="vertical"
-                android:layout_marginTop="@dimen/margin_ss">
-                <!--标题-->
+                android:layout_marginTop="@dimen/margin_ss"
+                android:gravity="center_vertical"
+                android:orientation="horizontal"
+                android:paddingStart="@dimen/margin_ss"
+                android:paddingEnd="@dimen/margin_ss">
+
+                <ImageView
+                    android:layout_width="22dp"
+                    android:layout_height="22dp"
+                    android:rotation="180"
+                    android:src="@mipmap/ding"
+                    android:tint="@color/red_droid" />
+
                 <TextView
-                    android:id="@+id/tv_title"
-                    android:layout_width="match_parent"
+                    android:id="@+id/tv_ding"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_marginBottom="@dimen/margin_ss"
                     android:ellipsize="end"
-                    android:maxLines="3"
-                    android:textColor="@color/black"
-                    android:textSize="@dimen/text_normal_p" />
+                    android:singleLine="true"
+                    android:textColor="@color/gray_text_s"
+                    android:textSize="@dimen/text_shop_name"
+                    android:layout_marginStart="@dimen/margin_sss"/>
 
-                <!--好评-->
-                <LinearLayout
-                    android:layout_width="match_parent"
+                <ImageView
+                    android:layout_width="22dp"
+                    android:layout_height="22dp"
+                    android:layout_marginStart="@dimen/margin_default"
+                    android:src="@mipmap/ding"
+                    android:tint="@color/green_logo" />
+
+                <TextView
+                    android:id="@+id/tv_cai"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:gravity="center_vertical"
-                    android:orientation="horizontal">
-                    <TextView
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:background="@drawable/shape_purple_tag_gradient"
-                        android:paddingStart="@dimen/margin_tag"
-                        android:paddingTop="@dimen/padding_tag"
-                        android:paddingEnd="@dimen/margin_tag"
-                        android:paddingBottom="@dimen/padding_tag"
-                        android:text=" 好评 "
-                        android:textColor="@color/white_slight"
-                        android:textSize="@dimen/text_sss" />
-
-                    <TextView
-                        android:id="@+id/tv_good_comment"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:background="@drawable/shape_purple_stroke_right"
-                        android:ellipsize="end"
-                        android:paddingStart="@dimen/margin_tag"
-                        android:paddingTop="@dimen/padding_tag"
-                        android:paddingEnd="@dimen/margin_tag"
-                        android:paddingBottom="@dimen/padding_tag"
-                        android:singleLine="true"
-                        android:textColor="@color/black_text"
-                        android:textSize="@dimen/text_sss"
-                        android:textStyle="bold"
-                        android:text="100%"/>
-
-
-                    <ImageView
-                        android:layout_width="20dp"
-                        android:layout_height="20dp"
-                        android:src="@mipmap/zan"
-                        android:tint="@color/red_droid"
-                        android:rotation="180"
-                        android:layout_marginStart="@dimen/margin_s"/>
-                    <TextView
-                        android:id="@+id/tv_ding"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:ellipsize="end"
-                        android:singleLine="true"
-                        android:textColor="@color/gray_text_s"
-                        android:textSize="@dimen/text_shop_name"/>
-
-                    <ImageView
-                        android:layout_width="20dp"
-                        android:layout_height="20dp"
-                        android:src="@mipmap/zan"
-                        android:tint="@color/green_logo"
-                        android:layout_marginStart="@dimen/margin_s"/>
-                    <TextView
-                        android:id="@+id/tv_cai"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:ellipsize="end"
-                        android:singleLine="true"
-                        android:textColor="@color/gray_text_s"
-                        android:textSize="@dimen/text_shop_name"/>
-
-                    <Space
-                        android:layout_width="0dp"
-                        android:layout_weight="1"
-                        android:layout_height="wrap_content"/>
-                    <ImageView
-                        android:layout_width="14dp"
-                        android:layout_height="14dp"
-                        android:src="@mipmap/see"
-                        android:tint="@color/black_text_comfortable"
-                        android:layout_marginStart="@dimen/margin_s"/>
-                    <TextView
-                        android:id="@+id/tv_see_num"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:layout_marginStart="@dimen/margin_ss"
-                        android:ellipsize="end"
-                        android:singleLine="true"
-                        android:textColor="@color/gray_text_s"
-                        android:textSize="@dimen/text_shop_name"/>
-
-                </LinearLayout>
+                    android:ellipsize="end"
+                    android:singleLine="true"
+                    android:textColor="@color/gray_text_s"
+                    android:textSize="@dimen/text_shop_name"
+                    android:layout_marginStart="@dimen/margin_sss"/>
+
 
 
+
+                <Space
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1" />
+
+                <ImageView
+                    android:layout_width="14dp"
+                    android:layout_height="14dp"
+                    android:layout_marginStart="@dimen/margin_s"
+                    android:src="@mipmap/see"
+                    android:tint="@color/black_text_comfortable"
+                    android:visibility="gone"/>
+
+                <TextView
+                    android:id="@+id/tv_see_num"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginStart="@dimen/margin_ss"
+                    android:ellipsize="end"
+                    android:singleLine="true"
+                    android:textColor="@color/gray_text_s"
+                    android:textSize="@dimen/text_shop_name"
+                    android:visibility="gone"/>
+
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:background="@drawable/shape_purple_tag_gradient"
+                    android:paddingStart="@dimen/margin_tag"
+                    android:paddingTop="@dimen/padding_tag"
+                    android:paddingEnd="@dimen/margin_tag"
+                    android:paddingBottom="@dimen/padding_tag"
+                    android:text=" 好评 "
+                    android:textColor="@color/white_slight"
+                    android:textSize="@dimen/text_sss" />
+
+                <TextView
+                    android:id="@+id/tv_good_comment"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:background="@drawable/shape_purple_stroke_right"
+                    android:ellipsize="end"
+                    android:paddingStart="@dimen/margin_tag"
+                    android:paddingTop="@dimen/padding_tag"
+                    android:paddingEnd="@dimen/margin_tag"
+                    android:paddingBottom="@dimen/padding_tag"
+                    android:singleLine="true"
+                    android:text="100%"
+                    android:textColor="@color/black_text"
+                    android:textSize="@dimen/text_sss"
+                    android:textStyle="bold" />
             </LinearLayout>
         </LinearLayout>
     </androidx.cardview.widget.CardView>

+ 1 - 1
app/src/main/res/layout/view_divider_slight.xml

@@ -2,5 +2,5 @@
 <View
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="1px"
+    android:layout_height="2px"
     android:background="@color/gray" />

BIN
app/src/main/res/mipmap-xhdpi/fav_no.png


BIN
app/src/main/res/mipmap-xhdpi/fav_yes.png


app/src/main/res/mipmap-xxhdpi/zan.png → app/src/main/res/mipmap-xxhdpi/ding.png