Junqin Wang 8 jaren geleden
bovenliggende
commit
35510bb1e6
48 gewijzigde bestanden met toevoegingen van 1442 en 359 verwijderingen
  1. 6 0
      app/AndroidManifest.xml
  2. 7 7
      app/app.iml
  3. BIN
      app/res/drawable-hdpi/ico_userinfo_setting.png
  4. BIN
      app/res/drawable-mdpi/ico_userinfo_setting.png
  5. BIN
      app/res/drawable-xhdpi/ico_userinfo_setting.png
  6. BIN
      app/res/drawable-xxhdpi/ico_userinfo_setting.png
  7. BIN
      app/res/drawable-xxxhdpi/ico_userinfo_setting.png
  8. 1 1
      app/res/drawable/shape_button_rc_solid_bg_primarycolor.xml
  9. 1 4
      app/res/layout/area_group_item.xml
  10. 24 0
      app/res/layout/area_group_nearby_group_activity.xml
  11. 2 1
      app/res/layout/area_groups_list_fragment.xml
  12. 16 0
      app/res/layout/friends_add_notification_activity.xml
  13. 61 0
      app/res/layout/item_add_friends_notification.xml
  14. 2 2
      app/res/layout/item_phone_contact_layout.xml
  15. 72 0
      app/res/layout/mine_complaint_activity.xml
  16. 95 89
      app/res/layout/mine_user_info_details.xml
  17. 1 1
      app/res/layout/session_list.xml
  18. 1 1
      app/res/layout/trade_list_fragment.xml
  19. 6 2
      app/res/layout/trade_list_search.xml
  20. 164 0
      app/res/layout/user_info_setting_activity.xml
  21. 2 2
      app/src/com/sheishuo/app/common/beans/TradeBean.java
  22. 2 1
      app/src/com/sheishuo/app/common/util/net/INet.java
  23. 60 4
      app/src/com/sheishuo/app/common/util/net/NetImpl.java
  24. 1 0
      app/src/com/sheishuo/app/common/util/net/NetInfo.java
  25. 6 2
      app/src/com/sheishuo/app/contact/ContactHelper.java
  26. 4 4
      app/src/com/sheishuo/app/core_module/circle/activity/CircleDetailsActivity.java
  27. 20 1
      app/src/com/sheishuo/app/core_module/friends/activity/AddNewFriendActivity.java
  28. 79 3
      app/src/com/sheishuo/app/core_module/friends/activity/PhoneContactsActivity.java
  29. 39 4
      app/src/com/sheishuo/app/core_module/friends/adapter/PhoneContactItemAdapter.java
  30. 62 0
      app/src/com/sheishuo/app/core_module/mine/view/ui/activity/ComplaintActivity.java
  31. 30 0
      app/src/com/sheishuo/app/core_module/mine/view/ui/activity/MineOthersCircleActivity.java
  32. 85 34
      app/src/com/sheishuo/app/core_module/mine/view/ui/activity/UserInfoDetailActivity.java
  33. 116 0
      app/src/com/sheishuo/app/core_module/mine/view/ui/activity/UserInfoSettingActivity.java
  34. 132 0
      app/src/com/sheishuo/app/core_module/sheishuo/view/ui/NearbyGroupActivity.java
  35. 68 72
      app/src/com/sheishuo/app/core_module/trade/view/adapter/TradeItemAdapter.java
  36. 54 3
      app/src/com/sheishuo/app/core_module/trade/view/ui/activity/TradeSearchActivity.java
  37. 5 1
      app/src/com/sheishuo/app/main/activity/MainActivity.java
  38. 5 0
      app/src/com/sheishuo/app/main/activity/SystemMessageActivity.java
  39. 134 85
      app/src/com/sheishuo/app/main/fragment/AreaGroupsFragment.java
  40. 6 0
      app/src/com/sheishuo/app/main/fragment/CircleOfFriendsFragment.java
  41. 9 0
      app/src/com/sheishuo/app/main/fragment/HomeFragment.java
  42. 13 6
      app/src/com/sheishuo/app/main/fragment/MineFragment.java
  43. 7 19
      app/src/com/sheishuo/app/main/fragment/TradeListFragment.java
  44. 23 0
      app/src/com/sheishuo/app/session/SessionHelper.java
  45. 1 1
      uikit/src/com/netease/nim/uikit/recent/holder/RecentViewHolder.java
  46. 1 0
      uikit/src/com/netease/nim/uikit/session/activity/WatchPictureData.java
  47. 12 2
      uikit/src/com/netease/nim/uikit/session/module/input/InputPanel.java
  48. 7 7
      uikit/uikit.iml

+ 6 - 0
app/AndroidManifest.xml

@@ -127,6 +127,8 @@
             android:theme="@style/AppTheme.NoActionBar"/>
         <activity android:name=".core_module.sheishuo.view.ui.SettingTextEditActivity"
             android:theme="@style/AppTheme.NoActionBar"/>
+        <activity android:name=".core_module.sheishuo.view.ui.NearbyGroupActivity"
+            android:theme="@style/AppTheme.NoActionBar"/>
 
         <!--朋友圈相关-->
         <activity android:name=".core_module.circle.activity.NewTweetingActivity"
@@ -165,6 +167,10 @@
             android:theme="@style/AppTheme.NoActionBar"/>
         <activity android:name=".core_module.mine.view.ui.activity.HobbySelectActivity"
             android:theme="@style/AppTheme.NoActionBar"/>
+        <activity android:name=".core_module.mine.view.ui.activity.UserInfoSettingActivity"
+            android:theme="@style/AppTheme.NoActionBar"/>
+        <activity android:name=".core_module.mine.view.ui.activity.ComplaintActivity"
+            android:theme="@style/AppTheme.NoActionBar"/>
 
         <!--交易帖相关Activity-->
         <activity android:name=".core_module.trade.view.ui.activity.TradeChangePriorityActivity"

+ 7 - 7
app/app.iml

@@ -59,13 +59,6 @@
       <sourceFolder url="file://$MODULE_DIR$/assets" type="java-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
@@ -73,6 +66,13 @@
       <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
       <excludeFolder url="file://$MODULE_DIR$/build/.DS_Store" />
       <excludeFolder url="file://$MODULE_DIR$/build/freeline" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/.DS_Store" />

BIN
app/res/drawable-hdpi/ico_userinfo_setting.png


BIN
app/res/drawable-mdpi/ico_userinfo_setting.png


BIN
app/res/drawable-xhdpi/ico_userinfo_setting.png


BIN
app/res/drawable-xxhdpi/ico_userinfo_setting.png


BIN
app/res/drawable-xxxhdpi/ico_userinfo_setting.png


+ 1 - 1
app/res/drawable/shape_button_rc_solid_bg_green.xml → app/res/drawable/shape_button_rc_solid_bg_primarycolor.xml

@@ -2,5 +2,5 @@
 <shape xmlns:android="http://schemas.android.com/apk/res/android">
 
     <corners android:radius="15dp"/>
-    <solid android:color="@color/green_4DC0A4"/>
+    <solid android:color="@color/colorPrimary"/>
 </shape>

+ 1 - 4
app/res/layout/area_group_item.xml

@@ -18,15 +18,13 @@
         <com.netease.nim.uikit.common.ui.imageview.HeadImageView
             android:id="@+id/area_groups_item_avatar"
             android:layout_width="48dp"
-            android:layout_height="48dp"
-            android:src="@drawable/ico_01_guojiaqun"/>
+            android:layout_height="48dp" />
         <TextView
             android:id="@+id/group_name"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_toRightOf="@id/area_groups_item_avatar"
             android:layout_toEndOf="@id/area_groups_item_avatar"
-            android:text="国家群"
             android:layout_marginTop="10dp"
             android:layout_marginLeft="10dp"
             android:layout_marginStart="10dp"/>
@@ -37,7 +35,6 @@
             android:layout_toRightOf="@id/area_groups_item_avatar"
             android:layout_toEndOf="@id/area_groups_item_avatar"
             android:layout_below="@id/group_name"
-            android:text="324人热聊中"
             android:textColor="@color/grey_light"
             android:layout_alignStart="@id/group_name"
             android:layout_alignLeft="@id/group_name"/>

+ 24 - 0
app/res/layout/area_group_nearby_group_activity.xml

@@ -0,0 +1,24 @@
+<?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="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+    <android.support.design.widget.AppBarLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+        <com.sheishuo.app.common.views.BaseToolbar
+            android:id="@id/toolbar"
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/action_bar_height"
+            app:title="附近群"
+            app:left_text="返回"
+            style="@style/fullToolbarStyle"/>
+    </android.support.design.widget.AppBarLayout>
+
+
+    <android.support.v7.widget.RecyclerView
+        android:id="@+id/area_group_nearby_group_recyclerview"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"/>
+</LinearLayout>

+ 2 - 1
app/res/layout/area_groups_list_fragment.xml

@@ -72,6 +72,7 @@
                 android:src="@drawable/ico_01_fujinqun" />
 
             <TextView
+                android:id="@+id/area_groups_nearby_groups_TV"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="10dp"
@@ -104,7 +105,7 @@
             <android.support.v7.widget.RecyclerView
                 android:id="@+id/area_groups_nearby_recyclerview"
                 android:layout_width="match_parent"
-                android:layout_height="700dp"
+                android:layout_height="wrap_content"
                 android:background="@color/white" />
 
             <View

+ 16 - 0
app/res/layout/friends_add_notification_activity.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical" android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <android.support.design.widget.AppBarLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+        <com.sheishuo.app.common.views.BaseToolbar
+            android:id="@+id/toolbar"
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/action_bar_height"/>
+    </android.support.design.widget.AppBarLayout>
+
+
+</LinearLayout>

+ 61 - 0
app/res/layout/item_add_friends_notification.xml

@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical" android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:padding="8dp">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal">
+        <com.netease.nim.uikit.common.ui.imageview.HeadImageView
+            android:id="@+id/item_add_friends_notification_avatar"
+            android:layout_width="48dp"
+            android:layout_height="48dp" />
+        <LinearLayout
+            android:layout_weight="5"
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:orientation="vertical">
+            <TextView
+                android:id="@+id/item_add_friends_notification_name_TV"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="用户昵称"/>
+
+
+            <TextView
+                android:id="@+id/item_add_friends_notification_msg_TV"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textColor="@color/grey_light"
+                android:text="附加信息"
+                android:layout_marginTop="8dp"/>
+
+        </LinearLayout>
+
+        <Button
+            android:id="@+id/item_add_friends_notification_follow_btn"
+            android:layout_width="wrap_content"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:text="关注"
+            android:background="@drawable/shape_button_rc_solid_bg_primarycolor"
+            android:textColor="@color/white"/>
+
+        <TextView
+            android:layout_weight="1"
+            android:id="@+id/item_add_friends_notification_has_followed_TV"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="已关注"
+            android:textColor="@color/grey_light"
+            android:gravity="center"
+            android:visibility="gone"/>
+    </LinearLayout>
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="1dp"
+        android:background="@color/grey_light"
+        android:layout_marginTop="8dp"/>
+</LinearLayout>

+ 2 - 2
app/res/layout/item_phone_contact_layout.xml

@@ -45,9 +45,9 @@
         android:id="@+id/item_phone_contact_add_friends_btn"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:text="已关注"
+        android:text="已添加"
         android:textColor="@color/white"
-        android:background="@drawable/shape_button_rc_solid_bg_green"
+        android:background="@drawable/shape_button_rc_solid_bg_primarycolor"
         android:layout_marginRight="8dp"
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toTopOf="parent"

+ 72 - 0
app/res/layout/mine_complaint_activity.xml

@@ -0,0 +1,72 @@
+<?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="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <android.support.design.widget.AppBarLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+        <com.sheishuo.app.common.views.BaseToolbar
+            android:id="@+id/toolbar"
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/action_bar_height"
+            app:title="投诉"
+            app:left_text="返回"
+            style="@style/fullToolbarStyle"/>
+    </android.support.design.widget.AppBarLayout>
+
+
+    <LinearLayout
+        android:id="@+id/mine_complaint_type_layout"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical">
+        <RadioGroup
+            android:id="@+id/mine_complaint_radiogroup"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:padding="8dp">
+                <RadioButton
+                    android:id="@+id/mine_complaint_type_ad"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:text="广告骚扰"
+                    android:padding="16dp"/>
+                <RadioButton
+                    android:id="@+id/mine_complaint_type_vulgar"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:text="色情低俗"
+                    android:padding="16dp"/>
+                <RadioButton
+                    android:id="@+id/mine_complaint_type_politics"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:text="政治敏感"
+                    android:padding="16dp"/>
+                <RadioButton
+                    android:id="@+id/mine_complaint_type_cheat"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:text="欺诈骗钱"
+                    android:padding="16dp"/>
+                <RadioButton
+                    android:id="@+id/mine_complaint_type_illegal"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:text="违法(暴力恐怖、违禁品等)"
+                    android:padding="16dp"/>
+        </RadioGroup>
+
+        <Button
+            android:id="@+id/mine_complaint_submit_btn"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:background="@drawable/btn1_selector"
+            android:text="下一步"
+            android:textColor="@color/white"
+            android:layout_margin="16dp"/>
+    </LinearLayout>
+</LinearLayout>

