Compare commits
1 Commits
ae3cada1c7
...
eaa6eee531
Author | SHA1 | Date | |
---|---|---|---|
eaa6eee531 |
@ -1,11 +1,3 @@
|
|||||||
**v125010131
|
|
||||||
|
|
||||||
- fix: reload the adapter when it's needed. Fixes #128. (#176)
|
|
||||||
- feat: basic auth and images loading. Fixes #172. (#175)
|
|
||||||
- Changelog for v125010111
|
|
||||||
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
|
|
||||||
**v125010111
|
**v125010111
|
||||||
|
|
||||||
- Debug trying to fix context issues. (#174)
|
- Debug trying to fix context issues. (#174)
|
||||||
|
@ -317,44 +317,50 @@ class HomeActivity :
|
|||||||
|
|
||||||
private fun reloadLayoutManager() {
|
private fun reloadLayoutManager() {
|
||||||
val currentManager = binding.recyclerView.layoutManager
|
val currentManager = binding.recyclerView.layoutManager
|
||||||
|
val layoutManager: RecyclerView.LayoutManager
|
||||||
|
|
||||||
fun gridLayoutManager() {
|
// This will only update the layout manager if settings changed
|
||||||
val layoutManager =
|
|
||||||
GridLayoutManager(
|
|
||||||
this,
|
|
||||||
calculateNoOfColumns(),
|
|
||||||
)
|
|
||||||
binding.recyclerView.layoutManager = layoutManager
|
|
||||||
}
|
|
||||||
|
|
||||||
fun staggererdGridLayoutManager() {
|
|
||||||
var layoutManager =
|
|
||||||
StaggeredGridLayoutManager(
|
|
||||||
calculateNoOfColumns(),
|
|
||||||
StaggeredGridLayoutManager.VERTICAL,
|
|
||||||
)
|
|
||||||
layoutManager.gapStrategy =
|
|
||||||
StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS
|
|
||||||
binding.recyclerView.layoutManager = layoutManager
|
|
||||||
}
|
|
||||||
|
|
||||||
when (currentManager) {
|
when (currentManager) {
|
||||||
is StaggeredGridLayoutManager ->
|
is StaggeredGridLayoutManager ->
|
||||||
if (!appSettingsService.isCardViewEnabled()) {
|
if (!appSettingsService.isCardViewEnabled()) {
|
||||||
gridLayoutManager()
|
layoutManager =
|
||||||
|
GridLayoutManager(
|
||||||
|
this,
|
||||||
|
calculateNoOfColumns(),
|
||||||
|
)
|
||||||
|
binding.recyclerView.layoutManager = layoutManager
|
||||||
}
|
}
|
||||||
|
|
||||||
is GridLayoutManager ->
|
is GridLayoutManager ->
|
||||||
if (appSettingsService.isCardViewEnabled()) {
|
if (appSettingsService.isCardViewEnabled()) {
|
||||||
staggererdGridLayoutManager()
|
layoutManager =
|
||||||
|
StaggeredGridLayoutManager(
|
||||||
|
calculateNoOfColumns(),
|
||||||
|
StaggeredGridLayoutManager.VERTICAL,
|
||||||
|
)
|
||||||
|
layoutManager.gapStrategy =
|
||||||
|
StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS
|
||||||
|
binding.recyclerView.layoutManager = layoutManager
|
||||||
}
|
}
|
||||||
|
|
||||||
else ->
|
else ->
|
||||||
if (currentManager == null) {
|
if (currentManager == null) {
|
||||||
if (!appSettingsService.isCardViewEnabled()) {
|
if (!appSettingsService.isCardViewEnabled()) {
|
||||||
gridLayoutManager()
|
layoutManager =
|
||||||
|
GridLayoutManager(
|
||||||
|
this,
|
||||||
|
calculateNoOfColumns(),
|
||||||
|
)
|
||||||
|
binding.recyclerView.layoutManager = layoutManager
|
||||||
} else {
|
} else {
|
||||||
staggererdGridLayoutManager()
|
layoutManager =
|
||||||
|
StaggeredGridLayoutManager(
|
||||||
|
calculateNoOfColumns(),
|
||||||
|
StaggeredGridLayoutManager.VERTICAL,
|
||||||
|
)
|
||||||
|
layoutManager.gapStrategy =
|
||||||
|
StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS
|
||||||
|
binding.recyclerView.layoutManager = layoutManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -479,8 +485,8 @@ class HomeActivity :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun handleListResult(appendResults: Boolean = false) {
|
private fun handleListResult(appendResults: Boolean = false) {
|
||||||
val oldManager = binding.recyclerView.layoutManager
|
|
||||||
if (appendResults) {
|
if (appendResults) {
|
||||||
|
val oldManager = binding.recyclerView.layoutManager
|
||||||
firstVisible =
|
firstVisible =
|
||||||
when (oldManager) {
|
when (oldManager) {
|
||||||
is StaggeredGridLayoutManager ->
|
is StaggeredGridLayoutManager ->
|
||||||
@ -493,13 +499,7 @@ class HomeActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("detekt:ComplexCondition")
|
if (recyclerAdapter == null) {
|
||||||
if (recyclerAdapter == null ||
|
|
||||||
(
|
|
||||||
(recyclerAdapter is ItemListAdapter && appSettingsService.isCardViewEnabled()) ||
|
|
||||||
(recyclerAdapter is ItemCardAdapter && !appSettingsService.isCardViewEnabled())
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
if (appSettingsService.isCardViewEnabled()) {
|
if (appSettingsService.isCardViewEnabled()) {
|
||||||
recyclerAdapter =
|
recyclerAdapter =
|
||||||
ItemCardAdapter(
|
ItemCardAdapter(
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
**v125010131**
|
|
||||||
|
|
||||||
- fix: reload the adapter when it's needed. Fixes #128. (#176)
|
|
||||||
- feat: basic auth and images loading. Fixes #172. (#175)
|
|
||||||
- Changelog for v125010111
|
|
Loading…
x
Reference in New Issue
Block a user