...
|
...
|
@@ -33,10 +33,13 @@ import com.studymachine.www.BuildConfig; |
33
|
33
|
import com.studymachine.www.R;
|
34
|
34
|
import com.studymachine.www.aop.CheckNet;
|
35
|
35
|
import com.studymachine.www.app.AppActivity;
|
|
36
|
+import com.studymachine.www.app.AppPresentation;
|
|
37
|
+import com.studymachine.www.domain.AiDTO;
|
36
|
38
|
import com.studymachine.www.event.DictionariesEvent;
|
37
|
39
|
import com.studymachine.www.event.NetworkEvent;
|
38
|
40
|
import com.studymachine.www.http.api.HostApi;
|
39
|
41
|
import com.studymachine.www.http.api.LoginApi;
|
|
42
|
+import com.studymachine.www.http.api.PointDetailApi;
|
40
|
43
|
import com.studymachine.www.http.api.UpdateVersionApi;
|
41
|
44
|
import com.studymachine.www.http.api.UserInfoApi;
|
42
|
45
|
import com.studymachine.www.http.model.HttpData;
|
...
|
...
|
@@ -53,7 +56,10 @@ import com.studymachine.www.other.ScreenUtils; |
53
|
56
|
import com.studymachine.www.other.Tool;
|
54
|
57
|
import com.studymachine.www.other.WebUrlConfig;
|
55
|
58
|
import com.studymachine.www.ui.dialog.UpdateDialog;
|
|
59
|
+import com.studymachine.www.ui.presentation.AiListPresentation;
|
|
60
|
+import com.studymachine.www.ui.presentation.BrowserPresentation;
|
56
|
61
|
import com.studymachine.www.ui.presentation.SplashPresentation;
|
|
62
|
+import com.studymachine.www.ui.presentation.SwitchInfoPresentation;
|
57
|
63
|
import com.studymachine.www.ui.presentation.WebPresentation;
|
58
|
64
|
import com.tencent.mmkv.MMKV;
|
59
|
65
|
|
...
|
...
|
@@ -66,6 +72,13 @@ import timber.log.Timber; |
66
|
72
|
* desc : 闪屏界面
|
67
|
73
|
*/
|
68
|
74
|
public final class SplashActivity extends AppActivity {
|
|
75
|
+ private SplashPresentation splashPresentation;
|
|
76
|
+ private AiListPresentation aiListPresentation;
|
|
77
|
+ private BrowserPresentation browserPresentation;
|
|
78
|
+ private SwitchInfoPresentation switchInfoPresentation;
|
|
79
|
+ private WebPresentation webPresentation;
|
|
80
|
+ private String mPointId;
|
|
81
|
+ public PointDetailApi.Bean<AiDTO> mPointDetail;
|
69
|
82
|
|
70
|
83
|
@Override
|
71
|
84
|
protected int getLayoutId() {
|
...
|
...
|
@@ -93,18 +106,17 @@ public final class SplashActivity extends AppActivity { |
93
|
106
|
@Override
|
94
|
107
|
public void onSucceed(HttpData<HostApi.Bean> result) {
|
95
|
108
|
if (result.getData() != null) {
|
96
|
|
-// if (AppConfig.isDebug()) {
|
97
|
|
-// AppConfig.setHostUrl("http://192.168.1.23:8100/");
|
98
|
|
-// AppConfig.setWebHostUrl("http://192.168.1.26:8086/");
|
99
|
|
-// } else {
|
100
|
|
-// AppConfig.setHostUrl(result.getData().getApi());
|
101
|
|
-// AppConfig.setWebHostUrl(result.getData().getH5Url());
|
102
|
|
-// }
|
|
109
|
+ if (AppConfig.isDebug()) {
|
|
110
|
+ AppConfig.setHostUrl("https://api.veln.cn/");
|
|
111
|
+ AppConfig.setWebHostUrl("https://h5.veln.cn/");
|
|
112
|
+ } else {
|
|
113
|
+ AppConfig.setHostUrl(result.getData().getApi());
|
|
114
|
+ AppConfig.setWebHostUrl(result.getData().getH5Url());
|
|
115
|
+ }
|
103
|
116
|
// AppConfig.setHostUrl(result.getData().getApi());
|
104
|
117
|
// AppConfig.setWebHostUrl(result.getData().getH5Url());
|
105
|
|
- AppConfig.setHostUrl("https://api.veln.cn/");
|
106
|
|
- AppConfig.setWebHostUrl("https://h5.veln.cn/");
|
107
|
|
-// Tool.updateVersion(getContext());
|
|
118
|
+
|
|
119
|
+ Tool.updateVersion(getContext());
|
108
|
120
|
initConfig();
|
109
|
121
|
}
|
110
|
122
|
}
|
...
|
...
|
@@ -125,6 +137,42 @@ public final class SplashActivity extends AppActivity { |
125
|
137
|
|
126
|
138
|
@Override
|
127
|
139
|
protected void initData() {
|
|
140
|
+ if (deviceInfo != null && deviceInfo.getSn() != null) {
|
|
141
|
+ mControlBack = findViewById(R.id.control_back);
|
|
142
|
+ mControlChange = findViewById(R.id.control_change);
|
|
143
|
+ mControlMode = findViewById(R.id.control_mode);
|
|
144
|
+ mControlBack.setVisibility(View.VISIBLE);
|
|
145
|
+ mControlChange.setVisibility(View.VISIBLE);
|
|
146
|
+ mControlMode.setVisibility(View.VISIBLE);
|
|
147
|
+ mControlLine = findViewById(R.id.control_line);
|
|
148
|
+// mControlBack.setOnClickListener(new View.OnClickListener() {
|
|
149
|
+// @Override
|
|
150
|
+// public void onClick(View v) {
|
|
151
|
+// finish();
|
|
152
|
+// if (presentation != null) {
|
|
153
|
+// presentation.dismiss();
|
|
154
|
+// }
|
|
155
|
+// }
|
|
156
|
+// });
|
|
157
|
+// mControlChange.setOnClickListener(new View.OnClickListener() {
|
|
158
|
+// @Override
|
|
159
|
+// public void onClick(View v) {
|
|
160
|
+// SwitchInfoActivity.start(getContext());
|
|
161
|
+// if (presentation != null) {
|
|
162
|
+// presentation.dismiss();
|
|
163
|
+// }
|
|
164
|
+// }
|
|
165
|
+// });
|
|
166
|
+// mControlMode.setOnClickListener(new View.OnClickListener() {
|
|
167
|
+// @Override
|
|
168
|
+// public void onClick(View v) {
|
|
169
|
+// if (presentation != null) {
|
|
170
|
+// presentation.changeMode();
|
|
171
|
+// }
|
|
172
|
+// }
|
|
173
|
+// });
|
|
174
|
+// return;
|
|
175
|
+// }
|
128
|
176
|
getHost();
|
129
|
177
|
}
|
130
|
178
|
|
...
|
...
|
@@ -145,11 +193,8 @@ public final class SplashActivity extends AppActivity { |
145
|
193
|
public void onSucceed() {
|
146
|
194
|
AccountManager.getInstance().addAccountMap(phone, "000000");
|
147
|
195
|
postDelayed(() -> {
|
148
|
|
- SwitchInfoActivity.start(getContext());
|
149
|
|
- // 销毁除了首页之外的 Activity
|
150
|
|
- ActivityManager.getInstance().finishAllActivities(SwitchInfoActivity.class);
|
151
|
|
- finish();
|
152
|
|
- presentation.dismiss();
|
|
196
|
+ splashPresentation.dismiss();
|
|
197
|
+ openPresentation(browserPresentation);
|
153
|
198
|
}, 1000);
|
154
|
199
|
}
|
155
|
200
|
|
...
|
...
|
@@ -169,31 +214,30 @@ public final class SplashActivity extends AppActivity { |
169
|
214
|
UserManager.getInstance().getUserInfo();
|
170
|
215
|
// 刷新用户信息
|
171
|
216
|
String grade = UserManager.getInstance().getUserBean().getGrade();
|
172
|
|
- if ( TextUtils.isEmpty(grade)) {
|
173
|
|
- SwitchInfoActivity.start(this);
|
174
|
|
- // 销毁除了首页之外的 Activity
|
175
|
|
- ActivityManager.getInstance().finishAllActivities(SwitchInfoActivity.class);
|
176
|
|
- finish();
|
177
|
|
- presentation.dismiss();
|
|
217
|
+ if (TextUtils.isEmpty(grade)) {
|
|
218
|
+ splashPresentation.dismiss();
|
178
|
219
|
} else {
|
179
|
|
- BrowserActivity.start(getContext(),"https://preview.inibiru.com/creator/custom/index.html?id=12242");
|
|
220
|
+ BrowserActivity.start(getContext(), "https://preview.inibiru.com/creator/custom/index.html?id=12242");
|
180
|
221
|
ActivityManager.getInstance().finishAllActivities(BrowserActivity.class);
|
181
|
222
|
finish();
|
182
|
|
- presentation.dismiss();
|
|
223
|
+ splashPresentation.dismiss();
|
183
|
224
|
}
|
184
|
225
|
}
|
185
|
226
|
}
|
186
|
227
|
|
187
|
228
|
@Override
|
188
|
229
|
public boolean dispatchTouchEvent(MotionEvent ev) {
|
189
|
|
- if (presentation != null) {
|
190
|
|
- return presentation.onTouchEvent(ev);
|
|
230
|
+ float y = mControlLine.getY();
|
|
231
|
+ if (ev.getY() < y){
|
|
232
|
+ return super.dispatchTouchEvent(ev);
|
|
233
|
+ }
|
|
234
|
+
|
|
235
|
+ if (splashPresentation != null) {
|
|
236
|
+ return splashPresentation.onTouchEvent(ev);
|
191
|
237
|
}
|
192
|
238
|
return super.dispatchTouchEvent(ev);
|
193
|
239
|
}
|
194
|
240
|
|
195
|
|
- private SplashPresentation presentation;
|
196
|
|
-
|
197
|
241
|
@NonNull
|
198
|
242
|
@Override
|
199
|
243
|
protected ImmersionBar createStatusBarConfig() {
|
...
|
...
|
@@ -209,11 +253,38 @@ public final class SplashActivity extends AppActivity { |
209
|
253
|
}
|
210
|
254
|
|
211
|
255
|
public void openAppPresentation() {
|
|
256
|
+ if (null == splashPresentation) {
|
|
257
|
+ DisplayManager mDisplayManage = (DisplayManager) this.getSystemService(Context.DISPLAY_SERVICE);
|
|
258
|
+ Display[] displayList = mDisplayManage.getDisplays();
|
|
259
|
+ if (displayList.length > 1) {
|
|
260
|
+ splashPresentation = new SplashPresentation(this, displayList[1]);
|
|
261
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {//8.0
|
|
262
|
+ splashPresentation.getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
|
|
263
|
+ } else {
|
|
264
|
+ splashPresentation.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY);
|
|
265
|
+ }
|
|
266
|
+ }
|
|
267
|
+ }
|
|
268
|
+ splashPresentation.setOwnerActivity(this);
|
|
269
|
+ splashPresentation.show();
|
|
270
|
+ }
|
|
271
|
+
|
|
272
|
+ public void openPresentation(AppPresentation presentation) {
|
212
|
273
|
if (null == presentation) {
|
213
|
274
|
DisplayManager mDisplayManage = (DisplayManager) this.getSystemService(Context.DISPLAY_SERVICE);
|
214
|
275
|
Display[] displayList = mDisplayManage.getDisplays();
|
215
|
276
|
if (displayList.length > 1) {
|
216
|
|
- presentation = new SplashPresentation(this, displayList[1]);
|
|
277
|
+ if (presentation instanceof SplashPresentation) {
|
|
278
|
+ presentation = new SplashPresentation(this, displayList[1]);
|
|
279
|
+ } else if (presentation instanceof BrowserPresentation) {
|
|
280
|
+ presentation = new BrowserPresentation(this, displayList[1], "https://preview.inibiru.com/creator/custom/index.html?id=12242");
|
|
281
|
+ } else if (presentation instanceof AiListPresentation) {
|
|
282
|
+ presentation = new AiListPresentation(this, displayList[1]);
|
|
283
|
+ } else if (presentation instanceof SwitchInfoPresentation) {
|
|
284
|
+ presentation = new SwitchInfoPresentation(this, displayList[1]);
|
|
285
|
+ } else if (presentation instanceof WebPresentation) {
|
|
286
|
+ presentation = new WebPresentation(getContext(), displayList[1], mPointId, mPointDetail);
|
|
287
|
+ }
|
217
|
288
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {//8.0
|
218
|
289
|
presentation.getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
|
219
|
290
|
} else {
|
...
|
...
|
@@ -248,6 +319,6 @@ public final class SplashActivity extends AppActivity { |
248
|
319
|
// 因为修复了一个启动页被重复启动的问题,所以有可能 Activity 还没有初始化完成就已经销毁了
|
249
|
320
|
// 所以如果需要在此处释放对象资源需要先对这个对象进行判空,否则可能会导致空指针异常
|
250
|
321
|
super.onDestroy();
|
251
|
|
- presentation.dismiss();
|
|
322
|
+ splashPresentation.dismiss();
|
252
|
323
|
}
|
253
|
324
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|