+ 95 - 89
app/res/layout/mine_user_info_details.xml

@@ -22,29 +22,49 @@
                 android:background="@drawable/mine_user_info_banner"
                 android:orientation="vertical">
 
-                <android.support.design.widget.CoordinatorLayout
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:paddingBottom="24dp"
-                    android:paddingTop="24dp">
 
-                    <com.netease.nim.uikit.common.ui.imageview.HeadImageView
-                        android:id="@+id/user_info_details_avatar"
-                        android:layout_width="96dp"
-                        android:layout_height="96dp"
-                        android:layout_gravity="center"
-                        android:src="@drawable/nim_avatar_default" />
+                <FrameLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content">
 
                     <ImageView
-                        android:id="@+id/user_info_details_gender"
+                        android:id="@+id/user_info_details_setting"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
-                        android:layout_marginBottom="8dp"
-                        android:src="@drawable/mine_gender_male"
-                        app:layout_anchor="@id/user_info_details_avatar"
-                        app:layout_anchorGravity="end|bottom" />
+                        android:layout_gravity="top|end"
+                        android:layout_margin="8dp"
+                        android:src="@drawable/ico_userinfo_setting"
+                        app:layout_anchorGravity="top|end" />
+
+                    <android.support.design.widget.CoordinatorLayout
+                        android:id="@+id/user_info_details_coordinator_layout"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:paddingBottom="24dp"
+                        android:paddingTop="24dp">
+
+
+
+
+                        <com.netease.nim.uikit.common.ui.imageview.HeadImageView
+                            android:id="@+id/user_info_details_avatar"
+                            android:layout_width="96dp"
+                            android:layout_height="96dp"
+                            android:layout_gravity="center"
+                            android:src="@drawable/nim_avatar_default" />
 
-                </android.support.design.widget.CoordinatorLayout>
+                        <ImageView
+                            android:id="@+id/user_info_details_gender"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_marginBottom="8dp"
+                            android:src="@drawable/mine_gender_male"
+                            app:layout_anchor="@id/user_info_details_avatar"
+                            app:layout_anchorGravity="end|bottom" />
+
+                    </android.support.design.widget.CoordinatorLayout>
+
+                </FrameLayout>
 
                 <LinearLayout
                     android:layout_width="match_parent"
@@ -57,15 +77,15 @@
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:text="用户昵称"
-                        android:textSize="18sp"
-                        android:textColor="@color/white"/>
+                        android:textColor="@color/white"
+                        android:textSize="18sp" />
 
                     <TextView
                         android:id="@+id/user_info_details_id"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:text="用户ID"
-                        android:textColor="@color/white"/>
+                        android:textColor="@color/white" />
 
 
                 </LinearLayout>
@@ -116,29 +136,29 @@
                 android:columnCount="4"
                 android:visibility="gone">
 
-                <ImageView
-                    android:layout_width="96dp"
-                    android:layout_height="96dp"
-                    android:layout_columnWeight="1"
-                    android:src="@drawable/ico_add_grey" />
-
-                <ImageView
-                    android:layout_width="96dp"
-                    android:layout_height="96dp"
-                    android:layout_columnWeight="1"
-                    android:layout_rowWeight="1" />
-
-                <ImageView
-                    android:layout_width="96dp"
-                    android:layout_height="96dp"
-                    android:layout_columnWeight="1"
-                    android:layout_rowWeight="1" />
-
-                <ImageView
-                    android:layout_width="96dp"
-                    android:layout_height="96dp"
-                    android:layout_columnWeight="1"
-                    android:layout_rowWeight="1" />
+                <!--<ImageView-->
+                    <!--android:layout_width="96dp"-->
+                    <!--android:layout_height="96dp"-->
+                    <!--android:layout_columnWeight="1"-->
+                    <!--android:src="@drawable/ico_add_grey" />-->
+
+                <!--<ImageView-->
+                    <!--android:layout_width="96dp"-->
+                    <!--android:layout_height="96dp"-->
+                    <!--android:layout_columnWeight="1"-->
+                    <!--android:layout_rowWeight="1" />-->
+
+                <!--<ImageView-->
+                    <!--android:layout_width="96dp"-->
+                    <!--android:layout_height="96dp"-->
+                    <!--android:layout_columnWeight="1"-->
+                    <!--android:layout_rowWeight="1" />-->
+
+                <!--<ImageView-->
+                    <!--android:layout_width="96dp"-->
+                    <!--android:layout_height="96dp"-->
+                    <!--android:layout_columnWeight="1"-->
+                    <!--android:layout_rowWeight="1" />-->
             </GridLayout>
 
 
@@ -147,10 +167,10 @@
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="8dp"
                 android:layout_marginStart="8dp"
-                android:text="动态"
-                android:textSize="16sp"
+                android:paddingBottom="8dp"
                 android:paddingTop="8dp"
-                android:paddingBottom="8dp"/>
+                android:text="动态"
+                android:textSize="16sp" />
 
             <GridLayout
                 android:id="@+id/user_info_details_tweet_photos_layout"
@@ -158,99 +178,85 @@
                 android:layout_height="wrap_content"
                 android:columnCount="4"
                 android:visibility="gone">
-
-                <ImageView
-                    android:layout_width="96dp"
-                    android:layout_height="96dp"
-                    android:layout_columnWeight="1"
-                    android:src="@drawable/ico_add_grey" />
-
-                <ImageView
-                    android:layout_width="96dp"
-                    android:layout_height="96dp"
-                    android:layout_columnWeight="1"
-                    android:layout_rowWeight="1" />
-
-                <ImageView
-                    android:layout_width="96dp"
-                    android:layout_height="96dp"
-                    android:layout_columnWeight="1"
-                    android:layout_rowWeight="1" />
-
-                <ImageView
-                    android:layout_width="96dp"
-                    android:layout_height="96dp"
-                    android:layout_columnWeight="1"
-                    android:layout_rowWeight="1" />
             </GridLayout>
 
             <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:orientation="horizontal"
+                android:background="@color/white"
                 android:gravity="center_vertical"
-                android:padding="8dp"
-                android:background="@color/white">
+                android:orientation="horizontal"
+                android:padding="8dp">
+
                 <TextView
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:text="年龄: "
-                    android:textSize="16sp"/>
+                    android:textSize="16sp" />
+
                 <TextView
                     android:id="@+id/user_info_details_age"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
+                    android:text="年龄已保密"
                     android:textColor="@color/grey_light"
-                    android:textSize="16sp"
-                    android:text="年龄已保密"/>
+                    android:textSize="16sp" />
 
             </LinearLayout>
+
             <View
                 android:layout_width="match_parent"
                 android:layout_height="1dp"
-                android:background="@color/grey_light_light"/>
+                android:background="@color/grey_light_light" />
+
             <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:orientation="horizontal"
+                android:background="@color/white"
                 android:gravity="center_vertical"
-                android:padding="8dp"
-                android:background="@color/white">
+                android:orientation="horizontal"
+                android:padding="8dp">
+
                 <TextView
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:text="爱好: "
-                    android:textSize="16sp"/>
+                    android:textSize="16sp" />
+
                 <TextView
                     android:id="@+id/user_info_details_hobby"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
+                    android:text="暂无爱好"
                     android:textColor="@color/grey_light"
-                    android:textSize="16sp"
-                    android:text="暂无爱好"/>
+                    android:textSize="16sp" />
             </LinearLayout>
+
             <View
                 android:layout_width="match_parent"
                 android:layout_height="1dp"
-                android:background="@color/grey_light_light"/>
+                android:background="@color/grey_light_light" />
+
             <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:orientation="horizontal"
+                android:background="@color/white"
                 android:gravity="center_vertical"
-                android:padding="8dp"
-                android:background="@color/white">
+                android:orientation="horizontal"
+                android:padding="8dp">
+
                 <TextView
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:text="地址: "
-                    android:textSize="16sp"/>
+                    android:textSize="16sp" />
+
                 <TextView
                     android:id="@+id/user_info_details_location"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:textColor="@color/grey_light"
-                    android:textSize="16sp"/>
+                    android:textSize="16sp" />
             </LinearLayout>
         </LinearLayout>
     </ScrollView>

+ 1 - 1
app/res/layout/session_list.xml

@@ -21,7 +21,7 @@
             android:layout_width="300dp"
             android:layout_height="wrap_content"
             android:background="@drawable/style_edittext_rounded_corner_2"
-            android:text="请输入ID或手机号进行查找"
+            android:text="搜索"
             android:textSize="10sp"
             android:textColor="@color/color_grey_999999"
             android:gravity="center"

+ 1 - 1
app/res/layout/trade_list_fragment.xml

@@ -4,7 +4,7 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:background="@color/color_background"
+    android:background="@color/white"
     android:fitsSystemWindows="false"
     android:orientation="vertical">
 

+ 6 - 2
app/res/layout/trade_list_search.xml

@@ -19,7 +19,10 @@
             android:layout_height="wrap_content"
             android:layout_weight="9"
             android:hint="请输入搜索内容"
-            android:textColorHint="@color/white" >
+            android:textColorHint="@color/white"
+            android:maxLines="1"
+            android:inputType="text"
+            android:imeOptions="actionDone">
             <requestFocus/>
         </EditText>
         <ImageView
@@ -32,6 +35,7 @@
             android:layout_height="wrap_content"
             android:text="搜索"
             android:textSize="18sp"
-            android:textColor="@color/white"/>
+            android:textColor="@color/white"
+            />
     </LinearLayout>
 </LinearLayout>

+ 164 - 0
app/res/layout/user_info_setting_activity.xml

@@ -0,0 +1,164 @@
+<?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:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:background="@color/color_background">
+
+    <android.support.design.widget.AppBarLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <com.sheishuo.app.common.views.BaseToolbar
+            android:id="@+id/toolbar"
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/action_bar_height"
+            app:left_text="返回"
+            app:title="设置" />
+    </android.support.design.widget.AppBarLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical">
+
+        <LinearLayout
+            android:id="@+id/user_info_setting_remark_layout"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+            android:padding="16dp"
+            android:background="@color/white">
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="7"
+                android:text="备注:"
+                android:textSize="16sp" />
+
+            <TextView
+                android:id="@+id/user_info_setting_remark_TV"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="3"
+                android:gravity="center_vertical|end"
+                android:text="用户备注"
+                android:textColor="@color/grey_light"
+                android:textSize="16sp" />
+        </LinearLayout>
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1dp"
+            android:background="@color/grey_light_light"/>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+            android:padding="16dp"
+            android:background="@color/white">
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="7"
+                android:text="置顶聊天:"
+                android:textSize="16sp" />
+
+            <Switch
+                android:id="@+id/user_info_setting_pin_switch"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content" />
+
+
+        </LinearLayout>
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1dp"
+            android:background="@color/grey_light_light"/>
+
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+            android:padding="16dp"
+            android:background="@color/white">
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="7"
+                android:text="消息免打扰:"
+                android:textSize="16sp" />
+
+            <Switch
+                android:id="@+id/user_info_setting_mute_switch"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content" />
+
+
+        </LinearLayout>
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1dp"
+            android:background="@color/grey_light_light"/>
+
+
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+            android:padding="16dp"
+            android:background="@color/white">
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="7"
+                android:text="拉入黑名单:"
+                android:textSize="16sp" />
+
+            <Switch
+                android:id="@+id/user_info_setting_ban_switch"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content" />
+
+
+        </LinearLayout>
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1dp"
+            android:background="@color/grey_light_light"/>
+
+        <LinearLayout
+            android:id="@+id/user_info_setting_complain_layout"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+            android:padding="16dp"
+            android:background="@color/white">
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="7"
+                android:text="投诉"
+                android:textSize="16sp" />
+
+            <ImageView
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:src="@drawable/right_arrow"
+                android:layout_gravity="center_vertical"/>
+
+        </LinearLayout>
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1dp"
+            android:background="@color/grey_light_light"/>
+    </LinearLayout>
+</LinearLayout>

+ 2 - 2
app/src/com/sheishuo/app/common/beans/TradeBean.java

@@ -7,7 +7,7 @@ import java.util.List;
  * Created by KN on 2017/7/31.
  */
 
