Junqin Wang 8 years ago
parent
commit
ed70fa0dc5
31 changed files with 1409 additions and 30 deletions
  1. 10 0
      app/AndroidManifest.xml
  2. 20 0
      app/res/drawable/selector_radiobutton_rc_bg_green.xml
  3. 10 0
      app/res/drawable/selector_textcolor_green_white.xml
  4. 10 0
      app/res/layout/item_hobby_select_checkbox.xml
  5. 61 0
      app/res/layout/mine_about_sheishuo.xml
  6. 23 0
      app/res/layout/mine_about_webview_activity.xml
  7. 61 0
      app/res/layout/mine_change_pwd_activity.xml
  8. 27 0
      app/res/layout/mine_hobby_select_activity.xml
  9. 64 0
      app/res/layout/mine_notification_setting_activity.xml
  10. 4 4
      app/res/layout/mine_personal_settings.xml
  11. 53 0
      app/src/com/sheishuo/app/cache/HobbyCache.java
  12. 5 0
      app/src/com/sheishuo/app/common/util/net/INet.java
  13. 179 7
      app/src/com/sheishuo/app/common/util/net/NetImpl.java
  14. 11 0
      app/src/com/sheishuo/app/common/util/net/NetInfo.java
  15. 1 0
      app/src/com/sheishuo/app/common/views/BaseToolbar.java
  16. 2 2
      app/src/com/sheishuo/app/core_module/location/LocationSelectActivity.java
  17. 85 0
      app/src/com/sheishuo/app/core_module/mine/view/ui/activity/AboutActivity.java
  18. 60 0
      app/src/com/sheishuo/app/core_module/mine/view/ui/activity/AboutWebViewActivity.java
  19. 2 1
      app/src/com/sheishuo/app/core_module/mine/view/ui/activity/AccountAndSecurityActivity.java
  20. 86 0
      app/src/com/sheishuo/app/core_module/mine/view/ui/activity/ChangePwdActivity.java
  21. 137 0
      app/src/com/sheishuo/app/core_module/mine/view/ui/activity/HobbySelectActivity.java
  22. 2 1
      app/src/com/sheishuo/app/core_module/mine/view/ui/activity/MineUploadPhotoActivity.java
  23. 93 0
      app/src/com/sheishuo/app/core_module/mine/view/ui/activity/NotificationSettingActivity.java
  24. 191 11
      app/src/com/sheishuo/app/core_module/mine/view/ui/activity/PersonalSettingsActivity.java
  25. 182 0
      app/src/com/sheishuo/app/core_module/mine/view/ui/activity/PrivacyActivity.java
  26. 20 0
      app/src/com/sheishuo/app/core_module/mine/view/ui/activity/SettingsActivity.java
  27. 6 0
      app/src/com/sheishuo/app/core_module/sheishuo/view/ui/SettingTextEditActivity.java
  28. 1 1
      app/src/com/sheishuo/app/main/activity/MainActivity.java
  29. 1 1
      app/src/com/sheishuo/app/main/fragment/AreaGroupsFragment.java
  30. 1 1
      app/src/com/sheishuo/app/main/fragment/HomeFragment.java
  31. 1 1
      app/src/com/sheishuo/app/main/fragment/TradeListFragment.java

+ 10 - 0
app/AndroidManifest.xml

@@ -155,6 +155,16 @@
             android:theme="@style/AppTheme.NoActionBar"/>
         <activity android:name=".core_module.mine.view.ui.activity.AccountAndSecurityActivity"
             android:theme="@style/AppTheme.NoActionBar"/>
+        <activity android:name=".core_module.mine.view.ui.activity.ChangePwdActivity"
+            android:theme="@style/AppTheme.NoActionBar"/>
+        <activity android:name=".core_module.mine.view.ui.activity.AboutActivity"
+            android:theme="@style/AppTheme.NoActionBar"/>
+        <activity android:name=".core_module.mine.view.ui.activity.AboutWebViewActivity"
+            android:theme="@style/AppTheme.NoActionBar"/>
+        <activity android:name=".core_module.mine.view.ui.activity.NotificationSettingActivity"
+            android:theme="@style/AppTheme.NoActionBar"/>
+        <activity android:name=".core_module.mine.view.ui.activity.HobbySelectActivity"
+            android:theme="@style/AppTheme.NoActionBar"/>
 
         <!--交易帖相关Activity-->
         <activity android:name=".core_module.trade.view.ui.activity.TradeChangePriorityActivity"

+ 20 - 0
app/res/drawable/selector_radiobutton_rc_bg_green.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_checked="false">
+        <shape>
+            <corners android:radius="15dp"/>
+            <stroke android:color="@color/green_4DC0A4"
+                android:width="1dp"/>
+        </shape>
+    </item>
+
+
+    <item android:state_checked="true">
+        <shape>
+            <corners android:radius="15dp"/>
+            <solid android:color="@color/green_4DC0A4"/>
+        </shape>
+    </item>
+
+
+</selector>

+ 10 - 0
app/res/drawable/selector_textcolor_green_white.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:state_checked="false"
+        android:drawable="@color/green_4DC0A4"/>
+
+    <item android:state_checked="true"
+        android:drawable="@color/white"/>
+
+</selector>

+ 10 - 0
app/res/layout/item_hobby_select_checkbox.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical" android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:background="@drawable/selector_radiobutton_rc_bg_green"
+    android:gravity="center"
+    android:padding="8dp"
+    android:button="@null">
+
+</CheckBox>

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

@@ -0,0 +1,61 @@
+<?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:background="@color/grey_light_light_light">
+
+    <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="返回"/>
+    </android.support.design.widget.AppBarLayout>
+
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:padding="16dp"
+        android:gravity="center"
+        android:orientation="vertical"
+        android:background="@color/white">
+        <ImageView
+            android:layout_width="96dp"
+            android:layout_height="96dp"
+            android:src="@drawable/logo"/>
+
+        <TextView
+            android:id="@+id/mine_about_version_TV"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="版本号:v1.0.0"
+            android:padding="16dp"/>
+
+        <TextView
+            android:id="@+id/mine_about_agreement_TV"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="谁说用户协议"
+            android:textColor="#5779ff"/>
+
+        <TextView
+            android:id="@+id/mine_about_law_TV"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="国家法律法规"
+            android:textColor="#5779ff"
+            android:layout_marginTop="16dp"/>
+
+    </LinearLayout>
+
+    <WebView
+        android:id="@+id/mine_about_webview"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"/>
+</LinearLayout>

