Explorar el Código

Merge branch 'draft' of https://gitlab.com/Arisono/SkWeiChat-Baidu into draft

Bitliker hace 8 años
padre
commit
d5094df4bb
Se han modificado 28 ficheros con 902 adiciones y 112 borrados
  1. 0 1
      WeiChat/build.gradle
  2. 1 1
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/MainActivity.java
  3. 23 0
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/message/MessageFragment.java
  4. 107 4
      WeiChat/src/main/res/layout/new_message_header.xml
  5. 2 2
      app_core/common/build.gradle
  6. BIN
      app_core/common/libs/hellocharts-library-1.5.8.jar
  7. 23 2
      app_core/common/src/main/java/com/core/utils/CommonUtil.java
  8. 6 2
      app_core/common/src/main/res/layout/activity_newstep.xml
  9. 107 4
      app_core/common/src/main/res/layout/new_message_header.xml
  10. 2 2
      app_core/common/src/main/res/raw/versionconfiguration.properties
  11. 6 1
      app_modular/appme/src/main/java/com/uas/appme/pedometer/adapter/UUAttentionAdapter.java
  12. 40 0
      app_modular/appme/src/main/java/com/uas/appme/pedometer/bean/ComPolylineBean.java
  13. 1 1
      app_modular/appme/src/main/java/com/uas/appme/pedometer/constant/Constant.java
  14. 23 5
      app_modular/appme/src/main/java/com/uas/appme/pedometer/db/StepDataDao.java
  15. 20 27
      app_modular/appme/src/main/java/com/uas/appme/pedometer/service/StepService.java
  16. 119 0
      app_modular/appme/src/main/java/com/uas/appme/pedometer/utils/PolylineUtils.java
  17. 212 18
      app_modular/appme/src/main/java/com/uas/appme/pedometer/utils/StepUtils.java
  18. 12 9
      app_modular/appme/src/main/java/com/uas/appme/pedometer/view/NewStepActivity.java
  19. 53 5
      app_modular/appme/src/main/java/com/uas/appme/pedometer/view/PersonalPageActivity.java
  20. 73 7
      app_modular/appme/src/main/java/com/uas/appme/pedometer/view/UURanking.java
  21. BIN
      app_modular/appme/src/main/res/drawable-hdpi/step_more.png
  22. BIN
      app_modular/appme/src/main/res/drawable-xhdpi/step_more.png
  23. BIN
      app_modular/appme/src/main/res/drawable-xxhdpi/step_more.png
  24. 24 0
      app_modular/appme/src/main/res/drawable/bg_green_btn.xml
  25. 4 2
      app_modular/appme/src/main/res/layout/item_uuattention.xml
  26. 12 14
      app_modular/appme/src/main/res/layout/item_uuranking.xml
  27. 23 5
      app_modular/appme/src/main/res/layout/personal_page_activity.xml
  28. 9 0
      app_modular/appme/src/main/res/menu/menu_step.xml

+ 0 - 1
WeiChat/build.gradle

@@ -120,7 +120,6 @@ dependencies {
     compile project(':appme')
     compile project(':appworks')
     compile project(":appbooking")
-  
     compile project(':android-pdf-viewer')
 }
 

+ 1 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/MainActivity.java

@@ -602,7 +602,7 @@ public class MainActivity extends BaseActivity implements ImStatusListener, NetW
         hiQuickSearch();
 
         //将本地的UU运动步数更新至服务器
-        StepUtils.doSaveLocalStepsToHttps();
+        StepUtils.doSaveLocalStepsToJudgeHttps();
     }
 
     private void hiQuickSearch() {

+ 23 - 0
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/message/MessageFragment.java

@@ -20,6 +20,7 @@ import com.common.LogUtil;
 import com.common.data.DateFormatUtil;
 import com.common.data.ListUtils;
 import com.common.data.StringUtil;
+import com.common.preferences.PreferenceUtils;
 import com.common.system.DisplayUtil;
 import com.core.api.wxapi.ApiPlatform;
 import com.core.api.wxapi.ApiUtils;
@@ -42,6 +43,8 @@ import com.modular.appmessages.activity.Subscription2Activity;
 import com.modular.appmessages.adapter.MessageAdapter;
 import com.modular.appmessages.presenter.MessagePresenter;
 import com.modular.appmessages.presenter.imp.IMessageView;
+import com.uas.appme.pedometer.view.NewStepActivity;
+import com.uas.appme.settings.Constant.Constant;
 import com.xzjmyk.pm.activity.R;
 import com.xzjmyk.pm.activity.ui.platform.task.TaskActivity;
 import com.xzjmyk.pm.activity.ui.platform.task.TaskB2BActivity;
@@ -93,6 +96,7 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
     private TextView book_time_tv;
     private TextView tv_book_num;
     private MessagePresenter.UnReaderListener unReaderListener;
+    private RelativeLayout uustep_rl;
 
 
     @Override
@@ -133,6 +137,11 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
     public void onResume() {
         super.onResume();
         presenter.loadData();
+        if (PreferenceUtils.getInt(MyApplication.getInstance(), Constant.UU_STEP) == 1
+              && !CommonUtil.isReleaseVersion()  )
+            uustep_rl.setVisibility(View.VISIBLE);
+        else
+            uustep_rl.setVisibility(View.GONE);
     }
 
     private void initEvent() {
@@ -201,6 +210,8 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
         book_time_tv = (TextView) view.findViewById(R.id.book_time_tv);
         dingyue_num = (TextView) view.findViewById(R.id.tv_dingYue_num);//订阅红点
         tv_dingyue_desc = (TextView) view.findViewById(R.id.tv_dingyue_desc);//订阅红点
+
+        uustep_rl = (RelativeLayout) view.findViewById(R.id.uustep_rl);
         if (CommonUtil.getSharedPreferencesBoolean(MyApplication.getInstance(), Constants.new_dingyue)) {
             dingyue_num.setVisibility(View.GONE);
             tv_dingyue_desc.setVisibility(View.GONE);
@@ -212,6 +223,7 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
         view.findViewById(R.id.waitting_work_rl).setOnClickListener(this);//待办工作
         view.findViewById(R.id.subscribe_rl).setOnClickListener(this);//我的订阅
         view.findViewById(R.id.booking_rl).setOnClickListener(this);//我的订阅
+        view.findViewById(R.id.uustep_rl).setOnClickListener(this);//UU运动
         if (platform) {
             subscribe_rl.setVisibility(View.GONE);
         } else {
@@ -223,6 +235,12 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
             view.findViewById(R.id.waitting_work_rl).setVisibility(View.GONE);//待办工作
             view.findViewById(R.id.subscribe_rl).setVisibility(View.GONE);//我的订阅
         }
+
+        if (PreferenceUtils.getInt(MyApplication.getInstance(), Constant.UU_STEP) == 1
+                && !CommonUtil.isReleaseVersion()  )
+            uustep_rl.setVisibility(View.VISIBLE);
+        else
+            uustep_rl.setVisibility(View.GONE);
         return view;
     }
 
@@ -314,6 +332,11 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
 ////                intent.putExtra(NoticeMenuActivity.NES, NES_count);
 //                startActivityForResult(intent, REQUESTCODE);
 //                break;
+            case R.id.uustep_rl:
+//                startActivity(new Intent(mContext, UURanking.class));
+
+                startActivity(new Intent(mContext, NewStepActivity.class));
+                break;
         }
 
     }

+ 107 - 4
WeiChat/src/main/res/layout/new_message_header.xml

@@ -306,7 +306,7 @@
             android:layout_centerVertical="true">
 
             <ImageView
-                
+
                 android:layout_width="@dimen/item_img_height"
                 android:layout_height="@dimen/item_img_width"
                 android:layout_gravity="center_vertical"
@@ -325,7 +325,7 @@
                 android:visibility="gone"
                 android:textColor="@android:color/white"
                 android:textSize="10.0dp"
-                 />
+                />
         </FrameLayout>
 
         <RelativeLayout
@@ -353,7 +353,7 @@
                 android:layout_below="@+id/book_time_tv"
                 android:layout_toLeftOf="@+id/tv_book_num"
                 android:layout_toStartOf="@+id/tv_book_num"
-               
+
                 android:text="" />
 
             <TextView
@@ -365,7 +365,7 @@
                 android:background="@drawable/hongdian"
                 android:gravity="center"
                 android:text=""
-          
+
                 android:textColor="@android:color/white"
                 android:textSize="10.0dp" />
 
@@ -392,6 +392,109 @@
         </RelativeLayout>
 
     </RelativeLayout>