-public class TradeBean {
+public class TradeBean implements Serializable{
 
     /**
      * c : 0
@@ -33,7 +33,7 @@ public class TradeBean {
         this.d = d;
     }
 
-    public static class DBean {
+    public static class DBean implements Serializable{
         private List<ListBean> list;
 
         public List<ListBean> getList() {

+ 2 - 1
app/src/com/sheishuo/app/common/util/net/INet.java

@@ -31,8 +31,8 @@ public interface INet {
     void getNearbyPeople(String userId,String page,ResponseCallback callback);
     void getCircleList(String targetId,String lastId,ResponseCallback callback);
     void getTradeList(int type,int page,ResponseCallback callback);
+    void searchTrade(String key,int type,int page,ResponseCallback callback);
     void publishTrade(int type,String content,String pics,int priority,int priorityType,String roomId,ResponseCallback callback);
-    void searchTrade(int page,int sort,String key,ResponseCallback callback);
     void newComment(int socialId, @Nullable int replyId, String comment, ResponseCallback callback);
     void updateBanner(String filePath,ResponseCallback callback);
     void getPhoneContactRelationship(String phoneListStr,ResponseCallback callback);
@@ -40,4 +40,5 @@ public interface INet {
     void followOrUnfollow(String targetId);
     void updateSocialInfo(SocialInfoBean bean,ResponseCallback callback);
     void getHobbyList(ResponseCallback callback);
+    void sendInviteMsg(String phoneNum);
 }

+ 60 - 4
app/src/com/sheishuo/app/common/util/net/NetImpl.java

@@ -619,6 +619,37 @@ public class NetImpl implements INet {
     }
 
     @Override
+    public void searchTrade(final String key, final int type, final int page, final ResponseCallback callback) {
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+                FormBody body = new FormBody.Builder()
+                        .add("user_id",AccountCache.getAccount().getId())
+                        .add("province",AccountCache.getAccount().getProvince())
+                        .add("key",key)
+                        .add("sort", String.valueOf(type))
+                        .add("page", String.valueOf(page))
+                        .build();
+
+                Request request = new Request.Builder()
+                        .post(body)
+                        .url(TRADE_SEARCH)
+                        .build();
+
+                try{
+                    Response response = client.newCall(request).execute();
+                    String resultStr = response.body().string();
+                    TradeBean bean = new Gson().fromJson(resultStr,new TypeToken<TradeBean>(){}.getType());
+                    callback.onSuccess(bean);
+                }catch (Exception e){
+                    e.printStackTrace();
+                    callback.onFailed();
+                }
+            }
+        }).start();
+    }
+
+    @Override
     public void publishTrade(final int type, final String content, final String pics, final int priority, final int priorityType, final String roomId, final ResponseCallback callback) {
         new Thread(new Runnable() {
             @Override
@@ -661,10 +692,6 @@ public class NetImpl implements INet {
         }).start();
     }
 
-    @Override
-    public void searchTrade(int page, int sort, String key, ResponseCallback callback) {
-
-    }
 
     @Override
     public void newComment(final int socialId, @Nullable final int replyId, final String comment, final ResponseCallback callback) {
@@ -807,6 +834,7 @@ public class NetImpl implements INet {
                 Response response = null;
                 try {
                     response = client.newCall(request).execute();
+                    Log.e("add result",response.body().string());
                 } catch (IOException e) {
                     e.printStackTrace();
                 }
@@ -951,5 +979,33 @@ public class NetImpl implements INet {
         }).start();
     }
 
+    @Override
+    public void sendInviteMsg(final String phoneNum) {
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+                try{
+                    //后四位
+                    String msg = phoneNum.substring(phoneNum.length() - 4 , phoneNum.length());
+                    Log.e("msg",msg);
+                    FormBody body = new FormBody.Builder()
+                            .add("mobile",phoneNum)
+                            .add("msg",msg)
+                            .build();
+
+                    Request request = new Request.Builder()
+                            .url(SEND_INVITE_MSG)
+                            .post(body)
+                            .build();
+
+                    client.newCall(request).execute();
+
+                }catch (Exception e){
+                    e.printStackTrace();
+                }
+            }
+        }).start();
+    }
+
 
 }

+ 1 - 0
app/src/com/sheishuo/app/common/util/net/NetInfo.java

@@ -34,6 +34,7 @@ public class NetInfo {
     public final static String FOLLOW_OR_UNFOLLOW_USER = INDEX + "?m=who&c=social&a=follow";
     public final static String UPDATE_SOCIAL_INFO = INDEX + "?m=who&c=social&a=update_info";
     public final static String GET_HOBBY = INDEX + "?m=who&c=index&a=hobby_list";
+    public final static String SEND_INVITE_MSG = INDEX + "?m=who&c=index&a=send_msg";
 
 
 

+ 6 - 2
app/src/com/sheishuo/app/contact/ContactHelper.java

@@ -5,6 +5,7 @@ import android.content.Context;
 import com.sheishuo.app.contact.activity.UserProfileActivity;
 import com.netease.nim.uikit.NimUIKit;
 import com.netease.nim.uikit.contact.ContactEventListener;
+import com.sheishuo.app.core_module.mine.view.ui.activity.UserInfoDetailActivity;
 
 /**
  * UIKit联系人列表定制展示类
@@ -21,7 +22,8 @@ public class ContactHelper {
         NimUIKit.setContactEventListener(new ContactEventListener() {
             @Override
             public void onItemClick(Context context, String account) {
-                UserProfileActivity.start(context, account);
+                //UserProfileActivity.start(context, account);
+                UserInfoDetailActivity.start(context,account);
             }
 
             @Override
@@ -31,7 +33,9 @@ public class ContactHelper {
 
             @Override
             public void onAvatarClick(Context context, String account) {
-                UserProfileActivity.start(context, account);
+                //UserProfileActivity.start(context, account);
+                UserInfoDetailActivity.start(context,account);
+
             }
         });
     }

+ 4 - 4
app/src/com/sheishuo/app/core_module/circle/activity/CircleDetailsActivity.java

@@ -155,14 +155,14 @@ public class CircleDetailsActivity extends SheishuoUI {
             int imgWidthAndHeight = 0;
             //设置图片展示大小
             if (bean.getPics().size() > 4){
-                imgWidthAndHeight = 128;
+                imgWidthAndHeight = ImgUtil.getScreenWidth(context) / 4;
             }else if (bean.getPics().size() > 1){
-                imgWidthAndHeight = 256;
+                imgWidthAndHeight = ImgUtil.getScreenWidth(context) / 3;
             }else{
-                imgWidthAndHeight = 512;
+                imgWidthAndHeight = ImgUtil.getScreenWidth(context);
             }
             //设置间距
-            LinearLayout.LayoutParams ll = new LinearLayout.LayoutParams((int) ImgUtil.convertDpToPixel(imgWidthAndHeight,context), (int) ImgUtil.convertDpToPixel(imgWidthAndHeight,context));
+            LinearLayout.LayoutParams ll = new LinearLayout.LayoutParams(imgWidthAndHeight, imgWidthAndHeight);
             GridLayout.LayoutParams gl = new GridLayout.LayoutParams(ll);
             gl.rightMargin = 16;
             gl.topMargin = 16 / 2;

+ 20 - 1
app/src/com/sheishuo/app/core_module/friends/activity/AddNewFriendActivity.java

@@ -8,7 +8,12 @@ import android.widget.EditText;
 import android.widget.Toast;
 
 import com.sheishuo.app.R;
+import com.sheishuo.app.common.beans.SocialInfoBean;
+import com.sheishuo.app.common.util.net.INet;
+import com.sheishuo.app.common.util.net.NetImpl;
+import com.sheishuo.app.common.util.net.ResponseCallback;
 import com.sheishuo.app.common.views.BaseToolbar;
+import com.sheishuo.app.core_module.mine.view.ui.activity.UserInfoDetailActivity;
 import com.sheishuo.app.impl.SheishuoUI;
 
 /**
@@ -25,6 +30,9 @@ public class AddNewFriendActivity extends SheishuoUI {
     private Button addFriendBtn;
     private Toast toast;
 
+
+    INet net = new NetImpl();
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -47,7 +55,18 @@ public class AddNewFriendActivity extends SheishuoUI {
                 if (idOrTelTV.getText().toString().trim().isEmpty()){
                     showToast("请填写用户ID或者手机号");
                 }else {
-                    showToast("暂未对接搜索接口");
+                    net.getSocialInfo(idOrTelTV.getText().toString(), new ResponseCallback() {
+                        @Override
+                        public void onSuccess(Object object) {
+                            SocialInfoBean bean = (SocialInfoBean) object;
+                            UserInfoDetailActivity.start(context,bean.getId());
+                        }
+
+                        @Override
+                        public void onFailed() {
+                            showToast(context,"查找的用户不存在");
+                        }
+                    });
                 }
             }
         });

+ 79 - 3
app/src/com/sheishuo/app/core_module/friends/activity/PhoneContactsActivity.java

@@ -10,9 +10,16 @@ import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.util.Log;
 import android.view.View;
+import android.widget.Button;
 import android.widget.EditText;
 import android.widget.LinearLayout;
 
+import com.netease.nimlib.sdk.NIMClient;
+import com.netease.nimlib.sdk.RequestCallback;
+import com.netease.nimlib.sdk.friend.FriendService;
+import com.netease.nimlib.sdk.friend.constant.VerifyType;
+import com.netease.nimlib.sdk.friend.model.AddFriendData;
+import com.netease.nimlib.sdk.uinfo.UserService;
 import com.sheishuo.app.R;
 import com.sheishuo.app.common.beans.ContactRelationshipBean;
 import com.sheishuo.app.common.util.net.INet;
@@ -47,6 +54,8 @@ public class PhoneContactsActivity extends SheishuoUI {
 
     private INet net = new NetImpl();
 
+    private String phoneNumStr = "";
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -68,6 +77,22 @@ public class PhoneContactsActivity extends SheishuoUI {
             @Override
             public void onSuccess(Object object) {
                 List<ContactRelationshipBean> list = (List<ContactRelationshipBean>) object;
+                for (ContactRelationshipBean bean : list){
+                    phoneNumStr = phoneNumStr.replace(bean.getMobile()+",","");
+                }
+
+                String[] phoneNums = phoneNumStr.split(",");
+                Log.e(TAG, String.valueOf(phoneNums.length));
+                for (String phoneNum : phoneNums){
+                    Log.e(TAG,phoneNum);
+                    if (!phoneNum.isEmpty()){
+                        ContactRelationshipBean bean = new ContactRelationshipBean();
+                        bean.setFollow(3);
+                        bean.setId("-1");
+                        bean.setMobile(phoneNum);
+                        list.add(bean);
+                    }
+                }
                 showContactRelationShip(list);
             }
 
@@ -84,7 +109,7 @@ public class PhoneContactsActivity extends SheishuoUI {
      * @return
      */
     private String getContacts(){
-        String phoneNumStr = "";
+
 
         Cursor cursor = context.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                 null, null, null, null);
@@ -120,11 +145,62 @@ public class PhoneContactsActivity extends SheishuoUI {
                 adapter.setOnAddFriendListenner(new PhoneContactItemAdapter.AddFriendButtonClickListener() {
                     @Override
                     public void onClick(View view) {
-                        net.sendAddFriendRequest((String) view.getTag(),"请求添加好友");
-                        showToast(context,"已发送好友申请");
+                        String str = (String) view.getTag();
+                        if (str.length() < 11){
+
+                            //以ID添加好友
+                            net.sendAddFriendRequest((String) view.getTag(),"请求添加好友");
+                            showToast(context,"成功发送好友申请");
+                            view.setEnabled(false);
+                            ((Button)view).setText("已发送");
+                            //Temp
+                            Log.e(TAG,(String) view.getTag());
+                            AddFriendData addFriendData = new AddFriendData((String) view.getTag(), VerifyType.VERIFY_REQUEST,"请求添加好友");
+                            NIMClient.getService(FriendService.class).addFriend(addFriendData).setCallback(new RequestCallback<Void>() {
+                                @Override
+                                public void onSuccess(Void aVoid) {
+                                    Log.e(TAG,"onSuccess");
+                                }
+
+                                @Override
+                                public void onFailed(int i) {
+                                    Log.e(TAG,"onFailed");
+                                }
+
+                                @Override
+                                public void onException(Throwable throwable) {
+                                    throwable.printStackTrace();
+                                }
+                            });
+                        }else {
+                            //以手机号发送邀请短信
+                            net.sendInviteMsg(str);
+                            showToast(context,"成功发送好友邀请");
+                            view.setEnabled(false);
+                            ((Button)view).setText("已邀请");
+
+                        }
+
                     }
                 });
             }
         });
     }
+
+
+    private String getContactName(Context context, String phoneNum) {
+        String contactName = "";
+        ContentResolver cr = context.getContentResolver();
+        Cursor pCur = cr.query(
+                ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,
+                ContactsContract.CommonDataKinds.Phone.NUMBER + " = ?",
+                new String[] { phoneNum }, null);
+        if (pCur.moveToFirst()) {
+            contactName = pCur
+                    .getString(pCur
+                            .getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
+            pCur.close();
+        }
+        return contactName;
+    }
 }

+ 39 - 4
app/src/com/sheishuo/app/core_module/friends/adapter/PhoneContactItemAdapter.java

@@ -1,6 +1,9 @@
 package com.sheishuo.app.core_module.friends.adapter;
 
+import android.content.ContentResolver;
 import android.content.Context;
+import android.database.Cursor;
+import android.provider.ContactsContract;
 import android.support.v7.widget.RecyclerView;
 import android.util.Log;
 import android.view.LayoutInflater;
