瀏覽代碼

对接机构收到的评论

316044749 7 年之前
父節點
當前提交
e9c20dfa21

+ 1 - 1
app/build.gradle

@@ -11,7 +11,7 @@ android {
         javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }
 
         ndk {
-            abiFilters 'armeabi-v7a'//, 'armeabi-v7a', 'x86_64', 'arm64-v8a', mips, mips64...加入需要生成的文件夹
+            abiFilters 'armeabi-v7a', 'x86'//, 'armeabi-v7a', 'x86_64', 'arm64-v8a', mips, mips64...加入需要生成的文件夹
         }
     }
 

+ 57 - 17
app/src/main/java/com/ynstkz/shitu/android/activity/OrgCommentListActivity.java

@@ -2,6 +2,8 @@ package com.ynstkz.shitu.android.activity;
 
 import android.os.Bundle;
 import android.support.annotation.Nullable;
+import android.view.View;
+import android.widget.ImageView;
 import android.widget.ListView;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
@@ -11,6 +13,7 @@ import com.common.library.pulltorefresh.PullToRefreshBase;
 import com.common.library.pulltorefresh.PullToRefreshListView;
 import com.google.gson.Gson;
 import com.ynstkz.shitu.android.R;
+import com.ynstkz.shitu.android.adapter.OrgCommentListAdapter;
 import com.ynstkz.shitu.android.base.TitleBarActivity;
 import com.ynstkz.shitu.android.bean.EvaluateListBean;
 import com.ynstkz.shitu.android.bean.OrgCommentListBean;
@@ -27,7 +30,7 @@ import okhttp3.Response;
  * 作者:fuchangle on 2018/3/15 17:40
  */
 
