Browse Source

1.修改登录页布局

20241218TB223FC(测试jar包)
wangwanlei 10 months ago
parent
commit
52d96b8541

+ 47
- 0
app/src/main/java/com/xhly/manageapp/ui/login/activity/LoginActivity.kt View File

@@ -34,6 +34,7 @@ import com.xhly.manageapp.bean.log.LogdOperateBean
34 34
 import com.xhly.manageapp.bean.user.UserBean
35 35
 import com.xhly.manageapp.contentprovider.ZSpProvider
36 36
 import com.xhly.manageapp.service.websocket.AppSocket
37
+import com.xhly.manageapp.ui.ManageActivity
37 38
 import com.xhly.manageapp.ui.login.viewmodel.LoginViewModel
38 39
 import com.xhly.manageapp.ui.main.activity.MainActivity
39 40
 import com.xhly.manageapp.utils.CurrentAppSharedPreferencesUtils
@@ -45,6 +46,8 @@ class LoginActivity : BaseActivity<LoginViewModel, ActivityLoginBinding>() {
45 46
     //单独创建sharedpreference用来存储初始化的应用
46 47
     private val currentSpUtils by lazy { CurrentAppSharedPreferencesUtils.getInstance(this) }
47 48
     private var regioncode = ""
49
+    //如果次数大于10则可以打开设置页面
50
+    private var showSettingNum=0
48 51
     override fun getBinding() = ActivityLoginBinding.inflate(layoutInflater)
49 52
 
50 53
     override fun initData() {
@@ -68,6 +71,11 @@ class LoginActivity : BaseActivity<LoginViewModel, ActivityLoginBinding>() {
68 71
             ManageApplication.setSysTime(it)
69 72
             Toast(getString(R.string.syncsucess))
70 73
         }
74
+        viewModel.controlResultData.observe(this){
75
+            if (it){
76
+                startIntentActivity(ManageActivity().javaClass)
77
+            }
78
+        }
71 79
         val exitControlFlag = currentSpUtils.getParam(Const.EXIT_CONTROL, false) as Boolean
72 80
         //如果解除管控为真,则不在执行以下代码
73 81
         if (!exitControlFlag){
@@ -112,6 +120,12 @@ class LoginActivity : BaseActivity<LoginViewModel, ActivityLoginBinding>() {
112 120
         mBinding.synctimeLlayout.setOnClickListener {
113 121
                viewModel.postSyncTime()
114 122
         }
123
+        mBinding.logoIv.setOnClickListener {
124
+            if (showSettingNum>10){
125
+                showSettingNum=0
126
+                showSettingDialog()
127
+            }
128
+        }
115 129
         onBackPressedDispatcher.addCallback {
116 130
             //屏蔽返回
117 131
         }
@@ -205,6 +219,7 @@ class LoginActivity : BaseActivity<LoginViewModel, ActivityLoginBinding>() {
205 219
                     val enterTv = v.findViewById<TextView>(R.id.dialog_enter_tv)
206 220
                     val cancelTv = v.findViewById<TextView>(R.id.dialog_cancel_tv)
207 221
                     val editText = v.findViewById<EditText>(R.id.dialog_et)
222
+                    val titleTv=v.findViewById<TextView>(R.id.dialog_title_tv)
208 223
                     enterTv.setOnClickListener {
209 224
                         dialog.dismiss()
210 225
                         val text = editText.text
@@ -219,6 +234,9 @@ class LoginActivity : BaseActivity<LoginViewModel, ActivityLoginBinding>() {
219 234
                     cancelTv.setOnClickListener {
220 235
                         dialog.dismiss()
221 236
                     }
237
+                    titleTv.setOnClickListener {
238
+                        showSettingNum++
239
+                    }
222 240
                 }
223 241
             }).setCancelable(false).setMaskColor(Color.parseColor("#66000000"))
224 242
             .setAlign(CustomDialog.ALIGN.CENTER).show()
@@ -355,6 +373,35 @@ class LoginActivity : BaseActivity<LoginViewModel, ActivityLoginBinding>() {
355 373
             }).setCancelable(false).setMaskColor(Color.parseColor("#66000000"))
356 374
             .setAlign(CustomDialog.ALIGN.CENTER).show()
357 375
     }
376
+    //弹出调用设置页面的dialog
377
+    private fun showSettingDialog() {
378
+        CustomDialog.build()
379
+            .setCustomView(object : OnBindView<CustomDialog>(R.layout.layout_edit_dialog) {
380
+                override fun onBind(dialog: CustomDialog, v: View) {
381
+                    val titleTv = v.findViewById<TextView>(R.id.dialog_title_tv)
382
+                    val enterTv = v.findViewById<TextView>(R.id.dialog_enter_tv)
383
+                    val cancelTv = v.findViewById<TextView>(R.id.dialog_cancel_tv)
384
+                    val editText = v.findViewById<EditText>(R.id.dialog_et)
385
+                    editText.hint = getString(R.string.inputcode)
386
+                    titleTv.text = getString(R.string.exitcontrol)
387
+                    enterTv.setOnClickListener {
388
+                        val code = editText.text
389
+                        if ((!code.isNullOrBlank()) && code.length >= 6) {
390
+                            dialog.dismiss()
391
+                            try {
392
+                                viewModel.postExitControl(code.toString())
393
+                            } catch (e: Exception) {
394
+
395
+                            }
396
+                        }
397
+                    }
398
+                    cancelTv.setOnClickListener {
399
+                        dialog.dismiss()
400
+                    }
401
+                }
402
+            }).setCancelable(false).setMaskColor(Color.parseColor("#66000000"))
403
+            .setAlign(CustomDialog.ALIGN.CENTER).show()
404
+    }
358 405
 
359 406
     private fun useTimeStrategy() {
360 407
         //获得sputils中的平板锁定策略

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

@@ -27,6 +27,7 @@ import androidx.work.WorkManager
27 27
 import com.bumptech.glide.Glide
28 28
 import com.bumptech.glide.request.target.CustomViewTarget
29 29
 import com.bumptech.glide.request.transition.Transition
30
+import com.hjq.toast.Toaster
30 31
 import com.kongzue.dialogx.dialogs.CustomDialog
31 32
 import com.kongzue.dialogx.interfaces.OnBindView
32 33
 import com.tbruyelle.rxpermissions2.RxPermissions
@@ -297,7 +298,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
297 298
             Const.backNum++
298 299
             if (Const.backNum>Const.UPDATESTRATEGYNUM){
299 300
                 Const.backNum=0
300
-                Toast("开始请求策略")
301
+                Toaster.show(R.string.updatetips)
301 302
                 updateAllStrategy()
302 303
             }
303 304
         }

+ 74
- 57
app/src/main/res/layout/activity_login.xml View File

@@ -40,13 +40,27 @@
40 40
                 android:layout_height="match_parent">
41 41
 
42 42
                 <ImageView
43
+                    android:id="@+id/logo_iv"
43 44
                     android:layout_width="wrap_content"
44 45
                     android:layout_height="37dp"
45 46
                     android:src="@drawable/ic_manageapp_launcher"
46 47
                     app:layout_constraintLeft_toLeftOf="parent"
47
-                    app:layout_constraintRight_toRightOf="parent"
48
+                    app:layout_constraintRight_toLeftOf="@id/logo_tv"
49
+                    app:layout_constraintHorizontal_chainStyle="packed"
48 50
                     app:layout_constraintTop_toTopOf="parent" />
49 51
 
52
+                <TextView
53
+                    android:id="@+id/logo_tv"
54
+                    android:layout_width="wrap_content"
55
+                    android:layout_height="37dp"
56
+                    android:gravity="center"
57
+                    android:text="星火云鸽"
58
+                    android:textColor="@color/codetipscolor"
59
+                    android:textSize="20sp"
60
+                    app:layout_constraintLeft_toRightOf="@id/logo_iv"
61
+                    app:layout_constraintRight_toRightOf="parent"
62
+                    app:layout_constraintTop_toTopOf="@id/logo_iv" />
63
+
50 64
                 <ImageView
51 65
                     android:layout_width="22dp"
52 66
                     android:layout_height="22dp"
@@ -64,11 +78,11 @@
64 78
                     android:background="@null"
65 79
                     android:gravity="center_vertical"
66 80
                     android:hint="@string/inputaccount"
81
+                    android:maxLength="20"
67 82
                     android:singleLine="true"
68 83
                     android:textColor="@color/black"
69 84
                     android:textColorHint="#FFB8C2D9"
70 85
                     android:textSize="21sp"
71
-                    android:maxLength="20"
72 86
                     app:layout_constraintLeft_toLeftOf="parent"
73 87
                     app:layout_constraintRight_toRightOf="parent"
74 88
                     app:layout_constraintTop_toTopOf="parent" />
@@ -101,11 +115,11 @@
101 115
                     android:gravity="center_vertical"
102 116
                     android:hint="@string/inputcode"
103 117
                     android:inputType="numberPassword"
118
+                    android:maxLength="20"
104 119
                     android:singleLine="true"
105 120
                     android:textColor="@color/black"
106 121
                     android:textColorHint="#FFB8C2D9"
107 122
                     android:textSize="21sp"
108
-                    android:maxLength="20"
109 123
                     app:layout_constraintLeft_toLeftOf="parent"
110 124
                     app:layout_constraintRight_toRightOf="parent"
111 125
                     app:layout_constraintTop_toTopOf="parent" />
@@ -131,60 +145,62 @@
131 145
                     app:layout_constraintLeft_toLeftOf="parent"
132 146
                     app:layout_constraintRight_toRightOf="parent"
133 147
                     app:layout_constraintTop_toTopOf="parent" />
134
-
135
-                <LinearLayout
136
-                    android:layout_width="match_parent"
137
-                    android:layout_height="wrap_content"
138
-                    android:layout_marginTop="10dp"
139
-                    android:gravity="center"
140
-                    android:orientation="horizontal"
141
-                    app:layout_constraintLeft_toLeftOf="parent"
142
-                    app:layout_constraintRight_toRightOf="parent"
143
-                    app:layout_constraintTop_toBottomOf="@id/login_btn">
144
-
145
-                    <LinearLayout
146
-                        android:id="@+id/netset_llayout"
147
-                        android:layout_width="wrap_content"
148
-                        android:layout_height="wrap_content"
149
-                        android:layout_marginRight="29dp"
150
-                        android:gravity="center"
151
-                        android:orientation="horizontal">
152
-
153
-                        <ImageView
154
-                            android:layout_width="21dp"
155
-                            android:layout_height="21dp"
156
-                            android:src="@drawable/icon_wifiset" />
157
-
158
-                        <TextView
159
-                            android:layout_width="wrap_content"
160
-                            android:layout_height="wrap_content"
161
-                            android:text="@string/netset"
162
-                            android:textColor="@color/codetipscolor"
163
-                            android:textSize="19sp" />
164
-                    </LinearLayout>
165
-
166
-                    <LinearLayout
167
-                        android:id="@+id/synctime_llayout"
168
-                        android:layout_width="wrap_content"
169
-                        android:layout_height="wrap_content"
170
-                        android:gravity="center"
171
-                        android:orientation="horizontal">
172
-
173
-                        <ImageView
174
-                            android:layout_width="21dp"
175
-                            android:layout_height="21dp"
176
-                            android:src="@drawable/icon_synctime" />
177
-
178
-                        <TextView
179
-                            android:layout_width="wrap_content"
180
-                            android:layout_height="wrap_content"
181
-                            android:text="@string/synctime"
182
-                            android:textColor="@color/codetipscolor"
183
-                            android:textSize="19sp" />
184
-                    </LinearLayout>
185
-                </LinearLayout>
186 148
             </androidx.constraintlayout.widget.ConstraintLayout>
187 149
         </androidx.core.widget.NestedScrollView>
150
+
151
+        <LinearLayout
152
+            android:layout_width="match_parent"
153
+            android:layout_height="wrap_content"
154
+            android:layout_marginBottom="10dp"
155
+            android:gravity="center_vertical|right"
156
+            android:orientation="horizontal"
157
+            app:layout_constraintBottom_toBottomOf="parent"
158
+            app:layout_constraintLeft_toLeftOf="parent"
159
+            app:layout_constraintRight_toRightOf="parent">
160
+
161
+            <LinearLayout
162
+                android:id="@+id/netset_llayout"
163
+                android:layout_width="wrap_content"
164
+                android:layout_height="wrap_content"
165
+                android:layout_marginRight="10dp"
166
+                android:gravity="center"
167
+                android:orientation="horizontal">
168
+
169
+                <ImageView
170
+                    android:layout_width="11dp"
171
+                    android:layout_height="11dp"
172
+                    android:src="@drawable/icon_wifiset" />
173
+
174
+                <TextView
175
+                    android:layout_width="wrap_content"
176
+                    android:layout_height="wrap_content"
177
+                    android:text="@string/netset"
178
+                    android:textColor="#798CB5"
179
+                    android:textSize="8sp" />
180
+            </LinearLayout>
181
+
182
+            <LinearLayout
183
+                android:id="@+id/synctime_llayout"
184
+                android:layout_width="wrap_content"
185
+                android:layout_height="wrap_content"
186
+                android:layout_marginRight="10dp"
187
+                android:gravity="center"
188
+                android:orientation="horizontal">
189
+
190
+                <ImageView
191
+                    android:layout_width="11dp"
192
+                    android:layout_height="11dp"
193
+                    android:src="@drawable/icon_synctime" />
194
+
195
+                <TextView
196
+                    android:layout_width="wrap_content"
197
+                    android:layout_height="wrap_content"
198
+                    android:text="@string/synctime"
199
+                    android:textColor="#798CB5"
200
+                    android:textSize="8sp" />
201
+            </LinearLayout>
202
+        </LinearLayout>
203
+
188 204
     </androidx.constraintlayout.widget.ConstraintLayout>
189 205
 
190 206
     <LinearLayout
@@ -193,7 +209,8 @@
193 209
         android:layout_height="match_parent"
194 210
         android:background="@drawable/main_bg"
195 211
         android:gravity="center_horizontal"
196
-        android:orientation="vertical">
212
+        android:orientation="vertical"
213
+        >
197 214
 
198 215
         <ImageView
199 216
             android:layout_width="157dp"
@@ -212,10 +229,10 @@
212 229
                 android:layout_height="53dp"
213 230
                 android:background="@drawable/shape_shadow_bg"
214 231
                 android:hint="@string/passcode"
232
+                android:maxLength="20"
215 233
                 android:paddingLeft="28dp"
216 234
                 android:paddingRight="28dp"
217 235
                 android:singleLine="true"
218
-                android:maxLength="20"
219 236
                 android:textColor="@color/codetipscolor"
220 237
                 android:textColorHint="@color/codehintcolor"
221 238
                 android:textSize="16sp" />

Loading…
Cancel
Save