Skip to content

Commit

Permalink
新增代码监听示例
Browse files Browse the repository at this point in the history
  • Loading branch information
Brook007 committed Feb 19, 2022
1 parent ef78d78 commit 2abe556
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/src/main/java/com/brook/app/lazyfragment/LazyFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ public abstract class LazyFragment extends Fragment implements FragmentUserVisib

public LazyFragment() {
mFragmentController = new FragmentUserVisibilityController(this);
mFragmentController.setUserVisibleListener(new FragmentUserVisibilityController.UserVisibilityListener() {
@Override
public void onUserVisible() {
Log.e("Brook", LazyFragment.this.getClass().getSimpleName() + "#可见#" + LazyFragment.this.hashCode());
}

@Override
public void onUserInvisible() {
Log.e("Brook", LazyFragment.this.getClass().getSimpleName() + "#不可见#" + LazyFragment.this.hashCode());
}
});
uid = UUID.randomUUID().toString().substring(0, 8);
}

Expand Down

0 comments on commit 2abe556

Please sign in to comment.