316044749 7 vuotta sitten
vanhempi
commit
5d61f60e20

+ 23 - 2
app/src/main/java/com/ynstkz/shitu/android/activity/MineCommentActivity.java

@@ -4,10 +4,12 @@ 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;
 
 import com.common.library.okhttp.callback.Callback;
+import com.common.library.pulltorefresh.PullToRefreshBase;
 import com.common.library.pulltorefresh.PullToRefreshListView;
 import com.google.gson.Gson;
 import com.ynstkz.shitu.android.R;
@@ -27,7 +29,7 @@ import okhttp3.Response;
  * 作者:fuchangle on 2018/2/11 15:37
  */
 
-public class MineCommentActivity extends TitleBarActivity {
+public class MineCommentActivity extends TitleBarActivity implements PullToRefreshBase.OnRefreshListener2<ListView>{
 
     @Bind(R.id.tv_title)
     TextView tvTitle;
@@ -64,6 +66,7 @@ public class MineCommentActivity extends TitleBarActivity {
 
     private void initView() {
         tvTitle.setText("我的评论");
+        pullToRefresh.setOnRefreshListener(this);
     }
 
     private void initData() {
@@ -76,6 +79,18 @@ public class MineCommentActivity extends TitleBarActivity {
 
     }
 
+    @Override
+    public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
+        pageNumber++;
+        getMyCommnet();
+    }
+
+    @Override
+    public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
+        pageNumber = 1;
+        getMyCommnet();
+    }
+
     /**
      * 获取我的评论
      */
@@ -90,6 +105,7 @@ public class MineCommentActivity extends TitleBarActivity {
             @Override
             public void onError(Call call, Exception e, int id) {
                 showToast(getString(R.string.error_msg));
+                pullToRefresh.onRefreshComplete();
             }
 
             @Override
@@ -113,7 +129,11 @@ public class MineCommentActivity extends TitleBarActivity {
                                     mineCommentItemAdapter.notifyDataSetChanged();
                                 }
                             } else {
-                                showNoData();
+                                if(mineCommentItemAdapter != null && mineCommentItemAdapter.getCount() > 0){
+                                    showToast("没有更过数据");
+                                } else {
+                                    showNoData();
+                                }
                             }
                         } else {
                             showNoData();
@@ -122,6 +142,7 @@ public class MineCommentActivity extends TitleBarActivity {
                         showToast(myCommnetBean.getMsg());
                     }
                 }
+                pullToRefresh.onRefreshComplete();
             }
         });
     }

+ 45 - 0
app/src/main/java/com/ynstkz/shitu/android/activity/OrgDetailActivity.java

@@ -16,6 +16,7 @@ import com.common.library.okhttp.callback.Callback;
 import com.google.gson.Gson;
 import com.ynstkz.shitu.android.R;
 import com.ynstkz.shitu.android.adapter.OrgCourseListAdapter;
+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.OrgDetailBean;
@@ -62,6 +63,10 @@ public class OrgDetailActivity extends TitleBarActivity {
     ImageView ivWriteComment;
     @Bind(R.id.tv_comment_list)
     TextView tvCommentList;
+    @Bind(R.id.iv_collect)
+    ImageView ivCollect;
+    @Bind(R.id.iv_share)
+    ImageView ivShare;
 
     private int memberId;
     private OrgDetailBean.DataBean dataBean;
@@ -123,6 +128,16 @@ public class OrgDetailActivity extends TitleBarActivity {
                 startActivity(intent);
             }
         });
+
+        /**
+         * 收藏
+         */
+        ivCollect.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                collectOrg(memberId+"");
+            }
+        });
     }
 
     /**
@@ -181,4 +196,34 @@ public class OrgDetailActivity extends TitleBarActivity {
             orgCourseListAdapter.notifyDataSetChanged();
         }
     }
+
+    /**
+     * 收藏
+     * @param memberId
+     */
+    private void collectOrg(String memberId){
+
+        RequestGroup.sumintCollect(memberId, new Callback() {
+            @Override
+            public Object parseNetworkResponse(Response response, int id) throws Exception {
+                return new Gson().fromJson(response.body().string(), BaseBean.class);
+            }
+
+            @Override
+            public void onError(Call call, Exception e, int id) {
+                showToast(getString(R.string.error_msg));
+            }
+
+            @Override
+            public void onResponse(Object response, int id) {
+                BaseBean baseBean = (BaseBean)response;
+                if(baseBean != null){
+                    if("200".equals(baseBean.getCode())){
+
+                    }
+                    showToast(baseBean.getMsg());
+                }
+            }
+        });
+    }
 }

