liuzhenxing1118 преди 3 години
родител
ревизия
73e7b8ae0b

+ 2 - 0
.idea/misc.xml

@@ -21,6 +21,7 @@
         <entry key="app/src/main/res/layout/bright_activity.xml" value="0.1889564336372847" />
         <entry key="app/src/main/res/layout/button_sure.xml" value="0.1" />
         <entry key="app/src/main/res/layout/display_activity.xml" value="0.20199275362318841" />
+        <entry key="app/src/main/res/layout/fragment_select.xml" value="0.1889564336372847" />
         <entry key="app/src/main/res/layout/item_cancel_sure.xml" value="0.14903846153846154" />
         <entry key="app/src/main/res/layout/item_center.xml" value="0.13179347826086957" />
         <entry key="app/src/main/res/layout/item_checkbox.xml" value="0.20199275362318841" />
@@ -43,6 +44,7 @@
         <entry key="app/src/main/res/layout/item_title_subtitle.xml" value="0.1" />
         <entry key="app/src/main/res/layout/item_wifi_switch.xml" value="0.1" />
         <entry key="app/src/main/res/layout/item_xpstyle.xml" value="0.16055045871559634" />
+        <entry key="app/src/main/res/layout/software_version_activity.xml" value="0.20199275362318841" />
         <entry key="app/src/main/res/layout/view_cancel_sure.xml" value="0.1" />
         <entry key="app/src/main/res/layout/view_content.xml" value="0.19300911854103345" />
         <entry key="app/src/main/res/layout/view_empty.xml" value="0.1" />

+ 1 - 1
app/src/main/java/com/xplora/xpsettings/Activity/QRActivity.java

@@ -26,7 +26,7 @@ public class QRActivity extends Activity {
         String t = "t=X6";
         String bt = "bt=" + DataManager.getBTMac();
         String content = host + "?" + qr + "&" + c + "&" + t + "&" + bt;
-        content = Base64.getEncoder().encodeToString(content.getBytes(StandardCharsets.UTF_8));
+        //content = Base64.getEncoder().encodeToString(content.getBytes(StandardCharsets.UTF_8));
 
         qrIv.setImageBitmap(QRCodeUtil.createQRCodeBitmap(content, 240, 240));
     }

+ 0 - 3
app/src/main/java/com/xplora/xpsettings/Activity/ScreenTimeActivity.java

@@ -43,9 +43,6 @@ public class ScreenTimeActivity extends BaseActivity {
     @Override
     protected void onPause() {
         super.onPause();
-        if (lastValue != initValue) {
-            DataManager.sendLocalSocketIntent(DataManager.ACTION_SCREEN_TIME_CHANGED, lastValue);
-        }
     }
 
     private void initData() {

+ 18 - 3
app/src/main/java/com/xplora/xpsettings/Activity/SettingsActivity.java

@@ -7,6 +7,8 @@ import android.os.PowerManager;
 import android.widget.ListView;
 
 import com.xplora.xpsettings.Adapter.BaseListAdapter;
+import com.xplora.xpsettings.Fragment.SelectFragment;
+import com.xplora.xpsettings.Listener;
 import com.xplora.xpsettings.Model.BaseModel;
 import com.xplora.xpsettings.R;
 import com.xplora.xpsettings.Utils.Constant;
@@ -18,7 +20,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 
-public class SettingsActivity extends BaseActivity {
+public class SettingsActivity extends BaseActivity implements Listener.SelectFragmentListener {
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -71,10 +73,14 @@ public class SettingsActivity extends BaseActivity {
                 case 5:
                     break;
                 case 6:
-                    restart();
+                    SelectFragment fragment6 = SelectFragment.newInstance(this);
+                    fragment6.setItemInfo(6, getString(R.string.restart), getString(R.string.confirm_to_restart));
+                    fragment6.show(this.getFragmentManager(), Constant.PACKAGE_NAME);
                     break;
                 case 7:
-                    shutdown();
+                    SelectFragment fragment7 = SelectFragment.newInstance(this);
+                    fragment7.setItemInfo(7, getString(R.string.shut_down), getString(R.string.confirm_to_shut_down));
+                    fragment7.show(this.getFragmentManager(), Constant.PACKAGE_NAME);
                     break;
                 case 8:
                     intent = new Intent(this, AboutActivity.class);
@@ -98,6 +104,15 @@ public class SettingsActivity extends BaseActivity {
         });
     }
 
+    @Override
+    public void onSelectFragment(int type) {
+        if (type == 6) {
+            restart();
+        } else if (type == 7) {
+            shutdown();
+        }
+    }
+
     public void restart() {
         if (Macros.DEBUG) {
             return;

+ 6 - 5
app/src/main/java/com/xplora/xpsettings/Data/DataManager.java

@@ -344,11 +344,12 @@ public class DataManager extends Application {
     }
 
     public static String getBTMac() {
-        if (Macros.DEBUG) {
-            return "11:22:33:44:55";
-        } else {
-            return SystemProperties.get("persist.zs.bt.number", "");
-        }
+        return "E4:A3:2F:69:2C:6B";
+//        if (Macros.DEBUG) {
+//            return "11:22:33:44:55";
+//        } else {
+//            return SystemProperties.get("persist.zs.bt.number", "");
+//        }
     }
 
     public static String getWifiMac() {

+ 71 - 0
app/src/main/java/com/xplora/xpsettings/Fragment/SelectFragment.java

@@ -0,0 +1,71 @@
+package com.xplora.xpsettings.Fragment;
+
+import android.app.DialogFragment;
+import android.content.Context;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.TextView;
+
+import com.xplora.xpsettings.Activity.SettingsActivity;
+import com.xplora.xpsettings.Listener;
+import com.xplora.xpsettings.R;
+
+public class SelectFragment extends DialogFragment {
+    private Context mContext = null;
+    private int type = 0;
+    private String title = "";
+    private String content = "";
+
+    public static SelectFragment newInstance(Context context) {
+        SelectFragment fragment = new SelectFragment();
+        fragment.mContext = context;
+        return fragment;
+    }
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
+    }
+
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+        View rootView = inflater.inflate(R.layout.fragment_select, container, false);
+        TextView titleTv = (TextView)rootView.findViewById(R.id.mTitle);
+        TextView contentTv = (TextView)rootView.findViewById(R.id.mContent);
+        Button noButton = (Button)rootView.findViewById(R.id.mNoBtn);
+        Button yesButton = (Button)rootView.findViewById(R.id.mYesBtn);
+
+        titleTv.setText(title);
+        contentTv.setText(content);
+
+        yesButton.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                Listener.SelectFragmentListener listener = (Listener.SelectFragmentListener)mContext;
+                listener.onSelectFragment(type);
+                remove();
+            }
+        });
+        noButton.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                remove();
+            }
+        });
+        return rootView;
+    }
+
+    public void setItemInfo(int type, String title,  String content) {
+        this.type = type;
+        this.title = title;
+        this.content = content;
+    }
+
+    private void remove() {
+        dismissAllowingStateLoss();
+    }
+}