+ 23 - 0
app/res/layout/mine_about_webview_activity.xml

@@ -0,0 +1,23 @@
+<?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:left_text="返回"/>
+    </android.support.design.widget.AppBarLayout>
+
+
+    <WebView
+        android:id="@+id/mine_about_webview"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"/>
+</LinearLayout>

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

@@ -0,0 +1,61 @@
+<?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:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical"
+        android:padding="16dp">
+        <EditText
+            android:id="@+id/mine_change_pwd_old_ET"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="请输入旧密码"
+            android:layout_marginTop="16dp"
+            android:inputType="textPassword"/>
+
+        <EditText
+            android:id="@+id/mine_change_pwd_new_ET"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="请输入新密码"
+            android:layout_marginTop="16dp"
+            android:inputType="textPassword"/>
+
+
+        <EditText
+            android:id="@+id/mine_change_pwd_confirm_ET"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="请确认新密码"
+            android:layout_marginTop="16dp"
+            android:inputType="textPassword"/>
+
+
+        <Button
+            android:id="@+id/mine_change_pwd_submit_btn"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="确认修改"
+            android:textColor="@color/white"
+            android:background="@drawable/btn1_selector" />
+    </LinearLayout>
+
+</LinearLayout>

+ 27 - 0
app/res/layout/mine_hobby_select_activity.xml

@@ -0,0 +1,27 @@
+<?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="返回"
+            app:right_text="确认"/>
+    </android.support.design.widget.AppBarLayout>
+
+
+    <LinearLayout
+        android:id="@+id/mine_hobby_select_activity_hobby_layout"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:padding="16dp"
+        android:orientation="vertical"/>
+</LinearLayout>

+ 64 - 0
app/res/layout/mine_notification_setting_activity.xml

@@ -0,0 +1,64 @@
+<?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:background="@color/grey_light_light_light">
+
+    <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="返回"/>
+    </android.support.design.widget.AppBarLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:padding="16dp"
+        android:gravity="center_vertical"
+        android:background="@color/white">
+        <TextView
+            android:layout_weight="7"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="声音"/>
+        <Switch
+            android:id="@+id/mine_notification_setting_sound_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:padding="16dp"
+        android:gravity="center_vertical"
+        android:background="@color/white">
+        <TextView
+            android:layout_weight="7"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="震动"/>
+        <Switch
+            android:id="@+id/mine_notification_setting_vibration_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>

+ 4 - 4
app/res/layout/mine_personal_settings.xml

@@ -183,10 +183,10 @@
                     android:layout_weight="9"
                     android:text="是否公开年龄" />
 
-                <com.netease.nim.uikit.common.ui.widget.SwitchButton
+                <Switch
                     android:id="@+id/personal_settings_age_is_public_switch"
-                    android:layout_width="58dp"
-                    android:layout_height="36.67dp"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
                     android:gravity="center"
                     android:src="@drawable/nim_avatar_default" />
 
@@ -218,7 +218,7 @@
                     android:layout_height="wrap_content"
                     android:gravity="center"
                     android:src="@drawable/nim_avatar_default"
-                    android:text="年龄" />
+                    android:text="21" />
 
             </LinearLayout>
 

+ 53 - 0
app/src/com/sheishuo/app/cache/HobbyCache.java

@@ -0,0 +1,53 @@
+package com.sheishuo.app.cache;
+
+import com.sheishuo.app.common.util.net.NetImpl;
+import com.sheishuo.app.common.util.net.ResponseCallback;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created by KN on 2017/8/28.
+ */
+
+public class HobbyCache {
+    private static boolean inited = false;
+
+    private static Map<String,List<String>> hobbyMap = new HashMap<>();
+
+
+
+    public static List<String> getHobbyCategory() throws Exception {
+        if (inited){
+            List<String> categoryList = new ArrayList<>();
+            Iterator<String> iterator = hobbyMap.keySet().iterator();
+            while (iterator.hasNext()){
+                categoryList.add(iterator.next());
+            }
+
+            return categoryList;
+        }
+        throw new Exception("HobbyCache not inited");
+    }
+
+
+    public static List<String> getHobbyItems(String category) throws Exception {
+        if (inited){
+            return hobbyMap.get(category);
+        }
+        throw new Exception("HobbyCache not inited");
+    }
+
+
+    public static void put(String category,List<String> items){
+        hobbyMap.put(category,items);
+        inited = true;
+    }
+
+
+
+}

+ 5 - 0
app/src/com/sheishuo/app/common/util/net/INet.java

@@ -2,6 +2,8 @@ package com.sheishuo.app.common.util.net;
 
 import android.support.annotation.Nullable;
 
+import com.sheishuo.app.common.beans.SocialInfoBean;
+
 import okhttp3.FormBody;
 import okhttp3.MediaType;
 import okhttp3.RequestBody;
