[app] Nuke LinearLayoutManagerFix

bad
This commit is contained in:
tehcneko 2021-08-25 13:33:53 +08:00 committed by vvb2060
parent b4a67a1f9e
commit eb61f84c67
6 changed files with 13 additions and 63 deletions

View File

@ -36,6 +36,7 @@ import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.SearchView;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.google.android.material.snackbar.Snackbar;
@ -44,7 +45,6 @@ import org.lsposed.manager.R;
import org.lsposed.manager.adapters.ScopeAdapter;
import org.lsposed.manager.databinding.FragmentAppListBinding;
import org.lsposed.manager.util.BackupUtils;
import org.lsposed.manager.util.LinearLayoutManagerFix;
import org.lsposed.manager.util.ModuleUtil;
import java.util.Locale;
@ -82,7 +82,7 @@ public class AppListFragment extends BaseFragment {
scopeAdapter.setHasStableIds(true);
binding.recyclerView.setAdapter(scopeAdapter);
binding.recyclerView.setHasFixedSize(true);
binding.recyclerView.setLayoutManager(new LinearLayoutManagerFix(requireActivity()));
binding.recyclerView.setLayoutManager(new LinearLayoutManager(requireActivity()));
RecyclerViewKt.fixEdgeEffect(binding.recyclerView, false, true);
binding.swipeRefreshLayout.setOnRefreshListener(() -> scopeAdapter.refresh(true));

View File

@ -40,6 +40,7 @@ import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.snackbar.Snackbar;
@ -49,7 +50,6 @@ import org.lsposed.manager.ConfigManager;
import org.lsposed.manager.R;
import org.lsposed.manager.databinding.FragmentLogsBinding;
import org.lsposed.manager.databinding.ItemLogBinding;
import org.lsposed.manager.util.LinearLayoutManagerFix;
import java.io.BufferedReader;
import java.io.FileDescriptor;
@ -75,7 +75,7 @@ public class LogsFragment extends BaseFragment {
private LogsAdapter adapter;
private final Handler handler = new Handler(Looper.getMainLooper());
private FragmentLogsBinding binding;
private LinearLayoutManagerFix layoutManager;
private LinearLayoutManager layoutManager;
private final ActivityResultLauncher<String> saveLogsLauncher = registerForActivityResult(
new ActivityResultContracts.CreateDocument(),
uri -> {
@ -123,7 +123,7 @@ public class LogsFragment extends BaseFragment {
adapter = new LogsAdapter();
RecyclerViewKt.fixEdgeEffect(binding.recyclerView, false, true);
binding.recyclerView.setAdapter(adapter);
layoutManager = new LinearLayoutManagerFix(requireActivity());
layoutManager = new LinearLayoutManager(requireActivity());
binding.recyclerView.setLayoutManager(layoutManager);
return binding.getRoot();
}

View File

@ -60,6 +60,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Lifecycle;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import androidx.viewpager2.widget.ViewPager2;
@ -83,7 +84,6 @@ import org.lsposed.manager.databinding.ItemRepoRecyclerviewBinding;
import org.lsposed.manager.repo.RepoLoader;
import org.lsposed.manager.ui.widget.EmptyStateRecyclerView;
import org.lsposed.manager.util.GlideApp;
import org.lsposed.manager.util.LinearLayoutManagerFix;
import org.lsposed.manager.util.ModuleUtil;
import java.util.ArrayList;
@ -228,7 +228,7 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
pickAdaptor.refresh();
var rv = DialogRecyclerviewBinding.inflate(getLayoutInflater()).getRoot();
rv.setAdapter(pickAdaptor);
rv.setLayoutManager(new LinearLayoutManagerFix(requireActivity()));
rv.setLayoutManager(new LinearLayoutManager(requireActivity()));
var dialog = new AlertDialog.Builder(requireActivity())
.setTitle(getString(R.string.install_to_user, user.name))
.setView(rv)
@ -398,7 +398,7 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
}
binding.recyclerView.setTag(position);
binding.recyclerView.setAdapter(fragment.adapters.get(position));
RecyclerView.LayoutManager layoutManager = new LinearLayoutManagerFix(requireActivity());
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(requireActivity());
binding.recyclerView.setLayoutManager(layoutManager);
binding.recyclerView.getBorderViewDelegate().setBorderVisibilityChangedListener((top, oldTop, bottom, oldBottom) -> fragment.binding.appBar.setRaised(!top));
binding.recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

View File

@ -36,6 +36,7 @@ import androidx.annotation.Nullable;
import androidx.appcompat.widget.SearchView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.lifecycle.Lifecycle;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.snackbar.Snackbar;
@ -46,7 +47,6 @@ import org.lsposed.manager.databinding.FragmentRepoBinding;
import org.lsposed.manager.databinding.ItemOnlinemoduleBinding;
import org.lsposed.manager.repo.RepoLoader;
import org.lsposed.manager.repo.model.OnlineModule;
import org.lsposed.manager.util.LinearLayoutManagerFix;
import java.time.Instant;
import java.util.ArrayList;
@ -96,7 +96,7 @@ public class RepoFragment extends BaseFragment implements RepoLoader.Listener {
adapter.setHasStableIds(true);
binding.recyclerView.setAdapter(adapter);
binding.recyclerView.setHasFixedSize(true);
binding.recyclerView.setLayoutManager(new LinearLayoutManagerFix(requireActivity()));
binding.recyclerView.setLayoutManager(new LinearLayoutManager(requireActivity()));
RecyclerViewKt.fixEdgeEffect(binding.recyclerView, false, true);
binding.progress.setVisibilityAfterHide(View.GONE);
repoLoader.addListener(this);

View File

@ -19,7 +19,6 @@
package org.lsposed.manager.ui.fragment;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Color;
import android.os.Bundle;
@ -42,6 +41,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.lifecycle.Lifecycle;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.widget.ViewPager2;
@ -65,7 +65,6 @@ import org.lsposed.manager.repo.model.OnlineModule;
import org.lsposed.manager.repo.model.Release;
import org.lsposed.manager.repo.model.ReleaseAsset;
import org.lsposed.manager.ui.widget.LinkifyTextView;
import org.lsposed.manager.util.LinearLayoutManagerFix;
import org.lsposed.manager.util.NavUtil;
import org.lsposed.manager.util.chrome.CustomTabsURLSpan;
@ -90,6 +89,7 @@ public class RepoItemFragment extends BaseFragment implements RepoLoader.Listene
private ReleaseAdapter releaseAdapter;
private static String readWebviewHTML(String name) {
try {
var input = App.getInstance().getAssets().open("webview/" + name);
var result = new ByteArrayOutputStream(1024);
@ -444,7 +444,7 @@ public class RepoItemFragment extends BaseFragment implements RepoLoader.Listene
holder.recyclerView.setAdapter(new InformationAdapter(module));
}
holder.recyclerView.setTag(position);
holder.recyclerView.setLayoutManager(new LinearLayoutManagerFix(requireActivity()));
holder.recyclerView.setLayoutManager(new LinearLayoutManager(requireActivity()));
holder.recyclerView.getBorderViewDelegate().setBorderVisibilityChangedListener((top, oldTop, bottom, oldBottom) -> binding.appBar.setRaised(!top));
var insets = requireActivity().getWindow().getDecorView().getRootWindowInsets();
if (insets != null)

View File

@ -1,50 +0,0 @@
/*
* This file is part of LSPosed.
*
* LSPosed is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LSPosed is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
*
* Copyright (C) 2020 EdXposed Contributors
* Copyright (C) 2021 LSPosed Contributors
*/
package org.lsposed.manager.util;
import android.content.Context;
import android.util.AttributeSet;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
public class LinearLayoutManagerFix extends LinearLayoutManager {
public LinearLayoutManagerFix(Context context) {
super(context);
}
public LinearLayoutManagerFix(Context context, int orientation, boolean reverseLayout) {
super(context, orientation, reverseLayout);
}
public LinearLayoutManagerFix(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@Override
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
try {
super.onLayoutChildren(recycler, state);
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
}
}