Skip to content

Commit 897da44

Browse files
committed
Fix some incorrect adapter count calculations
1 parent 92d6999 commit 897da44

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

app/src/main/java/com/hiddenramblings/tagmo/fragment/EliteBankFragment.kt

+6-2
Original file line numberDiff line numberDiff line change
@@ -378,12 +378,16 @@ class EliteBankFragment : Fragment(), EliteBankAdapter.OnAmiiboClickListener {
378378
// bankAdapter?.notifyItemChanged(i)
379379
}
380380
}
381-
bankAdapter?.notifyItemRangeChanged(0, currentSize)
381+
382382
if (updateSize > currentSize) {
383-
bankAdapter?.notifyItemRangeInserted(currentSize, updateSize)
383+
bankAdapter?.notifyItemRangeChanged(0, currentSize)
384+
bankAdapter?.notifyItemRangeInserted(currentSize, updateSize - currentSize)
384385
} else if (currentSize > updateSize) {
385386
amiibos.subList(0, currentSize - updateSize).clear()
387+
bankAdapter?.notifyItemRangeChanged(0, updateSize)
386388
bankAdapter?.notifyItemRangeRemoved(updateSize, currentSize - updateSize)
389+
} else {
390+
bankAdapter?.notifyItemRangeChanged(0, updateSize)
387391
}
388392
}
389393
refreshListener?.onListRefreshed(amiibos)

app/src/main/java/com/hiddenramblings/tagmo/update/UpdateReceiver.kt

+6-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ class UpdateReceiver : BroadcastReceiver() {
3939
try {
4040
startLauncherActivity(context, Intent.parseUri(
4141
it.toUri(0),
42-
if (Version.isLollipopMR) Intent.URI_ALLOW_UNSAFE else 0
42+
if (Version.isLollipopMR)
43+
Intent.URI_ALLOW_UNSAFE or Intent.URI_INTENT_SCHEME
44+
else
45+
Intent.URI_INTENT_SCHEME
4346
))
4447
} catch (_: URISyntaxException) { }
4548
} ?: Toasty(context).Long(R.string.install_rejected)
@@ -66,7 +69,7 @@ class UpdateReceiver : BroadcastReceiver() {
6669
}
6770
}
6871

69-
private fun startLauncherActivity(context: Context, intent: Intent?) {
70-
context.startActivity(intent?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
72+
private fun startLauncherActivity(context: Context, intent: Intent) {
73+
context.startActivity(intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
7174
}
7275
}

0 commit comments

Comments
 (0)