@@ -20,6 +22,7 @@ public interface INet {
     void updateLocation(String province,String city,String district,ResponseCallback callback);
     void loginQuery(String mobile,String pwd,ResponseCallback callback);
     void getVerificationCode(String mobile,ResponseCallback callback);
+    void changePwd(String pwd,String newPwd,ResponseCallback callback);
     void getGiftList(ResponseCallback callback);
     void uploadImgs(String filePath, ResponseCallback callback);
     void uploadSocialPhoto(String filePath,ResponseCallback callback);
@@ -35,4 +38,6 @@ public interface INet {
     void getPhoneContactRelationship(String phoneListStr,ResponseCallback callback);
     void sendAddFriendRequest(String targetId,String msg);
     void followOrUnfollow(String targetId);
+    void updateSocialInfo(SocialInfoBean bean,ResponseCallback callback);
+    void getHobbyList(ResponseCallback callback);
 }

+ 179 - 7
app/src/com/sheishuo/app/common/util/net/NetImpl.java

@@ -6,6 +6,7 @@ import android.util.Log;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 import com.sheishuo.app.cache.AccountCache;
+import com.sheishuo.app.cache.HobbyCache;
 import com.sheishuo.app.cache.SocialInfoCache;
 import com.sheishuo.app.common.beans.CircleBean;
 import com.sheishuo.app.common.beans.ContactRelationshipBean;
@@ -15,11 +16,14 @@ import com.sheishuo.app.common.beans.TradeBean;
 import com.sheishuo.app.common.util.location.LocationHelper;
 import com.sheishuo.app.login.beans.LoginBean;
 
+import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 import okhttp3.Call;
@@ -244,16 +248,74 @@ public class NetImpl implements INet {
     }
 
     @Override
-    public void getVerificationCode(final String mobile, ResponseCallback callback) {
+    public void getVerificationCode(final String mobile, final ResponseCallback callback) {
         new Thread(new Runnable() {
             @Override
             public void run() {
-                FormBody body = new FormBody.Builder()
-                        .add("mobile", mobile)
-                        .build();
-                Request request = new Request.Builder()
-                        .post(body)
-                        .url()
+
+                try{
+                    FormBody body = new FormBody.Builder()
+                            .add("mobile", mobile)
+                            .build();
+
+                    Request request = new Request.Builder()
+                            .post(body)
+                            .url(GET_CODE)
+                            .build();
+                    Response response = client.newCall(request).execute();
+                    if (200 == response.code()){
+                        String resultStr = response.body().string();
+                        String code = new JSONObject(resultStr).getJSONObject("d").getString("obj");
+                        callback.onSuccess(code);
+                    }else {
+                        callback.onFailed();
+                    }
+
+                }catch (Exception e){
+                    e.printStackTrace();
+                    callback.onFailed();
+                }
+            }
+        }).start();
+    }
+
+    @Override
+    public void changePwd(final String pwd, final String newPwd, final ResponseCallback callback) {
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+                try{
+                    FormBody body = new FormBody.Builder()
+                            .add("id",AccountCache.getAccount().getId())
+                            .add("pwd",pwd)
+                            .add("new_pwd",newPwd)
+                            .build();
+
+                    Request request = new Request.Builder()
+                            .post(body)
+                            .url(CHANGE_PWD)
+                            .build();
+
+                    Response response = client.newCall(request).execute();
+                    if (200 == response.code()){
+                        String resultStr = response.body().string();
+                        Boolean isUpdate = new JSONObject(resultStr).getJSONObject("d").getBoolean("update");
+                        if (isUpdate){
+                            callback.onSuccess(null);
+                        }else {
+                            callback.onFailed();
+                        }
+
+                    }else {
+                        callback.onFailed();
+                    }
+
+                }catch (Exception e){
+                    e.printStackTrace();
+                    callback.onFailed();
+                }
+
+
             }
         }).start();
     }
@@ -779,5 +841,115 @@ public class NetImpl implements INet {
         }).start();
     }
 
+    @Override
+    public void updateSocialInfo(SocialInfoBean bean,final ResponseCallback callback) {
+        //更新缓存
+        SocialInfoCache.put(bean.getUser_id(),bean);
+
+        String user_id = bean.getUser_id();
+        String age = bean.getAge();
+        String show_age = bean.getShow_age();
+        String real_name = bean.getReal_name();
+        String id_number = bean.getId_number();
+        String add_verify = bean.getAdd_verify();
+        String find_mobile = bean.getFind_mobile();
+        String find_id = bean.getFind_id();
+        String find_nick = bean.getFind_nick();
+        String see_social = bean.getSee_social();
+        String effect = bean.getEffect();
+        String hobby = bean.getHobby();
+        String address = bean.getAddress();
+
+        FormBody body = new FormBody.Builder()
+                .add("user_id",user_id)
+                .add("age",age)
+                .add("show_age",show_age)
+                .add("real_name",real_name)
+                .add("id_number",id_number)
+                .add("add_verify",add_verify)
+                .add("find_mobile",find_mobile)
+                .add("find_id",find_id)
+                .add("find_nick",find_nick)
+                .add("see_social",see_social)
+                .add("effect",effect)
+                .add("hobby",hobby)
+                .add("address",address)
+                .build();
+
+        final Request request = new Request.Builder()
+                .post(body)
+                .url(UPDATE_SOCIAL_INFO)
+                .build();
+
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    Response response = client.newCall(request).execute();
+
+                    if (200 == response.code()){
+                        String resultStr = response.body().string();
+                        int resultCode = new JSONObject(resultStr).getInt("c");
+                        if (0 == resultCode){
+                            callback.onSuccess(null);
+                        }else {
+                            callback.onFailed();
+                        }
+                    }else {
+                        callback.onFailed();
+                    }
+
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    callback.onFailed();
+                }
+            }
+        }).start();
+
+
+    }
+
+    @Override
+    public void getHobbyList(final ResponseCallback callback) {
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+                Request request = new Request.Builder()
+                        .get()
+                        .url(GET_HOBBY)
+                        .build();
+
+                try {
+                    Response response = client.newCall(request).execute();
+                    if (200 == response.code()) {
+                        String resultStr = response.body().string();
+                        JSONObject jsonObject = new JSONObject(resultStr).getJSONObject("d");
+                        Iterator<String> iterator = jsonObject.keys();
+
+                        while (iterator.hasNext()){
+                            String categoryName = iterator.next();
+                            JSONArray itemJsonArray = jsonObject.getJSONArray(categoryName);
+                            List<String> items = new ArrayList<>();
+                            for (int j = 0;j < itemJsonArray.length();j++){
+                                String item = itemJsonArray.getString(j);
+                                items.add(item);
+                            }
+
+                            HobbyCache.put(categoryName,items);
+                        }
+                        callback.onSuccess(null);
+
+
+                    } else {
+                        callback.onFailed();
+                    }
+                }catch (Exception e){
+                    e.printStackTrace();
+                    callback.onFailed();
+                }
+            }
+        }).start();
+    }
+
 
 }

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