@@ -50,19 +53,32 @@ public class PhoneContactItemAdapter extends RecyclerView.Adapter<PhoneContactIt
             Glide.with(context)
                     .load(getAvatar(bean.getId()))
                     .into(holder.avatar);
+        }else {
+            Glide.with(context)
+                    .load(R.drawable.nim_avatar_default)
+                    .into(holder.avatar);
         }
 
 
 
-        holder.nickname.setText(getName(bean.getId()));
+        if (bean.getId().equals("-1")){
+            holder.nickname.setText(getContactName(context,bean.getMobile()));
+        }else {
+            holder.nickname.setText(getName(bean.getId()));
+        }
 
         holder.name.setText("手机联系人:" + bean.getMobile());
 
         if (0 == bean.getFollow()){
-            holder.addFriendBtn.setText("关注");
+            holder.addFriendBtn.setText("加好友");
             holder.addFriendBtn.setEnabled(true);
             holder.addFriendBtn.setTag(bean.getId());
             holder.addFriendBtn.setOnClickListener(this);
+        }else if(3 == bean.getFollow()){
+            holder.addFriendBtn.setText("邀请");
+            holder.addFriendBtn.setEnabled(true);
+            holder.addFriendBtn.setTag(bean.getMobile());
+            holder.addFriendBtn.setOnClickListener(this);
         }
     }
 
@@ -81,7 +97,8 @@ public class PhoneContactItemAdapter extends RecyclerView.Adapter<PhoneContactIt
     }
 
     private String getAvatar(String userId){
-        if (NIMClient.getService(UserService.class).getUserInfo(userId).getAvatar() != null){
+        NimUserInfo userInfo = NIMClient.getService(UserService.class).getUserInfo(userId);
+        if (userInfo != null && userInfo.getAvatar() != null){
             return NIMClient.getService(UserService.class).getUserInfo(userId).getAvatar();
         }
         return null;
@@ -90,7 +107,9 @@ public class PhoneContactItemAdapter extends RecyclerView.Adapter<PhoneContactIt
     public void addAll(final List<ContactRelationshipBean> list){
         List<String> userIds = new ArrayList<>();
         for (ContactRelationshipBean bean : list){
-            userIds.add(bean.getId());
+            if (!bean.getId().equals("-1")){
+                userIds.add(bean.getId());
+            }
         }
 
         NIMClient.getService(UserService.class).fetchUserInfo(userIds).setCallback(new RequestCallback<List<NimUserInfo>>() {
@@ -123,6 +142,22 @@ public class PhoneContactItemAdapter extends RecyclerView.Adapter<PhoneContactIt
         this.listener = listener;
     }
 
+    private String getContactName(Context context, String phoneNum) {
+        String contactName = "";
+        ContentResolver cr = context.getContentResolver();
+        Cursor pCur = cr.query(
+                ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,
+                ContactsContract.CommonDataKinds.Phone.NUMBER + " = ?",
+                new String[] { phoneNum }, null);
+        if (pCur.moveToFirst()) {
+            contactName = pCur
+                    .getString(pCur
+                            .getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
+            pCur.close();
+        }
+        return contactName;
+    }
+
     class PhoneContactItemViewHolder extends RecyclerView.ViewHolder{
 
         HeadImageView avatar;

+ 62 - 0
app/src/com/sheishuo/app/core_module/mine/view/ui/activity/ComplaintActivity.java

@@ -0,0 +1,62 @@
+package com.sheishuo.app.core_module.mine.view.ui.activity;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.support.annotation.IdRes;
+import android.util.Log;
+import android.view.View;
+import android.widget.RadioButton;
+import android.widget.RadioGroup;
+
+import com.sheishuo.app.R;
+import com.sheishuo.app.impl.SheishuoUI;
+
+/**
+ * Created by KN on 2017/8/30.
+ */
+
+public class ComplaintActivity extends SheishuoUI implements RadioGroup.OnCheckedChangeListener{
+
+    public static final String USER_ID = "user_id";
+
+    private String TAG = this.getClass().getSimpleName();
+    private Context context = this;
+
+    RadioButton type1,type2,type3,type4,type5;
+
+    private RadioGroup radioGroup;
+
+    private String userId = "";
+
+    private String complaintType = "";
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.mine_complaint_activity);
+        userId = getIntent().getStringExtra(USER_ID);
+    }
+
+
+    void findViews(){
+        radioGroup = findView(R.id.mine_complaint_radiogroup);
+        type1 = findView(R.id.mine_complaint_type_ad);
+        type2 = findView(R.id.mine_complaint_type_cheat);
+        type3 = findView(R.id.mine_complaint_type_illegal);
+        type4 = findView(R.id.mine_complaint_type_politics);
+        type5 = findView(R.id.mine_complaint_type_vulgar);
+
+    }
+
+
+    void init(){
+
+    }
+
+
+
+    @Override
+    public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
+
+    }
+}

+ 30 - 0
app/src/com/sheishuo/app/core_module/mine/view/ui/activity/MineOthersCircleActivity.java

@@ -0,0 +1,30 @@
+package com.sheishuo.app.core_module.mine.view.ui.activity;
+
+import android.os.Bundle;
+
+import com.sheishuo.app.impl.SheishuoUI;
+
+/**
+ * Created by KN on 2017/8/30.
+ */
+
+public class MineOthersCircleActivity extends SheishuoUI {
+
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        findViews();
+        init();
+    }
+
+
+    void findViews(){
+
+    }
+
+
+    void init(){
+
+    }
+}

+ 85 - 34
app/src/com/sheishuo/app/core_module/mine/view/ui/activity/UserInfoDetailActivity.java

@@ -3,6 +3,7 @@ package com.sheishuo.app.core_module.mine.view.ui.activity;
 import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
+import android.util.Log;
 import android.view.View;
 import android.widget.Button;
 import android.widget.GridLayout;
@@ -11,14 +12,20 @@ import android.widget.TextView;
 
 import com.bumptech.glide.Glide;
 import com.netease.nim.uikit.common.ui.imageview.HeadImageView;
+import com.netease.nim.uikit.session.activity.WatchPictureActivity;
 import com.netease.nimlib.sdk.NIMClient;
 import com.netease.nimlib.sdk.RequestCallback;
+import com.netease.nimlib.sdk.friend.FriendService;
+import com.netease.nimlib.sdk.friend.constant.VerifyType;
+import com.netease.nimlib.sdk.friend.model.AddFriendData;
 import com.netease.nimlib.sdk.uinfo.UserService;
 import com.netease.nimlib.sdk.uinfo.model.NimUserInfo;
 import com.sheishuo.app.R;
 import com.sheishuo.app.cache.SocialInfoCache;
 import com.sheishuo.app.common.beans.CircleBean;
 import com.sheishuo.app.common.beans.SocialInfoBean;
+import com.sheishuo.app.common.beans.SocialPhoto;
+import com.sheishuo.app.common.util.img.ImgUtil;
 import com.sheishuo.app.common.util.net.INet;
 import com.sheishuo.app.common.util.net.NetImpl;
 import com.sheishuo.app.common.util.net.ResponseCallback;
@@ -34,13 +41,15 @@ import java.util.List;
 
 public class UserInfoDetailActivity extends SheishuoUI {
 
-    public final static String USER_ID = "5005";
+    public final static String USER_ID = "user_id";
 
     private String TAG = this.getClass().getSimpleName();
     private Context context = this;
 
     private HeadImageView avatar;
 
+    private ImageView settingImg;
+
     private TextView nameTV, idTV, ageTV, hobbyTV, locationTV;
 
     private Button followBtn, chatBtn, sendGiftBtn;
@@ -74,6 +83,7 @@ public class UserInfoDetailActivity extends SheishuoUI {
 
     void findViews() {
         avatar = findView(R.id.user_info_details_avatar);
+        settingImg = findView(R.id.user_info_details_setting);
 
         nameTV = findView(R.id.user_info_details_name);
         idTV = findView(R.id.user_info_details_id);
@@ -116,6 +126,16 @@ public class UserInfoDetailActivity extends SheishuoUI {
 
 
 
+        //右上角设置
+        settingImg.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                Intent intent = new Intent(context,UserInfoSettingActivity.class);
+                intent.putExtra(UserInfoSettingActivity.USER_ID,userId);
+                startActivity(intent);
+            }
+        });
+
 
 
 
@@ -137,13 +157,13 @@ public class UserInfoDetailActivity extends SheishuoUI {
     //展示用户信息
     public void showInfo(String id) {
         //展示年龄
-        SocialInfoBean info = SocialInfoCache.get(id);
+        final SocialInfoBean info = SocialInfoCache.get(id);
         if (info.getShow_age().equals("1")) {
             ageTV.setText(info.getAge());
         }
 
         //展示爱好
-        if (!info.getHobby().isEmpty()) {
+        if (info.getHobby()!= null && !info.getHobby().isEmpty()) {
             hobbyTV.setText(info.getHobby());
         }
 
@@ -151,32 +171,40 @@ public class UserInfoDetailActivity extends SheishuoUI {
         locationTV.setText(info.getProvince() + info.getCity() + info.getDistrict());
 
 
-        //展示个性照片墙
 
-        personalPhotosLayout.setVisibility(View.VISIBLE);
-        if (info.getPhotos().size() > 0)
-            Glide.with(context)
-                    .load(info.getPhotos().get(0).getThumb())
-                    .placeholder(R.drawable.nim_avatar_default)
-                    .into((ImageView) personalPhotosLayout.getChildAt(0));
+        //展示个性照片墙
+        if (info.getPhotos().size() > 0){
+            personalPhotosLayout.setVisibility(View.VISIBLE);
+
+            final List<String> photoUrl = new ArrayList<>();
+            final List<String> thumbUrl = new ArrayList<>();
+            for (int i = 0;i < info.getPhotos().size() && i < 4 ; i++){
+                photoUrl.add(info.getPhotos().get(i).getPic());
+                thumbUrl.add(info.getPhotos().get(i).getThumb());
+            }
 
-        if (info.getPhotos().size() > 1)
-        Glide.with(context)
-                .load(info.getPhotos().get(1).getThumb())
-                .placeholder(R.drawable.nim_avatar_default)
-                .into((ImageView) personalPhotosLayout.getChildAt(1));
+            int widthAndHeight = ImgUtil.getScreenWidth(context) / 4;
+            for (int i = 0;i < info.getPhotos().size() && i < 4;i++){
+                String url = info.getPhotos().get(i).getThumb();
+                ImageView imageView = ImgUtil.getImageFromNet(context,url);
+                imageView.setAdjustViewBounds(true);
+                GridLayout.LayoutParams layoutParams = new GridLayout.LayoutParams();
+                layoutParams.width = widthAndHeight;
+                layoutParams.height = widthAndHeight;
+                imageView.setLayoutParams(layoutParams);
+
+                final int finalI = i;
+                imageView.setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        WatchPictureActivity.start(context,photoUrl,thumbUrl, finalI);
+                    }
+                });
+                personalPhotosLayout.addView(imageView);
+            }
+        }
 
-        if (info.getPhotos().size() > 2)
-        Glide.with(context)
-                .load(info.getPhotos().get(2).getThumb())
-                .placeholder(R.drawable.nim_avatar_default)
-                .into((ImageView) personalPhotosLayout.getChildAt(2));
 
-        if (info.getPhotos().size() > 3)
-        Glide.with(context)
-                .load(info.getPhotos().get(3).getThumb())
-                .placeholder(R.drawable.nim_avatar_default)
-                .into((ImageView) personalPhotosLayout.getChildAt(3));
 
 
         //展示动态照片
@@ -184,20 +212,39 @@ public class UserInfoDetailActivity extends SheishuoUI {
             @Override
             public void onSuccess(Object object) {
                 CircleBean bean = (CircleBean) object;
+                final List<String> circlePhotosThumb = new ArrayList<>();
                 final List<String> circlePhotos = new ArrayList<>();
                 for (CircleBean.DBean.ListBean listItem : bean.getD().getList()) {
-                    circlePhotos.addAll(listItem.getThumbs());
+                    circlePhotosThumb.addAll(listItem.getThumbs());
+                    circlePhotos.addAll(listItem.getPics());
                 }
 
                 getHandler().post(new Runnable() {
                     @Override
                     public void run() {
-                        tweetPhotosLayout.setVisibility(View.VISIBLE);
-                        if (circlePhotos.size() > 0) {
-                            for (int i = 0; i < tweetPhotosLayout.getChildCount() && i < circlePhotos.size(); i++) {
-                                Glide.with(context)
-                                        .load(circlePhotos.get(i))
-                                        .into((ImageView) tweetPhotosLayout.getChildAt(0));
+                        if (circlePhotosThumb.size() > 0) {
+                            tweetPhotosLayout.setVisibility(View.VISIBLE);
+                            int widthAndHeight = ImgUtil.getScreenWidth(context) / 4;
+                            for (int i = 0; i < 4 && i < circlePhotosThumb.size(); i++) {
+
+
+                                ImageView imageView = ImgUtil.getImageFromNet(context,circlePhotosThumb.get(i));
+                                imageView.setAdjustViewBounds(true);
+                                GridLayout.LayoutParams layoutParams = new GridLayout.LayoutParams();
+                                layoutParams.width = widthAndHeight;
+                                layoutParams.height = widthAndHeight;
+                                imageView.setLayoutParams(layoutParams);
+
+                                final int finalI = i;
+                                imageView.setOnClickListener(new View.OnClickListener() {
+                                    @Override
+                                    public void onClick(View v) {
+                                        WatchPictureActivity.start(context,circlePhotos,circlePhotosThumb, finalI);
+                                    }
+                                });
+
+
+                                tweetPhotosLayout.addView(imageView);
                             }
                         }
                     }
@@ -230,12 +277,13 @@ public class UserInfoDetailActivity extends SheishuoUI {
 
             @Override
             public void onFailed(int i) {
-
+                showToast(context,"加载头像失败");
             }
 
             @Override
             public void onException(Throwable throwable) {
-
+                throwable.printStackTrace();
+                showToast(context,"加载头像失败");
             }
         });
     }
@@ -260,12 +308,15 @@ public class UserInfoDetailActivity extends SheishuoUI {
                     FOLLOWED = false;
                     followBtn.setText("关注");
                     showToast(context,"取消关注成功");
+                    NIMClient.getService(FriendService.class).deleteFriend(userId);
                     //更新缓存
                     SocialInfoCache.get(userId).setFollow(0);
                 }else {
                     FOLLOWED = true;
                     followBtn.setText("已关注");
                     showToast(context,"关注成功");
+                    AddFriendData data = new AddFriendData(userId, VerifyType.DIRECT_ADD);
+                    NIMClient.getService(FriendService.class).addFriend(data);
 
                     //更新缓存
                     SocialInfoCache.get(userId).setFollow(1);

+ 116 - 0
app/src/com/sheishuo/app/core_module/mine/view/ui/activity/UserInfoSettingActivity.java

@@ -0,0 +1,116 @@
+package com.sheishuo.app.core_module.mine.view.ui.activity;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.CompoundButton;
+import android.widget.LinearLayout;
+import android.widget.Switch;
+import android.widget.TextView;
+
+import com.netease.nimlib.sdk.NIMClient;
+import com.netease.nimlib.sdk.RequestCallback;
+import com.netease.nimlib.sdk.friend.FriendService;
+import com.netease.nimlib.sdk.msg.MsgService;
+import com.netease.nimlib.sdk.uinfo.UserService;
+import com.netease.nimlib.sdk.uinfo.constant.UserInfoFieldEnum;
+import com.sheishuo.app.R;
+import com.sheishuo.app.common.views.BaseToolbar;
+import com.sheishuo.app.impl.SheishuoUI;
+
+/**
+ * Created by KN on 2017/8/30.
+ */
+
+public class UserInfoSettingActivity extends SheishuoUI {
+
+
+    public static final String USER_ID = "user_id";
+
+    private String TAG = this.getClass().getSimpleName();
+    private Context context = this;
+
+
+    private BaseToolbar toolbar;
+    private TextView remarkTV;
+    private Switch pinSwitch,muteSwitch,banSwitch;
+    private LinearLayout remarkLayout,complaintLayout;
+
+
+    private String userId = "";
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.user_info_setting_activity);
+        userId = getIntent().getStringExtra(USER_ID);
+        findViews();
+        init();
+    }
+
+
+    void findViews(){
+        toolbar = findView(R.id.toolbar);
+        remarkTV = findView(R.id.user_info_setting_remark_TV);
+        pinSwitch = findView(R.id.user_info_setting_pin_switch);
+        muteSwitch = findView(R.id.user_info_setting_mute_switch);
+        banSwitch = findView(R.id.user_info_setting_ban_switch);
+
+        remarkLayout = findView(R.id.user_info_setting_remark_layout);
+        complaintLayout = findView(R.id.user_info_setting_complain_layout);
+    }
+
+
+    void init(){
+        toolbar.getLeftTV().setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                finish();
+            }
+        });
+
+        //MuteSwitch
+        if (NIMClient.getService(FriendService.class).isNeedMessageNotify(userId)){
+            muteSwitch.setChecked(true);
+        }
+
+        muteSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                NIMClient.getService(FriendService.class).setMessageNotify(userId,isChecked);
+            }
+        });
+
+
+
+        //BanSwitch
+        if (NIMClient.getService(FriendService.class).isInBlackList(userId)){
+            banSwitch.setChecked(true);
+        }
+
+        banSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                if (isChecked){
+                    NIMClient.getService(FriendService.class).addToBlackList(userId);
+                }else {
+                    NIMClient.getService(FriendService.class).removeFromBlackList(userId);
+                }
+
+            }
+        });
+
+
+
+        //投诉
+        complaintLayout.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                Intent intent = new Intent(context,ComplaintActivity.class);
+                intent.putExtra(ComplaintActivity.USER_ID,userId);
+                startActivity(intent);
+            }
+        });
+    }
+}

