liuzhenxing1118 5 сар өмнө
parent
commit
dd3df5a371

+ 5 - 0
app/src/main/AndroidManifest.xml

@@ -92,6 +92,11 @@
             android:exported="true"
             android:configChanges="keyboardHidden|orientation|screenSize"
             android:launchMode="singleInstance" />
+        <activity
+            android:name=".Activity.ShutdownActivity"
+            android:exported="true"
+            android:configChanges="keyboardHidden|orientation|screenSize"
+            android:launchMode="singleInstance" />
 
     </application>
 

+ 12 - 0
app/src/main/java/com/xplora/xponboarding/Activity/BaseActivity.java

@@ -171,4 +171,16 @@ public class BaseActivity extends Activity {
         ComponentName name = new ComponentName(this, OnboardingActivity.class);
         DataManager.disableApp(name);
     }
+
+    public void shutdown() {
+        String pkg = "com.sikey.commonservice";
+        String cls = pkg + ".modules.callbacks.LocalReceiver";
+        ComponentName componet = new ComponentName(pkg, cls);
+
+        Intent intent = new Intent("com.xplora.action.POWER_STATUS");
+        intent.putExtra("type", 0);  //0:power off  1:reboot  2:factory reset
+        intent.setComponent(componet);
+        sendBroadcast(intent, "com.xplora.receiver");
+        Log.d(TAG, "shutdown: ");
+    }
 }

+ 76 - 0
app/src/main/java/com/xplora/xponboarding/Activity/ShutdownActivity.java

@@ -0,0 +1,76 @@
+package com.xplora.xponboarding.Activity;
+
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
+
+import com.xplora.xponboarding.R;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+public class ShutdownActivity extends BaseActivity {
+    public TextView mTitleTV = null;
+    public TextView mContentTV = null;
+    public TextView mContent2TV = null;
+    public Button mCancelButton = null;
+    public Button mSureButton = null;
+    public Button mBottomButton = null;
+    private Timer mTimer = null;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_select);
+        isLockKey = true;
+
+        initView();
+        refreshView();
+        initTimer();
+    }
+
+    private void initView() {
+        mTitleTV = findViewById(R.id.mTitle);
+        mContentTV = findViewById(R.id.mContent);
+        mContent2TV = findViewById(R.id.mContent2);
+        mCancelButton = findViewById(R.id.mCancelBtn);
+        mSureButton = findViewById(R.id.mSureBtn);
+        mBottomButton = findViewById(R.id.mBottomBtn);
+    }
+
+    private void refreshView() {
+        mTitleTV.setText(R.string.sim_shutdown);
+        mContentTV.setText(R.string.sim_shutdown_nofind);
+        mContent2TV.setText(R.string.sim_shutdown_nofind_content);
+
+        mBottomButton.setVisibility(View.VISIBLE);
+        mBottomButton.setText(R.string.sim_shutdown_button);
+        mBottomButton.setOnClickListener(v -> {
+            shutdown();
+        });
+    }
+
+    private void initTimer() {
+        if (mTimer != null) {
+            mTimer.cancel();
+            mTimer = null;
+        }
+        mTimer = new Timer();
+        mTimer.schedule(new TimerTask() {
+            @Override
+            public void run() {
+                shutdown();
+            }
+        },1000 * 60); //一分钟
+    }
+
+    @Override
+    protected void onPause() {
+        super.onPause();
+        if (mTimer != null) {
+            mTimer.cancel();
+            mTimer = null;
+        }
+    }
+}

+ 10 - 0
app/src/main/res/drawable-xhdpi/bg_gray.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<shape
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <!-- 填充的颜色 -->
+    <solid android:color="@color/sk_gray" />
+
+    <!-- 圆角的半径 -->
+    <corners android:radius="5dp" />
+</shape>

+ 10 - 0
app/src/main/res/drawable-xhdpi/bg_gray_button.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<shape
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <!-- 填充的颜色 -->
+    <solid android:color="@color/sk_gray" />
+
+    <!-- 圆角的半径 -->
+    <corners android:radius="37dp" />
+</shape>

+ 10 - 0
app/src/main/res/drawable-xhdpi/sk_checkbox.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <!--    选中状态-->
+    <item android:drawable="@drawable/sk_checkbox_on" android:state_checked="true"/>
+    <!--    不选中状态-->
+    <item android:drawable="@drawable/sk_checkout_off" android:state_checked="false"/>
+    <item android:drawable="@drawable/sk_checkbox_on" android:state_pressed="true"/>
+    <!--    默认状态-->
+    <item android:drawable="@drawable/sk_checkout_off"/>
+</selector>

