Compare commits

...

5 Commits

Author SHA1 Message Date
Tlaster 21dd2dde45 fix crash when sharing file for android 11 2021-03-22 13:46:50 +08:00
Tlaster 6d4404bf57 Revert "fix crash when sharing file for android 11"
This reverts commit 205424735b.
2021-03-22 13:46:21 +08:00
Tlaster 94a73bf4b9 ensure idx is in data indices 2021-03-22 13:32:50 +08:00
Tlaster 205424735b fix crash when sharing file for android 11 2021-03-22 11:06:50 +08:00
Tlaster 4a7d5a99af fix crash when update refresh progress offset 2021-03-22 11:06:41 +08:00
3 changed files with 16 additions and 5 deletions

View File

@ -703,6 +703,7 @@
<provider
android:name=".provider.ShareProvider"
android:authorities="twidere.share"
android:grantUriPermissions="true"
android:exported="true"
tools:ignore="ExportedContentProvider"/>
<provider

View File

@ -128,8 +128,12 @@ class StatusDetailsAdapter(
ITEM_IDX_CONVERSATION -> {
data?.let { data ->
var idx = position - getIndexStart(ITEM_IDX_CONVERSATION)
if (data[idx].is_filtered) idx++
return data[idx]
if (idx !in data.indices) {
if (data[idx].is_filtered) {
idx++
}
return data[idx]
}
}
}
ITEM_IDX_REPLY -> {
@ -137,8 +141,12 @@ class StatusDetailsAdapter(
var idx = position - getIndexStart(ITEM_IDX_CONVERSATION) -
getTypeCount(ITEM_IDX_CONVERSATION) - getTypeCount(ITEM_IDX_STATUS) +
replyStart
if (data[idx].is_filtered) idx++
return data[idx]
if (idx !in data.indices) {
if (data[idx].is_filtered) {
idx++
}
return data[idx]
}
}
}
ITEM_IDX_STATUS -> {

View File

@ -213,7 +213,9 @@ abstract class AbsContentListViewFragment<A : ListAdapter> : BaseFragment(),
val density = resources.displayMetrics.density
val progressCircleDiameter = swipeLayout.progressCircleDiameter
val controlBarOffsetPixels =
(activity.controlBarHeight * (1 - activity.controlBarOffset)).roundToInt()
((activity.controlBarHeight * (1 - activity.controlBarOffset)).takeIf { !it.isNaN() }
?: 0f)
.roundToInt()
val swipeStart = systemWindowsInsets.top - controlBarOffsetPixels - progressCircleDiameter
// 64: SwipeRefreshLayout.DEFAULT_CIRCLE_TARGET
val swipeDistance = (64 * density).roundToInt()