* [app] Fix popup

* [app] Don't actually need to set binding to null
This commit is contained in:
Wang Han 2021-06-19 19:14:31 +08:00 committed by GitHub
parent f410634dc9
commit 2b593be1d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 11 deletions

View File

@ -93,6 +93,14 @@ public class AppListFragment extends BaseFragment {
return binding.getRoot(); return binding.getRoot();
} }
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (module == null) {
getNavController().navigate(R.id.action_app_list_fragment_to_modules_fragment);
}
}
@Override @Override
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -101,10 +109,6 @@ public class AppListFragment extends BaseFragment {
int moduleUserId = args.getModuleUserId(); int moduleUserId = args.getModuleUserId();
module = ModuleUtil.getInstance().getModule(modulePackageName, moduleUserId); module = ModuleUtil.getInstance().getModule(modulePackageName, moduleUserId);
if (module == null) {
getNavController().navigate(R.id.action_modules_fragment);
return;
}
backupLauncher = registerForActivityResult(new ActivityResultContracts.CreateDocument(), backupLauncher = registerForActivityResult(new ActivityResultContracts.CreateDocument(),
uri -> { uri -> {

View File

@ -177,13 +177,6 @@ public class RepoFragment extends BaseFragment implements RepoLoader.Listener {
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
private class RepoAdapter extends RecyclerView.Adapter<RepoAdapter.ViewHolder> implements Filterable { private class RepoAdapter extends RecyclerView.Adapter<RepoAdapter.ViewHolder> implements Filterable {
private List<OnlineModule> fullList, showList; private List<OnlineModule> fullList, showList;
private final LabelComparator labelComparator = new LabelComparator(); private final LabelComparator labelComparator = new LabelComparator();

View File

@ -92,6 +92,15 @@
<argument <argument
android:name="moduleUserId" android:name="moduleUserId"
app:argType="integer" /> app:argType="integer" />
<action
android:id="@+id/action_app_list_fragment_to_modules_fragment"
app:destination="@id/modules_fragment"
app:enterAnim="@anim/fragment_enter"
app:exitAnim="@anim/fragment_exit"
app:popEnterAnim="@anim/fragment_enter_pop"
app:popExitAnim="@anim/fragment_exit_pop"
app:popUpTo="@id/main_fragment"
app:popUpToInclusive="true" />
</fragment> </fragment>
<fragment <fragment
android:id="@+id/repo_fragment" android:id="@+id/repo_fragment"