decimal hide is fixed
This commit is contained in:
parent
a071c53823
commit
52ee779e18
File diff suppressed because one or more lines are too long
@ -108,6 +108,7 @@ public class InputAmountFragment extends DataBindingFragment implements DataBind
|
||||
}else {
|
||||
isDecimalEnabled = decimalEnabled;
|
||||
}
|
||||
|
||||
View keyboardView = getView().findViewById(R.id.numberKeyboard);
|
||||
|
||||
if (keyboardView instanceof NumberKeyboard) {
|
||||
|
||||
@ -183,6 +183,8 @@ public class QRTransactionFragment extends DataBindingFragment implements DataBi
|
||||
|
||||
initSetup();
|
||||
calculateIntervalAndCount();
|
||||
|
||||
LogUtil.d(TAG,"intervalInSec: "+intervalInSec+" totalCount: "+totalCount);
|
||||
setUpTimeout();
|
||||
setUpCountDown();
|
||||
|
||||
|
||||
@ -26,13 +26,36 @@ public class NumberKeyboard extends ViewGroup {
|
||||
|
||||
public void setDecimalEnable(boolean 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);
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
this.mKeyClickCallback = callback;
|
||||
@ -177,7 +200,7 @@ public class NumberKeyboard extends ViewGroup {
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
final View child = getChildAt(i);
|
||||
if (child.getVisibility() != GONE) {
|
||||
if (child.getVisibility() != GONE && child.getVisibility() != INVISIBLE) {
|
||||
final int childW = child.getMeasuredWidth();
|
||||
final int childH = child.getMeasuredHeight();
|
||||
|
||||
@ -189,6 +212,19 @@ public class NumberKeyboard extends ViewGroup {
|
||||
child.layout(xPos, yPos, xPos + childW, yPos + childH);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user