+ 132 - 0
app/src/com/sheishuo/app/core_module/sheishuo/view/ui/NearbyGroupActivity.java

@@ -0,0 +1,132 @@
+package com.sheishuo.app.core_module.sheishuo.view.ui;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+
+import com.google.gson.Gson;
+import com.netease.nimlib.sdk.NIMClient;
+import com.netease.nimlib.sdk.team.TeamService;
+import com.sheishuo.app.R;
+import com.sheishuo.app.cache.AccountCache;
+import com.sheishuo.app.common.beans.NearbyGroupsBean;
+import com.sheishuo.app.common.util.net.INet;
+import com.sheishuo.app.common.util.net.NetImpl;
+import com.sheishuo.app.common.util.net.NetInfo;
+import com.sheishuo.app.common.util.net.ResponseCallback;
+import com.sheishuo.app.common.views.BaseToolbar;
+import com.sheishuo.app.impl.SheishuoUI;
+import com.sheishuo.app.impl.SheishuoUIKit;
+import com.sheishuo.app.main.adapter.AreaGroupsAdapter;
+import com.sheishuo.app.main.adapter.OnItemClickListener;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import okhttp3.FormBody;
+
+/**
+ * Created by KN on 2017/8/30.
+ */
+
+public class NearbyGroupActivity extends SheishuoUI {
+
+    private String TAG = this.getClass().getSimpleName();
+    private Context context = this;
+
+    private BaseToolbar toolbar;
+
+    private RecyclerView recyclerView;
+
+    private AreaGroupsAdapter areaGroupsAdapter;
+
+    private LinearLayoutManager layoutManager = new LinearLayoutManager(context);
+
+    INet net = new NetImpl();
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.area_group_nearby_group_activity);
+        findViews();
+        init();
+    }
+
+
+
+    void findViews(){
+        toolbar = findView(R.id.toolbar);
+        recyclerView = findView(R.id.area_group_nearby_group_recyclerview);
+    }
+
+
+    void init(){
+        toolbar.getLeftTV().setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                finish();
+            }
+        });
+
+
+        loadNearbyGroups();
+    }
+
+
+    /**
+     * 加载附近群
+     */
+    void loadNearbyGroups(){
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+                FormBody body = new FormBody.Builder()
+                        .add("page", "1")
+                        .add("latitude", AccountCache.getAccount().getLatitude())
+                        .add("longitude", AccountCache.getAccount().getLongitude())
+                        .build();
+                net.post(NetInfo.GET_NEARBY_GROUP, body, new ResponseCallback() {
+                    @Override
+                    public void onSuccess(Object object) {
+                        String resultStr = (String) object;
+                        final NearbyGroupsBean bean = new Gson().fromJson(resultStr, NearbyGroupsBean.class);
+                        if (bean.getC() == 0) {
+                            final List<String> nearbyGroupIds = new ArrayList<>();
+                            for (NearbyGroupsBean.DBean.ListBean entity : bean.getD().getList())
+                                nearbyGroupIds.add(entity.getId());
+
+
+                            getHandler().post(new Runnable() {
+                                @Override
+                                public void run() {
+                                    areaGroupsAdapter = new AreaGroupsAdapter(context, nearbyGroupIds);
+                                    recyclerView.setAdapter(areaGroupsAdapter);
+                                    recyclerView.setLayoutManager(layoutManager);
+                                    areaGroupsAdapter.setOnItemClickListener(new OnItemClickListener() {
+                                        @Override
+                                        public void onItemClick(View view) {
+                                            String groupId = (String) view.getTag();
+                                            if (!NIMClient.getService(TeamService.class).queryTeamBlock(groupId).isMyTeam()) {
+                                                NIMClient.getService(TeamService.class).applyJoinTeam(groupId, "申请入群");
+                                            }
+                                            SheishuoUIKit.startTeamSession(context, (String) view.getTag());
+                                        }
+                                    });
+                                }
+                            });
+
+                        }
+                    }
+
+                    @Override
+                    public void onFailed() {
+
+                    }
+                });
+
+
+            }
+        }).start();
+    }
+}

+ 68 - 72
app/src/com/sheishuo/app/core_module/trade/view/adapter/TradeItemAdapter.java

@@ -1,15 +1,11 @@
 package com.sheishuo.app.core_module.trade.view.adapter;
 
 import android.content.Context;
-import android.support.annotation.Nullable;
-import android.support.constraint.ConstraintLayout;
-import android.support.v7.widget.CardView;
 import android.support.v7.widget.RecyclerView;
 import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.GridLayout;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.TextView;
@@ -22,31 +18,23 @@ import com.netease.nimlib.sdk.uinfo.model.NimUserInfo;
 import com.sheishuo.app.R;
 import com.sheishuo.app.cache.AccountCache;
 import com.sheishuo.app.common.beans.TradeBean;
-import com.sheishuo.app.common.util.img.ImgUtil;
 import com.sheishuo.app.common.views.GridViewAdapter;
 import com.sheishuo.app.common.views.ImgGridView;
 import com.sheishuo.app.common.views.PartlyHighLightTextView;
 import com.sheishuo.app.core_module.mine.view.ui.activity.MineTradeActivity;
 import com.sheishuo.app.core_module.trade.model.TradeModel;
-import com.sheishuo.app.core_module.trade.view.ui.activity.TradeChangePriorityActivity;
-import com.sheishuo.app.login.beans.LoginBean;
 import com.sheishuo.app.main.fragment.TradeListFragment;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 /**
  * Created by KN on 2017/8/1.
  */
 
