Przeglądaj źródła

内勤2.0画UI前备份

FANGLH 9 lat temu
rodzic
commit
3c1a4dc2bd

+ 1 - 1
WeiChat/build.gradle

@@ -13,7 +13,7 @@ android {
     }
     signingConfigs {
         config {
-            storeFile file('D:/config/applicationsignname[20150409]')
+            storeFile file('C:/Users/FANGlh/Desktop/UUAPP/applicationsignname[20150409]')
             storePassword '13237658359'
             keyAlias 'jie-20150409'
             keyPassword '13237658359'

+ 6 - 5
WeiChat/src/main/AndroidManifest.xml

@@ -2,8 +2,8 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     package="com.xzjmyk.pm.activity"
-    android:versionCode="78"
-    android:versionName="5.6.5">
+    android:versionCode="79"
+    android:versionName="5.6.6">
 
     <uses-sdk
         android:minSdkVersion="11"
@@ -107,7 +107,7 @@
     <uses-feature android:name="android.hardware.camera.autofocus" />
     <!-- 计步器用到 -->
     <uses-feature android:name="android.hardware.sensor.accelerometer" />
-
+    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
     <!-- 自动聚焦权限 -->
     <!-- 全局样式不要随意改动  @style/AppTheme -->
     <application
@@ -784,7 +784,9 @@
             android:name="com.xzjmyk.pm.basepedo.ui.MyPedometerActivity"
             android:label="UU运动" />
 
-        <service android:name="com.xzjmyk.pm.basepedo.service.StepService">
+        <service android:name="com.xzjmyk.pm.basepedo.service.StepService"
+                 android:process="com.uu.step"
+                    android:priority="1000">
             <intent-filter android:priority="1000">
 
                 <!-- 系统启动完成后会调用 -->
@@ -805,7 +807,6 @@
                 <action android:name="uu.step.destory" />
             </intent-filter>
         </receiver>
-
         <activity android:name=".ui.me.SpeechrecognitionActivity" />
         <activity android:name=".ui.erp.activity.oa.ErpActivity" />
         <activity

+ 1 - 1
WeiChat/src/main/java/com/xzjmyk/pm/basepedo/service/StepDcretor.java

@@ -61,7 +61,7 @@ public class StepDcretor implements SensorEventListener {
     public static float average = 0;
     private Timer timer;
     // 倒计时3秒,,用于屏蔽细微波动
-    private long duration = 3000;
+    private long duration = 2000;
     private TimeCount time;
     OnSensorChangeListener onSensorChangeListener;
 

+ 29 - 23
WeiChat/src/main/java/com/xzjmyk/pm/basepedo/service/StepService.java

@@ -112,8 +112,8 @@ public class StepService extends Service implements SensorEventListener {
         updateNotification("今日步数:" + com.xzjmyk.pm.basepedo.service.StepDcretor.CURRENT_SETP + " 步");
         flags = START_STICKY;
         Log.i("StepService", "onStartCommand");
-        return super.onStartCommand(intent,flags,startId);
-
+//        return super.onStartCommand(intent,flags,startId);
+        return START_REDELIVER_INTENT;
     }
     private String getTodayDate() {
         Date date = new Date(System.currentTimeMillis());
@@ -204,21 +204,27 @@ public class StepService extends Service implements SensorEventListener {
         PendingIntent contentIntent = PendingIntent.getActivity(this, 100,
                 new Intent(this, MyPedometerActivity.class), 0);
         builder.setContentIntent(contentIntent);
+//        builder.setDeleteIntent(contentIntent);
         builder.setSmallIcon(R.drawable.uuu);
         builder.setTicker("UU运动");
         builder.setContentTitle("UU运动");
-        //设置不可清除
-//        builder.setOngoing(true);
+//        builder.setOngoing(true);         //设置不可清除
         builder.setContentText(content);
         Notification notification = builder.build();
-
         startForeground(0, notification);
+
         nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
-        if (PreferenceUtils.getInt(this,MyPedometerActivity.UU_STEP_NOTICE) == 1){
+//        if (PreferenceUtils.getInt(this,MyPedometerActivity.UU_STEP_NOTICE) == 1){
             nm.notify(R.string.app_name, notification);
-        }else if(PreferenceUtils.getInt(this,MyPedometerActivity.UU_STEP_NOTICE) == 0){
-            nm.cancelAll();
+//        }else if(PreferenceUtils.getInt(this,MyPedometerActivity.UU_STEP_NOTICE) == 0){
+//            nm.cancelAll();
+//        }
+        try {
+            unlock();
+        }catch (SecurityException s){
+            s.printStackTrace();
         }
+
     }
 
     @Override
@@ -236,12 +242,12 @@ public class StepService extends Service implements SensorEventListener {
                 .getSystemService(SENSOR_SERVICE);
         getLock(this);
        // android4.4以后可以使用计步传感器
-        int VERSION_CODES = Build.VERSION.SDK_INT;
-        if (VERSION_CODES >= 19) {
-            addCountStepListener();
-        } else {
-            addBasePedoListener();
-        }
+//        int VERSION_CODES = Build.VERSION.SDK_INT;
+//        if (VERSION_CODES >= 19) {
+//            addCountStepListener();
+//        } else {
+//            addBasePedoListener();
+//        }
 
         addBasePedoListener();
         addCountStepListener();
@@ -274,7 +280,6 @@ public class StepService extends Service implements SensorEventListener {
 
                     @Override
                     public void onChange() {
-//                        updateNotification("今日步数:" + StepDcretor.CURRENT_SETP + "," + i + " 步");
                             updateNotification("今日步数:" + StepDcretor.CURRENT_SETP + " 步");
                     }
                 });
@@ -330,6 +335,7 @@ public class StepService extends Service implements SensorEventListener {
     public void onDestroy() {
         //取消前台进程
         stopForeground(true);
+        stopForeground(false);
         DbUtils.closeDb();
         unregisterReceiver(mBatInfoReceiver);
         if (! isServiceRunning(uustep_service_name) && PreferenceUtils.getInt(MyApplication.getInstance(), MainActivity.UU_STEP)==1){
@@ -347,14 +353,14 @@ public class StepService extends Service implements SensorEventListener {
         return super.onUnbind(intent);
     }
 
-//    private  void unlock(){
-//        setLockPatternEnabled(android.provider.Settings.Secure.LOCK_PATTERN_ENABLED,false);
-//    }
-//
-//    private void setLockPatternEnabled(String systemSettingKey, boolean enabled) {
-//        //推荐使用
-//        android.provider.Settings.Secure.putInt(getContentResolver(), systemSettingKey,enabled ? 1 : 0);
-//    }
+    private  void unlock(){
+        setLockPatternEnabled(android.provider.Settings.Secure.LOCK_PATTERN_ENABLED,false);
+    }
+
+    private void setLockPatternEnabled(String systemSettingKey, boolean enabled) {
+        //推荐使用
+        android.provider.Settings.Secure.putInt(getContentResolver(), systemSettingKey,enabled ? 1 : 0);
+    }
 
     synchronized private WakeLock getLock(Context context) {
         if (mWakeLock != null) {

+ 2 - 5
WeiChat/src/main/java/com/xzjmyk/pm/basepedo/ui/MyPedometerActivity.java

@@ -17,12 +17,9 @@ import android.view.MenuItem;
 import android.view.View;
 import android.widget.TextView;
 
-import com.baidu.android.pushservice.PushManager;
-import com.xzjmyk.pm.activity.MyApplication;
 import com.xzjmyk.pm.activity.R;
 import com.xzjmyk.pm.activity.ui.base.BaseActivity;
 import com.xzjmyk.pm.activity.ui.me.SettingActivity;
-import com.xzjmyk.pm.activity.util.PreferenceUtils;
 import com.xzjmyk.pm.basepedo.config.Constant;
 import com.xzjmyk.pm.basepedo.service.StepService;
 import com.xzjmyk.pm.basepedo.slidinguppanel.SlidingUpPanelLayout;
@@ -125,8 +122,8 @@ public class MyPedometerActivity extends BaseActivity implements Handler.Callbac
         delayHandler = new Handler(this);
         setupService();
 
-        PreferenceUtils.putInt(MyPedometerActivity.UU_STEP_NOTICE, 0);
-        PushManager.resumeWork(MyApplication.getInstance());
+//        PreferenceUtils.putInt(MyPedometerActivity.UU_STEP_NOTICE, 0);
+//        PushManager.resumeWork(MyApplication.getInstance());
     }
 
 

+ 2 - 2
WeiChat/src/main/res/layout/activity_pedometer.xml

@@ -64,7 +64,7 @@
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_marginTop="20dp"
-                android:text="计步功能:触发感应器开始计步,在持续运动3秒后才开始有效计数,不足3秒停止则时间重置,新增步数重置(屏蔽细微移动)。"
+                android:text="计步功能:触发感应器开始计步,在持续运动2秒后才开始有效计数,不足2秒停止则时间重置,新增步数重置(屏蔽细微移动)。"
                 />
             <TextView
                 android:visibility="gone"
@@ -77,7 +77,7 @@
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_marginTop="5dp"
-                android:text="通知栏提醒:实时通知更新步数,但最终只显示持续运动超过3秒的有效步数,通知栏便于实时测试观察,暂时不做点击取消显示(低版本号手机显示会有延迟效果)。"
+                android:text="通知栏提醒:实时通知更新步数,但最终只显示持续运动超过2秒的有效步数,通知栏便于实时测试观察,暂时不做点击取消显示(低版本号手机显示会有延迟效果)。"
                 />
             <TextView
                 android:layout_width="wrap_content"