BIN
app/src/main/res/drawable-xhdpi/sk_checkbox_on.png


+ 5 - 0
app/src/main/res/drawable-xhdpi/sk_checkout_off.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="oval">
+    <solid android:color="#00000000" />
+</shape>

+ 95 - 0
app/src/main/res/layout/activity_select.xml

@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@color/black"
+    >
+
+    <TextView
+        android:id="@+id/mTitle"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="10dp"
+        android:layout_marginStart="5dp"
+        android:layout_marginEnd="5dp"
+        android:textColor="@color/white"
+        android:textSize="17sp"
+        android:textStyle="bold"
+        />
+
+    <TextView
+        android:id="@+id/mContent"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_below="@+id/mTitle"
+        android:layout_marginTop="8dp"
+        android:layout_marginStart="5dp"
+        android:layout_marginEnd="5dp"
+        android:textColor="@color/white"
+        android:textSize="15sp"
+        android:textFontWeight="400"
+        />
+
+    <TextView
+        android:id="@+id/mContent2"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_below="@+id/mContent"
+        android:layout_marginTop="2dp"
+        android:layout_marginStart="5dp"
+        android:layout_marginEnd="5dp"
+        android:textColor="#B2FFFFFF"
+        android:textSize="12sp"
+        android:textFontWeight="400"
+        />
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="37dp"
+        android:layout_marginStart="5dp"
+        android:layout_marginEnd="5dp"
+        android:layout_marginBottom="5dp"
+        android:layout_alignParentBottom="true"
+        >
+        <Button
+            android:id="@+id/mBottomBtn"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:text="@string/button_sure"
+            android:textSize="17sp"
+            android:textColor="@color/white"
+            android:background="@drawable/bg_gray_button"
+            android:visibility="gone"
+            />
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="horizontal"
+            android:visibility="gone"
+            >
+            <Button
+                android:id="@+id/mCancelBtn"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:text="@string/button_cancel"
+                android:textSize="17sp"
+                android:textColor="@color/white"
+                android:background="@drawable/bg_gray_button"
+                />
+            <Button
+                android:id="@+id/mSureBtn"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:layout_marginStart="5dp"
+                android:text="@string/button_sure"
+                android:textSize="17sp"
+                android:textColor="@color/white"
+                android:background="@drawable/bg_gray_button"
+                />
+        </LinearLayout>
+    </RelativeLayout>
+
+</RelativeLayout>

+ 4 - 5
app/src/main/res/layout/activity_sim_locked.xml

@@ -9,15 +9,14 @@
         android:id="@+id/content"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginTop="42dp"
         android:layout_marginStart="8dp"
+        android:layout_marginTop="42dp"
         android:layout_marginEnd="8dp"
+        android:fontFamily="Roboto"
         android:textAlignment="center"
-        android:textSize="12sp"
-        android:textFontWeight="400"
         android:textColor="#FFFFFFFF"
-        android:fontFamily="Roboto"
-        />
+        android:textFontWeight="400"
+        android:textSize="12sp" />
 
     <RelativeLayout
         android:layout_width="match_parent"

+ 23 - 19
app/src/main/res/layout/item_checkbox.xml

@@ -1,38 +1,42 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="40dp">
+    android:layout_height="wrap_content"
+    android:paddingTop="2dp"
+    android:paddingBottom="2dp"
+    android:paddingStart="5dp"
+    android:paddingEnd="5dp"
+    >
 
     <RelativeLayout
         android:layout_width="match_parent"
-        android:layout_height="40dp"
+        android:layout_height="50dp"
+        android:background="@drawable/bg_gray"
         >
 
+        <TextView
+            android:id="@+id/item_title"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_centerVertical="true"
+            android:layout_marginStart="10dp"
+            android:fontFamily="Roboto"
+            android:textColor="@color/white"
+            android:textSize="17sp" />
+
         <CheckBox
             android:id="@+id/item_checkbox"
-            android:layout_width="28dp"
-            android:layout_height="28dp"
-            android:layout_marginStart="20dp"
+            android:layout_width="25dp"
+            android:layout_height="25dp"
             android:layout_centerVertical="true"
-            android:background="@drawable/xp_checkbox"
+            android:layout_alignParentEnd="true"
+            android:layout_marginEnd="10dp"
+            android:background="@drawable/sk_checkbox"
             android:clickable="false"
             android:button="@null"
             >
         </CheckBox>
 