-public class TradeItemAdapter extends RecyclerView.Adapter<TradeItemAdapter.TradeItemViewHolder> implements View.OnClickListener{
+public class TradeItemAdapter extends RecyclerView.Adapter<TradeItemAdapter.TradeItemViewHolder> implements View.OnClickListener {
 
-    public static final String PRIORITY_DISTRICT = "3"
-            ,PRIORITY_CITY = "2"
-            ,PRIORITY_PROVINCE = "1"
-            ,PRIORITY_COUNTRY = "0";
+    public static final String PRIORITY_DISTRICT = "3", PRIORITY_CITY = "2", PRIORITY_PROVINCE = "1", PRIORITY_COUNTRY = "0";
 
     private boolean IS_IN_MINE_INFO = false;
 
@@ -57,8 +45,11 @@ public class TradeItemAdapter extends RecyclerView.Adapter<TradeItemAdapter.Trad
     private OnTradeItemClickListener listener;
 
 
+    //FLAGS
+    public static Boolean IS_SEARCH_MODE = false;
 
-    public TradeItemAdapter(TradeListFragment fragment,TradeBean bean){
+
+    public TradeItemAdapter(TradeListFragment fragment, TradeBean bean) {
         data = new ArrayList<>();
         this.fragment = fragment;
         context = fragment.getActivity();
@@ -66,17 +57,17 @@ public class TradeItemAdapter extends RecyclerView.Adapter<TradeItemAdapter.Trad
     }
 
 
-    public TradeItemAdapter(MineTradeActivity activity, TradeBean bean){
+    public TradeItemAdapter(MineTradeActivity activity, TradeBean bean) {
         data = new ArrayList<>();
         this.activity = activity;
         this.context = activity;
         addAll(bean);
-        IS_IN_MINE_INFO =true;
+        IS_IN_MINE_INFO = true;
     }
 
     @Override
     public TradeItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
-        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.trade_list_item,parent,false);
+        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.trade_list_item, parent, false);
         return new TradeItemViewHolder(view);
     }
 
@@ -100,21 +91,21 @@ public class TradeItemAdapter extends RecyclerView.Adapter<TradeItemAdapter.Trad
         holder.content.setText(bean.getMsg());
         String highLightStr = "";
 
-        if (!bean.getDistrict().isEmpty()){
+        if (!bean.getDistrict().isEmpty()) {
             highLightStr = highLightStr + "[" + bean.getDistrict() + "]";
-        }else {
+        } else {
             highLightStr = highLightStr + "[全国]";
         }
 
-        if (Integer.valueOf(bean.getType()) == TradeModel.TYPE_SELL){
+        if (Integer.valueOf(bean.getType()) == TradeModel.TYPE_SELL) {
             highLightStr = highLightStr + "[出售]";
-        }else if(Integer.valueOf(bean.getType()) == TradeModel.TYPE_BUY){
+        } else if (Integer.valueOf(bean.getType()) == TradeModel.TYPE_BUY) {
             highLightStr = highLightStr + "[求购]";
         }
 
 
-        if (!highLightStr.isEmpty()){
-            holder.content.addHightlightStr(highLightStr,R.color.green_4DC0A4);
+        if (!highLightStr.isEmpty()) {
+            holder.content.addHightlightStr(highLightStr, R.color.green_4DC0A4);
         }
 
 
@@ -123,53 +114,56 @@ public class TradeItemAdapter extends RecyclerView.Adapter<TradeItemAdapter.Trad
 
 
         //设置置顶权限
-        if (Integer.valueOf(bean.getPriority()) > 0){
+        if (bean.getPriority() != null && Integer.valueOf(bean.getPriority()) > 0) {
             holder.priority.setText("置顶x" + bean.getPriority());
+
         }
 
+
         //判断是否为自己发布的交易帖,如果是才能编辑置顶加权
-        if (bean.getUser_id().equals(AccountCache.getAccount().getId())){
-            holder.priority.setTag(R.id.flag_trade_id,bean.getId());
-            holder.priority.setTag(R.id.flag_trade_priority,bean.getPriority());
-            holder.priority.setTag(R.id.flag_trade_priority_type,bean.getPriority_type());
+        if (bean.getUser_id().equals(AccountCache.getAccount().getId())) {
+            holder.priority.setTag(R.id.flag_trade_id, bean.getId());
+            holder.priority.setTag(R.id.flag_trade_priority, bean.getPriority());
+            holder.priority.setTag(R.id.flag_trade_priority_type, bean.getPriority_type());
             holder.priority.setOnClickListener(this);
         }
 
 
         //判断是否已加关注
-        if (1 == bean.getFollow()){
+        if (1 == bean.getFollow()) {
             Glide.with(context).load(R.drawable.trade_followed).into(holder.followImg);
-            holder.followImg.setTag(R.drawable.trade_followed,bean.getId());
+            holder.followImg.setTag(R.drawable.trade_followed, bean.getId());
             holder.followImg.setOnClickListener(this);
-        }else {
-            holder.followImg.setTag(R.drawable.trade_unfollowed,bean.getId());
+        } else {
+            holder.followImg.setTag(R.drawable.trade_unfollowed, bean.getId());
             holder.followImg.setOnClickListener(this);
         }
 
         //设置浏览量
-        holder.review.setText("浏览"+bean.getReview());
+        holder.review.setText("浏览" + bean.getReview());
 
         //加载thumbs
-        GridViewAdapter gridViewAdapter = new GridViewAdapter(context,bean.getThumbs(),bean.getPics());
-        if (bean.getThumbs().size() > 4){
+        GridViewAdapter gridViewAdapter = new GridViewAdapter(context, bean.getThumbs(), bean.getPics());
+        if (bean.getThumbs().size() > 4) {
             //默认为两列,如果超过4张图则显示为3列
             holder.imgGridView.setNumColumns(3);
-        }else {
+        } else {
             holder.imgGridView.setNumColumns(2);
         }
         holder.imgGridView.setAdapter(gridViewAdapter);
 
 
-
-
         //预加载
-        if (IS_IN_MINE_INFO){
-            if (position >= data.size() - 1){
-                activity.getTradeList(activity.TYPE_TO_LOAD,activity.PAGE_TO_LOAD);
+        //如果为搜索结果模式,停止预加载
+        if (IS_SEARCH_MODE) return;
+
+        if (IS_IN_MINE_INFO) {
+            if (position >= data.size() - 1) {
+                activity.getTradeList(activity.TYPE_TO_LOAD, activity.PAGE_TO_LOAD);
             }
-        }else {
-            if (position >= data.size() - 1){
-                fragment.loadTradeList(fragment.TYPE_TO_LOAD,fragment.PAGE_TO_LOAD);
+        } else {
+            if (position >= data.size() - 1) {
+                fragment.loadTradeList(fragment.TYPE_TO_LOAD, fragment.PAGE_TO_LOAD);
             }
         }
 
@@ -184,27 +178,27 @@ public class TradeItemAdapter extends RecyclerView.Adapter<TradeItemAdapter.Trad
     public void onViewRecycled(TradeItemViewHolder holder) {
         super.onViewRecycled(holder);
         //清空followImg设置的Tag
-        holder.followImg.setTag(R.drawable.trade_followed,null);
-        holder.followImg.setTag(R.drawable.trade_unfollowed,null);
+        holder.followImg.setTag(R.drawable.trade_followed, null);
+        holder.followImg.setTag(R.drawable.trade_unfollowed, null);
         Glide.with(context).load(R.drawable.trade_unfollowed).into(holder.followImg);
     }
 
 
     @Override
     public void onClick(View view) {
-        if (listener != null)listener.onClick(view);
+        if (listener != null) listener.onClick(view);
     }
 
 
     //添加数据
-    public void addAll(TradeBean bean){
+    public void addAll(TradeBean bean) {
         final List<TradeBean.DBean.ListBean> datas = bean.getD().getList();
 
 
         //将数据中的所有用户ID存入List
         List<String> userIds = new ArrayList<>();
         //遍历发布者ID
-        for (TradeBean.DBean.ListBean data : datas){
+        for (TradeBean.DBean.ListBean data : datas) {
             if (!userIds.contains(data.getUser_id()))
                 userIds.add(data.getUser_id());
         }
@@ -215,12 +209,12 @@ public class TradeItemAdapter extends RecyclerView.Adapter<TradeItemAdapter.Trad
                 //添加数据
                 data.addAll(datas);
                 notifyDataSetChanged();
-                Log.e("添加数据成功","Success");
+                Log.e("添加数据成功", "Success");
             }
 
             @Override
             public void onFailed(int i) {
-                Log.e("Failed",i+"");
+                Log.e("Failed", i + "");
             }
 
             @Override
@@ -232,17 +226,17 @@ public class TradeItemAdapter extends RecyclerView.Adapter<TradeItemAdapter.Trad
     }
 
     //设置Item点击监听事件
-    public void setOnTradeItemClickListener(OnTradeItemClickListener listener){
+    public void setOnTradeItemClickListener(OnTradeItemClickListener listener) {
         this.listener = listener;
     }
 
     //有用户名返回用户名,无用户名返回用户ID
-    private String getUserName(String userId){
+    private String getUserName(String userId) {
         if (NIMClient.getService(UserService.class).getUserInfo(userId) != null) {
             String name = NIMClient.getService(UserService.class).getUserInfo(userId).getName();
-            if (name.equals("")){
+            if (name.equals("")) {
                 return userId;
-            }else {
+            } else {
                 return name;
             }
         }
@@ -251,9 +245,9 @@ public class TradeItemAdapter extends RecyclerView.Adapter<TradeItemAdapter.Trad
     }
 
     //用于更新本地缓存,标注已关注的帖子
-    public void setFollowed(String id){
-        for (TradeBean.DBean.ListBean bean: data){
-            if (id.equals(bean.getId())){
+    public void setFollowed(String id) {
+        for (TradeBean.DBean.ListBean bean : data) {
+            if (id.equals(bean.getId())) {
                 bean.setFollow(1);
                 Log.e("notifyDataSetChanged", "    true");
                 notifyDataSetChanged();
@@ -261,10 +255,11 @@ public class TradeItemAdapter extends RecyclerView.Adapter<TradeItemAdapter.Trad
             }
         }
     }
+
     //用于更新本地缓存,标注取消关注的帖子
-    public void setUnfollowed(String id){
-        for (TradeBean.DBean.ListBean bean: data){
-            if (id.equals(bean.getId())){
+    public void setUnfollowed(String id) {
+        for (TradeBean.DBean.ListBean bean : data) {
+            if (id.equals(bean.getId())) {
                 bean.setFollow(0);
                 Log.e("notifyDataSetChanged", "    true");
                 notifyDataSetChanged();
@@ -273,16 +268,16 @@ public class TradeItemAdapter extends RecyclerView.Adapter<TradeItemAdapter.Trad
         }
     }
 
-    public void clearAll(){
+    public void clearAll() {
         data.clear();
         notifyDataSetChanged();
     }
 
-    public void updateTradePriority(String id,String priority){
-        Log.e("adapter","收到置顶修改请求");
-        Log.e("adapter",id +  "   " + priority);
-        for (TradeBean.DBean.ListBean bean : data){
-            if (bean.getId().equals(id)){
+    public void updateTradePriority(String id, String priority) {
+        Log.e("adapter", "收到置顶修改请求");
+        Log.e("adapter", id + "   " + priority);
+        for (TradeBean.DBean.ListBean bean : data) {
+            if (bean.getId().equals(id)) {
                 bean.setPriority(priority);
             }
         }
@@ -290,12 +285,13 @@ public class TradeItemAdapter extends RecyclerView.Adapter<TradeItemAdapter.Trad
         notifyDataSetChanged();
     }
 
-    class TradeItemViewHolder extends RecyclerView.ViewHolder{
+    class TradeItemViewHolder extends RecyclerView.ViewHolder {
         private LinearLayout layout;
-        private ImageView avatarImg,followImg;
-        private TextView userName,date,priority,review;
+        private ImageView avatarImg, followImg;
+        private TextView userName, date, priority, review;
         private PartlyHighLightTextView content;
         private ImgGridView imgGridView;
+
         public TradeItemViewHolder(View view) {
             super(view);
             layout = (LinearLayout) view.findViewById(R.id.trade_list_item_layout);
@@ -311,7 +307,7 @@ public class TradeItemAdapter extends RecyclerView.Adapter<TradeItemAdapter.Trad
     }
 
 
-    public interface OnTradeItemClickListener{
+    public interface OnTradeItemClickListener {
         void onClick(View view);
     }
 }

+ 54 - 3
app/src/com/sheishuo/app/core_module/trade/view/ui/activity/TradeSearchActivity.java

@@ -1,13 +1,21 @@
 package com.sheishuo.app.core_module.trade.view.ui.activity;
 
 import android.content.Context;
+import android.content.Intent;
 import android.os.Bundle;
+import android.util.Log;
+import android.view.KeyEvent;
 import android.view.View;
 import android.widget.EditText;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
+import com.huawei.hms.support.api.pay.PayResultInfo;
 import com.sheishuo.app.R;
+import com.sheishuo.app.common.beans.TradeBean;
+import com.sheishuo.app.common.util.net.INet;
+import com.sheishuo.app.common.util.net.NetImpl;
+import com.sheishuo.app.common.util.net.ResponseCallback;
 import com.sheishuo.app.impl.SheishuoUI;
 
 /**
@@ -16,6 +24,9 @@ import com.sheishuo.app.impl.SheishuoUI;
 
 public class TradeSearchActivity extends SheishuoUI {
 
+    public static final int RESULT_CODE = 3400;
+    public static final String RESULT_CONTENT = "result_content";
+
     private String TAG = this.getClass().getSimpleName();
 
     private Context context = this;
@@ -25,6 +36,11 @@ public class TradeSearchActivity extends SheishuoUI {
     private EditText searchET;
 
     private TextView searchTV;
+
+    private INet net = new NetImpl();
+
+    //FLAGS
+    private int PAGE_TO_LOAD = 1;
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -44,9 +60,7 @@ public class TradeSearchActivity extends SheishuoUI {
         searchTV.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                String searchContent = searchET.getText().toString();
-                showToast(context,"搜索完成");
-                finish();
+                searchTrade();
 
             }
         });
@@ -60,4 +74,41 @@ public class TradeSearchActivity extends SheishuoUI {
             }
         });
     }
+
+
+
+    private void searchTrade(){
+        String key = searchET.getText().toString();
+        net.searchTrade(key, 0, PAGE_TO_LOAD, new ResponseCallback() {
+            @Override
+            public void onSuccess(Object object) {
+                TradeBean bean = (TradeBean) object;
+                if (bean.getD().getList().size() > 0){
+                    Intent intent = new Intent();
+                    intent.putExtra(RESULT_CONTENT,bean);
+                    setResult(RESULT_CODE,intent);
+                }else {
+                    showToast(context,"搜索结果为空");
+                }
+
+                finish();
+            }
+
+            @Override
+            public void onFailed() {
+                showToast(context,"加载失败");
+            }
+        });
+    }
+
+
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        Log.e(TAG,"KeyDown");
+        if (event.getAction() == KeyEvent.KEYCODE_ENTER){
+            searchTrade();
+            return true;
+        }
+        return false;
+    }
 }

+ 5 - 1
app/src/com/sheishuo/app/main/activity/MainActivity.java

@@ -31,6 +31,7 @@ import com.sheishuo.app.chatroom.helper.ChatRoomHelper;
 import com.sheishuo.app.config.preference.UserPreferences;
 import com.sheishuo.app.core_module.location.LocationSelectActivity;
 import com.sheishuo.app.core_module.trade.view.ui.activity.TradeChangePriorityActivity;
+import com.sheishuo.app.core_module.trade.view.ui.activity.TradeSearchActivity;
 import com.sheishuo.app.login.LoginActivity;
 import com.sheishuo.app.login.LogoutHelperBak;
 import com.sheishuo.app.main.fragment.HomeFragment;
@@ -253,7 +254,10 @@ public class MainActivity extends SheishuoUI {
     public void onActivityResult(int requestCode, int resultCode, Intent data) {
         Log.e(TAG,"onActivityResult " + requestCode + "    " + resultCode);
 
-        if(requestCode == MineFragment.AVATAR_SELECTED || requestCode == MineFragment.BANNER_SELECTED){
+        if(resultCode == TradeSearchActivity.RESULT_CODE){
+            //搜索交易帖
+            mainFragment.onActivityResult(requestCode,resultCode,data);
+        }else if(requestCode == MineFragment.AVATAR_SELECTED || requestCode == MineFragment.BANNER_SELECTED){
             //我的---头像和背景图更改
             mainFragment.onActivityResult(requestCode,resultCode,data);
         }else if(resultCode == LocationSelectActivity.LOCATION_SELECTED_RESULT_CODE){

+ 5 - 0
app/src/com/sheishuo/app/main/activity/SystemMessageActivity.java

@@ -10,6 +10,8 @@ import android.view.MenuItem;
 import android.view.View;
 import android.widget.Toast;
 
+import com.sheishuo.app.cache.AccountCache;
+import com.sheishuo.app.common.util.net.NetImpl;
 import com.sheishuo.app.main.adapter.SystemMessageAdapter;
 import com.sheishuo.app.main.viewholder.SystemMessageViewHolder;
 import com.sheishuo.app.R;
@@ -340,6 +342,9 @@ public class SystemMessageActivity extends UI implements TAdapterDelegate,
 
     @Override
     public void onAgree(SystemMessage message) {
+        //相互关注
+        new NetImpl().followOrUnfollow(AccountCache.getAccount().getId());
+        new NetImpl().followOrUnfollow(message.getTargetId());
         onSystemNotificationDeal(message, true);
     }
 

+ 134 - 85
app/src/com/sheishuo/app/main/fragment/AreaGroupsFragment.java

@@ -9,23 +9,25 @@ import android.view.View;
 import android.widget.TextView;
 import android.widget.Toast;
 
-import com.google.gson.Gson;
 import com.netease.nimlib.sdk.NIMClient;
+import com.netease.nimlib.sdk.RequestCallback;
 import com.netease.nimlib.sdk.team.TeamService;
+import com.netease.nimlib.sdk.team.model.Team;
+import com.netease.nimlib.sdk.uinfo.UserService;
 import com.sheishuo.app.R;
 import com.sheishuo.app.cache.AccountCache;
 import com.sheishuo.app.cache.GiftCache;
 import com.sheishuo.app.common.beans.GiftBean;
-import com.sheishuo.app.common.beans.NearbyGroupsBean;
+import com.sheishuo.app.common.util.img.ImgUtil;
 import com.sheishuo.app.common.util.net.INet;
 import com.sheishuo.app.common.util.net.NetImpl;
-import com.sheishuo.app.common.util.net.NetInfo;
 import com.sheishuo.app.common.util.net.ResponseCallback;
 import com.sheishuo.app.common.views.BaseToolbar;
 import com.sheishuo.app.common.views.CustomScrollLinearLayoutManager;
 import com.sheishuo.app.core_module.location.LocationSelectActivity;
 import com.sheishuo.app.core_module.sheishuo.view.ui.CreateNewGroupActivity;
 import com.sheishuo.app.core_module.sheishuo.view.ui.MoreGroupsInTheAreaActivity;
+import com.sheishuo.app.core_module.sheishuo.view.ui.NearbyGroupActivity;
 import com.sheishuo.app.impl.SheishuoUIKit;
 import com.sheishuo.app.login.beans.LoginBean;
 import com.sheishuo.app.main.activity.MainActivity;
@@ -38,8 +40,6 @@ import org.json.JSONObject;
 import java.util.ArrayList;
 import java.util.List;
 
-import okhttp3.FormBody;
-
 /**
  * Created by KN on 2017/7/18.
  */
@@ -54,7 +54,7 @@ public class AreaGroupsFragment extends MainTabFragment {
 
     private AreaGroupsAdapter areaGroupsAdapter, recentGroupsAdapter;
 
-    private TextView moreAreaGroupsTV;
+    private TextView moreAreaGroupsTV, nearbyGroupsTV;
     private LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
     private CustomScrollLinearLayoutManager recentLayoutManager = new CustomScrollLinearLayoutManager(getActivity());
 
@@ -74,10 +74,11 @@ public class AreaGroupsFragment extends MainTabFragment {
         areaGroupsRecyclerview = findView(R.id.area_groups_recyclerview);
         recentGroupsRecyclerview = findView(R.id.area_groups_nearby_recyclerview);
         moreAreaGroupsTV = findView(R.id.area_groups_more_rooms_tv);
+        nearbyGroupsTV = findView(R.id.area_groups_nearby_groups_TV);
     }
 
 
-    void init(){
+    void init() {
         updateLocation();
         loadGroups();
         initToolbar();
@@ -87,12 +88,19 @@ public class AreaGroupsFragment extends MainTabFragment {
             @Override
             public void onClick(View v) {
                 Intent intent = new Intent(getActivity(), MoreGroupsInTheAreaActivity.class);
-                intent.putExtra("province",AccountCache.getAccount().getProvince());
-                intent.putExtra("city",AccountCache.getAccount().getCity());
+                intent.putExtra("province", AccountCache.getAccount().getProvince());
+                intent.putExtra("city", AccountCache.getAccount().getCity());
 
                 startActivity(intent);
             }
         });
+
+        nearbyGroupsTV.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                startActivity(new Intent(getActivity(), NearbyGroupActivity.class));
+            }
+        });
     }
 
     //初始化Toolbar
@@ -126,7 +134,7 @@ public class AreaGroupsFragment extends MainTabFragment {
 
 
     //更新地理位置
-    public void updateLocation(){
+    public void updateLocation() {
         net.updateLatitudeAndLongitude(new ResponseCallback() {
             @Override
             public void onSuccess(Object object) {
@@ -185,62 +193,104 @@ public class AreaGroupsFragment extends MainTabFragment {
             }
         });
 
+
         //自动打开地区群
-        SheishuoUIKit.startTeamSession(getActivity(),groupIds.get(groupIds.size() - 1));
+        SheishuoUIKit.startTeamSession(getActivity(), groupIds.get(groupIds.size() - 1));
 
 
         //加载附近的群
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-                FormBody body = new FormBody.Builder()
-                        .add("page", "1")
-                        .add("latitude", AccountCache.getAccount().getLatitude())
-                        .add("longitude", AccountCache.getAccount().getLongitude())
-                        .build();
-                net.post(NetInfo.GET_NEARBY_GROUP, body, new ResponseCallback() {
-                    @Override
-                    public void onSuccess(Object object) {
-                        String resultStr = (String) object;
-                        final NearbyGroupsBean bean = new Gson().fromJson(resultStr, NearbyGroupsBean.class);
-                        if (bean.getC() == 0) {
-                            final List<String> nearbyGroupIds = new ArrayList<>();
-                            for (NearbyGroupsBean.DBean.ListBean entity : bean.getD().getList())
-                                nearbyGroupIds.add(entity.getId());
-
-
-                            getHandler().post(new Runnable() {
-                                @Override
-                                public void run() {
-                                    recentGroupsAdapter = new AreaGroupsAdapter(getActivity(), nearbyGroupIds);
-                                    recentGroupsRecyclerview.setAdapter(recentGroupsAdapter);
-                                    recentLayoutManager.setScrollEnable(false);
-                                    recentGroupsRecyclerview.setLayoutManager(recentLayoutManager);
-                                    recentGroupsAdapter.setOnItemClickListener(new OnItemClickListener() {
-                                        @Override
-                                        public void onItemClick(View view) {
-                                            String groupId = (String) view.getTag();
-                                            if (!NIMClient.getService(TeamService.class).queryTeamBlock(groupId).isMyTeam()) {
-                                                NIMClient.getService(TeamService.class).applyJoinTeam(groupId, "申请入群");
-                                            }
-                                            SheishuoUIKit.startTeamSession(getActivity(), (String) view.getTag());
-                                        }
-                                    });
-                                }
-                            });
+//        new Thread(new Runnable() {
+//            @Override
+//            public void run() {
+//                FormBody body = new FormBody.Builder()
+//                        .add("page", "1")
+//                        .add("latitude", AccountCache.getAccount().getLatitude())
+//                        .add("longitude", AccountCache.getAccount().getLongitude())
+//                        .build();
+//                net.post(NetInfo.GET_NEARBY_GROUP, body, new ResponseCallback() {
+//                    @Override
+//                    public void onSuccess(Object object) {
+//                        String resultStr = (String) object;
+//                        final NearbyGroupsBean bean = new Gson().fromJson(resultStr, NearbyGroupsBean.class);
+//                        if (bean.getC() == 0) {
+//                            final List<String> nearbyGroupIds = new ArrayList<>();
+//                            for (NearbyGroupsBean.DBean.ListBean entity : bean.getD().getList())
+//                                nearbyGroupIds.add(entity.getId());
+//
+//
+//                            getHandler().post(new Runnable() {
+//                                @Override
+//                                public void run() {
+//                                    recentGroupsAdapter = new AreaGroupsAdapter(getActivity(), nearbyGroupIds);
+//                                    recentGroupsRecyclerview.setAdapter(recentGroupsAdapter);
+//                                    recentLayoutManager.setScrollEnable(false);
+//                                    recentGroupsRecyclerview.setLayoutManager(recentLayoutManager);
+//                                    recentGroupsAdapter.setOnItemClickListener(new OnItemClickListener() {
+//                                        @Override
+//                                        public void onItemClick(View view) {
+//                                            String groupId = (String) view.getTag();
+//                                            if (!NIMClient.getService(TeamService.class).queryTeamBlock(groupId).isMyTeam()) {
+//                                                NIMClient.getService(TeamService.class).applyJoinTeam(groupId, "申请入群");
+//                                            }
+//                                            SheishuoUIKit.startTeamSession(getActivity(), (String) view.getTag());
+//                                        }
+//                                    });
+//                                }
+//                            });
+//
+//                        }
+//                    }
+//
+//                    @Override
+//                    public void onFailed() {
+//
+//                    }
+//                });
+//
+//
+//            }
+//        }).start();
 
-                        }
+        //加载最近活跃群
+
+
+        //加载最近活跃的群
+        NIMClient.getService(TeamService.class).queryTeamList().setCallback(new RequestCallback<List<Team>>() {
+            @Override
+            public void onSuccess(List<Team> teams) {
+                List<String> teamIds = new ArrayList<>();
+                for (Team team : teams) {
+                    if (teamIds.size() <= 10) {
+                        teamIds.add(team.getId());
                     }
+                }
 
+                recentGroupsAdapter = new AreaGroupsAdapter(getActivity(), teamIds);
+                recentGroupsRecyclerview.setAdapter(recentGroupsAdapter);
+                recentGroupsRecyclerview.setMinimumHeight((int) ImgUtil.convertDpToPixel(64 * recentGroupsAdapter.getItemCount(),getActivity()));
+                recentGroupsRecyclerview.setLayoutManager(recentLayoutManager);
+                recentGroupsAdapter.setOnItemClickListener(new OnItemClickListener() {
                     @Override
-                    public void onFailed() {
-
+                    public void onItemClick(View view) {
+                        String teamId = (String) view.getTag();
+                        SheishuoUIKit.startTeamSession(getActivity(),teamId);
                     }
                 });
+            }
 
+            @Override
+            public void onFailed(int i) {
+                showToast("加载最近活跃群失败");
 
             }
-        }).start();
+
+            @Override
+            public void onException(Throwable throwable) {
+                throwable.printStackTrace();
+                showToast("加载最近活跃群失败");
+
+            }
+        });
 
     }
 
@@ -281,45 +331,45 @@ public class AreaGroupsFragment extends MainTabFragment {
         });
     }
 
-    public void updateAccountLocation(final String province, final String city, final String district){
+    public void updateAccountLocation(final String province, final String city, final String district) {
         //更新Cache
         AccountCache.getAccount().setProvince(province);
         AccountCache.getAccount().setCity(city);
         AccountCache.getAccount().setDistrict(district);
 
-       net.updateLocation(province, city, district, new ResponseCallback() {
-           @Override
-           public void onSuccess(Object object) {
-               String jsonStr = (String)object;
-               try {
-                   JSONObject jsonObject = new JSONObject(jsonStr);
-
-                   String provinceRoomId = jsonObject.getJSONObject("d").getString("province");
-                   String cityRoomId = jsonObject.getJSONObject("d").getString("city");
-                   String districtRoomId = jsonObject.getJSONObject("d").getString("district");
-
-                   AccountCache.getAccount().setProvince_room_id(provinceRoomId);
-                   AccountCache.getAccount().setCity_room_id(cityRoomId);
-                   AccountCache.getAccount().setDistrict_room_id(districtRoomId);
-
-                   getHandler().post(new Runnable() {
-                       @Override
-                       public void run() {
-                           loadGroups();
-                       }
-                   });
+        net.updateLocation(province, city, district, new ResponseCallback() {
+            @Override
+            public void onSuccess(Object object) {
+                String jsonStr = (String) object;
+                try {
+                    JSONObject jsonObject = new JSONObject(jsonStr);
+
+                    String provinceRoomId = jsonObject.getJSONObject("d").getString("province");
+                    String cityRoomId = jsonObject.getJSONObject("d").getString("city");
+                    String districtRoomId = jsonObject.getJSONObject("d").getString("district");
+
+                    AccountCache.getAccount().setProvince_room_id(provinceRoomId);
+                    AccountCache.getAccount().setCity_room_id(cityRoomId);
+                    AccountCache.getAccount().setDistrict_room_id(districtRoomId);
+
+                    getHandler().post(new Runnable() {
+                        @Override
+                        public void run() {
+                            loadGroups();
+                        }
+                    });
 
-               } catch (JSONException e) {
-                   e.printStackTrace();
-               }
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }
 
-           }
+            }
 
-           @Override
-           public void onFailed() {
+            @Override
+            public void onFailed() {
 
-           }
-       });
+            }
+        });
     }
 
 
@@ -347,8 +397,7 @@ public class AreaGroupsFragment extends MainTabFragment {
 //            }
 
 
-
-            updateAccountLocation(province,city,area);
+            updateAccountLocation(province, city, area);
 
             location = city + area;
             if (location.length() > 6) {

+ 6 - 0
app/src/com/sheishuo/app/main/fragment/CircleOfFriendsFragment.java

@@ -23,6 +23,8 @@ import com.netease.nimlib.sdk.uinfo.model.NimUserInfo;
 import com.sheishuo.app.cache.AccountCache;
 import com.sheishuo.app.R;
 import com.sheishuo.app.SheishuoApplication;
+import com.sheishuo.app.cache.SocialInfoCache;
+import com.sheishuo.app.common.beans.SocialInfoBean;
 import com.sheishuo.app.common.util.net.NetStatus;
 import com.sheishuo.app.common.views.ImgGridView;
 import com.sheishuo.app.core_module.circle.activity.CircleDetailsActivity;
@@ -82,6 +84,10 @@ public class CircleOfFriendsFragment extends MainTabFragment{
         NimUserInfo user = NIMClient.getService(UserService.class).getUserInfo(AccountCache.getAccount().getId());
         String avatarUrl = user.getAvatar();
         Glide.with(SheishuoApplication.getContext()).load(avatarUrl).into(avatar);
+        Glide.with(getActivity())
+                .load(SocialInfoCache.get(AccountCache.getAccount().getId()).getSocial_banner())
+                .centerCrop()
+                .into(backgroundImg);
 
         username.setText(user.getName());
 

+ 9 - 0
app/src/com/sheishuo/app/main/fragment/HomeFragment.java

@@ -36,6 +36,7 @@ import com.sheishuo.app.common.ui.viewpager.PagerSlidingTabStrip;
 import com.sheishuo.app.common.views.BottomNavigationViewEx;
 import com.sheishuo.app.core_module.location.LocationSelectActivity;
 import com.sheishuo.app.core_module.trade.view.ui.activity.TradeChangePriorityActivity;
+import com.sheishuo.app.core_module.trade.view.ui.activity.TradeSearchActivity;
 import com.sheishuo.app.main.activity.MainActivity;
 import com.sheishuo.app.main.adapter.MainTabPagerAdapter;
 import com.sheishuo.app.main.helper.SystemMessageUnreadManager;
@@ -403,6 +404,14 @@ public class HomeFragment extends TFragment implements OnPageChangeListener, Rem
 
 
         switch (resultCode) {
+            //搜索交易帖
+            case TradeSearchActivity.RESULT_CODE:
+                for (Fragment fragment : getFragmentManager().getFragments()) {
+                    if (fragment instanceof TradeListFragment)
+                        fragment.onActivityResult(requestCode, resultCode, data);
+                }
+                break;
+
             //创建群回调
             case Activity.RESULT_OK:
                 List<String> memberList = data.getStringArrayListExtra(ContactSelectActivity.RESULT_DATA);

+ 13 - 6
app/src/com/sheishuo/app/main/fragment/MineFragment.java

@@ -68,6 +68,7 @@ public class MineFragment extends MainTabFragment implements View.OnClickListene
     private Toast toast = null;
     private INet net = new NetImpl();
 
+    private String mineId;
 
     //FLAGS
     public final static int AVATAR_SELECTED = 5000;
@@ -116,7 +117,7 @@ public class MineFragment extends MainTabFragment implements View.OnClickListene
 
 
 
-        final String mineId =AccountCache.getAccount().getId();
+        mineId = AccountCache.getAccount().getId();
 
                 UserInfoProvider.UserInfo user = NIMClient.getService(UserService.class).getUserInfo(AccountCache.getAccount().getId());
         if (user.getAvatar() != null)
@@ -125,11 +126,6 @@ public class MineFragment extends MainTabFragment implements View.OnClickListene
         usernameTV.setText(getName(mineId));
         userIdTV.setText("ID:" + mineId);
 
-        //初始化照片墙
-        initPhotosWall(mineId);
-
-
-
 
 
     }
@@ -153,6 +149,7 @@ public class MineFragment extends MainTabFragment implements View.OnClickListene
 
         if (isVisibleToUser){
             fetchSocialInfo();
+            initPhotosWall(mineId);
         }
 
         if (isVisibleToUser && toolbar != null && parent != null){
@@ -347,6 +344,7 @@ public class MineFragment extends MainTabFragment implements View.OnClickListene
                 if (!MineSocialCache.getInfo().getSocial_banner().isEmpty()){
                     Glide.with(getActivity())
                             .load(MineSocialCache.getInfo().getSocial_banner())
+                            .centerCrop()
                             .into(bannerImg);
                 }
 
@@ -391,6 +389,7 @@ public class MineFragment extends MainTabFragment implements View.OnClickListene
         getHandler().post(new Runnable() {
             @Override
             public void run() {
+                photosLayout.removeAllViews();
                 int widthAndHeight = ImgUtil.getScreenWidth(getActivity()) / 4;
 
                 for (int i = 0;i < 7 && i < photos.size();i++){
@@ -404,6 +403,12 @@ public class MineFragment extends MainTabFragment implements View.OnClickListene
                             .diskCacheStrategy(DiskCacheStrategy.ALL)
                             .into(imageView);
                     //添加布局
+                    imageView.setOnClickListener(new View.OnClickListener() {
+                        @Override
+                        public void onClick(View v) {
+                            startActivity(new Intent(getActivity(), MineUploadPhotoActivity.class));
+                        }
+                    });
                     photosLayout.addView(imageView);
                 }
 
@@ -426,4 +431,6 @@ public class MineFragment extends MainTabFragment implements View.OnClickListene
     }
 
 
+
+
 }

+ 7 - 19
app/src/com/sheishuo/app/main/fragment/TradeListFragment.java

@@ -90,7 +90,8 @@ public class TradeListFragment extends MainTabFragment {
     public boolean onOptionsItemSelected(MenuItem item) {
 
         if (item.getItemId() == R.id.trade_menu_search){
-            startActivity(new Intent(getActivity(), TradeSearchActivity.class));
+            Intent intent = new Intent(getActivity(), TradeSearchActivity.class);
+            startActivityForResult(intent,0);
             return false;
         }
 
@@ -251,26 +252,13 @@ public class TradeListFragment extends MainTabFragment {
             Bundle bundle = data.getExtras();
             String priority = bundle.getString(TradeChangePriorityActivity.TRADE_PRIORITY);
             String priorityType = bundle.getString(TradeChangePriorityActivity.TRADE_PRIORITY_TYPE);
-
-//            switch (priority){
-//                case TradeItemAdapter.PRIORITY_DISTRICT:
-//                    priorityTypeStr = "地区";
-//                    break;
-//                case TradeItemAdapter.PRIORITY_CITY:
-//                    priorityTypeStr = "城市";
-//                    break;
-//                case TradeItemAdapter.PRIORITY_PROVINCE:
-//                    priorityTypeStr = "省份";
-//                    break;
-//                case TradeItemAdapter.PRIORITY_COUNTRY:
-//                    priorityTypeStr = "国家";
-//                    break;
-//
-//            }
-
-
             if (adapter != null) adapter.updateTradePriority(priorityBeanId,priority);
 
+        }else if (TradeSearchActivity.RESULT_CODE == resultCode){
+            if (adapter != null){
+                adapter.clearAll();
+                adapter.addAll((TradeBean) data.getSerializableExtra(TradeSearchActivity.RESULT_CONTENT));
+            }
         }
     }
 

+ 23 - 0
app/src/com/sheishuo/app/session/SessionHelper.java

@@ -5,10 +5,15 @@ import android.content.Context;
 import android.content.Intent;
 import android.os.Build;
 import android.text.TextUtils;
+import android.util.Log;
 import android.view.View;
 import android.widget.Toast;
 
+import com.netease.nim.uikit.contact.ait.AitedContacts;
 import com.netease.nim.uikit.session.extension.GiftAttachment;
+import com.netease.nimlib.sdk.RequestCallback;
+import com.netease.nimlib.sdk.team.TeamService;
+import com.netease.nimlib.sdk.team.model.TeamMember;
 import com.sheishuo.app.SheishuoCache;
 import com.sheishuo.app.contact.activity.UserProfileActivity;
 import com.sheishuo.app.core_module.mine.view.ui.activity.UserInfoDetailActivity;
@@ -425,6 +430,24 @@ public class SessionHelper {
             @Override
             public void onAvatarLongClicked(Context context, IMMessage message) {
                 // 一般用于聊天室@功能,或者弹出菜单,做拉黑,加好友等功能
+                Log.e("SessionHelper",message.getFromAccount()+ "   " + message.getSessionId());
+                NIMClient.getService(TeamService.class).queryTeamMember(message.getSessionId(),message.getFromAccount())
+                        .setCallback(new RequestCallback<TeamMember>() {
+                            @Override
+                            public void onSuccess(TeamMember teamMember) {
+                                AitedContacts.getInstance().aitTeamMember(teamMember);
+                            }
+
+                            @Override
+                            public void onFailed(int i) {
+
+                            }
+
+                            @Override
+                            public void onException(Throwable throwable) {
+
+                            }
+                        });
             }
         };
 

+ 1 - 1
uikit/src/com/netease/nim/uikit/recent/holder/RecentViewHolder.java

@@ -154,7 +154,7 @@ public abstract class RecentViewHolder extends RecyclerViewHolder<BaseQuickAdapt
         // 设置头像
         if (recent.getSessionType() == SessionTypeEnum.P2P) {
             imgHead.loadBuddyAvatar(recent.getContactId());
-        } else if (recent.getSessionType() == SessionTypeEnum.Team) {
+        } else if (recent.getSessionType() == SessionTypeEnum.Team && TeamDataCache.getInstance().getTeamById(recent.getContactId()) != null) {
             Team team = TeamDataCache.getInstance().getTeamById(recent.getContactId());
             if (team.getName().contains("国家")){
                 Glide.with(ContextCache.context).load(R.drawable.group_country).into(imgHead);

+ 1 - 0
uikit/src/com/netease/nim/uikit/session/activity/WatchPictureData.java

@@ -1,5 +1,6 @@
 package com.netease.nim.uikit.session.activity;
 
+import java.io.Serializable;
 import java.util.List;
 
 public class WatchPictureData implements IWatchPictureData

+ 12 - 2
uikit/src/com/netease/nim/uikit/session/module/input/InputPanel.java

@@ -310,6 +310,9 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
             public void onTextChanged(CharSequence s, int start, int before, int count) {
                 this.start = start;
                 this.count = count;
+
+                Log.e("InputPanel","onTextChanged");
+
             }
 
             @Override
@@ -335,6 +338,13 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
                 messageEditText.addTextChangedListener(this);
 
                 sendTypingCommand();
+
+                //去除掉多余的@符号
+                if (s.toString().equals("@")){
+                    String str = messageEditText.getText().toString();
+                    str = str.substring(0,str.length() - 1);
+                    messageEditText.setText(str);
+                }
             }
         });
     }
@@ -943,8 +953,8 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
         int length = account.length();
         // 不是输入的@,而是插进来的
         if (!force) {
-            start--;
-            length++;
+            //start--;
+            //length++;
         }
 
         editable.setSpan(TeamMemberAitHelper.getInputAitSpan(aitName, messageEditText.getTextSize(), messageEditText.getMeasuredWidth()),

+ 7 - 7
uikit/uikit.iml

@@ -59,13 +59,6 @@
       <sourceFolder url="file://$MODULE_DIR$/assets" type="java-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
@@ -73,6 +66,13 @@
       <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
       <excludeFolder url="file://$MODULE_DIR$/build/.DS_Store" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/.DS_Store" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />