diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2023-03-27 16:11:30 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2023-03-27 16:11:30 +0530 |
commit | fb05b358c07d8dca44ee472dbd0edbfa0a564336 (patch) | |
tree | 667742545e1bd2dcd2eee9b04d01ddeb240c42f1 /ui/src/main/java/com/wireguard/android | |
parent | f13624c58f0b8b46d3fd9958fe83f1631736cd45 (diff) |
ui: use AndroidX `BundleCompat` for extracting parcelable
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'ui/src/main/java/com/wireguard/android')
-rw-r--r-- | ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt b/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt index c4c031fa..7a8b822e 100644 --- a/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt +++ b/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt @@ -19,6 +19,7 @@ import android.view.WindowManager import android.view.inputmethod.InputMethodManager import android.widget.EditText import android.widget.Toast +import androidx.core.os.BundleCompat import androidx.core.view.MenuProvider import androidx.lifecycle.Lifecycle import androidx.lifecycle.lifecycleScope @@ -272,12 +273,7 @@ class TunnelEditorFragment : BaseFragment(), MenuProvider { onSelectedTunnelChanged(null, selectedTunnel) } else { tunnel = selectedTunnel - val config: ConfigProxy = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - savedInstanceState.getParcelable(KEY_LOCAL_CONFIG, ConfigProxy::class.java)!! - } else { - @Suppress("DEPRECATION") - savedInstanceState.getParcelable(KEY_LOCAL_CONFIG)!! - } + val config = BundleCompat.getParcelable(savedInstanceState, KEY_LOCAL_CONFIG, ConfigProxy::class.java)!! val originalName = savedInstanceState.getString(KEY_ORIGINAL_NAME) if (tunnel != null && tunnel!!.name != originalName) onSelectedTunnelChanged(null, tunnel) else binding!!.config = config } |