Skip to content

Commit

Permalink
fix: GroupPagerAdapter crash
Browse files Browse the repository at this point in the history
  • Loading branch information
arm64v8a committed May 15, 2023
1 parent 7fa7190 commit 11ecdba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1079,16 +1079,18 @@ class ConfigurationFragment @JvmOverloads constructor(
}
}

val runFunc = if (now) requireActivity()::runOnUiThread else groupPager::post
runFunc {
groupList = newGroupList
notifyDataSetChanged()
if (set) groupPager.setCurrentItem(selectedGroupIndex, false)
val hideTab = groupList.size < 2
tabLayout.isGone = hideTab
toolbar.elevation = if (hideTab) 0F else dp2px(4).toFloat()
if (!select) {
groupPager.registerOnPageChangeCallback(updateSelectedCallback)
val runFunc = if (now) activity?.let { it::runOnUiThread } else groupPager::post
if (runFunc != null) {
runFunc {
groupList = newGroupList
notifyDataSetChanged()
if (set) groupPager.setCurrentItem(selectedGroupIndex, false)
val hideTab = groupList.size < 2
tabLayout.isGone = hideTab
toolbar.elevation = if (hideTab) 0F else dp2px(4).toFloat()
if (!select) {
groupPager.registerOnPageChangeCallback(updateSelectedCallback)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ abstract class ProfileSettingsActivity<T : AbstractBean>(
.setLongLabel(ent.displayName())
.setIcon(
IconCompat.createWithResource(
ctx,
activity,
R.drawable.ic_qu_shadowsocks_launcher
)
)
Expand All @@ -298,7 +298,7 @@ abstract class ProfileSettingsActivity<T : AbstractBean>(
}
)
.build()
ShortcutManagerCompat.requestPinShortcut(ctx, shortcut, null)
ShortcutManagerCompat.requestPinShortcut(activity, shortcut, null)
}

R.id.action_move -> {
Expand Down

0 comments on commit 11ecdba

Please sign in to comment.