@@ -8,6 +8,7 @@ public class NetInfo {
     public final static String INDEX = "http://whosay.dashgame.com/index.php/";
     public final static String LOGIN_URL = INDEX + "?m=who&c=index&a=login";
     public final static String REG_URL = INDEX + "?m=who&c=index&a=register";
+    public final static String CHANGE_PWD = INDEX + "?m=who&c=index&a=pwd_update";
     public final static String GET_NEARBY_GROUP = INDEX + "?m=who&c=index&a=near_room";
     public final static String CIRCLE_LIST = INDEX + "?m=who&c=social&a=lists";
     public final static String CIRCLE_USER_LIKED = INDEX + "?m=who&c=social&a=like";
@@ -31,4 +32,14 @@ public class NetInfo {
     public final static String UPDATE_BANNER = INDEX + "?m=who&c=social&a=banner_upload";
     public final static String REQUEST_FRIEND = INDEX + "?m=who&c=social&a=request_friend";
     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";
+
+
+
+
+    //about URL
+    public final static String ABOUT_URL = INDEX + "?m=who&c=index&a=webview&id=about";
+    public final static String AGREEMENT_URL = INDEX + "?m=who&c=index&a=webview&id=agreement";
+    public final static String LAW_URL = INDEX + "?m=who&c=index&a=webview&id=law";
 }

+ 1 - 0
app/src/com/sheishuo/app/common/views/BaseToolbar.java

@@ -176,6 +176,7 @@ public class BaseToolbar extends Toolbar {
 
 
 
+
         /**
          * 为Toolbar添加一个图标按钮
          *

+ 2 - 2
app/src/com/sheishuo/app/core_module/location/LocationSelectActivity.java

@@ -23,7 +23,7 @@ public class LocationSelectActivity extends SheishuoUI {
 
 
     //Flag
-    public final static int LOCATION_SELECTED = 30001;
+    public final static int LOCATION_SELECTED_RESULT_CODE = 30001;
     public final static String LOCATION_PROVINCE = "province";
     public final static String LOCATION_CITY = "city";
     public final static String LOCATION_AREA = "area";
@@ -55,7 +55,7 @@ public class LocationSelectActivity extends SheishuoUI {
                 data.putString(LOCATION_AREA,area);
                 Intent intent = new Intent();
                 intent.putExtras(data);
-                setResult(LOCATION_SELECTED,intent);
+                setResult(LOCATION_SELECTED_RESULT_CODE,intent);
                 finish();
             }
         });

+ 85 - 0
app/src/com/sheishuo/app/core_module/mine/view/ui/activity/AboutActivity.java

@@ -0,0 +1,85 @@
+package com.sheishuo.app.core_module.mine.view.ui.activity;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.webkit.WebView;
+import android.widget.TextView;
+
+import com.sheishuo.app.R;
+import com.sheishuo.app.common.util.net.NetInfo;
+import com.sheishuo.app.common.views.BaseToolbar;
+import com.sheishuo.app.impl.SheishuoUI;
+
+/**
+ * Created by KN on 2017/8/28.
+ */
+
+public class AboutActivity extends SheishuoUI {
+
+    private String TAG = this.getClass().getSimpleName();
+    private Context context = this;
+
+    private BaseToolbar toolbar;
+
+    private TextView versionTV,agreementTV,lawTV;
+
+    private WebView webView;
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.mine_about_sheishuo);
+        findViews();
+        init();
+    }
+
+    void findViews(){
+        toolbar = findView(R.id.toolbar);
+        versionTV = findView(R.id.mine_about_version_TV);
+        agreementTV  = findView(R.id.mine_about_agreement_TV);
+        lawTV = findView(R.id.mine_about_law_TV);
+        webView = findView(R.id.mine_about_webview);
+    }
+
+    void init(){
+
+        toolbar.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                finish();
+            }
+        });
+
+        webView.loadUrl(NetInfo.ABOUT_URL);
+
+        agreementTV.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+
+            }
+        });
+
+
+        agreementTV.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                Intent intent = new Intent(context,AboutWebViewActivity.class);
+                intent.putExtra(AboutWebViewActivity.TITLE,"用户协议");
+                intent.putExtra(AboutWebViewActivity.URL,NetInfo.AGREEMENT_URL);
+                startActivity(intent);
+            }
+        });
+
+
+        lawTV.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                Intent intent = new Intent(context,AboutWebViewActivity.class);
+                intent.putExtra(AboutWebViewActivity.TITLE,"国家法律法规");
+                intent.putExtra(AboutWebViewActivity.URL,NetInfo.LAW_URL);
+                startActivity(intent);
+            }
+        });
+    }
+}

+ 60 - 0
app/src/com/sheishuo/app/core_module/mine/view/ui/activity/AboutWebViewActivity.java

@@ -0,0 +1,60 @@
+package com.sheishuo.app.core_module.mine.view.ui.activity;
+
+import android.os.Bundle;
+import android.view.View;
+import android.webkit.WebView;
+
+import com.sheishuo.app.R;
+import com.sheishuo.app.common.views.BaseToolbar;
+import com.sheishuo.app.impl.SheishuoUI;
+
+/**
+ * Created by KN on 2017/8/28.
+ */
+
+public class AboutWebViewActivity extends SheishuoUI{
+
+    public final static String TITLE = "title";
+    public final static String URL = "url";
+
+    private BaseToolbar toolbar;
+
+    private WebView webView;
+
+
+    private String title = "";
+    private String url = "";
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.mine_about_webview_activity);
+        title = getIntent().getStringExtra(TITLE);
+        url = getIntent().getStringExtra(URL);
+
+        findViews();
+        init();
+    }
+
+
+    void findViews(){
+        toolbar = findView(R.id.toolbar);
+
+        webView = findView(R.id.mine_about_webview);
+    }
+
+    void init(){
+        toolbar.setTitle(title);
+        toolbar.getLeftTV().setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                finish();
+            }
+        });
+
+        webView.loadUrl(url);
+
+
+
+    }
+}

+ 2 - 1
app/src/com/sheishuo/app/core_module/mine/view/ui/activity/AccountAndSecurityActivity.java

@@ -1,6 +1,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.view.View;
 import android.widget.LinearLayout;
@@ -48,7 +49,7 @@ public class AccountAndSecurityActivity extends SheishuoUI {
         changePwdLayout.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-
+                startActivity(new Intent(context,ChangePwdActivity.class));
             }
         });
     }

+ 86 - 0
app/src/com/sheishuo/app/core_module/mine/view/ui/activity/ChangePwdActivity.java

@@ -0,0 +1,86 @@
+package com.sheishuo.app.core_module.mine.view.ui.activity;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+
+import com.sheishuo.app.R;
+import com.sheishuo.app.cache.AccountCache;
+import com.sheishuo.app.common.util.data.SPHelper;
+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;
+
+/**
+ * Created by KN on 2017/8/28.
+ */
+
+public class ChangePwdActivity extends SheishuoUI {
+
+    private String TAG = this.getClass().getSimpleName();
+    private Context context = this;
+
+    private EditText oldPwdET,newPwdET,confirmPwdET;
+
+    private Button submitBtn;
+
+
+    private INet net = new NetImpl();
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.mine_change_pwd_activity);
+        findViews();
+        init();
+
+    }
+
+
+    void findViews(){
+        oldPwdET = findView(R.id.mine_change_pwd_old_ET);
+        newPwdET = findView(R.id.mine_change_pwd_new_ET);
+        confirmPwdET = findView(R.id.mine_change_pwd_confirm_ET);
+        submitBtn = findView(R.id.mine_change_pwd_submit_btn);
+    }
+
+
+    void init(){
+        submitBtn.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                String oldPwd = oldPwdET.getText().toString();
+                final String newPwd = newPwdET.getText().toString();
+                String confirmPwd = confirmPwdET.getText().toString();
+
+                if (!oldPwd.equals(SPHelper.getParam(context,"pwd",""))){
+                    showToast(context,"原密码输入错误");
+                    return;
+                }
+
+                if (!newPwd.equals(confirmPwd)){
+                    showToast(context,"两次密码输入不一致");
+                    return;
+                }
+
+
+                net.changePwd(oldPwd, newPwd, new ResponseCallback() {
+                    @Override
+                    public void onSuccess(Object object) {
+                        showToast(context,"密码修改成功");
+                        SPHelper.setParam(context,"pwd",newPwd);
+                        finish();
+                    }
+
+                    @Override
+                    public void onFailed() {
+                        showToast(context,"密码修改失败,请重试");
+
+                    }
+                });
+            }
+        });
+    }
+}

