Browse Source

关闭失败2

FANGLH 9 years ago
parent
commit
ae4d47f3e0

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

@@ -442,10 +442,6 @@
         <activity android:name=".ui.circle.PhoneSelectActivity" />
         <activity android:name=".ui.erp.activity.crm.ClientActivity" />
         <activity android:name=".ApplySubscribeActivity" />
-        <activity
-            android:name=".ui.erp.activity.oa.SigninActivity"
-            android:label=""
-            android:theme="@style/OAThemeSignin" />
         <!-- android:theme="@style/Theme.AppCompat.NoActionBar" /> -->
         <activity
             android:name=".ui.erp.activity.oa.AddMeetingActivity"
@@ -673,10 +669,6 @@
             android:name=".ui.erp.activity.message.ProcessMsgActivity"
             android:label="@string/title_activity_process_msg" />
 
-        <service
-            android:name=".ui.erp.util.auto.AlarmService"
-            android:enabled="true"
-            android:exported="true" />
 
         <!-- 百度推送相关 -->
         <!-- push必须的receviver和service声明 -->
@@ -777,9 +769,6 @@
         <activity android:name=".ui.erp.activity.oa.LocationSearchActivity"
             android:windowSoftInputMode="stateUnspecified|adjustNothing"
             />
-        <activity
-            android:name=".ui.erp.activity.oa.MissionPlanActivity"
-            android:label="@string/activity_mission_plan" />
         <activity
             android:name=".ui.erp.activity.oa.MissionSetActivity"
             android:label="@string/activity_mission_set" />
@@ -823,6 +812,11 @@
                 <action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
             </intent-filter>
         </service>
+        <receiver android:name="basepedo.service.BootCompleteReceiver">
+            <intent-filter>
+                <action android:name="android.intent.action.BOOT_COMPLETED"/>
+            </intent-filter>
+        </receiver>
     </application>
 
 </manifest>

+ 2 - 2
WeiChat/src/main/java/basepedo/service/StepDcretor.java

@@ -59,8 +59,8 @@ public class StepDcretor implements SensorEventListener {
     //用x、y、z轴三个维度算出的平均值
     public static float average = 0;
     private Timer timer;
-    // 倒计时3.5秒,3.5秒内不会显示计步,用于屏蔽细微波动
-    private long duration = 3500;
+    // 倒计时3秒,3秒内不会显示计步,用于屏蔽细微波动
+    private long duration = 3000;
     private TimeCount time;
     OnSensorChangeListener onSensorChangeListener;
 

+ 1 - 1
WeiChat/src/main/java/basepedo/service/StepService.java

@@ -195,7 +195,7 @@ public class StepService extends Service implements SensorEventListener {
         builder.setTicker("UU运动");
         builder.setContentTitle("UU运动");
         //设置不可清除
-//        builder.setOngoing(true);
+        builder.setOngoing(true);
         builder.setContentText(content);
         Notification notification = builder.build();
 

+ 7 - 24
WeiChat/src/main/java/basepedo/ui/MyPedometerActivity.java

@@ -110,8 +110,8 @@ public class MyPedometerActivity extends BaseActivity implements Handler.Callbac
             @Override
             public void onClick(View v) {
                 Intent intent = new Intent(mContext, StepService.class);
-                bindService(intent, conn, Context.BIND_AUTO_CREATE);
                 startService(intent);
+                bindService(intent, conn, Context.BIND_AUTO_CREATE);
                 Toast.makeText(MyPedometerActivity.this, "您已开启UU运动,UU将记录您的运动步数并显示在通知栏", Toast.LENGTH_LONG).show();
                 open_step.setVisibility(View.GONE);
                 close_step.setVisibility(View.VISIBLE);
@@ -122,20 +122,16 @@ public class MyPedometerActivity extends BaseActivity implements Handler.Callbac
         close_step.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                unbindService(conn);
-                stopService(new Intent(mContext, StepService.class));
-                Toast.makeText(MyPedometerActivity.this, "您已关闭UU运动,通知栏将不再显示您的运动步数", Toast.LENGTH_LONG).show();
-                finish();
+//                unbindService(conn);
+//                stopService(new Intent(mContext, StepService.class));
+//                Toast.makeText(MyPedometerActivity.this, "您已关闭UU运动,通知栏将不再显示您的运动步数", Toast.LENGTH_LONG).show();
+                ToastMessage("该功能未完善");
+//                open_step.setVisibility(View.VISIBLE);
+//                close_step.setVisibility(View.GONE);
             }
         });
     }
 
-//    @Override
-//    protected void onStart() {
-//        super.onStart();
-//        setupService();
-//    }
-//
     private void setupService() {
         Intent intent = new Intent(this, StepService.class);
         bindService(intent, conn, Context.BIND_AUTO_CREATE);
@@ -147,19 +143,6 @@ public class MyPedometerActivity extends BaseActivity implements Handler.Callbac
         super.onResume();
     }
 
