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,6 +114,13 @@ class LoginActivity : BaseActivity<LoginViewModel, ActivityLoginBinding>() {
114 114
     override fun initView() {
115 115
         initFirstUse()
116 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 124
         mBinding.loginBtn.setOnClickListener {
118 125
             val rxPermissions = RxPermissions(this)
119 126
             //有无权限都要登录

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

@@ -819,7 +819,11 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(), Downloa
819 819
         updateMcApp()
820 820
         val appVersionCode = SystemUtil.getAppVersionCode(this, packageName)
821 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 827
         if (SystemUtil.isSuEnable()) {
824 828
             //root了则调用接口
825 829
             val data = LogdOperateBean()

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

@@ -172,6 +172,16 @@
172 172
             app:layout_constraintLeft_toLeftOf="parent"
173 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 185
             <LinearLayout
176 186
                 android:id="@+id/netset_llayout"
177 187
                 android:layout_width="wrap_content"

Loading…
Cancel
Save