+ 15 - 1
app/src/main/java/com/ynstkz/shitu/android/adapter/MineCommentItemAdapter.java

@@ -2,9 +2,11 @@ package com.ynstkz.shitu.android.adapter;
 
 import android.annotation.SuppressLint;
 import android.content.Context;
+import android.content.Intent;
 import android.support.v4.content.ContextCompat;
 import android.view.View;
 import android.widget.ImageView;
+import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import com.bumptech.glide.Glide;
@@ -14,6 +16,7 @@ import com.common.library.utils.DateUtil;
 import com.github.vipulasri.timelineview.TimelineView;
 import com.ynstkz.shitu.android.R;
 import com.ynstkz.shitu.android.activity.OrgCommentItemBean;
+import com.ynstkz.shitu.android.activity.OrgDetailActivity;
 import com.ynstkz.shitu.android.utils.VectorDrawableUtils;
 
 import java.util.Date;
@@ -52,6 +55,7 @@ public class MineCommentItemAdapter extends CCListAdapter{
             TextView tvOrgName;
             ImageView ivOrgIcon;
             TextView tvAddress;
+            LinearLayout llOrgMain;
 
             @Override
             public int getResource() {
@@ -67,13 +71,14 @@ public class MineCommentItemAdapter extends CCListAdapter{
                 tvOrgName = convertView.findViewById(R.id.tv_org_name);
                 ivOrgIcon = convertView.findViewById(R.id.iv_org_icon);
                 tvAddress = convertView.findViewById(R.id.tv_address);
+                llOrgMain = convertView.findViewById(R.id.ll_org_main);
             }
 
             @SuppressLint("SetTextI18n")
             @Override
             public void updateView(Object content, int position) {
 
-                OrgCommentItemBean orgCommentItemBean = adapterContent.get(position);
+                final OrgCommentItemBean orgCommentItemBean = adapterContent.get(position);
                 if(position == 0){
                     timeMarker.setMarker(VectorDrawableUtils.getDrawable(context, R.drawable.ic_marker_inactive, R.color.main_color));
                     tvDate.setText(DateUtil.format(new Date(orgCommentItemBean.getCreateTime()), "yyyy") + "\n" +
@@ -90,6 +95,15 @@ public class MineCommentItemAdapter extends CCListAdapter{
                 tvOrgName.setText(orgCommentItemBean.getMemberName());
                 Glide.with(context).load(orgCommentItemBean.getHeadPic()).into(ivOrgIcon);
                 tvAddress.setText(orgCommentItemBean.getAddress());
+
+                llOrgMain.setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View view) {
+                        Intent intent = new Intent(context, OrgDetailActivity.class);
+                        intent.putExtra("memberId", orgCommentItemBean.getMemberId());
+                        context.startActivity(intent);
+                    }
+                });
             }
         };
     }

+ 71 - 0
app/src/main/java/com/ynstkz/shitu/android/bean/MyCollectBean.java

@@ -2,9 +2,80 @@ package com.ynstkz.shitu.android.bean;
 
 import com.ynstkz.shitu.android.base.BaseBean;
 