+ 137 - 0
app/src/com/sheishuo/app/core_module/mine/view/ui/activity/HobbySelectActivity.java

@@ -0,0 +1,137 @@
+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.LayoutInflater;
+import android.view.View;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.GridLayout;
+import android.widget.LinearLayout;
+import android.widget.RadioButton;
+import android.widget.TextView;
+
+import com.sheishuo.app.R;
+import com.sheishuo.app.cache.HobbyCache;
+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.impl.SheishuoUI;
+
+import java.util.List;
+
+/**
+ * Created by KN on 2017/8/28.
+ */
+
+public class HobbySelectActivity extends SheishuoUI {
+
+    public static final int HOBBY_RESULT_CODE = 5500;
+    public static final String RESULT_HOBBY = "result_hobby";
+
+    private String TAG = this.getClass().getSimpleName();
+    private Context context = this;
+
+    private BaseToolbar toolbar;
+
+    private LinearLayout hobbyLayout;
+
+    private INet net = new NetImpl();
+
+    //FLAGS
+    private String hobbySelect = "";
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.mine_hobby_select_activity);
+        findViews();
+        init();
+    }
+
+    void findViews(){
+        toolbar = findView(R.id.toolbar);
+        hobbyLayout = findView(R.id.mine_hobby_select_activity_hobby_layout);
+    }
+
+    void init(){
+        toolbar.getLeftTV().setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                finish();
+            }
+        });
+
+        toolbar.getRightTV().setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                Intent intent = new Intent();
+                intent.putExtra(RESULT_HOBBY,hobbySelect.substring(0,hobbySelect.length() - 1));
+                setResult(HOBBY_RESULT_CODE,intent);
+                finish();
+            }
+        });
+
+
+        //初始化兴趣缓存
+        net.getHobbyList(new ResponseCallback() {
+            @Override
+            public void onSuccess(Object object) {
+                Log.e(TAG,"success");
+                updateHobby();
+            }
+
+            @Override
+            public void onFailed() {
+                Log.e(TAG,"failed");
+            }
+        });
+
+
+
+    }
+
+
+
+    private void updateHobby(){
+        getHandler().post(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    List<String> categoryList = HobbyCache.getHobbyCategory();
+
+                    for (String category : categoryList){
+                        Log.e(TAG,category);
+                        LinearLayout linearLayout = new LinearLayout(context);
+                        TextView textView = new TextView(context);
+                        GridLayout gridLayout = new GridLayout(context);
+                        gridLayout.setColumnCount(5);
+                        textView.setText(category);
+                        hobbyLayout.addView(textView);
+                        linearLayout.addView(gridLayout);
+
+                        for (String item : HobbyCache.getHobbyItems(category)){
+                            final CheckBox checkBox = (CheckBox) LayoutInflater.from(context).inflate(R.layout.item_hobby_select_checkbox,null);
+                            checkBox.setText(item);
+                            checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+                                @Override
+                                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                                    if (isChecked) hobbySelect += checkBox.getText().toString()+ ",";
+                                }
+                            });
+                            gridLayout.addView(checkBox);
+                        }
+
+                        hobbyLayout.addView(linearLayout);
+
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        });
+    }
+}

+ 2 - 1
app/src/com/sheishuo/app/core_module/mine/view/ui/activity/MineUploadPhotoActivity.java

@@ -6,6 +6,7 @@ import android.content.Intent;
 import android.os.Bundle;
 import android.view.LayoutInflater;
 import android.view.View;
+import android.widget.FrameLayout;
 import android.widget.GridLayout;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
@@ -232,7 +233,7 @@ public class MineUploadPhotoActivity extends SheishuoUI {
      */
     private void createAddPhotoBtn(){
         int widthAndHeight = ImgUtil.getScreenWidth(context) / 3;
-        View addPhotoBtn = LayoutInflater.from(context).inflate(R.layout.item_add_photos_layout,gridLayout);
+        View addPhotoBtn = LayoutInflater.from(context).inflate(R.layout.item_add_photos_layout,gridLayout,false);
 
         GridLayout.LayoutParams params = (GridLayout.LayoutParams) addPhotoBtn.getLayoutParams();
         params.height = widthAndHeight;

+ 93 - 0
app/src/com/sheishuo/app/core_module/mine/view/ui/activity/NotificationSettingActivity.java

@@ -0,0 +1,93 @@
+package com.sheishuo.app.core_module.mine.view.ui.activity;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.CompoundButton;
+import android.widget.Switch;
+
+import com.netease.nimlib.sdk.NIMClient;
+import com.netease.nimlib.sdk.StatusBarNotificationConfig;
+import com.netease.nimlib.sdk.settings.SettingsService;
+import com.sheishuo.app.R;
+import com.sheishuo.app.common.util.data.SPHelper;
+import com.sheishuo.app.common.views.BaseToolbar;
+import com.sheishuo.app.impl.SheishuoUI;
+
+/**
+ * Created by KN on 2017/8/28.
+ */
+
+public class NotificationSettingActivity extends SheishuoUI {
+
+    private String TAG = this.getClass().getSimpleName();
+    private Context context = this;
+
+
+
+
+    private BaseToolbar toolbar;
+    private Switch soundSwitch,vibrationSwitch;
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.mine_notification_setting_activity);
+        findViews();
+        init();
+
+
+    }
+
+
+    void findViews(){
+        toolbar = findView(R.id.toolbar);
+        soundSwitch = findView(R.id.mine_notification_setting_sound_switch);
+        vibrationSwitch = findView(R.id.mine_notification_setting_vibration_switch);
+    }
+
+
+    void init(){
+
+        toolbar.getLeftTV().setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                finish();
+            }
+        });
+
+        boolean needSound = (boolean) SPHelper.getParam(context,"needSound",true);
+        boolean needVibration = (boolean) SPHelper.getParam(context,"needVibration",true);
+
+        soundSwitch.setChecked(needSound);
+        vibrationSwitch.setChecked(needVibration);
+
+        soundSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                StatusBarNotificationConfig config = new StatusBarNotificationConfig();
+
+                config.ring = isChecked;
+                config.vibrate = (boolean) SPHelper.getParam(context,"needVibration",true);
+                SPHelper.setParam(context,"needSound",config.ring);
+
+                NIMClient.updateStatusBarNotificationConfig(config);
+            }
+        });
+
+
+        vibrationSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                StatusBarNotificationConfig config = new StatusBarNotificationConfig();
+
+
+                config.vibrate = isChecked;
+                config.ring = (boolean) SPHelper.getParam(context,"needSound",true);
+
+                SPHelper.setParam(context,"needVibration",config.vibrate);
+
+                NIMClient.updateStatusBarNotificationConfig(config);
+            }
+        });
+    }
+}

