Browse Source

1.添加正式版本和测试版本展示

20241218TB223FC(测试jar包)
wangwanlei 5 months ago
parent
commit
2778f5dc27

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

114
     override fun initView() {
114
     override fun initView() {
115
         initFirstUse()
115
         initFirstUse()
116
         setSoftInput(mBinding.root)
116
         setSoftInput(mBinding.root)
117
+        val appVersionCode = SystemUtil.getAppVersionCode(this, packageName)
118
+        val appVersionName = SystemUtil.getAppVersionName(this, packageName)
119
+        mBinding.versionTv.text =if (com.xhkjedu.manageapp.BuildConfig.IS_DEBUG){
120
+            "版本 v${appVersionName} (Build ${appVersionCode})正式版"
121
+        }else{
122
+            "版本 v${appVersionName} (Build ${appVersionCode})测试版"
123
+        }
117
         mBinding.loginBtn.setOnClickListener {
124
         mBinding.loginBtn.setOnClickListener {
118
             val rxPermissions = RxPermissions(this)
125
             val rxPermissions = RxPermissions(this)
119
             //有无权限都要登录
126
             //有无权限都要登录

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

819
         updateMcApp()
819
         updateMcApp()
820
         val appVersionCode = SystemUtil.getAppVersionCode(this, packageName)
820
         val appVersionCode = SystemUtil.getAppVersionCode(this, packageName)
821
         val appVersionName = SystemUtil.getAppVersionName(this, packageName)
821
         val appVersionName = SystemUtil.getAppVersionName(this, packageName)
822
-        mBinding.versionTv.text = "版本 v${appVersionName} (Build ${appVersionCode})"
822
+        mBinding.versionTv.text =if (com.xhkjedu.manageapp.BuildConfig.IS_DEBUG){
823
+            "版本 v${appVersionName} (Build ${appVersionCode})正式版"
824
+        }else{
825
+            "版本 v${appVersionName} (Build ${appVersionCode})测试版"
826
+        }
823
         if (SystemUtil.isSuEnable()) {
827
         if (SystemUtil.isSuEnable()) {
824
             //root了则调用接口
828
             //root了则调用接口
825
             val data = LogdOperateBean()
829
             val data = LogdOperateBean()

+ 10
- 0
app/src/main/res/layout/activity_login.xml View File

172
             app:layout_constraintLeft_toLeftOf="parent"
172
             app:layout_constraintLeft_toLeftOf="parent"
173
             app:layout_constraintRight_toRightOf="parent">
173
             app:layout_constraintRight_toRightOf="parent">
174
 
174
 
175
+            <TextView
176
+                android:id="@+id/version_tv"
177
+                android:layout_width="0dp"
178
+                android:layout_height="wrap_content"
179
+                android:layout_gravity="center_vertical"
180
+                android:layout_weight="1"
181
+                android:textColor="#253A70"
182
+                android:layout_marginLeft="10dp"
183
+                android:textSize="8sp" />
184
+
175
             <LinearLayout
185
             <LinearLayout
176
                 android:id="@+id/netset_llayout"
186
                 android:id="@+id/netset_llayout"
177
                 android:layout_width="wrap_content"
187
                 android:layout_width="wrap_content"

Loading…
Cancel
Save