Browse Source

1.区分平板禁用和非可用时段禁用

master
wangwanlei 11 months ago
parent
commit
7e959e6bd3

+ 2
- 2
app/src/main/java/com/xhly/manageapp/service/websocket/AppSocket.kt View File

@@ -94,13 +94,13 @@ class AppSocket : SocketClient() {
94 94
 
95 95
             Const.CODE2002.toString() -> {
96 96
                 Toast.makeText(context, "限制使用", Toast.LENGTH_LONG).show()
97
-                spUtils.setParam(Const.DISABLEAPP, true)
97
+                spUtils.setParam(Const.DISABLEPAD, true)
98 98
                 goMainActivity()
99 99
             }
100 100
 
101 101
             Const.CODE2003.toString() -> {
102 102
                 Toast.makeText(context, "解除限制", Toast.LENGTH_LONG).show()
103
-                spUtils.setParam(Const.DISABLEAPP, false)
103
+                spUtils.setParam(Const.DISABLEPAD, false)
104 104
                 goMainActivity()
105 105
             }
106 106
 

+ 2
- 3
app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt View File

@@ -60,7 +60,6 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
60 60
             startIntentActivity(LoginActivity().javaClass)
61 61
         }
62 62
         val getAppList1 = AppUtils.GetAppList(this)
63
-        spUtils.get(Const.DISABLEAPP)
64 63
         dataList.addAll(getAppList1)
65 64
         adapter = AppAdapter(this, dataList)
66 65
         mBinding.rv.layoutManager = GridLayoutManager(this, 6, GridLayoutManager.VERTICAL, false)
@@ -99,7 +98,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
99 98
             showEditDialog()
100 99
         }
101 100
         mBinding.stoptv.setOnClickListener {
102
-            spUtils.setParam(Const.DISABLEAPP, false)
101
+            spUtils.setParam(Const.DISABLEPAD, false)
103 102
         }