+
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/line"
+        android:layout_marginLeft="10dp"
+        android:layout_marginRight="10dp"
+        android:background="@color/transparent" />
+
+    <RelativeLayout
+        android:id="@+id/uustep_rl"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/item_height"
+        android:background="@drawable/selector_me_menu_item_bg"
+        android:descendantFocusability="blocksDescendants"
+        android:minHeight="@dimen/item_height"
+        android:paddingLeft="15dp"
+        android:paddingRight="15dp"
+        android:visibility="gone">
+
+        <FrameLayout
+            android:id="@+id/head_uustep"
+            android:layout_width="57dp"
+            android:layout_height="64dp"
+            android:layout_centerVertical="true">
+
+            <ImageView
+
+                android:layout_width="@dimen/item_img_height"
+                android:layout_height="@dimen/item_img_width"
+                android:layout_gravity="center_vertical"
+                android:background="@color/transparent"
+                android:contentDescription="@string/app_name"
+                android:padding="1dp"
+                android:src="@drawable/uu_step" />
+
+            <TextView
+                android:id="@+id/uustep_num_tv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="top|right"
+                android:background="@drawable/tab_unread_bg"
+                android:gravity="center"
+                android:visibility="gone"
+                android:textColor="@android:color/white"
+                android:textSize="10.0dp"
+                />
+        </FrameLayout>
+
+        <RelativeLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_centerVertical="true"
+            android:layout_marginLeft="3dp"
+            android:layout_toRightOf="@id/head_uustep"
+            android:gravity="center_vertical">
+
+            <TextView
+                android:id="@+id/uustep_name_tv"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_toLeftOf="@+id/time_tv"
+                android:ellipsize="end"
+                android:text="@string/set_sport"
+                android:textColor="@color/text_main"
+                android:textSize="16sp" />
+
+            <TextView
+                android:id="@+id/tv_uustep_num"
+                android:layout_width="10dp"
+                android:layout_height="10dp"
+                android:layout_alignParentRight="true"
+                android:layout_gravity="top|right"
+                android:background="@drawable/hongdian"
+                android:gravity="center"
+                android:text=""
+
+                android:textColor="@android:color/white"
+                android:textSize="10.0dp" />
+
+            <TextView
+                android:id="@+id/uustep_time_tv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentRight="true"
+                android:ellipsize="end"
+                android:textColor="@color/text_hine"
+                android:textSize="14sp"
+                android:visibility="gone" />
+
+            <TextView
+                android:id="@+id/uustep_content_tv"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/uustep_name_tv"
+                android:layout_marginTop="8dp"
+                android:ellipsize="end"
+                android:lines="1"
+                android:textColor="@color/text_hine"
+                android:textSize="14sp" />
+        </RelativeLayout>
+
+    </RelativeLayout>
     <!--<RelativeLayout-->
     <!--android:id="@+id/notice_rl"-->
     <!--android:layout_width="match_parent"-->

+ 2 - 2
app_core/common/build.gradle

