Commit 88aea3922d1a39dcb8e977c787807233961bf76e
Merge branch 'master' of bj.gitlab.cnlive.com:cnlive-team/newModuleStrike
Showing
9 changed files
with
288 additions
and
79 deletions
app/strike/src/main/AndroidManifest.xml
| ... | ... | @@ -55,6 +55,8 @@ |
| 55 | 55 | </activity> |
| 56 | 56 | <activity android:name="com.cnlive.strike.demo.activity.DemoMvpActivity" /> |
| 57 | 57 | |
| 58 | + <activity android:name="com.cnlive.strike.demo.activity.DemoBottomSheetActivity" /> | |
| 59 | + | |
| 58 | 60 | <meta-data |
| 59 | 61 | android:name="com.baidu.lbsapi.API_KEY" |
| 60 | 62 | android:value="${BAIDU_MAP_APP_KEY}" | ... | ... |
app/strike/src/main/java/com/cnlive/strike/demo/activity/DemoBottomSheetActivity.java
0 → 100644
| 1 | +package com.cnlive.strike.demo.activity; | |
| 2 | + | |
| 3 | +import android.view.View; | |
| 4 | + | |
| 5 | +import androidx.annotation.NonNull; | |
| 6 | +import androidx.databinding.ViewDataBinding; | |
| 7 | + | |
| 8 | +import com.cnlive.cloud.R; | |
| 9 | +import com.cnlive.cloud.databinding.ActivityDemoBottomSheetBinding; | |
| 10 | +import com.cnlive.core.libs.base.frame.activity.BaseActivity; | |
| 11 | +import com.google.android.material.bottomsheet.BottomSheetBehavior; | |
| 12 | + | |
| 13 | +public class DemoBottomSheetActivity extends BaseActivity { | |
| 14 | + private ActivityDemoBottomSheetBinding binding; | |
| 15 | + BottomSheetBehavior behavior; | |
| 16 | + | |
| 17 | + @Override | |
| 18 | + protected int getBindLayoutId() { | |
| 19 | + return R.layout.activity_demo_bottom_sheet; | |
| 20 | + } | |
| 21 | + | |
| 22 | + @Override | |
| 23 | + protected void initBindingLayoutData(ViewDataBinding baseBinding) { | |
| 24 | + binding = (ActivityDemoBottomSheetBinding) baseBinding; | |
| 25 | + } | |
| 26 | + | |
| 27 | + @Override | |
| 28 | + protected void initView() { | |
| 29 | + behavior = BottomSheetBehavior.from(binding.recyclerview); | |
| 30 | + | |
| 31 | + behavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() { | |
| 32 | + @Override | |
| 33 | + public void onStateChanged(@NonNull View bottomSheet, @BottomSheetBehavior.State int newState) { | |
| 34 | + String state = "null"; | |
| 35 | + switch (newState) { | |
| 36 | + case 1: | |
| 37 | + state = "STATE_DRAGGING";//过渡状态此时用户正在向上或者向下拖动bottom sheet | |
| 38 | + break; | |
| 39 | + case 2: | |
| 40 | + state = "STATE_SETTLING"; // 视图从脱离手指自由滑动到最终停下的这一小段时间 | |
| 41 | + break; | |
| 42 | + case 3: | |
| 43 | + state = "STATE_EXPANDED"; //处于完全展开的状态 | |
| 44 | + | |
| 45 | + break; | |
| 46 | + case 4: | |
| 47 | + state = "STATE_COLLAPSED"; //默认的折叠状态 | |
| 48 | + break; | |
| 49 | + case 5: | |
| 50 | + state = "STATE_HIDDEN"; //下滑动完全隐藏 bottom sheet | |
| 51 | + break; | |
| 52 | + } | |
| 53 | + | |
| 54 | + } | |
| 55 | + | |
| 56 | + @Override | |
| 57 | + public void onSlide(@NonNull View view, float v) { | |
| 58 | + | |
| 59 | + } | |
| 60 | + }); | |
| 61 | + | |
| 62 | + binding.btnTest.setOnClickListener(new View.OnClickListener() { | |
| 63 | + @Override | |
| 64 | + public void onClick(View v) { | |
| 65 | + behavior.setState(BottomSheetBehavior.STATE_EXPANDED); | |
| 66 | + } | |
| 67 | + }); | |
| 68 | + | |
| 69 | + binding.mapview.setOnClickListener(new View.OnClickListener() { | |
| 70 | + @Override | |
| 71 | + public void onClick(View v) { | |
| 72 | + if (!isNull(behavior)) | |
| 73 | + behavior.setState(BottomSheetBehavior.STATE_HIDDEN); | |
| 74 | + | |
| 75 | + } | |
| 76 | + }); | |
| 77 | + } | |
| 78 | +} | |
| 79 | + | ... | ... |
app/strike/src/main/java/com/cnlive/strike/demo/activity/DemoMvpActivity.java
| ... | ... | @@ -44,6 +44,7 @@ import com.cnlive.strike.network.api.ApiTimeService; |
| 44 | 44 | import com.cnlive.strike.network.api.TimeServiceBean; |
| 45 | 45 | import com.cnlive.strike.network.api.VideoRequest; |
| 46 | 46 | import com.cnlive.strike.network.bean.TestBean; |
| 47 | +import com.google.android.material.bottomsheet.BottomSheetBehavior; | |
| 47 | 48 | |
| 48 | 49 | import org.greenrobot.eventbus.Subscribe; |
| 49 | 50 | import org.greenrobot.eventbus.ThreadMode; |
| ... | ... | @@ -55,7 +56,6 @@ public class DemoMvpActivity extends BaseActivity<DemoActivityView, DemoActivity |
| 55 | 56 | public ActivityDemoMvpMainBinding binding; |
| 56 | 57 | private String[] permission = new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}; |
| 57 | 58 | |
| 58 | - | |
| 59 | 59 | @Override |
| 60 | 60 | protected void initBindingLayoutData(ViewDataBinding baseBinding) { |
| 61 | 61 | binding = (ActivityDemoMvpMainBinding) baseBinding; |
| ... | ... | @@ -67,10 +67,22 @@ public class DemoMvpActivity extends BaseActivity<DemoActivityView, DemoActivity |
| 67 | 67 | return R.layout.activity_demo_mvp_main; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | + @Override | |
| 71 | + protected int getViewLayoutId() { | |
| 72 | + return super.getViewLayoutId(); | |
| 73 | + } | |
| 74 | + | |
| 70 | 75 | |
| 71 | 76 | @Override |
| 72 | 77 | protected void initView() { |
| 73 | - setStatusBarColor(R.color.red, 100, StatusBarConfig.BLACK); | |
| 78 | + showDefaultWhiteStatusBar(); | |
| 79 | + binding.btnBottomSheet.setOnClickListener(new View.OnClickListener() { | |
| 80 | + @Override | |
| 81 | + public void onClick(View v) { | |
| 82 | + | |
| 83 | + startActivity(new Intent(me, DemoBottomSheetActivity.class)); | |
| 84 | + } | |
| 85 | + }); | |
| 74 | 86 | // //登录页 |
| 75 | 87 | binding.btnLogin.setOnClickListener(new View.OnClickListener() { |
| 76 | 88 | @Override |
| ... | ... | @@ -152,9 +164,9 @@ public class DemoMvpActivity extends BaseActivity<DemoActivityView, DemoActivity |
| 152 | 164 | |
| 153 | 165 | //二部电商首页 |
| 154 | 166 | binding.btnShopcity.setOnClickListener(view -> { |
| 155 | - AlertUtil.showDeftToast(DemoMvpActivity.this,"商城部分版本待升级适配"); | |
| 167 | + AlertUtil.showDeftToast(DemoMvpActivity.this, "商城部分版本待升级适配"); | |
| 156 | 168 | // startActivity(new Intent(DemoMvpActivity.this, ShopHomeActivity.class)); |
| 157 | - }); | |
| 169 | + }); | |
| 158 | 170 | |
| 159 | 171 | //获取Handler,onDestory自动解除 |
| 160 | 172 | binding.btnHandler.setOnClickListener(new View.OnClickListener() { |
| ... | ... | @@ -369,7 +381,7 @@ public class DemoMvpActivity extends BaseActivity<DemoActivityView, DemoActivity |
| 369 | 381 | |
| 370 | 382 | @Override |
| 371 | 383 | public void onSuccess(TestBean data) { |
| 372 | - QMUITipDialogUtil.successDialog(me, "成功"+data.getResults().size()); | |
| 384 | + QMUITipDialogUtil.successDialog(me, "成功" + data.getResults().size()); | |
| 373 | 385 | } |
| 374 | 386 | |
| 375 | 387 | @Override |
| ... | ... | @@ -405,8 +417,8 @@ public class DemoMvpActivity extends BaseActivity<DemoActivityView, DemoActivity |
| 405 | 417 | binding.btnCnPlayer.setOnClickListener(new View.OnClickListener() { |
| 406 | 418 | @Override |
| 407 | 419 | public void onClick(View v) { |
| 408 | - Intent intent=new Intent(me,CNplayerActivity.class); | |
| 409 | - intent.putExtra("type","0"); | |
| 420 | + Intent intent = new Intent(me, CNplayerActivity.class); | |
| 421 | + intent.putExtra("type", "0"); | |
| 410 | 422 | startActivity(intent); |
| 411 | 423 | } |
| 412 | 424 | }); |
| ... | ... | @@ -418,14 +430,14 @@ public class DemoMvpActivity extends BaseActivity<DemoActivityView, DemoActivity |
| 418 | 430 | // intent.putExtra("type","1"); |
| 419 | 431 | // startActivityForResult(intent,100); |
| 420 | 432 | |
| 421 | - ARouter.getInstance().build(CNplayerActivity.PATH).navigation(me,300); | |
| 433 | + ARouter.getInstance().build(CNplayerActivity.PATH).navigation(me, 300); | |
| 422 | 434 | |
| 423 | 435 | } |
| 424 | 436 | }); |
| 425 | 437 | binding.btnExo.setOnClickListener(new View.OnClickListener() { |
| 426 | 438 | @Override |
| 427 | 439 | public void onClick(View v) { |
| 428 | - Intent intent=new Intent(me,ExoPlayerActivity.class); | |
| 440 | + Intent intent = new Intent(me, ExoPlayerActivity.class); | |
| 429 | 441 | startActivity(intent); |
| 430 | 442 | } |
| 431 | 443 | }); |
| ... | ... | @@ -439,9 +451,9 @@ public class DemoMvpActivity extends BaseActivity<DemoActivityView, DemoActivity |
| 439 | 451 | binding.btnUid.setOnClickListener(new View.OnClickListener() { |
| 440 | 452 | @Override |
| 441 | 453 | public void onClick(View v) { |
| 442 | - CNLiveUserService userService= OpenServiceHelpUtil.getUserService(me); | |
| 443 | - if (null!=userService){ | |
| 444 | - QMUITipDialogUtil.textDialog(me,userService.getUid(me)); | |
| 454 | + CNLiveUserService userService = OpenServiceHelpUtil.getUserService(me); | |
| 455 | + if (null != userService) { | |
| 456 | + QMUITipDialogUtil.textDialog(me, userService.getUid(me)); | |
| 445 | 457 | } |
| 446 | 458 | } |
| 447 | 459 | }); | ... | ... |
app/strike/src/main/res/layout/activity_demo_bottom_sheet.xml
0 → 100644
| 1 | +<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 2 | + xmlns:app="http://schemas.android.com/apk/res-auto"> | |
| 3 | + | |
| 4 | + <androidx.coordinatorlayout.widget.CoordinatorLayout | |
| 5 | + android:layout_width="match_parent" | |
| 6 | + android:layout_height="match_parent"> | |
| 7 | + | |
| 8 | + <LinearLayout | |
| 9 | + android:id="@+id/mapview" | |
| 10 | + android:background="@color/black" | |
| 11 | + android:layout_width="match_parent" | |
| 12 | + android:layout_height="match_parent" /> | |
| 13 | + | |
| 14 | + <Button | |
| 15 | + android:id="@+id/btnTest" | |
| 16 | + android:layout_width="wrap_content" | |
| 17 | + android:layout_height="wrap_content" | |
| 18 | + android:text="测试" /> | |
| 19 | + | |
| 20 | + <LinearLayout | |
| 21 | + android:id="@+id/recyclerview" | |
| 22 | + android:layout_width="match_parent" | |
| 23 | + android:layout_height="500dp" | |
| 24 | + android:background="@color/white" | |
| 25 | + android:clickable="true" | |
| 26 | + android:focusable="true" | |
| 27 | + app:behavior_hideable="true" | |
| 28 | + app:behavior_peekHeight="0dp" | |
| 29 | + app:layout_behavior="@string/bottom_sheet_behavior" ></LinearLayout> | |
| 30 | + </androidx.coordinatorlayout.widget.CoordinatorLayout> | |
| 31 | +</layout> | |
| 0 | 32 | \ No newline at end of file | ... | ... |
app/strike/src/main/res/layout/activity_demo_mvp_main.xml
| ... | ... | @@ -16,6 +16,13 @@ |
| 16 | 16 | android:orientation="vertical"> |
| 17 | 17 | |
| 18 | 18 | <Button |
| 19 | + android:id="@+id/btn_BottomSheet" | |
| 20 | + android:layout_width="match_parent" | |
| 21 | + android:layout_height="wrap_content" | |
| 22 | + android:layout_margin="5dp" | |
| 23 | + android:text="BottomSheet" /> | |
| 24 | + | |
| 25 | + <Button | |
| 19 | 26 | android:id="@+id/btn_login" |
| 20 | 27 | android:layout_width="match_parent" |
| 21 | 28 | android:layout_height="wrap_content" |
| ... | ... | @@ -33,7 +40,7 @@ |
| 33 | 40 | android:id="@+id/btn_login_bingding" |
| 34 | 41 | android:layout_width="match_parent" |
| 35 | 42 | android:layout_height="wrap_content" |
| 36 | - android:text="账号三方绑定管理"/> | |
| 43 | + android:text="账号三方绑定管理" /> | |
| 37 | 44 | |
| 38 | 45 | <Button |
| 39 | 46 | android:id="@+id/btn_new_user_face" |
| ... | ... | @@ -139,12 +146,14 @@ |
| 139 | 146 | android:layout_height="wrap_content" |
| 140 | 147 | android:layout_margin="5dp" |
| 141 | 148 | android:text="Exoplayer" /> |
| 149 | + | |
| 142 | 150 | <Button |
| 143 | 151 | android:id="@+id/btn_exo_home" |
| 144 | 152 | android:layout_width="match_parent" |
| 145 | 153 | android:layout_height="wrap_content" |
| 146 | 154 | android:layout_margin="5dp" |
| 147 | 155 | android:text="Exoplayer官方" /> |
| 156 | + | |
| 148 | 157 | <Button |
| 149 | 158 | android:id="@+id/btn_pay" |
| 150 | 159 | android:layout_width="match_parent" |
| ... | ... | @@ -221,6 +230,8 @@ |
| 221 | 230 | android:layout_height="wrap_content" |
| 222 | 231 | android:layout_margin="5dp" |
| 223 | 232 | android:text="默认权限申请,自定义申请码,自定义提示语" /> |
| 233 | + | |
| 234 | + | |
| 224 | 235 | </LinearLayout> |
| 225 | 236 | </androidx.core.widget.NestedScrollView> |
| 226 | 237 | </LinearLayout> | ... | ... |
core/base/src/main/java/com/cnlive/core/libs/base/frame/activity/BaseActivity.java
| ... | ... | @@ -51,6 +51,7 @@ import com.cnlive.core.libs.base.util.StatusBarConfig; |
| 51 | 51 | import com.cnlive.core.libs.base.util.StatusBarUtil; |
| 52 | 52 | import com.cnlive.cloud.base.R; |
| 53 | 53 | import com.hannesdorfmann.mosby3.mvp.MvpActivity; |
| 54 | +import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | |
| 54 | 55 | import com.me.yokeyword.fragmentation.ExtraTransaction; |
| 55 | 56 | import com.me.yokeyword.fragmentation.Fragmentation; |
| 56 | 57 | import com.me.yokeyword.fragmentation.ISupportActivity; |
| ... | ... | @@ -514,7 +515,12 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V |
| 514 | 515 | AppManager.getInstance().deleteActivity(me); |
| 515 | 516 | //清除当前订阅 |
| 516 | 517 | SubscriptionManager.getInstance().cancel(TAG); |
| 517 | - | |
| 518 | + if (null != getPresenter()) { | |
| 519 | + getPresenter().onDestory(); | |
| 520 | + } | |
| 521 | + if (null != getMvpView()) { | |
| 522 | + getMvpView().onDestory(); | |
| 523 | + } | |
| 518 | 524 | } |
| 519 | 525 | |
| 520 | 526 | /** |
| ... | ... | @@ -587,6 +593,26 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V |
| 587 | 593 | return view; |
| 588 | 594 | } |
| 589 | 595 | |
| 596 | + /** | |
| 597 | + * 判断view是否已经附加 | |
| 598 | + * | |
| 599 | + * @return | |
| 600 | + */ | |
| 601 | + public boolean isViewAttached() { | |
| 602 | + return view != null; | |
| 603 | + } | |
| 604 | + | |
| 605 | + /** | |
| 606 | + * 直接调用view的方法 | |
| 607 | + * | |
| 608 | + * @param action | |
| 609 | + */ | |
| 610 | + protected final void ifViewAttached(MvpBasePresenter.ViewAction<V> action) { | |
| 611 | + if (view != null) { | |
| 612 | + action.run(view); | |
| 613 | + } | |
| 614 | + } | |
| 615 | + | |
| 590 | 616 | protected int getBindLayoutId() { |
| 591 | 617 | return 0; |
| 592 | 618 | } |
| ... | ... | @@ -1456,14 +1482,14 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V |
| 1456 | 1482 | } |
| 1457 | 1483 | |
| 1458 | 1484 | /** |
| 1459 | - * It is recommended to use {@link SupportFragment#start(ISupportFragment)}. | |
| 1485 | + * It is recommended to use { SupportFragment#start(ISupportFragment)}. | |
| 1460 | 1486 | */ |
| 1461 | 1487 | public final void start(ISupportFragment toFragment) { |
| 1462 | 1488 | mDelegate.start(toFragment); |
| 1463 | 1489 | } |
| 1464 | 1490 | |
| 1465 | 1491 | /** |
| 1466 | - * It is recommended to use {@link SupportFragment#start(ISupportFragment, int)}. | |
| 1492 | + * It is recommended to use {SupportFragment#start(ISupportFragment, int)}. | |
| 1467 | 1493 | * |
| 1468 | 1494 | * @param launchMode Similar to Activity's LaunchMode. |
| 1469 | 1495 | */ |
| ... | ... | @@ -1472,7 +1498,7 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V |
| 1472 | 1498 | } |
| 1473 | 1499 | |
| 1474 | 1500 | /** |
| 1475 | - * It is recommended to use {@link SupportFragment#startForResult(ISupportFragment, int)}. | |
| 1501 | + * It is recommended to use {SupportFragment#startForResult(ISupportFragment, int)}. | |
| 1476 | 1502 | * Launch an fragment for which you would like a result when it poped. |
| 1477 | 1503 | */ |
| 1478 | 1504 | public final void startForResult(ISupportFragment toFragment, int requestCode) { |
| ... | ... | @@ -1480,7 +1506,7 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V |
| 1480 | 1506 | } |
| 1481 | 1507 | |
| 1482 | 1508 | /** |
| 1483 | - * It is recommended to use {@link SupportFragment#startWithPop(ISupportFragment)}. | |
| 1509 | + * It is recommended to use { SupportFragment#startWithPop(ISupportFragment)}. | |
| 1484 | 1510 | * Start the target Fragment and pop itself |
| 1485 | 1511 | */ |
| 1486 | 1512 | public final void startWithPop(ISupportFragment toFragment) { |
| ... | ... | @@ -1488,7 +1514,7 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V |
| 1488 | 1514 | } |
| 1489 | 1515 | |
| 1490 | 1516 | /** |
| 1491 | - * It is recommended to use {@link SupportFragment#startWithPopTo(ISupportFragment, Class, boolean)}. | |
| 1517 | + * It is recommended to use {SupportFragment#startWithPopTo(ISupportFragment, Class, boolean)}. | |
| 1492 | 1518 | * |
| 1493 | 1519 | * @see #popTo(Class, boolean) |
| 1494 | 1520 | * + |
| ... | ... | @@ -1499,7 +1525,7 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V |
| 1499 | 1525 | } |
| 1500 | 1526 | |
| 1501 | 1527 | /** |
| 1502 | - * It is recommended to use {@link SupportFragment#replaceFragment(ISupportFragment, boolean)}. | |
| 1528 | + * It is recommended to use {link SupportFragment#replaceFragment(ISupportFragment, boolean)}. | |
| 1503 | 1529 | */ |
| 1504 | 1530 | public final void replaceFragment(ISupportFragment toFragment, boolean addToBackStack) { |
| 1505 | 1531 | mDelegate.replaceFragment(toFragment, addToBackStack); | ... | ... |
core/base/src/main/java/com/cnlive/core/libs/base/frame/fragment/BaseFragment.java
| ... | ... | @@ -29,6 +29,7 @@ import com.cnlive.core.libs.base.util.ReflectUtil; |
| 29 | 29 | import com.cnlive.core.libs.base.frame.view.BaseView; |
| 30 | 30 | import com.cnlive.core.libs.base.util.StatusBarConfig; |
| 31 | 31 | import com.cnlive.cloud.base.R; |
| 32 | +import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | |
| 32 | 33 | import com.me.yokeyword.fragmentation.ExtraTransaction; |
| 33 | 34 | import com.me.yokeyword.fragmentation.ISupportFragment; |
| 34 | 35 | import com.me.yokeyword.fragmentation.SupportFragmentDelegate; |
| ... | ... | @@ -77,7 +78,7 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 77 | 78 | } |
| 78 | 79 | |
| 79 | 80 | @Override |
| 80 | - public void onCreate(Bundle savedInstanceState) { | |
| 81 | + public void onCreate(Bundle savedInstanceState) { | |
| 81 | 82 | super.onCreate(savedInstanceState); |
| 82 | 83 | if (getActivity() == null) return; |
| 83 | 84 | me = (BaseActivity) getActivity(); |
| ... | ... | @@ -92,14 +93,14 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 92 | 93 | setSwipeBackEnable(me.isOpenSwipBack()); |
| 93 | 94 | ARouter.getInstance().inject(this); |
| 94 | 95 | init(savedInstanceState); |
| 95 | - if (null!=getArguments()){ | |
| 96 | + if (null != getArguments()) { | |
| 96 | 97 | initParams(getArguments()); |
| 97 | 98 | } |
| 98 | 99 | } |
| 99 | 100 | |
| 100 | 101 | @Nullable |
| 101 | 102 | @Override |
| 102 | - public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | |
| 103 | + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | |
| 103 | 104 | if (0 != getBindLayoutId()) { |
| 104 | 105 | baseBinding = DataBindingUtil.inflate(inflater, getBindLayoutId(), container, false); |
| 105 | 106 | if (me.isOpenSwipBack()) { |
| ... | ... | @@ -130,21 +131,21 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 130 | 131 | } |
| 131 | 132 | |
| 132 | 133 | |
| 133 | - public boolean isNull(Object o) { | |
| 134 | + public boolean isNull(Object o) { | |
| 134 | 135 | return me.isNull(o); |
| 135 | 136 | } |
| 136 | 137 | |
| 137 | 138 | /** |
| 138 | 139 | * 显示白色通知栏 |
| 139 | 140 | */ |
| 140 | - public void showDefaultWhiteStatusBar() { | |
| 141 | + public void showDefaultWhiteStatusBar() { | |
| 141 | 142 | me.showDefaultWhiteStatusBar(); |
| 142 | 143 | } |
| 143 | 144 | |
| 144 | 145 | /** |
| 145 | 146 | * 显示黑色通知栏 |
| 146 | 147 | */ |
| 147 | - public void showDefaultBlackStatusBar() { | |
| 148 | + public void showDefaultBlackStatusBar() { | |
| 148 | 149 | me.showDefaultBlackStatusBar(); |
| 149 | 150 | } |
| 150 | 151 | |
| ... | ... | @@ -153,12 +154,12 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 153 | 154 | * |
| 154 | 155 | * @param enable |
| 155 | 156 | */ |
| 156 | - public void setEnableCreateDefultEmptyView(boolean enable) { | |
| 157 | + public void setEnableCreateDefultEmptyView(boolean enable) { | |
| 157 | 158 | isCreateDefultEmptyView = enable; |
| 158 | 159 | } |
| 159 | 160 | |
| 160 | 161 | @Override |
| 161 | - public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | |
| 162 | + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | |
| 162 | 163 | super.onViewCreated(view, savedInstanceState); |
| 163 | 164 | mSwipeDelegate.onViewCreated(view, savedInstanceState); |
| 164 | 165 | if (null != getMvpView() && null != getPresenter()) { |
| ... | ... | @@ -192,12 +193,33 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 192 | 193 | return view; |
| 193 | 194 | } |
| 194 | 195 | |
| 195 | - public Bundle getSavedInstanceState() { | |
| 196 | + | |
| 197 | + /** | |
| 198 | + * 判断view是否已经附加 | |
| 199 | + * | |
| 200 | + * @return | |
| 201 | + */ | |
| 202 | + public boolean isViewAttached() { | |
| 203 | + return view != null; | |
| 204 | + } | |
| 205 | + | |
| 206 | + /** | |
| 207 | + * 直接调用view的方法 | |
| 208 | + * | |
| 209 | + * @param action | |
| 210 | + */ | |
| 211 | + protected final void ifViewAttached(MvpBasePresenter.ViewAction<V> action) { | |
| 212 | + if (view != null) { | |
| 213 | + action.run(view); | |
| 214 | + } | |
| 215 | + } | |
| 216 | + | |
| 217 | + public Bundle getSavedInstanceState() { | |
| 196 | 218 | return savedInstanceState; |
| 197 | 219 | } |
| 198 | 220 | |
| 199 | 221 | //添加观察者 |
| 200 | - public void addObservable(Observable... observable) { | |
| 222 | + public void addObservable(Observable... observable) { | |
| 201 | 223 | Observable[] result = observable; |
| 202 | 224 | if (null != observable) { |
| 203 | 225 | if (null != result) { |
| ... | ... | @@ -229,7 +251,7 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 229 | 251 | } |
| 230 | 252 | } |
| 231 | 253 | |
| 232 | - public void registerEventBus() { | |
| 254 | + public void registerEventBus() { | |
| 233 | 255 | //注册eventbus |
| 234 | 256 | if (!EventBus.getDefault().isRegistered(this)) { |
| 235 | 257 | EventBus.getDefault().register(this); |
| ... | ... | @@ -243,15 +265,15 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 243 | 265 | } |
| 244 | 266 | } |
| 245 | 267 | |
| 246 | - public void postEvent(Object object) { | |
| 268 | + public void postEvent(Object object) { | |
| 247 | 269 | EventBus.getDefault().post(object); |
| 248 | 270 | } |
| 249 | 271 | |
| 250 | - public void postStickyEvent(Object object) { | |
| 272 | + public void postStickyEvent(Object object) { | |
| 251 | 273 | EventBus.getDefault().postSticky(object); |
| 252 | 274 | } |
| 253 | 275 | |
| 254 | - public Handler getMyFragHandler() { | |
| 276 | + public Handler getMyFragHandler() { | |
| 255 | 277 | if (null == myFragHandler) { |
| 256 | 278 | myFragHandler = new Handler() { |
| 257 | 279 | @Override |
| ... | ... | @@ -335,7 +357,7 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 335 | 357 | /** |
| 336 | 358 | * 隐藏软键盘 |
| 337 | 359 | */ |
| 338 | - public void hideSoftInput() { | |
| 360 | + public void hideSoftInput() { | |
| 339 | 361 | me.hideSoftInput(); |
| 340 | 362 | } |
| 341 | 363 | |
| ... | ... | @@ -343,14 +365,14 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 343 | 365 | /** |
| 344 | 366 | * 显示竖屏 |
| 345 | 367 | */ |
| 346 | - public void showPortraitScreen() { | |
| 368 | + public void showPortraitScreen() { | |
| 347 | 369 | me.showPortraitScreen(); |
| 348 | 370 | } |
| 349 | 371 | |
| 350 | 372 | /** |
| 351 | 373 | * 显示横屏 |
| 352 | 374 | */ |
| 353 | - public void showLandscapeScreen() { | |
| 375 | + public void showLandscapeScreen() { | |
| 354 | 376 | me.showLandscapeScreen(); |
| 355 | 377 | } |
| 356 | 378 | |
| ... | ... | @@ -360,8 +382,8 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 360 | 382 | * @param color |
| 361 | 383 | * @param statusBarAlpha |
| 362 | 384 | */ |
| 363 | - public void setStatusBarColor(@ColorRes int color, | |
| 364 | - @IntRange(from = 0, to = 255) int statusBarAlpha) { | |
| 385 | + public void setStatusBarColor(@ColorRes int color, | |
| 386 | + @IntRange(from = 0, to = 255) int statusBarAlpha) { | |
| 365 | 387 | me.setStatusBarColor(color, statusBarAlpha); |
| 366 | 388 | } |
| 367 | 389 | |
| ... | ... | @@ -371,20 +393,20 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 371 | 393 | * @param color |
| 372 | 394 | * @param statusBarAlpha |
| 373 | 395 | */ |
| 374 | - public void setStatusBarColor(@ColorRes int color, | |
| 375 | - @IntRange(from = 0, to = 255) int statusBarAlpha, @StatusBarConfig.Unit final int textColor) { | |
| 396 | + public void setStatusBarColor(@ColorRes int color, | |
| 397 | + @IntRange(from = 0, to = 255) int statusBarAlpha, @StatusBarConfig.Unit final int textColor) { | |
| 376 | 398 | me.setStatusBarColor(color, statusBarAlpha, textColor); |
| 377 | 399 | } |
| 378 | 400 | |
| 379 | - public void setTransparentForWindow() { | |
| 401 | + public void setTransparentForWindow() { | |
| 380 | 402 | me.setTransparentForWindow(); |
| 381 | 403 | } |
| 382 | 404 | |
| 383 | - public void addTranslucentView(@IntRange(from = 0, to = 255) int statusBarAlpha) { | |
| 405 | + public void addTranslucentView(@IntRange(from = 0, to = 255) int statusBarAlpha) { | |
| 384 | 406 | me.addTranslucentView(statusBarAlpha); |
| 385 | 407 | } |
| 386 | 408 | |
| 387 | - public void setDecorViewBgColor(@ColorInt int color) { | |
| 409 | + public void setDecorViewBgColor(@ColorInt int color) { | |
| 388 | 410 | me.setDecorViewBgColor(color); |
| 389 | 411 | } |
| 390 | 412 | |
| ... | ... | @@ -403,12 +425,18 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 403 | 425 | mSwipeDelegate.onDestroyView(); |
| 404 | 426 | //清除当前订阅 |
| 405 | 427 | SubscriptionManager.getInstance().cancel(TAG); |
| 428 | + if (null != getPresenter()) { | |
| 429 | + getPresenter().onDestory(); | |
| 430 | + } | |
| 431 | + if (null != getMvpView()) { | |
| 432 | + getMvpView().onDestory(); | |
| 433 | + } | |
| 406 | 434 | } |
| 407 | 435 | |
| 408 | 436 | /** |
| 409 | 437 | * 设置状态栏字体颜色 |
| 410 | 438 | */ |
| 411 | - public void setStatusBarTextColor(@StatusBarConfig.Unit int type) { | |
| 439 | + public void setStatusBarTextColor(@StatusBarConfig.Unit int type) { | |
| 412 | 440 | me.setStatusBarTextColor(type); |
| 413 | 441 | } |
| 414 | 442 | |
| ... | ... | @@ -416,14 +444,14 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 416 | 444 | /** |
| 417 | 445 | * 显示软键盘 |
| 418 | 446 | */ |
| 419 | - public void showSoftInput() { | |
| 447 | + public void showSoftInput() { | |
| 420 | 448 | me.showSoftInput(); |
| 421 | 449 | } |
| 422 | 450 | |
| 423 | 451 | /** |
| 424 | 452 | * 显示软键盘 |
| 425 | 453 | */ |
| 426 | - public void showSoftInput(View view) { | |
| 454 | + public void showSoftInput(View view) { | |
| 427 | 455 | me.showSoftInput(view); |
| 428 | 456 | } |
| 429 | 457 | |
| ... | ... | @@ -431,7 +459,7 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 431 | 459 | * 设置屏幕为横屏 |
| 432 | 460 | * Set the screen to landscape. |
| 433 | 461 | */ |
| 434 | - public void setLandscape() { | |
| 462 | + public void setLandscape() { | |
| 435 | 463 | me.setLandscape(); |
| 436 | 464 | } |
| 437 | 465 | |
| ... | ... | @@ -439,7 +467,7 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 439 | 467 | * 设置屏幕为竖屏 |
| 440 | 468 | * Set the screen to portrait. |
| 441 | 469 | */ |
| 442 | - public void setPortrait() { | |
| 470 | + public void setPortrait() { | |
| 443 | 471 | me.setPortrait(); |
| 444 | 472 | } |
| 445 | 473 | |
| ... | ... | @@ -450,7 +478,7 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 450 | 478 | * |
| 451 | 479 | * @return {@code true}: yes<br>{@code false}: no |
| 452 | 480 | */ |
| 453 | - public boolean isLandscape() { | |
| 481 | + public boolean isLandscape() { | |
| 454 | 482 | return me.isLandscape(); |
| 455 | 483 | } |
| 456 | 484 | |
| ... | ... | @@ -460,123 +488,123 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 460 | 488 | * |
| 461 | 489 | * @return {@code true}: yes<br>{@code false}: no |
| 462 | 490 | */ |
| 463 | - public boolean isPortrait() { | |
| 491 | + public boolean isPortrait() { | |
| 464 | 492 | return me.isPortrait(); |
| 465 | 493 | } |
| 466 | 494 | |
| 467 | 495 | |
| 468 | 496 | /*********************************************************/ |
| 469 | 497 | //用于进行dip和px转换 |
| 470 | - public int dp2px(float dpValue) { | |
| 498 | + public int dp2px(float dpValue) { | |
| 471 | 499 | return me.dp2px(dpValue); |
| 472 | 500 | } |
| 473 | 501 | |
| 474 | 502 | //用于进行px和dip转换 |
| 475 | - public int px2dp(float pxValue) { | |
| 503 | + public int px2dp(float pxValue) { | |
| 476 | 504 | return me.px2dp(pxValue); |
| 477 | 505 | } |
| 478 | 506 | |
| 479 | 507 | //权限申请 |
| 480 | - public void requestPermission(String[] permissions, OnPermissionResponseListener onPermissionResponseListener) { | |
| 508 | + public void requestPermission(String[] permissions, OnPermissionResponseListener onPermissionResponseListener) { | |
| 481 | 509 | me.requestPermission(permissions, onPermissionResponseListener); |
| 482 | 510 | } |
| 483 | 511 | |
| 484 | - public void requestPermission(String[] permissions, boolean isShowRefuseDialog, OnPermissionResponseListener onPermissionResponseListener) { | |
| 512 | + public void requestPermission(String[] permissions, boolean isShowRefuseDialog, OnPermissionResponseListener onPermissionResponseListener) { | |
| 485 | 513 | me.requestPermission(permissions, isShowRefuseDialog, onPermissionResponseListener); |
| 486 | 514 | } |
| 487 | 515 | |
| 488 | 516 | //权限申请 |
| 489 | - public void requestPermission(boolean isDefineActivity, String[] permissions, OnPermissionResponseListener onPermissionResponseListener) { | |
| 517 | + public void requestPermission(boolean isDefineActivity, String[] permissions, OnPermissionResponseListener onPermissionResponseListener) { | |
| 490 | 518 | me.requestPermission(isDefineActivity, permissions, onPermissionResponseListener); |
| 491 | 519 | } |
| 492 | 520 | |
| 493 | - public void requestPermission(boolean isDefineActivity, String[] permissions, boolean isShowRefuseDialog, OnPermissionResponseListener onPermissionResponseListener) { | |
| 521 | + public void requestPermission(boolean isDefineActivity, String[] permissions, boolean isShowRefuseDialog, OnPermissionResponseListener onPermissionResponseListener) { | |
| 494 | 522 | me.requestPermission(isDefineActivity, permissions, isShowRefuseDialog, onPermissionResponseListener); |
| 495 | 523 | } |
| 496 | 524 | |
| 497 | 525 | //权限申请 |
| 498 | - public void requestPermission(int requestCode, String[] permissions, OnPermissionResponseListener onPermissionResponseListener) { | |
| 526 | + public void requestPermission(int requestCode, String[] permissions, OnPermissionResponseListener onPermissionResponseListener) { | |
| 499 | 527 | me.requestPermission(requestCode, permissions, onPermissionResponseListener); |
| 500 | 528 | } |
| 501 | 529 | |
| 502 | - public void requestPermission(int requestCode, String[] permissions, boolean isShowRefuseDialog, OnPermissionResponseListener onPermissionResponseListener) { | |
| 530 | + public void requestPermission(int requestCode, String[] permissions, boolean isShowRefuseDialog, OnPermissionResponseListener onPermissionResponseListener) { | |
| 503 | 531 | me.requestPermission(requestCode, permissions, isShowRefuseDialog, onPermissionResponseListener); |
| 504 | 532 | } |
| 505 | 533 | |
| 506 | 534 | //权限申请 |
| 507 | - public void requestPermission(int requestCode, boolean isDefineActivity, String[] permissions, OnPermissionResponseListener onPermissionResponseListener) { | |
| 535 | + public void requestPermission(int requestCode, boolean isDefineActivity, String[] permissions, OnPermissionResponseListener onPermissionResponseListener) { | |
| 508 | 536 | me.requestPermission(requestCode, isDefineActivity, permissions, onPermissionResponseListener); |
| 509 | 537 | } |
| 510 | 538 | |
| 511 | - public void requestPermission(int requestCode, boolean isDefineActivity, String[] permissions, boolean isShowRefuseDialog, OnPermissionResponseListener onPermissionResponseListener) { | |
| 539 | + public void requestPermission(int requestCode, boolean isDefineActivity, String[] permissions, boolean isShowRefuseDialog, OnPermissionResponseListener onPermissionResponseListener) { | |
| 512 | 540 | me.requestPermission(requestCode, isDefineActivity, permissions, isShowRefuseDialog, onPermissionResponseListener); |
| 513 | 541 | } |
| 514 | 542 | |
| 515 | 543 | //权限申请 |
| 516 | - public void requestPermission(int requestCode, String defineTip, String[] permissions, OnPermissionResponseListener onPermissionResponseListener) { | |
| 544 | + public void requestPermission(int requestCode, String defineTip, String[] permissions, OnPermissionResponseListener onPermissionResponseListener) { | |
| 517 | 545 | me.requestPermission(requestCode, defineTip, permissions, onPermissionResponseListener); |
| 518 | 546 | } |
| 519 | 547 | |
| 520 | - public void requestPermission(int requestCode, String defineTip, String[] permissions, boolean isShowRefuseDialog, OnPermissionResponseListener onPermissionResponseListener) { | |
| 548 | + public void requestPermission(int requestCode, String defineTip, String[] permissions, boolean isShowRefuseDialog, OnPermissionResponseListener onPermissionResponseListener) { | |
| 521 | 549 | me.requestPermission(requestCode, defineTip, permissions, isShowRefuseDialog, onPermissionResponseListener); |
| 522 | 550 | } |
| 523 | 551 | |
| 524 | 552 | //权限申请 |
| 525 | - public void requestPermission(int requestCode, String defineTip, boolean isDefineActivity, String[] permissions, OnPermissionResponseListener onPermissionResponseListener) { | |
| 553 | + public void requestPermission(int requestCode, String defineTip, boolean isDefineActivity, String[] permissions, OnPermissionResponseListener onPermissionResponseListener) { | |
| 526 | 554 | me.requestPermission(requestCode, defineTip, isDefineActivity, permissions, onPermissionResponseListener); |
| 527 | 555 | } |
| 528 | 556 | |
| 529 | - public void requestPermission(int requestCode, String defineTip, boolean isDefineActivity, String[] permissions, boolean isShowRefuseDialog, OnPermissionResponseListener onPermissionResponseListener) { | |
| 557 | + public void requestPermission(int requestCode, String defineTip, boolean isDefineActivity, String[] permissions, boolean isShowRefuseDialog, OnPermissionResponseListener onPermissionResponseListener) { | |
| 530 | 558 | me.requestPermission(requestCode, defineTip, isDefineActivity, permissions, isShowRefuseDialog, onPermissionResponseListener); |
| 531 | 559 | } |
| 532 | 560 | |
| 533 | - public void requestPermission(String defineTip, String[] permissions, OnPermissionResponseListener | |
| 561 | + public void requestPermission(String defineTip, String[] permissions, OnPermissionResponseListener | |
| 534 | 562 | onPermissionResponseListener) { |
| 535 | 563 | me.requestPermission(defineTip, permissions, onPermissionResponseListener); |
| 536 | 564 | } |
| 537 | 565 | |
| 538 | - public void requestPermission(String defineTip, String[] permissions, boolean isShowRefuseDialog, OnPermissionResponseListener | |
| 566 | + public void requestPermission(String defineTip, String[] permissions, boolean isShowRefuseDialog, OnPermissionResponseListener | |
| 539 | 567 | onPermissionResponseListener) { |
| 540 | 568 | me.requestPermission(defineTip, permissions, isShowRefuseDialog, onPermissionResponseListener); |
| 541 | 569 | } |
| 542 | 570 | |
| 543 | - public void requestPermission(String defineTip, boolean isDefineActivity, String[] permissions, OnPermissionResponseListener | |
| 571 | + public void requestPermission(String defineTip, boolean isDefineActivity, String[] permissions, OnPermissionResponseListener | |
| 544 | 572 | onPermissionResponseListener) { |
| 545 | 573 | me.requestPermission(defineTip, isDefineActivity, permissions, onPermissionResponseListener); |
| 546 | 574 | } |
| 547 | 575 | |
| 548 | - public void requestPermission(String defineTip, boolean isDefineActivity, String[] permissions, boolean isShowRefuseDialog, OnPermissionResponseListener | |
| 576 | + public void requestPermission(String defineTip, boolean isDefineActivity, String[] permissions, boolean isShowRefuseDialog, OnPermissionResponseListener | |
| 549 | 577 | onPermissionResponseListener) { |
| 550 | 578 | me.requestPermission(defineTip, isDefineActivity, permissions, isShowRefuseDialog, onPermissionResponseListener); |
| 551 | 579 | } |
| 552 | 580 | |
| 553 | - public void requestPermission(int requestCode, @StringRes int defineTip, String[] | |
| 581 | + public void requestPermission(int requestCode, @StringRes int defineTip, String[] | |
| 554 | 582 | permissions, OnPermissionResponseListener onPermissionResponseListener) { |
| 555 | 583 | me.requestPermission(requestCode, defineTip, permissions, onPermissionResponseListener); |
| 556 | 584 | } |
| 557 | 585 | |
| 558 | - public void requestPermission(int requestCode, @StringRes int defineTip, String[] | |
| 586 | + public void requestPermission(int requestCode, @StringRes int defineTip, String[] | |
| 559 | 587 | permissions, boolean isShowRefuseDialog, OnPermissionResponseListener onPermissionResponseListener) { |
| 560 | 588 | me.requestPermission(requestCode, defineTip, permissions, isShowRefuseDialog, onPermissionResponseListener); |
| 561 | 589 | } |
| 562 | 590 | |
| 563 | - public void requestPermission(int requestCode, @StringRes int defineTip, boolean isDefineActivity, String[] | |
| 591 | + public void requestPermission(int requestCode, @StringRes int defineTip, boolean isDefineActivity, String[] | |
| 564 | 592 | permissions, OnPermissionResponseListener onPermissionResponseListener) { |
| 565 | 593 | me.requestPermission(requestCode, defineTip, isDefineActivity, permissions, onPermissionResponseListener); |
| 566 | 594 | } |
| 567 | 595 | |
| 568 | - public void requestPermission(int requestCode, @StringRes int defineTip, boolean isDefineActivity, String[] | |
| 596 | + public void requestPermission(int requestCode, @StringRes int defineTip, boolean isDefineActivity, String[] | |
| 569 | 597 | permissions, boolean isShowRefuseDialog, OnPermissionResponseListener onPermissionResponseListener) { |
| 570 | 598 | me.requestPermission(requestCode, defineTip, isDefineActivity, permissions, isShowRefuseDialog, onPermissionResponseListener); |
| 571 | 599 | } |
| 572 | 600 | |
| 573 | 601 | //多权限检查 |
| 574 | - public boolean checkPermissions(String[] permissions) { | |
| 602 | + public boolean checkPermissions(String[] permissions) { | |
| 575 | 603 | return me.checkPermissions(permissions); |
| 576 | 604 | } |
| 577 | 605 | |
| 578 | 606 | //单权限检查 |
| 579 | - public boolean checkPermissions(String permission) { | |
| 607 | + public boolean checkPermissions(String permission) { | |
| 580 | 608 | return me.checkPermissions(permission); |
| 581 | 609 | } |
| 582 | 610 | |
| ... | ... | @@ -642,6 +670,12 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 642 | 670 | unRegisterEventBus(); |
| 643 | 671 | //清除当前订阅 |
| 644 | 672 | SubscriptionManager.getInstance().cancel(TAG); |
| 673 | + if (null != getMvpView()) { | |
| 674 | + getMvpView().onDestory(); | |
| 675 | + } | |
| 676 | + if (null != getPresenter()) { | |
| 677 | + getPresenter().onDestory(); | |
| 678 | + } | |
| 645 | 679 | } |
| 646 | 680 | |
| 647 | 681 | @Override |
| ... | ... | @@ -818,9 +852,9 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 818 | 852 | } |
| 819 | 853 | |
| 820 | 854 | /** |
| 821 | - * 类似 {@link Activity#onActivityResult(int, int, Intent)} | |
| 855 | + * 类似 {link Activity#onActivityResult(int, int, Intent)} | |
| 822 | 856 | * <p> |
| 823 | - * Similar to {@link Activity#onActivityResult(int, int, Intent)} | |
| 857 | + * Similar to {link Activity#onActivityResult(int, int, Intent)} | |
| 824 | 858 | * |
| 825 | 859 | * @see #startForResult(ISupportFragment, int) |
| 826 | 860 | */ |
| ... | ... | @@ -831,9 +865,9 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 831 | 865 | |
| 832 | 866 | /** |
| 833 | 867 | * 在start(TargetFragment,LaunchMode)时,启动模式为SingleTask/SingleTop, 回调TargetFragment的该方法 |
| 834 | - * 类似 {@link Activity#onNewIntent(Intent)} | |
| 868 | + * 类似 {link Activity#onNewIntent(Intent)} | |
| 835 | 869 | * <p> |
| 836 | - * Similar to {@link Activity#onNewIntent(Intent)} | |
| 870 | + * Similar to {link Activity#onNewIntent(Intent)} | |
| 837 | 871 | * |
| 838 | 872 | * @param args putNewBundle(Bundle newBundle) |
| 839 | 873 | * @see #start(ISupportFragment, int) | ... | ... |
core/base/src/main/java/com/cnlive/core/libs/base/frame/presenter/BasePresenter.java
| ... | ... | @@ -63,4 +63,16 @@ public class BasePresenter<V extends BaseView> extends MvpBasePresenter<V> { |
| 63 | 63 | public void logXml(String xml) { |
| 64 | 64 | Logger.xml(xml); |
| 65 | 65 | } |
| 66 | + | |
| 67 | + public void onDestory(){}; | |
| 68 | + | |
| 69 | + @Override | |
| 70 | + public boolean isViewAttached() { | |
| 71 | + return super.isViewAttached(); | |
| 72 | + } | |
| 73 | + | |
| 74 | + @Override | |
| 75 | + public V getView() { | |
| 76 | + return super.getView(); | |
| 77 | + } | |
| 66 | 78 | } | ... | ... |