29
29
import com .aries .library .fast .i .ActivityKeyEventControl ;
30
30
import com .aries .library .fast .impl .FastActivityLifecycleCallbacks ;
31
31
import com .aries .library .fast .manager .LoggerManager ;
32
- import com .aries .library .fast .manager .RxJavaManager ;
33
- import com .aries .library .fast .retrofit .FastObserver ;
34
32
import com .aries .library .fast .util .FastStackUtil ;
35
33
import com .aries .library .fast .util .FastUtil ;
36
34
import com .aries .library .fast .util .SizeUtil ;
@@ -177,35 +175,6 @@ public void setContentViewBackground(View contentView, Class<?> cls) {
177
175
}
178
176
}
179
177
180
- /**
181
- * 设置屏幕方向--注意targetSDK设置27以上不能设置windowIsTranslucent=true属性不然应用直接崩溃-强烈建议手机应用锁定竖屏
182
- * 错误为 Only fullscreen activities can request orientation
183
- * 默认自动 ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
184
- * 竖屏 ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
185
- * 横屏 ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
186
- * {@link ActivityInfo#screenOrientation ActivityInfo.screenOrientation}
187
- *
188
- * @param activity
189
- */
190
- @ Override
191
- public void setRequestedOrientation (Activity activity ) {
192
- LoggerManager .i ("setRequestedOrientation:" + activity .getClass ().getSimpleName () + ";:" + (BaseActivity .class .isAssignableFrom (activity .getClass ()))
193
- + ";:" + (UniversalActivity .class .isAssignableFrom (activity .getClass ())));
194
- if (BaseActivity .class .isAssignableFrom (activity .getClass ())) {
195
- return ;
196
- }
197
- //全局控制屏幕横竖屏
198
- //先判断xml没有设置屏幕模式避免将开发者本身想设置的覆盖掉
199
- if (activity .getRequestedOrientation () == ActivityInfo .SCREEN_ORIENTATION_UNSPECIFIED ) {
200
- try {
201
- activity .setRequestedOrientation (ActivityInfo .SCREEN_ORIENTATION_PORTRAIT );
202
- } catch (Exception e ) {
203
- e .printStackTrace ();
204
- LoggerManager .e (TAG , "setRequestedOrientation:" + e .getMessage ());
205
- }
206
- }
207
- }
208
-
209
178
/**
210
179
* 设置非FastLib且未实现Activity 状态栏功能的三方Activity 状态栏沉浸
211
180
*
@@ -219,6 +188,8 @@ public boolean setStatusBar(Activity activity, StatusViewHelper helper, View top
219
188
boolean isSupportStatusBarFont = StatusBarUtil .isSupportStatusBarFontChange ();
220
189
helper .setTransEnable (isSupportStatusBarFont || isLeak (activity ))
221
190
.setPlusStatusViewEnable (!isLeak (activity ))
191
+ .setStatusBarLightMode (isSupportStatusBarFont )
192
+ .setStatusViewColor (Color .argb (isSupportStatusBarFont ?0 :102 ,0 ,0 ,0 ))
222
193
.setStatusLayoutColor (Color .WHITE );
223
194
setStatusBarActivity (activity );
224
195
return true ;
@@ -239,23 +210,30 @@ public boolean setNavigationBar(Activity activity, NavigationViewHelper helper,
239
210
//其它默认属性请参考FastLifecycleCallbacks
240
211
helper .setLogEnable (BuildConfig .DEBUG )
241
212
.setTransEnable (true )
242
- .setPlusNavigationViewEnable (isPlusView (activity ))
213
+ .setPlusNavigationViewEnable (true , ! isPlusView (activity ), true )
243
214
.setNavigationBarLightMode (isDarkIcon () && isPlusView (activity ))
244
215
//FastLib默认在可变导航栏icon 增加一个0.5dp的灰色分割线
245
216
.setNavigationViewDrawableTop (null )
246
- .setOnKeyboardVisibilityChangedListener (mOnKeyboardVisibilityChangedListener )
217
+ .setOnKeyboardVisibilityChangedListener (getOnKeyboardVisibilityChangedListener ( activity ) )
247
218
.setBottomView (PicturePreviewActivity .class .isAssignableFrom (activity .getClass ()) ?
248
219
FindViewUtil .getTargetView (bottomView , R .id .select_bar_layout ) : bottomView )
249
220
.setNavigationViewColor (isLeak (activity ) ? Color .BLACK : Color .argb (isDarkIcon () && isPlusView (activity ) ? 0 : 102 , 0 , 0 , 0 ))
250
- .setNavigationLayoutColor (ContextCompat .getColor (activity , R .color .colorTabBackground ));
221
+ .setNavigationLayoutColor (ContextCompat .getColor (activity , ! isPlusView ( activity ) ? R . color . transparent : R .color .colorTabBackground ));
251
222
if (!isControlNavigation () && !(activity instanceof MainActivity )) {
252
223
KeyboardHelper .with (activity )
253
224
.setEnable ()
254
- .setOnKeyboardVisibilityChangedListener (mOnKeyboardVisibilityChangedListener );
225
+ .setOnKeyboardVisibilityChangedListener (getOnKeyboardVisibilityChangedListener ( activity ) );
255
226
}
256
227
return isControlNavigation ();
257
228
}
258
229
230
+ private KeyboardHelper .OnKeyboardVisibilityChangedListener getOnKeyboardVisibilityChangedListener (Activity activity ) {
231
+ if (activity instanceof KeyboardHelper .OnKeyboardVisibilityChangedListener ) {
232
+ return (KeyboardHelper .OnKeyboardVisibilityChangedListener ) activity ;
233
+ }
234
+ return mOnKeyboardVisibilityChangedListener ;
235
+ }
236
+
259
237
/**
260
238
* 是否全透明-华为4.1以上、小米V6以上及Android O以上版本
261
239
* 可根据导航栏位置颜色设置导航图标颜色
@@ -285,6 +263,34 @@ protected boolean isPlusView(Activity activity) {
285
263
return false ;
286
264
};
287
265
266
+ /**
267
+ * 设置屏幕方向--注意targetSDK设置27以上不能设置windowIsTranslucent=true属性不然应用直接崩溃-强烈建议手机应用锁定竖屏
268
+ * 错误为 Only fullscreen activities can request orientation
269
+ * 默认自动 ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
270
+ * 竖屏 ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
271
+ * 横屏 ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
272
+ * {@link ActivityInfo#screenOrientation ActivityInfo.screenOrientation}
273
+ *
274
+ * @param activity
275
+ */
276
+ public void setActivityOrientation (Activity activity ) {
277
+ LoggerManager .i ("setRequestedOrientation:" + activity .getClass ().getSimpleName () + ";:" + (BaseActivity .class .isAssignableFrom (activity .getClass ()))
278
+ + ";:" + (UniversalActivity .class .isAssignableFrom (activity .getClass ())));
279
+ if (BaseActivity .class .isAssignableFrom (activity .getClass ())) {
280
+ return ;
281
+ }
282
+ //全局控制屏幕横竖屏
283
+ //先判断xml没有设置屏幕模式避免将开发者本身想设置的覆盖掉
284
+ if (activity .getRequestedOrientation () == ActivityInfo .SCREEN_ORIENTATION_UNSPECIFIED ) {
285
+ try {
286
+ activity .setRequestedOrientation (ActivityInfo .SCREEN_ORIENTATION_PORTRAIT );
287
+ } catch (Exception e ) {
288
+ e .printStackTrace ();
289
+ LoggerManager .e (TAG , "setRequestedOrientation:" + e .getMessage ());
290
+ }
291
+ }
292
+ }
293
+
288
294
/**
289
295
* Activity 生命周期监听--可用于三方统计页面数据
290
296
* 示例仅为参考如无需添加自己代码可回调null
@@ -309,6 +315,7 @@ public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
309
315
super .onActivityCreated (activity , savedInstanceState );
310
316
//阻止系统截屏功能
311
317
//activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
318
+ setActivityOrientation (activity );
312
319
}
313
320
314
321
@ Override
@@ -411,16 +418,16 @@ private void setStatusBarActivity(Activity activity) {
411
418
imageView .setPadding (SizeUtil .dp2px (15 ), SizeUtil .dp2px (4 ), SizeUtil .dp2px (4 ), SizeUtil .dp2px (4 ));
412
419
}
413
420
}
414
- RxJavaManager .getInstance ().setTimer (100 )
415
- .subscribe (new FastObserver <Long >() {
416
- @ Override
417
- public void _onNext (Long entity ) {
418
- if (isLeak (activity )) {
419
- return ;
420
- }
421
- StatusBarUtil .setStatusBarLightMode (activity );
422
- }
423
- });
421
+ // RxJavaManager.getInstance().setTimer(100)
422
+ // .subscribe(new FastObserver<Long>() {
423
+ // @Override
424
+ // public void _onNext(Long entity) {
425
+ // if (isLeak(activity)) {
426
+ // return;
427
+ // }
428
+ // StatusBarUtil.setStatusBarLightMode(activity);
429
+ // }
430
+ // });
424
431
}
425
432
426
433
/**
0 commit comments