fixed crashes when no network available
This commit is contained in:
parent
032cfda7ad
commit
3180a9c516
|
@ -415,7 +415,7 @@ abstract class ParcelableStatusesAdapter(
|
||||||
var sum = 0
|
var sum = 0
|
||||||
for (i in 0 until itemCounts.size) {
|
for (i in 0 until itemCounts.size) {
|
||||||
sum += when (i) {
|
sum += when (i) {
|
||||||
ITEM_INDEX_STATUS -> data!!.size
|
ITEM_INDEX_STATUS -> data?.size ?: 0
|
||||||
else -> itemCounts[i]
|
else -> itemCounts[i]
|
||||||
}
|
}
|
||||||
if (position < sum) {
|
if (position < sum) {
|
||||||
|
|
|
@ -167,7 +167,7 @@ abstract class ParcelableStatusesFragment : AbsStatusesFragment() {
|
||||||
super.triggerRefresh()
|
super.triggerRefresh()
|
||||||
val accountKeys = accountKeys
|
val accountKeys = accountKeys
|
||||||
val statusStartIndex = adapter.statusStartIndex
|
val statusStartIndex = adapter.statusStartIndex
|
||||||
if (statusStartIndex >= 0) {
|
if (statusStartIndex >= 0 && adapter.getStatusCount(true) > 0) {
|
||||||
val firstStatus = adapter.getStatus(statusStartIndex, true)
|
val firstStatus = adapter.getStatus(statusStartIndex, true)
|
||||||
val sinceIds = Array(accountKeys.size) {
|
val sinceIds = Array(accountKeys.size) {
|
||||||
return@Array if (firstStatus.account_key == accountKeys[it]) firstStatus.id else null
|
return@Array if (firstStatus.account_key == accountKeys[it]) firstStatus.id else null
|
||||||
|
|
|
@ -2018,14 +2018,14 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
||||||
if (childCount > 0) {
|
if (childCount > 0) {
|
||||||
if (isSmoothScrollbarEnabled) {
|
if (isSmoothScrollbarEnabled) {
|
||||||
var extent = childCount * 100
|
var extent = childCount * 100
|
||||||
var view = findViewByPosition(firstPosition)
|
var view = findViewByPosition(firstPosition) ?: return 0
|
||||||
val top = view.top
|
val top = view.top
|
||||||
var height = view.height
|
var height = view.height
|
||||||
if (height > 0) {
|
if (height > 0) {
|
||||||
extent += top * 100 / height
|
extent += top * 100 / height
|
||||||
}
|
}
|
||||||
|
|
||||||
view = findViewByPosition(lastPosition)
|
view = findViewByPosition(lastPosition) ?: return 0
|
||||||
val bottom = view.bottom
|
val bottom = view.bottom
|
||||||
height = view.height
|
height = view.height
|
||||||
if (height > 0) {
|
if (height > 0) {
|
||||||
|
@ -2047,7 +2047,7 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
||||||
val skippedCount = skippedScrollItemCount
|
val skippedCount = skippedScrollItemCount
|
||||||
if (firstPosition >= skippedCount && childCount > 0) {
|
if (firstPosition >= skippedCount && childCount > 0) {
|
||||||
if (isSmoothScrollbarEnabled) {
|
if (isSmoothScrollbarEnabled) {
|
||||||
val view = findViewByPosition(firstPosition)
|
val view = findViewByPosition(firstPosition) ?: return 0
|
||||||
val top = view.top
|
val top = view.top
|
||||||
val height = view.height
|
val height = view.height
|
||||||
if (height > 0) {
|
if (height > 0) {
|
||||||
|
|
Loading…
Reference in New Issue