+ 191 - 11
app/src/com/sheishuo/app/core_module/mine/view/ui/activity/PersonalSettingsActivity.java

@@ -5,8 +5,10 @@ import android.content.Intent;
 import android.os.Bundle;
 import android.util.Log;
 import android.view.View;
+import android.widget.CompoundButton;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
+import android.widget.Switch;
 import android.widget.TextView;
 
 import com.bumptech.glide.Glide;
@@ -14,20 +16,44 @@ import com.netease.nim.uikit.common.ui.imageview.HeadImageView;
 import com.netease.nim.uikit.common.ui.widget.SwitchButton;
 import com.netease.nimlib.sdk.NIMClient;
 import com.netease.nimlib.sdk.uinfo.UserService;
+import com.netease.nimlib.sdk.uinfo.constant.UserInfoFieldEnum;
 import com.netease.nimlib.sdk.uinfo.model.NimUserInfo;
 import com.sheishuo.app.R;
 import com.sheishuo.app.cache.AccountCache;
 import com.sheishuo.app.cache.MineSocialCache;
+import com.sheishuo.app.cache.SocialInfoCache;
 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.location.LocationSelectActivity;
+import com.sheishuo.app.core_module.sheishuo.view.ui.SettingTextEditActivity;
 import com.sheishuo.app.impl.SheishuoUI;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.sheishuo.app.core_module.location.LocationSelectActivity.LOCATION_AREA;
+import static com.sheishuo.app.core_module.location.LocationSelectActivity.LOCATION_CITY;
+import static com.sheishuo.app.core_module.location.LocationSelectActivity.LOCATION_PROVINCE;
+import static com.sheishuo.app.core_module.location.LocationSelectActivity.LOCATION_SELECTED_RESULT_CODE;
+
 /**
  * Created by KN on 2017/8/10.
  */
 
 public class PersonalSettingsActivity extends SheishuoUI {
 
+    //Const
+    public static final int REQUEST_NICKNAME = 5400;
+    public static final int REQUEST_AGE = 5401;
+    public static final int REQUEST_REALNAME = 5402;
+    public static final int REQUEST_IDNUM = 5403;
+
+
+
+
 
     private String TAG = this.getClass().getSimpleName();
     private Context context = this;
@@ -54,8 +80,13 @@ public class PersonalSettingsActivity extends SheishuoUI {
 
     private HeadImageView avatarImg;
 
-    private SwitchButton ageIsPublicSwitch;
+    private Switch ageIsPublicSwitch;
+
 
+    private SocialInfoBean bean;
+
+    private INet net = new NetImpl();
+    private ResponseCallback callback;
 
 
     public static void start(Context context){
@@ -108,7 +139,7 @@ public class PersonalSettingsActivity extends SheishuoUI {
         ageIsPublicSwitch = findView(R.id.personal_settings_age_is_public_switch);
     }
 
-    void init(){
+    void init() {
 
         toolbar.getLeftTV().setOnClickListener(new View.OnClickListener() {
             @Override
@@ -117,7 +148,27 @@ public class PersonalSettingsActivity extends SheishuoUI {
             }
         });
 
-        SocialInfoBean me = MineSocialCache.getInfo();
+        //初始化回调
+        callback = new ResponseCallback() {
+            @Override
+            public void onSuccess(Object object) {
+
+            }
+
+            @Override
+            public void onFailed() {
+                showToast(context,"更新设置失败,请重试");
+            }
+        };
+
+        //初始化设置
+        initSettings();
+
+    }
+
+
+    private void initSettings(){
+        bean = SocialInfoCache.get(AccountCache.getAccount().getId());
         NimUserInfo userInfo = NIMClient.getService(UserService.class)
                 .getUserInfo(AccountCache.getAccount().getId());
 
@@ -131,23 +182,152 @@ public class PersonalSettingsActivity extends SheishuoUI {
 
         //暂无性别
 
-        locationTV.setText(me.getCity() + " " + me.getDistrict());
+        locationTV.setText(bean.getCity() + " " + bean.getDistrict());
 
-        if (me.getShow_age().equals("1")){
-            ageIsPublicSwitch.setCheck(true);
+        if (bean.getShow_age().equals("1")){
+            ageIsPublicSwitch.setChecked(true);
         }
 
-        if (!me.getAge().isEmpty()) ageTV.setText(me.getAge());
+        if (!bean.getAge().isEmpty()) ageTV.setText(bean.getAge());
 
-        if (!me.getHobby().isEmpty()) hobbyTV.setText(me.getHobby().substring(0,6));
+        if (!bean.getHobby().isEmpty()) hobbyTV.setText(bean.getHobby().substring(0,6));
 
-        if (!me.getReal_name().isEmpty()) realNameTV.setText(me.getReal_name());
+        if (!bean.getReal_name().isEmpty()) realNameTV.setText(bean.getReal_name());
 
-        if (!me.getId_number().isEmpty()) idNumTV.setText(me.getId_number());
-    }
+        if (!bean.getId_number().isEmpty()) idNumTV.setText(bean.getId_number());
+
+
+        //公开年龄Switch监听
+        ageIsPublicSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                if (isChecked){
+                    bean.setShow_age("1");
+                }else {
+                    bean.setShow_age("0");
+                }
+
+                net.updateSocialInfo(bean, callback);
+
+            }
+        });
+
+
+
+        //昵称修改
+        nicknameLayout.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                Intent intent = new Intent(context, SettingTextEditActivity.class);
+                intent.putExtra(SettingTextEditActivity.SETTING_CONTENT_TITLE,"修改昵称");
+                intent.putExtra(SettingTextEditActivity.SETTING_CONTENT,nicknameTV.getText().toString());
+                startActivityForResult(intent,REQUEST_NICKNAME);
+
+            }
+        });
+
+
+        //修改年龄
+        ageLayout.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                Intent intent = new Intent(context, SettingTextEditActivity.class);
+                intent.putExtra(SettingTextEditActivity.SETTING_CONTENT_TITLE,"修改年龄");
+                intent.putExtra(SettingTextEditActivity.SETTING_CONTENT,ageTV.getText().toString());
+                startActivityForResult(intent,REQUEST_AGE);
+
+            }
+        });
+
+        //修改真实姓名
+        realNameLayout.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                Intent intent = new Intent(context, SettingTextEditActivity.class);
+                intent.putExtra(SettingTextEditActivity.SETTING_CONTENT_TITLE,"修改真实姓名");
+                intent.putExtra(SettingTextEditActivity.SETTING_CONTENT,realNameTV.getText().toString());
+                startActivityForResult(intent,REQUEST_REALNAME);
+
+            }
+        });
+
+
+        //修改身份证号码
+        idNumLayout.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                Intent intent = new Intent(context, SettingTextEditActivity.class);
+                intent.putExtra(SettingTextEditActivity.SETTING_CONTENT_TITLE,"修改身份证号码");
+                intent.putExtra(SettingTextEditActivity.SETTING_CONTENT,idNumTV.getText().toString());
+                startActivityForResult(intent,REQUEST_IDNUM);
 
