Skip to content

Commit d1c1d16

Browse files
committed
Address a few dependency API deprecations
1 parent 6f872f4 commit d1c1d16

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

app/src/main/java/com/hiddenramblings/tagmo/BrowserSettings.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ open class BrowserSettings : Parcelable {
2626
companion object {
2727
fun valueOf(value: Int): SORT {
2828
if (Version.isNougat) {
29-
val optional = Arrays.stream(values()).filter {
29+
val optional = Arrays.stream(entries.toTypedArray()).filter {
3030
sort: SORT -> sort.value == value
3131
}.findFirst()
3232
if (optional.isPresent) return optional.get()
3333
} else {
34-
for (view in values()) {
34+
for (view in entries) {
3535
if (view.value == value) return view
3636
}
3737
}
@@ -50,12 +50,12 @@ open class BrowserSettings : Parcelable {
5050
companion object {
5151
fun valueOf(value: Int): VIEW {
5252
if (Version.isNougat) {
53-
val optional = Arrays.stream(values()).filter {
53+
val optional = Arrays.stream(entries.toTypedArray()).filter {
5454
view: VIEW -> view.value == value
5555
}.findFirst()
5656
if (optional.isPresent) return optional.get()
5757
} else {
58-
for (view in values()) {
58+
for (view in entries) {
5959
if (view.value == value) return view
6060
}
6161
}

app/src/main/java/com/hiddenramblings/tagmo/nfctech/NfcByte.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,8 @@ object NfcByte {
4444
val POWERTAG_WRITE = TagArray.hexToByteArray("a000")
4545
@JvmField
4646
val POWERTAG_SIG = TagArray.hexToByteArray("3c00")
47+
48+
private fun generatePowerTagId(): ByteArray {
49+
return Foomiibo.generateRandomUID().plus(ByteArray(7))
50+
}
4751
}

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import androidx.documentfile.provider.DocumentFile
2424
import com.google.android.play.core.appupdate.AppUpdateInfo
2525
import com.google.android.play.core.appupdate.AppUpdateManager
2626
import com.google.android.play.core.appupdate.AppUpdateManagerFactory
27+
import com.google.android.play.core.appupdate.AppUpdateOptions
2728
import com.google.android.play.core.install.model.AppUpdateType
2829
import com.google.android.play.core.install.model.UpdateAvailability
2930
import com.hiddenramblings.tagmo.BrowserActivity
@@ -231,9 +232,9 @@ class UpdateManager internal constructor(activity: BrowserActivity) {
231232
private fun startPlayUpdateFlow(appUpdateInfo: AppUpdateInfo?) {
232233
try {
233234
appUpdateManager?.startUpdateFlowForResult( // Pass the intent that is returned by 'getAppUpdateInfo()'.
234-
appUpdateInfo!!, // Or 'AppUpdateType.FLEXIBLE' for flexible updates.
235-
AppUpdateType.IMMEDIATE, // The current activity making the update request.
236-
browserActivity, // Include a request code to later monitor this update request.
235+
appUpdateInfo!!,
236+
browserActivity,
237+
AppUpdateOptions.defaultOptions(AppUpdateType.IMMEDIATE),
237238
Random.nextInt()
238239
)
239240
} catch (ex: SendIntentException) {

0 commit comments

Comments
 (0)