[app] Fix scroll bar of module fragment from shortcut (#740)
* [app] Fix scroll bar of module fragment from shortcut * Also for RepoItemFragment
This commit is contained in:
parent
f64871dd0c
commit
ccafa7d29a
|
|
@ -21,6 +21,8 @@ package org.lsposed.manager.ui.fragment;
|
|||
|
||||
import static android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS;
|
||||
|
||||
import static androidx.recyclerview.widget.RecyclerView.Adapter.StateRestorationPolicy.PREVENT_WHEN_EMPTY;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
|
|
@ -166,6 +168,7 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
|
|||
for (var user : users) {
|
||||
var adapter = new ModuleAdapter(user);
|
||||
adapter.setHasStableIds(true);
|
||||
adapter.setStateRestorationPolicy(PREVENT_WHEN_EMPTY);
|
||||
adapters.add(adapter);
|
||||
tabTitles.add(user.name);
|
||||
}
|
||||
|
|
@ -179,6 +182,7 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
|
|||
} else {
|
||||
var adapter = new ModuleAdapter(null);
|
||||
adapter.setHasStableIds(true);
|
||||
adapter.setStateRestorationPolicy(PREVENT_WHEN_EMPTY);
|
||||
adapters.add(adapter);
|
||||
binding.viewPager.setUserInputEnabled(false);
|
||||
binding.tabLayout.setVisibility(View.GONE);
|
||||
|
|
@ -336,7 +340,6 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
|
|||
}
|
||||
|
||||
public static class ModuleListFragment extends Fragment {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
|
@ -365,6 +368,7 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
|
|||
}
|
||||
}
|
||||
});
|
||||
binding.recyclerView.onApplyWindowInsets(requireActivity().getWindow().getDecorView().getRootWindowInsets());
|
||||
RecyclerViewKt.fixEdgeEffect(binding.recyclerView, false, true);
|
||||
RecyclerViewKt.addFastScroller(binding.recyclerView, binding.recyclerView);
|
||||
return binding.getRoot();
|
||||
|
|
|
|||
|
|
@ -406,6 +406,7 @@ public class RepoItemFragment extends BaseFragment implements RepoLoader.Listene
|
|||
holder.recyclerView.setTag(position);
|
||||
holder.recyclerView.setLayoutManager(new LinearLayoutManagerFix(requireActivity()));
|
||||
holder.recyclerView.getBorderViewDelegate().setBorderVisibilityChangedListener((top, oldTop, bottom, oldBottom) -> binding.appBar.setRaised(!top));
|
||||
holder.recyclerView.onApplyWindowInsets(requireActivity().getWindow().getDecorView().getRootWindowInsets());
|
||||
RecyclerViewKt.fixEdgeEffect(holder.recyclerView, false, true);
|
||||
RecyclerViewKt.addFastScroller(holder.recyclerView, holder.itemView);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue