瀏覽代碼

添加机构详情评论

316044749 7 年之前
父節點
當前提交
11e840725e

+ 48 - 5
app/src/main/java/com/ynstkz/shitu/android/activity/OrgDetailActivity.java

@@ -4,25 +4,34 @@ import android.content.Intent;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
 import android.support.v4.view.ViewPager;
+import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.AdapterView;
+import android.widget.GridView;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.ListView;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
+import com.bumptech.glide.Glide;
 import com.common.library.okhttp.callback.Callback;
+import com.common.library.utils.DateUtil;
 import com.google.gson.Gson;
 import com.ynstkz.shitu.android.R;
 import com.ynstkz.shitu.android.adapter.OrgCourseListAdapter;
+import com.ynstkz.shitu.android.adapter.OrgDetailCommentPicAdapter;
 import com.ynstkz.shitu.android.base.BaseBean;
 import com.ynstkz.shitu.android.base.TitleBarActivity;
 import com.ynstkz.shitu.android.bean.CourseItemBean;
+import com.ynstkz.shitu.android.bean.EvaluateListBean;
 import com.ynstkz.shitu.android.bean.OrgDetailBean;
 import com.ynstkz.shitu.android.data.RequestGroup;
 import com.ynstkz.shitu.android.view.ListViewForScrollView;
 
+import java.util.Date;
+import java.util.List;
+
 import butterknife.Bind;
 import me.zhanghai.android.materialratingbar.MaterialRatingBar;
 import okhttp3.Call;
@@ -67,6 +76,8 @@ public class OrgDetailActivity extends TitleBarActivity {
     ImageView ivCollect;
     @Bind(R.id.iv_share)
     ImageView ivShare;
+    @Bind(R.id.ll_comment_main)
+    LinearLayout llCommentMain;
 
     private int memberId;
     private OrgDetailBean.DataBean dataBean;
@@ -135,7 +146,7 @@ public class OrgDetailActivity extends TitleBarActivity {
         ivCollect.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                collectOrg(memberId+"");
+                collectOrg(memberId + "");
             }
         });
     }
@@ -195,13 +206,45 @@ public class OrgDetailActivity extends TitleBarActivity {
             lvCourse.setAdapter(orgCourseListAdapter);
             orgCourseListAdapter.notifyDataSetChanged();
         }
+
+        //评论列表
+        List<EvaluateListBean> evaluateList = dataBean.getEvaluateList();
+        if(evaluateList != null && evaluateList.size() > 0){
+            llCommentMain.setVisibility(View.VISIBLE);
+            llCommentMain.removeAllViews();
+            for(int i=0; i<evaluateList.size(); i++){
+                EvaluateListBean evaluateListBean = evaluateList.get(i);
+                View view = LayoutInflater.from(this).inflate(R.layout.item_orgdetail_comment, null);
+                ImageView ivHeadPic = view.findViewById(R.id.iv_headPic);
+                TextView tvUsername = view.findViewById(R.id.tv_username);
+                TextView tvTime = view.findViewById(R.id.tv_time);
+                MaterialRatingBar rbScore = view.findViewById(R.id.rb_score);
+                TextView tvCommentContent = view.findViewById(R.id.tv_comment_content);
+                GridView gvCommentPic = view.findViewById(R.id.gv_comment_pic);
+
+                Glide.with(this).load(evaluateListBean.getHeadPic()).into(ivHeadPic);
+                tvUsername.setText(evaluateListBean.getUserName());
+                tvTime.setText(DateUtil.format(new Date(evaluateListBean.getCreateTime()),DateUtil.DATE_TIME_FORMAT_YYYY年MM月DD日));
+                rbScore.setProgress(evaluateListBean.getScore());
+                tvCommentContent.setText(evaluateListBean.getContent());
+
+                OrgDetailCommentPicAdapter orgDetailCommentPicAdapter = new OrgDetailCommentPicAdapter(OrgDetailActivity.this, evaluateListBean.getEvaluatePicList());
+                gvCommentPic.setAdapter(orgDetailCommentPicAdapter);
+                orgDetailCommentPicAdapter.notifyDataSetChanged();
+
+                llCommentMain.addView(view);
+            }
+        } else {
+            llCommentMain.setVisibility(View.GONE);
+        }
     }
 
     /**
      * 收藏
+     *
      * @param memberId
      */
