Skip to content

Commit

Permalink
Added PopupLoadingIndicator to fill the entire screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Maik Mursall committed Aug 15, 2022
1 parent dea8be2 commit 371cbac
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package com.fintecsystems.xs2awizard

import android.app.Activity
import androidx.compose.foundation.*
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.*
import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import com.fintecsystems.xs2awizard.components.LoadingIndicator
import com.fintecsystems.xs2awizard.components.XS2AWizardConfig
import com.fintecsystems.xs2awizard.components.XS2AWizardViewModel
import com.fintecsystems.xs2awizard.components.loadingIndicator.PopupLoadingIndicator
import com.fintecsystems.xs2awizard.components.networking.ConnectionState
import com.fintecsystems.xs2awizard.components.networking.ConnectivityStatusBanner
import com.fintecsystems.xs2awizard.components.theme.XS2ATheme
Expand Down Expand Up @@ -85,7 +88,7 @@ fun XS2AWizard(
}

if (loadingIndicatorLock) {
LoadingIndicator(
PopupLoadingIndicator(
modifier = Modifier
.fillMaxSize()
.clickable(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fintecsystems.xs2awizard.components
package com.fintecsystems.xs2awizard.components.loadingIndicator

import androidx.compose.foundation.layout.Box
import androidx.compose.material.CircularProgressIndicator
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.fintecsystems.xs2awizard.components.loadingIndicator

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.IntRect
import androidx.compose.ui.unit.IntSize
import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.window.Popup
import androidx.compose.ui.window.PopupPositionProvider

@Composable
fun PopupLoadingIndicator(
modifier: Modifier = Modifier,
) {
val popupPositionProvider = object : PopupPositionProvider {
override fun calculatePosition(
anchorBounds: IntRect,
windowSize: IntSize,
layoutDirection: LayoutDirection,
popupContentSize: IntSize
): IntOffset {
return IntOffset.Zero
}
}

Popup(popupPositionProvider = popupPositionProvider) {
LoadingIndicator(modifier)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Modifier
import com.fintecsystems.xs2awizard.components.LoadingIndicator
import com.fintecsystems.xs2awizard.components.loadingIndicator.LoadingIndicator
import com.fintecsystems.xs2awizard.components.XS2AWizardViewModel
import com.fintecsystems.xs2awizard.form.AutoSubmitLineData
import kotlinx.coroutines.delay
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import androidx.compose.ui.unit.sp
import androidx.compose.ui.unit.toSize
import androidx.compose.ui.window.PopupProperties
import com.fintecsystems.xs2awizard.R
import com.fintecsystems.xs2awizard.components.LoadingIndicator
import com.fintecsystems.xs2awizard.components.loadingIndicator.LoadingIndicator
import com.fintecsystems.xs2awizard.components.XS2AWizardViewModel
import com.fintecsystems.xs2awizard.components.theme.XS2ATheme
import com.fintecsystems.xs2awizard.form.TextLineData
Expand Down

0 comments on commit 371cbac

Please sign in to comment.