ui: use AndroidX BundleCompat
for extracting parcelable
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
f13624c58f
commit
fb05b358c0
@ -7,7 +7,7 @@ buildscript {
|
|||||||
collectionVersion = '1.2.0'
|
collectionVersion = '1.2.0'
|
||||||
constraintLayoutVersion = '2.1.4'
|
constraintLayoutVersion = '2.1.4'
|
||||||
coordinatorLayoutVersion = '1.2.0'
|
coordinatorLayoutVersion = '1.2.0'
|
||||||
coreKtxVersion = '1.9.0'
|
coreKtxVersion = '1.10.0-rc01'
|
||||||
coroutinesVersion = '1.6.4'
|
coroutinesVersion = '1.6.4'
|
||||||
datastoreVersion = '1.0.0'
|
datastoreVersion = '1.0.0'
|
||||||
desugarVersion = '1.1.5'
|
desugarVersion = '1.1.5'
|
||||||
|
@ -19,6 +19,7 @@ import android.view.WindowManager
|
|||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.core.os.BundleCompat
|
||||||
import androidx.core.view.MenuProvider
|
import androidx.core.view.MenuProvider
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
@ -272,12 +273,7 @@ class TunnelEditorFragment : BaseFragment(), MenuProvider {
|
|||||||
onSelectedTunnelChanged(null, selectedTunnel)
|
onSelectedTunnelChanged(null, selectedTunnel)
|
||||||
} else {
|
} else {
|
||||||
tunnel = selectedTunnel
|
tunnel = selectedTunnel
|
||||||
val config: ConfigProxy = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
val config = BundleCompat.getParcelable(savedInstanceState, KEY_LOCAL_CONFIG, ConfigProxy::class.java)!!
|
||||||
savedInstanceState.getParcelable(KEY_LOCAL_CONFIG, ConfigProxy::class.java)!!
|
|
||||||
} else {
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
savedInstanceState.getParcelable(KEY_LOCAL_CONFIG)!!
|
|
||||||
}
|
|
||||||
val originalName = savedInstanceState.getString(KEY_ORIGINAL_NAME)
|
val originalName = savedInstanceState.getString(KEY_ORIGINAL_NAME)
|
||||||
if (tunnel != null && tunnel!!.name != originalName) onSelectedTunnelChanged(null, tunnel) else binding!!.config = config
|
if (tunnel != null && tunnel!!.name != originalName) onSelectedTunnelChanged(null, tunnel) else binding!!.config = config
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user