Compare commits
5 Commits
eaa6eee531
...
v125010201
Author | SHA1 | Date | |
---|---|---|---|
1893904135 | |||
a4cb28ba81 | |||
ae3cada1c7 | |||
309500276f | |||
ce255b23cd |
@ -1,3 +1,11 @@
|
||||
**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
|
||||
|
||||
- Debug trying to fix context issues. (#174)
|
||||
|
@ -317,50 +317,44 @@ class HomeActivity :
|
||||
|
||||
private fun reloadLayoutManager() {
|
||||
val currentManager = binding.recyclerView.layoutManager
|
||||
val layoutManager: RecyclerView.LayoutManager
|
||||
|
||||
// This will only update the layout manager if settings changed
|
||||
fun gridLayoutManager() {
|
||||
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) {
|
||||
is StaggeredGridLayoutManager ->
|
||||
if (!appSettingsService.isCardViewEnabled()) {
|
||||
layoutManager =
|
||||
GridLayoutManager(
|
||||
this,
|
||||
calculateNoOfColumns(),
|
||||
)
|
||||
binding.recyclerView.layoutManager = layoutManager
|
||||
gridLayoutManager()
|
||||
}
|
||||
|
||||
is GridLayoutManager ->
|
||||
if (appSettingsService.isCardViewEnabled()) {
|
||||
layoutManager =
|
||||
StaggeredGridLayoutManager(
|
||||
calculateNoOfColumns(),
|
||||
StaggeredGridLayoutManager.VERTICAL,
|
||||
)
|
||||
layoutManager.gapStrategy =
|
||||
StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS
|
||||
binding.recyclerView.layoutManager = layoutManager
|
||||
staggererdGridLayoutManager()
|
||||
}
|
||||
|
||||
else ->
|
||||
if (currentManager == null) {
|
||||
if (!appSettingsService.isCardViewEnabled()) {
|
||||
layoutManager =
|
||||
GridLayoutManager(
|
||||
this,
|
||||
calculateNoOfColumns(),
|
||||
)
|
||||
binding.recyclerView.layoutManager = layoutManager
|
||||
gridLayoutManager()
|
||||
} else {
|
||||
layoutManager =
|
||||
StaggeredGridLayoutManager(
|
||||
calculateNoOfColumns(),
|
||||
StaggeredGridLayoutManager.VERTICAL,
|
||||
)
|
||||
layoutManager.gapStrategy =
|
||||
StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS
|
||||
binding.recyclerView.layoutManager = layoutManager
|
||||
staggererdGridLayoutManager()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -485,8 +479,8 @@ class HomeActivity :
|
||||
}
|
||||
|
||||
private fun handleListResult(appendResults: Boolean = false) {
|
||||
val oldManager = binding.recyclerView.layoutManager
|
||||
if (appendResults) {
|
||||
val oldManager = binding.recyclerView.layoutManager
|
||||
firstVisible =
|
||||
when (oldManager) {
|
||||
is StaggeredGridLayoutManager ->
|
||||
@ -499,7 +493,13 @@ class HomeActivity :
|
||||
}
|
||||
}
|
||||
|
||||
if (recyclerAdapter == null) {
|
||||
@Suppress("detekt:ComplexCondition")
|
||||
if (recyclerAdapter == null ||
|
||||
(
|
||||
(recyclerAdapter is ItemListAdapter && appSettingsService.isCardViewEnabled()) ||
|
||||
(recyclerAdapter is ItemCardAdapter && !appSettingsService.isCardViewEnabled())
|
||||
)
|
||||
) {
|
||||
if (appSettingsService.isCardViewEnabled()) {
|
||||
recyclerAdapter =
|
||||
ItemCardAdapter(
|
||||
|
@ -7,6 +7,7 @@ import android.webkit.WebView
|
||||
import android.widget.ImageView
|
||||
import bou.amine.apps.readerforselfossv2.android.utils.CircleImageView
|
||||
import bou.amine.apps.readerforselfossv2.service.AppSettingsService
|
||||
import bou.amine.apps.readerforselfossv2.utils.isEmptyOrNullOrNullString
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import com.bumptech.glide.load.model.GlideUrl
|
||||
@ -24,6 +25,9 @@ private const val PRELOAD_IMAGE_TIMEOUT = 10000
|
||||
|
||||
@OptIn(ExperimentalEncodingApi::class)
|
||||
fun String.toGlideUrl(appSettingsService: AppSettingsService): GlideUrl {
|
||||
if (this.isEmptyOrNullOrNullString()) {
|
||||
return GlideUrl("")
|
||||
}
|
||||
if (appSettingsService.getBasicUserName().isNotEmpty()) {
|
||||
val authString = "${appSettingsService.getBasicUserName()}:${appSettingsService.getBasicPassword()}"
|
||||
val authBuf = Base64.encode(authString.toByteArray(Charsets.UTF_8))
|
||||
|
@ -0,0 +1,5 @@
|
||||
**v125010131**
|
||||
|
||||
- fix: reload the adapter when it's needed. Fixes #128. (#176)
|
||||
- feat: basic auth and images loading. Fixes #172. (#175)
|
||||
- Changelog for v125010111
|
Reference in New Issue
Block a user