Skip to content

Commit

Permalink
测试、线上放量,发现了各种问题,统一修复下
Browse files Browse the repository at this point in the history
  • Loading branch information
李瑜 committed Jun 6, 2021
1 parent e6e8f20 commit de7495a
Show file tree
Hide file tree
Showing 8 changed files with 264 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;

import com.google.android.material.tabs.TabLayout;
import com.yu.lib.common.ui.BaseFragment;
import com.yu.lib.common.utils.ToastUtil;
import com.yu.nested.library.NestedRecyclerView;
import com.yu.nested.library.manager.NestedLinearLayoutManager;
import com.yu.nested.recyclerview.R;

import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -128,7 +127,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
View view = mRootView = inflater.inflate(R.layout.fragment_test, null);

RecyclerView recyclerView = mRecyclerView = view.findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext()));
recyclerView.setLayoutManager(new NestedLinearLayoutManager(recyclerView.getContext()));
final List<Object> list = new ArrayList<>();
for (int i = 0; i < pageCount; i++) {
list.add(" == " + i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.yu.lib.common.utils.ToastUtil;
import com.yu.nested.library.NestedRecyclerView;
import com.yu.nested.library.manager.NestedLinearLayoutManager;
import com.yu.nested.recyclerview.R;
import com.yu.nested.recyclerview.base.BaseNestedFragment;

Expand All @@ -35,7 +35,7 @@ public int getLayoutRes() {
public void loadView(@NotNull final View view) {
super.loadView(view);
mNestedRecyclerView = view.findViewById(R.id.recyclerView);
mNestedRecyclerView.setLayoutManager(new LinearLayoutManager(mNestedRecyclerView.getContext()));
mNestedRecyclerView.setLayoutManager(new NestedLinearLayoutManager(mNestedRecyclerView.getContext()));
final List<Object> list = new ArrayList<>();
for (int i=0; i<40; i++) {
list.add(" == " + i);
Expand All @@ -44,6 +44,8 @@ public void loadView(@NotNull final View view) {
//如果有数据加载的话,例如信息流,建议提前加载数据,避免卡顿,
// 至于打点,请自行处理这种预加载数据情况下的 曝光逻辑

//如果没有特殊要求,此处可以直接修改LayoutManager : getExtraLayoutSpace完成缓存

//构建底部view,如果在onCreateViewHolder内生成并加载数据,滑出viewpager的时候会有明显卡顿,毕竟渲染需要时间,
//对于复杂底部View,例如常见的信息流卡片,这个卡顿会十分明显,解决卡顿的一个方案就是提前预加载底部ViewPager
//提前渲染View,只是new 出View类,并不会引发绘制,需要将其加到某个容器内提前渲染
Expand Down
2 changes: 1 addition & 1 deletion library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yu.nested.recycler.library" />
package="com.yu.nested.library" />
Loading

0 comments on commit de7495a

Please sign in to comment.