@@ -22,7 +22,7 @@ android {
 }
 
 dependencies {
-    compile fileTree(dir: 'libs', include: ['*.jar'])
+    compile fileTree(include: ['*.jar'], dir: 'libs')
     testCompile deps.junit
     compile deps.appcompatV7
     compile deps.fastjson
@@ -50,5 +50,5 @@ dependencies {
     compile project(':lib-zxing')
     compile project(':library-refreshlayout')
     compile project(':recyclerlibrary')
-
+    compile files('libs/hellocharts-library-1.5.8.jar')  //折线库
 }

BIN
app_core/common/libs/hellocharts-library-1.5.8.jar


+ 23 - 2
app_core/common/src/main/java/com/core/utils/CommonUtil.java

@@ -27,9 +27,9 @@ import android.widget.TextView;
 import android.widget.Toast;
 
 import com.afollestad.materialdialogs.MaterialDialog;
-import com.andreabaccega.formedittext.BuildConfig;
 import com.andreabaccega.widget.FormEditText;
 import com.common.data.StringUtil;
+import com.common.file.PropertiesUtil;
 import com.core.api.wxapi.ApiPlatform;
 import com.core.api.wxapi.ApiUtils;
 import com.core.app.MyApplication;
@@ -45,6 +45,8 @@ import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
 import java.text.DecimalFormat;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -76,7 +78,11 @@ public class CommonUtil {
      * function:判断是不是发布版本,true:发布版本
      */
     public static Boolean isReleaseVersion() {
-        return !BuildConfig.DEBUG;
+        //        return !BuildConfig.DEBUG;  //垃圾方法,得根据自己选择的debug还是release模式返回,根本就不好用,
+        //         只要改变 common目录下的versionconfiguration就可以了
+        if (!StringUtil.isEmpty(PropertiesUtil.readData(MyApplication.getInstance(), "release_version", R.raw.versionconfiguration)) &&                "true".equals(PropertiesUtil.readData(MyApplication.getInstance(), "release_version", R.raw.versionconfiguration)))            return true;
+        else
+            return false;
     }
 
 
@@ -790,4 +796,19 @@ public class CommonUtil {
             e.printStackTrace();
         }
     }
+
+    public static String getUTF8String(String str){
+        String xmString = "";
+        String xmlUTF8="";
+        StringBuffer sb = new StringBuffer();
+        sb.append(str);
+        try {
+            xmString = new String(sb.toString().getBytes("UTF-8"));
+            xmlUTF8 = URLEncoder.encode(xmString, "UTF-8");
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        return xmlUTF8;
+    }
 }

+ 6 - 2
app_core/common/src/main/res/layout/activity_newstep.xml

@@ -1,12 +1,15 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/activity_main"
     android:orientation="vertical"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
    >
-
+<LinearLayout
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
     <LinearLayout
         android:orientation="horizontal"
         android:id="@+id/movement_records_calender_ll"
@@ -213,3 +216,4 @@
         android:layout_marginLeft="10dp"
         />
 </LinearLayout>
+</ScrollView>

+ 107 - 4
app_core/common/src/main/res/layout/new_message_header.xml

@@ -306,7 +306,7 @@
             android:layout_centerVertical="true">
 
             <ImageView
-                
+
                 android:layout_width="@dimen/item_img_height"
                 android:layout_height="@dimen/item_img_width"
                 android:layout_gravity="center_vertical"
@@ -325,7 +325,7 @@
                 android:visibility="gone"
                 android:textColor="@android:color/white"
                 android:textSize="10.0dp"
-                 />
+                />
         </FrameLayout>
 
         <RelativeLayout
@@ -353,7 +353,7 @@
                 android:layout_below="@+id/book_time_tv"
                 android:layout_toLeftOf="@+id/tv_book_num"
                 android:layout_toStartOf="@+id/tv_book_num"
-               
+
                 android:text="" />
 
             <TextView
@@ -365,7 +365,7 @@
                 android:background="@drawable/hongdian"
                 android:gravity="center"
                 android:text=""
-          
+
                 android:textColor="@android:color/white"
                 android:textSize="10.0dp" />
 
@@ -392,6 +392,109 @@
         </RelativeLayout>
 
     </RelativeLayout>
+
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/line"
+        android:layout_marginLeft="10dp"
+        android:layout_marginRight="10dp"
+        android:background="@color/transparent" />
+
+    <RelativeLayout
+        android:id="@+id/uustep_rl"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/item_height"
+        android:background="@drawable/selector_me_menu_item_bg"
+        android:descendantFocusability="blocksDescendants"
+        android:minHeight="@dimen/item_height"
+        android:paddingLeft="15dp"
+        android:paddingRight="15dp"
+        android:visibility="gone">
+
+        <FrameLayout
+            android:id="@+id/head_uustep"
+            android:layout_width="57dp"
+            android:layout_height="64dp"
+            android:layout_centerVertical="true">
+
+            <ImageView
+
+                android:layout_width="@dimen/item_img_height"
+                android:layout_height="@dimen/item_img_width"
+                android:layout_gravity="center_vertical"
+                android:background="@color/transparent"
+                android:contentDescription="@string/app_name"
+                android:padding="1dp"
+                android:src="@drawable/uu_step" />
+
+            <TextView
+                android:id="@+id/uustep_num_tv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="top|right"
+                android:background="@drawable/tab_unread_bg"
+                android:gravity="center"
+                android:visibility="gone"
+                android:textColor="@android:color/white"
+                android:textSize="10.0dp"
+                />
+        </FrameLayout>
+
+        <RelativeLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_centerVertical="true"
+            android:layout_marginLeft="3dp"
+            android:layout_toRightOf="@id/head_uustep"
+            android:gravity="center_vertical">
+
+            <TextView
+                android:id="@+id/uustep_name_tv"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_toLeftOf="@+id/time_tv"
+                android:ellipsize="end"
+                android:text="@string/set_sport"
+                android:textColor="@color/text_main"
+                android:textSize="16sp" />
+
+            <TextView
+                android:id="@+id/tv_uustep_num"
+                android:layout_width="10dp"
+                android:layout_height="10dp"
+                android:layout_alignParentRight="true"
+                android:layout_gravity="top|right"
+                android:background="@drawable/hongdian"
+                android:gravity="center"
+                android:text=""
+
+                android:textColor="@android:color/white"
+                android:textSize="10.0dp" />
+
+            <TextView
+                android:id="@+id/uustep_time_tv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentRight="true"
+                android:ellipsize="end"
+                android:textColor="@color/text_hine"
+                android:textSize="14sp"
+                android:visibility="gone" />
+
+            <TextView
+                android:id="@+id/uustep_content_tv"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/uustep_name_tv"
+                android:layout_marginTop="8dp"
+                android:ellipsize="end"
+                android:lines="1"
+                android:textColor="@color/text_hine"
+                android:textSize="14sp" />
+        </RelativeLayout>
+
+    </RelativeLayout>
     <!--<RelativeLayout-->
     <!--android:id="@+id/notice_rl"-->
     <!--android:layout_width="match_parent"-->

+ 2 - 2
app_core/common/src/main/res/raw/versionconfiguration.properties

@@ -1,3 +1,3 @@
 #发布版本状态改为true,测试版本状态为false
-#release_version=false
-release_version=true
+release_version=false
+#release_version=true

+ 6 - 1
app_modular/appme/src/main/java/com/uas/appme/pedometer/adapter/UUAttentionAdapter.java

@@ -62,9 +62,14 @@ public class UUAttentionAdapter extends BaseAdapter{
             viewHolder = (ViewHolder) convertView.getTag();
         }
 //        if(!MyApplication.getInstance().mLoginUser.getUserId().equals(model.getAttrank().get(position).getAs_userid())){  //关注的人不应该显示自己,但是数据返回了自己,这里要判断一下不显示
-            viewHolder.ranking_tv.setText("第"+model.getAttrank().get(position).getRank()+"名");
             viewHolder.name_tv.setText(model.getAttrank().get(position).getAs_username());
             viewHolder.steps_tv.setText(model.getAttrank().get(position).getAs_uusteps());
+            for (int i = 0; i < model.getToalrank().size(); i++) {
+            if (model.getAttrank().get(position).getAs_userid().equals(model.getToalrank().get(i).getAs_userid())){
+                viewHolder.ranking_tv.setText("第"+model.getToalrank().get(i).getRank()+"名");
+                break;
+            }
+        }
 //            viewHolder.prise_tv.setText("0");
 //        }
 

+ 40 - 0
app_modular/appme/src/main/java/com/uas/appme/pedometer/bean/ComPolylineBean.java

@@ -0,0 +1,40 @@
+package com.uas.appme.pedometer.bean;
+
+/**
+ * Created by FANGlh on 2017/9/25.
+ * function:  通用折线实体类,将X,Y轴数据以列表形式存贮
+ */
+
+public class ComPolylineBean  {
+    private String xValue;
+    private int yValue;
+
+    public ComPolylineBean(String xValue, int yValue) {
+        this.xValue = xValue;
+        this.yValue = yValue;
+    }
+
+    public String getxValue() {
+        return xValue;
+    }
+
+    public void setxValue(String xValue) {
+        this.xValue = xValue;
+    }
+
+    public int getyValue() {
+        return yValue;
+    }
+
+    public void setyValue(int yValue) {
+        this.yValue = yValue;
+    }
+
+    @Override
+    public String toString() {
+        return "ComPolylineBean{" +
+                "xValue='" + xValue + '\'' +
+                ", yValue='" + yValue + '\'' +
+                '}';
+    }
+}

+ 1 - 1
app_modular/appme/src/main/java/com/uas/appme/pedometer/constant/Constant.java

@@ -23,5 +23,5 @@ public class Constant {
     public static final int BASE_COLUMN = 100000000;
     public static String TRACK_STEP = "TRACKSTEP";
     public static String BASE_STEP_URL = "http://113.105.74.140:8092/user/";
-
+//    public static String BASE_STEP_URL = "http://192.168.253.136:8092/";
 }

+ 23 - 5
app_modular/appme/src/main/java/com/uas/appme/pedometer/db/StepDataDao.java

@@ -5,6 +5,7 @@ import android.content.Context;
 import android.database.Cursor;
 import android.database.sqlite.SQLiteDatabase;
 
+import com.common.LogUtil;
 import com.uas.appme.pedometer.bean.StepEntity;
 
 import java.util.ArrayList;
@@ -47,6 +48,8 @@ public class StepDataDao {
     public StepEntity getCurDataByDate(String curDate) {
         stepDb = stepHelper.getReadableDatabase();
         StepEntity stepEntity = null;
+
+
         Cursor cursor = stepDb.query("step", null, null, null, null, null, null);
         while (cursor.moveToNext()) {
             String date = cursor.getString(cursor.getColumnIndexOrThrow("curDate"));
@@ -88,19 +91,34 @@ public class StepDataDao {
 
     /**
      * 更新数据
+     *
      * @param stepEntity
      */
-    public void updateCurData(StepEntity stepEntity) {
-        stepDb = stepHelper.getReadableDatabase();
-
+    public synchronized void updateCurData(StepEntity stepEntity) {
+        LogUtil.prinlnLongMsg("stepDb.update", "updateCurData");
+        stepDb = stepHelper.getWritableDatabase();
         ContentValues values = new ContentValues();
-        values.put("curDate",stepEntity.getCurDate());
+        values.put("curDate", stepEntity.getCurDate());
         values.put("totalSteps", stepEntity.getSteps());
-        stepDb.update("step", values, "curDate=?", new String[]{stepEntity.getCurDate()});
+        LogUtil.prinlnLongMsg("stepDb.update", values.get("totalSteps").toString());
+        int i = stepDb.update("step", values, "curDate= ? ", new String[]{stepEntity.getCurDate()});
+        LogUtil.prinlnLongMsg("stepDb.update", String.valueOf(i));
 
         stepDb.close();
     }
 
+    public void updateCurData2(StepEntity stepEntity) {
+        stepDb = stepHelper.getWritableDatabase();
+        ContentValues values = new ContentValues();
+        values.put("curDate", stepEntity.getCurDate());
+        values.put("totalSteps", stepEntity.getSteps());
+        LogUtil.prinlnLongMsg("stepDb.update", values.get("totalSteps").toString());
+        int i = stepDb.update("step", values, "curDate= ? ", new String[]{stepEntity.getCurDate()});
+//        long i = stepDb.insert("step", null, values);
+        LogUtil.prinlnLongMsg("stepDb.update", String.valueOf(i));
+        stepDb.close();
+    }
+
 
     /**
      * 删除指定日期的记录

+ 20 - 27
app_modular/appme/src/main/java/com/uas/appme/pedometer/service/StepService.java

@@ -22,36 +22,22 @@ import android.os.IBinder;
 import android.os.Message;
 import android.os.Messenger;
 import android.os.RemoteException;
-import android.widget.Toast;
 
-import com.alibaba.fastjson.JSON;
 import com.baidu.mapapi.model.LatLng;
 import com.common.LogUtil;
-import com.common.data.DateFormatUtil;
-import com.common.data.ListUtils;
-import com.common.data.StringUtil;
 import com.core.app.MyApplication;
-import com.core.utils.CommonUtil;
-import com.core.utils.TimeUtils;
-import com.me.network.app.http.HttpClient;
-import com.me.network.app.http.Method;
-import com.me.network.app.http.rx.ResultListener;
-import com.me.network.app.http.rx.ResultSubscriber;
 import com.uas.appme.R;
 import com.uas.appme.pedometer.bean.StepEntity;
 import com.uas.appme.pedometer.constant.Constant;
 import com.uas.appme.pedometer.db.StepDataDao;
 import com.uas.appme.pedometer.utils.StepUtils;
 import com.uas.appme.pedometer.utils.TimeUtil;
-import com.uas.appme.pedometer.utils.TrackUtils;
 import com.uas.appme.pedometer.view.StepSplashActivity;
 
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 /**
  * Created by FANGLH
@@ -93,10 +79,11 @@ public class StepService extends Service implements SensorEventListener {
     private NotificationManager notificationManager;
     private Intent nfIntent;
     private int VERSION_CODES = Build.VERSION.SDK_INT;
+
     @Override
     public void onCreate() {
         super.onCreate();
-        latLngsList =  new ArrayList<>();
+        latLngsList = new ArrayList<>();
         initBroadcastReceiver();
         new Thread(new Runnable() {
             public void run() {
@@ -113,6 +100,7 @@ public class StepService extends Service implements SensorEventListener {
     }
 
 
+    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
     @Override
     public int onStartCommand(Intent intent, int flags, int startId) {
         /**
@@ -135,7 +123,7 @@ public class StepService extends Service implements SensorEventListener {
         // 获取构建好的Notification
         if (VERSION_CODES > 15) {
             Notification stepNotification = builder.build();
-            notificationManager.notify(110,stepNotification);
+            notificationManager.notify(110, stepNotification);
             // 参数一:唯一的通知标识;参数二:通知消息。
             startForeground(110, stepNotification);// 开始前台服务
         }
@@ -180,6 +168,8 @@ public class StepService extends Service implements SensorEventListener {
         filter.addAction(Intent.ACTION_SHUTDOWN);
         // 屏幕解锁广播
         filter.addAction(Intent.ACTION_USER_PRESENT);
+        filter.addAction("updateStepEntity");
+        filter.addAction("addStepEntity");
         // 当长按电源键弹出“关机”对话或者锁屏时系统会发出这个广播
         // example:有时候会用到系统对话框,权限可能很高,会覆盖在锁屏界面或者“关机”对话框之上,
         // 所以监听这个广播,当收到时就隐藏自己的对话,如点击pad右下角部分弹出的对话框
@@ -198,20 +188,14 @@ public class StepService extends Service implements SensorEventListener {
                     case Intent.ACTION_SCREEN_OFF:
                         //屏幕熄灭改为10秒一存储
                         saveDuration = 10000;
-                        //将本地的UU运动步数更新至服务器
-                        StepUtils.doSaveLocalStepsToHttps();
                         break;
                     //关机广播,保存好当前数据
                     case Intent.ACTION_SHUTDOWN:
                         saveStepData();
-                        //将本地的UU运动步数更新至服务器
-                        StepUtils.doSaveLocalStepsToHttps();
                         break;
                     // 屏幕解锁广播
                     case Intent.ACTION_USER_PRESENT:
                         saveDuration = 3000;
-                        //将本地的UU运动步数更新至服务器
-                        StepUtils.doSaveLocalStepsToHttps();
                         break;
                     // 当长按电源键弹出“关机”对话或者锁屏时系统会发出这个广播
                     // example:有时候会用到系统对话框,权限可能很高,会覆盖在锁屏界面或者“关机”对话框之上,
@@ -226,6 +210,14 @@ public class StepService extends Service implements SensorEventListener {
                         saveStepData();
                         isNewDay();
                         break;
+                    case "updateStepEntity":
+                    case "addStepEntity":
+                        int remoteSteps = intent.getIntExtra("remoteSteps", -1);
+                        LogUtil.prinlnLongMsg("stepDb.update","updateStepEntity="+remoteSteps);
+                        if (remoteSteps > CURRENT_STEP) {
+                            CURRENT_STEP = remoteSteps;
+                        }
+                        break;
                     default:
                         break;
                 }
@@ -371,7 +363,9 @@ public class StepService extends Service implements SensorEventListener {
     /**
      * 保存当天的数据到数据库中,并去刷新通知栏
      */
+    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
     private void saveStepData() {
+        LogUtil.i("saveStepData");
         //查询数据库中的数据
         StepEntity entity = stepDataDao.getCurDataByDate(CURRENT_DATE);
         //为空则说明还没有该天的数据,有则说明已经开始当天的计步了
@@ -384,6 +378,7 @@ public class StepService extends Service implements SensorEventListener {
             stepDataDao.addNewData(entity);
         } else {
             //有则更新当前的数据
+            LogUtil.i("", String.valueOf(CURRENT_STEP));
             entity.setSteps(String.valueOf(CURRENT_STEP));
 
             stepDataDao.updateCurData(entity);
@@ -395,19 +390,17 @@ public class StepService extends Service implements SensorEventListener {
                 .setSmallIcon(R.drawable.uuu) // 设置状态栏内的小图标
                 .setContentText(MyApplication.getInstance().getString(R.string.comeon_more_sport)); // 设置上下文内容 
 
-        if (VERSION_CODES > 15){
+        if (VERSION_CODES > 15) {
             // 获取构建好的Notification
             Notification stepNotification = builder.build();
             //调用更新
-            notificationManager.notify(110,stepNotification);
+            notificationManager.notify(110, stepNotification);
         }
-
+        StepUtils.doSaveLocalStepsToJudgeHttps();
 //        TrackUtils.doSaveTrackPoint(latLngsList);
     }
 
 
-
-
     @Override
     public void onDestroy() {
         super.onDestroy();

+ 119 - 0
app_modular/appme/src/main/java/com/uas/appme/pedometer/utils/PolylineUtils.java

@@ -0,0 +1,119 @@
+package com.uas.appme.pedometer.utils;
+
+import android.graphics.Color;
+import android.view.View;
+
+import com.uas.appme.pedometer.bean.ComPolylineBean;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import lecho.lib.hellocharts.gesture.ZoomType;
+import lecho.lib.hellocharts.model.Axis;
+import lecho.lib.hellocharts.model.AxisValue;
+import lecho.lib.hellocharts.model.Line;
+import lecho.lib.hellocharts.model.LineChartData;
+import lecho.lib.hellocharts.model.PointValue;
+import lecho.lib.hellocharts.model.ValueShape;
+import lecho.lib.hellocharts.model.Viewport;
+import lecho.lib.hellocharts.view.LineChartView;
+
+/**
+ * Created by FANGlh on 2017/9/25.
+ * function: 折线工具类
+ */
+
+public class PolylineUtils {
+    /**
+     * 初始化LineChart的一些设置
+     * @param lineChart   控件id 的对象
+     * @param cBeanList     包含 X,y轴对象的列表
+     */
+    public static void initLineChart(LineChartView lineChart,List<ComPolylineBean> cBeanList){
+
+         List<PointValue> mPointValues = new ArrayList<>();
+         List<AxisValue> mAxisXValues = new ArrayList<>();
+
+        getAxisXLables(mAxisXValues,cBeanList);//获取x轴的标注
+        getAxisPoints(mPointValues,cBeanList);//获取坐标点
+
+        Line line = new Line(mPointValues).setColor(Color.WHITE);  //折线的颜色
+        List<Line> lines = new ArrayList<>();
+        line.setShape(ValueShape.CIRCLE);//折线图上每个数据点的形状  这里是圆形 (有三种 :ValueShape.SQUARE  ValueShape.CIRCLE  ValueShape.SQUARE)
+        line.setCubic(false);//曲线是否平滑
+        line.setStrokeWidth(1);//线条的粗细,默认是3
+        line.setFilled(false);//是否填充曲线的面积
+        line.setHasLabels(true);//曲线的数据坐标是否加上备注
+//		line.setHasLabelsOnlyForSelected(true);//点击数据坐标提示数据(设置了这个line.setHasLabels(true);就无效)
+        line.setHasLines(true);//是否用直线显示。如果为false 则没有曲线只有点显示
+        line.setHasPoints(true);//是否显示圆点 如果为false 则没有原点只有点显示
+        lines.add(line);
+        LineChartData data = new LineChartData();
+        data.setLines(lines);
+
+        //坐标轴
+        Axis axisX = new Axis(); //X轴
+        axisX.setHasTiltedLabels(true);  //X轴下面坐标轴字体是斜的显示还是直的,true是斜的显示
+	    axisX.setTextColor(Color.WHITE);  //设置字体颜色
+//        axisX.setTextColor(Color.parseColor("#D6D6D9"));//灰色
+
+//	    axisX.setName("日期");  //表格名称
+        axisX.setTextSize(11);//设置字体大小
+        axisX.setMaxLabelChars(7); //最多几个X轴坐标,意思就是你的缩放让X轴上数据的个数7<=x<=mAxisValues.length
+        axisX.setValues(mAxisXValues);  //填充X轴的坐标名称
+        data.setAxisXBottom(axisX); //x 轴在底部
+        axisX.setHasLines(true); //x 轴分割线
+
+
+        Axis axisY = new Axis();  //Y轴
+        axisY.setName(" ");//y轴标注
+        axisY.setTextSize(11);//设置字体大小
+        axisY.setTextColor(Color.WHITE);
+
+        data.setAxisYLeft(axisY);  //Y轴设置在左边
+        //data.setAxisYRight(axisY);  //y轴设置在右边
+        //设置行为属性,支持缩放、滑动以及平移
+        lineChart.setInteractive(true);
+        lineChart.setZoomType(ZoomType.HORIZONTAL);  //缩放类型,水平
+        lineChart.setMaxZoom((float) 3);//缩放比例
+        lineChart.setLineChartData(data);
+        lineChart.setVisibility(View.VISIBLE);
+        /**注:下面的7,10只是代表一个数字去类比而已
+         * 尼玛搞的老子好辛苦!!!参考见(http://forum.xda-developers.com/tools/programming/library-hellocharts-charting-library-t2904456/page2);
+         * 下面几句可以设置X轴数据的显示个数(x轴0-7个数据),当数据点个数小于(29)的时候,缩小到极致hellochart默认的是所有显示。当数据点个数大于(29)的时候,
+         * 若不设置axisX.setMaxLabelChars(int count)这句话,则会自动适配X轴所能显示的尽量合适的数据个数。
+         * 若设置axisX.setMaxLabelChars(int count)这句话,
+         * 33个数据点测试,若 axisX.setMaxLabelChars(10);里面的10大于v.right= 7; 里面的7,则
+         刚开始X轴显示7条数据,然后缩放的时候X轴的个数会保证大于7小于10
+         若小于v.right= 7;中的7,反正我感觉是这两句都好像失效了的样子 - -!
+         * 并且Y轴是根据数据的大小自动设置Y轴上限
+         * 若这儿不设置 v.right= 7; 这句话,则图表刚开始就会尽可能的显示所有数据,交互性太差
+         */
+        Viewport v = new Viewport(lineChart.getMaximumViewport());
+        v.left = 0;
+        v.right= 7;
+        lineChart.setCurrentViewport(v);
+    }
+
+    /**
+     *  X 轴的显示
+     * @param mAxisXValues
+     * @param cBeanList
+     */
+    private static void getAxisXLables(List<AxisValue> mAxisXValues,List<ComPolylineBean> cBeanList){
+        for (int i = 0; i < cBeanList.size(); i++) {
+            mAxisXValues.add(new AxisValue(i).setLabel(cBeanList.get(i).getxValue()));
+        }
+    }
+
+    /**
+     * Y 轴的显示
+     * @param mPointValues
+     * @param cBeanList
+     */
+    private static void getAxisPoints(List<PointValue> mPointValues,List<ComPolylineBean> cBeanList){
+        for (int i = 0; i < cBeanList.size(); i++) {
+            mPointValues.add(new PointValue(i, cBeanList.get(i).getyValue()));
+        }
+    }
+}

+ 212 - 18
app_modular/appme/src/main/java/com/uas/appme/pedometer/utils/StepUtils.java

@@ -1,6 +1,10 @@
 package com.uas.appme.pedometer.utils;
 
+import android.content.Intent;
+
+import com.alibaba.fastjson.JSON;
 import com.common.LogUtil;
+import com.common.config.BaseConfig;
 import com.common.data.DateFormatUtil;
 import com.common.data.JSONUtil;
 import com.common.data.StringUtil;
@@ -11,6 +15,7 @@ import com.me.network.app.http.HttpClient;
 import com.me.network.app.http.Method;
 import com.me.network.app.http.rx.ResultListener;
 import com.me.network.app.http.rx.ResultSubscriber;
+import com.uas.appme.pedometer.bean.PersonalStepBean;
 import com.uas.appme.pedometer.bean.StepEntity;
 import com.uas.appme.pedometer.constant.Constant;
 import com.uas.appme.pedometer.db.StepDataDao;
@@ -25,34 +30,223 @@ import java.util.Map;
 
 public class StepUtils {
 
-    public static void doSaveLocalStepsToHttps() {
-        StepDataDao stepDataDao = new StepDataDao(MyApplication.getInstance());
-        //获取当前时间
-        String CURRENT_DATE = TimeUtil.getCurrentDate();
-        StepEntity entity = stepDataDao.getCurDataByDate(CURRENT_DATE);
-        if (entity == null) return;
+
+    /**
+     * 最终的上传操作
+     *
+     * @param entity
+     */
+    public static void doSaveLocalStepsToHttps(StepEntity entity) {
         String steps = entity.getSteps();
         String date = TimeUtils.s_long_2_str(DateFormatUtil.str2Long(entity.getCurDate(), "yyyy年MM月dd日"));
-
-        LogUtil.prinlnLongMsg("steps=,date=",steps+","+date);
+        String em_name = CommonUtil.getSharedPreferences(MyApplication.getInstance(), "erp_emname");
+        LogUtil.prinlnLongMsg("steps=,date=", steps + "," + date);
         if (StringUtil.isEmpty(steps) || StringUtil.isEmpty(date)) return;
-        Map<String,Object> saveMap = new HashMap<>();
-        saveMap.put("as_userid",MyApplication.getInstance().mLoginUser.getUserId());
-        saveMap.put("as_username", CommonUtil.getSharedPreferences(MyApplication.getInstance(), "erp_emname"));
-        saveMap.put("as_uusteps",steps);
-        saveMap.put("as_date",date);
+        Map<String, Object> saveMap = new HashMap<>();
+        saveMap.put("as_userid", MyApplication.getInstance().mLoginUser.getUserId());
+        saveMap.put("as_username", em_name);
+        saveMap.put("as_uusteps", steps);
+        saveMap.put("as_date", date);
         String map = JSONUtil.map2JSON(saveMap);
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_STEP_URL).build();
+        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_STEP_URL).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("appUUsteps")
-                .add("map",map)
-                .add("token",MyApplication.getInstance().mAccessToken)
+                .add("map", map)
+                .add("token", MyApplication.getInstance().mAccessToken)
                 .method(Method.POST)
-                .build(),new ResultSubscriber<>(new ResultListener<Object>() {
+                .build(), new ResultSubscriber<>(new ResultListener<Object>() {
+            @Override
+            public void onResponse(Object o) {
+                LogUtil.prinlnLongMsg("appUUsteps", o.toString() + "");
+            }
+        }));
+    }
+
+
+    /**
+     * 判断当前请求获取的步数与本地的步数比较,再选择是进行上传操作还是更新本地数据库操作
+     *
+     * @param s
+     */
+    public static void canUnloadToRemote(String s) {
+        PersonalStepBean mPersonalStepBean = new PersonalStepBean();
+        mPersonalStepBean = JSON.parseObject(s.toString(), PersonalStepBean.class);
+        if (mPersonalStepBean == null) return;
+        int remoteSteps = CommonUtil.getNumByString(mPersonalStepBean.getWeekSteps().get(mPersonalStepBean.getWeekSteps().size() - 1).getAs_uusteps());
+        String CURRENT_DATE = TimeUtil.getCurrentDate();
+        StepDataDao stepDataDao = new StepDataDao(MyApplication.getInstance());
+        StepEntity stepEntity = stepDataDao.getCurDataByDate(CURRENT_DATE);
+        try {
+            if (stepEntity == null) {
+//                stepEntity = new StepEntity();
+//                stepEntity.setSteps(remoteSteps + "");
+//                stepEntity.setCurDate(CURRENT_DATE);
+//                stepDataDao.addNewData(stepEntity);
+
+                Intent intent = new Intent("addStepEntity");
+                intent.putExtra("remoteSteps", remoteSteps);
+                BaseConfig.getContext().sendBroadcast(intent);
+            } else if (remoteSteps > CommonUtil.getNumByString(stepEntity.getSteps())) { //  本地步数小于服务端 ,更新本地步数,使其通服务器一样
+                Intent intent = new Intent("updateStepEntity");
+                intent.putExtra("remoteSteps", remoteSteps);
+                BaseConfig.getContext().sendBroadcast(intent);
+                LogUtil.prinlnLongMsg("stepDb.update","sendLocalBroadcast");
+            } else if (remoteSteps < CommonUtil.getNumByString(stepEntity.getSteps())) {
+                doSaveLocalStepsToHttps(stepEntity);
+            }
+        } catch (Exception e) {
+            LogUtil.prinlnLongMsg("stepDb.update", e.getMessage());
+            e.printStackTrace();
+        }
+
+    }
+
+    /**
+     * 判断当前手机硬件是否支持计步功能
+     *
+     * @return
+     */
+
+    public static boolean isCanStep() {
+        return StepCountCheckUtil.isSupportStepCountSensor(MyApplication.getInstance());
+    }
+
+
+    /**
+     * 获取服务器端个人今天目前的所存贮的步数请求
+     *
+     * @return
+     */
+    public static void doSaveLocalStepsToJudgeHttps() {
+        if (!isCanStep() || !CommonUtil.isNetWorkConnected(MyApplication.getInstance()))
+            return;  //不支持计步或者,本地数据与远程数据不符合上传条件则不上传
+        if (MyApplication.getInstance() == null
+                || MyApplication.getInstance().mLoginUser == null
+                || MyApplication.getInstance().mLoginUser.getUserId() == null) return;
+        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_STEP_URL).isDebug(true).build(true);
+        httpClient.Api().send(new HttpClient.Builder()
+                .url("appSteps")
+                .add("userid", MyApplication.getInstance().mLoginUser.getUserId())
+                .add("token", MyApplication.getInstance().mAccessToken)
+                .method(Method.GET)
+                .build(), new ResultSubscriber<>(new ResultListener<Object>() {
             @Override
             public void onResponse(Object o) {
-                LogUtil.prinlnLongMsg("appUUsteps",o.toString()+"");
+                LogUtil.prinlnLongMsg("appSteps", o.toString());
+                canUnloadToRemote(o.toString());
             }
         }));
     }
+
+
+    /**
+     * 分享UU运动的发消息方法
+     * @param activity 上下文
+     * @param loginim_id  自己的imid
+     * @param friendim_id  要分享的好友的imid
+     */
+   /* public  void sendShareStepMsg(final ChatMessage message,Activity activity,String loginim_id, String friendim_id){
+        if (interprect(message)) {
+            return;
+        }
+
+        message.setPacketId(UUID.randomUUID().toString().replaceAll("-", ""));
+        ChatMessageDao.getInstance().saveNewSingleChatMessage(loginim_id, friendim_id, message);
+        if (message.getType() == XmppMessage.TYPE_VOICE || message.getType() == XmppMessage.TYPE_IMAGE
+                || message.getType() == XmppMessage.TYPE_VIDEO || message.getType() == XmppMessage.TYPE_FILE) {
+            if (!message.isUpload()) {
+                Log.d("roamer", "去更新服务器的数据");
+                UploadEngine.uploadImFile(friendim_id, message, mUploadResponse);
+
+            } else {
+                Log.d("roamer", "sendChatMessage....");
+                mService.sendChatMessage(mFriend.getUserId(), message);
+            }
+        } else {
+            Log.d("roamer", "sendChatMessage");
+
+            mService.sendChatMessage(mFriend.getUserId(), message);
+            //进行百度推送
+            sendPushTask(mLoginUserId, mFriend.getUserId(), message.getContent());
+
+        }
+    }
+
+
+    private void sendMessage(final ChatMessage message) {
+        if (interprect(message)) {
+            return;
+        }
+        Log.i("wang", "send message:" + JSON.toJSONString(message));
+        boolean mHasSend = true;
+        Log.d("roamer", "开始发送消息,ChatBottomView的回调 sendmessage");
+        message.setPacketId(UUID.randomUUID().toString().replaceAll("-", ""));
+        ChatMessageDao.getInstance().saveNewSingleChatMessage(mLoginUserId, mFriend.getUserId(), message);
+        if (message.getType() == XmppMessage.TYPE_VOICE || message.getType() == XmppMessage.TYPE_IMAGE
+                || message.getType() == XmppMessage.TYPE_VIDEO || message.getType() == XmppMessage.TYPE_FILE) {
+            if (!message.isUpload()) {
+                Log.d("roamer", "去更新服务器的数据");
+                UploadEngine.uploadImFile(mFriend.getUserId(), message, mUploadResponse);
+
+            } else {
+                Log.d("roamer", "sendChatMessage....");
+                mService.sendChatMessage(mFriend.getUserId(), message);
+            }
+        } else {
+            Log.d("roamer", "sendChatMessage");
+
+            mService.sendChatMessage(mFriend.getUserId(), message);
+            //进行百度推送
+            sendPushTask(mLoginUserId, mFriend.getUserId(), message.getContent());
+
+        }
+    }
+    *//**
+     * 拦截发送的消息
+     *
+     * @param message
+     *//*
+    public boolean interprect(ChatMessage message) {
+        int len = 0;
+        List<Friend> mBlackList  = FriendDao.getInstance().getAllBlacklists(MyApplication.getInstance().mLoginUser.getUserId());
+        if (mBlackList != null) {
+            for (Friend friend : mBlackList) {
+                if (friend.getUserId().equals(mFriend.getUserId())) {
+                    Toast.makeText(mContext, "已经加入黑名单,无法发送消息", Toast.LENGTH_SHORT).show();
+                    len++;
+                }
+            }
+        }
+        Log.d("wang", "....kkkkk");
+        if (len != 0) {
+            // finish();
+            ListenerManager.getInstance().notifyMessageSendStateChange(mLoginUserId, mFriend.getUserId(),
+                    message.get_id(), ChatMessageListener.MESSAGE_SEND_FAILED);
+            return true;
+        }
+        return false;
+    }
+    private UploadEngine.ImFileUploadResponse mUploadResponse = new UploadEngine.ImFileUploadResponse() {
+        @Override
+        public void onSuccess(String toUserId, ChatMessage message) {
+            mService.sendChatMessage(mFriend.getUserId(), message);
+
+        }
+
+        @Override
+        public void onFailure(String toUserId, ChatMessage message) {
+            for (int i = 0; i < mChatMessages.size(); i++) {
+                ChatMessage msg = mChatMessages.get(i);
+                if (message.get_id() == msg.get_id()) {
+                    msg.setMessageState(ChatMessageListener.MESSAGE_SEND_FAILED);
+                    ChatMessageDao.getInstance().updateMessageSendState(mLoginUserId, mFriend.getUserId(),
+                            message.get_id(), ChatMessageListener.MESSAGE_SEND_FAILED);
+                    mChatContentView.notifyDataSetInvalidated(false);
+                    break;
+                }
+            }
+        }
+
+    };*/
+
 }

+ 12 - 9
app_modular/appme/src/main/java/com/uas/appme/pedometer/view/NewStepActivity.java

@@ -21,6 +21,7 @@ import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import com.core.base.BaseActivity;
+import com.core.utils.CommonUtil;
 import com.uas.appme.R;
 import com.uas.appme.pedometer.bean.StepEntity;
 import com.uas.appme.pedometer.calendar.BeforeOrAfterCalendarView;
@@ -28,8 +29,8 @@ import com.uas.appme.pedometer.constant.Constant;
 import com.uas.appme.pedometer.db.StepDataDao;
 import com.uas.appme.pedometer.service.StepService;
 import com.uas.appme.pedometer.utils.StepCountCheckUtil;
+import com.uas.appme.pedometer.utils.StepUtils;
 import com.uas.appme.pedometer.utils.TimeUtil;
-import com.uas.appme.settings.activity.SettingActivity;
 
 import java.text.DecimalFormat;
 import java.util.ArrayList;
@@ -306,25 +307,27 @@ public class NewStepActivity extends BaseActivity implements Handler.Callback {
 
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
-//        if (!CommonUtil.isReleaseVersion())
-//            getMenuInflater().inflate(R.menu.menu_uusport_list, menu);
+        if (!CommonUtil.isReleaseVersion()
+                && StepUtils.isCanStep())
+            getMenuInflater().inflate(R.menu.menu_uusport_list, menu);
         return super.onCreateOptionsMenu(menu);
     }
 
     @Override
     public boolean onOptionsItemSelected(MenuItem item) {
         if (item.getItemId() == android.R.id.home){
-            startActivity(new Intent(getApplicationContext(), SettingActivity.class));
-        } 
-//        else if (item.getItemId() == R.id.more){
-//            startActivity(new Intent(this,UURanking.class));
-//        }
+//            startActivity(new Intent(getApplicationContext(), SettingActivity.class));
+            finish();
+        } else if (StepUtils.isCanStep() && !CommonUtil.isReleaseVersion() && item.getItemId() == R.id.more){
+            startActivity(new Intent(this,UURanking.class));
+        }
         return super.onOptionsItemSelected(item);
     }
 
     @Override
     public void onBackPressed() {
-        startActivity(new Intent(getApplicationContext(), SettingActivity.class));
+//        startActivity(new Intent(getApplicationContext(), SettingActivity.class));
+        finish();
         super.onBackPressed();
     }
 

+ 53 - 5
app_modular/appme/src/main/java/com/uas/appme/pedometer/view/PersonalPageActivity.java

@@ -27,12 +27,21 @@ import com.me.network.app.http.HttpClient;
 import com.me.network.app.http.Method;
 import com.me.network.app.http.rx.ResultListener;
 import com.me.network.app.http.rx.ResultSubscriber;
+import com.uas.appcontact.model.contacts.ContactsModel;
+import com.uas.appcontact.ui.activity.ContactsActivity;
 import com.uas.appme.R;
+import com.uas.appme.pedometer.bean.ComPolylineBean;
 import com.uas.appme.pedometer.bean.PersonalStepBean;
 import com.uas.appme.pedometer.constant.Constant;
+import com.uas.appme.pedometer.utils.PolylineUtils;
 import com.uas.appme.pedometer.utils.TimeUtil;
 
 import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import lecho.lib.hellocharts.view.LineChartView;
 
 /**
  * Created by FANGlh on 2017/9/21.
@@ -51,12 +60,11 @@ public class PersonalPageActivity extends BaseActivity implements View.OnClickLi
     private TextView mMovementTotalStepsTimeTv;
     private PersonalStepBean mPersonalStepBean;
     private Button mbtnAttention;
-
+    private LineChartView lineChart;
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.personal_page_activity);
-
         initView();
         initData();
     }
@@ -78,11 +86,12 @@ public class PersonalPageActivity extends BaseActivity implements View.OnClickLi
         mbtnAttention = (Button) findViewById(R.id.btn_attention);
         mbtnAttention.setOnClickListener(this);
         mPersonalStepBean = new PersonalStepBean();
-
+//        LineChartView line_chart = findViewById(R.id.line_chart);
         if (type == 3)  // type 1、2 我、已关注的人
             mbtnAttention.setVisibility(View.VISIBLE);
         else
             mbtnAttention.setVisibility(View.GONE);
+        lineChart = (LineChartView)findViewById(R.id.line_chart);
     }
 
     private void initData() {
@@ -103,10 +112,32 @@ public class PersonalPageActivity extends BaseActivity implements View.OnClickLi
             public void onResponse(Object o) {
                 LogUtil.prinlnLongMsg("appSteps", o.toString());
                 mPersonalStepBean = JSON.parseObject(o.toString(),PersonalStepBean.class);
-                showStepsInfo();            }
+                showStepsInfo();
+                initPolylineData();
+            }
         }));
     }
 
+
+    //初始化折线数据
+    private void initPolylineData() {
+        if (mPersonalStepBean == null) return;
+        if (ListUtils.isEmpty(mPersonalStepBean.getMonthSteps()))  return;
+        List<ComPolylineBean> polyList = new ArrayList<>();
+        for (int i=0;i<mPersonalStepBean.getMonthSteps().size();i++){
+            if (!StringUtil.isEmpty(mPersonalStepBean.getMonthSteps().get(i).getAs_date())
+                    && !StringUtil.isEmpty(mPersonalStepBean.getMonthSteps().get(i).getAs_uusteps())){
+
+                long l = DateFormatUtil.str2Long(mPersonalStepBean.getMonthSteps().get(i).getAs_date(),"yyyy-MM-dd");
+                String date = DateFormatUtil.getStrDate4Date(new Date(l), "MM-dd");
+                ComPolylineBean cBean = new ComPolylineBean(date,CommonUtil.getNumByString(mPersonalStepBean.getMonthSteps().get(i).getAs_uusteps()));
+                polyList.add(cBean);
+                if (i == mPersonalStepBean.getMonthSteps().size()-1)
+                    PolylineUtils.initLineChart(lineChart,polyList);
+            }
+        }
+    }
+
     private void showStepsInfo() {
         progressDialog.dismiss();
         if (mPersonalStepBean == null || ListUtils.isEmpty(mPersonalStepBean.getWeekSteps()))  return;
@@ -142,6 +173,7 @@ public class PersonalPageActivity extends BaseActivity implements View.OnClickLi
             @Override
             public void onResponse(Object o) {
                 LogUtil.prinlnLongMsg("appUUSet", o.toString());
+                setResult(0x02);
                 finish();
             }
         }));
@@ -150,7 +182,7 @@ public class PersonalPageActivity extends BaseActivity implements View.OnClickLi
 
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
-        getMenuInflater().inflate(R.menu.menu_outoffice, menu);
+        getMenuInflater().inflate(R.menu.menu_step, menu);
         return super.onCreateOptionsMenu(menu);
     }
 
@@ -222,12 +254,28 @@ public class PersonalPageActivity extends BaseActivity implements View.OnClickLi
         }else if (v.getId() == R.id.cancel_attention_tv){
             doAttendHandle(0);
         }else if (v.getId() == R.id.share_friend_tv){
+            Intent intent = new Intent(this, ContactsActivity.class);
+            intent.putExtra("type", 1);
+            intent.putExtra("title", "分享好友");
+            startActivityForResult(intent, 0x01);
             ToastMessage("share_friend_tv");
+            closePopupWindow();
         }else if (v.getId() == R.id.share_monments_tv){
             ToastMessage("share_monments_tv");
+            closePopupWindow();
         }else if (v.getId() == R.id.not_rankingwith_tv){
             ToastMessage("not_rankingwith_tv");
+            closePopupWindow();
         }
+    }
 
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        if (data == null) return;
+        if (requestCode == 0x01){
+            ContactsModel model = data.getParcelableExtra("data");
+            LogUtil.d("0x01",JSON.toJSONString(model));
+        }
     }
 }

+ 73 - 7
app_modular/appme/src/main/java/com/uas/appme/pedometer/view/UURanking.java

@@ -10,6 +10,7 @@ import android.widget.TextView;
 
 import com.alibaba.fastjson.JSON;
 import com.common.LogUtil;
+import com.common.data.ListUtils;
 import com.core.app.MyApplication;
 import com.core.base.BaseActivity;
 import com.core.utils.CommonUtil;
@@ -56,6 +57,8 @@ public class UURanking extends BaseActivity implements View.OnClickListener {
     private UUAttentionAdapter mAttenAdapter;
     private ImageView mHeaderImg;
     private StepsRankingBean mStepsRankingBean;
+    private int att_position = -1;
+    private int all_position = -1;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -92,6 +95,8 @@ public class UURanking extends BaseActivity implements View.OnClickListener {
         mNameTv.setText(myem_name+"");
         String loginUserId = MyApplication.getInstance().mLoginUser.getUserId();
         AvatarHelper.getInstance().display(loginUserId, mPhotoImg, true, false);
+
+        //初始化个人信息,先从本地数据库取
         StepDataDao stepDataDao = new StepDataDao(this);
         StepEntity stepEntity = stepDataDao.getCurDataByDate(curSelDate);
         if (stepEntity != null) {
@@ -113,7 +118,7 @@ public class UURanking extends BaseActivity implements View.OnClickListener {
 
         progressDialog.show();
         //获取所有人的当天步数数据
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_STEP_URL).build();
+        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_STEP_URL).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("appStepsrank")
                 .add("userid",MyApplication.getInstance().mLoginUser.getUserId())
@@ -132,9 +137,11 @@ public class UURanking extends BaseActivity implements View.OnClickListener {
                     mAttenAdapter.setModel(mStepsRankingBean);
                     mAttentionPtlv.setAdapter(mAttenAdapter);
                     mAttenAdapter.notifyDataSetChanged();
-                    if (mStepsRankingBean.getAttrank().size()>1)
+//                    if (mStepsRankingBean.getAttrank().size()>1)
                         mAttentionLl.setVisibility(View.VISIBLE);
                     progressDialog.dismiss();
+                    doPositionFocus();
+                    showMyInfo();
                     LogUtil.prinlnLongMsg("mStepsRankingBean", JSON.toJSONString(mStepsRankingBean)+"");
                 }catch (Exception e){
                     e.printStackTrace();
@@ -144,6 +151,19 @@ public class UURanking extends BaseActivity implements View.OnClickListener {
 
     }
 
+    private void showMyInfo() {
+        if (mStepsRankingBean == null || ListUtils.isEmpty(mStepsRankingBean.getAttrank())) return;
+        //显示当前登录人的步数排名
+        for (int i = 0; i < mStepsRankingBean.getToalrank().size(); i++) {
+            if (MyApplication.getInstance().mLoginUser.getUserId().equals(mStepsRankingBean.getToalrank().get(i).getAs_userid())){
+                mRankingTv.setText("第" + mStepsRankingBean.getToalrank().get(i).getRank()+"名");
+                mStepsTv.setText(mStepsRankingBean.getToalrank().get(i).getAs_uusteps());
+                break;
+            }
+        }
+    }
+
+
     private void initEvents() {
         mAttentionPtlv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
             @Override
@@ -159,6 +179,8 @@ public class UURanking extends BaseActivity implements View.OnClickListener {
         });
     }
 
+
+
     private void inTentToPersonal(int type, int position) {
         Intent intent = new Intent(this,PersonalPageActivity.class);
         String title = "";
@@ -170,27 +192,49 @@ public class UURanking extends BaseActivity implements View.OnClickListener {
                 title = "我";
                 userid = MyApplication.getInstance().mLoginUser.getUserId();
                 em_name = CommonUtil.getSharedPreferences(MyApplication.getInstance(), "erp_emname");
+                all_position=-1;att_position=-1;
                 break;
             case 2:
                 title = mStepsRankingBean.getAttrank().get(position).getAs_username();
                 userid = mStepsRankingBean.getAttrank().get(position).getAs_userid();
                 em_name = mStepsRankingBean.getAttrank().get(position).getAs_username();
+                all_position=-1;att_position=position;
+
+                if (MyApplication.getInstance().mLoginUser.getUserId().equals(userid)) {
+                    type = 1;
+                    title = "我";
+                }
                 break;
             case 3:
                 title = mStepsRankingBean.getToalrank().get(position).getAs_username();
                 userid = mStepsRankingBean.getToalrank().get(position).getAs_userid();
                 em_name = mStepsRankingBean.getToalrank().get(position).getAs_username();
+                all_position=position;att_position=-1;
+
+                if (MyApplication.getInstance().mLoginUser.getUserId().equals(userid)) {
+                    type = 1;
+                    title = "我";
+                }else {
+                    for (int i = 0; i < mStepsRankingBean.getAttrank().size(); i++) {
+                        if (mStepsRankingBean.getToalrank().get(position).getAs_userid()
+                                .equals(mStepsRankingBean.getAttrank().get(i).getAs_userid())){  //当点击的所有人某一人在关注人的遍历中存在时
+                            type = 2;
+                            break;
+                        }else if (i == mStepsRankingBean.getAttrank().size()-1){
+                            type = 3;
+                        }
+
+                    }
+                }
+
                 break;
         }
-        if (MyApplication.getInstance().mLoginUser.getUserId().equals(userid)) {
-            type = 1;
-            title = "我";
-        }
+
         intent.putExtra("type",type);
         intent.putExtra("title",title+"的主页");
         intent.putExtra("userid",userid);
         intent.putExtra("em_name",em_name);
-        startActivity(intent);
+        startActivityForResult(intent,0x01);
     }
 
     @Override
@@ -199,4 +243,26 @@ public class UURanking extends BaseActivity implements View.OnClickListener {
             inTentToPersonal(1,0);
         }
     }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+
+        if (requestCode == 0x01 && resultCode == 0x02){
+            initData();
+        }
+    }
+
+    //对于处理点击关注或者取消关注后返回的焦点聚焦,回到之前位置的问题
+    private void doPositionFocus() {
+        if (all_position != -1 && all_position<mStepsRankingBean.getToalrank().size()){
+            mAllPtlv.setSelection(all_position);
+        }else if (all_position != -1 && all_position >= mStepsRankingBean.getToalrank().size()){
+            mAllPtlv.setSelection(mStepsRankingBean.getToalrank().size()-1);
+        }else if (att_position != -1 && att_position<mStepsRankingBean.getAttrank().size()){
+            mAttentionPtlv.setSelection(att_position);
+        }else if (att_position != -1 && att_position >= mStepsRankingBean.getAttrank().size()) {
+            mAttentionPtlv.setSelection(mStepsRankingBean.getAttrank().size() - 1);
+        }
+    }
 }

BIN
app_modular/appme/src/main/res/drawable-hdpi/step_more.png


BIN
app_modular/appme/src/main/res/drawable-xhdpi/step_more.png


BIN
app_modular/appme/src/main/res/drawable-xxhdpi/step_more.png


+ 24 - 0
app_modular/appme/src/main/res/drawable/bg_green_btn.xml

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true">
+        <shape>
+            <solid android:color="@color/btn_orange_press" />
+            <corners android:radius="8dp" />
+            <padding android:bottom="0.5dp" android:left="0.5dp" android:right="0.5dp" android:top="0.5dp" />
+        </shape>
+    </item>
+    <item android:state_enabled="false">
+        <shape>
+            <solid android:color="@color/btn_orange_press" />
+            <corners android:radius="8dp" />
+            <padding android:bottom="0.5dp" android:left="0.5dp" android:right="0.5dp" android:top="0.5dp" />
+        </shape>
+    </item>
+    <item>
+        <shape>
+            <solid android:color="@color/light_green" />
+            <corners android:radius="8dp" />
+            <padding android:bottom="0.5dp" android:left="0.5dp" android:right="0.5dp" android:top="0.5dp" />
+        </shape>
+    </item>
+</selector>

+ 4 - 2
app_modular/appme/src/main/res/layout/item_uuattention.xml

@@ -53,7 +53,8 @@
             android:textSize="@dimen/BigTextSize"
             android:textColor="@color/green"
             android:layout_toLeftOf="@+id/prise_tv"
-            android:layout_marginRight="20dp"
+            android:layout_marginRight="30dp"
+            android:text="11"
             />
 
         <TextView
@@ -65,7 +66,8 @@
             android:layout_marginBottom="0dp"
             android:textSize="@dimen/text_hine"
             android:textColor="@color/text_hine"
-            android:layout_marginRight="5dp"/>
+            android:layout_marginRight="5dp"
+            android:visibility="invisible"/>
         <ImageView
             android:id="@+id/prise_im"
             android:layout_width="25dp"

+ 12 - 14
app_modular/appme/src/main/res/layout/item_uuranking.xml

@@ -4,24 +4,12 @@
     android:layout_height="match_parent"
     android:background="@color/bg_main">
 
-    <TextView
-        android:id="@+id/ranking_tv"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:textColor="@color/black"
-        android:textSize="@dimen/text_main"
-        android:text="1"
-        android:layout_marginTop="20dp"
-        android:layout_alignParentLeft="true"
-        android:layout_marginLeft="10dp"
-        />
-
     <RelativeLayout
-        android:layout_toRightOf="@+id/ranking_tv"
+        android:id="@+id/_rl"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginRight="10dp"
-        android:layout_marginLeft="10dp"
+        android:layout_marginLeft="30dp"
         >
         <de.hdodenhof.circleimageview.CircleImageView
             android:id="@+id/photo_img"
@@ -78,4 +66,14 @@
             android:layout_marginTop="5dp"
             android:visibility="invisible"/>
     </RelativeLayout>
+    <TextView
+        android:id="@+id/ranking_tv"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textColor="@color/black"
+        android:textSize="@dimen/text_min"
+        android:text="1"
+        android:layout_marginTop="20dp"
+        android:layout_marginLeft="5dp"
+        />
 </RelativeLayout>

+ 23 - 5
app_modular/appme/src/main/res/layout/personal_page_activity.xml

@@ -1,5 +1,8 @@
 
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/activity_main"
+    android:orientation="vertical"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
@@ -151,6 +154,20 @@
                 </LinearLayout>
             </LinearLayout>
         </RelativeLayout>
+        <RelativeLayout
+            android:layout_marginTop="20dp"
+            android:layout_width="match_parent"
+            android:layout_height="300dp"
+            android:background="#48D1CC">
+            <lecho.lib.hellocharts.view.LineChartView
+                android:id="@+id/line_chart"
+                android:layout_width="match_parent"
+                android:layout_height="300dp"
+                android:layout_marginTop="20dp"
+                android:layout_marginBottom="20dp"
+                android:visibility="gone"/>
+        </RelativeLayout>
+
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
@@ -160,11 +177,12 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_marginTop="10dp"
-                android:background="@drawable/bg_bule_btn"
+                android:background="@drawable/bg_green_btn"
                 android:padding="10dp"
-                android:text="关  注"
+                android:text="添加关注"
                 android:textColor="@color/white"
-                android:textSize="@dimen/text_main" />
+                android:textSize="@dimen/text_main"
+                android:layout_marginBottom="20dp"/>
         </LinearLayout>
     </LinearLayout>
-</LinearLayout>
+</ScrollView>

+ 9 - 0
app_modular/appme/src/main/res/menu/menu_step.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+    <item
+        android:id="@id/title"
+        android:title="@string/more"
+        android:icon="@drawable/step_more"
+        app:showAsAction="always" />
+</menu>