Skip to content

Commit

Permalink
Fix some incorrect adapter count calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
AbandonedCart committed Jan 20, 2025
1 parent 92d6999 commit 897da44
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,16 @@ class EliteBankFragment : Fragment(), EliteBankAdapter.OnAmiiboClickListener {
// bankAdapter?.notifyItemChanged(i)
}
}
bankAdapter?.notifyItemRangeChanged(0, currentSize)

if (updateSize > currentSize) {
bankAdapter?.notifyItemRangeInserted(currentSize, updateSize)
bankAdapter?.notifyItemRangeChanged(0, currentSize)
bankAdapter?.notifyItemRangeInserted(currentSize, updateSize - currentSize)
} else if (currentSize > updateSize) {
amiibos.subList(0, currentSize - updateSize).clear()
bankAdapter?.notifyItemRangeChanged(0, updateSize)
bankAdapter?.notifyItemRangeRemoved(updateSize, currentSize - updateSize)
} else {
bankAdapter?.notifyItemRangeChanged(0, updateSize)
}
}
refreshListener?.onListRefreshed(amiibos)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ class UpdateReceiver : BroadcastReceiver() {
try {
startLauncherActivity(context, Intent.parseUri(
it.toUri(0),
if (Version.isLollipopMR) Intent.URI_ALLOW_UNSAFE else 0
if (Version.isLollipopMR)
Intent.URI_ALLOW_UNSAFE or Intent.URI_INTENT_SCHEME
else
Intent.URI_INTENT_SCHEME
))
} catch (_: URISyntaxException) { }
} ?: Toasty(context).Long(R.string.install_rejected)
Expand All @@ -66,7 +69,7 @@ class UpdateReceiver : BroadcastReceiver() {
}
}

private fun startLauncherActivity(context: Context, intent: Intent?) {
context.startActivity(intent?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
private fun startLauncherActivity(context: Context, intent: Intent) {
context.startActivity(intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
}
}

0 comments on commit 897da44

Please sign in to comment.