This commit is contained in:
NekoInverter 2020-11-22 15:21:40 +08:00
parent 351feb4fa9
commit 5fc718d28e
No known key found for this signature in database
GPG Key ID: 280D6CCCF95715F9
6 changed files with 40 additions and 5 deletions

View File

@ -21,6 +21,7 @@ import org.meowcat.edxposed.manager.adapters.AppHelper;
import org.meowcat.edxposed.manager.adapters.BlackListAdapter;
import org.meowcat.edxposed.manager.adapters.CompatListAdapter;
import org.meowcat.edxposed.manager.databinding.ActivityBlackListBinding;
import org.meowcat.edxposed.manager.util.LinearLayoutManagerFix;
public class BlackListActivity extends BaseActivity implements AppAdapter.Callback {
private SearchView searchView;
@ -54,7 +55,7 @@ public class BlackListActivity extends BaseActivity implements AppAdapter.Callba
appAdapter = isCompat ? new CompatListAdapter(this) : new BlackListAdapter(this, isWhiteListMode);
appAdapter.setHasStableIds(true);
binding.recyclerView.setAdapter(appAdapter);
binding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
binding.recyclerView.setLayoutManager(new LinearLayoutManagerFix(this));
if (!App.getPreferences().getBoolean("md2", false)) {
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(this,
DividerItemDecoration.VERTICAL);

View File

@ -35,6 +35,7 @@ import org.meowcat.edxposed.manager.databinding.ActivityDownloadBinding;
import org.meowcat.edxposed.manager.databinding.ItemDownloadBinding;
import org.meowcat.edxposed.manager.repo.RepoDb;
import org.meowcat.edxposed.manager.repo.RepoDbDefinitions;
import org.meowcat.edxposed.manager.util.LinearLayoutManagerFix;
import org.meowcat.edxposed.manager.util.ModuleUtil;
import org.meowcat.edxposed.manager.util.RepoLoader;
@ -95,7 +96,7 @@ public class DownloadActivity extends BaseActivity implements RepoLoader.RepoLis
moduleUtil.addListener(this);
binding.recyclerView.setAdapter(adapter);
binding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
binding.recyclerView.setLayoutManager(new LinearLayoutManagerFix(this));
StickyRecyclerHeadersDecoration headersDecor = new StickyRecyclerHeadersDecoration(adapter);
binding.recyclerView.addItemDecoration(headersDecor);
adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {

View File

@ -28,6 +28,7 @@ import com.google.android.material.tabs.TabLayout;
import org.meowcat.edxposed.manager.databinding.ActivityLogsBinding;
import org.meowcat.edxposed.manager.databinding.DialogInstallWarningBinding;
import org.meowcat.edxposed.manager.databinding.ItemLogBinding;
import org.meowcat.edxposed.manager.util.LinearLayoutManagerFix;
import java.io.File;
import java.io.FileInputStream;
@ -78,7 +79,7 @@ public class LogsActivity extends BaseActivity {
}
adapter = new LogsAdapter();
binding.recyclerView.setAdapter(adapter);
binding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
binding.recyclerView.setLayoutManager(new LinearLayoutManagerFix(this));
if (App.getPreferences().getBoolean("disable_verbose_log", false)) {
binding.slidingTabs.setVisibility(View.GONE);
}

View File

@ -17,6 +17,7 @@ import org.meowcat.edxposed.manager.adapters.AppAdapter;
import org.meowcat.edxposed.manager.adapters.AppHelper;
import org.meowcat.edxposed.manager.adapters.ScopeAdapter;
import org.meowcat.edxposed.manager.databinding.ActivityScopeListBinding;
import org.meowcat.edxposed.manager.util.LinearLayoutManagerFix;
public class ModuleScopeActivity extends BaseActivity implements AppAdapter.Callback {
private SearchView searchView;
@ -50,7 +51,7 @@ public class ModuleScopeActivity extends BaseActivity implements AppAdapter.Call
appAdapter = new ScopeAdapter(this, modulePackageName, binding.masterSwitch);
appAdapter.setHasStableIds(true);
binding.recyclerView.setAdapter(appAdapter);
binding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
binding.recyclerView.setLayoutManager(new LinearLayoutManagerFix(this));
if (!App.getPreferences().getBoolean("md2", false)) {
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(this,
DividerItemDecoration.VERTICAL);

View File

@ -33,6 +33,7 @@ import org.meowcat.edxposed.manager.repo.ModuleVersion;
import org.meowcat.edxposed.manager.repo.ReleaseType;
import org.meowcat.edxposed.manager.repo.RepoDb;
import org.meowcat.edxposed.manager.util.InstallApkUtil;
import org.meowcat.edxposed.manager.util.LinearLayoutManagerFix;
import org.meowcat.edxposed.manager.util.ModuleUtil;
import org.meowcat.edxposed.manager.util.NavUtil;
import org.meowcat.edxposed.manager.util.RepoLoader;
@ -196,7 +197,7 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
adapter.setHasStableIds(true);
moduleUtil.addListener(this);
binding.recyclerView.setAdapter(adapter);
binding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
binding.recyclerView.setLayoutManager(new LinearLayoutManagerFix(this));
if (!App.getPreferences().getBoolean("md2", false)) {
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(this,
DividerItemDecoration.VERTICAL);

View File

@ -0,0 +1,30 @@
package org.meowcat.edxposed.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();
}
}
}