+ 8 - 0
app/src/main/java/com/xplora/xpsettings/Listener.java

@@ -0,0 +1,8 @@
+package com.xplora.xpsettings;
+
+public class Listener {
+    public interface SelectFragmentListener {
+        void onSelectFragment(int type);
+    }
+}
+

+ 68 - 0
app/src/main/res/layout/fragment_select.xml

@@ -0,0 +1,68 @@
+<?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="25dp"
+        android:textColor="@color/white"
+        android:textSize="15sp"
+        android:textFontWeight="700"
+        android:gravity="center"/>
+
+    <TextView
+        android:id="@+id/mContent"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="55dp"
+        android:textColor="@color/white"
+        android:textSize="11sp"
+        android:textFontWeight="400"
+        android:gravity="center"/>
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="28dp"
+        android:layout_marginBottom="14dp"
+        android:layout_alignParentBottom="true"
+        >
+
+        <Button
+            android:id="@+id/mNoBtn"
+            android:layout_width="85dp"
+            android:layout_height="match_parent"
+            android:layout_alignParentStart="true"
+            android:layout_centerVertical="true"
+            android:text="@string/button_cancel"
+            android:textSize="12sp"
+            android:textFontWeight="700"
+            android:fontFamily="Roboto"
+            android:paddingRight="15dp"
+            android:backgroundTint="@color/xp_red"
+            style="@style/xp_style_button_right"
+            />
+
+        <Button
+            android:id="@+id/mYesBtn"
+            android:layout_width="85dp"
+            android:layout_height="match_parent"
+            android:layout_alignParentEnd="true"
+            android:layout_centerVertical="true"
+            android:text="@string/button_yes"
+            android:textSize="12sp"
+            android:textFontWeight="700"
+            android:fontFamily="Roboto"
+            android:paddingLeft="15dp"
+            android:backgroundTint="@color/xp_green"
+            style="@style/xp_style_button_left"
+            />
+
+    </RelativeLayout>
+
+</RelativeLayout>

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

@@ -40,6 +40,11 @@
 
     <string name="sound_mode">Sound Mode</string>
 
+    <string name="restart">Restart</string>
+    <string name="shut_down">Shut down</string>
+    <string name="confirm_to_restart">Confirm to restart?</string>
+    <string name="confirm_to_shut_down">Confirm to shut down?</string>
+
     <string name="source_announcement_1">The software included in this product contains copyrighted software that is licensed under the GPL.</string>
     <string name="source_announcement_2">If you would like to obtain the complete corresponding source code for a period of two years after the last shipment of this product by sending an email to support@xplora.com</string>
 </resources>