104 103
         onBackPressedDispatcher.addCallback {
105 104
             //屏蔽返回
@@ -124,7 +123,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
124 123
     private fun useStrategy() {
125 124
         //获得sputils中的数据设置状态,以及策略
126 125
         try {
127
-            var param = spUtils.getParam(Const.DISABLEAPP, false)
126
+            var param = spUtils.getParam(Const.DISABLEPAD, false)
128 127
             if (param as Boolean) {
129 128
                 mBinding.stoptv.visibility = View.VISIBLE
130 129
             } else {

+ 73
- 55
app/src/main/res/layout/activity_main.xml View File

@@ -6,67 +6,85 @@
6 6
     android:orientation="vertical"
7 7
     android:paddingTop="30dp">
8 8
 
9
-    <TextView
10
-        android:id="@+id/stoptv"
9
+    <FrameLayout
11 10
         android:layout_width="match_parent"
12
-        android:layout_height="match_parent"
13
-        android:gravity="center"
14
-        android:text="@string/stoptips"
15
-        android:textColor="@color/black"
16
-        android:textSize="20sp"
17
-        android:visibility="gone" />
11
+        android:layout_height="match_parent">
12
+        <LinearLayout
13
+            android:layout_width="match_parent"
14
+            android:layout_height="match_parent"
15
+            android:orientation="vertical">
18 16
 
19
-    <Button
20
-        android:id="@+id/btn"
21
-        android:layout_width="100dp"
22
-        android:layout_height="100dp"
23
-        android:text="管理页面"
24
-        android:visibility="visible"
25
-        />
17
+            <Button
18
+                android:id="@+id/btn"
19
+                android:layout_width="100dp"
20
+                android:layout_height="100dp"
21
+                android:text="管理页面"
22
+                android:visibility="visible" />
26 23
 
27
-    <Button
28
-        android:id="@+id/resetbtn"
29
-        android:layout_width="100dp"
30
-        android:layout_height="100dp"
31
-        android:text="重启"
32
-        android:visibility="gone" />
24
+            <Button
25
+                android:id="@+id/resetbtn"
26
+                android:layout_width="100dp"
27
+                android:layout_height="100dp"
28
+                android:text="重启"
29
+                android:visibility="gone" />
33 30
 
34
-    <LinearLayout
35
-        android:layout_width="match_parent"
36
-        android:layout_height="wrap_content"
37
-        android:layout_marginLeft="21dp"
38
-        android:layout_marginRight="21dp"
39
-        android:gravity="center_vertical"
40
-        android:orientation="horizontal">
31
+            <LinearLayout
32
+                android:layout_width="match_parent"
33
+                android:layout_height="wrap_content"
34
+                android:layout_marginLeft="21dp"
35
+                android:layout_marginRight="21dp"
36
+                android:gravity="center_vertical"
37
+                android:orientation="horizontal">
41 38
 
42
-        <TextView
43
-            android:layout_width="wrap_content"
44
-            android:layout_height="wrap_content"
45
-            android:text="姓名"
46
-            android:textColor="#253A70"
47
-            android:textSize="19sp" />
39
+                <TextView
40
+                    android:layout_width="wrap_content"
41
+                    android:layout_height="wrap_content"
42
+                    android:text="姓名"
43
+                    android:textColor="#253A70"
44
+                    android:textSize="19sp" />
48 45
 
49
-        <ImageView
50
-            android:id="@+id/loginout_iv"
51
-            android:layout_width="16dp"
52
-            android:layout_height="12dp"
53
-            android:layout_marginLeft="2dp"
54
-            android:src="@drawable/icon_fanhui" />
55
-    </LinearLayout>
46
+                <ImageView
47
+                    android:id="@+id/loginout_iv"
48
+                    android:layout_width="16dp"
49
+                    android:layout_height="12dp"
50
+                    android:layout_marginLeft="2dp"
51
+                    android:src="@drawable/icon_fanhui" />
52
+            </LinearLayout>
56 53
 
57
-    <TextView
58
-        android:layout_width="wrap_content"
59
-        android:layout_height="wrap_content"
60
-        android:layout_marginLeft="21dp"
61
-        android:layout_marginRight="21dp"
62
-        android:text="学校"
63
-        android:textColor="#798CB5"
64
-        android:textSize="15sp" />
54
+            <TextView
55
+                android:layout_width="wrap_content"
56
+                android:layout_height="wrap_content"
57
+                android:layout_marginLeft="21dp"
58
+                android:layout_marginRight="21dp"
59
+                android:text="学校"
60
+                android:textColor="#798CB5"
61
+                android:textSize="15sp" />
65 62
 
66
-    <androidx.recyclerview.widget.RecyclerView
67
-        android:id="@+id/rv"
68
-        android:layout_width="match_parent"
69
-        android:layout_height="match_parent"
70
-        android:layout_marginTop="24dp"
71
-        android:overScrollMode="never" />
63
+            <androidx.recyclerview.widget.RecyclerView
64
+                android:id="@+id/rv"
65
+                android:layout_width="match_parent"
66
+                android:layout_height="match_parent"
67
+                android:layout_marginTop="24dp"
68
+                android:overScrollMode="never" />
69
+        </LinearLayout>
70
+        <TextView
71
+            android:id="@+id/timestoptv"
72
+            android:layout_width="match_parent"
73
+            android:layout_height="match_parent"
74
+            android:gravity="center"
75
+            android:text="@string/stoptips"
76
+            android:textColor="@color/black"
77
+            android:textSize="20sp"
78
+            android:visibility="gone" />
79
+
80
+        <TextView
81
+            android:id="@+id/stoptv"
82
+            android:layout_width="match_parent"
83
+            android:layout_height="match_parent"
84
+            android:gravity="center"
85
+            android:text="@string/stoptips"
86
+            android:textColor="@color/black"
87
+            android:textSize="20sp"
88
+            android:visibility="gone" />
89
+    </FrameLayout>
72 90
 </LinearLayout>

+ 1
- 0
app/src/main/res/values/strings.xml View File

@@ -1,6 +1,7 @@
1 1
 <resources>
2 2
     <string name="app_name">XhlyManageApp</string>
3 3
     <string name="stoptips">已被禁用,无法操作</string>
4
+    <string name="timestoptips">当前时段不可用</string>
4 5
     <string name="inputaccount">请输入账号</string>
5 6
     <string name="inputcode">请输入密码</string>
6 7
     <string name="inputregioncode">请输入区域码</string>

+ 5
- 2
corelib/src/main/java/com/xhly/corelib/Const.kt View File

@@ -8,8 +8,11 @@ object Const {
8 8
     //接口地址
9 9
     const val WSURL: String = "wss://mcwstest.xhkjedu.com/ws"
10 10
 
11
-    //标记app禁用
12
-    const val DISABLEAPP = "DISABLEAPP"
11
+    //标记平板禁用
12
+    const val DISABLEPAD= "DISABLEPAD"
13
+
14
+    //标记平板在禁用或者使用的事件
15
+    const val DISABLEPADTIME= "DISABLEPADTIME"
13 16
 
14 17
     //作为存储白名单应用的key
15 18
     const val WHITELISTAPP = "WHITELISTAPP"

Loading…
Cancel
Save