+import java.io.Serializable;
+import java.util.List;
+
 /**
  * 作者:fuchangle on 2018/2/27 11:38
  */
 
 public class MyCollectBean extends BaseBean{
+
+
+    private DataBean data;
+
+    public DataBean getData() {
+        return data;
+    }
+
+    public void setData(DataBean data) {
+        this.data = data;
+    }
+
+    public static class DataBean implements Serializable{
+        /**
+         * total : 1
+         * current : 1
+         * pages : 1
+         * size : 10
+         * records : [{"score":0,"collectId":1,"memberName":"xxx机构培训123","lon":null,"viewCount":0,"headPic":null,"lat":null,"memberId":2}]
+         */
+
+        private int total;
+        private int current;
+        private int pages;
+        private int size;
+        private List<OrgItemBean> records;
+
+        public int getTotal() {
+            return total;
+        }
+
+        public void setTotal(int total) {
+            this.total = total;
+        }
+
+        public int getCurrent() {
+            return current;
+        }
+
+        public void setCurrent(int current) {
+            this.current = current;
+        }
+
+        public int getPages() {
+            return pages;
+        }
+
+        public void setPages(int pages) {
+            this.pages = pages;
+        }
+
+        public int getSize() {
+            return size;
+        }
+
+        public void setSize(int size) {
+            this.size = size;
+        }
+
+        public List<OrgItemBean> getRecords() {
+            return records;
+        }
+
+        public void setRecords(List<OrgItemBean> records) {
+            this.records = records;
+        }
+
+    }
 }

+ 12 - 0
app/src/main/java/com/ynstkz/shitu/android/data/RequestGroup.java

@@ -359,4 +359,16 @@ public class RequestGroup {
         params.put("memberId", memberId);
         OkHttpUtils.get().url(UrlCat.URL_ORG_COMMNET_LIST).params(params).build().execute(callback);
     }
+
+    /**
+     * 收藏
+     * @param memberId
+     * @param callback
+     */
+    public static void sumintCollect(String memberId, Callback callback){
+        Map<String, String> params = getSystemParams();
+        params.put("memberId", memberId);
+        OkHttpUtils.get().url(UrlCat.URL_COLLECT_SUBMIT).addHeader(KEY_TOKEN,
+                SharedPreferencesUtils.getToken()).params(params).build().execute(callback);
+    }
 }

+ 5 - 0
app/src/main/java/com/ynstkz/shitu/android/data/UrlCat.java

@@ -147,6 +147,11 @@ public class UrlCat {
      * 评论列表
      */
     public static final String URL_ORG_COMMNET_LIST = HOST + "api/evaluate/agency/list";
+
+    /**
+     * 提交收藏
+     */
+    public static final String URL_COLLECT_SUBMIT = HOST + "api/collect/submit";
 }
 
 

BIN
app/src/main/res/drawable-xxhdpi/collect_icon.png


BIN
app/src/main/res/drawable-xxhdpi/share_icon.png


+ 49 - 1
app/src/main/res/layout/activity_org_detail.xml

@@ -6,7 +6,55 @@
     android:background="@color/default_bg"
     android:orientation="vertical">
 
-    <include layout="@layout/view_title" />
+    <RelativeLayout
+        android:id="@+id/view_title"
+        android:layout_width="match_parent"
+        android:layout_height="?attr/actionBarSize"
+        android:background="@color/colorPrimary">
+
+        <ImageView
+            android:id="@+id/iv_back"
+            android:layout_width="@dimen/company_20dp"
+            android:layout_height="@dimen/company_20dp"
+            android:layout_centerVertical="true"
+            android:layout_marginLeft="@dimen/company_10dp"
+            android:src="@drawable/back_icon"/>
+
+        <TextView
+            android:id="@+id/tv_title"
+            style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerInParent="true"
+            android:lines="1"
+            android:ellipsize="end"
+            android:scrollHorizontally="true"
+            android:textColor="@color/white"/>
+
+        <LinearLayout
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentRight="true"
+            android:layout_centerVertical="true"
+            android:paddingRight="@dimen/company_10dp"
+            android:orientation="horizontal">
+
+            <ImageView
+                android:id="@+id/iv_collect"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:src="@drawable/collect_icon"
+                android:layout_marginRight="@dimen/company_15dp"/>
+
+            <ImageView
+                android:id="@+id/iv_share"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:src="@drawable/share_icon"/>
+
+        </LinearLayout>
+
+    </RelativeLayout>
 
     <ScrollView
         android:layout_width="match_parent"

+ 1 - 0
app/src/main/res/layout/item_minecomment_list.xml

@@ -52,6 +52,7 @@
             android:textColor="@color/color_666"/>
 
         <LinearLayout
+            android:id="@+id/ll_org_main"
             android:layout_width="match_parent"
             android:layout_height="@dimen/company_60dp"
             android:orientation="horizontal"