Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesign request screen UI #1795

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@ fun MifosTopBar(
) {
CenterAlignedTopAppBar(
title = {
if (titleColor != null) {
Text(
text = stringResource(id = topBarTitle),
style = MaterialTheme.typography.titleMedium,
color = titleColor,
)
}
Text(
text = stringResource(id = topBarTitle),
style = MaterialTheme.typography.titleMedium,
color = titleColor ?: MaterialTheme.colorScheme.onSurface,
)
},
navigationIcon = {
IconBox(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import android.graphics.Bitmap
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
Expand All @@ -37,21 +36,20 @@ import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage
import org.mifospay.core.designsystem.component.MifosButton
import org.mifospay.core.designsystem.component.MifosOutlinedButton
import org.mifospay.core.designsystem.theme.MifosBlue

@Composable
internal fun ShowQrContent(
qrDataBitmap: Bitmap,
// qrDataString: String, // this parameter is not used in new figma design
showAmountDialog: () -> Unit,
modifier: Modifier = Modifier,
// amount: String? = null, // this parameter is not used in new figma design
onShare: () -> Unit,
) {
Box(
modifier = modifier
.fillMaxSize()
.background(
getColor(),
MifosBlue,
)
.padding(25.dp),
) {
Expand All @@ -76,7 +74,7 @@ internal fun ShowQrContent(
) {
Text(
text = stringResource(id = R.string.feature_request_money_title),
color = getColor(),
color = MifosBlue,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we still using MifosBlue? Didn’t we already change the theme?

Copy link
Contributor Author

@Nagarjuna0033 Nagarjuna0033 Oct 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@itsPronay dark theme for this is not provided for applying same figma theme for both dark mode and light mode i have used this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think since we've updated the theme for other screens, we should apply it here as well. Otherwise, it might appear inconsistent.
@niyajali what are your thoughts on this?

style = MaterialTheme.typography.titleLarge,
fontWeight = FontWeight.SemiBold,
)
Expand All @@ -99,7 +97,7 @@ internal fun ShowQrContent(
) {
Text(
text = stringResource(id = R.string.feature_request_money_set_amount),
color = getColor(),
color = MifosBlue,
)
}
MifosOutlinedButton(
Expand All @@ -121,12 +119,3 @@ internal fun ShowQrContent(
}
}
}

@Composable
private fun getColor(): Color {
return if (isSystemInDarkTheme()) {
Color(0xFF0673BA)
} else {
MaterialTheme.colorScheme.primary
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import android.content.Intent
import android.content.Intent.createChooser
import android.graphics.Bitmap
import android.net.Uri
import android.util.Log
import android.view.WindowManager
import androidx.annotation.VisibleForTesting
import androidx.compose.foundation.background
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
Expand All @@ -41,6 +41,7 @@ import org.koin.androidx.compose.koinViewModel
import org.mifospay.core.designsystem.component.MfLoadingWheel
import org.mifospay.core.designsystem.component.MifosScaffold
import org.mifospay.core.designsystem.icon.MifosIcons
import org.mifospay.core.designsystem.theme.MifosBlue
import org.mifospay.core.ui.EmptyContentScreen
import org.mifospay.feature.request.money.util.ImageUtils

Expand All @@ -51,13 +52,11 @@ internal fun ShowQrScreenRoute(
viewModel: ShowQrViewModel = koinViewModel(),
) {
val uiState by viewModel.showQrUiState.collectAsStateWithLifecycle()
// val vpaId by viewModel.vpaId.collectAsStateWithLifecycle()

UpdateBrightness()

ShowQrScreen(
uiState = uiState,
// vpaId = vpaId,
backPress = backPress,
generateQR = viewModel::generateQr,
modifier = modifier,
Expand All @@ -68,7 +67,6 @@ internal fun ShowQrScreenRoute(
@VisibleForTesting
internal fun ShowQrScreen(
uiState: ShowQrUiState,
// vpaId: String,
backPress: () -> Unit,
generateQR: (RequestQrData) -> Unit,
modifier: Modifier = Modifier,
Expand Down Expand Up @@ -106,12 +104,11 @@ internal fun ShowQrScreen(
} else {
qrBitmap = uiState.qrDataBitmap
ShowQrContent(
// qrDataString = vpaId,
// amount = amount,
qrDataBitmap = uiState.qrDataBitmap,
showAmountDialog = { amountDialogState = true },
onShare = {
qrBitmap?.let {
Log.d("yesyesyes", it.toString())
val uri = ImageUtils.saveImage(context = context, bitmap = it)
shareQr(context, uri = uri)
}
Expand All @@ -132,7 +129,7 @@ internal fun ShowQrScreen(
}
}
},
modifier = modifier.background(getScaffoldBackgroundColor()),
modifier = modifier.background(MifosBlue),
)

if (amountDialogState) {
Expand Down Expand Up @@ -200,15 +197,6 @@ internal class ShowQrUiStateProvider :
)
}

@Composable
private fun getScaffoldBackgroundColor(): Color {
return if (isSystemInDarkTheme()) {
Color(0xFF0673BA)
} else {
MaterialTheme.colorScheme.primary
}
}

@Preview(showSystemUi = true)
@Composable
private fun ShowQrScreenPreview(
Expand All @@ -217,7 +205,6 @@ private fun ShowQrScreenPreview(
) {
ShowQrScreen(
uiState = uiState,
// vpaId = "",
backPress = {},
generateQR = {},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import android.graphics.Bitmap
import android.net.Uri
import android.util.Log
import androidx.core.content.FileProvider
import org.mifospay.feature.request.money.BuildConfig
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
Expand All @@ -32,7 +31,7 @@ object ImageUtils {
stream.close()
uri = FileProvider.getUriForFile(
context,
BuildConfig.LIBRARY_PACKAGE_NAME + ".provider", file,
context.packageName + ".provider", file,
)
} catch (e: IOException) {
Log.d("Error", e.message.toString())
Expand Down
Loading