Pratinjau Developer untuk Android 11 kini tersedia; uji dan sampaikan masukan Anda.

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
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.

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.

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.androidx.activity.result.ActivityResultCaller
() -> Unit
ActivityResultCaller.prepareCall(contract: ActivityResultContract<I, O>, input: I, registry: ActivityResultRegistry, crossinline callback: (O) -> Unit)

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

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

A version of ActivityResultCaller.prepareCall 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.

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

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)