decimal hide is fixed

This commit is contained in:
kizzy 2025-12-11 15:11:14 +07:00
parent a071c53823
commit 52ee779e18
4 changed files with 75 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -108,6 +108,7 @@ public class InputAmountFragment extends DataBindingFragment implements DataBind
}else { }else {
isDecimalEnabled = decimalEnabled; isDecimalEnabled = decimalEnabled;
} }
View keyboardView = getView().findViewById(R.id.numberKeyboard); View keyboardView = getView().findViewById(R.id.numberKeyboard);
if (keyboardView instanceof NumberKeyboard) { if (keyboardView instanceof NumberKeyboard) {

View File

@ -183,6 +183,8 @@ public class QRTransactionFragment extends DataBindingFragment implements DataBi
initSetup(); initSetup();
calculateIntervalAndCount(); calculateIntervalAndCount();
LogUtil.d(TAG,"intervalInSec: "+intervalInSec+" totalCount: "+totalCount);
setUpTimeout(); setUpTimeout();
setUpCountDown(); setUpCountDown();

View File

@ -26,12 +26,35 @@ public class NumberKeyboard extends ViewGroup {
public void setDecimalEnable(boolean enable){ public void setDecimalEnable(boolean enable){
this.isDecimalEnable = enable; this.isDecimalEnable = enable;
View key = getChildAt(9); // index starts at 0
if (key instanceof TextView) {
key.setAlpha(enable ? 1f : 0.3f); View key = null;
if (Config.getInstance().IS_SETTING_NEW_INPUT_TYPE() && getChildCount() > 9) {
key = getChildAt(9);
} }
invalidate();
requestLayout();
if (key != null) {
key.setVisibility(enable ? View.VISIBLE : View.INVISIBLE);
if (enable) {
key.setBackgroundColor(getResources().getColor(R.color.white, null));
}
// If it's a TextView, let's also check its text content
if (key instanceof TextView) {
TextView tv = (TextView) key;
}
}
post(new Runnable() {
@Override
public void run() {
invalidate();
requestLayout();
}
});
} }
public void setKeyClickCallback(KeyClickCallback callback) { public void setKeyClickCallback(KeyClickCallback callback) {
@ -177,7 +200,7 @@ public class NumberKeyboard extends ViewGroup {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
final View child = getChildAt(i); final View child = getChildAt(i);
if (child.getVisibility() != GONE) { if (child.getVisibility() != GONE && child.getVisibility() != INVISIBLE) {
final int childW = child.getMeasuredWidth(); final int childW = child.getMeasuredWidth();
final int childH = child.getMeasuredHeight(); final int childH = child.getMeasuredHeight();
@ -189,6 +212,19 @@ public class NumberKeyboard extends ViewGroup {
child.layout(xPos, yPos, xPos + childW, yPos + childH); child.layout(xPos, yPos, xPos + childW, yPos + childH);
xPos += childW + hSpacing; xPos += childW + hSpacing;
} else if (child.getVisibility() == INVISIBLE) {
// For invisible views, we still need to maintain their space in the layout
// This ensures the keyboard layout doesn't shift when decimal key is hidden
final int childW = child.getMeasuredWidth();
final int childH = child.getMeasuredHeight();
int newline = i % 3;
if (newline == 0 && i != 0) {
xPos = getPaddingLeft();
yPos += mLineHeight;
}
child.layout(xPos, yPos, xPos + childW, yPos + childH);
xPos += childW + hSpacing;
} }
} }