-        <TextView
-            android:id="@+id/item_title"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_toEndOf="@id/item_checkbox"
-            android:layout_marginStart="0dp"
-            android:layout_centerVertical="true"
-            android:layout_alignParentEnd="true"
-            android:textAlignment="center"
-            android:fontFamily="Roboto"
-            android:textColor="@color/white"
-            android:textSize="13sp" />
-
     </RelativeLayout>
 
 </LinearLayout>

+ 12 - 0
app/src/main/res/values-zh-rCN/strings.xml

@@ -31,4 +31,16 @@
     <string name="sim_install_2">2.然后重新启动手表</string>
     <string name="timeformat_array_0">12小时</string>
     <string name="timeformat_array_1">24小时</string>
+    <string name="button_cancel">取消</string>
+    <string name="button_sure">确定</string>
+    <string name="sim_locked">SIM卡已锁定</string>
+    <string name="sim_locked_to_unlock">请解锁后使用设备</string>
+    <string name="sim_locked_to_unlock_content">请输入PIN码解锁</string>
+    <string name="sim_locked_errormax">错误次数已达上限</string>
+    <string name="sim_locked_max">错误次数已达上限</string>
+    <string name="sim_locked_max_content">请尝试其他方式解锁SIM卡后再使用</string>
+    <string name="sim_shutdown">即将关机</string>
+    <string name="sim_shutdown_button">关机</string>
+    <string name="sim_shutdown_nofind">未检测到可用SIM卡</string>
+    <string name="sim_shutdown_nofind_content">为了您的体验请使用nano-SIM卡并确保未被锁定后使用设备</string>
 </resources>

+ 12 - 0
app/src/main/res/values-zh-rTW/strings.xml

@@ -31,4 +31,16 @@
     <string name="sim_install_2">2.然後重啟手錶</string>
     <string name="timeformat_array_0">12小時</string>
     <string name="timeformat_array_1">24小時</string>
+    <string name="button_cancel">取消</string>
+    <string name="button_sure">确定</string>
+    <string name="sim_locked">SIM卡已锁定</string>
+    <string name="sim_locked_to_unlock">请解锁后使用设备</string>
+    <string name="sim_locked_to_unlock_content">请输入PIN码解锁</string>
+    <string name="sim_locked_errormax">错误次数已达上限</string>
+    <string name="sim_locked_max">错误次数已达上限</string>
+    <string name="sim_locked_max_content">请尝试其他方式解锁SIM卡后再使用</string>
+    <string name="sim_shutdown">即将关机</string>
+    <string name="sim_shutdown_button">关机</string>
+    <string name="sim_shutdown_nofind">未检测到可用SIM卡</string>
+    <string name="sim_shutdown_nofind_content">为了您的体验请使用nano-SIM卡并确保未被锁定后使用设备</string>
 </resources>

+ 2 - 0
app/src/main/res/values/colors.xml

@@ -11,4 +11,6 @@
     <color name="transparent">#00FFFFFF</color>
     <color name="xp_yellow">#FFFFC34B</color>
     <color name="xp_red">#FFFF0000</color>
+
+    <color name="sk_gray">#303030</color>
 </resources>

+ 12 - 0
app/src/main/res/values/strings.xml

@@ -30,4 +30,16 @@
     <string name="sim_install_2">2.Then restart the watch</string>
     <string name="timeformat_array_0">12 Hour</string>
     <string name="timeformat_array_1">24 Hour</string>
+    <string name="button_cancel">Cancel</string>
+    <string name="button_sure">Sure</string>
+    <string name="sim_locked">SIM卡已锁定</string>
+    <string name="sim_locked_to_unlock">请解锁后使用设备</string>
+    <string name="sim_locked_to_unlock_content">请输入PIN码解锁</string>
+    <string name="sim_locked_errormax">错误次数已达上限</string>
+    <string name="sim_locked_max">错误次数已达上限</string>
+    <string name="sim_locked_max_content">请尝试其他方式解锁SIM卡后再使用</string>
+    <string name="sim_shutdown">即将关机</string>
+    <string name="sim_shutdown_button">关机</string>
+    <string name="sim_shutdown_nofind">未检测到可用SIM卡</string>
+    <string name="sim_shutdown_nofind_content">为了您的体验请使用nano-SIM卡并确保未被锁定后使用设备</string>
 </resources>