-    private void collectOrg(String memberId){
+    private void collectOrg(String memberId) {
 
         RequestGroup.sumintCollect(memberId, new Callback() {
             @Override
@@ -216,9 +259,9 @@ public class OrgDetailActivity extends TitleBarActivity {
 
             @Override
             public void onResponse(Object response, int id) {
-                BaseBean baseBean = (BaseBean)response;
-                if(baseBean != null){
-                    if("200".equals(baseBean.getCode())){
+                BaseBean baseBean = (BaseBean) response;
+                if (baseBean != null) {
+                    if ("200".equals(baseBean.getCode())) {
 
                     }
                     showToast(baseBean.getMsg());

+ 59 - 0
app/src/main/java/com/ynstkz/shitu/android/adapter/OrgDetailCommentPicAdapter.java

@@ -0,0 +1,59 @@
+package com.ynstkz.shitu.android.adapter;
+
+import android.content.Context;
+import android.view.View;
+import android.widget.ImageView;
+
+import com.bumptech.glide.Glide;
+import com.common.library.adapter.CCAdapterHolder;
+import com.common.library.adapter.CCListAdapter;
+import com.ynstkz.shitu.android.R;
+import com.ynstkz.shitu.android.bean.EvaluateListBean;
+import com.ynstkz.shitu.android.data.UrlCat;
+
+import java.util.List;
+
+/**
+ * 作者:fuchangle on 2018/3/19 11:09
+ */
+
+public class OrgDetailCommentPicAdapter extends CCListAdapter<EvaluateListBean.EvaluatePicListBean>{
+
+    private Context context;
+    private List<EvaluateListBean.EvaluatePicListBean> adapterContent;
+    /**
+     * Construct list adapter.
+     *
+     * @param context        Context.
+     * @param adapterContent Content to display.
+     */
+    public OrgDetailCommentPicAdapter(Context context, List<EvaluateListBean.EvaluatePicListBean> adapterContent) {
+        super(context, adapterContent);
+        this.context = context;
+        this.adapterContent = adapterContent;
+    }
+
+    @Override
+    public CCAdapterHolder<EvaluateListBean.EvaluatePicListBean> createHolder(int type) {
+
+        return new CCAdapterHolder<EvaluateListBean.EvaluatePicListBean>() {
+
+            ImageView orgdetailCommentPic;
+
+            @Override
+            public int getResource() {
+                return R.layout.item_orgdetail_comment_pic;
+            }
+
+            @Override
+            public void initializeView(View convertView) {
+                orgdetailCommentPic = convertView.findViewById(R.id.iv_comment_pic);
+            }
+
+            @Override
+            public void updateView(EvaluateListBean.EvaluatePicListBean content, int position) {
+                Glide.with(context).load(UrlCat.HOST + content.getPicUrl()).into(orgdetailCommentPic);
+            }
+        };
+    }
+}

+ 9 - 40
app/src/main/java/com/ynstkz/shitu/android/bean/EvaluateListBean.java

@@ -2,7 +2,6 @@ package com.ynstkz.shitu.android.bean;
 
 import com.ynstkz.shitu.android.base.BaseBean;
 
-import java.io.Serializable;
 import java.util.List;
 
 /**
@@ -12,26 +11,12 @@ import java.util.List;
 public class EvaluateListBean extends BaseBean{
 
 
-    /**
-     * score : 5
-     * evaluatePicList : [{"evaluatePicId":3,"evaluateId":3,"picUrl":"/upload/evaluate/8/2018-03-16/txnqm3pjtx9rmxiuaerydm2lm4oyh9yk.jpg"},{"evaluatePicId":4,"evaluateId":3,"picUrl":"/upload/evaluate/8/2018-03-16/3mccmipqme5e1qojv7t5xzhmygjdheh6.jpg"}]
-     * createTime : 1521188739000
-     * memberName : 奥腾专业英语培训机构
-     * userId : 8
-     * headPic : null
-     * content : 很不错的
-     * evaluateId : 3
-     * memberId : 3
-     */
-
     private int score;
     private long createTime;
-    private String memberName;
-    private int userId;
+    private String userName;
     private String headPic;
     private String content;
     private int evaluateId;
-    private int memberId;
     private List<EvaluatePicListBean> evaluatePicList;
 
     public int getScore() {
@@ -50,20 +35,12 @@ public class EvaluateListBean extends BaseBean{
         this.createTime = createTime;
     }
 
-    public String getMemberName() {
-        return memberName;
-    }
-
-    public void setMemberName(String memberName) {
-        this.memberName = memberName;
-    }
-
-    public int getUserId() {
-        return userId;
+    public String getUserName() {
+        return userName;
     }
 
-    public void setUserId(int userId) {
-        this.userId = userId;
+    public void setUserName(String userName) {
+        this.userName = userName;
     }
 
     public String getHeadPic() {
@@ -90,14 +67,6 @@ public class EvaluateListBean extends BaseBean{
         this.evaluateId = evaluateId;
     }
 
-    public int getMemberId() {
-        return memberId;
-    }
-
-    public void setMemberId(int memberId) {
-        this.memberId = memberId;
-    }
-
     public List<EvaluatePicListBean> getEvaluatePicList() {
         return evaluatePicList;
     }
@@ -106,11 +75,11 @@ public class EvaluateListBean extends BaseBean{
         this.evaluatePicList = evaluatePicList;
     }
 
-    public static class EvaluatePicListBean implements Serializable{
+    public static class EvaluatePicListBean {
         /**
-         * evaluatePicId : 3
-         * evaluateId : 3
-         * picUrl : /upload/evaluate/8/2018-03-16/txnqm3pjtx9rmxiuaerydm2lm4oyh9yk.jpg
+         * evaluatePicId : 1
+         * evaluateId : 2
+         * picUrl : /upload/evaluate/8/2018-03-16/oucpol4gpoj5bgsff79yjz3n5j7xakeg.
          */
 
         private int evaluatePicId;

+ 0 - 75
app/src/main/java/com/ynstkz/shitu/android/bean/OrgDetailBean.java

@@ -140,80 +140,5 @@ public class OrgDetailBean extends BaseBean{
             this.showPicList = showPicList;
         }
 
-        public static class EvaluateListBean {
-            /**
-             * evaluateId : 1
-             * userId : 1
-             * memberId : 1
-             * score : 3
-             * content : null
-             * createTime : null
-             * updateTime : null
-             */
-
-            private int evaluateId;
-            private int userId;
-            private int memberId;
-            private int score;
-            private Object content;
-            private Object createTime;
-            private Object updateTime;
-
-            public int getEvaluateId() {
-                return evaluateId;
-            }
-
-            public void setEvaluateId(int evaluateId) {
-                this.evaluateId = evaluateId;
-            }
-
-            public int getUserId() {
-                return userId;
-            }
-
-            public void setUserId(int userId) {
-                this.userId = userId;
-            }
-
-            public int getMemberId() {
-                return memberId;
-            }
-
-            public void setMemberId(int memberId) {
-                this.memberId = memberId;
-            }
-
-            public int getScore() {
-                return score;
-            }
-
-            public void setScore(int score) {
-                this.score = score;
-            }
-
-            public Object getContent() {
-                return content;
-            }
-
-            public void setContent(Object content) {
-                this.content = content;
-            }
-
-            public Object getCreateTime() {
-                return createTime;
-            }
-
-            public void setCreateTime(Object createTime) {
-                this.createTime = createTime;
-            }
-
-            public Object getUpdateTime() {
-                return updateTime;
-            }
-
-            public void setUpdateTime(Object updateTime) {
-                this.updateTime = updateTime;
-            }
-        }
     }
 }

+ 6 - 0
app/src/main/res/layout/activity_org_detail.xml

@@ -250,6 +250,12 @@
 
                 </RelativeLayout>
 
+                <LinearLayout
+                    android:id="@+id/ll_comment_main"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:orientation="vertical"/>
+
             </LinearLayout>
 
             <LinearLayout

+ 100 - 0
app/src/main/res/layout/item_orgdetail_comment.xml

@@ -0,0 +1,100 @@
+<?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"
+    android:orientation="horizontal"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:layout_marginTop="@dimen/company_5dp"
+    android:layout_marginBottom="@dimen/company_10dp">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal">
+
+        <ImageView
+            android:id="@+id/iv_headPic"
+            android:layout_width="@dimen/company_70dp"
+            android:layout_height="@dimen/company_70dp"
+            android:background="@mipmap/ic_launcher"/>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical"
+            android:layout_marginLeft="@dimen/company_10dp">
+
+            <RelativeLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+
+                <TextView
+                    android:id="@+id/tv_username"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textSize="@dimen/company_16sp"
+                    android:textColor="@color/color_333"
+                    android:text="某某老师"/>
+
+                <TextView
+                    android:id="@+id/tv_time"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_centerVertical="true"
+                    android:layout_alignParentRight="true"
+                    android:textSize="11sp"
+                    android:textColor="@color/color_999"/>
+
+            </RelativeLayout>
+
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="center_vertical"
+                    android:textColor="@color/color_666"
+                    android:textSize="@dimen/company_14sp"
+                    android:text="打分"/>
+
+                <me.zhanghai.android.materialratingbar.MaterialRatingBar
+                    android:id="@+id/rb_score"
+                    android:layout_width="@dimen/company_90dp"
+                    android:layout_height="@dimen/company_20dp"
+                    android:isIndicator="true"
+                    app:mrb_progressTint="@color/rb_color"
+                    app:mrb_secondaryProgressTint="@color/color_999"
+                    android:stepSize="0.5"
+                    style="@style/Widget.MaterialRatingBar.RatingBar" />
+
+            </LinearLayout>
+
+            <TextView
+                android:id="@+id/tv_comment_content"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textSize="@dimen/company_14sp"
+                android:textColor="@color/color_666"
+                android:text="老师教的很好,很有耐心!"/>
+
+            <GridView
+                android:id="@+id/gv_comment_pic"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:paddingTop="@dimen/company_10dp"
+                android:paddingBottom="@dimen/company_10dp"
+                android:numColumns="4"/>
+
+        </LinearLayout>
+
+
+    </LinearLayout>
+
+
+    <include layout="@layout/view_default_line"/>
+
+</LinearLayout>

+ 8 - 0
app/src/main/res/layout/item_orgdetail_comment_pic.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/iv_comment_pic"
+    android:orientation="vertical"
+    android:layout_width="@dimen/company_70dp"
+    android:layout_height="@dimen/company_70dp">
+
+</ImageView>