NTP-30296 | Sidharth Bamba | keyboard changes on clicking view history (#14883)

This commit is contained in:
Sidharth Bamba
2025-02-10 13:41:02 +05:30
committed by GitHub
parent 2181e07de5
commit 90c33d1ddc
2 changed files with 42 additions and 0 deletions

View File

@@ -7,6 +7,8 @@
package com.navi.bbps.feature.paybill.ui
import android.content.Context
import android.view.View
import androidx.activity.compose.BackHandler
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
@@ -42,6 +44,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.key
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -56,6 +59,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.platform.SoftwareKeyboardController
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
@@ -624,6 +628,8 @@ fun PayBillScreenV2(
offerData = offerDataList,
payBillHeaderState = payBillHeaderState,
billCategoryEntity = billCategoryEntity,
context = context,
view = view,
)
Spacer(Modifier.weight(1f))
Spacer(modifier = Modifier.height(16.dp))
@@ -658,6 +664,9 @@ fun PayBillScreenV2(
billCategoryEntity = billCategoryEntity,
removeDiscountOnViewHistoryClicked =
payBillViewModelV2::onRemoveDiscountClicked,
keyboardController = keyboardController,
context = context,
view = view,
)
AmountTextFieldV2(
modifier = Modifier.fillMaxWidth().padding(top = 32.dp),
@@ -1199,7 +1208,11 @@ fun onBillHistoryClicked(
billCategoryEntity: BillCategoryEntity,
billDetailsEntity: BillDetailsEntity?,
removeDiscountAnimationPostNavigation: () -> Unit,
keyboardController: SoftwareKeyboardController?,
context: Context,
view: View,
) {
keyboardController?.customHide(context = context, view = view)
if (myBillEntity != null) {
removeDiscountAnimationPostNavigation.invoke()
navigator.navigate(
@@ -1666,6 +1679,9 @@ private fun RenderPayBillDetailSection(
formattedLastPaidDate: String,
billCategoryEntity: BillCategoryEntity,
removeDiscountOnViewHistoryClicked: () -> Unit,
keyboardController: SoftwareKeyboardController?,
context: Context,
view: View,
) {
Column(
verticalArrangement = Arrangement.Center,
@@ -1702,6 +1718,9 @@ private fun RenderPayBillDetailSection(
billCategoryEntity = billCategoryEntity,
billDetailsEntity = billDetailsEntity,
removeDiscountAnimationPostNavigation = removeDiscountOnViewHistoryClicked,
keyboardController = keyboardController,
context = context,
view = view,
)
},
horizontalArrangement = Arrangement.Center,
@@ -1867,6 +1886,9 @@ fun ViewHistory(
payBillHeaderState: PayBillHeaderState?,
billCategoryEntity: BillCategoryEntity,
billDetailsEntity: BillDetailsEntity,
keyboardController: SoftwareKeyboardController?,
context: Context,
view: View,
) {
Row(
modifier =
@@ -1880,6 +1902,9 @@ fun ViewHistory(
billCategoryEntity = billCategoryEntity,
billDetailsEntity = billDetailsEntity,
removeDiscountAnimationPostNavigation = {},
keyboardController = keyboardController,
context = context,
view = view,
)
},
horizontalArrangement = Arrangement.Center,

View File

@@ -7,6 +7,8 @@
package com.navi.bbps.feature.paybill.ui
import android.content.Context
import android.view.View
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.shrinkVertically
import androidx.compose.foundation.BorderStroke
@@ -41,6 +43,7 @@ import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.platform.SoftwareKeyboardController
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
@@ -126,6 +129,8 @@ fun RenderCreditCardPayBillScreenV2(
offerData: List<OfferData>?,
payBillHeaderState: PayBillHeaderState?,
billCategoryEntity: BillCategoryEntity,
context: Context,
view: View,
) {
val keyboardController = LocalSoftwareKeyboardController.current
val focusRequester = remember { FocusRequester() }
@@ -179,6 +184,9 @@ fun RenderCreditCardPayBillScreenV2(
navigator = navigator,
initialSource = "",
billCategoryEntity = billCategoryEntity,
keyboardController = keyboardController,
context = context,
view = view,
)
} else {
ViewHistory(
@@ -189,6 +197,9 @@ fun RenderCreditCardPayBillScreenV2(
payBillScreenSource = payBillScreenSource,
billCategoryEntity = billCategoryEntity,
billDetailsEntity = payBillScreenState.billDetailsEntity,
keyboardController = keyboardController,
context = context,
view = view,
)
}
@@ -649,6 +660,9 @@ fun CreditCardBillHistorySection(
navigator: DestinationsNavigator,
initialSource: String,
billCategoryEntity: BillCategoryEntity,
keyboardController: SoftwareKeyboardController?,
context: Context,
view: View,
) {
Row(
modifier =
@@ -662,6 +676,9 @@ fun CreditCardBillHistorySection(
billCategoryEntity = billCategoryEntity,
billDetailsEntity = null,
removeDiscountAnimationPostNavigation = {},
keyboardController = keyboardController,
context = context,
view = view,
)
},
verticalAlignment = Alignment.CenterVertically,