Google 致力于为黑人社区推动种族平等。查看具体举措

DefaultProgressFragment

class DefaultProgressFragment : AbstractProgressFragment
kotlin.Any
   ↳ androidx.fragment.app.Fragment
   ↳ androidx.navigation.dynamicfeatures.fragment.ui.AbstractProgressFragment
   ↳ androidx.navigation.dynamicfeatures.fragment.ui.DefaultProgressFragment

The default androidx.fragment.app.Fragment to display during installation progress.

This Fragment provides a default UI and handles split install state changes so you don't have to deal with this.

To create a custom progress fragment, extend AbstractProgressFragment.

Summary

Public constructors

The default androidx.fragment.app.Fragment to display during installation progress.

Public methods
Unit

Unit
onViewCreated(view: View, savedInstanceState: Bundle?)

Protected methods
Unit

Called when the user decided to cancel installation.

Unit
onFailed(errorCode: Int)

Called when the installation has failed due to non-user issues.

Unit
onProgress(status: Int, bytesDownloaded: Long, bytesTotal: Long)

Called when there was a progress update for an active module download.

Inherited functions
Inherited extension functions
From androidx.fragment.app
Lazy<VM>
Fragment.activityViewModels(noinline factoryProducer: () -> ViewModelProvider.Factory = null)

Returns a property delegate to access parent activity's ViewModel, if factoryProducer is specified then ViewModelProvider.Factory returned by it will be used to create ViewModel first time.

Unit

Clears the stored result for the given requestKey.

Unit

Clears the stored FragmentResultListener for the given requestKey.

Lazy<VM>
Fragment.createViewModelLazy(viewModelClass: KClass<VM>, storeProducer: () -> ViewModelStore, factoryProducer: () -> ViewModelProvider.Factory = null)

Helper method for creation of ViewModelLazy, that resolves null passed as factoryProducer to default factory.

Unit
Fragment.setFragmentResult(requestKey: String, result: Bundle)

Sets the given result for the requestKey.

Unit
Fragment.setFragmentResultListener(requestKey: String, crossinline listener: (requestKey: String, bundle: Bundle) -> Unit)

Sets the FragmentResultListener for a given requestKey.

Lazy<VM>
Fragment.viewModels(noinline ownerProducer: () -> ViewModelStoreOwner = { this }, noinline factoryProducer: () -> ViewModelProvider.Factory = null)

Returns a property delegate to access ViewModel by default scoped to this Fragment:

From androidx.navigation.fragment
NavController

Find a NavController given a Fragment

NavArgsLazy<Args>

Returns a Lazy delegate to access the Fragment's arguments as an Args instance.

From androidx.navigation
Lazy<VM>
Fragment.navGraphViewModels(@IdRes navGraphId: Int, noinline factoryProducer: () -> ViewModelProvider.Factory = null)

Returns a property delegate to access a ViewModel scoped to a navigation graph present on the {@link NavController} back stack:

From androidx.activity.result
ActivityResultLauncher<Unit>
ActivityResultCaller.registerForActivityResult(contract: ActivityResultContract<I, O>, input: I, registry: ActivityResultRegistry, callback: (O) -> Unit)

A version of ActivityResultCaller.registerForActivityResult that additionally takes an input right away, producing a launcher that doesn't take any additional input when called.

ActivityResultLauncher<Unit>
ActivityResultCaller.registerForActivityResult(contract: ActivityResultContract<I, O>, input: I, callback: (O) -> Unit)

A version of ActivityResultCaller.registerForActivityResult that additionally takes an input right away, producing a launcher that doesn't take any additional input when called.

From androidx.lifecycle
suspend T
LifecycleOwner.whenCreated(block: suspend CoroutineScope.() -> T)

Runs the given block when the LifecycleOwner's Lifecycle is at least in Lifecycle.State.CREATED state.

suspend T
LifecycleOwner.whenResumed(block: suspend CoroutineScope.() -> T)

Runs the given block when the LifecycleOwner's Lifecycle is at least in Lifecycle.State.RESUMED state.

suspend T
LifecycleOwner.whenStarted(block: suspend CoroutineScope.() -> T)

Runs the given block when the LifecycleOwner's Lifecycle is at least in Lifecycle.State.STARTED state.

suspend R
LifecycleOwner.withCreated(crossinline block: () -> R)

Run block with this LifecycleOwner's Lifecycle in a Lifecycle.State of at least Lifecycle.State.CREATED and resume with the result.

suspend R
LifecycleOwner.withResumed(crossinline block: () -> R)

Run block with this LifecycleOwner's Lifecycle in a Lifecycle.State of at least Lifecycle.State.RESUMED and resume with the result.

suspend R
LifecycleOwner.withStarted(crossinline block: () -> R)

Run block with this LifecycleOwner's Lifecycle in a Lifecycle.State of at least Lifecycle.State.STARTED and resume with the result.

suspend R
LifecycleOwner.withStateAtLeast(state: Lifecycle.State, crossinline block: () -> R)

Run block with this LifecycleOwner's Lifecycle in a Lifecycle.State of at least state and resume with the result.

Inherited extension properties
From androidx.lifecycle
LifecycleCoroutineScope

CoroutineScope tied to this LifecycleOwner's Lifecycle.

Public constructors

<init>

DefaultProgressFragment()

The default androidx.fragment.app.Fragment to display during installation progress.

This Fragment provides a default UI and handles split install state changes so you don't have to deal with this.

To create a custom progress fragment, extend AbstractProgressFragment.

Public methods

onDestroyView

fun onDestroyView(): Unit

onViewCreated

fun onViewCreated(
    view: View,
    savedInstanceState: Bundle?
): Unit

Protected methods

onCancelled

protected fun onCancelled(): Unit

Called when the user decided to cancel installation.

onFailed

protected fun onFailed(errorCode: Int): Unit

Called when the installation has failed due to non-user issues.

Please check SplitInstallErrorCode for error code constants.

Parameters
errorCode: Int contains the error code of the installation failure.

onProgress

protected fun onProgress(
    status: Int,
    bytesDownloaded: Long,
    bytesTotal: Long
): Unit

Called when there was a progress update for an active module download.

Parameters
status: Int the current installation status from SplitInstallSessionStatus
bytesDownloaded: Long The bytes downloaded so far.
bytesTotal: Long The total bytes to be downloaded (can be 0 for some status updates)