+            }
+        });
 
+        //地区选择
+        locationLayout.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                startActivityForResult(new Intent(context,LocationSelectActivity.class),0);
+            }
+        });
 
+        //兴趣选择
+        hobbyLayout.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
 
+                startActivityForResult(new Intent(context,HobbySelectActivity.class),0);
+            }
+        });
+
+    }
 
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        if (SettingTextEditActivity.SETTING_CONTENT_RESULT_CODE == resultCode){
+            String resultStr = data.getStringExtra(SettingTextEditActivity.SETTING_CONTENT_RESULT);
+            switch (requestCode){
+               case REQUEST_NICKNAME:
+                   nicknameTV.setText(resultStr);
+                   Map<UserInfoFieldEnum,Object> fieldMap = new HashMap<>();
+                   fieldMap.put(UserInfoFieldEnum.Name,resultStr);
+                   NIMClient.getService(UserService.class).updateUserInfo(fieldMap);
+                   bean.setNick(resultStr);
+                   net.updateSocialInfo(bean,callback);
+                   break;
+               case REQUEST_AGE:
+                   ageTV.setText(resultStr);
+                   bean.setAge(resultStr);
+                   net.updateSocialInfo(bean,callback);
+                   break;
+               case REQUEST_REALNAME:
+                   realNameTV.setText(resultStr);
+                   bean.setReal_name(resultStr);
+                   net.updateSocialInfo(bean,callback);
+                   break;
+               case REQUEST_IDNUM:
+                   idNumTV.setText(resultStr);
+                   bean.setId_number(resultStr);
+                   net.updateSocialInfo(bean,callback);
+                   break;
+           }
+        }else if (resultCode == LOCATION_SELECTED_RESULT_CODE){
+
+            //更新地理位置
+            bean.setProvince(data.getStringExtra(LOCATION_PROVINCE));
+            bean.setCity(data.getStringExtra(LOCATION_CITY));
+            bean.setDistrict(data.getStringExtra(LOCATION_AREA));
+
+            locationTV.setText(data.getStringExtra(LOCATION_CITY) +" "+ data.getStringExtra(LOCATION_AREA));
+
+            net.updateLocation(bean.getProvince(),bean.getCity(),bean.getDistrict(),callback);
+
+        }else if (HobbySelectActivity.HOBBY_RESULT_CODE == resultCode){
+            String hobby = data.getStringExtra(HobbySelectActivity.RESULT_HOBBY);
+            hobbyTV.setText(hobby);
+        }
+    }
 }

+ 182 - 0
app/src/com/sheishuo/app/core_module/mine/view/ui/activity/PrivacyActivity.java

@@ -3,10 +3,17 @@ package com.sheishuo.app.core_module.mine.view.ui.activity;
 import android.content.Context;
 import android.os.Bundle;
 import android.view.View;
+import android.widget.CompoundButton;
 import android.widget.LinearLayout;
 import android.widget.Switch;
 
 import com.sheishuo.app.R;
+import com.sheishuo.app.cache.AccountCache;
+import com.sheishuo.app.cache.SocialInfoCache;
+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.contact.activity.BlackListActivity;
 import com.sheishuo.app.impl.SheishuoUI;
 
