@@ -205,7 +205,9 @@ public boolean createTitleBarViewControl(TitleBarView titleBar, Class<?> cls) {
205
205
.setStatusAlpha (isSupport ? 0 : 102 )
206
206
.setLeftTextDrawable (isActivity ? mDrawable : null )
207
207
.setDividerHeight (Build .VERSION .SDK_INT < Build .VERSION_CODES .LOLLIPOP ? SizeUtil .dp2px (0.5f ) : 0 );
208
- if (activity != null ) titleBar .setTitleMainText (activity .getTitle ());
208
+ if (activity != null ) {
209
+ titleBar .setTitleMainText (activity .getTitle ());
210
+ }
209
211
ViewCompat .setElevation (titleBar , mContext .getResources ().getDimension (R .dimen .dp_elevation ));
210
212
return false ;
211
213
}
@@ -223,7 +225,8 @@ public void setSwipeBack(Activity activity, BGASwipeBackHelper swipeBackHelper)
223
225
activity .getWindow ().setBackgroundDrawableResource (android .R .color .transparent );
224
226
swipeBackHelper .setSwipeBackEnable (true )
225
227
// .setShadowResId(R.color.colorSwipeBackBackground)
226
- .setIsNavigationBarOverlap (true );//底部导航条是否悬浮在内容上设置过NavigationViewHelper可以不用设置该属性
228
+ //底部导航条是否悬浮在内容上设置过NavigationViewHelper可以不用设置该属性
229
+ .setIsNavigationBarOverlap (true );
227
230
}
228
231
229
232
@ Override
@@ -337,12 +340,14 @@ public void onActivityResumed(Activity activity) {
337
340
FragmentManager manager = ((FragmentActivity ) activity ).getSupportFragmentManager ();
338
341
List <Fragment > list = manager .getFragments ();
339
342
//有Fragment的FragmentActivity不需调用以下方法避免统计不准
340
- if (list == null || list .size () == 0 )
343
+ if (list == null || list .size () == 0 ) {
341
344
MobclickAgent .onPageStart (activity .getClass ().getSimpleName ());
345
+ }
342
346
} else {
343
347
MobclickAgent .onPageStart (activity .getClass ().getSimpleName ());
344
348
}
345
- MobclickAgent .onResume (activity ); //统计时长
349
+ //统计时长
350
+ MobclickAgent .onResume (activity );
346
351
}
347
352
348
353
@ Override
@@ -352,18 +357,21 @@ public void onActivityPaused(Activity activity) {
352
357
FragmentManager manager = ((FragmentActivity ) activity ).getSupportFragmentManager ();
353
358
List <Fragment > list = manager .getFragments ();
354
359
//有Fragment的FragmentActivity不需调用以下方法避免统计不准
355
- if (list == null || list .size () == 0 )
360
+ if (list == null || list .size () == 0 ) {
356
361
MobclickAgent .onPageEnd (activity .getClass ().getSimpleName ());
362
+ }
357
363
} else {
358
364
MobclickAgent .onPageEnd (activity .getClass ().getSimpleName ());
359
365
}
360
- MobclickAgent .onPause (activity ); //统计时长
366
+ //统计时长
367
+ MobclickAgent .onPause (activity );
361
368
}
362
369
363
370
@ Override
364
371
public void onActivityStopped (Activity activity ) {
365
- if (activity .isFinishing ())
372
+ if (activity .isFinishing ()) {
366
373
activity .overridePendingTransition (0 , R .anim .bga_sbl_activity_swipeback_exit );
374
+ }
367
375
}
368
376
369
377
@ Override
@@ -411,12 +419,16 @@ public void httpRequestSuccess(IHttpRequestControl httpRequestControl, List<? ex
411
419
int size = httpRequestControl .getPageSize ();
412
420
413
421
LoggerManager .i (TAG , "smartRefreshLayout:" + smartRefreshLayout + ";adapter:" + adapter + ";status:" + ";page:" + page + ";class:" + httpRequestControl .getRequestClass ());
414
- if (smartRefreshLayout != null )
422
+ if (smartRefreshLayout != null ) {
415
423
smartRefreshLayout .finishRefresh ();
416
- if (adapter == null ) return ;
424
+ }
425
+ if (adapter == null ) {
426
+ return ;
427
+ }
417
428
adapter .loadMoreComplete ();
418
429
if (list == null || list .size () == 0 ) {
419
- if (page == 0 ) {//第一页没有
430
+ //第一页没有
431
+ if (page == 0 ) {
420
432
adapter .setNewData (new ArrayList ());
421
433
statusLayoutManager .showEmptyLayout ();
422
434
if (listener != null ) {
@@ -453,21 +465,28 @@ public void httpRequestError(IHttpRequestControl httpRequestControl, Throwable e
453
465
if (!NetworkUtil .isConnected (mContext )) {
454
466
reason = R .string .fast_exception_network_not_connected ;
455
467
} else {
456
- if (e instanceof NetworkErrorException ) {//网络异常--继承于AccountsException
468
+ //网络异常--继承于AccountsException
469
+ if (e instanceof NetworkErrorException ) {
457
470
reason = R .string .fast_exception_network_error ;
458
- } else if (e instanceof AccountsException ) {//账户异常
471
+ //账户异常
472
+ } else if (e instanceof AccountsException ) {
459
473
reason = R .string .fast_exception_accounts ;
460
- } else if (e instanceof ConnectException ) {//连接异常--继承于SocketException
474
+ //连接异常--继承于SocketException
475
+ } else if (e instanceof ConnectException ) {
461
476
reason = R .string .fast_exception_connect ;
462
- } else if (e instanceof SocketException ) {//socket异常
477
+ //socket异常
478
+ } else if (e instanceof SocketException ) {
463
479
reason = R .string .fast_exception_socket ;
464
- } else if (e instanceof HttpException ) {// http异常
480
+ // http异常
481
+ } else if (e instanceof HttpException ) {
465
482
reason = R .string .fast_exception_http ;
466
- } else if (e instanceof UnknownHostException ) {//DNS错误
483
+ //DNS错误
484
+ } else if (e instanceof UnknownHostException ) {
467
485
reason = R .string .fast_exception_unknown_host ;
468
486
} else if (e instanceof JsonSyntaxException
469
487
|| e instanceof JsonIOException
470
- || e instanceof JsonParseException ) {//数据格式化错误
488
+ || e instanceof JsonParseException ) {
489
+ //数据格式化错误
471
490
reason = R .string .fast_exception_json_syntax ;
472
491
} else if (e instanceof SocketTimeoutException || e instanceof TimeoutException ) {
473
492
reason = R .string .fast_exception_time_out ;
@@ -483,23 +502,27 @@ public void httpRequestError(IHttpRequestControl httpRequestControl, Throwable e
483
502
BaseQuickAdapter adapter = httpRequestControl .getRecyclerAdapter ();
484
503
StatusLayoutManager statusLayoutManager = httpRequestControl .getStatusLayoutManager ();
485
504
int page = httpRequestControl .getCurrentPage ();
486
- // int size = httpRequestControl.getPageSize();
487
- if (smartRefreshLayout != null )
505
+ if (smartRefreshLayout != null ) {
488
506
smartRefreshLayout .finishRefresh (false );
489
- if (adapter != null )
507
+ }
508
+ if (adapter != null ) {
490
509
adapter .loadMoreComplete ();
491
- if (statusLayoutManager == null ) return ;
492
- if (page == 0 ) {//初始页
493
- if (!NetworkUtil .isConnected (mContext )) {
494
- //可自定义网络错误页面展示
495
- statusLayoutManager .showCustomLayout (R .layout .layout_status_layout_manager_error );
496
- } else {
497
- statusLayoutManager .showErrorLayout ();
510
+ if (statusLayoutManager == null ) {
511
+ return ;
498
512
}
499
- return ;
513
+ //初始页
514
+ if (page == 0 ) {
515
+ if (!NetworkUtil .isConnected (mContext )) {
516
+ //可自定义网络错误页面展示
517
+ statusLayoutManager .showCustomLayout (R .layout .layout_status_layout_manager_error );
518
+ } else {
519
+ statusLayoutManager .showErrorLayout ();
520
+ }
521
+ return ;
522
+ }
523
+ //可根据不同错误展示不同错误布局 showCustomLayout(R.layout.xxx);
524
+ statusLayoutManager .showErrorLayout ();
500
525
}
501
- //可根据不同错误展示不同错误布局 statusLayoutManager.showCustomLayout(R.layout.xxx);
502
- statusLayoutManager .showErrorLayout ();
503
526
}
504
527
505
528
/**
@@ -515,11 +538,6 @@ public long quipApp(boolean isFirst, Activity activity) {
515
538
} else {
516
539
FastStackUtil .getInstance ().exit ();
517
540
}
518
- // if (isFirst) {
519
- // ToastUtil.show(R.string.fast_back_home);
520
- // } else {
521
- // activity.moveTaskToBack(true);
522
- // }
523
541
return 2000 ;
524
542
}
525
543
0 commit comments