Comments (3)
👍 That's pretty cool. I haven't tested swapping SLMs yet, but any time is a good time. I'll get this fixed as soon as I get some more sleep :)
from superslim.
It's pretty late on your side of the pond! From playing with the sample, it feels as though it's the switching of the header that breaks it.
If you leave the header using the LinearLM and switch the items to the GridLM, they simply stay the same size but headers are removed. It isn't until you switch the header over that the items appear as a grid. This of course gives us the awesome berserk header spam.
from superslim.
There is a bug in SuperSLiM and a bug in your code. Here is a patch to get your coding working.
From 66fb94f1387e0f4e6df49cba494db942239b0cc2 Mon Sep 17 00:00:00 2001
From: Tonic Artos <[email protected]>
Date: Thu, 19 Feb 2015 13:39:16 +0000
Subject: [PATCH] Fix layout corruption on SLM swap.
- Workaround bug with sections with only headers.
- Correctly notify datachanges on SLM change, requestLayout() is not
enough with RecyclerView.
---
.../java/com/dattilio/patrick/superslimtest/RecyclerAdapter.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/src/main/java/com/dattilio/patrick/superslimtest/RecyclerAdapter.java b/app/src/main/java/com/dattilio/patrick/superslimtest/RecyclerAdapter.java
index 006e119..fb2e13d 100644
--- a/app/src/main/java/com/dattilio/patrick/superslimtest/RecyclerAdapter.java
+++ b/app/src/main/java/com/dattilio/patrick/superslimtest/RecyclerAdapter.java
@@ -87,7 +87,7 @@ public class RecyclerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
break;
case GRID_ITEM:
lp.layoutId = 1;
- lp.setFirstPosition(2);
+ lp.setFirstPosition(1);
holder.itemView.setLayoutParams(lp);
break;
}
@@ -129,7 +129,7 @@ public class RecyclerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
@Override
public void onClick(View v) {
isList = true;
- recyclerView.requestLayout();
+ notifyItemRangeChanged(1, getItemCount() - 1);
}
});
@@ -137,7 +137,7 @@ public class RecyclerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
@Override
public void onClick(View v) {
isList = false;
- recyclerView.requestLayout();
+ notifyItemRangeChanged(1, getItemCount() - 1);
}
});
}
--
2.1.0
from superslim.
Related Issues (20)
- Flexbox layout
- Dynamic sticky content
- Built in elevation change for sticky content.
- Infinite scroll
- Collapsible/expandable sections
- Sticky footers weirdly wobble on horizontal scroll. HOT 1
- Toggling collapsible sections loses items.
- Prepare milestone 5 release
- Update Readme.md
- On layout a sticky footer always sits above sticky inset (section state inset parameter).
- Sticky footer HOT 2
- RecycleView scrolls over sticky header
- Crash On RecyclerView Refresh
- Does SuperSLiM supports sub headers ? HOT 10
- Mocking framework
- i cannot build the project
- NPE at LayoutManager#onItemsUpdated
- Androidx HOT 1
- Is this covered by the Apache 2.0 License?
- Scrolling issue with Sticky Headers on
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from superslim.