-//    @Override
-//    public void onBackPressed() {
-//        moveTaskToBack(true);
-//        super.onBackPressed();
-//    }
-
-//    @Override
-//    protected void onDestroy() {
-//        super.onDestroy();
-//      unbindService(conn);
-//        finish();
-//    }
-
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
         return super.onCreateOptionsMenu(menu);

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

@@ -12,7 +12,9 @@ import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.Message;
+import android.os.Messenger;
 import android.os.PersistableBundle;
+import android.os.RemoteException;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.support.v4.app.FragmentTransaction;
@@ -20,6 +22,7 @@ import android.util.Log;
 import android.view.KeyEvent;
 import android.view.View;
 import android.widget.TextView;
+import android.widget.Toast;
 
 import com.android.volley.Response;
 import com.android.volley.VolleyError;
@@ -65,6 +68,9 @@ import com.xzjmyk.pm.activity.xmpp.listener.AuthStateListener;
 import java.util.HashMap;
 import java.util.List;
 
+import basepedo.config.Constant;
+import basepedo.service.StepService;
+
 
 /**
  * @项目名称: SkWeiChat-Baidu
@@ -485,6 +491,37 @@ public class MainActivity extends BaseActivity implements NetWorkObservable.NetW
 //        }
 //        dbManager.closeDB();
 
+
+        //开启APP后自动开启UU运动服务,这里为了耗电占内存等情况暂时不设置开启APP自动开启UU运动
+//        openUUStepService();
+    }
+    private Messenger messenger;
+    private Messenger mGetReplyMessenger = new Messenger(new Handler());
+    private void openUUStepService() {
+
+        ServiceConnection conn = new ServiceConnection() {
+            @Override
+            public void onServiceConnected(ComponentName name, IBinder service) {
+                try {
+                    messenger = new Messenger(service);
+                    Message msg = Message.obtain(null, Constant.MSG_FROM_CLIENT);
+                    msg.replyTo = mGetReplyMessenger;
+                    messenger.send(msg);
+                } catch (RemoteException e) {
+                    e.printStackTrace();
+                }
+            }
+
+            @Override
+            public void onServiceDisconnected(ComponentName name) {
+
+            }
+        };
+
+        Intent intent = new Intent(mContext, StepService.class);
+        startService(intent);
+        bindService(intent, conn, Context.BIND_AUTO_CREATE);
+        Toast.makeText(MainActivity.this, "系统已为你开启UU运动,UU将记录您的运动步数并显示在通知栏", Toast.LENGTH_LONG).show();
     }
 
     public void updateVersion() {

BIN
WeiChat/src/main/res/drawable-xxhdpi/uu_step.png


+ 70 - 50
WeiChat/src/main/res/layout/activity_pedometer.xml

@@ -2,59 +2,79 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:paddingBottom="@dimen/activity_vertical_margin"
-    android:paddingLeft="@dimen/activity_horizontal_margin"
-    android:paddingRight="@dimen/activity_horizontal_margin"
-    android:paddingTop="@dimen/activity_vertical_margin"
-    android:orientation="vertical">
+    android:layout_height="match_parent">
+<ScrollView
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_marginTop="10dp"
+    android:layout_marginLeft="10dp"
+    android:layout_marginRight="10dp">
 
-    <TextView
+    <LinearLayout
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:text="测试须知"
-        android:layout_gravity="center_horizontal"/>
-    <TextView
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="计步功能:暂时只测试了放在裤子口袋里计步,晃动幅度判断,在持续运动10秒后才开始计数"
-        />
-    <TextView
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="屏蔽功能:连续运动一定时间才开始计步,屏蔽细微移动或者驾车时震动所带来的干扰,停止运动超过5秒,便重新开启屏蔽功能"
-        />
-    <TextView
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="通知栏提醒:, 后面是微动次数不算步数的,目前只是为了方便测试,目前版本只能在杀死进程下关闭UU计步"
-        />
+        android:orientation="vertical">
 
-    <TextView
-        android:id="@+id/text_step"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:textColor="#00cc00"
-        android:layout_centerInParent="true"
-        android:textSize="20sp"
-        android:layout_gravity="center_horizontal"
-        android:layout_marginTop="200dp"
-        android:text="暂未开启UU运动"
-        />
-    <Button
-        android:id="@+id/open_uu_step_bt"
-        style="@style/from_button_base_bule"
-        android:layout_marginTop="5dp"
-        android:layout_marginLeft="40dp"
-        android:layout_marginRight="40dp"
-        android:text="开启UU运动"
-        android:visibility="visible"/>
-    <Button
-        android:id="@+id/close_uu_step_bt"
-        style="@style/from_button_base_bule"
-        android:layout_marginTop="5dp"
-        android:layout_marginLeft="40dp"
-        android:layout_marginRight="40dp"
-        android:text="关闭UU运动" />
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="测试须知"
+            android:textSize="23sp"
+            android:layout_gravity="center_horizontal"/>
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:text="计步功能:触发感应器开始计步,在持续运动3秒后才开始计数,不足3秒停止则时间重置"
+            />
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:text="屏蔽功能:屏蔽细微移动或者驾车时震动所带来的干扰,停止运动超过5秒,便重新开启屏蔽功能"
+            />
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:text="通知栏提醒:实时通知更新步数,目前版本只能在杀死进程下关闭UU计步,以及通知栏暂时设置不可清除"
+            />
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:text="计步防作弊:这里对波峰以及晃动的时间差做了特殊的处理,只记录放在口袋里的走动或者类似其的运动才会开始计步(主要外勤企业版的需求),所以测试者不要再拿着手机使劲摇的时候问我步数不变动、不准等问题了,请你走动起来测试,谢谢!!!"
+            />
+
+        <TextView
+            android:id="@+id/text_step"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textColor="#00cc00"
+            android:layout_centerInParent="true"
+            android:textSize="20sp"
+            android:layout_gravity="center_horizontal"
+            android:layout_marginTop="150dp"
+            android:text="暂未开启UU运动"
+            />
+        <Button
+            android:id="@+id/open_uu_step_bt"
+            style="@style/from_button_base_bule"
+            android:layout_marginTop="5dp"
+            android:layout_marginLeft="40dp"
+            android:layout_marginRight="40dp"
+            android:text="开启UU运动"
+            android:visibility="visible"/>
+        <Button
+            android:id="@+id/close_uu_step_bt"
+            style="@style/from_button_base_bule"
+            android:layout_marginTop="5dp"
+            android:layout_marginLeft="40dp"
+            android:layout_marginRight="40dp"
+            android:text="关闭UU运动" />
+
+    </LinearLayout>
+</ScrollView>
 
 </LinearLayout>

+ 25 - 34
WeiChat/src/main/res/layout/fragment_me.xml

@@ -116,14 +116,6 @@
 
                 android:background="@drawable/oa_next"
                 android:contentDescription="@string/app_name" />
-
-            <LinearLayout
-                android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                android:layout_alignBottom="@+id/imageView"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentRight="true"
-                android:orientation="horizontal"></LinearLayout>
         </RelativeLayout>
 
         <RelativeLayout
@@ -238,7 +230,32 @@
             android:layout_width="match_parent"
             android:layout_height="@dimen/line"
             android:background="@color/item_line" />
+        <RelativeLayout
+            android:id="@+id/uu_sport_step"
+            style="@style/IMTbleLine_UP_Me"
+            android:layout_marginTop="7dp"
+            android:background="@drawable/selector_me_menu_item_bg"
+            >
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_centerVertical="true"
+                android:drawableLeft="@drawable/uu_step"
+                android:drawablePadding="10dp"
+                android:gravity="center"
+                android:text="UU运动"
+                android:textColor="@color/text_main"
+                android:textSize="@dimen/text_main" />
 
+            <ImageView
+                android:layout_width="@dimen/next_width"
+                android:layout_height="@dimen/next_height"
+                android:layout_alignParentRight="true"
+                android:layout_centerVertical="true"
+                android:layout_marginRight="8dp"
+                android:background="@drawable/oa_next"
+                android:contentDescription="@string/app_name" />
+        </RelativeLayout>
         <View
             android:layout_width="match_parent"
             android:layout_height="@dimen/line"
@@ -517,32 +534,6 @@
                 android:contentDescription="@string/app_name" />
         </RelativeLayout>
 
-        <RelativeLayout
-            android:id="@+id/uu_sport_step"
-            style="@style/IMTbleLine_UP_Me"
-            android:layout_marginTop="7dp"
-            android:background="@drawable/selector_me_menu_item_bg"
-            >
-            <TextView
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_centerVertical="true"
-                android:drawableLeft="@drawable/icon_uu_setting"
-                android:drawablePadding="10dp"
-                android:gravity="center"
-                android:text="UU运动"
-                android:textColor="@color/text_main"
-                android:textSize="@dimen/text_main" />
-
-            <ImageView
-                android:layout_width="@dimen/next_width"
-                android:layout_height="@dimen/next_height"
-                android:layout_alignParentRight="true"
-                android:layout_centerVertical="true"
-                android:layout_marginRight="8dp"
-                android:background="@drawable/oa_next"
-                android:contentDescription="@string/app_name" />
-        </RelativeLayout>
     </LinearLayout>
 
 </ScrollView>