|
@@ -1,6 +1,7 @@
|
1
|
1
|
package com.xhly.manageapp
|
2
|
2
|
|
3
|
3
|
import DownLoadUtils
|
|
4
|
+import android.content.ComponentName
|
4
|
5
|
import android.content.Context
|
5
|
6
|
import android.content.Intent
|
6
|
7
|
import android.provider.Settings
|
|
@@ -14,10 +15,14 @@ import com.xhly.corelib.Const
|
14
|
15
|
import com.xhly.corelib.bean.AppInfo
|
15
|
16
|
import com.xhly.corelib.eventbus.UIEvent
|
16
|
17
|
import com.xhly.corelib.utils.AppUtils
|
|
18
|
+import com.xhly.corelib.utils.GsonUtils
|
17
|
19
|
import com.xhly.corelib.utils.LogShow
|
18
|
20
|
import com.xhly.corelib.utils.ModelNameUtils
|
19
|
21
|
import com.xhly.corelib.utils.NetworkUtils
|
|
22
|
+import com.xhly.corelib.utils.SharedPreferencesUtils
|
20
|
23
|
import com.xhly.corelib.utils.SystemUtil
|
|
24
|
+import com.xhly.manageapp.bean.scheme.AutoAppBean
|
|
25
|
+import com.xhly.manageapp.bean.user.UserBean
|
21
|
26
|
import com.xhly.manageapp.utils.InstallUtils
|
22
|
27
|
import com.xhly.manageapp.utils.StrategyUtils
|
23
|
28
|
import java.util.Calendar
|
|
@@ -29,6 +34,8 @@ class AppAdapter(var context: Context, var data: ArrayList<AppInfo>) :
|
29
|
34
|
var lastTimeLong=0L
|
30
|
35
|
//用来判断1s内的连点
|
31
|
36
|
var lastClickLong=0L
|
|
37
|
+ var userBean:UserBean?=null
|
|
38
|
+ val spUtils by lazy { SharedPreferencesUtils.getInstance(context) }
|
32
|
39
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AppViewHolder {
|
33
|
40
|
val inflate = ItemAppBinding.inflate(LayoutInflater.from(context), parent, false)
|
34
|
41
|
return AppViewHolder(inflate)
|
|
@@ -136,13 +143,53 @@ class AppAdapter(var context: Context, var data: ArrayList<AppInfo>) :
|
136
|
143
|
Toaster.show("应用正在安装,请稍后")
|
137
|
144
|
return@setOnClickListener
|
138
|
145
|
}
|
139
|
|
- var instance = Calendar.getInstance()
|
|
146
|
+ val instance = Calendar.getInstance()
|
140
|
147
|
instance.set(Calendar.HOUR_OF_DAY, 11)
|
141
|
148
|
instance.set(Calendar.MINUTE, 0)
|
142
|
149
|
/* context.startActivity(appInfo.intent)*/
|
143
|
150
|
val appTimeStrategy = StrategyUtils.getAppTimeStrategy(context, appInfo.packageName)
|
144
|
151
|
if (appTimeStrategy){
|
145
|
|
- context.startActivity(appInfo.intent)
|
|
152
|
+ //然后根据自动拉起和单点登录判断打开时是否传递登录数据
|
|
153
|
+ if (userBean!=null){
|
|
154
|
+ userBean?.let {
|
|
155
|
+ if (it.sso==2){
|
|
156
|
+ //单点登录则传递数据,否则不传递,单点登录同样有两种情况,一种是拉起,一种是不拉起,拉起的则指定页面跳转,否则不指定
|
|
157
|
+ val autoAppBean = spUtils.getFromJson(
|
|
158
|
+ Const.AUTOAPPKEY,
|
|
159
|
+ AutoAppBean().javaClass
|
|
160
|
+ ) as? AutoAppBean
|
|
161
|
+ if (autoAppBean!=null){
|
|
162
|
+ val launchIntent = Intent()
|
|
163
|
+ launchIntent.setComponent(
|
|
164
|
+ ComponentName(
|
|
165
|
+ autoAppBean.appPackage!!,
|
|
166
|
+ autoAppBean.authUrl!!
|
|
167
|
+ )
|
|
168
|
+ )
|
|
169
|
+ launchIntent.putExtra("authType", autoAppBean.authType)
|
|
170
|
+ userBean?.let {
|
|
171
|
+ val parseClassToJson = GsonUtils.parseClassToJson(it)
|
|
172
|
+ launchIntent.putExtra("authData", parseClassToJson)
|
|
173
|
+ }
|
|
174
|
+ context.startActivity(launchIntent)
|
|
175
|
+ }else{
|
|
176
|
+ //单点不拉起,则传递数据,但是不指定页面专挑
|
|
177
|
+ val intent = appInfo.intent
|
|
178
|
+ intent.putExtra("authType", userBean?.authType)
|
|
179
|
+ userBean?.let {
|
|
180
|
+ val parseClassToJson = GsonUtils.parseClassToJson(it)
|
|
181
|
+ intent.putExtra("authData", parseClassToJson)
|
|
182
|
+ }
|
|
183
|
+ context.startActivity(intent)
|
|
184
|
+ }
|
|
185
|
+ }else{
|
|
186
|
+ //非单点登录还走之前的跳转
|
|
187
|
+ context.startActivity(appInfo.intent)
|
|
188
|
+ }
|
|
189
|
+ }
|
|
190
|
+ }else{
|
|
191
|
+ context.startActivity(appInfo.intent)
|
|
192
|
+ }
|
146
|
193
|
}else{
|
147
|
194
|
Toaster.showLong(context.getString(R.string.apptimestoptips))
|
148
|
195
|
}
|