-public class OrgCommentListActivity extends TitleBarActivity implements PullToRefreshBase.OnRefreshListener2<ListView>{
+public class OrgCommentListActivity extends TitleBarActivity implements PullToRefreshBase.OnRefreshListener2<ListView> {
 
     @Bind(R.id.tv_title)
     TextView tvTitle;
@@ -35,10 +38,17 @@ public class OrgCommentListActivity extends TitleBarActivity implements PullToRe
     RelativeLayout viewTitle;
     @Bind(R.id.pullToRefresh)
     PullToRefreshListView pullToRefresh;
+    @Bind(R.id.iv_nodata_icon)
+    ImageView ivNodataIcon;
+    @Bind(R.id.tv_nodata_lab)
+    TextView tvNodataLab;
+    @Bind(R.id.rl_nodata)
+    RelativeLayout rlNodata;
 
     private String memberId;
     private int pageNumber;
     private List<EvaluateListBean> evaluateList;
+    private OrgCommentListAdapter orgCommentListAdapter;
 
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
@@ -53,12 +63,12 @@ public class OrgCommentListActivity extends TitleBarActivity implements PullToRe
         return R.layout.activity_org_comment_list;
     }
 
-    private void initView(){
-        tvTitle.setText(getIntent().getStringExtra("收到的评论"));
+    private void initView() {
+        tvTitle.setText("收到的评论");
         pullToRefresh.setOnRefreshListener(this);
     }
 
-    private void initData(){
+    private void initData() {
         memberId = getIntent().getStringExtra("memberId");
         pageNumber = 1;
         getOrgCommentList();
@@ -66,7 +76,7 @@ public class OrgCommentListActivity extends TitleBarActivity implements PullToRe
 
     @Override
     public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
-        pageNumber ++;
+        pageNumber++;
         getOrgCommentList();
     }
 
@@ -76,13 +86,13 @@ public class OrgCommentListActivity extends TitleBarActivity implements PullToRe
         getOrgCommentList();
     }
 
-    private void setListener(){
+    private void setListener() {
 
     }
 
-    private void getOrgCommentList(){
+    private void getOrgCommentList() {
 
-        RequestGroup.getOrgCommentList(pageNumber+"", memberId, new Callback() {
+        RequestGroup.getOrgCommentList(pageNumber + "", memberId, new Callback() {
             @Override
             public Object parseNetworkResponse(Response response, int id) throws Exception {
                 return new Gson().fromJson(response.body().string(), OrgCommentListBean.class);
@@ -95,26 +105,56 @@ public class OrgCommentListActivity extends TitleBarActivity implements PullToRe
 
             @Override
             public void onResponse(Object response, int id) {
-                OrgCommentListBean orgCommentListBean = (OrgCommentListBean)response;
-                if(orgCommentListBean != null){
-                    if("200".equals(orgCommentListBean.getCode())){
-                        if(orgCommentListBean.getData() != null){
-                            if(orgCommentListBean.getData().getEvaluateList() != null
-                                    && orgCommentListBean.getData().getEvaluateList().size() > 0){
-                                if(pageNumber == 1){
-                                    if(evaluateList == null){
+                OrgCommentListBean orgCommentListBean = (OrgCommentListBean) response;
+                if (orgCommentListBean != null) {
+                    if ("200".equals(orgCommentListBean.getCode())) {
+                        if (orgCommentListBean.getData() != null) {
+                            if (orgCommentListBean.getData().getEvaluateList() != null
+                                    && orgCommentListBean.getData().getEvaluateList().size() > 0) {
+                                if (pageNumber == 1) {
+                                    if (evaluateList == null) {
                                         evaluateList = new ArrayList<>();
                                     }
+                                    evaluateList.clear();
                                     evaluateList.addAll(orgCommentListBean.getData().getEvaluateList());
-
+                                    orgCommentListAdapter = new OrgCommentListAdapter(OrgCommentListActivity.this, evaluateList);
+                                    pullToRefresh.setAdapter(orgCommentListAdapter);
+                                    orgCommentListAdapter.notifyDataSetChanged();
+                                } else {
+                                    evaluateList.addAll(orgCommentListBean.getData().getEvaluateList());
+                                    orgCommentListAdapter.notifyDataSetChanged();
+                                }
+                                pullToRefresh.setMode(PullToRefreshBase.Mode.BOTH);
+                            } else {
+                                if(orgCommentListAdapter != null && orgCommentListAdapter.getCount() > 0){
+                                    showToast("已加载完毕!");
+                                } else {
+                                    showNoData();
                                 }
                             }
+                        } else {
+                            if(orgCommentListAdapter != null && orgCommentListAdapter.getCount() > 0){
+                                showToast("已加载完毕!");
+                            } else {
+                                showNoData();
+                            }
                         }
                     } else {
                         showToast(orgCommentListBean.getMsg());
                     }
                 }
+                pullToRefresh.onRefreshComplete();
             }
         });
     }
+
+    /**
+     * 显示无数据
+     */
+    private void showNoData() {
+        pullToRefresh.setVisibility(View.GONE);
+        rlNodata.setVisibility(View.VISIBLE);
+        ivNodataIcon.setImageResource(R.drawable.nodata_common);
+        tvNodataLab.setText(getString(R.string.nodata_org_comment));
+    }
 }

+ 30 - 2
app/src/main/java/com/ynstkz/shitu/android/adapter/OrgCommentListAdapter.java

@@ -1,8 +1,13 @@
 package com.ynstkz.shitu.android.adapter;
 
 import android.content.Context;
+import android.view.Gravity;
 import android.view.View;
+import android.widget.GridView;
+import android.widget.ImageView;
+import android.widget.TextView;
 
+import com.bumptech.glide.Glide;
 import com.common.library.adapter.CCAdapterHolder;
 import com.common.library.adapter.CCListAdapter;
 import com.ynstkz.shitu.android.R;
@@ -10,6 +15,8 @@ import com.ynstkz.shitu.android.bean.EvaluateListBean;
 
 import java.util.List;
 
+import me.zhanghai.android.materialratingbar.MaterialRatingBar;
+
 /**
  * 作者:fuchangle on 2018/3/17 22:50
  */
@@ -35,6 +42,12 @@ public class OrgCommentListAdapter extends CCListAdapter<EvaluateListBean>{
     public CCAdapterHolder<EvaluateListBean> createHolder(int type) {
         return new CCAdapterHolder<EvaluateListBean>() {
 
+            ImageView ivIcon;
+            TextView tvUsername;
+            MaterialRatingBar rbScore;
+            TextView tvContent;
+            GridView gvCommentPic;
+
             @Override
             public int getResource() {
                 return R.layout.item_org_comment_list;
@@ -42,12 +55,27 @@ public class OrgCommentListAdapter extends CCListAdapter<EvaluateListBean>{
 
             @Override
             public void initializeView(View convertView) {
-
+                ivIcon = convertView.findViewById(R.id.iv_icon);
+                tvUsername = convertView.findViewById(R.id.tv_username);
+                rbScore = convertView.findViewById(R.id.rb_score);
+                tvContent = convertView.findViewById(R.id.tv_content);
+                gvCommentPic = convertView.findViewById(R.id.gv_comment_pic);
             }
 
             @Override
             public void updateView(EvaluateListBean content, int position) {
-
+                Glide.with(context).load(content.getHeadPic()).into(ivIcon);
+                tvUsername.setText(content.getUserName());
+                rbScore.setProgress(content.getScore());
+                tvContent.setText(content.getContent());
+                if(content.getEvaluatePicList() != null && content.getEvaluatePicList().size() > 0) {
+                    gvCommentPic.setVisibility(View.VISIBLE);
+                    OrgDetailCommentPicAdapter orgCommentPicAdapter = new OrgDetailCommentPicAdapter(context, content.getEvaluatePicList());
+                    gvCommentPic.setAdapter(orgCommentPicAdapter);
+                    orgCommentPicAdapter.notifyDataSetChanged();
+                } else {
+                    gvCommentPic.setVisibility(View.GONE);
+                }
             }
         };
     }

+ 19 - 3
app/src/main/res/layout/activity_org_comment_list.xml

@@ -6,9 +6,25 @@
 
     <include layout="@layout/view_title"/>
 
-    <com.common.library.pulltorefresh.PullToRefreshListView
-        android:id="@+id/pullToRefresh"
+    <RelativeLayout
         android:layout_width="match_parent"
-        android:layout_height="match_parent"/>
+        android:layout_height="match_parent">
+
+        <com.common.library.pulltorefresh.PullToRefreshListView
+            android:id="@+id/pullToRefresh"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"/>
+
+        <RelativeLayout
+            android:id="@+id/rl_nodata"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:visibility="gone">
+
+            <include layout="@layout/view_nodata"/>
+
+        </RelativeLayout>
+
+    </RelativeLayout>
 
 </LinearLayout>

+ 38 - 3
app/src/main/res/layout/item_org_comment_list.xml

@@ -1,5 +1,6 @@
 <?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"
@@ -7,9 +8,10 @@
 
     <ImageView
         android:id="@+id/iv_icon"
-        android:layout_width="@dimen/company_40dp"
-        android:layout_height="@dimen/company_40dp"
-        android:scaleType="centerCrop"/>
+        android:layout_width="@dimen/company_60dp"
+        android:layout_height="@dimen/company_60dp"
+        android:scaleType="centerCrop"
+        android:background="@mipmap/ic_launcher"/>
 
     <LinearLayout
         android:layout_width="match_parent"
@@ -17,7 +19,40 @@
         android:orientation="vertical"
         android:layout_marginLeft="@dimen/company_10dp">
 
+        <TextView
+            android:id="@+id/tv_username"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textSize="@dimen/company_15sp"
+            android:textColor="@color/color_333"
+            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:layout_marginTop="@dimen/company_5dp"
+            android:isIndicator="true"
+            app:mrb_progressTint="@color/rb_color"
+            app:mrb_secondaryProgressTint="@color/color_999"
+            android:stepSize="0.5"
+            style="@style/Widget.MaterialRatingBar.RatingBar" />
+
+        <TextView
+            android:id="@+id/tv_content"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textSize="@dimen/company_15sp"
+            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>
 

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

@@ -43,7 +43,7 @@
                 app:mrb_progressTint="@color/rb_color"
                 app:mrb_secondaryProgressTint="@color/color_999"
                 android:stepSize="0.5"
-                style="@style/Widget.MaterialRatingBar.RatingBar" />
+                style="@style/Widget.MaterialRatingBar.RatingBar.Indicator.Small" />
 
             <RelativeLayout
                 android:layout_width="match_parent"

+ 2 - 0
app/src/main/res/values/strings.xml

@@ -12,5 +12,7 @@
     <string name="nodata_comment">亲,你还没有评论哦~</string>
     <string name="nodata_apply">亲,你还没有报名哦~</string>
 
+    <string name="nodata_org_comment">亲,还没有收到评论哦~</string>
+
     <string name="token_error">登录过期,请重新登录</string>
 </resources>