@@ -29,6 +36,8 @@ public class PrivacyActivity extends SheishuoUI {
 
     private LinearLayout blackListLayout;
 
+
+    private INet net = new NetImpl();
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -51,6 +60,11 @@ public class PrivacyActivity extends SheishuoUI {
 
     void init(){
 
+        SocialInfoBean bean = SocialInfoCache.get(AccountCache.getAccount().getId());
+        //加载各个switch状态
+        initSwitches(bean);
+
+
         //初始化黑名单
         blackListLayout.setOnClickListener(new View.OnClickListener() {
             @Override
@@ -59,4 +73,172 @@ public class PrivacyActivity extends SheishuoUI {
             }
         });
     }
+
+
+    /**
+     * 加载各个Switch状态
+     * @param bean
+     */
+    private void initSwitches(final SocialInfoBean bean){
+        if (bean.getAdd_verify().equals("0")) addFriendSwitch.setChecked(true);
+        if (bean.getFind_mobile().equals("0")) findByMobileSwitch.setChecked(true);
+        if (bean.getFind_id().equals("0")) findBySheishuoSwitch.setChecked(true);
+        if (bean.getFind_nick().equals("0")) findByUsernameSwitch.setChecked(true);
+        if (bean.getSee_social().equals("0")) publicToEveryoneSwitch.setChecked(true);
+        if (bean.getEffect().equals("0")) effectsSwitch.setChecked(true);
+
+        //添加好友验证
+        addFriendSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                if (isChecked){
+                    bean.setAdd_verify("0");
+                }else {
+                    bean.setAdd_verify("1");
+                }
+
+                net.updateSocialInfo(bean, new ResponseCallback() {
+                    @Override
+                    public void onSuccess(Object object) {
+                    }
+
+                    @Override
+                    public void onFailed() {
+                                showToast(context,"更新设置失败,请重试");
+
+
+                    }
+                });
+            }
+        });
+
+        //通过手机号找到我
+        findByMobileSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                if (isChecked){
+                    bean.setFind_mobile("0");
+                }else {
+                    bean.setFind_mobile("1");
+                }
+
+                net.updateSocialInfo(bean, new ResponseCallback() {
+                    @Override
+                    public void onSuccess(Object object) {
+                    }
+
+                    @Override
+                    public void onFailed() {
+                        showToast(context,"更新设置失败,请重试");
+
+                    }
+                });
+            }
+        });
+
+
+        //通过谁说号找到我
+        findBySheishuoSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                if (isChecked){
+                    bean.setFind_id("0");
+                }else {
+                    bean.setFind_id("1");
+                }
+
+                net.updateSocialInfo(bean, new ResponseCallback() {
+                    @Override
+                    public void onSuccess(Object object) {
+                    }
+
+                    @Override
+                    public void onFailed() {
+                        showToast(context,"更新设置失败,请重试");
+
+
+                    }
+                });
+            }
+        });
+
+
+        //通过昵称找到我
+        findByUsernameSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                if (isChecked){
+                    bean.setFind_nick("0");
+                }else {
+                    bean.setFind_nick("1");
+                }
+
+                net.updateSocialInfo(bean, new ResponseCallback() {
+                    @Override
+                    public void onSuccess(Object object) {
+                    }
+
+                    @Override
+                    public void onFailed() {
+                        showToast(context,"更新设置失败,请重试");
+
+
+                    }
+                });
+            }
+        });
+
+
+        //允许陌生人查看动态
+        publicToEveryoneSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                if (isChecked){
+                    bean.setSee_social("0");
+                }else {
+                    bean.setSee_social("1");
+                }
+
+                net.updateSocialInfo(bean, new ResponseCallback() {
+                    @Override
+                    public void onSuccess(Object object) {
+                    }
+
+                    @Override
+                    public void onFailed() {
+                        showToast(context,"更新设置失败,请重试");
+
+
+                    }
+                });
+            }
+        });
+
+
+        //特效开关
+        effectsSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                if (isChecked){
+                    bean.setEffect("0");
+                }else {
+                    bean.setEffect("1");
+                }
+
+                net.updateSocialInfo(bean, new ResponseCallback() {
+                    @Override
+                    public void onSuccess(Object object) {
+                    }
+
+                    @Override
+                    public void onFailed() {
+                        showToast(context,"更新设置失败,请重试");
+
+
+                    }
+                });
+            }
+        });
+
+    }
 }

+ 20 - 0
app/src/com/sheishuo/app/core_module/mine/view/ui/activity/SettingsActivity.java

@@ -94,6 +94,14 @@ public class SettingsActivity extends SheishuoUI {
         });
 
 
+        //初始化消息通知
+        notifyLayout.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                startActivity(new Intent(context,NotificationSettingActivity.class));
+            }
+        });
+
         //初始化隐私
         privacyLayout.setOnClickListener(new View.OnClickListener() {
             @Override
@@ -101,5 +109,17 @@ public class SettingsActivity extends SheishuoUI {
                 startActivity(new Intent(context,PrivacyActivity.class));
             }
         });
+
+
+        //初始化关于
+        aboutLayout.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                startActivity(new Intent(context,AboutActivity.class));
+            }
+        });
+
     }
+
+
 }

+ 6 - 0
app/src/com/sheishuo/app/core_module/sheishuo/view/ui/SettingTextEditActivity.java

@@ -2,6 +2,7 @@ package com.sheishuo.app.core_module.sheishuo.view.ui;
 
 import android.content.Intent;
 import android.os.Bundle;
+import android.text.InputType;
 import android.view.View;
 import android.widget.EditText;
 
@@ -48,6 +49,11 @@ public class SettingTextEditActivity extends SheishuoUI {
         toolbar.setTitle(title);
         editText.setText(originStr);
 
+        //临时特殊处理一下仅能输入数字
+        if (title.contains("年龄") || title.contains("号")){
+            editText.setInputType(InputType.TYPE_CLASS_NUMBER);
+        }
+
         toolbar.setRightText("确定");
 
         toolbar.getRightTV().setOnClickListener(new View.OnClickListener() {

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

@@ -256,7 +256,7 @@ public class MainActivity extends SheishuoUI {
         if(requestCode == MineFragment.AVATAR_SELECTED || requestCode == MineFragment.BANNER_SELECTED){
             //我的---头像和背景图更改
             mainFragment.onActivityResult(requestCode,resultCode,data);
-        }else if(resultCode == LocationSelectActivity.LOCATION_SELECTED){
+        }else if(resultCode == LocationSelectActivity.LOCATION_SELECTED_RESULT_CODE){
             //地区选择
             mainFragment.onActivityResult(requestCode,resultCode,data);
         }else if(resultCode == TradeChangePriorityActivity.TRADE_CHANGE_PRIORITY){

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

@@ -326,7 +326,7 @@ public class AreaGroupsFragment extends MainTabFragment {
     @Override
     public void onActivityResult(int requestCode, int resultCode, Intent data) {
         super.onActivityResult(requestCode, resultCode, data);
-        if (LocationSelectActivity.LOCATION_SELECTED == resultCode) {
+        if (LocationSelectActivity.LOCATION_SELECTED_RESULT_CODE == resultCode) {
             String province = data.getExtras().getString(LocationSelectActivity.LOCATION_PROVINCE);
             String city = data.getExtras().getString(LocationSelectActivity.LOCATION_CITY);
             String area = data.getExtras().getString(LocationSelectActivity.LOCATION_AREA);

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

@@ -419,7 +419,7 @@ public class HomeFragment extends TFragment implements OnPageChangeListener, Rem
                 break;
 
             //位置选择
-            case LocationSelectActivity.LOCATION_SELECTED:
+            case LocationSelectActivity.LOCATION_SELECTED_RESULT_CODE:
                 for (Fragment fragment : getFragmentManager().getFragments()) {
                     if (fragment instanceof AreaGroupsFragment)
                         fragment.onActivityResult(requestCode, resultCode, data);

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

@@ -176,7 +176,7 @@ public class TradeListFragment extends MainTabFragment {
 
     private void initToolbar(){
         toolbar.init();
-        toolbar.setTitle("                       快讯");
+        toolbar.setTitle("                    快讯");
 
         toolbar.getIndexIco().setVisibility(View.VISIBLE);
         toolbar.setLeftText(AccountCache.getAccount().getCity() + AccountCache.getAccount().getDistrict());