[app] onAttach onDetach for repoloader as well

This commit is contained in:
LoveSy 2021-07-03 15:08:38 +08:00 committed by LoveSy
parent 1e71d035c2
commit 8bb287ae08
1 changed files with 3 additions and 1 deletions

View File

@ -103,6 +103,7 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
private static final Handler workHandler;
private static final PackageManager pm = App.getInstance().getPackageManager();
private static final ModuleUtil moduleUtil = ModuleUtil.getInstance();
private static final RepoLoader repoLoader = RepoLoader.getInstance();
protected FragmentPagerBinding binding;
protected SearchView searchView;
@ -136,19 +137,20 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
return false;
}
};
RepoLoader.getInstance().addListener(this);
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
moduleUtil.addListener(this);
repoLoader.addListener(this);
repoLoaded();
}
@Override
public void onDetach() {
moduleUtil.removeListener(this);
repoLoader.removeListener(this);
super.onDetach();
}